Promote marker symbol alignment enums to enum class, move to Qgis

This commit is contained in:
Nyall Dawson 2025-03-04 08:29:52 +10:00
parent 620be751dc
commit 13aae162f0
27 changed files with 493 additions and 498 deletions

View File

@ -1445,6 +1445,73 @@ Qgis.SymbolRotationMode.__doc__ = """Modes for handling how symbol and text enti
"""
# --
Qgis.SymbolRotationMode.baseClass = Qgis
QgsMarkerSymbolLayer.HorizontalAnchorPoint = Qgis.HorizontalAnchorPoint
# monkey patching scoped based enum
QgsMarkerSymbolLayer.Left = Qgis.HorizontalAnchorPoint.Left
QgsMarkerSymbolLayer.Left.is_monkey_patched = True
QgsMarkerSymbolLayer.Left.__doc__ = "Align to left side of symbol"
QgsMarkerSymbolLayer.HCenter = Qgis.HorizontalAnchorPoint.Center
QgsMarkerSymbolLayer.HorizontalAnchorPoint.HCenter = Qgis.HorizontalAnchorPoint.Center
QgsMarkerSymbolLayer.HCenter.is_monkey_patched = True
QgsMarkerSymbolLayer.HCenter.__doc__ = "Align to horizontal center of symbol"
QgsMarkerSymbolLayer.Right = Qgis.HorizontalAnchorPoint.Right
QgsMarkerSymbolLayer.Right.is_monkey_patched = True
QgsMarkerSymbolLayer.Right.__doc__ = "Align to right side of symbol"
Qgis.HorizontalAnchorPoint.__doc__ = """Marker symbol horizontal anchor points.
.. note::
Prior to QGIS 3.44 this was available as :py:class:`QgsMarkerSymbolLayer`.HorizontalAnchorPoint
.. versionadded:: 3.44
* ``Left``: Align to left side of symbol
* ``Center``: Align to horizontal center of symbol
Available as ``QgsMarkerSymbolLayer.HCenter`` in older QGIS releases.
* ``Right``: Align to right side of symbol
"""
# --
Qgis.HorizontalAnchorPoint.baseClass = Qgis
QgsMarkerSymbolLayer.VerticalAnchorPoint = Qgis.VerticalAnchorPoint
# monkey patching scoped based enum
QgsMarkerSymbolLayer.Top = Qgis.VerticalAnchorPoint.Top
QgsMarkerSymbolLayer.Top.is_monkey_patched = True
QgsMarkerSymbolLayer.Top.__doc__ = "Align to top of symbol"
QgsMarkerSymbolLayer.VCenter = Qgis.VerticalAnchorPoint.Center
QgsMarkerSymbolLayer.VerticalAnchorPoint.VCenter = Qgis.VerticalAnchorPoint.Center
QgsMarkerSymbolLayer.VCenter.is_monkey_patched = True
QgsMarkerSymbolLayer.VCenter.__doc__ = "Align to vertical center of symbol"
QgsMarkerSymbolLayer.Bottom = Qgis.VerticalAnchorPoint.Bottom
QgsMarkerSymbolLayer.Bottom.is_monkey_patched = True
QgsMarkerSymbolLayer.Bottom.__doc__ = "Align to bottom of symbol"
QgsMarkerSymbolLayer.Baseline = Qgis.VerticalAnchorPoint.Baseline
QgsMarkerSymbolLayer.Baseline.is_monkey_patched = True
QgsMarkerSymbolLayer.Baseline.__doc__ = "Align to baseline of symbol, e.g. font baseline for font marker symbol layers. Treated as Bottom if no baseline is available for the symbol layer type. \n.. versionadded:: 3.44"
Qgis.VerticalAnchorPoint.__doc__ = """Marker symbol vertical anchor points.
.. note::
Prior to QGIS 3.44 this was available as :py:class:`QgsMarkerSymbolLayer`.VerticalAnchorPoint
.. versionadded:: 3.44
* ``Top``: Align to top of symbol
* ``Center``: Align to vertical center of symbol
Available as ``QgsMarkerSymbolLayer.VCenter`` in older QGIS releases.
* ``Bottom``: Align to bottom of symbol
* ``Baseline``: Align to baseline of symbol, e.g. font baseline for font marker symbol layers. Treated as Bottom if no baseline is available for the symbol layer type.
.. versionadded:: 3.44
"""
# --
Qgis.VerticalAnchorPoint.baseClass = Qgis
# monkey patching scoped based enum
Qgis.FeatureRendererFlag.AffectsLabeling.__doc__ = "If present, indicates that the renderer will participate in the map labeling problem"
Qgis.FeatureRendererFlag.__doc__ = """Flags controlling behavior of vector feature renderers.

View File

@ -609,13 +609,6 @@ QgsSymbolLayer.Property.__doc__ = """Data definable properties.
"""
# --
QgsMarkerSymbolLayer.Left = QgsMarkerSymbolLayer.HorizontalAnchorPoint.Left
QgsMarkerSymbolLayer.HCenter = QgsMarkerSymbolLayer.HorizontalAnchorPoint.HCenter
QgsMarkerSymbolLayer.Right = QgsMarkerSymbolLayer.HorizontalAnchorPoint.Right
QgsMarkerSymbolLayer.Top = QgsMarkerSymbolLayer.VerticalAnchorPoint.Top
QgsMarkerSymbolLayer.VCenter = QgsMarkerSymbolLayer.VerticalAnchorPoint.VCenter
QgsMarkerSymbolLayer.Bottom = QgsMarkerSymbolLayer.VerticalAnchorPoint.Bottom
QgsMarkerSymbolLayer.Baseline = QgsMarkerSymbolLayer.VerticalAnchorPoint.Baseline
QgsLineSymbolLayer.AllRings = QgsLineSymbolLayer.RenderRingFilter.AllRings
QgsLineSymbolLayer.ExteriorRingOnly = QgsLineSymbolLayer.RenderRingFilter.ExteriorRingOnly
QgsLineSymbolLayer.InteriorRingsOnly = QgsLineSymbolLayer.RenderRingFilter.InteriorRingsOnly

View File

@ -483,6 +483,22 @@ The development version
IgnoreMapRotation,
};
enum class HorizontalAnchorPoint /BaseType=IntEnum/
{
Left,
Center,
Right,
};
enum class VerticalAnchorPoint /BaseType=IntEnum/
{
Top,
Center,
Bottom,
Baseline,
};
enum class FeatureRendererFlag /BaseType=IntFlag/
{
AffectsLabeling,

View File

@ -759,21 +759,6 @@ Abstract base class for marker symbol layers.
%End
public:
enum HorizontalAnchorPoint /BaseType=IntEnum/
{
Left,
HCenter,
Right,
};
enum VerticalAnchorPoint /BaseType=IntEnum/
{
Top,
VCenter,
Bottom,
Baseline,
};
virtual void startRender( QgsSymbolRenderContext &context );
@ -986,7 +971,7 @@ Returns the map unit scale for the symbol's offset.
.. seealso:: :py:func:`offsetUnit`
%End
void setHorizontalAnchorPoint( HorizontalAnchorPoint h );
void setHorizontalAnchorPoint( Qgis::HorizontalAnchorPoint h );
%Docstring
Sets the horizontal anchor point for positioning the symbol.
@ -998,7 +983,7 @@ Sets the horizontal anchor point for positioning the symbol.
.. seealso:: :py:func:`setVerticalAnchorPoint`
%End
HorizontalAnchorPoint horizontalAnchorPoint() const;
Qgis::HorizontalAnchorPoint horizontalAnchorPoint() const;
%Docstring
Returns the horizontal anchor point for positioning the symbol. The symbol will be drawn so that
the horizontal anchor point is aligned with the marker's desired location.
@ -1008,7 +993,7 @@ the horizontal anchor point is aligned with the marker's desired location.
.. seealso:: :py:func:`verticalAnchorPoint`
%End
void setVerticalAnchorPoint( VerticalAnchorPoint v );
void setVerticalAnchorPoint( Qgis::VerticalAnchorPoint v );
%Docstring
Sets the vertical anchor point for positioning the symbol.
@ -1020,7 +1005,7 @@ Sets the vertical anchor point for positioning the symbol.
.. seealso:: :py:func:`setHorizontalAnchorPoint`
%End
VerticalAnchorPoint verticalAnchorPoint() const;
Qgis::VerticalAnchorPoint verticalAnchorPoint() const;
%Docstring
Returns the vertical anchor point for positioning the symbol. The symbol will be drawn so that
the vertical anchor point is aligned with the marker's desired location.

View File

@ -1428,6 +1428,73 @@ Qgis.SymbolRotationMode.__doc__ = """Modes for handling how symbol and text enti
"""
# --
Qgis.SymbolRotationMode.baseClass = Qgis
QgsMarkerSymbolLayer.HorizontalAnchorPoint = Qgis.HorizontalAnchorPoint
# monkey patching scoped based enum
QgsMarkerSymbolLayer.Left = Qgis.HorizontalAnchorPoint.Left
QgsMarkerSymbolLayer.Left.is_monkey_patched = True
QgsMarkerSymbolLayer.Left.__doc__ = "Align to left side of symbol"
QgsMarkerSymbolLayer.HCenter = Qgis.HorizontalAnchorPoint.Center
QgsMarkerSymbolLayer.HorizontalAnchorPoint.HCenter = Qgis.HorizontalAnchorPoint.Center
QgsMarkerSymbolLayer.HCenter.is_monkey_patched = True
QgsMarkerSymbolLayer.HCenter.__doc__ = "Align to horizontal center of symbol"
QgsMarkerSymbolLayer.Right = Qgis.HorizontalAnchorPoint.Right
QgsMarkerSymbolLayer.Right.is_monkey_patched = True
QgsMarkerSymbolLayer.Right.__doc__ = "Align to right side of symbol"
Qgis.HorizontalAnchorPoint.__doc__ = """Marker symbol horizontal anchor points.
.. note::
Prior to QGIS 3.44 this was available as :py:class:`QgsMarkerSymbolLayer`.HorizontalAnchorPoint
.. versionadded:: 3.44
* ``Left``: Align to left side of symbol
* ``Center``: Align to horizontal center of symbol
Available as ``QgsMarkerSymbolLayer.HCenter`` in older QGIS releases.
* ``Right``: Align to right side of symbol
"""
# --
Qgis.HorizontalAnchorPoint.baseClass = Qgis
QgsMarkerSymbolLayer.VerticalAnchorPoint = Qgis.VerticalAnchorPoint
# monkey patching scoped based enum
QgsMarkerSymbolLayer.Top = Qgis.VerticalAnchorPoint.Top
QgsMarkerSymbolLayer.Top.is_monkey_patched = True
QgsMarkerSymbolLayer.Top.__doc__ = "Align to top of symbol"
QgsMarkerSymbolLayer.VCenter = Qgis.VerticalAnchorPoint.Center
QgsMarkerSymbolLayer.VerticalAnchorPoint.VCenter = Qgis.VerticalAnchorPoint.Center
QgsMarkerSymbolLayer.VCenter.is_monkey_patched = True
QgsMarkerSymbolLayer.VCenter.__doc__ = "Align to vertical center of symbol"
QgsMarkerSymbolLayer.Bottom = Qgis.VerticalAnchorPoint.Bottom
QgsMarkerSymbolLayer.Bottom.is_monkey_patched = True
QgsMarkerSymbolLayer.Bottom.__doc__ = "Align to bottom of symbol"
QgsMarkerSymbolLayer.Baseline = Qgis.VerticalAnchorPoint.Baseline
QgsMarkerSymbolLayer.Baseline.is_monkey_patched = True
QgsMarkerSymbolLayer.Baseline.__doc__ = "Align to baseline of symbol, e.g. font baseline for font marker symbol layers. Treated as Bottom if no baseline is available for the symbol layer type. \n.. versionadded:: 3.44"
Qgis.VerticalAnchorPoint.__doc__ = """Marker symbol vertical anchor points.
.. note::
Prior to QGIS 3.44 this was available as :py:class:`QgsMarkerSymbolLayer`.VerticalAnchorPoint
.. versionadded:: 3.44
* ``Top``: Align to top of symbol
* ``Center``: Align to vertical center of symbol
Available as ``QgsMarkerSymbolLayer.VCenter`` in older QGIS releases.
* ``Bottom``: Align to bottom of symbol
* ``Baseline``: Align to baseline of symbol, e.g. font baseline for font marker symbol layers. Treated as Bottom if no baseline is available for the symbol layer type.
.. versionadded:: 3.44
"""
# --
Qgis.VerticalAnchorPoint.baseClass = Qgis
# monkey patching scoped based enum
Qgis.FeatureRendererFlag.AffectsLabeling.__doc__ = "If present, indicates that the renderer will participate in the map labeling problem"
Qgis.FeatureRendererFlag.__doc__ = """Flags controlling behavior of vector feature renderers.

