Write dxf circle

This commit is contained in:
Marco Hugentobler 2013-12-06 13:23:52 +01:00
parent ebbb976e8a
commit 668403ace5
5 changed files with 23 additions and 4 deletions

View File

@ -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" );

View File

@ -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;

View File

@ -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 );

View File

@ -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
}

View File

@ -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 );