32 #include "../shape/shapeCommon.h" 37 #include <qtransform.h> 39 #include <qdatastream.h> 41 #if !defined(Q_MOC_RUN) || defined(ITOMSHAPE_MOC) //only moc this file in itomShapeLib but not in other libraries or executables linking against this itomCommonQtLib 48 QDataStream ITOMSHAPE_EXPORT &operator<<(QDataStream &out,
const ito::Shape &shape);
50 QDataStream ITOMSHAPE_EXPORT &operator>>(QDataStream &in,
ito::Shape &shape);
63 MultiPointPick = 0x00000001,
66 Rectangle = 0x00000008,
77 MoveLock = 0x00010000,
78 RotateLock = 0x00020000,
79 ResizeLock = 0x00040000,
84 TypeMask = 0x0000FFFF,
89 explicit Shape(
unsigned int type,
unsigned int flags,
const QPolygonF &basePoints,
const QTransform &transform = QTransform());
90 explicit Shape(
unsigned int type,
unsigned int flags,
const QPolygonF &basePoints,
int index,
const QTransform &transform = QTransform());
91 explicit Shape(
unsigned int type,
unsigned int flags,
const QPolygonF &basePoints,
int index,
const QString &name,
const QTransform &transform = QTransform());
92 explicit Shape(
unsigned int type,
unsigned int flags,
const QPolygonF &basePoints,
const QString &name,
const QTransform &transform = QTransform());
99 Shape normalized()
const;
101 bool isValid()
const;
103 unsigned int flags()
const;
104 void setFlags(
const unsigned int &flags);
107 void setIndex(
const int &index);
109 QString name()
const;
110 void setName(
const QString &name);
112 unsigned int type()
const;
113 void setType(
const unsigned int &type);
115 QTransform transform()
const;
116 QTransform &rtransform()
const;
117 void setTransform(
const QTransform &trafo);
119 double rotationAngleDeg()
const;
120 double rotationAngleRad()
const;
122 ito::float64 userData1()
const;
123 void setUserData1(
const ito::float64 &userData1);
125 ito::float64 userData2()
const;
126 void setUserData2(
const ito::float64 &userData2);
128 QPolygonF basePoints()
const;
129 QPolygonF &rbasePoints();
130 const QPolygonF &rbasePoints()
const;
131 QPolygonF contour(
bool applyTrafo =
true, qreal tol = -1.0)
const;
132 QRegion region()
const;
135 void point1MoveTo(
const QPointF &newPoint1);
137 QPointF centerPoint()
const;
140 double circumference()
const;
141 double distance(
const Shape &otherShape)
const;
142 double centerDistance(
const Shape &otherShape)
const;
144 double radius()
const;
145 double radiusX()
const;
146 double radiusY()
const;
148 static Shape fromRectangle(
const QRectF &rect,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
149 static Shape fromRectangle(qreal x1, qreal y1, qreal x2, qreal y2,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
150 static Shape fromSquare(
const QPointF ¢er, qreal sideLength,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
151 static Shape fromEllipse(
const QRectF &rect,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
152 static Shape fromEllipse(qreal x1, qreal y1, qreal x2, qreal y2,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
153 static Shape fromCircle(
const QPointF ¢er, qreal radius,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
154 static Shape fromLine(
const QPointF &p1,
const QPointF &p2,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
155 static Shape fromLine(qreal x1, qreal y1, qreal x2, qreal y2,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
156 static Shape fromPoint(
const QPointF &point,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
157 static Shape fromPoint(qreal x, qreal y,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
158 static Shape fromPolygon(
const QPolygonF &polygon,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
159 static Shape fromMultipoint(
const QPolygonF &polygon,
int index = -1, QString name =
"",
const QTransform &trafo = QTransform());
161 static QString type2QString(
const int type);
170 QPolygonF ramerDouglasPeucker(qreal tol)
const;
173 static double distanceLine2Point2D(
const Shape &line,
const QPointF &point);
174 static double distanceLine2Line2D(
const Shape &line1,
const Shape &line2);
175 static double distancePoint2Point2D(
const QPointF &point1,
const QPointF &point2);
180 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC) Definition: apiFunctionsGraph.cpp:39
ShapeType
Definition: shape.h:60
ShapeFlag
Definition: shape.h:75
ShapeMask
Definition: shape.h:82