FlowArithmeticCalculator 1.0.0
Flow Arithmetic Calculator
Loading...
Searching...
No Matches
gui::elements::SkiaBlocksManagerRenderer Class Reference

Class that extends business_logic::BlocksManager and adds rendering logic. More...

#include <SkiaBlocksManagerRenderer.h>

+ Inheritance diagram for gui::elements::SkiaBlocksManagerRenderer:
+ Collaboration diagram for gui::elements::SkiaBlocksManagerRenderer:

Public Member Functions

 SkiaBlocksManagerRenderer (business_logic::delegate::IWindowDelegate *windowDelegate)
 
void render (SkCanvas *canvas, const business_logic::geometry::Size2D &size, gui::renderer::delegate::UIRendererDelegate< SkCanvas > *&uiRendererDelegate)
 Renders the blocks on the canvas.
 
void maybeRenderDraggedLine (SkCanvas *canvas)
 Renders the dragged line on the canvas.
 
- Public Member Functions inherited from business_logic::BlocksManager
 BlocksManager (business_logic::delegate::IWindowDelegate *windowDelegate)
 
 ~BlocksManager () noexcept override=default
 
 BlocksManager (const BlocksManager &)=delete
 
BlocksManageroperator= (const BlocksManager &)=delete
 
 BlocksManager (BlocksManager &&)=delete
 
BlocksManageroperator= (BlocksManager &&)=delete
 
void handleMouseDown ()
 Handles the mouse down event.
 
void handleMouseUp ()
 Handles the mouse up event.
 
void handleMouseMove (int x, int y)
 Handles the mouse move event.
 
void handleNumericKeyPress (int number)
 Handles the numeric key press event.
 
void handleEscapeKeyPress ()
 Handles the ESC key press event.
 
std::optional< std::shared_ptr< business_logic::elements::blocks::BaseBlock > > getBlockAtMousePos ()
 Gets the block at the mouse position.
 
std::optional< std::shared_ptr< business_logic::elements::blocks::BaseBlock > > getBlockAt (int x, int y)
 Gets the block at the given coordinates.
 
void onNewBlockChoice (const business_logic::elements::blocks::BlockType &blockType) override
 Called when a new block is chosen to be added to the canvas.
 
void setActiveChoicesInput (business_logic::input::InputChoiceInteraction< business_logic::elements::blocks::BlockType > &&inputChoiceInteraction)
 Sets the input callback; this will override rendering other entities.
 
bool hasActiveChoicesInput () const
 Checks if the input callback is active.
 
void clearActiveChoicesInput ()
 Clears the active input choices and the corresponding generated UI texts rows.
 
void onPortsConnected (const business_logic::elements::structures::BlocksConnectionSide &source, const business_logic::elements::structures::BlocksConnectionSide &dest) override
 Invoked when a connection is made between two ports + blocks (sides)
 
bool hasConnectionBetween (const business_logic::elements::structures::BlocksConnectionSide &source, const business_logic::elements::structures::BlocksConnectionSide &dest) const override
 Checks if there is a connection between two entities.
 
bool isInputConnected (const business_logic::elements::structures::BlocksConnectionSide &side) const override
 Checks if the input port is connected to anything.
 
void onBlockDeleted (const business_logic::elements::blocks::BaseBlock *block) override
 Called when a block is deleted.
 
void handleRightClickOnBlock (const std::shared_ptr< business_logic::elements::blocks::BaseBlock > &block)
 Handles right click event on a block.
 
const std::vector< std::shared_ptr< business_logic::elements::blocks::BaseBlock > > & getBlocks () const override
 Gets the blocks.
 
const std::unordered_map< business_logic::elements::structures::BlocksConnectionSide, std::unordered_set< business_logic::elements::structures::BlocksConnectionSide > > & getConnectionsRegistry () const override
 Gets the connections registry.
 
- Public Member Functions inherited from business_logic::delegate::INewBlockChoiceDelegate
virtual ~INewBlockChoiceDelegate ()=default
 
- Public Member Functions inherited from business_logic::delegate::IBlockLifecycleManagerDelegate
virtual ~IBlockLifecycleManagerDelegate ()=default
 
- Public Member Functions inherited from business_logic::calculations::delegate::IBlocksRegistryDelegate
 IBlocksRegistryDelegate ()=default
 
virtual ~IBlocksRegistryDelegate ()=default
 
 IBlocksRegistryDelegate (const IBlocksRegistryDelegate &)=delete
 
IBlocksRegistryDelegateoperator= (const IBlocksRegistryDelegate &)=delete
 
 IBlocksRegistryDelegate (IBlocksRegistryDelegate &&)=delete
 
IBlocksRegistryDelegateoperator= (IBlocksRegistryDelegate &&)=delete
 
- Public Member Functions inherited from business_logic::calculations::BlocksCalculator
 BlocksCalculator (business_logic::calculations::delegate::IBlocksRegistryDelegate *blocksRegistryDelegate)
 
