Skip to content

Commit aaef947

Browse files
committed
remove line decoration symbol layer (fixes #8379)
1 parent 7f8b259 commit aaef947

10 files changed

+1
-465
lines changed

python/core/symbology-ng/qgslinesymbollayerv2.sip

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -138,41 +138,3 @@ class QgsMarkerLineSymbolLayerV2 : QgsLineSymbolLayerV2
138138
void renderPolylineVertex( const QPolygonF& points, QgsSymbolV2RenderContext& context );
139139
void renderPolylineCentral( const QPolygonF& points, QgsSymbolV2RenderContext& context );
140140
};
141-
142-
/////////
143-
144-
class QgsLineDecorationSymbolLayerV2 : QgsLineSymbolLayerV2
145-
{
146-
%TypeHeaderCode
147-
#include <qgslinesymbollayerv2.h>
148-
%End
149-
150-
public:
151-
QgsLineDecorationSymbolLayerV2( QColor color = DEFAULT_LINEDECORATION_COLOR,
152-
double width = DEFAULT_LINEDECORATION_WIDTH );
153-
154-
~QgsLineDecorationSymbolLayerV2();
155-
156-
// static stuff
157-
158-
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
159-
160-
// implemented from base classes
161-
162-
QString layerType() const;
163-
164-
void startRender( QgsSymbolV2RenderContext& context );
165-
166-
void stopRender( QgsSymbolV2RenderContext& context );
167-
168-
void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
169-
170-
QgsStringMap properties() const;
171-
172-
QgsSymbolLayerV2* clone() const /Factory/;
173-
174-
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
175-
176-
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
177-
QgsSymbolV2::OutputUnit outputUnit() const;
178-
};

python/core/symbology-ng/qgssymbollayerv2.sip

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ class QgsSymbolLayerV2
2424
break;
2525

2626
case QgsSymbolV2::Line:
27-
if (dynamic_cast<QgsLineDecorationSymbolLayerV2*>(sipCpp) != NULL)
28-
sipClass = sipClass_QgsLineDecorationSymbolLayerV2;
29-
else if (dynamic_cast<QgsMarkerLineSymbolLayerV2*>(sipCpp) != NULL)
27+
if (dynamic_cast<QgsMarkerLineSymbolLayerV2*>(sipCpp) != NULL)
3028
sipClass = sipClass_QgsMarkerLineSymbolLayerV2;
3129
else if (dynamic_cast<QgsSimpleLineSymbolLayerV2*>(sipCpp) != NULL)
3230
sipClass = sipClass_QgsSimpleLineSymbolLayerV2;

python/gui/symbology-ng/qgssymbollayerv2widget.sip

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -183,29 +183,6 @@ class QgsSvgMarkerSymbolLayerV2Widget : QgsSymbolLayerV2Widget
183183

184184
///////////
185185

