QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RLineEntity.h
Go to the documentation of this file.
1
20#ifndef RLINEENTITY_H
21#define RLINEENTITY_H
22
23#include "entity_global.h"
24
25#include "REntity.h"
26#include "RLineData.h"
27
28class RDocument;
29class RExporter;
30
39
40public:
54
64
68
69public:
70 RLineEntity(RDocument* document, const RLineData& data);
71 RLineEntity(const RLineEntity& other);
72 virtual ~RLineEntity();
73
74 static void init();
75
77 return RS::EntityLine;
78 }
79
80 static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
82 }
83
84 virtual QSharedPointer<RObject> clone() const {
85 return QSharedPointer<RObject>(new RLineEntity(*this));
86 }
87
88 QSharedPointer<RLineEntity> cloneToLineEntity() const {
89 return QSharedPointer<RLineEntity>(new RLineEntity(*this));
90 }
91
92 virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
93 RTransaction* transaction=NULL);
94 virtual QPair<QVariant, RPropertyAttributes> getProperty(
95 RPropertyTypeId& propertyTypeId,
96 bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
97
98 virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
99
100 virtual RLineData& getData() {
101 return data;
102 }
103
104 virtual const RLineData& getData() const {
105 return data;
106 }
107
108 void setShape(const RLine& l);
109
110 void setStartPoint(const RVector& p) {
111 data.setStartPoint(p);
112 }
113
115 return data.getStartPoint();
116 }
117
118 void setEndPoint(const RVector& p) {
119 data.setEndPoint(p);
120 }
121
123 return data.getEndPoint();
124 }
125
127 return getData().getMiddlePoint();
128 }
129
130 double getAngle() const {
131 return data.getAngle();
132 }
133
134 double getAngleAt(double distance, RS::From from) const {
135 return data.getAngleAt(distance, from);
136 }
137
138 double getDirection1() const {
139 return data.getDirection1();
140 }
141
142 double getDirection2() const {
143 return data.getDirection2();
144 }
145
146 bool reverse() {
147 return data.reverse();
148 }
149
150 RS::Side getSideOfPoint(const RVector& point) const {
151 return data.getSideOfPoint(point);
152 }
153
154 RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
155 return data.getTrimEnd(trimPoint, clickPoint);
156 }
157
158 bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
159 return data.trimStartPoint(trimPoint, clickPoint, extend);
160 }
161 bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
162 return data.trimEndPoint(trimPoint, clickPoint, extend);
163 }
164
165 double getLength() const {
166 return data.getLength();
167 }
168
169protected:
170 virtual void print(QDebug dbg) const;
171
172protected:
174};
175
177Q_DECLARE_METATYPE(QSharedPointer<RLineEntity>)
178Q_DECLARE_METATYPE(QSharedPointer<RLineEntity>*)
179
180#endif
Q_DECLARE_METATYPE(RMath *)
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 REntityData & getData()=0
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
Stores and manages all data that defines the geometry and appearance of a line entity.
Definition RLineData.h:42
Line entity.
Definition RLineEntity.h:38
static RPropertyTypeId PropertyLayer
Definition RLineEntity.h:47
static RPropertyTypeId PropertyMiddlePointY
Definition RLineEntity.h:59
virtual const RLineData & getData() const
Definition RLineEntity.h:104
static RPropertyTypeId PropertyDrawOrder
Definition RLineEntity.h:53
static RPropertyTypeId PropertyHandle
Definition RLineEntity.h:42
static RPropertyTypeId PropertyStartPointY
Definition RLineEntity.h:56
void setEndPoint(const RVector &p)
Definition RLineEntity.h:118
static RPropertyTypeId PropertyLinetypeScale
Definition RLineEntity.h:49
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition RLineEntity.h:158
static RPropertyTypeId PropertyTotalLength
Definition RLineEntity.h:67
static RPropertyTypeId PropertyBlock
Definition RLineEntity.h:46
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition RLineEntity.h:161
RVector getMiddlePoint() const
Definition RLineEntity.h:126
static RPropertyTypeId PropertyWorkingSet
Definition RLineEntity.h:44
double getDirection1() const
Definition RLineEntity.h:138
static RPropertyTypeId PropertyEndPointX
Definition RLineEntity.h:61
QSharedPointer< RLineEntity > cloneToLineEntity() const
Definition RLineEntity.h:88
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RLineEntity.h:41
static RPropertyTypeId PropertyMiddlePointX
Definition RLineEntity.h:58
static RPropertyTypeId PropertyMiddlePointZ
Definition RLineEntity.h:60
virtual QSharedPointer< RObject > clone() const
Definition RLineEntity.h:84
double getDirection2() const
Definition RLineEntity.h:142
static RPropertyTypeId PropertyLinetype
Definition RLineEntity.h:48
static RPropertyTypeId PropertyLength
Definition RLineEntity.h:66
static RPropertyTypeId PropertyEndPointY
Definition RLineEntity.h:62
static RPropertyTypeId PropertyStartPointX
Definition RLineEntity.h:55
static RPropertyTypeId PropertyProtected
Definition RLineEntity.h:43
void setStartPoint(const RVector &p)
Definition RLineEntity.h:110
static RPropertyTypeId PropertyEndPointZ
Definition RLineEntity.h:63
RLineData data
Definition RLineEntity.h:173
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition RLineEntity.h:154
RS::Side getSideOfPoint(const RVector &point) const
Definition RLineEntity.h:150
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition RLineEntity.h:80
double getAngleAt(double distance, RS::From from) const
Definition RLineEntity.h:134
bool reverse()
Definition RLineEntity.h:146
RVector getStartPoint() const
Definition RLineEntity.h:114
static RS::EntityType getRtti()
Definition RLineEntity.h:76
virtual RLineData & getData()
Definition RLineEntity.h:100
static RPropertyTypeId PropertyColor
Definition RLineEntity.h:51
double getAngle() const
Definition RLineEntity.h:130
static RPropertyTypeId PropertyAngle
Definition RLineEntity.h:65
RVector getEndPoint() const
Definition RLineEntity.h:122
static RPropertyTypeId PropertyStartPointZ
Definition RLineEntity.h:57
static RPropertyTypeId PropertyType
Definition RLineEntity.h:45
double getLength() const
Definition RLineEntity.h:165
static RPropertyTypeId PropertyDisplayedColor
Definition RLineEntity.h:52
static RPropertyTypeId PropertyLineweight
Definition RLineEntity.h:50
Low-level mathematical representation of a line.
Definition RLine.h:41
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
From
End used to specify from which end of a shape to measure a distance.
Definition RS.h:371
EntityType
Entity types used for property handling / filtering.
Definition RS.h:227
@ EntityLine
Line.
Definition RS.h:249
Side
Side used for side of a point relative to an entity (right hand or left hand side)
Definition RS.h:313
Ending
Entity ending.
Definition RS.h:323
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