@@ -21,18 +21,18 @@ QgsArrowSymbolLayer::QgsArrowSymbolLayer()
2121 , mArrowWidthUnit( QgsSymbolV2::MM )
2222 , mArrowStartWidth( 1.0 )
2323 , mArrowStartWidthUnit( QgsSymbolV2::MM )
24- , mHeadWidth ( 1.5 )
25- , mHeadWidthUnit ( QgsSymbolV2::MM )
26- , mHeadHeight ( 1.5 )
27- , mHeadHeightUnit ( QgsSymbolV2::MM )
24+ , mHeadLength ( 1.5 )
25+ , mHeadLengthUnit ( QgsSymbolV2::MM )
26+ , mHeadThickness ( 1.5 )
27+ , mHeadThicknessUnit ( QgsSymbolV2::MM )
2828 , mHeadType( HeadSingle )
2929 , mArrowType( ArrowPlain )
3030 , mIsCurved( true )
3131 , mIsRepeated( true )
3232 , mScaledArrowWidth( 1.0 )
3333 , mScaledArrowStartWidth( 1.0 )
34- , mScaledHeadWidth ( 1.5 )
35- , mScaledHeadHeight ( 1.5 )
34+ , mScaledHeadLength ( 1.5 )
35+ , mScaledHeadThickness ( 1.5 )
3636 , mScaledOffset( 0.0 )
3737 , mComputedHeadType( HeadSingle )
3838 , mComputedArrowType( ArrowPlain )
@@ -83,23 +83,23 @@ QgsSymbolLayerV2* QgsArrowSymbolLayer::create( const QgsStringMap& props )
8383 if ( props.contains ( " is_repeated" ) )
8484 l->setIsRepeated ( props[" is_repeated" ].toInt () == 1 );
8585
86- if ( props.contains ( " head_width " ) )
87- l->setHeadWidth ( props[" head_width " ].toDouble () );
86+ if ( props.contains ( " head_length " ) )
87+ l->setHeadLength ( props[" head_length " ].toDouble () );
8888
89- if ( props.contains ( " head_width_unit " ) )
90- l->setHeadWidthUnit ( QgsSymbolLayerV2Utils::decodeOutputUnit ( props[" head_width_unit " ] ) );
89+ if ( props.contains ( " head_length_unit " ) )
90+ l->setHeadLengthUnit ( QgsSymbolLayerV2Utils::decodeOutputUnit ( props[" head_length_unit " ] ) );
9191
92- if ( props.contains ( " head_width_unit_scale " ) )
93- l->setHeadWidthUnitScale ( QgsSymbolLayerV2Utils::decodeMapUnitScale ( props[" head_width_unit_scale " ] ) );
92+ if ( props.contains ( " head_length_unit_scale " ) )
93+ l->setHeadLengthUnitScale ( QgsSymbolLayerV2Utils::decodeMapUnitScale ( props[" head_length_unit_scale " ] ) );
9494
95- if ( props.contains ( " head_height " ) )
96- l->setHeadHeight ( props[" head_height " ].toDouble () );
95+ if ( props.contains ( " head_thickness " ) )
96+ l->setHeadThickness ( props[" head_thickness " ].toDouble () );
9797
98- if ( props.contains ( " head_height_unit " ) )
99- l->setHeadHeightUnit ( QgsSymbolLayerV2Utils::decodeOutputUnit ( props[" head_height_unit " ] ) );
98+ if ( props.contains ( " head_thickness_unit " ) )
99+ l->setHeadThicknessUnit ( QgsSymbolLayerV2Utils::decodeOutputUnit ( props[" head_thickness_unit " ] ) );
100100
101- if ( props.contains ( " head_height_unit_scale " ) )
102- l->setHeadHeightUnitScale ( QgsSymbolLayerV2Utils::decodeMapUnitScale ( props[" head_height_unit_scale " ] ) );
101+ if ( props.contains ( " head_thickness_unit_scale " ) )
102+ l->setHeadThicknessUnitScale ( QgsSymbolLayerV2Utils::decodeMapUnitScale ( props[" head_thickness_unit_scale " ] ) );
103103
104104 if ( props.contains ( " head_type" ) )
105105 l->setHeadType ( static_cast <HeadType>( props[" head_type" ].toInt () ) );
@@ -152,13 +152,13 @@ QgsStringMap QgsArrowSymbolLayer::properties() const
152152 map[" is_curved" ] = QString::number ( isCurved () ? 1 : 0 );
153153 map[" is_repeated" ] = QString::number ( isRepeated () ? 1 : 0 );
154154
155- map[" head_width " ] = QString::number ( headWidth () );
156- map[" head_width_unit " ] = QgsSymbolLayerV2Utils::encodeOutputUnit ( headWidthUnit () );
157- map[" head_width_unit_scale " ] = QgsSymbolLayerV2Utils::encodeMapUnitScale ( headWidthUnitScale () );
155+ map[" head_length " ] = QString::number ( headLength () );
156+ map[" head_length_unit " ] = QgsSymbolLayerV2Utils::encodeOutputUnit ( headLengthUnit () );
157+ map[" head_length_unit_scale " ] = QgsSymbolLayerV2Utils::encodeMapUnitScale ( headLengthUnitScale () );
158158
159- map[" head_height " ] = QString::number ( headHeight () );
160- map[" head_height_unit " ] = QgsSymbolLayerV2Utils::encodeOutputUnit ( headHeightUnit () );
161- map[" head_height_unit_scale " ] = QgsSymbolLayerV2Utils::encodeMapUnitScale ( headHeightUnitScale () );
159+ map[" head_thickness " ] = QString::number ( headThickness () );
160+ map[" head_thickness_unit " ] = QgsSymbolLayerV2Utils::encodeOutputUnit ( headThicknessUnit () );
161+ map[" head_thickness_unit_scale " ] = QgsSymbolLayerV2Utils::encodeMapUnitScale ( headThicknessUnitScale () );
162162
163163 map[" head_type" ] = QString::number ( headType () );
164164 map[" arrow_type" ] = QString::number ( arrowType () );
@@ -186,8 +186,8 @@ void QgsArrowSymbolLayer::startRender( QgsSymbolV2RenderContext& context )
186186 mExpressionScope .reset ( new QgsExpressionContextScope () );
187187 mScaledArrowWidth = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), arrowWidth (), arrowWidthUnit (), arrowWidthUnitScale () );
188188 mScaledArrowStartWidth = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), arrowStartWidth (), arrowStartWidthUnit (), arrowStartWidthUnitScale () );
189- mScaledHeadWidth = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), headWidth (), headWidthUnit (), headWidthUnitScale () );
190- mScaledHeadHeight = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), headHeight (), headHeightUnit (), headHeightUnitScale () );
189+ mScaledHeadLength = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), headLength (), headLengthUnit (), headLengthUnitScale () );
190+ mScaledHeadThickness = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), headThickness (), headThicknessUnit (), headThicknessUnitScale () );
191191 mScaledOffset = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), offset (), offsetUnit (), offsetMapUnitScale () );
192192 mComputedHeadType = headType ();
193193 mComputedArrowType = arrowType ();
@@ -632,22 +632,22 @@ void QgsArrowSymbolLayer::_resolveDataDefined( QgsSymbolV2RenderContext& context
632632 mScaledArrowStartWidth = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, arrowStartWidthUnit (), arrowStartWidthUnitScale () );
633633 }
634634 }
635- if ( hasDataDefinedProperty ( " head_width " ) )
635+ if ( hasDataDefinedProperty ( " head_length " ) )
636636 {
637- context.setOriginalValueVariable ( headWidth () );
638- double w = evaluateDataDefinedProperty ( " head_width " , context, QVariant (), &ok ).toDouble ();
637+ context.setOriginalValueVariable ( headLength () );
638+ double w = evaluateDataDefinedProperty ( " head_length " , context, QVariant (), &ok ).toDouble ();
639639 if ( ok )
640640 {
641- mScaledHeadWidth = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, headWidthUnit (), headWidthUnitScale () );
641+ mScaledHeadLength = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, headLengthUnit (), headLengthUnitScale () );
642642 }
643643 }
644- if ( hasDataDefinedProperty ( " head_height " ) )
644+ if ( hasDataDefinedProperty ( " head_thickness " ) )
645645 {
646- context.setOriginalValueVariable ( headHeight () );
647- double w = evaluateDataDefinedProperty ( " head_height " , context, QVariant (), &ok ).toDouble ();
646+ context.setOriginalValueVariable ( headThickness () );
647+ double w = evaluateDataDefinedProperty ( " head_thickness " , context, QVariant (), &ok ).toDouble ();
648648 if ( ok )
649649 {
650- mScaledHeadHeight = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, headHeightUnit (), headHeightUnitScale () );
650+ mScaledHeadThickness = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, headThicknessUnit (), headThicknessUnitScale () );
651651 }
652652 }
653653 if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OFFSET ) )
@@ -708,7 +708,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
708708 // destination point
709709 QPointF pd ( points.back () );
710710
711- QPolygonF poly = curvedArrow ( po, pm, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadWidth , mScaledHeadHeight , mComputedHeadType , mComputedArrowType , mScaledOffset );
711+ QPolygonF poly = curvedArrow ( po, pm, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadLength , mScaledHeadThickness , mComputedHeadType , mComputedArrowType , mScaledOffset );
712712 mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
713713 }
714714 // straight arrow
@@ -719,7 +719,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
719719 // destination point
720720 QPointF pd ( points.at ( 1 ) );
721721
722- QPolygonF poly = straightArrow ( po, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadWidth , mScaledHeadHeight , mComputedHeadType , mComputedArrowType , mScaledOffset );
722+ QPolygonF poly = straightArrow ( po, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadLength , mScaledHeadThickness , mComputedHeadType , mComputedArrowType , mScaledOffset );
723723 mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
724724 }
725725 }
@@ -739,7 +739,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
739739 // destination point
740740 QPointF pd ( points.at ( pIdx + 2 ) );
741741
742- QPolygonF poly = curvedArrow ( po, pm, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadWidth , mScaledHeadHeight , mComputedHeadType , mComputedArrowType , mScaledOffset );
742+ QPolygonF poly = curvedArrow ( po, pm, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadLength , mScaledHeadThickness , mComputedHeadType , mComputedArrowType , mScaledOffset );
743743 mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
744744 }
745745 // straight arrow
@@ -750,7 +750,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
750750 // destination point
751751 QPointF pd ( points.at ( pIdx + 1 ) );
752752
753- QPolygonF poly = straightArrow ( po, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadWidth , mScaledHeadHeight , mComputedHeadType , mComputedArrowType , mScaledOffset );
753+ QPolygonF poly = straightArrow ( po, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadLength , mScaledHeadThickness , mComputedHeadType , mComputedArrowType , mScaledOffset );
754754 mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
755755 }
756756 }
@@ -769,7 +769,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
769769 // destination point
770770 QPointF pd ( points.back () );
771771
772- QPolygonF poly = straightArrow ( po, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadWidth , mScaledHeadHeight , mComputedHeadType , mComputedArrowType , mScaledOffset );
772+ QPolygonF poly = straightArrow ( po, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadLength , mScaledHeadThickness , mComputedHeadType , mComputedArrowType , mScaledOffset );
773773 mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
774774 }
775775 }
@@ -786,7 +786,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
786786 // destination point
787787 QPointF pd ( points.at ( pIdx + 1 ) );
788788
789- QPolygonF poly = straightArrow ( po, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadWidth , mScaledHeadHeight , mComputedHeadType , mComputedArrowType , mScaledOffset );
789+ QPolygonF poly = straightArrow ( po, pd, mScaledArrowStartWidth , mScaledArrowWidth , mScaledHeadLength , mScaledHeadThickness , mComputedHeadType , mComputedArrowType , mScaledOffset );
790790 mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
791791 }
792792 }
0 commit comments