View File

@ -483,6 +483,22 @@ The development version
IgnoreMapRotation,
};
enum class HorizontalAnchorPoint
{
Left,
Center,
Right,
};
enum class VerticalAnchorPoint
{
Top,
Center,
Bottom,
Baseline,
};
enum class FeatureRendererFlag
{
AffectsLabeling,

View File

@ -759,21 +759,6 @@ Abstract base class for marker symbol layers.
%End
public:
enum HorizontalAnchorPoint
{
Left,
HCenter,
Right,
};
enum VerticalAnchorPoint
{
Top,
VCenter,
Bottom,
Baseline,
};
virtual void startRender( QgsSymbolRenderContext &context );
@ -986,7 +971,7 @@ Returns the map unit scale for the symbol's offset.
.. seealso:: :py:func:`offsetUnit`
%End
void setHorizontalAnchorPoint( HorizontalAnchorPoint h );
void setHorizontalAnchorPoint( Qgis::HorizontalAnchorPoint h );
%Docstring
Sets the horizontal anchor point for positioning the symbol.
@ -998,7 +983,7 @@ Sets the horizontal anchor point for positioning the symbol.
.. seealso:: :py:func:`setVerticalAnchorPoint`
%End
HorizontalAnchorPoint horizontalAnchorPoint() const;
Qgis::HorizontalAnchorPoint horizontalAnchorPoint() const;
%Docstring
Returns the horizontal anchor point for positioning the symbol. The symbol will be drawn so that
the horizontal anchor point is aligned with the marker's desired location.
@ -1008,7 +993,7 @@ the horizontal anchor point is aligned with the marker's desired location.
.. seealso:: :py:func:`verticalAnchorPoint`
%End
void setVerticalAnchorPoint( VerticalAnchorPoint v );
void setVerticalAnchorPoint( Qgis::VerticalAnchorPoint v );
%Docstring
Sets the vertical anchor point for positioning the symbol.
@ -1020,7 +1005,7 @@ Sets the vertical anchor point for positioning the symbol.
.. seealso:: :py:func:`setHorizontalAnchorPoint`
%End
VerticalAnchorPoint verticalAnchorPoint() const;
Qgis::VerticalAnchorPoint verticalAnchorPoint() const;
%Docstring
Returns the vertical anchor point for positioning the symbol. The symbol will be drawn so that
the vertical anchor point is aligned with the marker's desired location.

View File

@ -793,36 +793,36 @@ std::unique_ptr<QgsMarkerSymbol> QgsArcGisRestUtils::parseEsriTextMarkerSymbolJs
markerLayer->setSizeUnit( Qgis::RenderUnit::Points );
markerLayer->setStrokeWidthUnit( Qgis::RenderUnit::Points );
QgsMarkerSymbolLayer::HorizontalAnchorPoint hAlign = QgsMarkerSymbolLayer::HorizontalAnchorPoint::HCenter;
QgsMarkerSymbolLayer::VerticalAnchorPoint vAlign = QgsMarkerSymbolLayer::VerticalAnchorPoint::VCenter;
Qgis::HorizontalAnchorPoint hAlign = Qgis::HorizontalAnchorPoint::Center;
Qgis::VerticalAnchorPoint vAlign = Qgis::VerticalAnchorPoint::Center;
QString horizontalAnchorPoint = symbolData.value( QStringLiteral( "horizontalAlignment" ) ).toString();
QString verticalAnchorPoint = symbolData.value( QStringLiteral( "verticalAlignment" ) ).toString();
if ( horizontalAnchorPoint == QString( "center" ) )
{
hAlign = QgsMarkerSymbolLayer::HorizontalAnchorPoint::HCenter;
hAlign = Qgis::HorizontalAnchorPoint::Center;
}
else if ( horizontalAnchorPoint == QString( "left" ) )
{
hAlign = QgsMarkerSymbolLayer::HorizontalAnchorPoint::Left;
hAlign = Qgis::HorizontalAnchorPoint::Left;
}
else if ( horizontalAnchorPoint == QString( "right" ) )
{
hAlign = QgsMarkerSymbolLayer::HorizontalAnchorPoint::Right;
hAlign = Qgis::HorizontalAnchorPoint::Right;
}
if ( verticalAnchorPoint == QString( "center" ) )
{
vAlign = QgsMarkerSymbolLayer::VerticalAnchorPoint::VCenter;
vAlign = Qgis::VerticalAnchorPoint::Center;
}
else if ( verticalAnchorPoint == QString( "top" ) )
{
vAlign = QgsMarkerSymbolLayer::VerticalAnchorPoint::Top;
vAlign = Qgis::VerticalAnchorPoint::Top;
}
else if ( verticalAnchorPoint == QString( "bottom" ) )
{
vAlign = QgsMarkerSymbolLayer::VerticalAnchorPoint::Bottom;
vAlign = Qgis::VerticalAnchorPoint::Bottom;
}
markerLayer->setHorizontalAnchorPoint( hAlign );

View File

@ -753,6 +753,36 @@ class CORE_EXPORT Qgis
};
Q_ENUM( SymbolRotationMode )
/**
* Marker symbol horizontal anchor points.
*
* \note Prior to QGIS 3.44 this was available as QgsMarkerSymbolLayer::HorizontalAnchorPoint
* \since QGIS 3.44
*/
enum class HorizontalAnchorPoint SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsMarkerSymbolLayer, HorizontalAnchorPoint ) : int
{
Left, //!< Align to left side of symbol
Center SIP_MONKEYPATCH_COMPAT_NAME( HCenter ), //!< Align to horizontal center of symbol
Right, //!< Align to right side of symbol
};
Q_ENUM( HorizontalAnchorPoint )
/**
* Marker symbol vertical anchor points.
*
* \note Prior to QGIS 3.44 this was available as QgsMarkerSymbolLayer::VerticalAnchorPoint
* \since QGIS 3.44
*/
enum class VerticalAnchorPoint SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsMarkerSymbolLayer, VerticalAnchorPoint ) : int
{
Top, //!< Align to top of symbol
Center SIP_MONKEYPATCH_COMPAT_NAME( VCenter ), //!< Align to vertical center of symbol
Bottom, //!< Align to bottom of symbol
Baseline, //!< Align to baseline of symbol, e.g. font baseline for font marker symbol layers. Treated as Bottom if no baseline is available for the symbol layer type. \since QGIS 3.44
};
Q_ENUM( VerticalAnchorPoint )
/**
* \brief Flags controlling behavior of vector feature renderers.
*

View File

@ -158,11 +158,11 @@ QgsSymbolLayer *QgsEllipseSymbolLayer::create( const QVariantMap &properties )
}
if ( properties.contains( QStringLiteral( "horizontal_anchor_point" ) ) )
{
layer->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( properties[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
layer->setHorizontalAnchorPoint( static_cast< Qgis::HorizontalAnchorPoint >( properties[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
}
if ( properties.contains( QStringLiteral( "vertical_anchor_point" ) ) )
{
layer->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( properties[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
layer->setVerticalAnchorPoint( static_cast< Qgis::VerticalAnchorPoint >( properties[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
}
//data defined properties
@ -570,8 +570,8 @@ QVariantMap QgsEllipseSymbolLayer::properties() const
map[QStringLiteral( "size" )] = QString::number( mSize );
map[QStringLiteral( "size_unit" )] = QgsUnitTypes::encodeUnit( mSizeUnit );
map[QStringLiteral( "size_map_unit_scale" )] = QgsSymbolLayerUtils::encodeMapUnitScale( mSizeMapUnitScale );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( mHorizontalAnchorPoint );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( mVerticalAnchorPoint );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( static_cast< int >( mHorizontalAnchorPoint ) );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( static_cast< int >( mVerticalAnchorPoint ) );
return map;
}

View File

@ -1398,7 +1398,7 @@ QgsMarkerSymbol *QgsMapInfoSymbolConverter::convertMarkerSymbol( int identifier,
bool isNull = false;
bool hasShadow = false;
double angle = 0;
QgsMarkerSymbolLayer::VerticalAnchorPoint vertAlign = QgsMarkerSymbolLayer::VCenter;
Qgis::VerticalAnchorPoint vertAlign = Qgis::VerticalAnchorPoint::Center;
QPointF shadowOffset;
switch ( identifier )
{
@ -1486,14 +1486,14 @@ QgsMarkerSymbol *QgsMapInfoSymbolConverter::convertMarkerSymbol( int identifier,
shape = Qgis::MarkerShape::Arrow;
size *= 0.66666;
angle = 45;
vertAlign = QgsMarkerSymbolLayer::Top;
vertAlign = Qgis::VerticalAnchorPoint::Top;
break;
case 48:
shape = Qgis::MarkerShape::Arrow;
size *= 0.66666;
angle = 225;
vertAlign = QgsMarkerSymbolLayer::Top;
vertAlign = Qgis::VerticalAnchorPoint::Top;
break;
case 49:

View File

@ -1054,11 +1054,11 @@ QgsSymbolLayer *QgsSimpleMarkerSymbolLayer::create( const QVariantMap &props )
if ( props.contains( QStringLiteral( "horizontal_anchor_point" ) ) )
{
m->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( props[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
m->setHorizontalAnchorPoint( static_cast< Qgis::HorizontalAnchorPoint >( props[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
}
if ( props.contains( QStringLiteral( "vertical_anchor_point" ) ) )
{
m->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( props[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
m->setVerticalAnchorPoint( static_cast< Qgis::VerticalAnchorPoint >( props[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
}
if ( props.contains( QStringLiteral( "cap_style" ) ) )
@ -1379,8 +1379,8 @@ QVariantMap QgsSimpleMarkerSymbolLayer::properties() const
map[QStringLiteral( "outline_width_map_unit_scale" )] = QgsSymbolLayerUtils::encodeMapUnitScale( mStrokeWidthMapUnitScale );
map[QStringLiteral( "joinstyle" )] = QgsSymbolLayerUtils::encodePenJoinStyle( mPenJoinStyle );
map[QStringLiteral( "cap_style" )] = QgsSymbolLayerUtils::encodePenCapStyle( mPenCapStyle );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( mHorizontalAnchorPoint );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( mVerticalAnchorPoint );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( static_cast< int >( mHorizontalAnchorPoint ) );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( static_cast< int >( mVerticalAnchorPoint ) );
return map;
}
@ -1901,11 +1901,11 @@ QgsSymbolLayer *QgsFilledMarkerSymbolLayer::create( const QVariantMap &props )
m->setSizeMapUnitScale( QgsSymbolLayerUtils::decodeMapUnitScale( props[QStringLiteral( "size_map_unit_scale" )].toString() ) );
if ( props.contains( QStringLiteral( "horizontal_anchor_point" ) ) )
{
m->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( props[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
m->setHorizontalAnchorPoint( static_cast< Qgis::HorizontalAnchorPoint >( props[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
}
if ( props.contains( QStringLiteral( "vertical_anchor_point" ) ) )
{
m->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( props[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
m->setVerticalAnchorPoint( static_cast< Qgis::VerticalAnchorPoint >( props[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
}
m->setSubSymbol( QgsFillSymbol::createSimple( props ) );
@ -1965,8 +1965,8 @@ QVariantMap QgsFilledMarkerSymbolLayer::properties() const
map[QStringLiteral( "offset_unit" )] = QgsUnitTypes::encodeUnit( mOffsetUnit );
map[QStringLiteral( "offset_map_unit_scale" )] = QgsSymbolLayerUtils::encodeMapUnitScale( mOffsetMapUnitScale );
map[QStringLiteral( "scale_method" )] = QgsSymbolLayerUtils::encodeScaleMethod( mScaleMethod );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( mHorizontalAnchorPoint );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( mVerticalAnchorPoint );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( static_cast< int >( mHorizontalAnchorPoint ) );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( static_cast< int >( mVerticalAnchorPoint ) );
if ( mFill )
{
@ -2211,11 +2211,11 @@ QgsSymbolLayer *QgsSvgMarkerSymbolLayer::create( const QVariantMap &props )
if ( props.contains( QStringLiteral( "horizontal_anchor_point" ) ) )
{
m->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( props[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
m->setHorizontalAnchorPoint( static_cast< Qgis::HorizontalAnchorPoint >( props[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
}
if ( props.contains( QStringLiteral( "vertical_anchor_point" ) ) )
{
m->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( props[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
m->setVerticalAnchorPoint( static_cast< Qgis::VerticalAnchorPoint >( props[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
}
m->restoreOldDataDefinedProperties( props );
@ -2627,8 +2627,8 @@ QVariantMap QgsSvgMarkerSymbolLayer::properties() const
map[QStringLiteral( "outline_width" )] = QString::number( mStrokeWidth );
map[QStringLiteral( "outline_width_unit" )] = QgsUnitTypes::encodeUnit( mStrokeWidthUnit );
map[QStringLiteral( "outline_width_map_unit_scale" )] = QgsSymbolLayerUtils::encodeMapUnitScale( mStrokeWidthMapUnitScale );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( mHorizontalAnchorPoint );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( mVerticalAnchorPoint );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( static_cast< int >( mHorizontalAnchorPoint ) );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( static_cast< int >( mVerticalAnchorPoint ) );
map[QStringLiteral( "parameters" )] = QgsProperty::propertyMapToVariantMap( mParameters );
@ -3086,11 +3086,11 @@ void QgsRasterMarkerSymbolLayer::setCommonProperties( const QVariantMap &propert
if ( properties.contains( QStringLiteral( "horizontal_anchor_point" ) ) )
{
setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( properties[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
setHorizontalAnchorPoint( static_cast< Qgis::HorizontalAnchorPoint >( properties[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
}
if ( properties.contains( QStringLiteral( "vertical_anchor_point" ) ) )
{
setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( properties[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
setVerticalAnchorPoint( static_cast< Qgis::VerticalAnchorPoint >( properties[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
}
restoreOldDataDefinedProperties( properties );
@ -3373,8 +3373,8 @@ QVariantMap QgsRasterMarkerSymbolLayer::properties() const
map[QStringLiteral( "offset_unit" )] = QgsUnitTypes::encodeUnit( mOffsetUnit );
map[QStringLiteral( "offset_map_unit_scale" )] = QgsSymbolLayerUtils::encodeMapUnitScale( mOffsetMapUnitScale );
map[QStringLiteral( "scale_method" )] = QgsSymbolLayerUtils::encodeScaleMethod( mScaleMethod );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( mHorizontalAnchorPoint );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( mVerticalAnchorPoint );
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( static_cast< int >( mHorizontalAnchorPoint ) );
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( static_cast< int >( mVerticalAnchorPoint ) );
return map;
}
@ -3538,9 +3538,9 @@ QgsSymbolLayer *QgsFontMarkerSymbolLayer::create( const QVariantMap &props )
if ( props.contains( QStringLiteral( "joinstyle" ) ) )
m->setPenJoinStyle( QgsSymbolLayerUtils::decodePenJoinStyle( props[QStringLiteral( "joinstyle" )].toString() ) );
if ( props.contains( QStringLiteral( "horizontal_anchor_point" ) ) )
m->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( props[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
m->setHorizontalAnchorPoint( static_cast< Qgis::HorizontalAnchorPoint >( props[ QStringLiteral( "horizontal_anchor_point" )].toInt() ) );
if ( props.contains( QStringLiteral( "vertical_anchor_point" ) ) )
m->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( props[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
m->setVerticalAnchorPoint( static_cast< Qgis::VerticalAnchorPoint >( props[ QStringLiteral( "vertical_anchor_point" )].toInt() ) );
m->restoreOldDataDefinedProperties( props );
@ -3595,13 +3595,20 @@ void QgsFontMarkerSymbolLayer::startRender( QgsSymbolRenderContext &context )
mFont.setPixelSize( std::max( 2, static_cast< int >( std::round( sizePixels ) ) ) );
mFontMetrics.reset( new QFontMetrics( mFont ) );
mChrWidth = mFontMetrics->horizontalAdvance( mString );
if ( mVerticalAnchorPoint == VerticalAnchorPoint::Baseline )
switch ( mVerticalAnchorPoint )
{
mChrOffset = QPointF( mChrWidth / 2.0, -sizePixels / 2.0 );
}
else
{
mChrOffset = QPointF( mChrWidth / 2.0, -mFontMetrics->ascent() / 2.0 );
case Qgis::VerticalAnchorPoint::Baseline:
{
mChrOffset = QPointF( mChrWidth / 2.0, -sizePixels / 2.0 );
break;
}
case Qgis::VerticalAnchorPoint::Top:
case Qgis::VerticalAnchorPoint::Bottom:
case Qgis::VerticalAnchorPoint::Center:
{
mChrOffset = QPointF( mChrWidth / 2.0, -mFontMetrics->ascent() / 2.0 );
break;
}
}
mOrigSize = mSize; // save in case the size would be data defined
@ -3635,14 +3642,21 @@ QString QgsFontMarkerSymbolLayer::characterToRender( QgsSymbolRenderContext &con
if ( stringToRender != mString )
{
charWidth = mFontMetrics->horizontalAdvance( stringToRender );
if ( mVerticalAnchorPoint == VerticalAnchorPoint::Baseline )
switch ( mVerticalAnchorPoint )
{
const double sizePixels = context.renderContext().convertToPainterUnits( mSize, mSizeUnit, mSizeMapUnitScale );
charOffset = QPointF( charWidth / 2.0, -sizePixels / 2.0 );
}
else
{
charOffset = QPointF( charWidth / 2.0, -mFontMetrics->ascent() / 2.0 );
case Qgis::VerticalAnchorPoint::Baseline:
{
const double sizePixels = context.renderContext().convertToPainterUnits( mSize, mSizeUnit, mSizeMapUnitScale );
charOffset = QPointF( charWidth / 2.0, -sizePixels / 2.0 );
break;
}
case Qgis::VerticalAnchorPoint::Top:
case Qgis::VerticalAnchorPoint::Bottom:
case Qgis::VerticalAnchorPoint::Center:
{
charOffset = QPointF( charWidth / 2.0, -mFontMetrics->ascent() / 2.0 );
break;
}
}
}
}
@ -3871,8 +3885,8 @@ QVariantMap QgsFontMarkerSymbolLayer::properties() const
props[QStringLiteral( "offset" )] = QgsSymbolLayerUtils::encodePoint( mOffset );
props[QStringLiteral( "offset_unit" )] = QgsUnitTypes::encodeUnit( mOffsetUnit );
props[QStringLiteral( "offset_map_unit_scale" )] = QgsSymbolLayerUtils::encodeMapUnitScale( mOffsetMapUnitScale );
props[QStringLiteral( "horizontal_anchor_point" )] = QString::number( mHorizontalAnchorPoint );
props[QStringLiteral( "vertical_anchor_point" )] = QString::number( mVerticalAnchorPoint );
props[QStringLiteral( "horizontal_anchor_point" )] = QString::number( static_cast< int >( mHorizontalAnchorPoint ) );
props[QStringLiteral( "vertical_anchor_point" )] = QString::number( static_cast< int >( mVerticalAnchorPoint ) );
return props;
}

View File

@ -629,8 +629,8 @@ void QgsMarkerSymbolLayer::markerOffset( QgsSymbolRenderContext &context, double
offsetX = context.renderContext().convertToPainterUnits( offsetX, mOffsetUnit, mOffsetMapUnitScale );
offsetY = context.renderContext().convertToPainterUnits( offsetY, mOffsetUnit, mOffsetMapUnitScale );
HorizontalAnchorPoint horizontalAnchorPoint = mHorizontalAnchorPoint;
VerticalAnchorPoint verticalAnchorPoint = mVerticalAnchorPoint;
Qgis::HorizontalAnchorPoint horizontalAnchorPoint = mHorizontalAnchorPoint;
Qgis::VerticalAnchorPoint verticalAnchorPoint = mVerticalAnchorPoint;
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::Property::HorizontalAnchor ) )
{
QVariant exprVal = mDataDefinedProperties.value( QgsSymbolLayer::Property::HorizontalAnchor, context.renderContext().expressionContext() );
@ -649,7 +649,7 @@ void QgsMarkerSymbolLayer::markerOffset( QgsSymbolRenderContext &context, double
}
//correct horizontal position according to anchor point
if ( horizontalAnchorPoint == HCenter && verticalAnchorPoint == VCenter )
if ( horizontalAnchorPoint == Qgis::HorizontalAnchorPoint::Center && verticalAnchorPoint == Qgis::VerticalAnchorPoint::Center )
{
return;
}
@ -670,23 +670,30 @@ void QgsMarkerSymbolLayer::markerOffset( QgsSymbolRenderContext &context, double
anchorPointCorrectionY = std::min( std::max( context.renderContext().convertToPainterUnits( height, Qgis::RenderUnit::Millimeters ), 3.0 ), 100.0 ) / 2.0;
}
if ( horizontalAnchorPoint == Left )
switch ( horizontalAnchorPoint )
{
offsetX += anchorPointCorrectionX;
}
else if ( horizontalAnchorPoint == Right )
{
offsetX -= anchorPointCorrectionX;
case Qgis::HorizontalAnchorPoint::Left:
offsetX += anchorPointCorrectionX;
break;
case Qgis::HorizontalAnchorPoint::Right:
offsetX -= anchorPointCorrectionX;
break;
case Qgis::HorizontalAnchorPoint::Center:
break;
}
//correct vertical position according to anchor point
if ( verticalAnchorPoint == Top )
//correct vertical position according to anchor point
switch ( verticalAnchorPoint )
{
offsetY += anchorPointCorrectionY;
}
else if ( verticalAnchorPoint == Bottom or verticalAnchorPoint == Baseline )
{
offsetY -= anchorPointCorrectionY;
case Qgis::VerticalAnchorPoint::Top:
offsetY += anchorPointCorrectionY;
break;
case Qgis::VerticalAnchorPoint::Bottom:
case Qgis::VerticalAnchorPoint::Baseline:
offsetY -= anchorPointCorrectionY;
break;
case Qgis::VerticalAnchorPoint::Center:
break;
}
}
@ -697,35 +704,35 @@ QPointF QgsMarkerSymbolLayer::_rotatedOffset( QPointF offset, double angle )
return QPointF( offset.x() * c - offset.y() * s, offset.x() * s + offset.y() * c );
}
QgsMarkerSymbolLayer::HorizontalAnchorPoint QgsMarkerSymbolLayer::decodeHorizontalAnchorPoint( const QString &str )
Qgis::HorizontalAnchorPoint QgsMarkerSymbolLayer::decodeHorizontalAnchorPoint( const QString &str )
{
if ( str.compare( QLatin1String( "left" ), Qt::CaseInsensitive ) == 0 )
{
return QgsMarkerSymbolLayer::Left;
return Qgis::HorizontalAnchorPoint::Left;
}
else if ( str.compare( QLatin1String( "right" ), Qt::CaseInsensitive ) == 0 )
{
return QgsMarkerSymbolLayer::Right;
return Qgis::HorizontalAnchorPoint::Right;
}
else
{
return QgsMarkerSymbolLayer::HCenter;
return Qgis::HorizontalAnchorPoint::Center;
}
}
QgsMarkerSymbolLayer::VerticalAnchorPoint QgsMarkerSymbolLayer::decodeVerticalAnchorPoint( const QString &str )
Qgis::VerticalAnchorPoint QgsMarkerSymbolLayer::decodeVerticalAnchorPoint( const QString &str )
{
if ( str.compare( QLatin1String( "top" ), Qt::CaseInsensitive ) == 0 )
{
return QgsMarkerSymbolLayer::Top;
return Qgis::VerticalAnchorPoint::Top;
}
else if ( str.compare( QLatin1String( "bottom" ), Qt::CaseInsensitive ) == 0 )
{
return QgsMarkerSymbolLayer::Bottom;
return Qgis::VerticalAnchorPoint::Bottom;
}
else
{
return QgsMarkerSymbolLayer::VCenter;
return Qgis::VerticalAnchorPoint::Center;
}
}

View File

@ -765,23 +765,6 @@ class CORE_EXPORT QgsMarkerSymbolLayer : public QgsSymbolLayer
{
public:
//! Symbol horizontal anchor points
enum HorizontalAnchorPoint
{
Left, //!< Align to left side of symbol
HCenter, //!< Align to horizontal center of symbol
Right, //!< Align to right side of symbol
};
//! Symbol vertical anchor points
enum VerticalAnchorPoint
{
Top, //!< Align to top of symbol
VCenter, //!< Align to vertical center of symbol
Bottom, //!< Align to bottom of symbol
Baseline, //!< Align to baseline of symbol, e.g. font baseline for font marker symbol layers. Treated as Bottom if no baseline is available for the symbol layer type. \since QGIS 3.44
};
QgsMarkerSymbolLayer &operator=( const QgsMarkerSymbolLayer &other ) = delete;
void startRender( QgsSymbolRenderContext &context ) override;
@ -946,7 +929,7 @@ class CORE_EXPORT QgsMarkerSymbolLayer : public QgsSymbolLayer
* \see horizontalAnchorPoint()
* \see setVerticalAnchorPoint()
*/
void setHorizontalAnchorPoint( HorizontalAnchorPoint h ) { mHorizontalAnchorPoint = h; }
void setHorizontalAnchorPoint( Qgis::HorizontalAnchorPoint h ) { mHorizontalAnchorPoint = h; }
/**
* Returns the horizontal anchor point for positioning the symbol. The symbol will be drawn so that
@ -954,7 +937,7 @@ class CORE_EXPORT QgsMarkerSymbolLayer : public QgsSymbolLayer
* \see setHorizontalAnchorPoint()
* \see verticalAnchorPoint()
*/
HorizontalAnchorPoint horizontalAnchorPoint() const { return mHorizontalAnchorPoint; }
Qgis::HorizontalAnchorPoint horizontalAnchorPoint() const { return mHorizontalAnchorPoint; }
/**
* Sets the vertical anchor point for positioning the symbol.
@ -963,7 +946,7 @@ class CORE_EXPORT QgsMarkerSymbolLayer : public QgsSymbolLayer
* \see verticalAnchorPoint()
* \see setHorizontalAnchorPoint()
*/
void setVerticalAnchorPoint( VerticalAnchorPoint v ) { mVerticalAnchorPoint = v; }
void setVerticalAnchorPoint( Qgis::VerticalAnchorPoint v ) { mVerticalAnchorPoint = v; }
/**
* Returns the vertical anchor point for positioning the symbol. The symbol will be drawn so that
@ -971,7 +954,7 @@ class CORE_EXPORT QgsMarkerSymbolLayer : public QgsSymbolLayer
* \see setVerticalAnchorPoint()
* \see horizontalAnchorPoint()
*/
VerticalAnchorPoint verticalAnchorPoint() const { return mVerticalAnchorPoint; }
Qgis::VerticalAnchorPoint verticalAnchorPoint() const { return mVerticalAnchorPoint; }
void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
@ -1062,13 +1045,13 @@ class CORE_EXPORT QgsMarkerSymbolLayer : public QgsSymbolLayer
//! Marker size scaling method
Qgis::ScaleMethod mScaleMethod = Qgis::ScaleMethod::ScaleDiameter;
//! Horizontal anchor point
HorizontalAnchorPoint mHorizontalAnchorPoint = HCenter;
Qgis::HorizontalAnchorPoint mHorizontalAnchorPoint = Qgis::HorizontalAnchorPoint::Center;
//! Vertical anchor point
VerticalAnchorPoint mVerticalAnchorPoint = VCenter;
Qgis::VerticalAnchorPoint mVerticalAnchorPoint = Qgis::VerticalAnchorPoint::Center;
private:
static QgsMarkerSymbolLayer::HorizontalAnchorPoint decodeHorizontalAnchorPoint( const QString &str );
static QgsMarkerSymbolLayer::VerticalAnchorPoint decodeVerticalAnchorPoint( const QString &str );
static Qgis::HorizontalAnchorPoint decodeHorizontalAnchorPoint( const QString &str );
static Qgis::VerticalAnchorPoint decodeVerticalAnchorPoint( const QString &str );
#ifdef SIP_RUN
QgsMarkerSymbolLayer( const QgsMarkerSymbolLayer &other );

