@@ -84,12 +84,19 @@ void QgsDxfPaintEngine::drawPolygon( const QPointF *points, int pointCount, Poly
84
84
polyline[i] = toDxfCoordinates ( points[i] );
85
85
}
86
86
87
- mDxf ->writePolygon ( polygon, mLayer , " SOLID" , currentColor () );
87
+ if ( mode == QPaintEngine::PolylineMode )
88
+ {
89
+ mDxf ->writePolyline ( polyline, mLayer , " CONTINUOUS" , mPen .color (), currentWidth (), true );
90
+ }
91
+ else
92
+ {
93
+ mDxf ->writePolygon ( polygon, mLayer , " SOLID" , mBrush .color () );
94
+ }
88
95
}
89
96
90
97
void QgsDxfPaintEngine::drawRects ( const QRectF* rects, int rectCount )
91
98
{
92
- if ( !mDxf || !mPaintDevice || !rects )
99
+ if ( !mDxf || !mPaintDevice || !rects || mBrush . style () == Qt::NoBrush )
93
100
{
94
101
return ;
95
102
}
@@ -104,7 +111,7 @@ void QgsDxfPaintEngine::drawRects( const QRectF* rects, int rectCount )
104
111
QgsPoint pt2 = toDxfCoordinates ( QPointF ( right, bottom ) );
105
112
QgsPoint pt3 = toDxfCoordinates ( QPointF ( left, top ) );
106
113
QgsPoint pt4 = toDxfCoordinates ( QPointF ( right, top ) );
107
- mDxf ->writeSolid ( mLayer , currentColor (), pt1, pt2, pt3, pt4 );
114
+ mDxf ->writeSolid ( mLayer , mBrush . color (), pt1, pt2, pt3, pt4 );
108
115
}
109
116
}
110
117
@@ -162,7 +169,10 @@ void QgsDxfPaintEngine::endPolygon()
162
169
{
163
170
if ( mCurrentPolygon .size () > 1 )
164
171
{
165
- drawPolygon ( mCurrentPolygon .constData (), mCurrentPolygon .size (), QPaintEngine::OddEvenMode );
172
+ if ( mPen .style () != Qt::NoPen )
173
+ drawPolygon ( mCurrentPolygon .constData (), mCurrentPolygon .size (), QPaintEngine::PolylineMode );
174
+ if ( mBrush .style () != Qt::NoBrush )
175
+ drawPolygon ( mCurrentPolygon .constData (), mCurrentPolygon .size (), QPaintEngine::OddEvenMode );
166
176
}
167
177
mCurrentPolygon .clear ();
168
178
}
@@ -198,7 +208,7 @@ void QgsDxfPaintEngine::endCurve()
198
208
199
209
void QgsDxfPaintEngine::drawLines ( const QLineF* lines, int lineCount )
200
210
{
201
- if ( !mDxf || !mPaintDevice || !lines )
211
+ if ( !mDxf || !mPaintDevice || !lines || mPen . style () == Qt::NoPen )
202
212
{
203
213
return ;
204
214
}
@@ -207,7 +217,7 @@ void QgsDxfPaintEngine::drawLines( const QLineF* lines, int lineCount )
207
217
{
208
218
QgsPoint pt1 = toDxfCoordinates ( lines[i].p1 () );
209
219
QgsPoint pt2 = toDxfCoordinates ( lines[i].p2 () );
210
- mDxf ->writeLine ( pt1, pt2, mLayer , " CONTINUOUS" , currentColor (), currentWidth () );
220
+ mDxf ->writeLine ( pt1, pt2, mLayer , " CONTINUOUS" , mPen . color (), currentWidth () );
211
221
}
212
222
}
213
223
@@ -222,20 +232,6 @@ QgsPoint QgsDxfPaintEngine::toDxfCoordinates( const QPointF& pt ) const
222
232
return QgsPoint ( dxfPt.x (), dxfPt.y () );
223
233
}
224
234
225
- QColor QgsDxfPaintEngine::currentColor () const
226
- {
227
- if ( !mDxf )
228
- {
229
- return QColor ();
230
- }
231
-
232
- QColor c = mPen .color ();
233
- if ( mPen .style () == Qt::NoPen )
234
- {
235
- c = mBrush .color ();
236
- }
237
- return c;
238
- }
239
235
240
236
double QgsDxfPaintEngine::currentWidth () const
241
237
{
0 commit comments