The VGObject class keep information graphical objects. More...
#include <vgobject.h>
Public Member Functions | |
VGObject () | |
VGObject default constructor. More... | |
VGObject (const GOType &type, const quint32 &idObject=0, const Draw &mode=Draw::Calculation) | |
VGObject constructor. More... | |
VGObject (const VGObject &obj) | |
VGObject copy constructor. More... | |
virtual | ~VGObject () |
VGObject & | operator= (const VGObject &obj) |
operator = assignment operator. More... | |
void | Swap (VGObject &obj) Q_DECL_NOTHROW |
quint32 | getIdObject () const |
getIdObject return parent id. More... | |
void | setIdObject (const quint32 &value) |
setIdObject set parent id. More... | |
virtual QString | name () const |
name return name graphical object. More... | |
void | setName (const QString &name) |
setName set name graphical object. More... | |
Draw | getMode () const |
getMode return mode creation. More... | |
void | setMode (const Draw &value) |
setMode set mode creation. More... | |
GOType | getType () const |
getType return object type. More... | |
void | setType (const GOType &type) |
quint32 | id () const |
id return id object. More... | |
virtual void | setId (const quint32 &id) |
setId set id object. More... | |
quint32 | getIdTool () const |
Static Public Member Functions | |
static QLineF | BuildLine (const QPointF &p1, const qreal &length, const qreal &angle) |
static QPointF | BuildRay (const QPointF &firstPoint, const qreal &angle, const QRectF &scRect) |
static QLineF | BuildAxis (const QPointF &p, const qreal &angle, const QRectF &scRect) |
static QLineF | BuildAxis (const QPointF &p1, const QPointF &p2, const QRectF &scRect) |
static int | ContactPoints (const QPointF &p, const QPointF ¢er, qreal radius, QPointF &p1, QPointF &p2) |
static QPointF | LineIntersectRect (const QRectF &rec, const QLineF &line) |
LineIntersectRect find point intersection line and rect. More... | |
static int | IntersectionCircles (const QPointF &c1, double r1, const QPointF &c2, double r2, QPointF &p1, QPointF &p2) |
static qint32 | LineIntersectCircle (const QPointF ¢er, qreal radius, const QLineF &line, QPointF &p1, QPointF &p2) |
LineIntersectCircle find point intersection line and circle. More... | |
static QPointF | ClosestPoint (const QLineF &line, const QPointF &point) |
ClosestPoint find point projection of point onto line. More... | |
static QPointF | addVector (const QPointF &p, const QPointF &p1, const QPointF &p2, qreal k) |
static void | LineCoefficients (const QLineF &line, qreal *a, qreal *b, qreal *c) |
LineCoefficients coefficient for equation of segment. Segment equestion ax+by+c=0. More... | |
static bool | IsPointOnLineSegment (const QPointF &t, const QPointF &p1, const QPointF &p2) |
IsPointOnLineSegment Check if the point is on the line segment. More... | |
static bool | IsPointOnLineviaPDP (const QPointF &t, const QPointF &p1, const QPointF &p2) |
IsPointOnLineviaPDP use the perp dot product (PDP) way. More... | |
template<typename T > | |
static QVector< T > | GetReversePoints (const QVector< T > &points) |
GetReversePoint return revers container of points. More... | |
static int | GetLengthContour (const QVector< QPointF > &contour, const QVector< QPointF > &newPoints) |
GetLengthContour return length of contour. More... | |
Static Public Attributes | |
static const double | accuracyPointOnLine = (0.1555 / 25.4) * 96.0 |
Static Protected Member Functions | |
static QTransform | flipTransform (const QLineF &axis) |
Static Private Member Functions | |
static double | PerpDotProduct (const QPointF &p1, const QPointF &p2, const QPointF &t) |
PerpDotProduct Calculates the area of the parallelogram of the three points. This is actually the same as the area of the triangle defined by the three points, multiplied by 2. More... | |
static double | GetEpsilon (const QPointF &p1, const QPointF &p2) |
GetEpsilon solve the floating-point accuraccy problem. More... | |
static int | PointInCircle (const QPointF &p, const QPointF ¢er, qreal radius) |
Private Attributes | |
QSharedDataPointer< VGObjectData > | d |
The VGObject class keep information graphical objects.
Definition at line 73 of file vgobject.h.
VGObject::VGObject | ( | ) |
VGObject default constructor.
Definition at line 79 of file vgobject.cpp.
|
explicit |
VGObject constructor.
type | type graphical object. |
idObject | id parent object. |
mode | mode creation. Used in modeling mode. |
Definition at line 90 of file vgobject.cpp.
VGObject::VGObject | ( | const VGObject & | obj | ) |
|
virtual |
Definition at line 120 of file vgobject.cpp.
|
static |
Definition at line 456 of file vgobject.cpp.
Referenced by LineIntersectCircle().
|
static |
|
static |
Definition at line 279 of file vgobject.cpp.
References BuildAxis().
|
static |
Definition at line 241 of file vgobject.cpp.
Referenced by BuildRay(), VisLine::DrawRay(), VisToolMove::RefreshGeometry(), VisToolAlongLine::RefreshGeometry(), VisToolBisector::RefreshGeometry(), VisToolEndLine::RefreshGeometry(), and VisToolShoulderPoint::RefreshGeometry().
|
static |
Definition at line 251 of file vgobject.cpp.
References BuildLine(), and LineIntersectRect().
Referenced by BuildAxis(), VToolCurveIntersectAxis::FindPoint(), and VisLine::Ray().
|
static |
ClosestPoint find point projection of point onto line.
line | line. |
Definition at line 436 of file vgobject.cpp.
References LineCoefficients().
Referenced by VToolHeight::FindPoint(), LineIntersectCircle(), and DialogHeight::PointNameChanged().
|
static |
Definition at line 286 of file vgobject.cpp.
References d, IntersectionCircles(), and PointInCircle().
Referenced by IntersectCircleTangentTool::FindPoint(), VToolPointFromArcAndTangent::FindPoint(), IntersectCircleTangentVisual::FindRays(), and VisToolPointFromArcAndTangent::FindRays().
|
staticprotected |
Definition at line 591 of file vgobject.cpp.
Referenced by VEllipticalArc::Flip(), and VPointF::FlipPF().
|
staticprivate |
GetEpsilon solve the floating-point accuraccy problem.
There is the floating-point accuraccy problem, so instead of checking against zero, some epsilon value has to be used. Because the size of the pdp value depends on the length of the vectors, no static value can be used. One approach is to compare the pdp/area value to the fraction of another area which also depends on the length of the line e1=(p1, p2), e.g. the minimal area calucalted with PerpDotProduc() if point still not on the line. This distance is controled by variable accuracyPointOnLine
Definition at line 545 of file vgobject.cpp.
References accuracyPointOnLine, and PerpDotProduct().
Referenced by IsPointOnLineviaPDP().
quint32 VGObject::getIdObject | ( | ) | const |
getIdObject return parent id.
Definition at line 128 of file vgobject.cpp.
References d.
Referenced by VEllipticalArc::CutArc(), VArc::CutArc(), and MainWindow::zoomToPoint().
quint32 VGObject::getIdTool | ( | ) | const |
Definition at line 221 of file vgobject.cpp.
References Calculation, d, and NULL_ID.
Referenced by VToolPointFromArcAndTangent::Create(), IntersectCircleTangentTool::Create(), IntersectCirclesTool::Create(), VToolPointOfIntersectionCurves::Create(), VToolArc::Create(), VToolArcWithLength::Create(), VToolEllipticalArc::Create(), VToolCubicBezier::Create(), VToolSpline::Create(), VPattern::ParseOldToolSplinePath(), VPattern::ParseToolCubicBezierPath(), VPattern::ParseToolSplinePath(), and MainWindow::zoomToPoint().
|
static |
GetLengthContour return length of contour.
contour | container with points of contour. |
newPoints | point whos we try to add to contour. |
Definition at line 577 of file vgobject.cpp.
Draw VGObject::getMode | ( | ) | const |
getMode return mode creation.
Definition at line 168 of file vgobject.cpp.
References d.
Referenced by VEllipticalArc::CutArc(), and VArc::CutArc().
GetReversePoint return revers container of points.
points | container with points. |
Definition at line 145 of file vgobject.h.
Referenced by VAbstractCurve::GetSegmentPoints(), VPiece::GetUnitedPath(), VPiecePath::SeamAllowancePoints(), and VAbstractCurve::ToEnd().
GOType VGObject::getType | ( | ) | const |
quint32 VGObject::id | ( | ) | const |
id return id object.
Definition at line 205 of file vgobject.cpp.
References d.
Referenced by VToolCubicBezierPath::AddPathPoint(), VToolSplinePath::AddPathPoint(), VArc::CreateName(), VEllipticalArc::CreateName(), DialogCubicBezierPath::currentPointChanged(), DialogSplinePath::currentPointChanged(), DialogCubicBezierPath::DataPoint(), DialogSplinePath::DataPoint(), MoveSpline::Do(), VToolCurveIntersectAxis::InitArc(), VAbstractArc::NameForHistory(), DialogArc::pointNameChanged(), DialogArcWithLength::pointNameChanged(), DialogEllipticalArc::pointNameChanged(), DialogCubicBezier::PointNameChanged(), DialogSpline::PointNameChanged(), setId(), DialogCubicBezier::SetSpline(), DialogSpline::SetSpline(), VToolCubicBezier::SetSplineAttributes(), and VToolSpline::SetSplineAttributes().
|
static |
Definition at line 342 of file vgobject.cpp.
References d, and VFuzzyComparePossibleNulls().
Referenced by ContactPoints(), IntersectCirclesTool::FindPoint(), and VToolPointOfIntersectionArcs::FindPoint().
|
static |
IsPointOnLineSegment Check if the point is on the line segment.
Original idea http://www.sunshine2k.de/coding/java/PointOnLine/PointOnLine.html
Definition at line 484 of file vgobject.cpp.
References accuracyPointOnLine, and IsPointOnLineviaPDP().
Referenced by VToolPointOfContact::FindPoint(), VAbstractCurve::FromBegin(), and VAbstractCurve::isPointOnCurve().
|
static |
IsPointOnLineviaPDP use the perp dot product (PDP) way.
The pdp is zero only if the t lies on the line e1 = vector from p1 to p2.
Definition at line 516 of file vgobject.cpp.
References GetEpsilon(), PerpDotProduct(), and VFuzzyComparePossibleNulls().
Referenced by VAbstractPiece::CheckLoops(), VAbstractPiece::IsEkvPointOnLine(), and IsPointOnLineSegment().
|
static |
LineCoefficients coefficient for equation of segment. Segment equestion ax+by+c=0.
line | line |
a | a value |
b | b value |
c | c value |
Definition at line 469 of file vgobject.cpp.
Referenced by ClosestPoint(), and LineIntersectCircle().
|
static |
LineIntersectCircle find point intersection line and circle.
center | arc center. |
radius | arc radius. |
line | line |
p1 | first intersection point. |
p2 | second intersection point. |
Definition at line 391 of file vgobject.cpp.
References addVector(), ClosestPoint(), d, LineCoefficients(), and VFuzzyComparePossibleNulls().
Referenced by VToolShoulderPoint::FindPoint(), VToolPointOfContact::FindPoint(), VScenePoint::refreshLeader(), and VControlPointSpline::setCtrlLine().
|
static |
LineIntersectRect find point intersection line and rect.
rec | rect. |
line | line. |
Definition at line 313 of file vgobject.cpp.
Referenced by BuildRay(), and VScenePoint::refreshLeader().
|
virtual |
name return name graphical object.
Definition at line 148 of file vgobject.cpp.
References d.
Referenced by VContainer::AddGObject(), VToolPointFromArcAndTangent::Create(), VAbstractCubicBezier::CreateName(), VAbstractCubicBezierPath::CreateName(), VArc::CreateName(), VEllipticalArc::CreateName(), DialogCubicBezierPath::currentPointChanged(), DialogSplinePath::currentPointChanged(), DialogSplinePath::EvalAngle1(), DialogSplinePath::EvalAngle2(), DialogSplinePath::EvalLength1(), DialogSplinePath::EvalLength2(), VToolCubicBezier::FirstPointName(), VArc::Flip(), VCubicBezier::Flip(), VCubicBezierPath::Flip(), VEllipticalArc::Flip(), VPointF::Flip(), VSpline::Flip(), VSplinePath::Flip(), VToolCubicBezier::ForthPointName(), VToolCurveIntersectAxis::InitSegments(), VToolCutSpline::makeToolTip(), VToolCutSplinePath::makeToolTip(), VArc::Move(), VCubicBezier::Move(), VCubicBezierPath::Move(), VEllipticalArc::Move(), VPointF::Move(), VSpline::Move(), VSplinePath::Move(), VAbstractArc::NameForHistory(), VAbstractCubicBezier::NameForHistory(), VAbstractCubicBezierPath::NameForHistory(), DialogCubicBezierPath::NewItem(), DialogSplinePath::NewItem(), DialogArc::pointNameChanged(), DialogArcWithLength::pointNameChanged(), DialogEllipticalArc::pointNameChanged(), DialogCubicBezier::PointNameChanged(), DialogSpline::PointNameChanged(), VScenePoint::refreshPointGeometry(), VArc::Rotate(), VCubicBezier::Rotate(), VCubicBezierPath::Rotate(), VPointF::Rotate(), VSpline::Rotate(), VSplinePath::Rotate(), VEllipticalArc::Rotate(), VToolDoublePoint::SaveOptions(), VToolCubicBezier::SecondPointName(), DialogArc::setArc(), DialogArcWithLength::setArc(), DialogEllipticalArc::setArc(), setName(), DialogCubicBezierPath::SetPath(), DialogSplinePath::SetPath(), DialogCubicBezier::SetSpline(), DialogSpline::SetSpline(), DialogCubicBezierPath::ShowDialog(), DialogSpline::ShowDialog(), DialogSplinePath::ShowDialog(), VToolCubicBezier::ThirdPointName(), VToolOptionsPropertyBrowser::updateOptionsToolSpline(), VArcRadius::VArcRadius(), VCurveAngle::VCurveAngle(), VCurveCLength::VCurveCLength(), VCurveLength::VCurveLength(), VLengthLine::VLengthLine(), VLineAngle::VLineAngle(), and VPointF::VPointF().
operator = assignment operator.
obj | object |
Definition at line 109 of file vgobject.cpp.
References d.
Referenced by VAbstractCurve::operator=(), and VPointF::operator=().
|
staticprivate |
PerpDotProduct Calculates the area of the parallelogram of the three points. This is actually the same as the area of the triangle defined by the three points, multiplied by 2.
Definition at line 530 of file vgobject.cpp.
Referenced by GetEpsilon(), and IsPointOnLineviaPDP().
|
staticprivate |
Definition at line 555 of file vgobject.cpp.
References d, and VFuzzyComparePossibleNulls().
Referenced by ContactPoints().
|
virtual |
setId set id object.
id | id. |
Reimplemented in VAbstractArc.
Definition at line 215 of file vgobject.cpp.
Referenced by VContainer::GetFakeGObject(), and VAbstractArc::setId().
void VGObject::setIdObject | ( | const quint32 & | value | ) |
setIdObject set parent id.
value | parent id. |
Definition at line 138 of file vgobject.cpp.
References d.
Referenced by VPattern::ParseNodeArc(), VPattern::ParseNodeEllipticalArc(), VPattern::ParseNodeSpline(), and VPattern::ParseNodeSplinePath().
void VGObject::setMode | ( | const Draw & | value | ) |
setMode set mode creation.
value | mode. |
Definition at line 178 of file vgobject.cpp.
References d.
Referenced by QT_WARNING_POP::AddNodeSpline(), AnchorPointTool::Create(), VPattern::ParseNodeArc(), VPattern::ParseNodeEllipticalArc(), VPattern::ParseNodeSpline(), and VPattern::ParseNodeSplinePath().
void VGObject::setName | ( | const QString & | name | ) |
setName set name graphical object.
name | name graphical object. |
Definition at line 158 of file vgobject.cpp.
Referenced by VAbstractCubicBezier::CreateName(), VAbstractCubicBezierPath::CreateName(), VArc::CreateName(), VEllipticalArc::CreateName(), VToolCutSplinePath::CutSplinePath(), VArc::Flip(), VCubicBezier::Flip(), VCubicBezierPath::Flip(), VEllipticalArc::Flip(), VSpline::Flip(), VArc::Move(), VCubicBezier::Move(), VCubicBezierPath::Move(), VEllipticalArc::Move(), VSpline::Move(), VArc::Rotate(), VCubicBezier::Rotate(), VCubicBezierPath::Rotate(), VSpline::Rotate(), VEllipticalArc::Rotate(), and VPointF::VPointF().
void VGObject::setType | ( | const GOType & | type | ) |
Definition at line 195 of file vgobject.cpp.
References d.
void VGObject::Swap | ( | VGObject & | obj | ) |
Definition at line 72 of file vgobject.cpp.
Referenced by VAbstractCurve::Swap(), and VPointF::Swap().
|
static |
Definition at line 126 of file vgobject.h.
Referenced by GetEpsilon(), VPiece::getSeamNotchSAPoint(), VAbstractPiece::IsEkvPointOnLine(), IsPointOnLineSegment(), and VAbstractPiece::RemoveDublicates().
|
private |
Definition at line 130 of file vgobject.h.
Referenced by ContactPoints(), getIdObject(), getIdTool(), getMode(), getType(), id(), IntersectionCircles(), LineIntersectCircle(), name(), operator=(), PointInCircle(), setId(), setIdObject(), setMode(), setName(), and setType().