QCAD
Open Source 2D CAD
RSolidData.h
Go to the documentation of this file.
1 
20 #ifndef RSOLIDDATA_H
21 #define RSOLIDDATA_H
22 
23 #include "entity_global.h"
24 
25 #include "RBox.h"
26 #include "RDocument.h"
27 #include "REntity.h"
28 #include "RPolyline.h"
29 #include "RVector.h"
30 
40 
41  friend class RSolidEntity;
42 
43 protected:
45 
46 public:
47  RSolidData();
48  RSolidData(const RTriangle& triangle);
49  RSolidData(const RVector& p1, const RVector& p2, const RVector& p3);
50  RSolidData(const RVector& p1, const RVector& p2, const RVector& p3, const RVector& p4);
51 
52  virtual RS::EntityType getType() const {
53  return RS::EntitySolid;
54  }
56  return RPolyline::getStartPoint();
57  }
58  RVector getEndPoint() const {
59  return RPolyline::getEndPoint();
60  }
61  double getDirection1() const {
62  return RPolyline::getDirection1();
63  }
64  double getDirection2() const {
65  return RPolyline::getDirection2();
66  }
67  bool reverse() {
68  return RPolyline::reverse();
69  }
70  RVector getVertexAt(int i) const {
71  return RPolyline::getVertexAt(i);
72  }
73  int countVertices() const {
74  return RPolyline::countVertices();
75  }
76 
77  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
78  return RPolyline::getTrimEnd(trimPoint, clickPoint);
79  }
80  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
81  return RPolyline::trimStartPoint(trimPoint, clickPoint, extend);
82  }
83  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
84  return RPolyline::trimEndPoint(trimPoint, clickPoint, extend);
85  }
86 
87  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
88 
89  virtual bool moveReferencePoint(const RVector& referencePoint, const RVector& targetPoint, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
90 
91  virtual RShape* castToShape() {
92  return this;
93  }
94 
95  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false, bool segment = false) const {
96  Q_UNUSED(queryBox)
97  Q_UNUSED(ignoreComplex)
98  Q_UNUSED(segment)
99 
100  return QList<QSharedPointer<RShape> >() <<
101  QSharedPointer<RShape>(new RPolyline(*this));
102  }
103 
105  return *this;
106  }
107 };
108 
112 Q_DECLARE_METATYPE(QSharedPointer<RSolidData>)
113 
114 #endif
REntity.h
RPolyline::RPolyline
RPolyline()
Creates a polyline object without points.
Definition: RPolyline.cpp:36
RSolidEntity::data
RSolidData data
Definition: RSolidEntity.h:152
RPolyline::countVertices
int countVertices() const
Definition: RPolyline.cpp:563
RBox.h
RSolidData::trimEndPoint
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RSolidData.h:83
RVector
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RSolidData::getEndPoint
RVector getEndPoint() const
Definition: RSolidData.h:58
RS::Ending
Ending
Entity ending.
Definition: RS.h:215
RSolidData::getDirection2
double getDirection2() const
Definition: RSolidData.h:64
RS::EntitySolid
@ EntitySolid
Solid.
Definition: RS.h:152
RSolidData::getVertexAt
RVector getVertexAt(int i) const
Definition: RSolidData.h:70
i
int i
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: autostart.js:49
RSolidData::reverse
bool reverse()
Definition: RSolidData.h:67
RS::EntityType
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:125
RPolyline::getDirection2
virtual double getDirection2() const
Definition: RPolyline.cpp:1398
RSolidData::getGeometry
RPolyline getGeometry()
Definition: RSolidData.h:104
RSolidData::getDirection1
double getDirection1() const
Definition: RSolidData.h:61
RObject::document
RDocument * document
Definition: RObject.h:341
RPolyline::getStartPoint
virtual RVector getStartPoint() const
Definition: RPolyline.cpp:1335
QCADENTITY_EXPORT
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
RPolyline::trimStartPoint
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RPolyline.cpp:1930
RShape
Interface for geometrical shape classes.
Definition: RShape.h:72
RDocument.h
RVector.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
REntityData::getReferencePoints
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const =0
REntityData
Base class for all entity data classes.
Definition: REntityData.h:67
RPolyline::reverse
virtual bool reverse()
Definition: RPolyline.cpp:1877
RPolyline::getDirection1
virtual double getDirection1() const
Definition: RPolyline.cpp:1389
RSolidData::countVertices
int countVertices() const
Definition: RSolidData.h:73
RPolyline::getVertexAt
RVector getVertexAt(int i) const
Definition: RPolyline.cpp:514
RPolyline::trimEndPoint
virtual bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RPolyline.cpp:1937
RDocument
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:72
RTriangle
Low-level mathematical representation of a triangle.
Definition: RTriangle.h:46
RSolidData::castToShape
virtual RShape * castToShape()
Definition: RSolidData.h:91
RPolyline::getEndPoint
virtual RVector getEndPoint() const
Definition: RPolyline.cpp:1343
RPolyline.h
RSolidData::getShapes
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const
Definition: RSolidData.h:95
RSolidData::getType
virtual RS::EntityType getType() const
Definition: RSolidData.h:52
RS::ProjectionRenderingHint
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:185
RDEFAULT_RBOX
#define RDEFAULT_RBOX
Definition: RBox.h:32
RSolidData::trimStartPoint
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RSolidData.h:80
RSolidData
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RSolidData.h:39
RSolidData::getTrimEnd
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RSolidData.h:77
RS::RenderTop
@ RenderTop
Definition: RS.h:186
RBox
Represents a box e.g.
Definition: RBox.h:43
RVector::invalid
static const RVector invalid
invalid vector
Definition: RVector.h:322
entity_global.h
RSolidData::getStartPoint
RVector getStartPoint() const
Definition: RSolidData.h:55
RPolyline
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
RPolyline::getTrimEnd
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RPolyline.cpp:1923
REntityData::moveReferencePoint
virtual bool moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint, Qt::KeyboardModifiers modifiers=Qt::NoModifier)=0
Moves the given reference point to the given target point or does nothing if this entity has no refer...
RSolidEntity
Solid entity.
Definition: RSolidEntity.h:38