View File

@ -24,6 +24,15 @@ QgsEllipseSymbolLayerWidget::QgsEllipseSymbolLayerWidget( QgsVectorLayer *vl, QW
{
setupUi( this );
mHorizontalAnchorComboBox->addItem( tr( "Left" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Left ) );
mHorizontalAnchorComboBox->addItem( tr( "Horizontal Center" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Center ) );
mHorizontalAnchorComboBox->addItem( tr( "Right" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Right ) );
mVerticalAnchorComboBox->addItem( tr( "Top" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Top ) );
mVerticalAnchorComboBox->addItem( tr( "Vertical Center" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Center ) );
mVerticalAnchorComboBox->addItem( tr( "Bottom" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Bottom ) );
connect( mShapeListWidget, &QListWidget::itemSelectionChanged, this, &QgsEllipseSymbolLayerWidget::mShapeListWidget_itemSelectionChanged );
connect( mWidthSpinBox, static_cast<void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsEllipseSymbolLayerWidget::mWidthSpinBox_valueChanged );
connect( mHeightSpinBox, static_cast<void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsEllipseSymbolLayerWidget::mHeightSpinBox_valueChanged );
@ -134,8 +143,8 @@ void QgsEllipseSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
const QPointF offsetPt = mLayer->offset();
spinOffsetX->setValue( offsetPt.x() );
spinOffsetY->setValue( offsetPt.y() );
mHorizontalAnchorComboBox->setCurrentIndex( mLayer->horizontalAnchorPoint() );
mVerticalAnchorComboBox->setCurrentIndex( mLayer->verticalAnchorPoint() );
mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue( mLayer->horizontalAnchorPoint() ) ) );
mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue( mLayer->verticalAnchorPoint() ) ) );
cboJoinStyle->setPenJoinStyle( mLayer->penJoinStyle() );
cboCapStyle->setPenCapStyle( mLayer->penCapStyle() );
blockComboSignals( false );
@ -306,20 +315,20 @@ void QgsEllipseSymbolLayerWidget::blockComboSignals( bool block )
cboCapStyle->blockSignals( block );
}
void QgsEllipseSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
void QgsEllipseSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setHorizontalAnchorPoint( ( QgsMarkerSymbolLayer::HorizontalAnchorPoint ) index );
mLayer->setHorizontalAnchorPoint( mHorizontalAnchorComboBox->currentData().value< Qgis::HorizontalAnchorPoint >() );
emit changed();
}
}
void QgsEllipseSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
void QgsEllipseSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setVerticalAnchorPoint( ( QgsMarkerSymbolLayer::VerticalAnchorPoint ) index );
mLayer->setVerticalAnchorPoint( mVerticalAnchorComboBox->currentData().value< Qgis::VerticalAnchorPoint >() );
emit changed();
}
}

