Commit 3d190e2bd1500d1d10bd9d4efa81961e1ccd05a0
1 parent
0dfabad8
Exists in
master
i3geo/i3geo#118
Created by Edmar Moretti 8 days ago Nas ferramentas de medir área e medir distâncias, incluir opão para remover as figuras criadas, sem necessidade de fechar a janela para isso
Showing
54 changed files
with
120 additions
and
79 deletions
Show diff stats
ferramentas/area/dicionario.js
1 | 1 | //+$trad(1,i3GEOF.area.dicionario)+ |
2 | 2 | i3GEOF.area.dicionario = { |
3 | 3 | 'incorporar' : [{ |
4 | - pt : "Incorporar figura ao mapa", | |
4 | + pt : "Incorporar figura", | |
5 | 5 | en : "Add picture to the map", |
6 | 6 | es : "Agregar figura al mapa" |
7 | 7 | }], |
... | ... | @@ -9,5 +9,10 @@ i3GEOF.area.dicionario = { |
9 | 9 | pt : "Clique em diferentes pontos do mapa para traçar um polígono", |
10 | 10 | en : "Click on different points on the map to draw a polygon", |
11 | 11 | es : "Haga clic en diferentes puntos del mapa para dibujar un polígono" |
12 | - }] | |
12 | + }], | |
13 | + 'remover' : [{ | |
14 | + pt : "Remover figura", | |
15 | + en : "", | |
16 | + es : "" | |
17 | + }] | |
13 | 18 | }; | ... | ... |
ferramentas/area/index.js
... | ... | @@ -37,6 +37,13 @@ i3GEOF.area = |
37 | 37 | $i(iddiv).innerHTML = i3GEOF.area.html(); |
38 | 38 | i3GEOF.area[i3GEO.Interface["ATUAL"]].inicia(); |
39 | 39 | }, |
40 | + isOn : function() { | |
41 | + if($i("i3GEOF.area")){ | |
42 | + return true; | |
43 | + } else { | |
44 | + return false; | |
45 | + } | |
46 | + }, | |
40 | 47 | /* |
41 | 48 | * Function: html |
42 | 49 | * |
... | ... | @@ -89,7 +96,8 @@ i3GEOF.area = |
89 | 96 | i3GEOF.area.inicia(divid); |
90 | 97 | temp = |
91 | 98 | function() { |
92 | - var janela; | |
99 | + i3GEOF.area.pontos = {}; | |
100 | + var janela; | |
93 | 101 | i3GEO.eventos.cliquePerm.ativa(); |
94 | 102 | janela = YAHOO.i3GEO.janela.manager.find("area"); |
95 | 103 | if (janela) { |
... | ... | @@ -121,6 +129,9 @@ i3GEOF.area = |
121 | 129 | pontos.push(x[0] + " " + y[0]); |
122 | 130 | return "POLYGON((" + pontos.join(",") + "))"; |
123 | 131 | }, |
132 | + removeFiguras : function(){ | |
133 | + i3GEOF.area[i3GEO.Interface["ATUAL"]].removeFiguras(); | |
134 | + }, | |
124 | 135 | /** |
125 | 136 | * Funcoes especificas da interface openlayers |
126 | 137 | */ |
... | ... | @@ -171,6 +182,10 @@ i3GEOF.area = |
171 | 182 | ypt : [], |
172 | 183 | dist : [] |
173 | 184 | }; |
185 | + i3GEO.analise.pontos = { | |
186 | + xpt : [], | |
187 | + ypt : [] | |
188 | + }; | |
174 | 189 | var m = i3GEOF.area.openlayers, |
175 | 190 | sketch = evt.feature; |
176 | 191 | m.estilo = sketch.getStyle(); |
... | ... | @@ -240,7 +255,8 @@ i3GEOF.area = |
240 | 255 | |
241 | 256 | }, |
242 | 257 | point : function(point,geom) { |
243 | - var wgs84Sphere,area,coordinates,sourceProj,n, x1, y1, x2, y2, trecho, temp, | |
258 | + i3GEO.eventos.cliquePerm.desativa(); | |
259 | + var wgs84Sphere,area,coordinates,sourceProj,n, x1, y1, x2, y2, trecho, temp, | |
244 | 260 | coord = point.getCoordinates(), |
245 | 261 | total = 0; |
246 | 262 | i3GEOF.area.pontos.xpt.push(coord[0]); |
... | ... | @@ -300,24 +316,26 @@ i3GEOF.area = |
300 | 316 | m.removeControle(); |
301 | 317 | m.numpontos = 0; |
302 | 318 | i3GEO.eventos.cliquePerm.ativa(); |
303 | - | |
304 | - var features, n, f, i, remover = [], temp; | |
305 | - features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
306 | - n = features.length; | |
307 | - for (i = 0; i < n; i++) { | |
308 | - f = features[i]; | |
309 | - if (f.getProperties().origem === "i3GeoMedeArea" || f.getProperties().origem === "medeAreaExcluir") { | |
310 | - remover.push(f); | |
311 | - } | |
312 | - } | |
313 | - if (remover.length > 0) { | |
314 | - temp = window.confirm($trad("x94")); | |
315 | - if (temp) { | |
316 | - for (r in remover) { | |
317 | - i3GEO.desenho.layergrafico.getSource().removeFeature(remover[r]); | |
318 | - } | |
319 | - } | |
320 | - } | |
319 | + i3GEOF.area.openlayers.removeFiguras(); | |
320 | + }, | |
321 | + removeFiguras : function(){ | |
322 | + var features, n, f, i, remover = [], temp; | |
323 | + features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
324 | + n = features.length; | |
325 | + for (i = 0; i < n; i++) { | |
326 | + f = features[i]; | |
327 | + if (f.getProperties().origem === "i3GeoMedeArea" || f.getProperties().origem === "medeAreaExcluir") { | |
328 | + remover.push(f); | |
329 | + } | |
330 | + } | |
331 | + if (remover.length > 0) { | |
332 | + temp = window.confirm($trad("x94")); | |
333 | + if (temp) { | |
334 | + for (r in remover) { | |
335 | + i3GEO.desenho.layergrafico.getSource().removeFeature(remover[r]); | |
336 | + } | |
337 | + } | |
338 | + } | |
321 | 339 | }, |
322 | 340 | /** |
323 | 341 | * Mostra a totalizacao das linhas ja digitalizadas |
... | ... | @@ -425,7 +443,8 @@ i3GEOF.area = |
425 | 443 | i3GEOF.area.ultimoWkt = i3GEOF.area.pontos2wkt(); |
426 | 444 | }; |
427 | 445 | evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) { |
428 | - var area = 0, per; | |
446 | + i3GEO.eventos.cliquePerm.desativa(); | |
447 | + var area = 0, per; | |
429 | 448 | // When the map is clicked, pass the LatLng obect to the |
430 | 449 | // measureAdd function |
431 | 450 | pontos.mvcLine.push(evt.latLng); |
... | ... | @@ -525,17 +544,20 @@ i3GEOF.area = |
525 | 544 | i3GeoMap.setOptions({ |
526 | 545 | draggableCursor : undefined |
527 | 546 | }); |
528 | - var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "medeArea"); | |
529 | - if (f && f.length > 0) { | |
530 | - temp = window.confirm($trad("x94")); | |
531 | - if (temp) { | |
532 | - i3GEO.desenho.googlemaps.destroyFeatures(f); | |
533 | - } | |
534 | - } | |
535 | - f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "medeAreaExcluir"); | |
536 | - if (f && f.length > 0) { | |
537 | - i3GEO.desenho.googlemaps.destroyFeatures(f); | |
538 | - } | |
547 | + i3GEOF.area.googlemaps.removeFiguras(); | |
548 | + }, | |
549 | + removeFiguras: function(){ | |
550 | + var temp, f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "medeArea"); | |
551 | + if (f && f.length > 0) { | |
552 | + temp = window.confirm($trad("x94")); | |
553 | + if (temp) { | |
554 | + i3GEO.desenho.googlemaps.destroyFeatures(f); | |
555 | + } | |
556 | + } | |
557 | + f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "medeAreaExcluir"); | |
558 | + if (f && f.length > 0) { | |
559 | + i3GEO.desenho.googlemaps.destroyFeatures(f); | |
560 | + } | |
539 | 561 | }, |
540 | 562 | /** |
541 | 563 | * Mostra a totalizacao das linhas ja digitalizadas | ... | ... |
ferramentas/area/template_mst.html
... | ... | @@ -2,4 +2,5 @@ |
2 | 2 | <div id="mostraarea_calculo"><h5 class="alert alert-info">{{{inicia}}}</h5></div> |
3 | 3 | <div id="mostraarea_calculo_parcial"></div> |
4 | 4 | <button onclick="i3GEO.mapa.dialogo.wkt2layer(i3GEOF.area.ultimoWkt, i3GEOF.area.ultimaMedida);" class='btn btn-primary btn-sm btn-raised'>{{{incorporar}}}</button> |
5 | + <button onclick="i3GEOF.area.removeFiguras()" class='btn btn-primary btn-sm btn-raised'>{{{remover}}}</button> | |
5 | 6 | </div> |
6 | 7 | \ No newline at end of file | ... | ... |
ferramentas/distancia/dicionario.js
1 | 1 | //+$trad(1,i3GEOF.distancia.dicionario)+ |
2 | 2 | i3GEOF.distancia.dicionario = { |
3 | 3 | 'incorporar' : [{ |
4 | - pt : "Incorporar figura ao mapa", | |
4 | + pt : "Incorporar figura", | |
5 | 5 | en : "Add shape to map", |
6 | 6 | es : "Agregar figura al mapa" |
7 | 7 | }], |
... | ... | @@ -14,5 +14,10 @@ i3GEOF.distancia.dicionario = { |
14 | 14 | pt : "Clique em diferentes pontos do mapa para traçar uma linha", |
15 | 15 | en : "Click on different points on the map to draw a line", |
16 | 16 | es : "Haga clic en diferentes puntos del mapa para trazar una línea" |
17 | - }] | |
17 | + }], | |
18 | + 'remover' : [{ | |
19 | + pt : "Remover figura", | |
20 | + en : "", | |
21 | + es : "" | |
22 | + }] | |
18 | 23 | }; | ... | ... |
ferramentas/distancia/index.js
... | ... | @@ -58,6 +58,13 @@ i3GEOF.distancia = |
58 | 58 | var ins = Mustache.render(i3GEOF.distancia.MUSTACHE, i3GEOF.distancia.mustacheHash()); |
59 | 59 | return ins; |
60 | 60 | }, |
61 | + isOn : function() { | |
62 | + if($i("i3GEOF.distancia")){ | |
63 | + return true; | |
64 | + } else { | |
65 | + return false; | |
66 | + } | |
67 | + }, | |
61 | 68 | /* |
62 | 69 | * Function: iniciaJanelaFlutuante |
63 | 70 | * |
... | ... | @@ -95,8 +102,8 @@ i3GEOF.distancia = |
95 | 102 | ); |
96 | 103 | divid = janela[2].id; |
97 | 104 | i3GEOF.distancia.inicia(divid); |
98 | - temp = | |
99 | - function() { | |
105 | + temp = function() { | |
106 | + i3GEO.distancia.pontos = {}; | |
100 | 107 | var janela; |
101 | 108 | i3GEO.eventos.cliquePerm.ativa(); |
102 | 109 | janela = YAHOO.i3GEO.janela.manager.find("distancia"); |
... | ... | @@ -105,6 +112,7 @@ i3GEOF.distancia = |
105 | 112 | janela.destroy(); |
106 | 113 | } |
107 | 114 | i3GEOF.distancia[i3GEO.Interface["ATUAL"]].fechaJanela(); |
115 | + | |
108 | 116 | i3GEO.analise.pontos = { |
109 | 117 | xpt : [], |
110 | 118 | ypt : [] |
... | ... | @@ -131,6 +139,9 @@ i3GEOF.distancia = |
131 | 139 | } |
132 | 140 | return "LINESTRING(" + pontos.join(",") + ")"; |
133 | 141 | }, |
142 | + removeFiguras : function(){ | |
143 | + i3GEOF.distancia[i3GEO.Interface["ATUAL"]].removeFiguras(); | |
144 | + }, | |
134 | 145 | /** |
135 | 146 | * Funcoes especificas da interface openlayers |
136 | 147 | */ |
... | ... | @@ -246,6 +257,7 @@ i3GEOF.distancia = |
246 | 257 | } |
247 | 258 | }, |
248 | 259 | point : function(point) { |
260 | + i3GEO.eventos.cliquePerm.desativa(); | |
249 | 261 | var n, x1, y1, x2, y2, trecho, temp, circ, label, raio, |
250 | 262 | estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao], |
251 | 263 | coord = point.getCoordinates(), |
... | ... | @@ -360,7 +372,9 @@ i3GEOF.distancia = |
360 | 372 | m.removeControle(); |
361 | 373 | m.numpontos = 0; |
362 | 374 | i3GEO.eventos.cliquePerm.ativa(); |
363 | - | |
375 | + i3GEOF.distancia.openlayers.removeFiguras(); | |
376 | + }, | |
377 | + removeFiguras: function(){ | |
364 | 378 | var features, n, f, i, remover = [], temp; |
365 | 379 | features = i3GEO.desenho.layergrafico.getSource().getFeatures(); |
366 | 380 | n = features.length; |
... | ... | @@ -470,6 +484,7 @@ i3GEOF.distancia = |
470 | 484 | } |
471 | 485 | }; |
472 | 486 | evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) { |
487 | + i3GEO.eventos.cliquePerm.desativa(); | |
473 | 488 | var x1, x2, y1, y2, trecho = 0, total, n; |
474 | 489 | // When the map is clicked, pass the LatLng obect to the |
475 | 490 | // measureAdd function |
... | ... | @@ -592,6 +607,9 @@ i3GEOF.distancia = |
592 | 607 | i3GeoMap.setOptions({ |
593 | 608 | draggableCursor : undefined |
594 | 609 | }); |
610 | + i3GEOF.distancia.googlemaps.removeFiguras(); | |
611 | + }, | |
612 | + removeFiguras: function(){ | |
595 | 613 | var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "medeDistancia"); |
596 | 614 | if (f && f.length > 0) { |
597 | 615 | temp = window.confirm($trad("x94")); | ... | ... |
ferramentas/distancia/template_mst.html
1 | 1 | <div class='container-fluid'> |
2 | - <div id="mostradistancia_calculo"> | |
3 | - <h5 class="alert alert-info">{{{inicia}}}</h5> | |
4 | - </div> | |
5 | - <div id="mostradistancia_calculo_movel"></div> | |
6 | - <button onclick="i3GEO.mapa.dialogo.wkt2layer(i3GEOF.distancia.ultimoWkt, i3GEOF.distancia.ultimaMedida);" class='btn btn-primary btn-sm btn-raised'>{{{incorporar}}}</button> | |
2 | + <div id="mostradistancia_calculo"> | |
3 | + <h5 class="alert alert-info">{{{inicia}}}</h5> | |
4 | + </div> | |
5 | + <div id="mostradistancia_calculo_movel"></div> | |
6 | + <button onclick="i3GEO.mapa.dialogo.wkt2layer(i3GEOF.distancia.ultimoWkt, i3GEOF.distancia.ultimaMedida);" class='btn btn-primary btn-sm btn-raised'>{{{incorporar}}}</button> | |
7 | + <button onclick="i3GEOF.distancia.removeFiguras()" class='btn btn-primary btn-sm btn-raised'>{{{remover}}}</button> | |
7 | 8 | |
8 | - <button onclick="$('#i3GEOFdistanciaExpande').collapse('toggle')" role="button" class="btn btn-default btn-xs"> | |
9 | - <span class="text-primary readMore"> | |
10 | - <i class="material-icons">keyboard_arrow_down</i> | |
11 | - </span> | |
12 | - <span class="text-primary readLess"> | |
13 | - <i class="material-icons">keyboard_arrow_up</i> | |
14 | - </span> | |
15 | - </button> | |
9 | + <button onclick="$('#i3GEOFdistanciaExpande').collapse('toggle')" role="button" class="btn btn-default btn-xs"> | |
10 | + <span class="text-primary readMore"> <i class="material-icons">keyboard_arrow_down</i> | |
11 | + </span> <span class="text-primary readLess"> <i class="material-icons">keyboard_arrow_up</i> | |
12 | + </span> | |
13 | + </button> | |
16 | 14 | |
17 | - <div id="i3GEOFdistanciaExpande" class="collapse"> | |
18 | - <div class="form-group condensed"> | |
19 | - <div class="checkbox text-left" style="display: inline;"> | |
20 | - <label> | |
21 | - <input checked id='pararraios' type="checkbox"> | |
22 | - <span class="checkbox-material noprint"> | |
23 | - <span class="check"></span> | |
24 | - </span> | |
25 | - Raios | |
26 | - </label> | |
27 | - </div> | |
15 | + <div id="i3GEOFdistanciaExpande" class="collapse"> | |
16 | + <div class="form-group condensed"> | |
17 | + <div class="checkbox text-left" style="display: inline;"> | |
18 | + <label> <input checked id='pararraios' type="checkbox"> <span class="checkbox-material noprint"> <span class="check"></span> | |
19 | + </span> Raios | |
20 | + </label> | |
21 | + </div> | |
28 | 22 | |
29 | - <div class="checkbox text-left" style="display: inline;"> | |
30 | - <label> | |
31 | - <input checked id='parartextos' type="checkbox"> | |
32 | - <span class="checkbox-material noprint"> | |
33 | - <span class="check"></span> | |
34 | - </span> | |
35 | - Textos | |
36 | - </label> | |
37 | - </div> | |
38 | - </div> | |
39 | - <div class='form-group label-fixed condensed' style="display: inline;"> | |
40 | - <label class="control-label" for="">Estilo</label> | |
41 | - <div style="width: 100%;" class="input-group">{{{caixaDeEstilos}}}</div> | |
42 | - </div> | |
43 | - <button onclick="i3GEOF.distancia.perfil();" class='btn btn-primary btn-sm btn-raised'>{{{perfilDistancia}}}</button> | |
44 | - </div> | |
23 | + <div class="checkbox text-left" style="display: inline;"> | |
24 | + <label> <input checked id='parartextos' type="checkbox"> <span class="checkbox-material noprint"> <span class="check"></span> | |
25 | + </span> Textos | |
26 | + </label> | |
27 | + </div> | |
28 | + </div> | |
29 | + <div class='form-group label-fixed condensed' style="display: inline;"> | |
30 | + <label class="control-label" for="">Estilo</label> | |
31 | + <div style="width: 100%;" class="input-group">{{{caixaDeEstilos}}}</div> | |
32 | + </div> | |
33 | + <button onclick="i3GEOF.distancia.perfil();" class='btn btn-primary btn-sm btn-raised'>{{{perfilDistancia}}}</button> | |
34 | + </div> | |
45 | 35 | </div> |
46 | 36 | \ No newline at end of file | ... | ... |