mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
dxf export: add support for expression contexts and rotated symbols (fixes #14495)
This commit is contained in:
parent
f19a35c34e
commit
c30f71ac73
@ -21,7 +21,7 @@ class QgsEllipseSymbolLayerV2 : QgsMarkerSymbolLayerV2
|
|||||||
void toSld( QDomDocument& doc, QDomElement &element, const QgsStringMap& props ) const;
|
void toSld( QDomDocument& doc, QDomElement &element, const QgsStringMap& props ) const;
|
||||||
void writeSldMarker( QDomDocument& doc, QDomElement &element, const QgsStringMap& props ) const;
|
void writeSldMarker( QDomDocument& doc, QDomElement &element, const QgsStringMap& props ) const;
|
||||||
|
|
||||||
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
||||||
|
|
||||||
void setSymbolName( const QString& name );
|
void setSymbolName( const QString& name );
|
||||||
QString symbolName() const;
|
QString symbolName() const;
|
||||||
|
@ -93,7 +93,7 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
|
|||||||
void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale);
|
void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||||
const QgsMapUnitScale& outlineWidthMapUnitScale() const;
|
const QgsMapUnitScale& outlineWidthMapUnitScale() const;
|
||||||
|
|
||||||
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
||||||
|
|
||||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||||
@ -172,7 +172,7 @@ class QgsSvgMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
|
|||||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||||
QgsMapUnitScale mapUnitScale() const;
|
QgsMapUnitScale mapUnitScale() const;
|
||||||
|
|
||||||
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
||||||
|
|
||||||
QRectF bounds( QPointF point, QgsSymbolV2RenderContext& context );
|
QRectF bounds( QPointF point, QgsSymbolV2RenderContext& context );
|
||||||
};
|
};
|
||||||
|
@ -252,17 +252,13 @@ class QgsSymbolLayerV2
|
|||||||
*/
|
*/
|
||||||
virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsSymbolV2RenderContext& context, const QVariant& defaultVal = QVariant(), bool *ok = 0 ) const;
|
virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsSymbolV2RenderContext& context, const QVariant& defaultVal = QVariant(), bool *ok = 0 ) const;
|
||||||
|
|
||||||
virtual bool writeDxf( QgsDxfExport& e,
|
virtual bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
||||||
double mmMapUnitScaleFactor,
|
|
||||||
const QString& layerName,
|
|
||||||
QgsSymbolV2RenderContext* context,
|
|
||||||
const QgsFeature* f,
|
|
||||||
QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
|
||||||
|
|
||||||
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
||||||
virtual double dxfOffset( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
virtual double dxfOffset( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
||||||
|
|
||||||
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
|
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
|
||||||
|
virtual double dxfAngle( QgsSymbolV2RenderContext& context ) const;
|
||||||
|
|
||||||
virtual QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const;
|
virtual QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const;
|
||||||
virtual Qt::PenStyle dxfPenStyle() const;
|
virtual Qt::PenStyle dxfPenStyle() const;
|
||||||
|
@ -870,7 +870,7 @@ void QgsDxfExport::writeBlocks()
|
|||||||
writeGroup( 1, "" );
|
writeGroup( 1, "" );
|
||||||
|
|
||||||
// maplayer 0 -> block receives layer from INSERT statement
|
// maplayer 0 -> block receives layer from INSERT statement
|
||||||
ml->writeDxf( *this, mapUnitScaleFactor( mSymbologyScaleDenominator, ml->sizeUnit(), mMapUnits ), "0", &ctx, nullptr );
|
ml->writeDxf( *this, mapUnitScaleFactor( mSymbologyScaleDenominator, ml->sizeUnit(), mMapUnits ), "0", ctx );
|
||||||
|
|
||||||
writeGroup( 0, "ENDBLK" );
|
writeGroup( 0, "ENDBLK" );
|
||||||
writeHandle();
|
writeHandle();
|
||||||
@ -984,7 +984,7 @@ void QgsDxfExport::writeEntities()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsFeatureRequest freq = QgsFeatureRequest().setSubsetOfAttributes( attributes, vl->fields() );
|
QgsFeatureRequest freq = QgsFeatureRequest().setSubsetOfAttributes( attributes, vl->fields() ).setExpressionContext( ctx.expressionContext() );
|
||||||
if ( !mExtent.isEmpty() )
|
if ( !mExtent.isEmpty() )
|
||||||
{
|
{
|
||||||
freq.setFilterRect( mExtent );
|
freq.setFilterRect( mExtent );
|
||||||
@ -3329,7 +3329,7 @@ void QgsDxfExport::endSection()
|
|||||||
writeGroup( 0, "ENDSEC" );
|
writeGroup( 0, "ENDSEC" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsDxfExport::writePoint( const QgsPoint& pt, const QString& layer, const QColor& color, const QgsFeature* f, const QgsSymbolLayerV2* symbolLayer, const QgsSymbolV2* symbol )
|
void QgsDxfExport::writePoint( const QgsPoint& pt, const QString& layer, const QColor& color, QgsSymbolV2RenderContext &ctx, const QgsSymbolLayerV2* symbolLayer, const QgsSymbolV2* symbol, double angle )
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
// debug: draw rectangle for debugging
|
// debug: draw rectangle for debugging
|
||||||
@ -3356,9 +3356,7 @@ void QgsDxfExport::writePoint( const QgsPoint& pt, const QString& layer, const Q
|
|||||||
const QgsMarkerSymbolLayerV2* msl = dynamic_cast< const QgsMarkerSymbolLayerV2* >( symbolLayer );
|
const QgsMarkerSymbolLayerV2* msl = dynamic_cast< const QgsMarkerSymbolLayerV2* >( symbolLayer );
|
||||||
if ( msl && symbol )
|
if ( msl && symbol )
|
||||||
{
|
{
|
||||||
QgsRenderContext ct;
|
if ( symbolLayer->writeDxf( *this, mapUnitScaleFactor( mSymbologyScaleDenominator, msl->sizeUnit(), mMapUnits ), layer, ctx, QPointF( pt.x(), pt.y() ) ) )
|
||||||
QgsSymbolV2RenderContext ctx( ct, QgsSymbolV2::MapUnit, symbol->alpha(), false, symbol->renderHints(), f );
|
|
||||||
if ( symbolLayer->writeDxf( *this, mapUnitScaleFactor( mSymbologyScaleDenominator, msl->sizeUnit(), mMapUnits ), layer, &ctx, f, QPointF( pt.x(), pt.y() ) ) )
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3374,6 +3372,7 @@ void QgsDxfExport::writePoint( const QgsPoint& pt, const QString& layer, const Q
|
|||||||
writeGroup( 100, "AcDbBlockReference" );
|
writeGroup( 100, "AcDbBlockReference" );
|
||||||
writeGroup( 8, layer );
|
writeGroup( 8, layer );
|
||||||
writeGroup( 2, blockIt.value() ); // Block name
|
writeGroup( 2, blockIt.value() ); // Block name
|
||||||
|
writeGroup( 50, angle ); // angle
|
||||||
writeGroup( 0, pt ); // Insertion point (in OCS)
|
writeGroup( 0, pt ); // Insertion point (in OCS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3659,10 +3658,12 @@ void QgsDxfExport::addFeature( QgsSymbolV2RenderContext& ctx, const QString& lay
|
|||||||
Qt::BrushStyle brushStyle( Qt::NoBrush );
|
Qt::BrushStyle brushStyle( Qt::NoBrush );
|
||||||
double width = -1;
|
double width = -1;
|
||||||
double offset = 0.0;
|
double offset = 0.0;
|
||||||
|
double angle = 0.0;
|
||||||
if ( mSymbologyExport != NoSymbology && symbolLayer )
|
if ( mSymbologyExport != NoSymbology && symbolLayer )
|
||||||
{
|
{
|
||||||
width = symbolLayer->dxfWidth( *this, ctx );
|
width = symbolLayer->dxfWidth( *this, ctx );
|
||||||
offset = symbolLayer->dxfOffset( *this, ctx );
|
offset = symbolLayer->dxfOffset( *this, ctx );
|
||||||
|
angle = symbolLayer->dxfAngle( ctx );
|
||||||
penStyle = symbolLayer->dxfPenStyle();
|
penStyle = symbolLayer->dxfPenStyle();
|
||||||
brushStyle = symbolLayer->dxfBrushStyle();
|
brushStyle = symbolLayer->dxfBrushStyle();
|
||||||
|
|
||||||
@ -3679,7 +3680,7 @@ void QgsDxfExport::addFeature( QgsSymbolV2RenderContext& ctx, const QString& lay
|
|||||||
// single point
|
// single point
|
||||||
if ( geometryType == QGis::WKBPoint || geometryType == QGis::WKBPoint25D )
|
if ( geometryType == QGis::WKBPoint || geometryType == QGis::WKBPoint25D )
|
||||||
{
|
{
|
||||||
writePoint( geom->asPoint(), layer, penColor, fet, symbolLayer, symbol );
|
writePoint( geom->asPoint(), layer, penColor, ctx, symbolLayer, symbol, angle );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3690,7 +3691,7 @@ void QgsDxfExport::addFeature( QgsSymbolV2RenderContext& ctx, const QString& lay
|
|||||||
QgsMultiPoint::const_iterator it = multiPoint.constBegin();
|
QgsMultiPoint::const_iterator it = multiPoint.constBegin();
|
||||||
for ( ; it != multiPoint.constEnd(); ++it )
|
for ( ; it != multiPoint.constEnd(); ++it )
|
||||||
{
|
{
|
||||||
writePoint( *it, layer, penColor, fet, symbolLayer, symbol );
|
writePoint( *it, layer, penColor, ctx, symbolLayer, symbol, angle );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -327,7 +327,7 @@ class CORE_EXPORT QgsDxfExport
|
|||||||
void startSection();
|
void startSection();
|
||||||
void endSection();
|
void endSection();
|
||||||
|
|
||||||
void writePoint( const QgsPoint &pt, const QString &layer, const QColor& color, const QgsFeature *f, const QgsSymbolLayerV2 *symbolLayer, const QgsSymbolV2 *symbol );
|
void writePoint( const QgsPoint &pt, const QString &layer, const QColor& color, QgsSymbolV2RenderContext &ctx, const QgsSymbolLayerV2 *symbolLayer, const QgsSymbolV2 *symbol, double angle );
|
||||||
void writeVertex( const QgsPoint &pt, const QString &layer );
|
void writeVertex( const QgsPoint &pt, const QString &layer );
|
||||||
void writeDefaultLinetypes();
|
void writeDefaultLinetypes();
|
||||||
void writeSymbolLayerLinetype( const QgsSymbolLayerV2 *symbolLayer );
|
void writeSymbolLayerLinetype( const QgsSymbolLayerV2 *symbolLayer );
|
||||||
|
@ -719,17 +719,17 @@ QRectF QgsEllipseSymbolLayerV2::bounds( QPointF point, QgsSymbolV2RenderContext&
|
|||||||
return symbolBounds;
|
return symbolBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext *context, const QgsFeature*, QPointF shift ) const
|
bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext &context, QPointF shift ) const
|
||||||
{
|
{
|
||||||
//width
|
//width
|
||||||
double symbolWidth = mSymbolWidth;
|
double symbolWidth = mSymbolWidth;
|
||||||
|
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH ) ) //1. priority: data defined setting on symbol layer le
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH ) ) //1. priority: data defined setting on symbol layer le
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mSymbolWidth );
|
context.setOriginalValueVariable( mSymbolWidth );
|
||||||
symbolWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH, *context, mSymbolWidth ).toDouble();
|
symbolWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH, context, mSymbolWidth ).toDouble();
|
||||||
}
|
}
|
||||||
else if ( context->renderHints() & QgsSymbolV2::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
|
else if ( context.renderHints() & QgsSymbolV2::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
|
||||||
{
|
{
|
||||||
symbolWidth = mSize;
|
symbolWidth = mSize;
|
||||||
}
|
}
|
||||||
@ -742,10 +742,10 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
|||||||
double symbolHeight = mSymbolHeight;
|
double symbolHeight = mSymbolHeight;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_HEIGHT ) ) //1. priority: data defined setting on symbol layer level
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_HEIGHT ) ) //1. priority: data defined setting on symbol layer level
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mSymbolHeight );
|
context.setOriginalValueVariable( mSymbolHeight );
|
||||||
symbolHeight = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_HEIGHT, *context, mSymbolHeight ).toDouble();
|
symbolHeight = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_HEIGHT, context, mSymbolHeight ).toDouble();
|
||||||
}
|
}
|
||||||
else if ( context->renderHints() & QgsSymbolV2::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
|
else if ( context.renderHints() & QgsSymbolV2::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
|
||||||
{
|
{
|
||||||
symbolHeight = mSize;
|
symbolHeight = mSize;
|
||||||
}
|
}
|
||||||
@ -759,8 +759,8 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
|||||||
|
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mOutlineWidth );
|
context.setOriginalValueVariable( mOutlineWidth );
|
||||||
outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, *context, mOutlineWidth ).toDouble();
|
outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, context, mOutlineWidth ).toDouble();
|
||||||
}
|
}
|
||||||
if ( mOutlineWidthUnit == QgsSymbolV2::MM )
|
if ( mOutlineWidthUnit == QgsSymbolV2::MM )
|
||||||
{
|
{
|
||||||
@ -772,8 +772,8 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
|||||||
QColor fc = mColor;
|
QColor fc = mColor;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL_COLOR ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL_COLOR ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mColor ) );
|
context.setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mColor ) );
|
||||||
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL_COLOR, *context, QVariant(), &ok ).toString();
|
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL_COLOR, context, QVariant(), &ok ).toString();
|
||||||
if ( ok )
|
if ( ok )
|
||||||
fc = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
fc = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
||||||
}
|
}
|
||||||
@ -782,8 +782,8 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
|||||||
QColor oc = mOutlineColor;
|
QColor oc = mOutlineColor;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mOutlineColor ) );
|
context.setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mOutlineColor ) );
|
||||||
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR, *context, QVariant(), &ok ).toString();
|
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR, context, QVariant(), &ok ).toString();
|
||||||
if ( ok )
|
if ( ok )
|
||||||
oc = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
oc = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
||||||
}
|
}
|
||||||
@ -792,22 +792,22 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
|||||||
QString symbolName = mSymbolName;
|
QString symbolName = mSymbolName;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SYMBOL_NAME ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SYMBOL_NAME ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mSymbolName );
|
context.setOriginalValueVariable( mSymbolName );
|
||||||
symbolName = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_SYMBOL_NAME, *context, mSymbolName ).toString();
|
symbolName = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_SYMBOL_NAME, context, mSymbolName ).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//offset
|
//offset
|
||||||
double offsetX = 0;
|
double offsetX = 0;
|
||||||
double offsetY = 0;
|
double offsetY = 0;
|
||||||
markerOffset( *context, offsetX, offsetY );
|
markerOffset( context, offsetX, offsetY );
|
||||||
QPointF off( offsetX, offsetY );
|
QPointF off( offsetX, offsetY );
|
||||||
|
|
||||||
//priority for rotation: 1. data defined symbol level, 2. symbol layer rotation (mAngle)
|
//priority for rotation: 1. data defined symbol level, 2. symbol layer rotation (mAngle)
|
||||||
double rotation = 0.0;
|
double rotation = 0.0;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_ROTATION ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_ROTATION ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mAngle );
|
context.setOriginalValueVariable( mAngle );
|
||||||
rotation = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_ROTATION, *context, mAngle ).toDouble() + mLineAngle;
|
rotation = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_ROTATION, context, mAngle ).toDouble() + mLineAngle;
|
||||||
}
|
}
|
||||||
else if ( !qgsDoubleNear( mAngle + mLineAngle, 0.0 ) )
|
else if ( !qgsDoubleNear( mAngle + mLineAngle, 0.0 ) )
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
|
|||||||
void toSld( QDomDocument& doc, QDomElement &element, const QgsStringMap& props ) const override;
|
void toSld( QDomDocument& doc, QDomElement &element, const QgsStringMap& props ) const override;
|
||||||
void writeSldMarker( QDomDocument& doc, QDomElement &element, const QgsStringMap& props ) const override;
|
void writeSldMarker( QDomDocument& doc, QDomElement &element, const QgsStringMap& props ) const override;
|
||||||
|
|
||||||
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
|
bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
|
||||||
|
|
||||||
void setSymbolName( const QString& name ) { mSymbolName = name; }
|
void setSymbolName( const QString& name ) { mSymbolName = name; }
|
||||||
QString symbolName() const { return mSymbolName; }
|
QString symbolName() const { return mSymbolName; }
|
||||||
|
@ -422,6 +422,17 @@ QColor QgsSimpleFillSymbolLayerV2::dxfColor( QgsSymbolV2RenderContext &context )
|
|||||||
return mBorderColor;
|
return mBorderColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double QgsSimpleFillSymbolLayerV2::dxfAngle( QgsSymbolV2RenderContext &context ) const
|
||||||
|
{
|
||||||
|
double angle = mAngle;
|
||||||
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE ) )
|
||||||
|
{
|
||||||
|
context.setOriginalValueVariable( mAngle );
|
||||||
|
angle = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE, context, mAngle ).toDouble();
|
||||||
|
}
|
||||||
|
return angle;
|
||||||
|
}
|
||||||
|
|
||||||
Qt::PenStyle QgsSimpleFillSymbolLayerV2::dxfPenStyle() const
|
Qt::PenStyle QgsSimpleFillSymbolLayerV2::dxfPenStyle() const
|
||||||
{
|
{
|
||||||
return mBorderStyle;
|
return mBorderStyle;
|
||||||
|
@ -118,6 +118,8 @@ class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2
|
|||||||
|
|
||||||
double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const override;
|
double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const override;
|
||||||
QColor dxfColor( QgsSymbolV2RenderContext& context ) const override;
|
QColor dxfColor( QgsSymbolV2RenderContext& context ) const override;
|
||||||
|
double dxfAngle( QgsSymbolV2RenderContext& context ) const override;
|
||||||
|
|
||||||
Qt::PenStyle dxfPenStyle() const override;
|
Qt::PenStyle dxfPenStyle() const override;
|
||||||
QColor dxfBrushColor( QgsSymbolV2RenderContext &context ) const override;
|
QColor dxfBrushColor( QgsSymbolV2RenderContext &context ) const override;
|
||||||
Qt::BrushStyle dxfBrushStyle() const override;
|
Qt::BrushStyle dxfBrushStyle() const override;
|
||||||
@ -562,14 +564,15 @@ class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayerV2
|
|||||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ) override;
|
void setOutputUnit( QgsSymbolV2::OutputUnit unit ) override;
|
||||||
QgsSymbolV2::OutputUnit outputUnit() const override;
|
QgsSymbolV2::OutputUnit outputUnit() const override;
|
||||||
|
|
||||||
void setMapUnitScale( const QgsMapUnitScale& scale ) override;
|
void setMapUnitScale( const QgsMapUnitScale &scale ) override;
|
||||||
QgsMapUnitScale mapUnitScale() const override;
|
QgsMapUnitScale mapUnitScale() const override;
|
||||||
|
|
||||||
virtual double estimateMaxBleed() const override;
|
virtual double estimateMaxBleed() const override;
|
||||||
|
|
||||||
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const override;
|
double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const override;
|
||||||
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const override;
|
QColor dxfColor( QgsSymbolV2RenderContext& context ) const override;
|
||||||
virtual Qt::PenStyle dxfPenStyle() const override;
|
|
||||||
|
Qt::PenStyle dxfPenStyle() const override;
|
||||||
|
|
||||||
QSet<QString> usedAttributes() const override;
|
QSet<QString> usedAttributes() const override;
|
||||||
|
|
||||||
|
@ -937,16 +937,12 @@ void QgsSimpleMarkerSymbolLayerV2::drawMarker( QPainter* p, QgsSymbolV2RenderCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext *context, const QgsFeature*, QPointF shift ) const
|
bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext &context, QPointF shift ) const
|
||||||
{
|
{
|
||||||
//data defined size?
|
//data defined size?
|
||||||
double size = mSize;
|
double size = mSize;
|
||||||
|
|
||||||
bool hasDataDefinedSize = false;
|
bool hasDataDefinedSize = context.renderHints() & QgsSymbolV2::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE );
|
||||||
if ( context )
|
|
||||||
{
|
|
||||||
hasDataDefinedSize = context->renderHints() & QgsSymbolV2::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE );
|
|
||||||
}
|
|
||||||
|
|
||||||
//data defined size
|
//data defined size
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
@ -954,8 +950,8 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
|
|||||||
{
|
{
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mSize );
|
context.setOriginalValueVariable( mSize );
|
||||||
size = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE, *context, mSize, &ok ).toDouble();
|
size = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE, context, mSize, &ok ).toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ok )
|
if ( ok )
|
||||||
@ -970,7 +966,7 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size = QgsSymbolLayerV2Utils::convertToPainterUnits( context->renderContext(), size, mSizeUnit, mSizeMapUnitScale );
|
size = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), size, mSizeUnit, mSizeMapUnitScale );
|
||||||
}
|
}
|
||||||
if ( mSizeUnit == QgsSymbolV2::MM )
|
if ( mSizeUnit == QgsSymbolV2::MM )
|
||||||
{
|
{
|
||||||
@ -981,10 +977,10 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
|
|||||||
//outlineWidth
|
//outlineWidth
|
||||||
double outlineWidth = mOutlineWidth;
|
double outlineWidth = mOutlineWidth;
|
||||||
|
|
||||||
if ( context && hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mOutlineWidth );
|
context.setOriginalValueVariable( mOutlineWidth );
|
||||||
outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, *context, mOutlineWidth ).toDouble();
|
outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, context, mOutlineWidth ).toDouble();
|
||||||
}
|
}
|
||||||
if ( mSizeUnit == QgsSymbolV2::MM )
|
if ( mSizeUnit == QgsSymbolV2::MM )
|
||||||
{
|
{
|
||||||
@ -994,17 +990,17 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
|
|||||||
//color
|
//color
|
||||||
QColor pc = mPen.color();
|
QColor pc = mPen.color();
|
||||||
QColor bc = mBrush.color();
|
QColor bc = mBrush.color();
|
||||||
if ( context && hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mColor ) );
|
context.setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mColor ) );
|
||||||
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR, *context, QVariant(), &ok ).toString();
|
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR, context, QVariant(), &ok ).toString();
|
||||||
if ( ok )
|
if ( ok )
|
||||||
bc = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
bc = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
||||||
}
|
}
|
||||||
if ( context && hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR_BORDER ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR_BORDER ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mBorderColor ) );
|
context.setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mBorderColor ) );
|
||||||
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR_BORDER, *context, QVariant(), &ok ).toString();
|
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR_BORDER, context, QVariant(), &ok ).toString();
|
||||||
if ( ok )
|
if ( ok )
|
||||||
pc = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
pc = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
||||||
}
|
}
|
||||||
@ -1012,25 +1008,23 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
|
|||||||
//offset
|
//offset
|
||||||
double offsetX = 0;
|
double offsetX = 0;
|
||||||
double offsetY = 0;
|
double offsetY = 0;
|
||||||
if ( context )
|
markerOffset( context, offsetX, offsetY );
|
||||||
{
|
|
||||||
markerOffset( *context, offsetX, offsetY );
|
|
||||||
}
|
|
||||||
QPointF off( offsetX, offsetY );
|
QPointF off( offsetX, offsetY );
|
||||||
|
|
||||||
//angle
|
//angle
|
||||||
double angle = mAngle + mLineAngle;
|
double angle = mAngle + mLineAngle;
|
||||||
if ( context && hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mAngle );
|
context.setOriginalValueVariable( mAngle );
|
||||||
angle = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE, *context, mAngle ).toDouble() + mLineAngle;
|
angle = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE, context, mAngle ).toDouble() + mLineAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString name( mName );
|
QString name( mName );
|
||||||
if ( context && hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_NAME ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_NAME ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mName );
|
context.setOriginalValueVariable( mName );
|
||||||
name = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_NAME, *context, QVariant(), &ok ).toString();
|
name = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_NAME, context, QVariant(), &ok ).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
angle = -angle; //rotation in Qt is counterclockwise
|
angle = -angle; //rotation in Qt is counterclockwise
|
||||||
@ -1761,8 +1755,7 @@ QgsSymbolLayerV2* QgsSvgMarkerSymbolLayerV2::createFromSld( QDomElement &element
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext *context, const QgsFeature*,
|
bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext &context, QPointF shift ) const
|
||||||
QPointF shift ) const
|
|
||||||
{
|
{
|
||||||
Q_UNUSED( layerName );
|
Q_UNUSED( layerName );
|
||||||
Q_UNUSED( shift ); //todo...
|
Q_UNUSED( shift ); //todo...
|
||||||
@ -1770,13 +1763,13 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
|
|||||||
//size
|
//size
|
||||||
double size = mSize;
|
double size = mSize;
|
||||||
|
|
||||||
bool hasDataDefinedSize = context->renderHints() & QgsSymbolV2::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE );
|
bool hasDataDefinedSize = context.renderHints() & QgsSymbolV2::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE );
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mSize );
|
context.setOriginalValueVariable( mSize );
|
||||||
size = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE, *context, mSize, &ok ).toDouble();
|
size = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE, context, mSize, &ok ).toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hasDataDefinedSize && ok )
|
if ( hasDataDefinedSize && ok )
|
||||||
@ -1803,8 +1796,8 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
|
|||||||
|
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OFFSET ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OFFSET ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( QgsSymbolLayerV2Utils::encodePoint( mOffset ) );
|
context.setOriginalValueVariable( QgsSymbolLayerV2Utils::encodePoint( mOffset ) );
|
||||||
QString offsetString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OFFSET, *context, QVariant(), &ok ).toString();
|
QString offsetString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OFFSET, context, QVariant(), &ok ).toString();
|
||||||
if ( ok )
|
if ( ok )
|
||||||
offset = QgsSymbolLayerV2Utils::decodePoint( offsetString );
|
offset = QgsSymbolLayerV2Utils::decodePoint( offsetString );
|
||||||
}
|
}
|
||||||
@ -1821,8 +1814,8 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
|
|||||||
double angle = mAngle + mLineAngle;
|
double angle = mAngle + mLineAngle;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mAngle );
|
context.setOriginalValueVariable( mAngle );
|
||||||
angle = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE, *context, mAngle ).toDouble() + mLineAngle;
|
angle = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE, context, mAngle ).toDouble() + mLineAngle;
|
||||||
}
|
}
|
||||||
//angle = -angle; //rotation in Qt is counterclockwise
|
//angle = -angle; //rotation in Qt is counterclockwise
|
||||||
if ( angle )
|
if ( angle )
|
||||||
@ -1831,23 +1824,23 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
|
|||||||
QString path = mPath;
|
QString path = mPath;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_NAME ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_NAME ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mPath );
|
context.setOriginalValueVariable( mPath );
|
||||||
path = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_NAME, *context, mPath ).toString();
|
path = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_NAME, context, mPath ).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
double outlineWidth = mOutlineWidth;
|
double outlineWidth = mOutlineWidth;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( mOutlineWidth );
|
context.setOriginalValueVariable( mOutlineWidth );
|
||||||
outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, *context, mOutlineWidth ).toDouble();
|
outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, context, mOutlineWidth ).toDouble();
|
||||||
}
|
}
|
||||||
outlineWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context->renderContext(), outlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale );
|
outlineWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), outlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale );
|
||||||
|
|
||||||
QColor fillColor = mColor;
|
QColor fillColor = mColor;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mColor ) );
|
context.setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mColor ) );
|
||||||
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL, *context, QVariant(), &ok ).toString();
|
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL, context, QVariant(), &ok ).toString();
|
||||||
if ( ok )
|
if ( ok )
|
||||||
fillColor = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
fillColor = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
||||||
}
|
}
|
||||||
@ -1855,15 +1848,15 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
|
|||||||
QColor outlineColor = mOutlineColor;
|
QColor outlineColor = mOutlineColor;
|
||||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE ) )
|
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE ) )
|
||||||
{
|
{
|
||||||
context->setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mOutlineColor ) );
|
context.setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mOutlineColor ) );
|
||||||
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE, *context, QVariant(), &ok ).toString();
|
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE, context, QVariant(), &ok ).toString();
|
||||||
if ( ok )
|
if ( ok )
|
||||||
outlineColor = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
outlineColor = QgsSymbolLayerV2Utils::decodeColor( colorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
const QByteArray &svgContent = QgsSvgCache::instance()->svgContent( path, size, fillColor, outlineColor, outlineWidth,
|
const QByteArray &svgContent = QgsSvgCache::instance()->svgContent( path, size, fillColor, outlineColor, outlineWidth,
|
||||||
context->renderContext().scaleFactor(),
|
context.renderContext().scaleFactor(),
|
||||||
context->renderContext().rasterScaleFactor() );
|
context.renderContext().rasterScaleFactor() );
|
||||||
|
|
||||||
//if current entry image is 0: cache image for entry
|
//if current entry image is 0: cache image for entry
|
||||||
// checks to see if image will fit into cache
|
// checks to see if image will fit into cache
|
||||||
|
@ -123,7 +123,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
|
|||||||
void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale ) { mOutlineWidthMapUnitScale = scale; }
|
void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale ) { mOutlineWidthMapUnitScale = scale; }
|
||||||
const QgsMapUnitScale& outlineWidthMapUnitScale() const { return mOutlineWidthMapUnitScale; }
|
const QgsMapUnitScale& outlineWidthMapUnitScale() const { return mOutlineWidthMapUnitScale; }
|
||||||
|
|
||||||
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
|
bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
|
||||||
|
|
||||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ) override;
|
void setOutputUnit( QgsSymbolV2::OutputUnit unit ) override;
|
||||||
QgsSymbolV2::OutputUnit outputUnit() const override;
|
QgsSymbolV2::OutputUnit outputUnit() const override;
|
||||||
@ -230,7 +230,7 @@ class CORE_EXPORT QgsSvgMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
|
|||||||
void setMapUnitScale( const QgsMapUnitScale& scale ) override;
|
void setMapUnitScale( const QgsMapUnitScale& scale ) override;
|
||||||
QgsMapUnitScale mapUnitScale() const override;
|
QgsMapUnitScale mapUnitScale() const override;
|
||||||
|
|
||||||
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
|
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
|
||||||
|
|
||||||
QRectF bounds( QPointF point, QgsSymbolV2RenderContext& context ) override;
|
QRectF bounds( QPointF point, QgsSymbolV2RenderContext& context ) override;
|
||||||
|
|
||||||
|
@ -256,18 +256,12 @@ QVariant QgsSymbolLayerV2::evaluateDataDefinedProperty( const QString& property,
|
|||||||
return defaultVal;
|
return defaultVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsSymbolLayerV2::writeDxf( QgsDxfExport& e,
|
bool QgsSymbolLayerV2::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift ) const
|
||||||
double mmMapUnitScaleFactor,
|
|
||||||
const QString& layerName,
|
|
||||||
QgsSymbolV2RenderContext *context,
|
|
||||||
const QgsFeature* f,
|
|
||||||
QPointF shift ) const
|
|
||||||
{
|
{
|
||||||
Q_UNUSED( e );
|
Q_UNUSED( e );
|
||||||
Q_UNUSED( mmMapUnitScaleFactor );
|
Q_UNUSED( mmMapUnitScaleFactor );
|
||||||
Q_UNUSED( layerName );
|
Q_UNUSED( layerName );
|
||||||
Q_UNUSED( context );
|
Q_UNUSED( context );
|
||||||
Q_UNUSED( f );
|
|
||||||
Q_UNUSED( shift );
|
Q_UNUSED( shift );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -292,6 +286,12 @@ QColor QgsSymbolLayerV2::dxfColor( QgsSymbolV2RenderContext &context ) const
|
|||||||
return color();
|
return color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double QgsSymbolLayerV2::dxfAngle( QgsSymbolV2RenderContext &context ) const
|
||||||
|
{
|
||||||
|
Q_UNUSED( context );
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
QVector<qreal> QgsSymbolLayerV2::dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const
|
QVector<qreal> QgsSymbolLayerV2::dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const
|
||||||
{
|
{
|
||||||
Q_UNUSED( unit );
|
Q_UNUSED( unit );
|
||||||
|
@ -235,17 +235,13 @@ class CORE_EXPORT QgsSymbolLayerV2
|
|||||||
*/
|
*/
|
||||||
virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsSymbolV2RenderContext& context, const QVariant& defaultVal = QVariant(), bool *ok = nullptr ) const;
|
virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsSymbolV2RenderContext& context, const QVariant& defaultVal = QVariant(), bool *ok = nullptr ) const;
|
||||||
|
|
||||||
virtual bool writeDxf( QgsDxfExport& e,
|
virtual bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
||||||
double mmMapUnitScaleFactor,
|
|
||||||
const QString& layerName,
|
|
||||||
QgsSymbolV2RenderContext* context,
|
|
||||||
const QgsFeature* f,
|
|
||||||
QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
|
||||||
|
|
||||||
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
||||||
virtual double dxfOffset( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
virtual double dxfOffset( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
||||||
|
|
||||||
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
|
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
|
||||||
|
virtual double dxfAngle( QgsSymbolV2RenderContext& context ) const;
|
||||||
|
|
||||||
virtual QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const;
|
virtual QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const;
|
||||||
virtual Qt::PenStyle dxfPenStyle() const;
|
virtual Qt::PenStyle dxfPenStyle() const;
|
||||||
|
@ -469,8 +469,11 @@ void QgsSymbolV2::startRender( QgsRenderContext& context, const QgsFields* field
|
|||||||
void QgsSymbolV2::stopRender( QgsRenderContext& context )
|
void QgsSymbolV2::stopRender( QgsRenderContext& context )
|
||||||
{
|
{
|
||||||
Q_UNUSED( context )
|
Q_UNUSED( context )
|
||||||
Q_FOREACH ( QgsSymbolLayerV2* layer, mLayers )
|
if ( mSymbolRenderContext )
|
||||||
layer->stopRender( *mSymbolRenderContext );
|
{
|
||||||
|
Q_FOREACH ( QgsSymbolLayerV2* layer, mLayers )
|
||||||
|
layer->stopRender( *mSymbolRenderContext );
|
||||||
|
}
|
||||||
|
|
||||||
delete mSymbolRenderContext;
|
delete mSymbolRenderContext;
|
||||||
mSymbolRenderContext = nullptr;
|
mSymbolRenderContext = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user