View File

@ -628,6 +628,15 @@ QgsSimpleMarkerSymbolLayerWidget::QgsSimpleMarkerSymbolLayerWidget( QgsVectorLay
mLayer = nullptr;
setupUi( this );
mHorizontalAnchorComboBox->addItem( tr( "Left" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Left ) );
mHorizontalAnchorComboBox->addItem( tr( "Horizontal Center" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Center ) );
mHorizontalAnchorComboBox->addItem( tr( "Right" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Right ) );
mVerticalAnchorComboBox->addItem( tr( "Top" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Top ) );
mVerticalAnchorComboBox->addItem( tr( "Vertical Center" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Center ) );
mVerticalAnchorComboBox->addItem( tr( "Bottom" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Bottom ) );
connect( mSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleMarkerSymbolLayerWidget::mSizeUnitWidget_changed );
connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleMarkerSymbolLayerWidget::mOffsetUnitWidget_changed );
connect( mStrokeWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed );
@ -769,8 +778,8 @@ void QgsSimpleMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
//anchor points
mHorizontalAnchorComboBox->blockSignals( true );
mVerticalAnchorComboBox->blockSignals( true );
mHorizontalAnchorComboBox->setCurrentIndex( mLayer->horizontalAnchorPoint() );
mVerticalAnchorComboBox->setCurrentIndex( mLayer->verticalAnchorPoint() );
mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue( mLayer->horizontalAnchorPoint() ) ) );
mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue( mLayer->verticalAnchorPoint() ) ) );
mHorizontalAnchorComboBox->blockSignals( false );
mVerticalAnchorComboBox->blockSignals( false );
@ -894,20 +903,20 @@ void QgsSimpleMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed()
}
}
void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
void QgsSimpleMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setHorizontalAnchorPoint( ( QgsMarkerSymbolLayer::HorizontalAnchorPoint ) index );
mLayer->setHorizontalAnchorPoint( mHorizontalAnchorComboBox->currentData().value< Qgis::HorizontalAnchorPoint >() );
emit changed();
}
}
void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
void QgsSimpleMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setVerticalAnchorPoint( ( QgsMarkerSymbolLayer::VerticalAnchorPoint ) index );
mLayer->setVerticalAnchorPoint( mVerticalAnchorComboBox->currentData().value< Qgis::VerticalAnchorPoint >() );
emit changed();
}
}
@ -1087,6 +1096,15 @@ QgsFilledMarkerSymbolLayerWidget::QgsFilledMarkerSymbolLayerWidget( QgsVectorLay
mLayer = nullptr;
setupUi( this );
mHorizontalAnchorComboBox->addItem( tr( "Left" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Left ) );
mHorizontalAnchorComboBox->addItem( tr( "Horizontal Center" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Center ) );
mHorizontalAnchorComboBox->addItem( tr( "Right" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Right ) );
mVerticalAnchorComboBox->addItem( tr( "Top" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Top ) );
mVerticalAnchorComboBox->addItem( tr( "Vertical Center" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Center ) );
mVerticalAnchorComboBox->addItem( tr( "Bottom" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Bottom ) );
connect( mSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFilledMarkerSymbolLayerWidget::mSizeUnitWidget_changed );
connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed );
connect( mHorizontalAnchorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged );
@ -1169,8 +1187,8 @@ void QgsFilledMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
mOffsetUnitWidget->blockSignals( false );
//anchor points
whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mLayer->horizontalAnchorPoint() );
whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mLayer->verticalAnchorPoint() );
whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue( mLayer->horizontalAnchorPoint() ) ) );
whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue( mLayer->verticalAnchorPoint() ) ) );
registerDataDefinedButton( mNameDDBtn, QgsSymbolLayer::Property::Name );
registerDataDefinedButton( mSizeDDBtn, QgsSymbolLayer::Property::Size );
@ -1231,20 +1249,20 @@ void QgsFilledMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
}
}
void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
void QgsFilledMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setHorizontalAnchorPoint( ( QgsMarkerSymbolLayer::HorizontalAnchorPoint ) index );
mLayer->setHorizontalAnchorPoint( mHorizontalAnchorComboBox->currentData().value<Qgis::HorizontalAnchorPoint>() );
emit changed();
}
}
void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
void QgsFilledMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setVerticalAnchorPoint( ( QgsMarkerSymbolLayer::VerticalAnchorPoint ) index );
mLayer->setVerticalAnchorPoint( mVerticalAnchorComboBox->currentData().value< Qgis::VerticalAnchorPoint >() );
emit changed();
}
}
@ -2390,6 +2408,14 @@ QgsSvgMarkerSymbolLayerWidget::QgsSvgMarkerSymbolLayerWidget( QgsVectorLayer *vl
setupUi( this );
mHorizontalAnchorComboBox->addItem( tr( "Left" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Left ) );
mHorizontalAnchorComboBox->addItem( tr( "Horizontal Center" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Center ) );
mHorizontalAnchorComboBox->addItem( tr( "Right" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Right ) );
mVerticalAnchorComboBox->addItem( tr( "Top" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Top ) );
mVerticalAnchorComboBox->addItem( tr( "Vertical Center" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Center ) );
mVerticalAnchorComboBox->addItem( tr( "Bottom" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Bottom ) );
mSvgSelectorWidget->setAllowParameters( true );
mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible( true );
mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral( "/UI/lastSVGMarkerDir" ) );
@ -2574,8 +2600,8 @@ void QgsSvgMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
//anchor points
mHorizontalAnchorComboBox->blockSignals( true );
mVerticalAnchorComboBox->blockSignals( true );
mHorizontalAnchorComboBox->setCurrentIndex( mLayer->horizontalAnchorPoint() );
mVerticalAnchorComboBox->setCurrentIndex( mLayer->verticalAnchorPoint() );
mHorizontalAnchorComboBox->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue( mLayer->horizontalAnchorPoint() ) ) );
mVerticalAnchorComboBox->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue( mLayer->verticalAnchorPoint() ) ) );
mHorizontalAnchorComboBox->blockSignals( false );
mVerticalAnchorComboBox->blockSignals( false );
@ -2771,20 +2797,20 @@ void QgsSvgMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
}
}
void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
void QgsSvgMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( index ) );
mLayer->setHorizontalAnchorPoint( mHorizontalAnchorComboBox->currentData().value< Qgis::HorizontalAnchorPoint >() );
emit changed();
}
}
void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
void QgsSvgMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( index ) );
mLayer->setVerticalAnchorPoint( mVerticalAnchorComboBox->currentData().value< Qgis::VerticalAnchorPoint >() );
emit changed();
}
}
@ -3451,6 +3477,16 @@ QgsFontMarkerSymbolLayerWidget::QgsFontMarkerSymbolLayerWidget( QgsVectorLayer *
mLayer = nullptr;
setupUi( this );
mHorizontalAnchorComboBox->addItem( tr( "Left" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Left ) );
mHorizontalAnchorComboBox->addItem( tr( "Horizontal Center" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Center ) );
mHorizontalAnchorComboBox->addItem( tr( "Right" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Right ) );
mVerticalAnchorComboBox->addItem( tr( "Top" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Top ) );
mVerticalAnchorComboBox->addItem( tr( "Vertical Center" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Center ) );
mVerticalAnchorComboBox->addItem( tr( "Bottom on Baseline" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Baseline ) );
mVerticalAnchorComboBox->addItem( tr( "Bottom" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Bottom ) );
connect( mSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFontMarkerSymbolLayerWidget::mSizeUnitWidget_changed );
connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFontMarkerSymbolLayerWidget::mOffsetUnitWidget_changed );
connect( mStrokeWidthUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsFontMarkerSymbolLayerWidget::mStrokeWidthUnitWidget_changed );
@ -3558,8 +3594,8 @@ void QgsFontMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
whileBlocking( cboJoinStyle )->setPenJoinStyle( mLayer->penJoinStyle() );
//anchor points
whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mLayer->horizontalAnchorPoint() );
whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mLayer->verticalAnchorPoint() );
whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue( mLayer->horizontalAnchorPoint() ) ) );
whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue( mLayer->verticalAnchorPoint() ) ) );
registerDataDefinedButton( mFontFamilyDDBtn, QgsSymbolLayer::Property::FontFamily );
registerDataDefinedButton( mFontStyleDDBtn, QgsSymbolLayer::Property::FontStyle );
@ -3756,20 +3792,20 @@ void QgsFontMarkerSymbolLayerWidget::mFontStyleComboBox_currentIndexChanged( int
setFontStyle( mFontStyleComboBox->currentText() );
}
void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
void QgsFontMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( index ) );
mLayer->setHorizontalAnchorPoint( mHorizontalAnchorComboBox->currentData().value< Qgis::HorizontalAnchorPoint >() );
emit changed();
}
}
void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
void QgsFontMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( index ) );
mLayer->setVerticalAnchorPoint( mVerticalAnchorComboBox->currentData().value< Qgis::VerticalAnchorPoint >() );
emit changed();
}
}
@ -3863,6 +3899,14 @@ QgsRasterMarkerSymbolLayerWidget::QgsRasterMarkerSymbolLayerWidget( QgsVectorLay
setupUi( this );
mHorizontalAnchorComboBox->addItem( tr( "Left" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Left ) );
mHorizontalAnchorComboBox->addItem( tr( "Horizontal Center" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Center ) );
mHorizontalAnchorComboBox->addItem( tr( "Right" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Right ) );
mVerticalAnchorComboBox->addItem( tr( "Top" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Top ) );
mVerticalAnchorComboBox->addItem( tr( "Vertical Center" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Center ) );
mVerticalAnchorComboBox->addItem( tr( "Bottom" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Bottom ) );
mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral( "/UI/lastRasterMarkerImageDir" ) );
connect( mImageSourceLineEdit, &QgsImageSourceLineEdit::sourceChanged, this, &QgsRasterMarkerSymbolLayerWidget::imageSourceChanged );
@ -3935,8 +3979,8 @@ void QgsRasterMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
mOffsetUnitWidget->blockSignals( false );
//anchor points
whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mLayer->horizontalAnchorPoint() );
whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mLayer->verticalAnchorPoint() );
whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue( mLayer->horizontalAnchorPoint() ) ) );
whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue( mLayer->verticalAnchorPoint() ) ) );
registerDataDefinedButton( mWidthDDBtn, QgsSymbolLayer::Property::Width );
registerDataDefinedButton( mHeightDDBtn, QgsSymbolLayer::Property::Height );
@ -4104,20 +4148,20 @@ void QgsRasterMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
}
}
void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
void QgsRasterMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( index ) );
mLayer->setHorizontalAnchorPoint( mHorizontalAnchorComboBox->currentData().value< Qgis::HorizontalAnchorPoint >() );
emit changed();
}
}
void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
void QgsRasterMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( index ) );
mLayer->setVerticalAnchorPoint( mVerticalAnchorComboBox->currentData().value< Qgis::VerticalAnchorPoint >() );
emit changed();
}
}
@ -4132,6 +4176,14 @@ QgsAnimatedMarkerSymbolLayerWidget::QgsAnimatedMarkerSymbolLayerWidget( QgsVecto
setupUi( this );
mHorizontalAnchorComboBox->addItem( tr( "Left" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Left ) );
mHorizontalAnchorComboBox->addItem( tr( "Horizontal Center" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Center ) );
mHorizontalAnchorComboBox->addItem( tr( "Right" ), QVariant::fromValue( Qgis::HorizontalAnchorPoint::Right ) );
mVerticalAnchorComboBox->addItem( tr( "Top" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Top ) );
mVerticalAnchorComboBox->addItem( tr( "Vertical Center" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Center ) );
mVerticalAnchorComboBox->addItem( tr( "Bottom" ), QVariant::fromValue( Qgis::VerticalAnchorPoint::Bottom ) );
mImageSourceLineEdit->setLastPathSettingsKey( QStringLiteral( "/UI/lastAnimatedMarkerImageDir" ) );
connect( mImageSourceLineEdit, &QgsImageSourceLineEdit::sourceChanged, this, &QgsAnimatedMarkerSymbolLayerWidget::imageSourceChanged );
@ -4223,8 +4275,8 @@ void QgsAnimatedMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
mOffsetUnitWidget->blockSignals( false );
//anchor points
whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mLayer->horizontalAnchorPoint() );
whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mLayer->verticalAnchorPoint() );
whileBlocking( mHorizontalAnchorComboBox )->setCurrentIndex( mHorizontalAnchorComboBox->findData( QVariant::fromValue( mLayer->horizontalAnchorPoint() ) ) );
whileBlocking( mVerticalAnchorComboBox )->setCurrentIndex( mVerticalAnchorComboBox->findData( QVariant::fromValue( mLayer->verticalAnchorPoint() ) ) );
registerDataDefinedButton( mWidthDDBtn, QgsSymbolLayer::Property::Width );
registerDataDefinedButton( mHeightDDBtn, QgsSymbolLayer::Property::Height );
@ -4384,20 +4436,20 @@ void QgsAnimatedMarkerSymbolLayerWidget::mOffsetUnitWidget_changed()
}
}
void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int index )
void QgsAnimatedMarkerSymbolLayerWidget::mHorizontalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HorizontalAnchorPoint( index ) );
mLayer->setHorizontalAnchorPoint( mHorizontalAnchorComboBox->currentData().value< Qgis::HorizontalAnchorPoint >() );
emit changed();
}
}
void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int index )
void QgsAnimatedMarkerSymbolLayerWidget::mVerticalAnchorComboBox_currentIndexChanged( int )
{
if ( mLayer )
{
mLayer->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VerticalAnchorPoint( index ) );
mLayer->setVerticalAnchorPoint( mVerticalAnchorComboBox->currentData().value< Qgis::VerticalAnchorPoint >() );
emit changed();
}
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>372</width>
<height>505</height>
<height>528</height>
</rect>
</property>
<property name="windowTitle">
@ -295,23 +295,7 @@
</layout>
</item>
<item row="10" column="1">
<widget class="QComboBox" name="mHorizontalAnchorComboBox">
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>HCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mHorizontalAnchorComboBox"/>
</item>
<item row="9" column="2">
<widget class="QgsPropertyOverrideButton" name="mVerticalAnchorDDBtn">
@ -380,23 +364,7 @@
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="mVerticalAnchorComboBox">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>VCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mVerticalAnchorComboBox"/>
</item>
<item row="5" column="2">
<widget class="QgsPropertyOverrideButton" name="mRotationDDBtn">
@ -477,27 +445,27 @@
</widget>
<customwidgets>
<customwidget>
<class>QgsRatioLockButton</class>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgsratiolockbutton.h</header>
<container>1</container>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
<customwidget>
<class>QgsUnitSelectionWidget</class>
<extends>QWidget</extends>
<header>qgsunitselectionwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsRatioLockButton</class>
<extends>QToolButton</extends>
<header>qgsratiolockbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsOpacityWidget</class>
<extends>QWidget</extends>

