Skip to content

Commit

Permalink
dxf export: use implicit cast QPointF to QgsPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 15, 2015
1 parent 859efa5 commit e432317
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
18 changes: 9 additions & 9 deletions src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
Expand Up @@ -696,7 +696,7 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
if ( qgsDoubleNear( halfWidth, halfHeight ) )
{
QPointF pt( t.map( QPointF( 0, 0 ) ) );
e.writeFilledCircle( layerName, oc, QgsPoint( pt.x(), pt.y() ), halfWidth );
e.writeFilledCircle( layerName, oc, pt, halfWidth );
}
else
{
Expand All @@ -708,11 +708,11 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
double x = halfWidth * cos( angle );
double y = halfHeight * sin( angle );
QPointF pt( t.map( QPointF( x, y ) ) );
line.push_back( QgsPoint( pt.x(), pt.y() ) );
line.push_back( pt );
}
//close ellipse with first point
line.push_back( line.at( 0 ) );
e.writePolyline( line, layerName, "solid", oc, outlineWidth, true );
e.writePolyline( line, layerName, "SOLID", oc, outlineWidth, true );
}
}
else if ( symbolName == "rectangle" )
Expand All @@ -721,22 +721,22 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
QPointF pt2( t.map( QPointF( halfWidth, -halfHeight ) ) );
QPointF pt3( t.map( QPointF( -halfWidth, halfHeight ) ) );
QPointF pt4( t.map( QPointF( halfWidth, halfHeight ) ) );
e.writeSolid( layerName, fc, QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt4.x(), pt4.y() ) );
e.writeSolid( layerName, fc, pt1, pt2, pt3, pt4 );
return true;
}
else if ( symbolName == "cross" )
{
QgsPolyline line1( 2 );
QPointF pt1( t.map( QPointF( -halfWidth, 0 ) ) );
QPointF pt2( t.map( QPointF( halfWidth, 0 ) ) );
line1[0] = QgsPoint( pt1.x(), pt1.y() );
line1[1] = QgsPoint( pt2.x(), pt2.y() );
line1[0] = pt1;
line1[1] = pt2;
e.writePolyline( line1, layerName, "CONTINUOUS", oc, outlineWidth, false );
QgsPolyline line2( 2 );
QPointF pt3( t.map( QPointF( 0, halfHeight ) ) );
QPointF pt4( t.map( QPointF( 0, -halfHeight ) ) );
line2[0] = QgsPoint( pt3.x(), pt3.y() );
line2[1] = QgsPoint( pt4.x(), pt4.y() );
line2[0] = pt3;
line2[1] = pt4;
e.writePolyline( line2, layerName, "CONTINUOUS", oc, outlineWidth, false );
return true;
}
Expand All @@ -746,7 +746,7 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
QPointF pt2( t.map( QPointF( halfWidth, -halfHeight ) ) );
QPointF pt3( t.map( QPointF( 0, halfHeight ) ) );
QPointF pt4( t.map( QPointF( 0, halfHeight ) ) );
e.writeSolid( layerName, fc, QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt4.x(), pt4.y() ) );
e.writeSolid( layerName, fc, pt1, pt2, pt3, pt4 );
return true;
}

Expand Down
26 changes: 13 additions & 13 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Expand Up @@ -889,9 +889,9 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
if ( mName == "circle" )
{
if ( mBrush.style() != Qt::NoBrush )
e.writeFilledCircle( layerName, bc, QgsPoint( shift.x(), shift.y() ), halfSize );
e.writeFilledCircle( layerName, bc, shift, halfSize );
if ( mPen.style() != Qt::NoPen )
e.writeCircle( layerName, pc, QgsPoint( shift.x(), shift.y() ), halfSize, "CONTINUOUS", outlineWidth );
e.writeCircle( layerName, pc, shift, halfSize, "CONTINUOUS", outlineWidth );
}
else if ( mName == "square" || mName == "rectangle" )
{
Expand All @@ -903,7 +903,7 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
QPointF pt4 = t.map( QPointF( halfSize, halfSize ) );

if ( mBrush.style() != Qt::NoBrush )
e.writeSolid( layerName, bc, QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt4.x(), pt4.y() ) );
e.writeSolid( layerName, bc, pt1, pt2, pt3, pt4 );

if ( mPen.style() != Qt::NoPen )
{
Expand All @@ -921,7 +921,7 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
QPointF pt4 = t.map( QPointF( halfSize, 0 ) );

if ( mBrush.style() != Qt::NoBrush )
e.writeSolid( layerName, bc, QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt4.x(), pt4.y() ) );
e.writeSolid( layerName, bc, pt1, pt2, pt3, pt4 );

if ( mPen.style() != Qt::NoPen )
{
Expand All @@ -938,7 +938,7 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
QPointF pt3 = t.map( QPointF( 0, halfSize ) );

if ( mBrush.style() != Qt::NoBrush )
e.writeSolid( layerName, bc, QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt3.x(), pt3.y() ) );
e.writeSolid( layerName, bc, pt1, pt2, pt3, pt3 );

if ( mPen.style() != Qt::NoPen )
{
Expand All @@ -959,7 +959,7 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
QPointF pt2 = t.map( QPointF( 0, -halfSize ) );

if ( mPen.style() != Qt::NoPen )
e.writeLine( QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( pt1, pt2, layerName, "CONTINUOUS", pc, outlineWidth );
}
else if ( mName == "cross" )
{
Expand All @@ -970,8 +970,8 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc

if ( mPen.style() != Qt::NoPen )
{
e.writeLine( QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt4.x(), pt4.y() ), layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( pt1, pt2, layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( pt3, pt4, layerName, "CONTINUOUS", pc, outlineWidth );
}
}
else if ( mName == "x" || mName == "cross2" )
Expand All @@ -983,8 +983,8 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc

if ( mPen.style() != Qt::NoPen )
{
e.writeLine( QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt4.x(), pt4.y() ), layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( pt1, pt2, layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( pt3, pt4, layerName, "CONTINUOUS", pc, outlineWidth );
}
}
else if ( mName == "arrowhead" )
Expand All @@ -995,8 +995,8 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc

if ( mPen.style() != Qt::NoPen )
{
e.writeLine( QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( pt1, pt2, layerName, "CONTINUOUS", pc, outlineWidth );
e.writeLine( pt3, pt2, layerName, "CONTINUOUS", pc, outlineWidth );
}
}
else if ( mName == "filled_arrowhead" )
Expand All @@ -1007,7 +1007,7 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc

if ( mBrush.style() != Qt::NoBrush )
{
e.writeSolid( layerName, bc, QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt3.x(), pt3.y() ) );
e.writeSolid( layerName, bc, pt1, pt2, pt3, pt3 );
}
}
else
Expand Down

0 comments on commit e432317

Please sign in to comment.