|
9 | 9 | "new": "Neuer Kommentar", |
10 | 10 | "emailhint": "Um Ihren Kommentar freizuschalten, schicken wir Ihnen eine Email mit einem Aktivierungslink. Bitte geben Sie Ihre Email Adresse an:", |
11 | 11 | "commentSaved": "Ihr Kommentar wurde gespeichert. Klicken Sie den Link in der Email um ihn freizuschalten." |
| 12 | + }, |
| 13 | + "polygon": { |
| 14 | + "add": "Klicken Sie auf die Stelle in Karte an der Sie einen Kommentar hinzufügen möchten.", |
| 15 | + "editing": { |
| 16 | + "invalid": "Ungültige Geometrie, hinzufügen dieses Punktes möglich.", |
| 17 | + "unfinished": "Klicken Sie erneut auf den Startpunkt, um den Kommentar abzuschliessen", |
| 18 | + "closable": "Klicken Sie hier, um den Kommentar abzuschliessen." |
| 19 | + } |
12 | 20 | } |
13 | 21 | }, |
14 | 22 | "areamanagement": { |
|
21 | 29 | }, |
22 | 30 | "polygon": { |
23 | 31 | "add": "Klicken Sie auf die Stelle in Karte an der Sie eine Fläche hinzufügen möchten.", |
| 32 | + "editing": { |
| 33 | + "invalid": "Ungültige Geometrie, hinzufügen dieses Punktes möglich.", |
| 34 | + "unfinished": "Klicken Sie erneut auf den Startpunkt, um die Fläche abzuschliessen", |
| 35 | + "closable": "Klicken Sie hier, um die Fläche abzuschliessen." |
| 36 | + }, |
24 | 37 | "new": "Neue Fläche", |
25 | 38 | "emailhint": "Um Ihren Fläche freizuschalten, schicken wir Ihnen eine Email mit einem Aktivierungslink. Bitte geben Sie Ihre Email Adresse an:", |
26 | 39 | "commentSaved": "Ihre Fläche wurde gespeichert. Klicken Sie den Link in der Email um ihn freizuschalten." |
|
70 | 83 |
|
71 | 84 | <v-slide-y-transition> |
72 | 85 | <p class="addHint elevation-6" v-if="addingAnnotation"> |
73 | | - <span v-if="annotations.mode == 'PAR'">{{ $t('participation.annotation.add') }}</span> |
| 86 | + <span v-if="annotations.mode == 'PAR'"> |
| 87 | + <span v-if="polygonEditingState.invalid"> |
| 88 | + {{ $t('participation.polygon.editing.invalid') }}</span> |
| 89 | + <span v-else-if="polygonEditingState.closable"> |
| 90 | + {{ $t('participation.polygon.editing.closable') }}</span> |
| 91 | + <span v-else-if="polygonEditingState.active"> |
| 92 | + {{ $t('participation.polygon.editing.unfinished') }}</span> |
| 93 | + <span v-else> |
| 94 | + {{ $t('participation.annotation.add') }}</span> |
| 95 | + </span> |
74 | 96 | <span v-else-if="annotations.mode == 'MGT' && addingAnnotation == 'PLY'"> |
75 | | - {{ $t('areamanagement.polygon.add') }}</span> |
| 97 | + <span v-if="polygonEditingState.invalid"> |
| 98 | + {{ $t('areamanagement.polygon.editing.invalid') }}</span> |
| 99 | + <span v-else-if="polygonEditingState.closable"> |
| 100 | + {{ $t('areamanagement.polygon.editing.closable') }}</span> |
| 101 | + <span v-else-if="polygonEditingState.active"> |
| 102 | + {{ $t('areamanagement.polygon.editing.unfinished') }}</span> |
| 103 | + <span v-else> |
| 104 | + {{ $t('areamanagement.polygon.add') }}</span> |
| 105 | + </span> |
76 | 106 | <span v-else-if="annotations.mode == 'MGT' && addingAnnotation == 'COM'"> |
77 | 107 | {{ $t('areamanagement.note.add') }}</span> |
78 | 108 | </p> |
|
140 | 170 | id="addingAnnotationPly" |
141 | 171 | color="primary" |
142 | 172 | v-if="annotations.polygon.open" |
143 | | - @click="addingAnnotation ? addingAnnotation=null : addingAnnotation='PLY';"> |
| 173 | + @click="addingAnnotation ? addingAnnotation = null : addingAnnotation = 'PLY';"> |
144 | 174 | <v-icon v-if="!addingAnnotation || addingAnnotation != 'PLY'"> |
145 | 175 | mdi-shape-polygon-plus |
146 | 176 | </v-icon> |
|
154 | 184 | light width="400" class="pa-4 elevation-6" |
155 | 185 | > |
156 | 186 | <h3> |
157 | | - <span v-if="annotations.mode == 'PAR'"> |
158 | | - {{ $t('participation.annotation.new') }}</span> |
159 | | - <span v-else-if="annotations.mode == 'MGT' && newAnnotation.kind == 'PLY'"> |
| 187 | + <span v-if="annotations.mode == 'PAR' && addingAnnotation == 'PLY'"> |
| 188 | + <span>{{ $t('participation.polygon.new') }}</span> |
| 189 | + </span> |
| 190 | + <span v-else-if="annotations.mode == 'PAR' && addingAnnotation == 'COM'"> |
| 191 | + {{ $t('participation.note.new') }}</span> |
| 192 | + <span v-else-if="annotations.mode == 'MGT' && addingAnnotation == 'PLY'"> |
160 | 193 | {{ $t('areamanagement.polygon.new') }}</span> |
161 | | - <span v-else-if="annotations.mode == 'MGT' && newAnnotation.kind == 'COM'"> |
| 194 | + <span v-else-if="annotations.mode == 'MGT' && addingAnnotation == 'COM'"> |
162 | 195 | {{ $t('areamanagement.note.new') }}</span> |
163 | 196 | </h3> |
164 | 197 | <v-form |
@@ -411,8 +444,7 @@ body, |
411 | 444 |
|
412 | 445 | #myLocation, |
413 | 446 | #addingAnnotationPt, |
414 | | -#addingAnnotationPly |
415 | | -{ |
| 447 | +#addingAnnotationPly { |
416 | 448 | top: 5.6em; |
417 | 449 | right: 1.3em; |
418 | 450 | transition: top 0.3s; |
@@ -608,6 +640,11 @@ export default { |
608 | 640 | mapinfoopen: true, |
609 | 641 | addingAnnotation: null, |
610 | 642 | newAnnotation: null, |
| 643 | + polygonEditingState: { |
| 644 | + active: false, |
| 645 | + invalid: false, |
| 646 | + closable: false |
| 647 | + }, |
611 | 648 | polygonString: [], |
612 | 649 | drawnItems: null, |
613 | 650 | tooltipContainer: null, |
@@ -964,6 +1001,7 @@ export default { |
964 | 1001 | break; |
965 | 1002 | } |
966 | 1003 | case 'PLY': { |
| 1004 | + this.polygonEditingState.active = true; |
967 | 1005 | // 1. |
968 | 1006 | // On each click while in Polygon mode |
969 | 1007 | // record click series |
@@ -1026,6 +1064,7 @@ export default { |
1026 | 1064 | // this.map.setView(event.latlng); |
1027 | 1065 | window.setTimeout(() => { newMarker.fire('click'); }, 500); |
1028 | 1066 | this.cancelAnnotation(); |
| 1067 | + this.polygonEditingState.active = false; |
1029 | 1068 | } else { |
1030 | 1069 | const drawingLayer = this.drawnItems.getLayers(); |
1031 | 1070 | const layer = drawingLayer[0]; |
@@ -1118,10 +1157,14 @@ export default { |
1118 | 1157 | ); |
1119 | 1158 | const withinReach = Math.abs(distanceToStart) < 9 * (window.devicePixelRatio || 1); |
1120 | 1159 |
|
1121 | | - this.updateTooltip(pos, ` |
1122 | | - Position: ${latlng} / ${pos}<br> |
1123 | | - Distance: ${distanceToStart}<br>Within reach: ${withinReach} |
1124 | | - `); |
| 1160 | + this.polygonEditingState.closable = this.polygonString.length > 1 ? withinReach : false; |
| 1161 | +
|
| 1162 | + // todo: detect invalid, e.g. self-intersecting geomtries and set flag |
| 1163 | +
|
| 1164 | + // this.updateTooltip(pos, ` |
| 1165 | + // Position: ${latlng} / ${pos}<br> |
| 1166 | + // Distance: ${distanceToStart}<br>Within reach: ${withinReach} |
| 1167 | + // `); |
1125 | 1168 | this.updateGuideline(latlng); |
1126 | 1169 | } |
1127 | 1170 | } |
|
0 commit comments