QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
dxf
qgsdxfpaintengine.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsdxpaintengine.h
3
------------------
4
begin : November 2013
5
copyright : (C) 2013 by Marco Hugentobler
6
email : marco at sourcepole dot ch
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSDXFPAINTENGINE_H
19
#define QGSDXFPAINTENGINE_H
20
21
22
#include "qgis_core.h"
23
#include "
qgsabstractgeometry.h
"
24
25
#include <QPaintEngine>
26
#include <QPainterPath>
27
28
#define SIP_NO_FILE
29
30
class
QgsPoint
;
31
class
QgsDxfExport
;
32
class
QgsDxfPaintDevice
;
33
34
41
42
class
CORE_EXPORT
QgsDxfPaintEngine
:
public
QPaintEngine
43
{
44
public
:
45
QgsDxfPaintEngine
(
const
QgsDxfPaintDevice
*dxfDevice,
QgsDxfExport
*dxf );
46
47
bool
begin
( QPaintDevice *pdev )
override
;
48
bool
end
()
override
;
49
QPaintEngine::Type
type
()
const override
;
50
void
updateState
(
const
QPaintEngineState &state )
override
;
51
52
void
drawPixmap
(
const
QRectF &r,
const
QPixmap &pm,
const
QRectF &sr )
override
;
53
54
void
drawPolygon
(
const
QPointF *points,
int
pointCount, PolygonDrawMode mode )
override
;
55
void
drawPath
(
const
QPainterPath &path )
override
;
56
void
drawLines
(
const
QLineF *lines,
int
lineCount )
override
;
57
58
void
setLayer
(
const
QString &
layer
) { mLayer =
layer
; }
59
QString
layer
()
const
{
return
mLayer; }
60
61
void
setShift
( QPointF shift ) { mShift = shift; }
62
63
private
:
64
const
QgsDxfPaintDevice
*mPaintDevice =
nullptr
;
65
QgsDxfExport
*mDxf =
nullptr
;
66
67
//painter state information
68
QTransform mTransform;
69
QPen mPen;
70
QBrush mBrush;
72
double
mOpacity = 1.0;
73
QString mLayer;
74
QPointF mShift;
75
QgsRingSequence
mPolygon;
76
QPolygonF mCurrentPolygon;
77
QList<QPointF> mCurrentCurve;
78
79
QPainterPath mClipPath;
//in painter device coordinates
80
bool
mClipEnabled =
false
;
81
88
QList<QPolygonF> clipPolygonLogical(
const
QPolygonF &polyLogical )
const
;
89
90
QgsPoint
toDxfCoordinates( QPointF pt )
const
;
91
double
currentWidth()
const
;
92
93
void
moveTo(
double
dx,
double
dy );
94
void
lineTo(
double
dx,
double
dy );
95
void
curveTo(
double
dx,
double
dy );
96
void
endPolygon();
97
void
endCurve();
98
99
void
setRing(
QgsPointSequence
&polyline,
const
QPointF *points,
int
pointCount );
100
101
//utils for bezier curve calculation
102
static
QPointF bezierPoint(
const
QList<QPointF> &controlPolygon,
double
t );
103
static
double
bernsteinPoly(
int
n,
int
i,
double
t );
104
static
int
lower(
int
n,
int
i );
105
static
double
power(
double
a,
int
b );
106
static
int
faculty(
int
n );
107
109
QColor penColor()
const
;
111
QColor brushColor()
const
;
112
};
113
114
#endif
// QGSDXFPAINTENGINE_H
QgsDxfExport
Exports QGIS layers to the DXF format.
Definition
qgsdxfexport.h:70
QgsDxfPaintDevice
A paint device for drawing into dxf files.
Definition
qgsdxfpaintdevice.h:41
QgsDxfPaintEngine::setShift
void setShift(QPointF shift)
Definition
qgsdxfpaintengine.h:61
QgsDxfPaintEngine::drawPath
void drawPath(const QPainterPath &path) override
Definition
qgsdxfpaintengine.cpp:182
QgsDxfPaintEngine::begin
bool begin(QPaintDevice *pdev) override
Definition
qgsdxfpaintengine.cpp:34
QgsDxfPaintEngine::QgsDxfPaintEngine
QgsDxfPaintEngine(const QgsDxfPaintDevice *dxfDevice, QgsDxfExport *dxf)
Definition
qgsdxfpaintengine.cpp:28
QgsDxfPaintEngine::drawPixmap
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override
Definition
qgsdxfpaintengine.cpp:50
QgsDxfPaintEngine::updateState
void updateState(const QPaintEngineState &state) override
Definition
qgsdxfpaintengine.cpp:57
QgsDxfPaintEngine::setLayer
void setLayer(const QString &layer)
Definition
qgsdxfpaintengine.h:58
QgsDxfPaintEngine::end
bool end() override
Definition
qgsdxfpaintengine.cpp:40
QgsDxfPaintEngine::drawLines
void drawLines(const QLineF *lines, int lineCount) override
Definition
qgsdxfpaintengine.cpp:282
QgsDxfPaintEngine::type
QPaintEngine::Type type() const override
Definition
qgsdxfpaintengine.cpp:45
QgsDxfPaintEngine::layer
QString layer() const
Definition
qgsdxfpaintengine.h:59
QgsDxfPaintEngine::drawPolygon
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override
Definition
qgsdxfpaintengine.cpp:148
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition
qgspoint.h:53
qgsabstractgeometry.h
QgsRingSequence
QVector< QgsPointSequence > QgsRingSequence
Definition
qgsabstractgeometry.h:59
QgsPointSequence
QVector< QgsPoint > QgsPointSequence
Definition
qgsabstractgeometry.h:57
Generated on
for QGIS API Documentation by
1.17.0