|
QCAD
Open Source 2D CAD
|
Go to the documentation of this file.
20 #ifndef RPAINTERPATH_H
21 #define RPAINTERPATH_H
27 #include <QPainterPath>
29 #include <QSharedPointer>
54 FixedPenColor = 0x0008,
55 FixedBrushColor = 0x0010,
63 SimplePointDisplay = 0x1000,
67 Q_DECLARE_FLAGS(Modes, Mode)
75 void setPath(
const QPainterPath& path);
77 QList<QSharedPointer<RShape> > getShapes()
const;
80 return RVector(currentPosition().x(), currentPosition().y());
86 QPainterPath::moveTo(v.
x, v.
y);
90 if (!isAtPosition(v)) {
96 QPainterPath::moveTo(x, y);
103 QPainterPath::moveTo(p);
107 QPainterPath::lineTo(v.
x, v.
y);
111 QPainterPath::lineTo(x, y);
118 QPainterPath::lineTo(p);
122 QPainterPath::quadTo(cp.
x, cp.
y, v.
x, v.
y);
125 void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty) {
126 QPainterPath::quadTo(ctrlPtx, ctrlPty, endPtx, endPty);
130 QPainterPath::cubicTo(cp1.
x, cp1.
y, cp2.
x, cp2.
y, v.
x, v.
y);
133 void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y, qreal endPtx, qreal endPty) {
134 QPainterPath::cubicTo(ctrlPt1x, ctrlPt1y, ctrlPt2x, ctrlPt2y, endPtx, endPty);
138 QPainterPath::closeSubpath();
154 return QPainterPath::contains(QPointF(v.
x, v.
y));
164 void addRect(
double x1,
double y1,
double x2,
double y2);
165 void addRect(
const QRectF& rect);
166 void addBox(
const RBox& box);
168 RBox getBoundingBox()
const;
173 bool isValid()
const;
174 void setValid(
bool on);
178 int getZLevel()
const;
179 void setZLevel(
int zl);
183 void setPen(
const QPen& p);
185 QBrush getBrush()
const;
186 void setBrush(
const QBrush& b);
191 void setHighlighted(
bool on);
192 bool isHighlighted()
const;
194 void setSelected(
bool on);
195 bool isSelected()
const;
197 void setFixedPenColor(
bool on);
198 bool isFixedPenColor()
const;
200 void setFixedBrushColor(
bool on);
201 bool isFixedBrushColor()
const;
203 void setAutoRegen(
bool on);
204 bool getAutoRegen()
const;
206 void setAlwaysRegen(
bool on);
207 bool getAlwaysRegen()
const;
209 void setInheritPen(
bool on);
210 bool getInheritPen()
const;
212 void setPixelUnit(
bool on);
213 bool getPixelUnit()
const;
215 void setNoClipping(
bool on);
216 bool getNoClipping()
const;
218 void setNoColorMode(
bool on);
219 bool getNoColorMode()
const;
221 void setSimplePointDisplay(
bool on);
222 bool getSimplePointDisplay()
const;
224 void setPolylineGen(
bool on);
225 bool getPolylineGen()
const;
227 void setNoPattern(
bool on);
228 bool getNoPattern()
const;
230 void setPixelWidth(
bool on);
231 bool getPixelWidth()
const;
233 void setFeatureSize(
double s);
234 double getFeatureSize()
const;
236 void setPixelSizeHint(
double s);
237 double getPixelSizeHint()
const;
239 double getDistanceTo(
const RVector& point)
const;
243 void setPoints(
const QList<RVector>& p);
244 QList<RVector> getPoints()
const;
246 void transform(
const QTransform& t);
248 void rotate(
double angle);
249 void scale(
double fx,
double fy);
251 int getElementCount()
const;
252 double getXAt(
int i)
const;
253 double getYAt(
int i)
const;
254 QPainterPath::ElementType getTypeAt(
int i)
const;
255 bool isEmpty()
const;
257 void addShape(QSharedPointer<RShape> shape);
259 void addOriginalShape(QSharedPointer<RShape> shape);
260 bool hasOriginalShapes()
const;
261 int countOriginalShapes()
const;
262 QSharedPointer<RShape> getOriginalShape(
int i)
const;
264 static void rotateList(QList<RPainterPath>& pps,
double angle);
265 static void translateList(QList<RPainterPath>& pps,
const RVector& offset);
266 static void scaleList(QList<RPainterPath>& pps,
double fx,
double fy);
267 static RVector getMinList(QList<RPainterPath>& pps);
268 static RVector getMaxList(QList<RPainterPath>& pps);
288 Q_DECLARE_OPERATORS_FOR_FLAGS(RPainterPath::Modes)
void addPoint(void position)
Adds a point to the drawing.
Definition: simple_create.js:78
void moveTo(qreal x, qreal y)
Definition: RPainterPath.h:95
void cubicTo(const RVector &cp1, const RVector &cp2, const RVector &v)
Definition: RPainterPath.h:129
double y
Getter function for this property: getY Setter function for this property: setY
Definition: RVector.h:306
void addPolyline(void points, void closed, void relative)
Adds a polyline to the drawing.
Definition: simple_create.js:107
void moveToOrNop(const RVector &v)
Definition: RPainterPath.h:89
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RSpline.h:54
void rotate(void e, void angle, void center)
Rotates the given entity or shape by the given angle around the given center.
Definition: simple_modify.js:109
static const double PointTolerance
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RS.h:699
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
Mode
Definition: RPainterPath.h:49
void addShape(void shape, void color, void linetype, void lineweight)
Adds the given RShape to the drawing as a new entity using current layer and attributes.
Definition: simple_create.js:155
int i
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: autostart.js:49
void moveTo(const RVector &v)
Definition: RPainterPath.h:85
Low-level mathematical representation of an arc.
Definition: RArc.h:40
void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty)
Definition: RPainterPath.h:125
void addArc(void center, void radius, void startAngle, void endAngle, void reversed)
Adds an arc to the drawing.
Definition: simple_create.js:141
void addLine(void startPoint, void endPoint)
Adds a line to the drawing.
Definition: simple_create.js:27
Low-level mathematical representation of a line.
Definition: RLine.h:41
Modes modes
Definition: RPainterPath.h:274
void lineTo(qreal x, qreal y)
Definition: RPainterPath.h:110
Interface for geometrical shape classes.
Definition: RShape.h:72
Q_DECLARE_METATYPE(RMath *)
QPen pen
Definition: RPainterPath.h:272
void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y, qreal endPtx, qreal endPty)
Definition: RPainterPath.h:133
QList< QSharedPointer< RShape > > originalShapes
Definition: RPainterPath.h:279
QBrush brush
Definition: RPainterPath.h:273
void moveTo(const QPointF &p)
Definition: RPainterPath.h:102
QCADCORE_EXPORT bool operator<(const RPainterPath &p1, const RPainterPath &p2)
This operator allows us to sort painter paths based on z-level.
Definition: RPainterPath.cpp:739
void addSpline(void points, void closed)
Adds a spline to the drawing.
Definition: simple_create.js:169
QList< RVector > points
Definition: RPainterPath.h:275
Extended painter path with a z-level and a pen.
Definition: RPainterPath.h:46
RVector getCurrentPosition() const
Definition: RPainterPath.h:79
bool containsPoint(const RVector &v) const
Definition: RPainterPath.h:153
int zLevel
Definition: RPainterPath.h:271
void lineTo(const QPointF &p)
Definition: RPainterPath.h:117
double featureSize
Definition: RPainterPath.h:277
void closeSubpath()
Definition: RPainterPath.h:137
double x
Getter function for this property: getX Setter function for this property: setX
Definition: RVector.h:300
void lineTo(const RVector &v)
Definition: RPainterPath.h:106
Represents a box e.g.
Definition: RBox.h:43
void move(void e, void offset)
Moves the given entity or shape by the given offset.
Definition: simple_modify.js:25
void quadTo(const RVector &cp, const RVector &v)
Definition: RPainterPath.h:121
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
#define QCADCORE_EXPORT
Definition: core_global.h:10
void scale(void e, void factor, void focusPoint)
Scales the given entity or shape by the given factor with the given focus point.
Definition: simple_modify.js:76
double pixelSizeHint
Definition: RPainterPath.h:278
QCADCORE_EXPORT QDebug operator<<(QDebug dbg, RPainterPath &p)
Stream operator for QDebug.
Definition: RPainterPath.cpp:746