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/PointModel.h" 
   38 #include "../../core/enum/EnumPointType.h" 
   45   m_nameClass = std::string(this->metaObject()->className());
 
   68   drawBackground(painter);
 
  105   if (option->state & QStyle::State_Selected)
 
  107     drawSelection(painter);
 
  121   double halfW = boundingRect().width() / 4.;
 
  123   double w = boundingRect().width() / 2.;
 
  125   QPainterPath rhombus_path;
 
  128   qreal 
const c = halfW;
 
  132   for ( qreal i = 0 ; i < 2*3.14; i += 3.14/5.0, inner=!inner ) {
 
  133     qreal 
const f = inner ? c : d;
 
  134     poly << QPointF( f * std::cos(i), f * std::sin(i) );
 
  137       pUnion = QPointF( f * std::cos(i), f * std::sin(i) );
 
  141   poly.translate(boundingRect().center());
 
  143   rhombus_path.addPolygon(poly);
 
  148   pointColor.setRed(clrPoint.
getRed());
 
  149   pointColor.setGreen(clrPoint.
getGreen());
 
  150   pointColor.setBlue(clrPoint.
getBlue());
 
  151   pointColor.setAlpha(clrPoint.
getAlpha());
 
  156   painter->setBrush(pointColor);
 
  157   painter->drawPath(rhombus_path);
 
  172   double halfW = boundingRect().width() / 4.;
 
  173   double halfH = boundingRect().height() / 4.;
 
  175   double x = boundingRect().center().x() - halfW;
 
  176   double y = boundingRect().center().y() - halfH;
 
  177   double w = boundingRect().width() / 2.;
 
  178   double h = boundingRect().height() / 2.;
 
  180   QRectF pointRect(x, y, w, h);
 
  182   QPainterPath circle_path;
 
  183   circle_path.addEllipse(pointRect);
 
  188   pointColor.setRed(clrPoint.
getRed());
 
  189   pointColor.setGreen(clrPoint.
getGreen());
 
  190   pointColor.setBlue(clrPoint.
getBlue());
 
  191   pointColor.setAlpha(clrPoint.
getAlpha());
 
  196   painter->setBrush(pointColor);
 
  197   painter->drawPath(circle_path);
 
  212   double halfW = boundingRect().width() / 4.;
 
  213   double halfH = boundingRect().height() / 4.;
 
  215   double x = boundingRect().center().x() - halfW;
 
  216   double y = boundingRect().center().y() + halfH;
 
  217   double w = boundingRect().width() / 2.;
 
  219   QFont ft = painter->font();
 
  222   QPainterPath rect_path;
 
  223   rect_path.addText(x, y, ft, 
"X");
 
  228   pointColor.setRed(clrPoint.
getRed());
 
  229   pointColor.setGreen(clrPoint.
getGreen());
 
  230   pointColor.setBlue(clrPoint.
getBlue());
 
  231   pointColor.setAlpha(clrPoint.
getAlpha());
 
  236   painter->setBrush(pointColor);
 
  237   painter->drawPath(rect_path);
 
  252   double halfW = boundingRect().width() / 4.;
 
  253   double halfH = boundingRect().height() / 4.;
 
  255   double x = boundingRect().center().x() - halfW;
 
  256   double y = boundingRect().center().y() - halfH;
 
  257   double w = boundingRect().width() / 2.;
 
  258   double h = boundingRect().height() / 2.;
 
  260   QRectF pointRect(x, y, w, h);
 
  262   QPainterPath rect_path;
 
  263   rect_path.addRect(pointRect);
 
  268   pointColor.setRed(clrPoint.
getRed());
 
  269   pointColor.setGreen(clrPoint.
getGreen());
 
  270   pointColor.setBlue(clrPoint.
getBlue());
 
  271   pointColor.setAlpha(clrPoint.
getAlpha());
 
  276   painter->setBrush(pointColor);
 
  277   painter->drawPath(rect_path);
 
  292   double centerX = boundingRect().center().x();
 
  293   double centerY = boundingRect().center().y();
 
  295   double halfW = boundingRect().width() / 4.;
 
  296   double halfH = boundingRect().height() / 4.;
 
  298   double x = centerX - halfW;
 
  299   double y = centerY + halfH;
 
  302   poly.push_back(QPoint(centerX, y));
 
  303   poly.push_back(QPoint(centerX + halfW, centerY));
 
  304   poly.push_back(QPoint(centerX, centerY - halfH));
 
  305   poly.push_back(QPoint(x, centerY));
 
  306   poly.push_back(QPoint(centerX, y));
 
  308   QPainterPath rhombus_path;
 
  309   rhombus_path.addPolygon(poly);
 
  314   pointColor.setRed(clrPoint.
getRed());
 
  315   pointColor.setGreen(clrPoint.
getGreen());
 
  316   pointColor.setBlue(clrPoint.
getBlue());
 
  317   pointColor.setAlpha(clrPoint.
getAlpha());
 
  322   painter->setBrush(pointColor);
 
  323   painter->drawPath(rhombus_path);
 
  338   double centerX = boundingRect().center().x();
 
  339   double centerY = boundingRect().center().y();
 
  341   double halfW = boundingRect().width() / 4.;
 
  342   double halfH = boundingRect().height() / 4.;
 
  344   double x = centerX - halfW;
 
  345   double y = centerY + halfH;
 
  346   double w = boundingRect().width() / 2.;
 
  347   double h = boundingRect().height() / 2.;
 
  352   pointColor.setRed(clrPoint.
getRed());
 
  353   pointColor.setGreen(clrPoint.
getGreen());
 
  354   pointColor.setBlue(clrPoint.
getBlue());
 
  355   pointColor.setAlpha(clrPoint.
getAlpha());
 
  360   painter->setBrush(pointColor);
 
  361   painter->drawLine(x, centerY, x + w, centerY);
 
  362   painter->drawLine(centerX, y, centerX, y - h);
 
virtual void drawSquare(QPainter *painter)
Abstract class to represent an observable. "Model" part of MVC component. 
virtual EnumType * getCircleType() const 
Returns value that represents circle type belonging to enumeration. 
virtual void drawStar(QPainter *painter)
int getRed() const 
It returns the red component color value (a value from 0 to 255). 
Class to represent a scale point enumeration. Ex.: X, square, circle, etc. 
PointItem(ItemController *controller, Observable *o)
Constructor. 
virtual EnumType * getCurrentPointType()
virtual te::color::RGBAColor getPointColor()
virtual ~PointItem()
Destructor. 
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). 
virtual void drawCross(QPainter *painter)
Abstract class to represent a controller. "Controller" part of MVC component. All classes representin...
Abstract class that represents a graphic item. This object is of type QGraphicsObject. 
virtual EnumPointType * getEnumPointType()
virtual void drawCircle(QPainter *painter)
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Reimplemented from QGraphicsItem. 
virtual void drawX(QPainter *painter)
int getAlpha() const 
It returns the alpha component color value (a value from 0 to 255). 
std::string m_nameClass
Class name. 
virtual void drawRhombus(QPainter *painter)
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Reimplemented from QGraphicsItem. 
Class that represents a "Model" part of Point MVC component. Its coordinate system is the same of sce...
virtual EnumType * getRhombusType() const 
Returns value that represents rhombus type belonging to enumeration. 
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color. 
virtual EnumType * getSquareType() const 
Returns value that represents square type belonging to enumeration. 
virtual EnumType * getXType() const 
Returns value that represents X type belonging to enumeration. 
virtual EnumType * getStarType() const 
Returns value that represents star type belonging to enumeration. 
virtual EnumType * getCrossType() const 
Returns value that represents cross type belonging to enumeration. 
Class that represents a graphic Point. Its coordinate system is the same of scene (millimeters)...