void QgsDxfPaintEngine::drawLines( const QLineF* lines, int lineCount ) { if ( !mDxf || !mPaintDevice || !lines ) { return; } for ( int i = 0; i < lineCount; ++i ) { QgsPoint pt1 = toDxfCoordinates( lines[i].p1() ); QgsPoint pt2 = toDxfCoordinates( lines[i].p2() ); mDxf->writeLine( pt1, pt2, mLayer, "CONTINUOUS", currentColor(), currentWidth() ); } }
void QgsDxfPaintEngine::drawPolygon( const QPointF *points, int pointCount, PolygonDrawMode mode ) { Q_UNUSED( mode ); if ( !mDxf || !mPaintDevice ) { return; } QgsPolygon polygon( 1 ); polygon[0].resize( pointCount ); QgsPolyline &polyline = polygon[0]; for ( int i = 0; i < pointCount; ++i ) { polyline[i] = toDxfCoordinates( points[i] ); } if ( mode == QPaintEngine::PolylineMode ) { mDxf->writePolyline( polyline, mLayer, "CONTINUOUS", mPen.color(), currentWidth(), true ); } else { mDxf->writePolygon( polygon, mLayer, "SOLID", mBrush.color() ); } }
void QgsDxfPaintEngine::drawRects( const QRectF* rects, int rectCount ) { if ( !mDxf || !mPaintDevice || !rects ) { return; } for ( int i = 0; i < rectCount; ++i ) { double left = rects[i].left(); double right = rects[i].right(); double top = rects[i].top(); double bottom = rects[i].bottom(); QgsPoint pt1 = toDxfCoordinates( QPointF( left, bottom ) ); QgsPoint pt2 = toDxfCoordinates( QPointF( right, bottom ) ); QgsPoint pt3 = toDxfCoordinates( QPointF( left, top ) ); QgsPoint pt4 = toDxfCoordinates( QPointF( right, top ) ); mDxf->writeSolid( mLayer, currentColor(), pt1, pt2, pt3, pt4 ); } }
void QgsDxfPaintEngine::drawPolygon( const QPointF* points, int pointCount, PolygonDrawMode mode ) { Q_UNUSED( mode ); if ( !mDxf || !mPaintDevice ) { return; } QgsPolyline polyline( pointCount ); for ( int i = 0; i < pointCount; ++i ) { polyline[i] = toDxfCoordinates( points[i] ); } bool closed = ( pointCount > 3 && points[0] == points[pointCount - 1] ); mDxf->writePolyline( polyline, mLayer, "CONTINUOUS", currentColor(), currentWidth(), closed ); }