Skip to content
Permalink
Browse files

Write dxf circle

  • Loading branch information
mhugent committed Dec 6, 2013
1 parent ebbb976 commit 668403ace5e86f7aed9a6782a38d8e3c270180b6
@@ -796,6 +796,17 @@ void QgsDxfExport::writePoint( const QString& layer, int color, const QgsPoint&
writeGroup( 30, 0.0 );
}

void QgsDxfExport::writeCircle( const QString& layer, int color, const QgsPoint& pt, double radius )
{
writeGroup( 0, "CIRCLE" );
writeGroup( 8, layer );
writeGroup( 62, color );
writeGroup( 10, pt.x() );
writeGroup( 20, pt.y() );
writeGroup( 30, 0 );
writeGroup( 40, radius );
}

void QgsDxfExport::writeSolid( const QString& layer, int color, const QgsPoint& pt1, const QgsPoint& pt2, const QgsPoint& pt3, const QgsPoint& pt4 )
{
writeGroup( 0, "SOLID" );
@@ -29,7 +29,7 @@ class QgsPoint;
class QgsSymbolLayerV2;
class QIODevice;

class QgsDxfExport
class CORE_EXPORT QgsDxfExport
{
public:
enum SymbologyExport
@@ -78,6 +78,8 @@ class QgsDxfExport

void writePoint( const QString& layer, int color, const QgsPoint& pt );

void writeCircle( const QString& layer, int color, const QgsPoint& pt, double radius );

private:

QList< QgsMapLayer* > mLayers;
@@ -26,7 +26,7 @@ class QPaintEngine;

/**A paint device for drawing into dxf files*/

class QgsDxfPaintDevice: public QPaintDevice
class CORE_EXPORT QgsDxfPaintDevice: public QPaintDevice
{
public:
QgsDxfPaintDevice( QgsDxfExport* dxf );
@@ -103,7 +103,13 @@ void QgsDxfPaintEngine::drawRects( const QRectF* rects, int rectCount )

void QgsDxfPaintEngine::drawEllipse( const QRectF& rect )
{
//map to circle in case of square?
QPoint midPoint(( rect.left() + rect.right() ) / 2.0, ( rect.top() + rect.bottom() ) / 2.0 );

//a circle
if ( qgsDoubleNear( rect.width(), rect.height() ) )
{
mDxf->writeCircle( mLayer, currentPenColor(), toDxfCoordinates( midPoint ), rect.width() / 2.0 );
}

//todo: create polyline for real ellises
}
@@ -24,7 +24,7 @@ class QgsDxfExport;
class QgsDxfPaintDevice;
class QgsPoint;

class QgsDxfPaintEngine: public QPaintEngine
class CORE_EXPORT QgsDxfPaintEngine: public QPaintEngine
{
public:
QgsDxfPaintEngine( const QgsDxfPaintDevice* dxfDevice, QgsDxfExport* dxf );

0 comments on commit 668403a

Please sign in to comment.
You can’t perform that action at this time.