View File

@ -84,23 +84,7 @@
</widget>
</item>
<item row="13" column="1">
<widget class="QComboBox" name="mHorizontalAnchorComboBox">
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>HCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mHorizontalAnchorComboBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mSymbolHeightLabel">
@ -201,23 +185,7 @@
<widget class="QgsPenJoinStyleComboBox" name="cboJoinStyle"/>
</item>
<item row="12" column="1">
<widget class="QComboBox" name="mVerticalAnchorComboBox">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>VCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mVerticalAnchorComboBox"/>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_9">

View File

@ -115,7 +115,7 @@
</item>
<item row="2" column="2">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="margin" stdset="0">
<number>0</number>
</property>
<item row="1" column="0">
@ -203,23 +203,7 @@
</widget>
</item>
<item row="6" column="2">
<widget class="QComboBox" name="mHorizontalAnchorComboBox">
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>HCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mHorizontalAnchorComboBox"/>
</item>
<item row="6" column="3">
<widget class="QgsPropertyOverrideButton" name="mHorizontalAnchorDDBtn">
@ -229,23 +213,7 @@
</widget>
</item>
<item row="5" column="2">
<widget class="QComboBox" name="mVerticalAnchorComboBox">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>VCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mVerticalAnchorComboBox"/>
</item>
<item row="5" column="3">
<widget class="QgsPropertyOverrideButton" name="mVerticalAnchorDDBtn">
@ -307,16 +275,16 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsUnitSelectionWidget</class>
<extends>QWidget</extends>