186-
class QgsLineDecorationSymbolLayerV2Widget : QgsSymbolLayerV2Widget
187-
{
188-
%TypeHeaderCode
189-
#include <qgssymbollayerv2widget.h>
190-
%End
191-
192-
public:
193-
QgsLineDecorationSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
194-
195-
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) /Factory/;
196-
197-
// from base class
198-
virtual void setSymbolLayer( QgsSymbolLayerV2* layer );
199-
virtual QgsSymbolLayerV2* symbolLayer();
200-
201-
public slots:
202-
void colorChanged( const QColor& color );
203-
void penWidthChanged();
204-
void on_mWidthUnitComboBox_currentIndexChanged( int index );
205-
};
206-
207-
//////////
208-
209186
class QgsSVGFillSymbolLayerWidget : QgsSymbolLayerV2Widget
210187
{
211188
%TypeHeaderCode

src/core/symbology-ng/qgslinesymbollayerv2.cpp

Lines changed: 0 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,155 +1086,3 @@ QgsSymbolV2::OutputUnit QgsMarkerLineSymbolLayerV2::outputUnit() const
10861086
}
10871087
return unit;
10881088
}
1089-
1090-
/////////////
1091-
1092-
QgsLineDecorationSymbolLayerV2::QgsLineDecorationSymbolLayerV2( QColor color, double width )
1093-
{
1094-
mColor = color;
1095-
mWidth = width;
1096-
}
1097-
1098-
QgsLineDecorationSymbolLayerV2::~QgsLineDecorationSymbolLayerV2()
1099-
{
1100-
}
1101-
1102-
QgsSymbolLayerV2* QgsLineDecorationSymbolLayerV2::create( const QgsStringMap& props )
1103-
{
1104-
QColor color = DEFAULT_LINEDECORATION_COLOR;
1105-
double width = DEFAULT_LINEDECORATION_WIDTH;
1106-
1107-
if ( props.contains( "color" ) )
1108-
color = QgsSymbolLayerV2Utils::decodeColor( props["color"] );
1109-
if ( props.contains( "width" ) )
1110-
width = props["width"].toDouble();
1111-
1112-
1113-
QgsLineDecorationSymbolLayerV2* layer = new QgsLineDecorationSymbolLayerV2( color, width );
1114-
if ( props.contains( "width_unit" ) )
1115-
{
1116-
layer->setWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["width_unit"] ) );
1117-
}
1118-
return layer;
1119-
}
1120-
1121-
QString QgsLineDecorationSymbolLayerV2::layerType() const
1122-
{
1123-
return "LineDecoration";
1124-
}
1125-
1126-
void QgsLineDecorationSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
1127-
{
1128-
QColor penColor = mColor;
1129-
penColor.setAlphaF( mColor.alphaF() * context.alpha() );
1130-
1131-
double width = mWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mWidthUnit );
1132-
mPen.setWidth( width );
1133-
mPen.setColor( penColor );
1134-
QColor selColor = context.renderContext().selectionColor();
1135-
if ( ! selectionIsOpaque )
1136-
selColor.setAlphaF( context.alpha() );
1137-
mSelPen.setWidth( width ); //context.outputLineWidth( width ) );
1138-
mSelPen.setColor( selColor );
1139-
}
1140-
1141-
void QgsLineDecorationSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context )
1142-
{
1143-
Q_UNUSED( context );
1144-
}
1145-
1146-
void QgsLineDecorationSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context )
1147-
{
1148-
// draw arrow at the end of line
1149-
1150-
QPainter* p = context.renderContext().painter();
1151-
if ( !p )
1152-
{
1153-
return;
1154-
}
1155-
1156-
int cnt = points.count();
1157-
if ( cnt < 2 )
1158-
{
1159-
return;
1160-
}
1161-
QPointF p2 = points.at( --cnt );
1162-
QPointF p1 = points.at( --cnt );
1163-
while ( p2 == p1 && cnt )
1164-
p1 = points.at( --cnt );
1165-
if ( p1 == p2 )
1166-
{
1167-
// this is a collapsed line... don't bother drawing an arrow
1168-
// with arbitrary orientation
1169-
return;
1170-
}
1171-
1172-
double angle = atan2( p2.y() - p1.y(), p2.x() - p1.x() );
1173-
double size = ( mWidth * 8 ) * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mWidthUnit );
1174-
double angle1 = angle + M_PI / 6;
1175-
double angle2 = angle - M_PI / 6;
1176-
1177-
QPointF p2_1 = p2 - QPointF( size * cos( angle1 ), size * sin( angle1 ) );
1178-
QPointF p2_2 = p2 - QPointF( size * cos( angle2 ), size * sin( angle2 ) );
1179-
1180-
p->setPen( context.selected() ? mSelPen : mPen );
1181-
p->drawLine( p2, p2_1 );
1182-
p->drawLine( p2, p2_2 );
1183-
}
1184-
1185-
QgsStringMap QgsLineDecorationSymbolLayerV2::properties() const
1186-
{
1187-
QgsStringMap map;
1188-
map["color"] = QgsSymbolLayerV2Utils::encodeColor( mColor );
1189-
map["width"] = QString::number( mWidth );
1190-
map["width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mWidthUnit );
1191-
return map;
1192-
}
1193-
1194-
QgsSymbolLayerV2* QgsLineDecorationSymbolLayerV2::clone() const
1195-
{
1196-
QgsLineDecorationSymbolLayerV2* layer = new QgsLineDecorationSymbolLayerV2( mColor, mWidth );
1197-
layer->setWidthUnit( mWidthUnit );
1198-
return layer;
1199-
}
1200-
1201-
void QgsLineDecorationSymbolLayerV2::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
1202-
{
1203-
QDomElement symbolizerElem = doc.createElement( "se:LineSymbolizer" );
1204-
if ( !props.value( "uom", "" ).isEmpty() )
1205-
symbolizerElem.setAttribute( "uom", props.value( "uom", "" ) );
1206-
element.appendChild( symbolizerElem );
1207-
1208-
QgsSymbolLayerV2Utils::createGeometryElement( doc, symbolizerElem, props.value( "geom" , "" ) );
1209-
1210-
// <Stroke>
1211-
QDomElement strokeElem = doc.createElement( "se:Stroke" );
1212-
symbolizerElem.appendChild( strokeElem );
1213-
1214-
// <GraphicStroke>
1215-
QDomElement graphicStrokeElem = doc.createElement( "se:GraphicStroke" );
1216-
strokeElem.appendChild( graphicStrokeElem );
1217-
1218-
// <Graphic>
1219-
QDomElement graphicElem = doc.createElement( "se:Graphic" );
1220-
graphicStrokeElem.appendChild( graphicElem );
1221-
1222-
// <Mark>
1223-
QgsSymbolLayerV2Utils::wellKnownMarkerToSld( doc, graphicElem, "arrowhead", QColor(), mColor, mWidth, mWidth*8 );
1224-
1225-
// <Rotation>
1226-
QgsSymbolLayerV2Utils::createRotationElement( doc, graphicElem, props.value( "angle", "" ) );
1227-
1228-
// use <VendorOption> to draw the decoration at end of the line
1229-
symbolizerElem.appendChild( QgsSymbolLayerV2Utils::createVendorOptionElement( doc, "placement", "lastPoint" ) );
1230-
}
1231-
1232-
void QgsLineDecorationSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
1233-
{
1234-
mWidthUnit = unit;
1235-
}
1236-
1237-
QgsSymbolV2::OutputUnit QgsLineDecorationSymbolLayerV2::outputUnit() const
1238-
{
1239-
return mWidthUnit;
1240-
}

src/core/symbology-ng/qgslinesymbollayerv2.h

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -200,46 +200,4 @@ class CORE_EXPORT QgsMarkerLineSymbolLayerV2 : public QgsLineSymbolLayerV2
200200
Placement mPlacement;
201201
};
202202

