Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
CDrawLogicsElements.hpp
Go to the documentation of this file.
1#ifndef LIBS_SHAPES_CDRAWLOGICSELEMENTS_HPP_
2#define LIBS_SHAPES_CDRAWLOGICSELEMENTS_HPP_
3
5#include "logic/enums.hpp"
6#include "logic/types.hpp"
9
10#include <map>
11#include <set>
12#include <string>
13#include <tuple>
14#include <utility>
15
17
28{
29public:
31
36 enum class EMainShape
37 {
38 Circle,
39 Ellipse,
40 Path,
42 Square,
44 };
45
50 enum class EDrawProperty
51 {
53 Font,
56 };
57
58 typedef std::tuple<iv::logic::eLogicsElementType, iv::logic::eGeneralType, iv::types::logic::componentType>
60 typedef std::pair<EDrawProperty, std::string> TPairDrawPropertyValue;
61 typedef std::set<TPairDrawPropertyValue> TSetDrawProperties;
62 typedef std::map<AbstractLogicsElement::TPairIndexPartType, TSetDrawProperties> TMapPartTypeDrawProperties;
63 typedef std::map<AbstractCanvasItem::TTupleDrawingMode, TMapPartTypeDrawProperties>
64 TMapDrawingModePartsDrawProperties;// what to draw for each part for a particular drawing mode
65
66 static inline const double kAverageTextHeight = 15.;
67 static inline const double kMainTextHeight = 8.;
68 static inline const double kSubText1Height = 8.;
69 static inline const double kSubText2Height = 8.;
70 static inline const double kSubText3Height = 8.;
71 static inline const double kConnectionPointSize = 10.;
72 static inline const double kComponentPadding = 4.;
73 static inline const double kComponentCharacterWidth = 7.;
74 static inline const double kComponentMinimumHeight = 15.;
75 static inline const double kComponentMinimumWidth = 20.;
76
83
88
93
98
101 static void drawBackground(const std::shared_ptr<AbstractLogicsElement> &logicsElement, IGraphics *graphics);
102 static void drawConnection(const std::shared_ptr<AbstractLogicsElement> &logicsElement, IGraphics *graphics);
103 static void drawElement(const std::shared_ptr<AbstractLogicsElement> &logicsElement, const std::string &lCName,
104 IGraphics *graphics, bool isGrabbed, bool startDragging);
105 static const TMapPartTypeDrawProperties &
107 const AbstractCanvasItem::TTupleDrawingMode &drawingMode);
108 static AbstractCanvasItem::TPosition2d elementCenter(const std::shared_ptr<AbstractLogicsElement> &logicsElement);
109 static double elementHeight(const std::shared_ptr<AbstractLogicsElement> &logicsElement);
110 static double elementWidth(const std::shared_ptr<AbstractLogicsElement> &logicsElement);
111 static TTupleElementType elementType(const std::shared_ptr<AbstractLogicsElement> &logicsElement);
112 static TTupleElementType elementType(const AbstractLogicsElement *logicsElement);
113 static void eraseElement(const std::shared_ptr<AbstractLogicsElement> &logicsElement, IGraphics *graphics);
114 static graphics_t *graphicsTypeUsed(IGraphics *graphics);
117 static std::string strDrawProperty(EDrawProperty drawProperty);
118};
119
120#endif /* LIBS_SHAPES_CDRAWLOGICSELEMENTS_HPP_ */
std::tuple< EMarkMode, EStandOutMode > TTupleDrawingMode
Definition AbstractCanvasItem.hpp:50
std::pair< double, double > TPosition2d
Definition AbstractCanvasItem.hpp:48
Definition AbstractLogicsElement.hpp:15
std::map< TIndex, EPartType > TMapIndexPartType
Definition AbstractLogicsElement.hpp:31
EPartType
Definition AbstractLogicsElement.hpp:22
Definition CDrawLogicsElements.hpp:28
static const double kMainTextHeight
Definition CDrawLogicsElements.hpp:67
static const double kComponentMinimumHeight
Definition CDrawLogicsElements.hpp:74
std::tuple< iv::logic::eLogicsElementType, iv::logic::eGeneralType, iv::types::logic::componentType > TTupleElementType
Definition CDrawLogicsElements.hpp:59
static void drawConnection(const std::shared_ptr< AbstractLogicsElement > &logicsElement, IGraphics *graphics)
Definition CDrawLogicsElements.cpp:2875
CDrawLogicsElements(CDrawLogicsElements &&other)=delete
static AbstractCanvasItem::TPosition2d elementCenter(const std::shared_ptr< AbstractLogicsElement > &logicsElement)
Definition CDrawLogicsElements.cpp:3018
static const double kComponentMinimumWidth
Definition CDrawLogicsElements.hpp:75
std::map< AbstractCanvasItem::TTupleDrawingMode, TMapPartTypeDrawProperties > TMapDrawingModePartsDrawProperties
Definition CDrawLogicsElements.hpp:64
CDrawLogicsElements(const CDrawLogicsElements &other)=delete
static const double kComponentCharacterWidth
Definition CDrawLogicsElements.hpp:73
static const AbstractLogicsElement::TMapIndexPartType & parts(const TTupleElementType &elementType)
Definition CDrawLogicsElements.cpp:3325
static TSetDrawProperties propertiesLogicElementsWarningSelected(const TTupleElementType &elementType, AbstractLogicsElement::EPartType partType)
Definition CDrawLogicsElements.cpp:1438
static void eraseElement(const std::shared_ptr< AbstractLogicsElement > &logicsElement, IGraphics *graphics)
Definition CDrawLogicsElements.cpp:3205
CDrawLogicsElements & operator=(const CDrawLogicsElements &other)=delete
static double defaultElementHeight(const TTupleElementType &elementType)
Definition CDrawLogicsElements.cpp:2764
static TSetDrawProperties propertiesLogicElementsHighlightedDefault(const TTupleElementType &elementType, AbstractLogicsElement::EPartType partType)
Definition CDrawLogicsElements.cpp:991
static const double kSubText3Height
Definition CDrawLogicsElements.hpp:70
static EMainShape & mainShape(const TTupleElementType &elementType)
Definition CDrawLogicsElements.cpp:3242
EDrawProperty
Definition CDrawLogicsElements.hpp:51
static void drawBackground(const std::shared_ptr< AbstractLogicsElement > &logicsElement, IGraphics *graphics)
Definition CDrawLogicsElements.cpp:2849
static TSetDrawProperties propertiesLogicElementsSelected(const TTupleElementType &elementType, AbstractLogicsElement::EPartType partType)
Definition CDrawLogicsElements.cpp:841
static double elementWidth(const std::shared_ptr< AbstractLogicsElement > &logicsElement)
Definition CDrawLogicsElements.cpp:3107
CDrawLogicsElements & operator=(CDrawLogicsElements &&other)=delete
std::pair< EDrawProperty, std::string > TPairDrawPropertyValue
Definition CDrawLogicsElements.hpp:60
static TSetDrawProperties propertiesLogicElementsHighlightedSelected(const TTupleElementType &elementType, AbstractLogicsElement::EPartType partType)
Definition CDrawLogicsElements.cpp:1140
static void drawElement(const std::shared_ptr< AbstractLogicsElement > &logicsElement, const std::string &lCName, IGraphics *graphics, bool isGrabbed, bool startDragging)
Definition CDrawLogicsElements.cpp:2915
~CDrawLogicsElements()=delete
static double defaultElementWidth(const TTupleElementType &elementType)
Definition CDrawLogicsElements.cpp:2799
static const double kConnectionPointSize
Definition CDrawLogicsElements.hpp:71
static std::string strDrawProperty(EDrawProperty drawProperty)
Definition CDrawLogicsElements.cpp:3398
std::set< TPairDrawPropertyValue > TSetDrawProperties
Definition CDrawLogicsElements.hpp:61
std::map< AbstractLogicsElement::TPairIndexPartType, TSetDrawProperties > TMapPartTypeDrawProperties
Definition CDrawLogicsElements.hpp:62
static TSetDrawProperties propertiesLogicElementsDefault(const TTupleElementType &elementType, AbstractLogicsElement::EPartType partType)
Definition CDrawLogicsElements.cpp:697
EMainShape
Definition CDrawLogicsElements.hpp:37
static const double kSubText2Height
Definition CDrawLogicsElements.hpp:69
static double elementHeight(const std::shared_ptr< AbstractLogicsElement > &logicsElement)
Definition CDrawLogicsElements.cpp:3037
static const TMapPartTypeDrawProperties & drawingModeProperties(const TTupleElementType &elementType, const AbstractCanvasItem::TTupleDrawingMode &drawingMode)
Definition CDrawLogicsElements.cpp:2983
static const double kComponentPadding
Definition CDrawLogicsElements.hpp:72
static TTupleElementType elementType(const std::shared_ptr< AbstractLogicsElement > &logicsElement)
Definition CDrawLogicsElements.cpp:3153
static const double kSubText1Height
Definition CDrawLogicsElements.hpp:68
static TSetDrawProperties propertiesLogicElementsWarningDefault(const TTupleElementType &elementType, AbstractLogicsElement::EPartType partType)
Definition CDrawLogicsElements.cpp:1294
CDrawLogicsElements()=delete
static graphics_t * graphicsTypeUsed(IGraphics *graphics)
Definition CDrawLogicsElements.cpp:3225
static const double kAverageTextHeight
Definition CDrawLogicsElements.hpp:66
Definition CGraphicsGooCanvas.hpp:17
Definition IGraphics.hpp:20