View File

@ -265,23 +265,7 @@
</widget>
</item>
<item row="12" column="2">
<widget class="QComboBox" name="mHorizontalAnchorComboBox">
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>HCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mHorizontalAnchorComboBox"/>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_4">
@ -291,28 +275,7 @@
</widget>
</item>
<item row="11" column="2">
<widget class="QComboBox" name="mVerticalAnchorComboBox">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>VCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom on Baseline</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mVerticalAnchorComboBox"/>
</item>
<item row="3" column="4">
<widget class="QgsPropertyOverrideButton" name="mColorDDBtn">
@ -468,7 +431,7 @@
<property name="value">
<double>0.200000000000000</double>
</property>
<property name="showClearButton">
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
@ -513,7 +476,7 @@
<property name="value">
<double>12.000000000000000</double>
</property>
<property name="showClearButton">
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
@ -560,21 +523,15 @@
<header>qgscolorbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
<customwidget>
<class>QgsScrollArea</class>
<extends>QScrollArea</extends>
<header>qgsscrollarea.h</header>
<container>1</container>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsUnitSelectionWidget</class>
@ -587,6 +544,12 @@
<extends>QComboBox</extends>
<header>qgspenstylecombobox.h</header>
</customwidget>
<customwidget>
<class>QgsScrollArea</class>
<extends>QScrollArea</extends>
<header>qgsscrollarea.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>cboFont</tabstop>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>372</width>
<height>485</height>
<height>495</height>
</rect>
</property>
<property name="windowTitle">
@ -295,23 +295,7 @@
</layout>
</item>
<item row="10" column="1">
<widget class="QComboBox" name="mHorizontalAnchorComboBox">
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>HCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mHorizontalAnchorComboBox"/>
</item>
<item row="9" column="2">
<widget class="QgsPropertyOverrideButton" name="mVerticalAnchorDDBtn">
@ -380,23 +364,7 @@
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="mVerticalAnchorComboBox">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>VCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mVerticalAnchorComboBox"/>
</item>
<item row="5" column="2">
<widget class="QgsPropertyOverrideButton" name="mRotationDDBtn">
@ -451,27 +419,27 @@
</widget>
<customwidgets>
<customwidget>
<class>QgsRatioLockButton</class>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgsratiolockbutton.h</header>
<container>1</container>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
<customwidget>
<class>QgsUnitSelectionWidget</class>
<extends>QWidget</extends>
<header>qgsunitselectionwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsRatioLockButton</class>
<extends>QToolButton</extends>
<header>qgsratiolockbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsOpacityWidget</class>
<extends>QWidget</extends>