203-
/////////
204-
205-
#define DEFAULT_LINEDECORATION_COLOR QColor(0,0,0)
206-
#define DEFAULT_LINEDECORATION_WIDTH DEFAULT_LINE_WIDTH
207-
208-
class CORE_EXPORT QgsLineDecorationSymbolLayerV2 : public QgsLineSymbolLayerV2
209-
{
210-
public:
211-
QgsLineDecorationSymbolLayerV2( QColor color = DEFAULT_LINEDECORATION_COLOR,
212-
double width = DEFAULT_LINEDECORATION_WIDTH );
213-
214-
~QgsLineDecorationSymbolLayerV2();
215-
216-
// static stuff
217-
218-
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
219-
220-
// implemented from base classes
221-
222-
QString layerType() const;
223-
224-
void startRender( QgsSymbolV2RenderContext& context );
225-
226-
void stopRender( QgsSymbolV2RenderContext& context );
227-
228-
void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
229-
230-
QgsStringMap properties() const;
231-
232-
QgsSymbolLayerV2* clone() const;
233-
234-
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
235-
236-
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
237-
QgsSymbolV2::OutputUnit outputUnit() const;
238-
239-
protected:
240-
QPen mPen;
241-
QPen mSelPen;
242-
243-
};
244-
245203
#endif

