itom  3.0.0
ito::Shape Class Reference

Public Types

enum  ShapeType {
  Invalid = 0, MultiPointPick = 0x00000001, Point = 0x00000002, Line = 0x00000004,
  Rectangle = 0x00000008, Square = 0x00000010, Ellipse = 0x00000020, Circle = 0x00000040,
  Polygon = 0x00000080
}
 
enum  ShapeFlag { MoveLock = 0x00010000, RotateLock = 0x00020000, ResizeLock = 0x00040000 }
 
enum  ShapeMask { TypeMask = 0x0000FFFF, FlagMask = 0xFFFF0000 }
 

Public Member Functions

 Shape (unsigned int type, unsigned int flags, const QPolygonF &basePoints, const QTransform &transform=QTransform())
 
 Shape (unsigned int type, unsigned int flags, const QPolygonF &basePoints, int index, const QTransform &transform=QTransform())
 
 Shape (unsigned int type, unsigned int flags, const QPolygonF &basePoints, int index, const QString &name, const QTransform &transform=QTransform())
 
 Shape (unsigned int type, unsigned int flags, const QPolygonF &basePoints, const QString &name, const QTransform &transform=QTransform())
 
 Shape (const Shape &other)
 
Shapeoperator= (const Shape &other)
 
Shape normalized () const
 
bool isValid () const
 
unsigned int flags () const
 
void setFlags (const unsigned int &flags)
 
int index () const
 
void setIndex (const int &index)
 
QString name () const
 
void setName (const QString &name)
 
unsigned int type () const
 
void setType (const unsigned int &type)
 
QTransform transform () const
 
QTransform & rtransform () const
 
void setTransform (const QTransform &trafo)
 
double rotationAngleDeg () const
 
double rotationAngleRad () const
 
ito::float64 userData1 () const
 
void setUserData1 (const ito::float64 &userData1)
 
ito::float64 userData2 () const
 
void setUserData2 (const ito::float64 &userData2)
 
QPolygonF basePoints () const
 
QPolygonF & rbasePoints ()
 
const QPolygonF & rbasePoints () const
 
QPolygonF contour (bool applyTrafo=true, qreal tol=-1.0) const
 
QRegion region () const
 
void point1MoveTo (const QPointF &newPoint1)
 
QPointF centerPoint () const
 
double area () const
 
double circumference () const
 
double distance (const Shape &otherShape) const
 
double centerDistance (const Shape &otherShape) const
 
double radius () const
 
double radiusX () const
 
double radiusY () const
 

Static Public Member Functions

static Shape fromRectangle (const QRectF &rect, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromRectangle (qreal x1, qreal y1, qreal x2, qreal y2, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromSquare (const QPointF &center, qreal sideLength, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromEllipse (const QRectF &rect, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromEllipse (qreal x1, qreal y1, qreal x2, qreal y2, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromCircle (const QPointF &center, qreal radius, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromLine (const QPointF &p1, const QPointF &p2, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromLine (qreal x1, qreal y1, qreal x2, qreal y2, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromPoint (const QPointF &point, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromPoint (qreal x, qreal y, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromPolygon (const QPolygonF &polygon, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static Shape fromMultipoint (const QPolygonF &polygon, int index=-1, QString name="", const QTransform &trafo=QTransform())
 
static QString type2QString (const int type)
 

Protected Member Functions

QPolygonF ramerDouglasPeucker (qreal tol) const
 

Static Protected Member Functions

static double distanceLine2Point2D (const Shape &line, const QPointF &point)
 
static double distanceLine2Line2D (const Shape &line1, const Shape &line2)
 
static double distancePoint2Point2D (const QPointF &point1, const QPointF &point2)
 

Protected Attributes

ShapePrivated
 

Member Enumeration Documentation

Enumerator
RotateLock 

! Element can not be moved

ResizeLock 

! Element can not be rotated

Enumerator
FlagMask 

! Mask for the type space

Enumerator
Point 

! Multi point pick

Line 

! Element is point in order to pick points

Rectangle 

! Element is line in order to pick lines

Square 

! Element is rectangle in order to pick rectangles

Ellipse 

! Element is square in order to pick squares

Circle 

! Element is ellipse in order to pick ellipses

Polygon 

! Element is circle in order to pick circles

Member Function Documentation

QPolygonF ito::Shape::basePoints ( ) const

base points are various points that help to define the geometry in a precise description.

QPolygonF ito::Shape::contour ( bool  applyTrafo = true,
qreal  tol = -1.0 
) const

returns the enclosing contour as polygon. If the shape is elliptic, an approximation is applied, where tol is the maximum distance between real contour and a line segment of the polygon (if -1.0, the tolerance is defined to be 1% of the smaller diameter of the ellise


The documentation for this class was generated from the following files: