@@ -21,18 +21,18 @@ QgsArrowSymbolLayer::QgsArrowSymbolLayer()
21
21
, mArrowWidthUnit( QgsSymbolV2::MM )
22
22
, mArrowStartWidth( 1.0 )
23
23
, 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 )
28
28
, mHeadType( HeadSingle )
29
29
, mArrowType( ArrowPlain )
30
30
, mIsCurved( true )
31
31
, mIsRepeated( true )
32
32
, mScaledArrowWidth( 1.0 )
33
33
, mScaledArrowStartWidth( 1.0 )
34
- , mScaledHeadWidth ( 1.5 )
35
- , mScaledHeadHeight ( 1.5 )
34
+ , mScaledHeadLength ( 1.5 )
35
+ , mScaledHeadThickness ( 1.5 )
36
36
, mScaledOffset( 0.0 )
37
37
, mComputedHeadType( HeadSingle )
38
38
, mComputedArrowType( ArrowPlain )
@@ -83,23 +83,23 @@ QgsSymbolLayerV2* QgsArrowSymbolLayer::create( const QgsStringMap& props )
83
83
if ( props.contains ( " is_repeated" ) )
84
84
l->setIsRepeated ( props[" is_repeated" ].toInt () == 1 );
85
85
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 () );
88
88
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 " ] ) );
91
91
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 " ] ) );
94
94
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 () );
97
97
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 " ] ) );
100
100
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 " ] ) );
103
103
104
104
if ( props.contains ( " head_type" ) )
105
105
l->setHeadType ( static_cast <HeadType>( props[" head_type" ].toInt () ) );
@@ -152,13 +152,13 @@ QgsStringMap QgsArrowSymbolLayer::properties() const
152
152
map[" is_curved" ] = QString::number ( isCurved () ? 1 : 0 );
153
153
map[" is_repeated" ] = QString::number ( isRepeated () ? 1 : 0 );
154
154
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 () );
158
158
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 () );
162
162
163
163
map[" head_type" ] = QString::number ( headType () );
164
164
map[" arrow_type" ] = QString::number ( arrowType () );
@@ -186,8 +186,8 @@ void QgsArrowSymbolLayer::startRender( QgsSymbolV2RenderContext& context )
186
186
mExpressionScope .reset ( new QgsExpressionContextScope () );
187
187
mScaledArrowWidth = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), arrowWidth (), arrowWidthUnit (), arrowWidthUnitScale () );
188
188
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 () );
191
191
mScaledOffset = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), offset (), offsetUnit (), offsetMapUnitScale () );
192
192
mComputedHeadType = headType ();
193
193
mComputedArrowType = arrowType ();
@@ -632,22 +632,22 @@ void QgsArrowSymbolLayer::_resolveDataDefined( QgsSymbolV2RenderContext& context
632
632
mScaledArrowStartWidth = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, arrowStartWidthUnit (), arrowStartWidthUnitScale () );
633
633
}
634
634
}
635
- if ( hasDataDefinedProperty ( " head_width " ) )
635
+ if ( hasDataDefinedProperty ( " head_length " ) )
636
636
{
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 ();
639
639
if ( ok )
640
640
{
641
- mScaledHeadWidth = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, headWidthUnit (), headWidthUnitScale () );
641
+ mScaledHeadLength = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, headLengthUnit (), headLengthUnitScale () );
642
642
}
643
643
}
644
- if ( hasDataDefinedProperty ( " head_height " ) )
644
+ if ( hasDataDefinedProperty ( " head_thickness " ) )
645
645
{
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 ();
648
648
if ( ok )
649
649
{
650
- mScaledHeadHeight = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, headHeightUnit (), headHeightUnitScale () );
650
+ mScaledHeadThickness = QgsSymbolLayerV2Utils::convertToPainterUnits ( context.renderContext (), w, headThicknessUnit (), headThicknessUnitScale () );
651
651
}
652
652
}
653
653
if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OFFSET ) )
@@ -708,7 +708,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
708
708
// destination point
709
709
QPointF pd ( points.back () );
710
710
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 );
712
712
mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
713
713
}
714
714
// straight arrow
@@ -719,7 +719,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
719
719
// destination point
720
720
QPointF pd ( points.at ( 1 ) );
721
721
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 );
723
723
mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
724
724
}
725
725
}
@@ -739,7 +739,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
739
739
// destination point
740
740
QPointF pd ( points.at ( pIdx + 2 ) );
741
741
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 );
743
743
mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
744
744
}
745
745
// straight arrow
@@ -750,7 +750,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
750
750
// destination point
751
751
QPointF pd ( points.at ( pIdx + 1 ) );
752
752
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 );
754
754
mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
755
755
}
756
756
}
@@ -769,7 +769,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
769
769
// destination point
770
770
QPointF pd ( points.back () );
771
771
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 );
773
773
mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
774
774
}
775
775
}
@@ -786,7 +786,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
786
786
// destination point
787
787
QPointF pd ( points.at ( pIdx + 1 ) );
788
788
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 );
790
790
mSymbol ->renderPolygon ( poly, /* rings */ nullptr , context.feature (), context.renderContext () );
791
791
}
792
792
}
0 commit comments