Skip to content
Permalink
Browse files

[Feature]: anchor points for marker symbols

  • Loading branch information
mhugent committed Sep 10, 2013
1 parent 4cad8ba commit bc95d0bc64b2e611f60d2aa8402e64c01c0c9ef6
Showing with 26 additions and 0 deletions.
  1. +8 −0 src/core/symbology-ng/qgssymbollayerv2.cpp
  2. +18 −0 src/core/symbology-ng/qgssymbollayerv2.h
@@ -190,6 +190,14 @@ void QgsMarkerSymbolLayerV2::markerOffset( QgsSymbolV2RenderContext& context, do

offsetX *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit );
offsetY *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit );

//consider anchor point corrections
if( mHorizontalAnchorPoint == HCenter && mVerticalAnchorPoint == VCenter )
{
return;
}


}

QPointF QgsMarkerSymbolLayerV2::_rotatedOffset( const QPointF& offset, double angle )
@@ -121,6 +121,21 @@ class CORE_EXPORT QgsSymbolLayerV2
class CORE_EXPORT QgsMarkerSymbolLayerV2 : public QgsSymbolLayerV2
{
public:

enum HorizontalAnchorPoint
{
Left,
HCenter,
Right
};

enum VerticalAnchorPoint
{
Top,
VCenter,
Bottom
};

virtual void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context ) = 0;

void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );
@@ -153,6 +168,7 @@ class CORE_EXPORT QgsMarkerSymbolLayerV2 : public QgsSymbolLayerV2

protected:
QgsMarkerSymbolLayerV2( bool locked = false );
//handles marker offset and anchor point shift together
void markerOffset( QgsSymbolV2RenderContext& context, double& offsetX, double& offsetY );
static QPointF _rotatedOffset( const QPointF& offset, double angle );

@@ -162,6 +178,8 @@ class CORE_EXPORT QgsMarkerSymbolLayerV2 : public QgsSymbolLayerV2
QPointF mOffset;
QgsSymbolV2::OutputUnit mOffsetUnit;
QgsSymbolV2::ScaleMethod mScaleMethod;
HorizontalAnchorPoint mHorizontalAnchorPoint;
VerticalAnchorPoint mVerticalAnchorPoint;
};

class CORE_EXPORT QgsLineSymbolLayerV2 : public QgsSymbolLayerV2

0 comments on commit bc95d0b

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