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/LineModel.h"
44 #include <QGraphicsSceneMouseEvent>
45 #include <QStyleOptionGraphicsItem>
51 m_nameClass = std::string(this->metaObject()->className());
72 std::vector<te::gm::Point*> coords = model->
getCoords();
77 for (
unsigned int i = 0; i < coords.size(); ++i)
79 QPointF pt(coords[i]->getX(), coords[i]->getY());
81 QPointF mlocal = mapFromScene(pt);
82 m_poly.push_back(mlocal);
95 drawBackground(painter);
102 if (option->state & QStyle::State_Selected)
104 drawSelection(painter);
122 cpen.setRed(clrLne.
getRed());
124 cpen.setBlue(clrLne.
getBlue());
127 QPainterPath path (m_poly[0]);
129 for(
int i = 0; i < m_poly.size() ; ++i)
131 path.lineTo(m_poly[i]);
138 painter->drawPath(path);
Abstract class to represent an observable. "Model" part of MVC component.
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
virtual void updateObserver(te::layout::ContextItem context)
Reimplemented from ItemObserver.
int getRed() const
It returns the red component color value (a value from 0 to 255).
LineItem(ItemController *controller, Observable *o)
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Reimplemented from QGraphicsItem.
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...
virtual void updateObserver(ContextItem context)
Reimplemented from ItemObserver.
virtual void drawLine(QPainter *painter)
Abstract class that represents a graphic item. This object is of type QGraphicsObject.
virtual te::color::RGBAColor getLineColor()
int getAlpha() const
It returns the alpha component color value (a value from 0 to 255).
std::string m_nameClass
Class name.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
virtual std::vector< te::gm::Point * > getCoords()