@@ -39,41 +39,41 @@ int QgsMapToolEdit::insertSegmentVerticesForSnap(const QList<QgsSnappingResult>&
39
39
QgsPoint layerPoint;
40
40
41
41
if (!editedLayer || !editedLayer->isEditable ())
42
- {
43
- return 1 ;
44
- }
42
+ {
43
+ return 1 ;
44
+ }
45
45
46
46
// transform snaping coordinates to layer crs first
47
47
QList<QgsSnappingResult> transformedSnapResults = snapResults;
48
48
QList<QgsSnappingResult>::iterator it = transformedSnapResults.begin ();
49
49
for (; it != transformedSnapResults.constEnd (); ++it)
50
- {
51
- QgsPoint layerPoint = toLayerCoords (editedLayer, it->snappedVertex );
52
- it->snappedVertex = layerPoint;
53
- }
50
+ {
51
+ QgsPoint layerPoint = toLayerCoords (editedLayer, it->snappedVertex );
52
+ it->snappedVertex = layerPoint;
53
+ }
54
54
55
55
return editedLayer->insertSegmentVerticesForSnap (transformedSnapResults);
56
56
}
57
57
58
58
QgsPoint QgsMapToolEdit::snapPointFromResults (const QList<QgsSnappingResult>& snapResults, const QPoint& screenCoords)
59
59
{
60
60
if (snapResults.size () < 1 )
61
- {
62
- return toMapCoords (screenCoords);
63
- }
61
+ {
62
+ return toMapCoords (screenCoords);
63
+ }
64
64
else
65
- {
66
- return snapResults.constBegin ()->snappedVertex ;
67
- }
65
+ {
66
+ return snapResults.constBegin ()->snappedVertex ;
67
+ }
68
68
}
69
69
70
70
QgsRubberBand* QgsMapToolEdit::createRubberBand (bool isPolygon)
71
71
{
72
72
QSettings settings;
73
73
QgsRubberBand* rb = new QgsRubberBand (mCanvas , isPolygon);
74
74
QColor color ( settings.value (" /qgis/digitizing/line_color_red" , 255 ).toInt (),
75
- settings.value (" /qgis/digitizing/line_color_green" , 0 ).toInt (),
76
- settings.value (" /qgis/digitizing/line_color_blue" , 0 ).toInt ());
75
+ settings.value (" /qgis/digitizing/line_color_green" , 0 ).toInt (),
76
+ settings.value (" /qgis/digitizing/line_color_blue" , 0 ).toInt ());
77
77
rb->setColor (color);
78
78
rb->setWidth (settings.value (" /qgis/digitizing/line_width" , 1 ).toInt ());
79
79
rb->show ();
@@ -84,39 +84,39 @@ QgsVectorLayer* QgsMapToolEdit::currentVectorLayer()
84
84
{
85
85
QgsMapLayer* currentLayer = mCanvas ->currentLayer ();
86
86
if (!currentLayer)
87
- {
88
- return 0 ;
89
- }
87
+ {
88
+ return 0 ;
89
+ }
90
90
91
91
QgsVectorLayer* vlayer = dynamic_cast <QgsVectorLayer*>(currentLayer);
92
92
if (!vlayer)
93
- {
94
- return 0 ;
95
- }
93
+ {
94
+ return 0 ;
95
+ }
96
96
return vlayer;
97
97
}
98
98
99
99
100
100
int QgsMapToolEdit::addTopologicalPoints (const QList<QgsPoint>& geom)
101
101
{
102
102
if (!mCanvas )
103
- {
104
- return 1 ;
105
- }
103
+ {
104
+ return 1 ;
105
+ }
106
106
107
107
// find out current vector layer
108
108
QgsVectorLayer *vlayer = currentVectorLayer ();
109
-
109
+
110
110
if (!vlayer)
111
- {
112
- return 2 ;
113
- }
111
+ {
112
+ return 2 ;
113
+ }
114
114
115
115
QList<QgsPoint>::const_iterator list_it = geom.constBegin ();
116
116
for (; list_it != geom.constEnd (); ++list_it)
117
- {
118
- vlayer->addTopologicalPoints (*list_it);
119
- }
117
+ {
118
+ vlayer->addTopologicalPoints (*list_it);
119
+ }
120
120
return 0 ;
121
121
}
122
122
0 commit comments