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
RPolyline.h
Go to the documentation of this file.
1
#ifndef RPOLYLINE_H
2
#define RPOLYLINE_H
3
4
#include <QPainterPath>
5
6
#include "
RDirected.h
"
7
#include "
RExplodable.h
"
8
#include "
RShape.h
"
9
#include "
RVector.h
"
10
11
class
RBox
;
12
23
class
RPolyline
:
public
RShape
,
public
RExplodable
,
public
RDirected
{
24
public
:
25
RPolyline
();
26
RPolyline
(
const
QList<RVector>&
vertices
,
bool
closed
);
27
RPolyline
(
const
QList<QSharedPointer<RShape> >& segments);
28
virtual
~RPolyline
();
29
30
virtual
RPolyline
*
clone
()
const
{
31
return
new
RPolyline
(*
this
);
32
}
33
34
virtual
void
to2D
();
35
36
void
clear
();
37
void
normalize
();
38
39
void
appendShape
(
const
RShape
& shape);
40
41
void
appendVertex
(
const
RVector
& vertex,
double
bulge = 0.0);
42
void
prependVertex
(
const
RVector
& vertex,
double
bulge = 0.0);
43
void
insertVertex
(
int
index,
const
RVector
& vertex);
44
void
removeLastVertex
();
45
void
removeVertex
(
int
index);
46
47
void
setVertices
(
const
QList<RVector>& vertices);
48
QList<RVector>
getVertices
()
const
;
49
void
setVertexAt
(
int
i,
const
RVector
& v);
50
RVector
getVertexAt
(
int
i)
const
;
51
RVector
getLastVertex
()
const
;
52
int
countVertices
()
const
;
53
54
void
setBulges
(
const
QList<double>& b);
55
QList<double>
getBulges
()
const
;
56
double
getBulgeAt
(
int
i)
const
;
57
void
setBulgeAt
(
int
i,
double
b);
58
bool
hasArcSegments
()
const
;
59
60
void
setClosed
(
bool
on);
61
bool
isClosed
()
const
;
62
bool
isLogicallyClosed
()
const
;
63
64
bool
contains
(
const
RVector
& point)
const
;
65
// TODO:
66
//bool contains(const RShape& shape) const;
67
68
virtual
RVector
getStartPoint
()
const
;
69
virtual
RVector
getEndPoint
()
const
;
70
71
virtual
double
getDirection1
()
const
;
72
virtual
double
getDirection2
()
const
;
73
74
virtual
RBox
getBoundingBox
()
const
;
75
76
virtual
double
getLength
()
const
;
77
78
virtual
QList<RVector>
getEndPoints
()
const
;
79
virtual
QList<RVector>
getMiddlePoints
()
const
;
80
virtual
QList<RVector>
getCenterPoints
()
const
;
81
virtual
QList<RVector>
getPointsWithDistanceToEnd
(
82
double
distance,
RS::From
from =
RS::FromAny
)
const
;
83
84
virtual
RVector
getVectorTo
(
const
RVector
& point,
85
bool
limited =
true
)
const
;
86
87
virtual
bool
move
(
const
RVector
& offset);
88
virtual
bool
rotate
(
double
rotation,
const
RVector
& center =
RDEFAULT_RVECTOR
);
89
virtual
bool
scale
(
double
scaleFactor,
const
RVector
& center =
RDEFAULT_RVECTOR
);
90
virtual
bool
scale
(
const
RVector
& scaleFactors,
const
RVector
& center =
RDEFAULT_RVECTOR
);
91
virtual
bool
mirror
(
const
RLine
& axis);
92
virtual
bool
flipHorizontal
();
93
virtual
bool
flipVertical
();
94
virtual
bool
reverse
();
95
virtual
bool
stretch
(
const
RPolyline
& area,
const
RVector
& offset);
96
97
virtual
RS::Ending
getTrimEnd
(
const
RVector
& coord,
const
RVector
& trimPoint);
98
virtual
void
trimStartPoint
(
const
RVector
& p);
99
virtual
void
trimEndPoint
(
const
RVector
& p);
100
101
virtual
QList<QSharedPointer<RShape> >
getExploded
()
const
;
102
virtual
bool
isInterpolated
()
const
{
103
return
false
;
104
}
105
int
countSegments
()
const
;
106
QSharedPointer<RShape>
getSegmentAt
(
int
i)
const
;
107
108
static
bool
isStraight
(
double
bulge);
109
110
QPainterPath
toPainterPath
()
const
;
111
112
protected
:
113
void
addToPainterPath
(QPainterPath& pp, QSharedPointer<RShape> shape)
const
;
114
bool
isLineSegment
(
int
i)
const
;
115
116
void
print
(QDebug dbg)
const
;
117
118
protected
:
123
QList<RVector>
vertices
;
124
125
QList<double>
bulges
;
126
131
bool
closed
;
132
133
private
:
134
// TODO caching:
135
//QList<QSharedPointer<RShape> > subShapes;
136
};
137
138
Q_DECLARE_METATYPE
(
const
RPolyline
*)
139
Q_DECLARE_METATYPE
(
RPolyline
*)
140
Q_DECLARE_METATYPE
(
RPolyline
)
141
Q_DECLARE_METATYPE
(QSharedPointer<
RPolyline
>)
142
Q_DECLARE_METATYPE
(QSharedPointer<
RPolyline
>*)
143
144
#endif
src
math
RPolyline.h
Generated on Tue Jun 26 2012 18:41:08 for QCAD Application Framework by
1.8.1.1