Skip to content
Permalink
Browse files

Consider PR feedback

  • Loading branch information
mhugent authored and nyalldawson committed Jun 14, 2018
1 parent 49cce29 commit e76ca64eaea42720baef700760bd000c7a671cd0
@@ -397,7 +397,7 @@ Write mtext (MTEXT)
.. versionadded:: 2.15
%End

static double mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits, double mapUnitsPerPixel = 1.0 );
static double mapUnitScaleFactor( double scale, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits, double mapUnitsPerPixel = 1.0 );
%Docstring
Returns scale factor for conversion to map units

@@ -999,7 +999,12 @@ void QgsDxfExport::writeEntities()
continue;
}

ctx.expressionContext().appendScope( QgsExpressionContextUtils::layerScope( ml ) );
auto scopePopper = [&ctx]( QgsExpressionContextScope * scope )
{
delete ctx.expressionContext().popScope();
};
std::unique_ptr<QgsExpressionContextScope, decltype( scopePopper ) > layerScope( QgsExpressionContextUtils::layerScope( ml ), scopePopper );
ctx.expressionContext().appendScope( layerScope.get() );
QgsSymbolRenderContext sctx( ctx, QgsUnitTypes::RenderMillimeters, 1.0, false, nullptr, nullptr );

std::unique_ptr< QgsFeatureRenderer > renderer( vl->renderer()->clone() );
@@ -1048,7 +1053,6 @@ void QgsDxfExport::writeEntities()
writeEntitiesSymbolLevels( vl );
renderer->stopRender( ctx );

delete ctx.expressionContext().popScope();
continue;
}

@@ -1089,7 +1093,7 @@ void QgsDxfExport::writeEntities()
continue;
}

bool isGeometryGenerator = ( sl->layerType() == "GeometryGenerator" );
bool isGeometryGenerator = ( sl->layerType() == QLatin1String( "GeometryGenerator" ) );
if ( isGeometryGenerator )
{
addGeometryGeneratorSymbolLayer( sctx, ct, lName, sl, true );
@@ -1110,7 +1114,7 @@ void QgsDxfExport::writeEntities()
continue;
}

if ( s->symbolLayer( 0 )->layerType() == "GeometryGenerator" )
if ( s->symbolLayer( 0 )->layerType() == QLatin1String( "GeometryGenerator" ) )
{
addGeometryGeneratorSymbolLayer( sctx, ct, lName, s->symbolLayer( 0 ), false );
}
@@ -1132,7 +1136,6 @@ void QgsDxfExport::writeEntities()
}

renderer->stopRender( ctx );
delete ctx.expressionContext().popScope();
}

engine.run( ctx );
@@ -3989,15 +3992,15 @@ QgsRenderContext QgsDxfExport::renderContext() const
return context;
}

double QgsDxfExport::mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits, double mapUnitsPerPixel )
double QgsDxfExport::mapUnitScaleFactor( double scale, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits, double mapUnitsPerPixel )
{
if ( symbolUnits == QgsUnitTypes::RenderMapUnits )
{
return 1.0;
}
else if ( symbolUnits == QgsUnitTypes::RenderMillimeters )
{
return ( scaleDenominator * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::DistanceMeters, mapUnits ) / 1000.0 );
return ( scale * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::DistanceMeters, mapUnits ) / 1000.0 );
}
else if ( symbolUnits == QgsUnitTypes::RenderPixels )
{
@@ -391,7 +391,7 @@ class CORE_EXPORT QgsDxfExport
* \param mapUnits the map units
* \param mapUnitsPerPixel Map units per pixel
*/
static double mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits, double mapUnitsPerPixel = 1.0 );
static double mapUnitScaleFactor( double scale, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits, double mapUnitsPerPixel = 1.0 );

/**
* Clips value to scale minimum/maximum
@@ -24,7 +24,6 @@ QgsDxfPaintEngine::QgsDxfPaintEngine( const QgsDxfPaintDevice *dxfDevice, QgsDxf
: QPaintEngine( QPaintEngine::AllFeatures /*QPaintEngine::PainterPaths | QPaintEngine::PaintOutsidePaintEvent*/ )
, mPaintDevice( dxfDevice )
, mDxf( dxf )
, mOpacity( 1.0 )
{
}

@@ -65,7 +65,7 @@ class CORE_EXPORT QgsDxfPaintEngine: public QPaintEngine
QPen mPen;
QBrush mBrush;
//! Opacity
double mOpacity;
double mOpacity = 1.0;
QString mLayer;
QPointF mShift;
QgsRingSequence mPolygon;

0 comments on commit e76ca64

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