View File

@ -357,23 +357,7 @@
</widget>
</item>
<item row="15" column="2">
<widget class="QComboBox" name="mVerticalAnchorComboBox">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>VCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mVerticalAnchorComboBox"/>
</item>
<item row="13" column="4">
<widget class="QgsPropertyOverrideButton" name="mOffsetDDBtn">
@ -386,23 +370,7 @@
<widget class="QgsPenStyleComboBox" name="mStrokeStyleComboBox"/>
</item>
<item row="16" column="2">
<widget class="QComboBox" name="mHorizontalAnchorComboBox">
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>HCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mHorizontalAnchorComboBox"/>
</item>
<item row="3" column="2">
<widget class="QgsColorButton" name="btnChangeColorStroke">
@ -527,39 +495,39 @@
</widget>
<customwidgets>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<header>qgscolorbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsUnitSelectionWidget</class>
<extends>QWidget</extends>
<header>qgsunitselectionwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<header>qgscolorbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsPenJoinStyleComboBox</class>
<extends>QComboBox</extends>
<header>qgspenstylecombobox.h</header>
</customwidget>
<customwidget>
<class>QgsPenStyleComboBox</class>
<class>QgsPenCapStyleComboBox</class>
<extends>QComboBox</extends>
<header>qgspenstylecombobox.h</header>
</customwidget>
<customwidget>
<class>QgsPenCapStyleComboBox</class>
<class>QgsPenStyleComboBox</class>
<extends>QComboBox</extends>
<header>qgspenstylecombobox.h</header>
</customwidget>