virtual ~BlocksCalculator () noexcept=default
 
 BlocksCalculator (const BlocksCalculator &)=delete
 
BlocksCalculatoroperator= (const BlocksCalculator &)=delete
 
 BlocksCalculator (BlocksCalculator &&)=delete
 
BlocksCalculatoroperator= (BlocksCalculator &&)=delete
 
void calculateValuesFlow ()
 Calculates the values flowing through the graph.
 
- Public Member Functions inherited from business_logic::Loggable< BlocksCalculator >
 Loggable ()
 
- Public Member Functions inherited from business_logic::Loggable< BlocksManager >
 Loggable ()
 

Static Private Attributes

static SkPaint connectorPaint
 
static SkPaint cycleConnectorPaint
 

Additional Inherited Members

- Protected Member Functions inherited from business_logic::calculations::BlocksCalculator
void calculateBlockValues (business_logic::elements::blocks::BaseBlock *block)
 Calculates the values of the dependencies of a block and then the block itself.
 
std::optional< std::unordered_set< business_logic::elements::structures::BlocksConnectionSide > > hasCycle (elements::structures::BlocksConnectionSide side)
 Checks if there is a cycle in the graph.
 
- Protected Attributes inherited from business_logic::BlocksManager
std::vector< std::shared_ptr< business_logic::elements::blocks::BaseBlock > > blocks
 
business_logic::elements::blocks::BaseBlockdraggedBlock
 
int mouseX
 
int mouseY
 
business_logic::geometry::Size2D dragOffset
 
std::chrono::steady_clock::time_point doubleClickCtLastMouseClickTime
 
business_logic::delegate::IWindowDelegatewindowDelegate
 
std::optional< business_logic::input::InputChoiceInteraction< business_logic::elements::blocks::BlockType > > inputChoiceInteraction
 
business_logic::input::ConnectPortsInteraction connectPortsInteraction
 
std::vector< components::UITextsRowinputChoicesUiTextsRows
 
std::unordered_map< business_logic::elements::structures::BlocksConnectionSide, std::unordered_set< business_logic::elements::structures::BlocksConnectionSide > > connectionsRegistry
 
std::optional< std::unordered_set< business_logic::elements::structures::BlocksConnectionSide > > maybeGraphCycle
 
- Protected Attributes inherited from business_logic::calculations::BlocksCalculator
std::unordered_set< business_logic::elements::structures::BlocksConnectionSidevisited
 The set of visited blocks to detect cycles.
 
std::unordered_set< business_logic::elements::structures::BlocksConnectionSiderecursionStack
 The stack of recursion to detect cycles.
 
std::unordered_set< business_logic::elements::blocks::BaseBlock * > calcVisited
 The set of visited blocks to note which blocks have been visited when calculating their values.
 
business_logic::calculations::delegate::IBlocksRegistryDelegateblocksRegistryDelegate
 The delegate that provides the connections registry.
 
- Protected Attributes inherited from business_logic::Loggable< BlocksCalculator >
std::shared_ptr< spdlog::logger > logger
 
- Protected Attributes inherited from business_logic::Loggable< BlocksManager >
std::shared_ptr< spdlog::logger > logger
 

Detailed Description

Class that extends business_logic::BlocksManager and adds rendering logic.

Definition at line 23 of file SkiaBlocksManagerRenderer.h.

Constructor & Destructor Documentation

◆ SkiaBlocksManagerRenderer()

gui::elements::SkiaBlocksManagerRenderer::SkiaBlocksManagerRenderer ( business_logic::delegate::IWindowDelegate windowDelegate)
inlineexplicit

Definition at line 25 of file SkiaBlocksManagerRenderer.h.

Member Function Documentation

◆ maybeRenderDraggedLine()

void gui::elements::SkiaBlocksManagerRenderer::maybeRenderDraggedLine ( SkCanvas *  canvas)

◆ render()

Member Data Documentation

◆ connectorPaint

SkPaint gui::elements::SkiaBlocksManagerRenderer::connectorPaint
staticprivate
Initial value:
= []() {
SkPaint paint;
paint.setColor(colors::PURPLE_BLUE);
paint.setStrokeWidth(4);
paint.setAntiAlias(true);
return paint;
}()
const SkColor PURPLE_BLUE
Definition colors.cpp:6

The paint for the connector lines

Definition at line 49 of file SkiaBlocksManagerRenderer.h.

Referenced by maybeRenderDraggedLine(), and render().

◆ cycleConnectorPaint

SkPaint gui::elements::SkiaBlocksManagerRenderer::cycleConnectorPaint
staticprivate
Initial value:
= []() {
SkPaint paint;
paint.setColor(colors::RED);
paint.setStrokeWidth(4);
paint.setAntiAlias(true);
return paint;
}()
const SkColor RED
Definition colors.cpp:9

The paint for the connector lines that form a cycle

Definition at line 54 of file SkiaBlocksManagerRenderer.h.

Referenced by render().


The documentation for this class was generated from the following files: