itom
Loading...
Searching...
No Matches
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)
 
bool unclosed () const
 return true if this shape (e.g. polygon) is currently being created and not closed, yet.
 
void setUnclosed (bool unclosed)
 
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)
 
QColor color () const
 
void setColor (const QColor &color)
 
QTransform transform () const
 
QTransform & rtransform () const
 
void setTransform (const QTransform &trafo)
 
double rotationAngleDeg () const
 
double rotationAngleRad () const
 
void setRotationAngleDeg (double degree)
 
void setRotationAngleRad (double radians)
 
void rotateByCenterDeg (double degree)
 
void rotateByCenterRad (double radians)
 
void translate (const QPointF &delta)
 
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
 
QPointF baseCenterPoint () 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
 
bool contains (const QPointF &point) const
 
QVector< bool > contains (const QPolygonF &points) 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

◆ ShapeFlag

Enumerator
RotateLock 

! Element can not be moved

ResizeLock 

! Element can not be rotated

◆ ShapeMask

Enumerator
FlagMask 

! Mask for the type space

◆ ShapeType

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

◆ area()

double ito::Shape::area ( ) const

return the area of this shape, or zero if the shape is a point, multi-point or line

◆ baseCenterPoint()

QPointF ito::Shape::baseCenterPoint ( ) const

center point of this shape

◆ basePoints()

QPolygonF ito::Shape::basePoints ( ) const

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

◆ centerPoint()

QPointF ito::Shape::centerPoint ( ) const

center point of this shape (after applying the transformation assigned to this shape)

◆ contains() [1/2]

bool ito::Shape::contains ( const QPointF & point) const

returns true if shape contains the given point, or false if this is not the case. In case of shapes with an area of 0, this method always returns false.

< returns true if shape contains the given point, or false if this is not the case. In case of shapes with an area of 0, this method always returns false.

◆ contains() [2/2]

QVector< bool > ito::Shape::contains ( const QPolygonF & points) const

repeatedly calls contains(point) for each point in points and returns a vector of boolean values to tell for each point if it is contained in the shape or not.

< repeatedly calls contains(point) for each point in points and returns a vector of boolean values to tell for each point if it is contained in the shape or not.

◆ contour()

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

◆ fromRectangle()

Shape ito::Shape::fromRectangle ( const QRectF & rect,
int index = -1,
QString name = "",
const QTransform & trafo = QTransform() )
static

static‍/ ito::DataObject Shape::maskFromMultipleShapes(const ito::DataObject &dataObject, const QVector<ito::Shape> &shapes, bool inverse /*= false*‍/)

◆ rotateByCenterDeg()

void ito::Shape::rotateByCenterDeg ( double degree)

rotate this shape around its current center points by the given angle (in degree). This rotation changes the current transformation matrix, not the base points of the shape.

◆ rotateByCenterRad()

void ito::Shape::rotateByCenterRad ( double radians)

rotate this shape around its current center points by the given angle (in radians). This rotation changes the current transformation matrix, not the base points of the shape.

◆ rotationAngleDeg()

double ito::Shape::rotationAngleDeg ( ) const

return the current rotation angle (in degree, counterclockwise) of this shape (obtained by current transformation matrix)

◆ rotationAngleRad()

double ito::Shape::rotationAngleRad ( ) const

return the current rotation angle (in radians, counterclockwise) of this shape (obtained by current transformation matrix)

◆ setRotationAngleDeg()

void ito::Shape::setRotationAngleDeg ( double degree)

set the current rotation angle (in degree, counterclockwise) of this shape without changing the translation values

◆ setRotationAngleRad()

void ito::Shape::setRotationAngleRad ( double radians)

set the current rotation angle (in radians, counterclockwise) of this shape without changing the translation values

◆ translate()

void ito::Shape::translate ( const QPointF & delta)

moves this shape by the given delta in the global coordinate system, which is the system where all base points are mapped using the current transformation matrix. This translation operation changes the current transformation matrix, not the base points of the shape.


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