View File

@ -231,23 +231,7 @@
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="mHorizontalAnchorComboBox">
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>HCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mHorizontalAnchorComboBox"/>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
@ -457,23 +441,7 @@
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="mVerticalAnchorComboBox">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>VCenter</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mVerticalAnchorComboBox"/>
</item>
<item row="7" column="0" rowspan="2">
<widget class="QLabel" name="mAnchorPointLabel">
@ -486,26 +454,20 @@
</widget>
<customwidgets>
<customwidget>
<class>QgsRatioLockButton</class>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<header>qgsratiolockbutton.h</header>
<header>qgscolorbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<header>qgscolorbutton.h</header>
<container>1</container>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsUnitSelectionWidget</class>
@ -513,6 +475,12 @@
<header>qgsunitselectionwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsRatioLockButton</class>
<extends>QToolButton</extends>
<header>qgsratiolockbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsSvgSelectorWidget</class>
<extends>QWidget</extends>

View File

@ -307,8 +307,8 @@ void TestQgsArcGisRestUtils::testParseMarkerSymbol()
QCOMPARE( fontMarkerLayer->fontFamily(), QString( "Arial" ) );
QCOMPARE( fontMarkerLayer->offset(), QPointF( 0, 0 ) );
QCOMPARE( fontMarkerLayer->angle(), 45 );
QCOMPARE( fontMarkerLayer->horizontalAnchorPoint(), QgsMarkerSymbolLayer::HorizontalAnchorPoint::Left );
QCOMPARE( fontMarkerLayer->verticalAnchorPoint(), QgsMarkerSymbolLayer::VerticalAnchorPoint::Bottom );
QCOMPARE( fontMarkerLayer->horizontalAnchorPoint(), Qgis::HorizontalAnchorPoint::Left );
QCOMPARE( fontMarkerLayer->verticalAnchorPoint(), Qgis::VerticalAnchorPoint::Bottom );
QColor mainColor = fontMarkerLayer->color();
QCOMPARE( mainColor.name(), QStringLiteral( "#4e4e4e" ) );
QColor strokeColor = fontMarkerLayer->strokeColor();

View File

@ -266,9 +266,9 @@ void TestQgsFontMarkerSymbol::fontMarkerSymbolVerticalAnchor()
mMapSettings.setExtent( mpPointsLayer->extent() );
mMapSettings.setOutputDpi( 96 );
QGSVERIFYRENDERMAPSETTINGSCHECK( "fontmarker", "fontmarker", mMapSettings, 30 );
mFontMarkerLayer->setVerticalAnchorPoint( QgsMarkerSymbolLayer::Bottom );
mFontMarkerLayer->setVerticalAnchorPoint( Qgis::VerticalAnchorPoint::Bottom );
QGSVERIFYRENDERMAPSETTINGSCHECK( "fontmarker_vertical_anchor_bottom", "fontmarker_vertical_anchor_bottom", mMapSettings, 30 );
mFontMarkerLayer->setVerticalAnchorPoint( QgsMarkerSymbolLayer::Baseline );
mFontMarkerLayer->setVerticalAnchorPoint( Qgis::VerticalAnchorPoint::Baseline );
QGSVERIFYRENDERMAPSETTINGSCHECK( "fontmarker_vertical_anchor_baseline", "fontmarker_vertical_anchor_baseline", mMapSettings, 30 );
}

View File

@ -140,12 +140,12 @@ void TestQgsRasterMarker::rasterMarkerSymbol()
void TestQgsRasterMarker::anchor()
{
mRasterMarker->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::Right );
mRasterMarker->setVerticalAnchorPoint( QgsMarkerSymbolLayer::Bottom );
mRasterMarker->setHorizontalAnchorPoint( Qgis::HorizontalAnchorPoint::Right );
mRasterMarker->setVerticalAnchorPoint( Qgis::VerticalAnchorPoint::Bottom );
const bool result = imageCheck( QStringLiteral( "rastermarker_anchor" ) );
QVERIFY( result );
mRasterMarker->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HCenter );
mRasterMarker->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VCenter );
mRasterMarker->setHorizontalAnchorPoint( Qgis::HorizontalAnchorPoint::Center );
mRasterMarker->setVerticalAnchorPoint( Qgis::VerticalAnchorPoint::Center );
}
void TestQgsRasterMarker::alpha()
@ -205,11 +205,11 @@ void TestQgsRasterMarker::percentageAnchor()
{
mRasterMarker->setSizeUnit( Qgis::RenderUnit::Percentage );
mRasterMarker->setSize( 6.3 );
mRasterMarker->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::Right );
mRasterMarker->setVerticalAnchorPoint( QgsMarkerSymbolLayer::Bottom );
mRasterMarker->setHorizontalAnchorPoint( Qgis::HorizontalAnchorPoint::Right );
mRasterMarker->setVerticalAnchorPoint( Qgis::VerticalAnchorPoint::Bottom );
const bool result = imageCheck( QStringLiteral( "rastermarker_anchor_percentage" ) );
mRasterMarker->setHorizontalAnchorPoint( QgsMarkerSymbolLayer::HCenter );
mRasterMarker->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VCenter );
mRasterMarker->setHorizontalAnchorPoint( Qgis::HorizontalAnchorPoint::Center );
mRasterMarker->setVerticalAnchorPoint( Qgis::VerticalAnchorPoint::Center );
QVERIFY( result );
}

View File

@ -194,10 +194,10 @@ void TestQgsSvgMarkerSymbol::anchor()
mSvgMarkerLayer->setSize( 5 );
mSvgMarkerLayer->setFixedAspectRatio( 6 );
mSvgMarkerLayer->setStrokeWidth( 0.0 );
mSvgMarkerLayer->setVerticalAnchorPoint( QgsMarkerSymbolLayer::Bottom );
mSvgMarkerLayer->setVerticalAnchorPoint( Qgis::VerticalAnchorPoint::Bottom );
QGSVERIFYRENDERMAPSETTINGSCHECK( "svgmarker_anchor", "svgmarker_anchor", mMapSettings );
mSvgMarkerLayer->setFixedAspectRatio( 0.0 );
mSvgMarkerLayer->setVerticalAnchorPoint( QgsMarkerSymbolLayer::VCenter );
mSvgMarkerLayer->setVerticalAnchorPoint( Qgis::VerticalAnchorPoint::Center );
}
void TestQgsSvgMarkerSymbol::aspectRatio()