QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RSolidEntity.h
Go to the documentation of this file.
1
20#ifndef RSOLIDENTITY_H
21#define RSOLIDENTITY_H
22
23#include "entity_global.h"
24
25#include "REntity.h"
26#include "RSolidData.h"
27
28class RDocument;
29class RExporter;
30
39
40public:
54
67
70
71public:
72 RSolidEntity(RDocument* document, const RSolidData& data);
73 virtual ~RSolidEntity();
74
75 static void init();
76
78 return RS::EntitySolid;
79 }
80
81 static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
83 }
84
85 virtual QSharedPointer<RObject> clone() const {
86 return QSharedPointer<RObject>(new RSolidEntity(*this));
87 }
88
89 QSharedPointer<RSolidEntity> cloneToSolidEntity() const {
90 return QSharedPointer<RSolidEntity>(new RSolidEntity(*this));
91 }
92
93 virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
94 RTransaction* transaction=NULL);
95 virtual QPair<QVariant, RPropertyAttributes> getProperty(
96 RPropertyTypeId& propertyTypeId,
97 bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
98
99 virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
100
101 virtual RSolidData& getData() {
102 return data;
103 }
104
105 virtual const RSolidData& getData() const {
106 return data;
107 }
108
109 RVector getVertexAt(int i) const {
110 return data.getVertexAt(i);
111 }
112
113 int countVertices() const {
114 return data.countVertices();
115 }
116
118 return data.getStartPoint();
119 }
120
122 return data.getEndPoint();
123 }
124
125 double getDirection1() const {
126 return data.getDirection1();
127 }
128
129 double getDirection2() const {
130 return data.getDirection2();
131 }
132
133 bool reverse() {
134 return data.reverse();
135 }
136
137 RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
138 return data.getTrimEnd(trimPoint, clickPoint);
139 }
140
141 bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
142 return data.trimStartPoint(trimPoint, clickPoint, extend);
143 }
144 bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
145 return data.trimEndPoint(trimPoint, clickPoint, extend);
146 }
147
148 double getLength() const {
149 return data.getLength();
150 }
151
152 QList<QSharedPointer<RShape> > getExploded() const {
153 return data.getExploded();
154 }
155
156protected:
157 virtual void print(QDebug dbg) const;
158
159protected:
161};
162
164Q_DECLARE_METATYPE(QSharedPointer<RSolidEntity>)
165Q_DECLARE_METATYPE(QSharedPointer<RSolidEntity>*)
166
167#endif
Q_DECLARE_METATYPE(RMath *)
int i
Copyright (c) 2011-2018 by Andrew Mustun.
Definition autostart.js:32
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
Base class for all entity classes.
Definition REntity.h:63
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition REntity.cpp:236
static void init()
Definition REntity.cpp:89
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition REntity.cpp:338
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition REntity.cpp:487
Abstract base class for exporters.
Definition RExporter.h:78
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyTypeId.h:54
static QSet< RPropertyTypeId > getPropertyTypeIds(RS::EntityType type, RPropertyAttributes::Option=RPropertyAttributes::NoOptions)
Gets all property type IDs that where registered for the given class.
Definition RPropertyTypeId.cpp:283
EntityType
Entity types used for property handling / filtering.
Definition RS.h:227
@ EntitySolid
Solid.
Definition RS.h:256
Ending
Entity ending.
Definition RS.h:323
Stores and manages all data that defines the geometry and appearance of a solid entity.
Definition RSolidData.h:44
Solid entity.
Definition RSolidEntity.h:38
virtual const RSolidData & getData() const
Definition RSolidEntity.h:105
RSolidData data
Definition RSolidEntity.h:160
static RPropertyTypeId PropertyLinetypeScale
Definition RSolidEntity.h:49
static RPropertyTypeId PropertyWorkingSet
Definition RSolidEntity.h:44
static RPropertyTypeId PropertyDrawOrder
Definition RSolidEntity.h:53
virtual RSolidData & getData()
Definition RSolidEntity.h:101
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition RSolidEntity.h:144
double getDirection2() const
Definition RSolidEntity.h:129
bool reverse()
Definition RSolidEntity.h:133
static RPropertyTypeId PropertyPoint1Z
Definition RSolidEntity.h:57
static RPropertyTypeId PropertyPoint3X
Definition RSolidEntity.h:61
static RPropertyTypeId PropertyPoint1Y
Definition RSolidEntity.h:56
static RPropertyTypeId PropertyPoint3Y
Definition RSolidEntity.h:62
double getDirection1() const
Definition RSolidEntity.h:125
static RPropertyTypeId PropertyTotalLength
Definition RSolidEntity.h:69
static RPropertyTypeId PropertyProtected
Definition RSolidEntity.h:43
static RPropertyTypeId PropertyBlock
Definition RSolidEntity.h:46
static RPropertyTypeId PropertyColor
Definition RSolidEntity.h:51
int countVertices() const
Definition RSolidEntity.h:113
static RPropertyTypeId PropertyPoint2Z
Definition RSolidEntity.h:60
static RPropertyTypeId PropertyPoint4X
Definition RSolidEntity.h:64
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition RSolidEntity.h:141
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RSolidEntity.h:41
QList< QSharedPointer< RShape > > getExploded() const
Definition RSolidEntity.h:152
static RPropertyTypeId PropertyType
Definition RSolidEntity.h:45
QSharedPointer< RSolidEntity > cloneToSolidEntity() const
Definition RSolidEntity.h:89
RVector getEndPoint() const
Definition RSolidEntity.h:121
static RPropertyTypeId PropertyDisplayedColor
Definition RSolidEntity.h:52
static RPropertyTypeId PropertyPoint3Z
Definition RSolidEntity.h:63
static RPropertyTypeId PropertyLinetype
Definition RSolidEntity.h:48
static RS::EntityType getRtti()
Definition RSolidEntity.h:77
static RPropertyTypeId PropertyPoint4Z
Definition RSolidEntity.h:66
virtual QSharedPointer< RObject > clone() const
Definition RSolidEntity.h:85
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition RSolidEntity.h:81
static RPropertyTypeId PropertyPoint2Y
Definition RSolidEntity.h:59
static RPropertyTypeId PropertyPoint2X
Definition RSolidEntity.h:58
static RPropertyTypeId PropertyPoint4Y
Definition RSolidEntity.h:65
double getLength() const
Definition RSolidEntity.h:148
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition RSolidEntity.h:137
static RPropertyTypeId PropertyLength
Definition RSolidEntity.h:68
static RPropertyTypeId PropertyLayer
Definition RSolidEntity.h:47
static RPropertyTypeId PropertyLineweight
Definition RSolidEntity.h:50
RVector getStartPoint() const
Definition RSolidEntity.h:117
static RPropertyTypeId PropertyHandle
Definition RSolidEntity.h:42
RVector getVertexAt(int i) const
Definition RSolidEntity.h:109
static RPropertyTypeId PropertyPoint1X
Definition RSolidEntity.h:55
Transaction implementation.
Definition RTransaction.h:73
Represents a 3d vector (x/y/z).
Definition RVector.h:47
static const RVector invalid
invalid vector
Definition RVector.h:335
#define QCADENTITY_EXPORT
Definition entity_global.h:10
#define NULL
Definition opennurbs_system.h:256