mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -04:00
Remove more deprecated methods from symbology
This commit is contained in:
parent
7c1fc8e4bc
commit
55fc40d87f
@ -899,6 +899,20 @@ be returned instead of a null pointer if no transformation is required.</li>
|
||||
<li>QgsRubberBand( QgsMapCanvas* mapCanvas, bool isPolygon ) constructor and reset( bool isPolygon) have been removed, use constructor and function with Qgis::GeometryType as argument instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsRuleBasedRenderer QgsRuleBasedRenderer
|
||||
|
||||
<ul>
|
||||
<li>QgsRuleBasedRenderer.Rule checkState() and setCheckState() were removed. Use active() and setActive() instead.</li>
|
||||
<li>startRender( QgsRenderContext& context, const QgsFields& fields ) was removed. Use startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter ) instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSimpleMarkerSymbolLayer QgsSimpleMarkerSymbolLayer
|
||||
|
||||
<ul>
|
||||
<li>The constructor variant with a string for the shape name has been removed. Use the variant which accepts a QgsSimpleMarkerSymbolLayerBase.Shape enum instead.</li>
|
||||
<li>name() and setName() have been removed. Use shape() and setShape() instead.</li>
|
||||
<li>prepareShape() and preparePath() were removed. Calling these methods manually should no longer be required.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSnapper QgsSnapper
|
||||
|
||||
|
@ -148,28 +148,6 @@ class QgsSimpleMarkerSymbolLayer : QgsSimpleMarkerSymbolLayerBase
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor for QgsSimpleMarkerSymbolLayer.
|
||||
* @param name symbol name, should be one of "square", "rectangle", "diamond",
|
||||
* "pentagon", "hexagon", "triangle", "equilateral_triangle", "star", "arrow",
|
||||
* "circle", "cross", "cross_fill", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
|
||||
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
|
||||
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
|
||||
* @param color fill color for symbol
|
||||
* @param borderColor border color for symbol
|
||||
* @param size symbol size (in mm)
|
||||
* @param angle symbol rotation angle
|
||||
* @param scaleMethod scaling method for data defined scaling
|
||||
* @param penJoinStyle join style for outline pen
|
||||
* @deprecated use variant which accepts QgsSimpleMarkerSymbolLayerBase::Shape instead
|
||||
*/
|
||||
QgsSimpleMarkerSymbolLayer( const QString& name,
|
||||
const QColor& color = DEFAULT_SIMPLEMARKER_COLOR,
|
||||
const QColor& borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
|
||||
double size = DEFAULT_SIMPLEMARKER_SIZE,
|
||||
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
|
||||
QgsSymbol::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD,
|
||||
Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE ) /Deprecated/;
|
||||
|
||||
/** Constructor for QgsSimpleMarkerSymbolLayer.
|
||||
* @param shape symbol shape
|
||||
* @param size symbol size (in mm)
|
||||
@ -225,12 +203,6 @@ class QgsSimpleMarkerSymbolLayer : QgsSimpleMarkerSymbolLayerBase
|
||||
|
||||
// new methods
|
||||
|
||||
//! @deprecated use shape() instead
|
||||
QString name() const /Deprecated/;
|
||||
|
||||
//! @deprecated use setShape() instead
|
||||
void setName( const QString& name ) /Deprecated/;
|
||||
|
||||
/** Returns the marker's border color.
|
||||
* @see setBorderColor()
|
||||
* @see outlineStyle()
|
||||
@ -334,13 +306,6 @@ class QgsSimpleMarkerSymbolLayer : QgsSimpleMarkerSymbolLayerBase
|
||||
*/
|
||||
void drawMarker( QPainter* p, QgsSymbolRenderContext& context );
|
||||
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
bool prepareShape( const QString& name = QString() ) /Deprecated/;
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
bool prepareShape( const QString& name, QPolygonF &polygon ) const /Deprecated/;
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
bool preparePath( QString name = QString() ) /Deprecated/;
|
||||
|
||||
/** Prepares cache image
|
||||
* @returns true in case of success, false if cache image size too large
|
||||
*/
|
||||
|
@ -77,10 +77,6 @@ class QgsPointDisplacementRenderer : QgsFeatureRenderer
|
||||
virtual bool legendSymbolItemChecked( const QString& key );
|
||||
virtual void checkLegendSymbolItem( const QString& key, bool state = true );
|
||||
|
||||
//! not available in python bindings
|
||||
//! @deprecated since 2.4
|
||||
// void setDisplacementGroups( const QList<QMap<QgsFeatureId, QgsFeature> >& list );
|
||||
|
||||
void setLabelFont( const QFont& f );
|
||||
QFont labelFont() const;
|
||||
|
||||
|
@ -138,10 +138,6 @@ class QgsRuleBasedRenderer : QgsFeatureRenderer
|
||||
*/
|
||||
QString description() const;
|
||||
|
||||
//! @note added in 2.6
|
||||
//! @deprecated use active instead
|
||||
bool checkState() const /Deprecated/;
|
||||
|
||||
/**
|
||||
* Returns if this rule is active
|
||||
*
|
||||
@ -190,10 +186,6 @@ class QgsRuleBasedRenderer : QgsFeatureRenderer
|
||||
*/
|
||||
void setDescription( const QString& description );
|
||||
|
||||
//! @note added in 2.6
|
||||
//! @deprecated use setActive instead
|
||||
void setCheckState( bool state ) /Deprecated/;
|
||||
|
||||
/**
|
||||
* Sets if this rule is active
|
||||
* @param state Determines if the rule should be activated or deactivated
|
||||
@ -208,11 +200,6 @@ class QgsRuleBasedRenderer : QgsFeatureRenderer
|
||||
|
||||
QDomElement save( QDomDocument& doc, QgsSymbolMap& symbolMap );
|
||||
|
||||
/** Prepare the rule for rendering and its children (build active children array)
|
||||
* @deprecated use startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter ) instead
|
||||
*/
|
||||
bool startRender( QgsRenderContext& context, const QgsFields& fields ) /Deprecated/;
|
||||
|
||||
//! prepare the rule for rendering and its children (build active children array)
|
||||
bool startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter );
|
||||
|
||||
|
@ -682,20 +682,6 @@ void QgsSimpleMarkerSymbolLayerBase::calculateOffsetAndRotation( QgsSymbolRender
|
||||
// QgsSimpleMarkerSymbolLayer
|
||||
//
|
||||
|
||||
QgsSimpleMarkerSymbolLayer::QgsSimpleMarkerSymbolLayer( const QString& name, const QColor& color, const QColor& borderColor, double size, double angle, QgsSymbol::ScaleMethod scaleMethod,
|
||||
Qt::PenJoinStyle penJoinStyle )
|
||||
: QgsSimpleMarkerSymbolLayerBase( decodeShape( name ), size, angle, scaleMethod )
|
||||
, mBorderColor( borderColor )
|
||||
, mOutlineStyle( Qt::SolidLine )
|
||||
, mOutlineWidth( 0 )
|
||||
, mOutlineWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mPenJoinStyle( penJoinStyle )
|
||||
, mName( name )
|
||||
, mUsingCache( false )
|
||||
{
|
||||
mColor = color;
|
||||
}
|
||||
|
||||
QgsSimpleMarkerSymbolLayer::QgsSimpleMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase::Shape shape, double size, double angle, QgsSymbol::ScaleMethod scaleMethod, const QColor& color, const QColor& borderColor, Qt::PenJoinStyle penJoinStyle )
|
||||
: QgsSimpleMarkerSymbolLayerBase( shape, size, angle, scaleMethod )
|
||||
, mBorderColor( borderColor )
|
||||
@ -944,21 +930,6 @@ bool QgsSimpleMarkerSymbolLayer::prepareCache( QgsSymbolRenderContext& context )
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QgsSimpleMarkerSymbolLayer::prepareShape( const QString& name )
|
||||
{
|
||||
return shapeToPolygon( name.isNull() ? mShape : decodeShape( name ), mPolygon );
|
||||
}
|
||||
|
||||
bool QgsSimpleMarkerSymbolLayer::prepareShape( const QString& name, QPolygonF &polygon ) const
|
||||
{
|
||||
return shapeToPolygon( decodeShape( name ), polygon );
|
||||
}
|
||||
|
||||
bool QgsSimpleMarkerSymbolLayer::preparePath( QString name )
|
||||
{
|
||||
return prepareMarkerPath( decodeShape( name ) );
|
||||
}
|
||||
|
||||
void QgsSimpleMarkerSymbolLayer::draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path )
|
||||
{
|
||||
//making changes here? Don't forget to also update ::bounds if the changes affect the bounding box
|
||||
|
@ -186,28 +186,6 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
|
||||
{
|
||||
public:
|
||||
|
||||
/** Constructor for QgsSimpleMarkerSymbolLayer.
|
||||
* @param name symbol name, should be one of "square", "rectangle", "diamond",
|
||||
* "pentagon", "hexagon", "triangle", "equilateral_triangle", "star", "arrow",
|
||||
* "circle", "cross", "cross_fill", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
|
||||
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
|
||||
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
|
||||
* @param color fill color for symbol
|
||||
* @param borderColor border color for symbol
|
||||
* @param size symbol size (in mm)
|
||||
* @param angle symbol rotation angle
|
||||
* @param scaleMethod scaling method for data defined scaling
|
||||
* @param penJoinStyle join style for outline pen
|
||||
* @deprecated use variant which accepts QgsSimpleMarkerSymbolLayerBase::Shape instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED QgsSimpleMarkerSymbolLayer( const QString& name,
|
||||
const QColor& color = DEFAULT_SIMPLEMARKER_COLOR,
|
||||
const QColor& borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
|
||||
double size = DEFAULT_SIMPLEMARKER_SIZE,
|
||||
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
|
||||
QgsSymbol::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD,
|
||||
Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE );
|
||||
|
||||
/** Constructor for QgsSimpleMarkerSymbolLayer.
|
||||
* @param shape symbol shape
|
||||
* @param size symbol size (in mm)
|
||||
@ -263,12 +241,6 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
|
||||
|
||||
// new methods
|
||||
|
||||
//! @deprecated use shape() instead
|
||||
Q_DECL_DEPRECATED QString name() const { return encodeShape( mShape ); }
|
||||
|
||||
//! @deprecated use setShape() instead
|
||||
Q_DECL_DEPRECATED void setName( const QString& name ) { mName = name; mShape = decodeShape( name ); }
|
||||
|
||||
/** Returns the marker's border color.
|
||||
* @see setBorderColor()
|
||||
* @see outlineStyle()
|
||||
@ -372,13 +344,6 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
|
||||
*/
|
||||
void drawMarker( QPainter* p, QgsSymbolRenderContext& context );
|
||||
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
Q_DECL_DEPRECATED bool prepareShape( const QString& name = QString() );
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
Q_DECL_DEPRECATED bool prepareShape( const QString& name, QPolygonF &polygon ) const;
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
Q_DECL_DEPRECATED bool preparePath( QString name = QString() );
|
||||
|
||||
/** Prepares cache image
|
||||
* @returns true in case of success, false if cache image size too large
|
||||
*/
|
||||
|
@ -105,10 +105,6 @@ class CORE_EXPORT QgsPointDisplacementRenderer: public QgsFeatureRenderer
|
||||
virtual bool legendSymbolItemChecked( const QString& key ) override;
|
||||
virtual void checkLegendSymbolItem( const QString& key, bool state = true ) override;
|
||||
|
||||
//! not available in python bindings
|
||||
//! @deprecated since 2.4
|
||||
Q_DECL_DEPRECATED void setDisplacementGroups( const QList<QMap<QgsFeatureId, QgsFeature> >& list ) { Q_UNUSED( list ); }
|
||||
|
||||
void setLabelFont( const QFont& f ) { mLabelFont = f; }
|
||||
QFont labelFont() const { return mLabelFont;}
|
||||
|
||||
|
@ -396,12 +396,6 @@ void QgsRuleBasedRenderer::Rule::toSld( QDomDocument& doc, QDomElement &element,
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsRuleBasedRenderer::Rule::startRender( QgsRenderContext& context, const QgsFields& fields )
|
||||
{
|
||||
QString filter;
|
||||
return startRender( context, fields, filter );
|
||||
}
|
||||
|
||||
bool QgsRuleBasedRenderer::Rule::startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter )
|
||||
{
|
||||
mActiveChildren.clear();
|
||||
|
@ -192,10 +192,6 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer
|
||||
*/
|
||||
QString description() const { return mDescription; }
|
||||
|
||||
//! @note added in 2.6
|
||||
//! @deprecated use active instead
|
||||
Q_DECL_DEPRECATED bool checkState() const { return mIsActive; }
|
||||
|
||||
/**
|
||||
* Returns if this rule is active
|
||||
*
|
||||
@ -244,10 +240,6 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer
|
||||
*/
|
||||
void setDescription( const QString& description ) { mDescription = description; }
|
||||
|
||||
//! @note added in 2.6
|
||||
//! @deprecated use setActive instead
|
||||
Q_DECL_DEPRECATED void setCheckState( bool state ) { mIsActive = state; }
|
||||
|
||||
/**
|
||||
* Sets if this rule is active
|
||||
* @param state Determines if the rule should be activated or deactivated
|
||||
@ -266,11 +258,6 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer
|
||||
|
||||
QDomElement save( QDomDocument& doc, QgsSymbolMap& symbolMap ) const;
|
||||
|
||||
/** Prepare the rule for rendering and its children (build active children array)
|
||||
* @deprecated use startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED bool startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
//! prepare the rule for rendering and its children (build active children array)
|
||||
bool startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter );
|
||||
|
||||
|
@ -42,6 +42,7 @@ from qgis.core import (QgsGeometry,
|
||||
QgsMapSettings,
|
||||
QgsRenderChecker,
|
||||
QgsSimpleMarkerSymbolLayer,
|
||||
QgsSimpleMarkerSymbolLayerBase,
|
||||
QgsUnitTypes,
|
||||
QgsWkbTypes
|
||||
)
|
||||
@ -207,15 +208,15 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
# create a marker symbol with a single layer
|
||||
markerSymbol = QgsMarkerSymbol()
|
||||
markerSymbol.deleteSymbolLayer(0)
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
self.assertEqual(markerSymbol.size(), 10)
|
||||
markerSymbol.setSize(20)
|
||||
self.assertEqual(markerSymbol.size(), 20)
|
||||
self.assertEqual(markerSymbol.symbolLayer(0).size(), 20)
|
||||
|
||||
# add additional layers
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 30))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=30))
|
||||
self.assertEqual(markerSymbol.size(), 30)
|
||||
markerSymbol.setSize(3)
|
||||
self.assertEqual(markerSymbol.size(), 3)
|
||||
@ -230,15 +231,15 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
# create a marker symbol with a single layer
|
||||
markerSymbol = QgsMarkerSymbol()
|
||||
markerSymbol.deleteSymbolLayer(0)
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10, 90))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10, angle=90))
|
||||
self.assertEqual(markerSymbol.angle(), 90)
|
||||
markerSymbol.setAngle(100)
|
||||
self.assertEqual(markerSymbol.angle(), 100)
|
||||
self.assertEqual(markerSymbol.symbolLayer(0).angle(), 100)
|
||||
|
||||
# add additional layers
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10, 130))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10, 150))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10, angle=130))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10, angle=150))
|
||||
# should take first layer's angle
|
||||
self.assertEqual(markerSymbol.angle(), 100)
|
||||
markerSymbol.setAngle(10)
|
||||
@ -254,15 +255,15 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
# create a marker symbol with a single layer
|
||||
markerSymbol = QgsMarkerSymbol()
|
||||
markerSymbol.deleteSymbolLayer(0)
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
self.assertEqual(markerSymbol.sizeUnit(), QgsUnitTypes.RenderMillimeters)
|
||||
markerSymbol.setSizeUnit(QgsUnitTypes.RenderMapUnits)
|
||||
self.assertEqual(markerSymbol.sizeUnit(), QgsUnitTypes.RenderMapUnits)
|
||||
self.assertEqual(markerSymbol.symbolLayer(0).sizeUnit(), QgsUnitTypes.RenderMapUnits)
|
||||
|
||||
# add additional layers
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 30))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=30))
|
||||
# should now be mixed size units
|
||||
self.assertEqual(markerSymbol.sizeUnit(), QgsUnitTypes.RenderUnknownUnit)
|
||||
markerSymbol.setSizeUnit(QgsUnitTypes.RenderPixels)
|
||||
@ -278,7 +279,7 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
# create a marker symbol with a single layer
|
||||
markerSymbol = QgsMarkerSymbol()
|
||||
markerSymbol.deleteSymbolLayer(0)
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
markerSymbol.symbolLayer(0).setSizeMapUnitScale(QgsMapUnitScale(10000, 20000))
|
||||
self.assertEqual(markerSymbol.sizeMapUnitScale(), QgsMapUnitScale(10000, 20000))
|
||||
markerSymbol.setSizeMapUnitScale(QgsMapUnitScale(1000, 2000))
|
||||
@ -286,8 +287,8 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
self.assertEqual(markerSymbol.symbolLayer(0).sizeMapUnitScale(), QgsMapUnitScale(1000, 2000))
|
||||
|
||||
# add additional layers
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 30))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=30))
|
||||
# should take first layer's map unit scale
|
||||
self.assertEqual(markerSymbol.sizeMapUnitScale(), QgsMapUnitScale(1000, 2000))
|
||||
markerSymbol.setSizeMapUnitScale(QgsMapUnitScale(3000, 4000))
|
||||
|
@ -46,6 +46,7 @@ from qgis.core import (QgsCentroidFillSymbolLayer,
|
||||
QgsSimpleFillSymbolLayer,
|
||||
QgsSimpleLineSymbolLayer,
|
||||
QgsSimpleMarkerSymbolLayer,
|
||||
QgsSimpleMarkerSymbolLayerBase,
|
||||
QgsSVGFillSymbolLayer,
|
||||
QgsSvgMarkerSymbolLayer,
|
||||
QgsSymbolLayer,
|
||||
@ -410,8 +411,8 @@ class TestQgsSymbolLayer(unittest.TestCase):
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
mExpectedValue = u'star'
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
|
||||
mExpectedValue = QgsSimpleMarkerSymbolLayerBase.Star
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).shape()
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
@ -504,8 +505,8 @@ class TestQgsSymbolLayer(unittest.TestCase):
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
mExpectedValue = u'triangle'
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
|
||||
mExpectedValue = QgsSimpleMarkerSymbolLayerBase.Triangle
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).shape()
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
@ -598,8 +599,8 @@ class TestQgsSymbolLayer(unittest.TestCase):
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
mExpectedValue = u'circle'
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
|
||||
mExpectedValue = QgsSimpleMarkerSymbolLayerBase.Circle
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).shape()
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
|
@ -33,7 +33,7 @@ from qgis.PyQt.QtXml import (
|
||||
from qgis.PyQt.QtGui import QColor
|
||||
|
||||
from qgis.core import (
|
||||
QgsSimpleMarkerSymbolLayer, QgsUnitTypes, QgsSvgMarkerSymbolLayer,
|
||||
QgsSimpleMarkerSymbolLayer, QgsSimpleMarkerSymbolLayerBase, QgsUnitTypes, QgsSvgMarkerSymbolLayer,
|
||||
QgsFontMarkerSymbolLayer, QgsEllipseSymbolLayer, QgsSimpleLineSymbolLayer,
|
||||
QgsMarkerLineSymbolLayer, QgsMarkerSymbol, QgsSimpleFillSymbolLayer, QgsSVGFillSymbolLayer,
|
||||
QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsVectorLayer)
|
||||
@ -53,7 +53,7 @@ class TestQgsSymbolLayerCreateSld(unittest.TestCase):
|
||||
|
||||
def testSimpleMarkerRotation(self):
|
||||
symbol = QgsSimpleMarkerSymbolLayer(
|
||||
'star', QColor(255, 0, 0), QColor(0, 255, 0), 10)
|
||||
QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10)
|
||||
symbol.setAngle(50)
|
||||
dom, root = self.symbolToSld(symbol)
|
||||
# print( "Simple marker rotation: " + root.ownerDocument().toString())
|
||||
@ -88,7 +88,7 @@ class TestQgsSymbolLayerCreateSld(unittest.TestCase):
|
||||
|
||||
def testSimpleMarkerUnitDefault(self):
|
||||
symbol = QgsSimpleMarkerSymbolLayer(
|
||||
'star', QColor(255, 0, 0), QColor(0, 255, 0), 10)
|
||||
QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10)
|
||||
symbol.setOutlineWidth(3)
|
||||
symbol.setOffset(QPointF(5, 10))
|
||||
dom, root = self.symbolToSld(symbol)
|
||||
@ -111,7 +111,7 @@ class TestQgsSymbolLayerCreateSld(unittest.TestCase):
|
||||
|
||||
def testSimpleMarkerUnitPixels(self):
|
||||
symbol = QgsSimpleMarkerSymbolLayer(
|
||||
'star', QColor(255, 0, 0), QColor(0, 255, 0), 10)
|
||||
QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10)
|
||||
symbol.setOutlineWidth(3)
|
||||
symbol.setOffset(QPointF(5, 10))
|
||||
symbol.setOutputUnit(QgsUnitTypes.RenderPixels)
|
||||
|
Loading…
x
Reference in New Issue
Block a user