src/core/symbology-ng/qgssymbollayerv2registry.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ QgsSymbolLayerV2Registry::QgsSymbolLayerV2Registry()
3030
QgsSimpleLineSymbolLayerV2::create, QgsSimpleLineSymbolLayerV2::createFromSld ) );
3131
addSymbolLayerType( new QgsSymbolLayerV2Metadata( "MarkerLine", QObject::tr( "Marker line" ), QgsSymbolV2::Line,
3232
QgsMarkerLineSymbolLayerV2::create, QgsMarkerLineSymbolLayerV2::createFromSld ) );
33-
addSymbolLayerType( new QgsSymbolLayerV2Metadata( "LineDecoration", QObject::tr( "Line decoration" ), QgsSymbolV2::Line,
34-
QgsLineDecorationSymbolLayerV2::create ) );
3533

3634
addSymbolLayerType( new QgsSymbolLayerV2Metadata( "SimpleMarker", QObject::tr( "Simple marker" ), QgsSymbolV2::Marker,
3735
QgsSimpleMarkerSymbolLayerV2::create, QgsSimpleMarkerSymbolLayerV2::createFromSld ) );

src/gui/symbology-ng/qgslayerpropertieswidget.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ static void _initWidgetFunctions()
5959

6060
_initWidgetFunction( "SimpleLine", QgsSimpleLineSymbolLayerV2Widget::create );
6161
_initWidgetFunction( "MarkerLine", QgsMarkerLineSymbolLayerV2Widget::create );
62-
_initWidgetFunction( "LineDecoration", QgsLineDecorationSymbolLayerV2Widget::create );
6362

6463
_initWidgetFunction( "SimpleMarker", QgsSimpleMarkerSymbolLayerV2Widget::create );
6564
_initWidgetFunction( "SvgMarker", QgsSvgMarkerSymbolLayerV2Widget::create );

src/gui/symbology-ng/qgssymbollayerv2widget.cpp

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,63 +1151,6 @@ void QgsSvgMarkerSymbolLayerV2Widget::on_mDataDefinedPropertiesButton_clicked()
11511151
}
11521152
}
11531153

1154-
///////////////
1155-
1156-
QgsLineDecorationSymbolLayerV2Widget::QgsLineDecorationSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent )
1157-
: QgsSymbolLayerV2Widget( parent, vl )
1158-
{
1159-
mLayer = NULL;
1160-
1161-
setupUi( this );
1162-
1163-
connect( btnChangeColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( colorChanged( const QColor& ) ) );
1164-
connect( spinWidth, SIGNAL( valueChanged( double ) ), this, SLOT( penWidthChanged() ) );
1165-
}
1166-
1167-
void QgsLineDecorationSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
1168-
{
1169-
if ( layer->layerType() != "LineDecoration" )
1170-
return;
1171-
1172-
// layer type is correct, we can do the cast
1173-
mLayer = static_cast<QgsLineDecorationSymbolLayerV2*>( layer );
1174-
1175-
// set values
1176-
btnChangeColor->setColor( mLayer->color() );
1177-
btnChangeColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
1178-
spinWidth->setValue( mLayer->width() );
1179-
1180-
mWidthUnitComboBox->blockSignals( true );
1181-
mWidthUnitComboBox->setCurrentIndex( mLayer->widthUnit() );
1182-
mWidthUnitComboBox->blockSignals( false );
1183-
}
1184-
1185-
QgsSymbolLayerV2* QgsLineDecorationSymbolLayerV2Widget::symbolLayer()
1186-
{
1187-
return mLayer;
1188-
}
1189-
1190-
void QgsLineDecorationSymbolLayerV2Widget::colorChanged( const QColor& color )
1191-
{
1192-
mLayer->setColor( color );
1193-
emit changed();
1194-
}
1195-
1196-
void QgsLineDecorationSymbolLayerV2Widget::penWidthChanged()
1197-
{
1198-
mLayer->setWidth( spinWidth->value() );
1199-
emit changed();
1200-
}
1201-
1202-
void QgsLineDecorationSymbolLayerV2Widget::on_mWidthUnitComboBox_currentIndexChanged( int index )
1203-
{
1204-
if ( mLayer )
1205-
{
1206-
mLayer->setWidthUnit(( QgsSymbolV2::OutputUnit ) index );
1207-
}
1208-
emit changed();
1209-
}
1210-
12111154
/////////////
12121155

12131156
#include <QFileDialog>

0 commit comments

Comments
 (0)