QCAD Application Framework
CAD Application Development and Automation.
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
RBlockReferenceData.h
Go to the documentation of this file.
1
#ifndef RBLOCKREFERENCEDATA_H
2
#define RBLOCKREFERENCEDATA_H
3
4
#include "
RBox.h
"
5
#include "
RDocument.h
"
6
#include "
REntity.h
"
7
#include "
RVector.h
"
8
#include "
RBlock.h
"
9
14
class
RBlockReferenceData
:
public
REntityData
{
15
16
friend
class
RBlockReferenceEntity
;
17
18
protected
:
19
RBlockReferenceData
(
RDocument
*
document
,
const
RBlockReferenceData
&
data
);
20
21
public
:
22
RBlockReferenceData
();
23
RBlockReferenceData
(
RBlock::Id
referencedBlockId
,
24
const
RVector
&
position
,
const
RVector
&
scaleFactors
,
double
angle);
25
26
virtual
RBox
getBoundingBox
()
const
;
27
virtual
QList<RBox>
getBoundingBoxes
(
/*RObject::Id subEntityId = REntity::INVALID_ID*/
)
const
;
28
//virtual QList<QPair<REntity::Id, RBox> > getIdBoundingBoxes() const;
29
30
virtual
QList<RVector>
getReferencePoints
(
31
RS::ProjectionRenderingHint
hint =
RS::RenderTop
)
const
;
32
//virtual QList<RVector> getEndPoints() const;
33
//virtual QList<RVector> getMiddlePoints() const;
34
//virtual QList<RVector> getCenterPoints() const;
35
virtual
RVector
getClosestPointOnEntity
(
36
const
RVector
& point,
double
range=
RNANDOUBLE
37
)
const
;
38
virtual
QList<RVector>
getIntersectionPoints
(
const
REntity
& other,
39
bool
limited =
true
)
const
;
40
virtual
RVector
getVectorTo
(
const
RVector
& point,
41
bool
limited =
true
)
const
;
42
virtual
double
getDistanceTo
(
const
RVector
& point,
43
bool
limited =
true
,
double
range = 0.0,
bool
draft =
false
)
const
;
44
// virtual QList<RVector> getPointsWithDistanceToEnd(double distance, const RBox& queryBox = RDEFAULT_RBOX) const;
45
46
virtual
QList<QSharedPointer<RShape> >
getShapes
(
const
RBox
& queryBox =
RDEFAULT_RBOX
)
const
;
47
48
virtual
bool
moveReferencePoint
(
const
RVector
& referencePoint,
49
const
RVector
& targetPoint);
50
virtual
bool
move
(
const
RVector
& offset);
51
virtual
bool
rotate
(
double
rotation
,
const
RVector
& center =
RDEFAULT_RVECTOR
);
52
virtual
bool
mirror
(
const
RLine
& axis);
53
virtual
bool
scale
(
const
RVector
&
scaleFactors
,
54
const
RVector
& center =
RDEFAULT_RVECTOR
);
55
56
void
setReferencedBlockId
(
RBlock::Id
blockId
) {
57
referencedBlockId
=
blockId
;
58
}
59
60
RBlock::Id
getReferencedBlockId
()
const
{
61
return
referencedBlockId
;
62
}
63
64
void
setReferencedBlockName
(
const
QString& blockName);
65
QString
getReferencedBlockName
()
const
;
66
67
RVector
getPosition
()
const
{
68
return
position
;
69
}
70
71
void
setPosition
(
const
RVector
& p) {
72
position
= p;
73
}
74
75
RVector
getScaleFactors
()
const
{
76
return
scaleFactors
;
77
}
78
79
void
setScaleFactors
(
const
RVector
& sf) {
80
scaleFactors
= sf;
81
if
(fabs(
scaleFactors
.
x
) <
RS::PointTolerance
) {
82
scaleFactors
.
x
= 1.0;
83
}
84
if
(fabs(
scaleFactors
.
y
) <
RS::PointTolerance
) {
85
scaleFactors
.
y
= 1.0;
86
}
87
if
(fabs(
scaleFactors
.
z
) <
RS::PointTolerance
) {
88
scaleFactors
.
z
= 1.0;
89
}
90
}
91
92
double
getRotation
()
const
{
93
return
rotation
;
94
}
95
96
void
setRotation
(
double
r) {
97
rotation
= r;
98
}
99
100
virtual
void
update
()
const
;
101
virtual
void
update
(
RObject::Id
entityId)
const
;
102
103
QSharedPointer<REntity>
queryEntity
(
REntity::Id
entityId)
const
;
104
105
private
:
106
RBlock::Id
referencedBlockId
;
107
RVector
position
;
108
RVector
scaleFactors
;
109
double
rotation
;
110
mutable
RBox
boundingBox
;
111
mutable
QMap<REntity::Id, QSharedPointer<REntity> >
cache
;
112
};
113
114
Q_DECLARE_METATYPE
(
RBlockReferenceData
*)
115
Q_DECLARE_METATYPE
(QSharedPointer<
RBlockReferenceData
>)
116
117
#endif
src
core
RBlockReferenceData.h
Generated on Tue Jun 26 2012 18:41:07 for QCAD Application Framework by
1.8.1.1