linesymbollayer_outerVertexOnly.diff
src/gui/symbology-ng/qgssymbollayerv2widget.cpp (Arbeitskopie) | ||
---|---|---|
361 | 361 |
connect( spinOffset, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) ); |
362 | 362 |
connect( radInterval, SIGNAL( clicked() ), this, SLOT( setPlacement() ) ); |
363 | 363 |
connect( radVertex, SIGNAL( clicked() ), this, SLOT( setPlacement() ) ); |
364 |
connect( radVertexLast, SIGNAL( clicked() ),this, SLOT( setPlacement() ) ); |
|
365 |
connect( radVertexFirst, SIGNAL( clicked() ),this, SLOT( setPlacement() ) ); |
|
364 | 366 |
} |
365 | 367 | |
366 | 368 |
void QgsMarkerLineSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer ) |
... | ... | |
377 | 379 |
spinOffset->setValue( mLayer->offset() ); |
378 | 380 |
if ( mLayer->placement() == QgsMarkerLineSymbolLayerV2::Interval ) |
379 | 381 |
radInterval->setChecked( true ); |
382 |
else if ( mLayer->placement() == QgsMarkerLineSymbolLayerV2::Vertex ) |
|
383 |
radVertex->setChecked( true ); |
|
384 |
else if ( mLayer->placement() == QgsMarkerLineSymbolLayerV2::LastVertex ) |
|
385 |
radVertexLast->setChecked( true ); |
|
380 | 386 |
else |
381 |
radVertex->setChecked( true ); |
|
387 |
radVertexFirst->setChecked( true );
|
|
382 | 388 |
updateMarker(); |
383 | 389 |
setPlacement(); // update gui |
384 | 390 |
} |
... | ... | |
426 | 432 |
void QgsMarkerLineSymbolLayerV2Widget::setPlacement() |
427 | 433 |
{ |
428 | 434 |
bool interval = radInterval->isChecked(); |
429 |
mLayer->setPlacement( interval ? QgsMarkerLineSymbolLayerV2::Interval : QgsMarkerLineSymbolLayerV2::Vertex ); |
|
430 | 435 |
spinInterval->setEnabled( interval ); |
436 |
//mLayer->setPlacement( interval ? QgsMarkerLineSymbolLayerV2::Interval : QgsMarkerLineSymbolLayerV2::Vertex ); |
|
437 |
if ( radInterval->isChecked() ) |
|
438 |
mLayer->setPlacement( QgsMarkerLineSymbolLayerV2::Interval ); |
|
439 |
else if ( radVertex->isChecked() ) |
|
440 |
mLayer->setPlacement( QgsMarkerLineSymbolLayerV2::Vertex ); |
|
441 |
else if ( radVertexLast->isChecked() ) |
|
442 |
mLayer->setPlacement( QgsMarkerLineSymbolLayerV2::LastVertex ); |
|
443 |
else |
|
444 |
mLayer->setPlacement( QgsMarkerLineSymbolLayerV2::FirstVertex ); |
|
445 | ||
431 | 446 |
emit changed(); |
432 | 447 |
} |
433 | 448 |
src/core/symbology-ng/qgslinesymbollayerv2.h (Arbeitskopie) | ||
---|---|---|
88 | 88 |
enum Placement |
89 | 89 |
{ |
90 | 90 |
Interval, |
91 |
Vertex |
|
91 |
Vertex, |
|
92 |
LastVertex, |
|
93 |
FirstVertex |
|
92 | 94 |
}; |
93 | 95 | |
94 | 96 |
// static stuff |
src/core/symbology-ng/qgslinesymbollayerv2.cpp (Arbeitskopie) | ||
---|---|---|
239 | 239 |
if ( props.contains( "offset" ) ) |
240 | 240 |
x->setOffset( props["offset"].toDouble() ); |
241 | 241 |
if ( props.contains( "placement" ) ) |
242 |
x->setPlacement( props["placement"] == "vertex" ? Vertex : Interval ); |
|
242 |
if ( props["placement"] == "vertex" ) |
|
243 |
x->setPlacement( Vertex ); |
|
244 |
else if ( props["placement"] == "lastvertex" ) |
|
245 |
x->setPlacement( LastVertex ); |
|
246 |
else if ( props["placement"] == "firstvertex" ) |
|
247 |
x->setPlacement( FirstVertex ); |
|
248 |
else |
|
249 |
x->setPlacement( Interval ); |
|
243 | 250 |
return x; |
244 | 251 |
} |
245 | 252 | |
... | ... | |
279 | 286 |
{ |
280 | 287 |
if ( mOffset == 0 ) |
281 | 288 |
{ |
282 |
if ( mPlacement == Vertex ) |
|
289 |
if ( mPlacement == Interval ) |
|
290 |
renderPolylineInterval( points, context ); |
|
291 |
else |
|
283 | 292 |
renderPolylineVertex( points, context ); |
284 |
else |
|
285 |
renderPolylineInterval( points, context ); |
|
286 | 293 |
} |
287 | 294 |
else |
288 | 295 |
{ |
289 | 296 |
QPolygonF points2 = ::offsetLine( points, context.outputLineWidth( mOffset ) ); |
290 |
if ( mPlacement == Vertex )
|
|
291 |
renderPolylineVertex( points2, context );
|
|
297 |
if ( mPlacement == Interval )
|
|
298 |
renderPolylineInterval( points2, context );
|
|
292 | 299 |
else |
293 |
renderPolylineInterval( points2, context );
|
|
300 |
renderPolylineVertex( points2, context );
|
|
294 | 301 |
} |
295 | 302 |
} |
296 | 303 | |
... | ... | |
360 | 367 | |
361 | 368 |
double origAngle = mMarker->angle(); |
362 | 369 |
double angle; |
370 |
int i, maxCount; |
|
363 | 371 | |
364 |
for ( int i = 0; i < points.count(); ++i )
|
|
372 |
if( mPlacement == FirstVertex )
|
|
365 | 373 |
{ |
374 |
i = 0; |
|
375 |
maxCount = 1; |
|
376 |
} |
|
377 |
else if( mPlacement == LastVertex ) |
|
378 |
{ |
|
379 |
i = points.count() - 1; |
|
380 |
maxCount = points.count(); |
|
381 |
} |
|
382 |
else |
|
383 |
{ |
|
384 |
i = 0; |
|
385 |
maxCount = points.count(); |
|
386 |
} |
|
387 | ||
388 |
for ( ; i < maxCount; ++i ) |
|
389 |
{ |
|
366 | 390 |
const QPointF& pt = points[i]; |
367 | 391 | |
368 | 392 |
// rotate marker (if desired) |
... | ... | |
395 | 419 |
double unitX = cos( a1 ) + cos( a2 ), unitY = sin( a1 ) + sin( a2 ); |
396 | 420 |
angle = atan2( unitY, unitX ); |
397 | 421 |
} |
398 |
mMarker->setAngle( angle * 180 / M_PI ); |
|
422 |
mMarker->setAngle(origAngle + angle * 180 / M_PI );
|
|
399 | 423 |
} |
400 | 424 | |
401 | 425 |
mMarker->renderPoint( points.at( i ), rc, -1, context.selected() ); |
... | ... | |
411 | 435 |
map["rotate"] = ( mRotateMarker ? "1" : "0" ); |
412 | 436 |
map["interval"] = QString::number( mInterval ); |
413 | 437 |
map["offset"] = QString::number( mOffset ); |
414 |
map["placement"] = ( mPlacement == Vertex ? "vertex" : "interval" ); |
|
438 |
if ( mPlacement == Vertex ) |
|
439 |
map["placement"] = "vertex"; |
|
440 |
else if ( mPlacement == LastVertex ) |
|
441 |
map["placement"] = "lastvertex"; |
|
442 |
else if ( mPlacement == FirstVertex ) |
|
443 |
map["placement"] = "firstvertex"; |
|
444 |
else |
|
445 |
map["placement"] = "interval"; |
|
415 | 446 |
return map; |
416 | 447 |
} |
417 | 448 |
src/ui/symbollayer/widget_markerline.ui (Arbeitskopie) | ||
---|---|---|
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 | 9 |
<width>352</width> |
10 |
<height>232</height>
|
|
10 |
<height>281</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="windowTitle"> |
14 | 14 |
<string>Form</string> |
15 | 15 |
</property> |
16 |
<layout class="QVBoxLayout" name="verticalLayout"> |
|
17 |
<item> |
|
18 |
<layout class="QGridLayout" name="gridLayout"> |
|
19 |
<item row="0" column="0"> |
|
20 |
<widget class="QLabel" name="label"> |
|
21 |
<property name="text"> |
|
22 |
<string>Marker</string> |
|
23 |
</property> |
|
24 |
</widget> |
|
25 |
</item> |
|
26 |
<item row="0" column="1"> |
|
27 |
<widget class="QPushButton" name="btnChangeMarker"> |
|
28 |
<property name="text"> |
|
29 |
<string>Change</string> |
|
30 |
</property> |
|
31 |
</widget> |
|
32 |
</item> |
|
33 |
<item row="1" column="0" colspan="2"> |
|
34 |
<widget class="QLabel" name="label_2"> |
|
35 |
<property name="text"> |
|
36 |
<string>Marker placement</string> |
|
37 |
</property> |
|
38 |
</widget> |
|
39 |
</item> |
|
40 |
<item row="2" column="0"> |
|
41 |
<widget class="QRadioButton" name="radInterval"> |
|
42 |
<property name="text"> |
|
43 |
<string>with interval</string> |
|
44 |
</property> |
|
45 |
<property name="checked"> |
|
46 |
<bool>true</bool> |
|
47 |
</property> |
|
48 |
</widget> |
|
49 |
</item> |
|
50 |
<item row="2" column="1"> |
|
51 |
<widget class="QDoubleSpinBox" name="spinInterval"> |
|
52 |
<property name="decimals"> |
|
53 |
<number>2</number> |
|
54 |
</property> |
|
55 |
<property name="maximum"> |
|
56 |
<double>100000.000000000000000</double> |
|
57 |
</property> |
|
58 |
<property name="value"> |
|
59 |
<double>1.000000000000000</double> |
|
60 |
</property> |
|
61 |
</widget> |
|
62 |
</item> |
|
63 |
<item row="3" column="0" colspan="2"> |
|
64 |
<widget class="QRadioButton" name="radVertex"> |
|
65 |
<property name="text"> |
|
66 |
<string>on every vertex</string> |
|
67 |
</property> |
|
68 |
</widget> |
|
69 |
</item> |
|
70 |
<item row="4" column="0" colspan="2"> |
|
71 |
<widget class="QCheckBox" name="chkRotateMarker"> |
|
72 |
<property name="text"> |
|
73 |
<string>Rotate marker</string> |
|
74 |
</property> |
|
75 |
</widget> |
|
76 |
</item> |
|
77 |
<item row="5" column="0"> |
|
78 |
<widget class="QLabel" name="label_3"> |
|
79 |
<property name="text"> |
|
80 |
<string>Line offset</string> |
|
81 |
</property> |
|
82 |
</widget> |
|
83 |
</item> |
|
84 |
<item row="5" column="1"> |
|
85 |
<widget class="QDoubleSpinBox" name="spinOffset"> |
|
86 |
<property name="decimals"> |
|
87 |
<number>2</number> |
|
88 |
</property> |
|
89 |
<property name="minimum"> |
|
90 |
<double>-100000.000000000000000</double> |
|
91 |
</property> |
|
92 |
<property name="maximum"> |
|
93 |
<double>100000.000000000000000</double> |
|
94 |
</property> |
|
95 |
</widget> |
|
96 |
</item> |
|
97 |
<item row="0" column="2" rowspan="6"> |
|
98 |
<spacer> |
|
99 |
<property name="orientation"> |
|
100 |
<enum>Qt::Horizontal</enum> |
|
101 |
</property> |
|
102 |
<property name="sizeType"> |
|
103 |
<enum>QSizePolicy::Preferred</enum> |
|
104 |
</property> |
|
105 |
<property name="sizeHint" stdset="0"> |
|
106 |
<size> |
|
107 |
<width>110</width> |
|
108 |
<height>20</height> |
|
109 |
</size> |
|
110 |
</property> |
|
111 |
</spacer> |
|
112 |
</item> |
|
113 |
</layout> |
|
16 |
<layout class="QGridLayout" name="gridLayout"> |
|
17 |
<item row="0" column="0"> |
|
18 |
<widget class="QLabel" name="label"> |
|
19 |
<property name="text"> |
|
20 |
<string>Marker</string> |
|
21 |
</property> |
|
22 |
</widget> |
|
114 | 23 |
</item> |
115 |
<item> |
|
24 |
<item row="0" column="1"> |
|
25 |
<widget class="QPushButton" name="btnChangeMarker"> |
|
26 |
<property name="text"> |
|
27 |
<string>Change</string> |
|
28 |
</property> |
|
29 |
</widget> |
|
30 |
</item> |
|
31 |
<item row="0" column="2"> |
|
116 | 32 |
<spacer> |
117 | 33 |
<property name="orientation"> |
34 |
<enum>Qt::Horizontal</enum> |
|
35 |
</property> |
|
36 |
<property name="sizeType"> |
|
37 |
<enum>QSizePolicy::Preferred</enum> |
|
38 |
</property> |
|
39 |
<property name="sizeHint" stdset="0"> |
|
40 |
<size> |
|
41 |
<width>109</width> |
|
42 |
<height>20</height> |
|
43 |
</size> |
|
44 |
</property> |
|
45 |
</spacer> |
|
46 |
</item> |
|
47 |
<item row="1" column="0" colspan="2"> |
|
48 |
<widget class="QLabel" name="label_2"> |
|
49 |
<property name="text"> |
|
50 |
<string>Marker placement</string> |
|
51 |
</property> |
|
52 |
</widget> |
|
53 |
</item> |
|
54 |
<item row="2" column="0"> |
|
55 |
<widget class="QRadioButton" name="radInterval"> |
|
56 |
<property name="text"> |
|
57 |
<string>with interval</string> |
|
58 |
</property> |
|
59 |
<property name="checked"> |
|
60 |
<bool>true</bool> |
|
61 |
</property> |
|
62 |
</widget> |
|
63 |
</item> |
|
64 |
<item row="2" column="1"> |
|
65 |
<widget class="QDoubleSpinBox" name="spinInterval"> |
|
66 |
<property name="decimals"> |
|
67 |
<number>2</number> |
|
68 |
</property> |
|
69 |
<property name="maximum"> |
|
70 |
<double>100000.000000000000000</double> |
|
71 |
</property> |
|
72 |
<property name="value"> |
|
73 |
<double>1.000000000000000</double> |
|
74 |
</property> |
|
75 |
</widget> |
|
76 |
</item> |
|
77 |
<item row="3" column="0" colspan="2"> |
|
78 |
<widget class="QRadioButton" name="radVertex"> |
|
79 |
<property name="text"> |
|
80 |
<string>on every vertex</string> |
|
81 |
</property> |
|
82 |
</widget> |
|
83 |
</item> |
|
84 |
<item row="4" column="0" colspan="2"> |
|
85 |
<widget class="QRadioButton" name="radVertexLast"> |
|
86 |
<property name="text"> |
|
87 |
<string>on last vertex only</string> |
|
88 |
</property> |
|
89 |
</widget> |
|
90 |
</item> |
|
91 |
<item row="5" column="0" colspan="2"> |
|
92 |
<widget class="QRadioButton" name="radVertexFirst"> |
|
93 |
<property name="text"> |
|
94 |
<string>on first vertex only</string> |
|
95 |
</property> |
|
96 |
</widget> |
|
97 |
</item> |
|
98 |
<item row="6" column="0" colspan="2"> |
|
99 |
<widget class="QCheckBox" name="chkRotateMarker"> |
|
100 |
<property name="text"> |
|
101 |
<string>Rotate marker</string> |
|
102 |
</property> |
|
103 |
</widget> |
|
104 |
</item> |
|
105 |
<item row="7" column="0"> |
|
106 |
<widget class="QLabel" name="label_3"> |
|
107 |
<property name="text"> |
|
108 |
<string>Line offset</string> |
|
109 |
</property> |
|
110 |
</widget> |
|
111 |
</item> |
|
112 |
<item row="7" column="1"> |
|
113 |
<widget class="QDoubleSpinBox" name="spinOffset"> |
|
114 |
<property name="decimals"> |
|
115 |
<number>2</number> |
|
116 |
</property> |
|
117 |
<property name="minimum"> |
|
118 |
<double>-100000.000000000000000</double> |
|
119 |
</property> |
|
120 |
<property name="maximum"> |
|
121 |
<double>100000.000000000000000</double> |
|
122 |
</property> |
|
123 |
</widget> |
|
124 |
</item> |
|
125 |
<item row="8" column="0" colspan="3"> |
|
126 |
<spacer> |
|
127 |
<property name="orientation"> |
|
118 | 128 |
<enum>Qt::Vertical</enum> |
119 | 129 |
</property> |
120 | 130 |
<property name="sizeHint" stdset="0"> |