30 #include "../../core/pattern/mvc/ItemController.h"
31 #include "../../core/AbstractScene.h"
32 #include "../../core/pattern/mvc/Observable.h"
33 #include "../../../color/RGBAColor.h"
34 #include "../../../qt/widgets/Utils.h"
35 #include "../../../geometry/Envelope.h"
36 #include "../../../common/STLUtils.h"
37 #include "../../item/GridMapModel.h"
41 #include <QStyleOptionGraphicsItem>
42 #include "../../core/WorldTransformer.h"
47 m_nameClass = std::string(this->metaObject()->className());
65 QRectF parentBound = boundingRect();
69 parentBound = parentItem()->boundingRect();
72 QPainterPath gridMapPath;
73 gridMapPath.setFillRule(Qt::WindingFill);
75 int heightRect = (int)parentBound.height();
76 int widgetRect = (int)parentBound.width();
87 m_maxHeigthTextMM = m_onePointMM * ft.pointSize();
91 for (
int i = 0; i <= heightRect; i+=10)
93 QLineF lineOne = QLineF(parentBound.topLeft().x(), parentBound.topLeft().y() + i, parentBound.topRight().x(), parentBound.topRight().y() + i);
95 QPointF pointInit(parentBound.topLeft().x() - (heightRect*.01), parentBound.topLeft().y() + i - (m_maxHeigthTextMM/2));
96 drawText(pointInit, painter, text.toStdString(),
true);
97 QPointF pointFinal(parentBound.topRight().x() + (heightRect*.01), parentBound.topRight().y() + i - (m_maxHeigthTextMM/2));
98 drawText(pointFinal, painter, text.toStdString());
100 painter->drawLine(lineOne);
102 for (
int j = 0; j <= widgetRect; j+=10)
104 QLineF lineTwo = QLineF(parentBound.topLeft().x() + j, parentBound.topLeft().y(), parentBound.bottomLeft().x() + j, parentBound.bottomLeft().y());
106 QPointF pointInit(parentBound.topLeft().x() + j + (m_maxWidthTextMM/2), boundingRect().topLeft().y() );
107 drawText(pointInit, painter, text.toStdString(),
true);
108 QPointF pointFinal(parentBound.bottomLeft().x() + j - (m_maxWidthTextMM/2), parentBound.bottomLeft().y() + (widgetRect*.01));
109 drawText(pointFinal, painter, text.toStdString());
111 painter->drawLine(lineTwo);
virtual void drawGrid(QPainter *painter)
GridGeodesicItem(ItemController *controller, Observable *o)
Constructor.
virtual ~GridGeodesicItem()
Destructor.
Abstract class to represent an observable. "Model" part of MVC component.
virtual te::color::RGBAColor getLineColor()
virtual int getTextPointSize()
Class that represents a "Model" part of GridMap MVC component. Its coordinate system is the same of s...
int getRed() const
It returns the red component color value (a value from 0 to 255).
int getBlue() const
It returns the blue component color value (a value from 0 to 255).
int getGreen() const
It returns the green component color value (a value from 0 to 255).
Abstract class to represent a controller. "Controller" part of MVC component. All classes representin...
int getAlpha() const
It returns the alpha component color value (a value from 0 to 255).
std::string m_nameClass
Class name.
Class that represents a graphic GridMap. Its coordinate system is the same of scene (millimeters)...
Class that represents a graphic GridMap. Its coordinate system is the same of scene (millimeters)...
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
virtual std::string getFontFamily()