Commit 3226bb828117c7b75ef5492aeae1ade54a5395f7

Authored by Edmar Moretti
1 parent 5fb57828

Adaptação da ferramenta de cálculo de área para Bootstrap

ferramentas/area/dicionario.js
1 //+$trad(1,i3GEOF.area.dicionario)+ 1 //+$trad(1,i3GEOF.area.dicionario)+
2 i3GEOF.area.dicionario = { 2 i3GEOF.area.dicionario = {
3 - 'ajuda' : [{  
4 - pt : "", 3 + 'incorporar' : [{
  4 + pt : "Incroporar figura ao mapa",
  5 + en : "",
  6 + es : ""
  7 + }],
  8 + 'inicia' : [{
  9 + pt : "Clique em diferentes pontos do mapa para traçar um polígono",
5 en : "", 10 en : "",
6 es : "" 11 es : ""
7 }] 12 }]
ferramentas/area/index.js
@@ -20,24 +20,22 @@ i3GEOF.area = @@ -20,24 +20,22 @@ i3GEOF.area =
20 * Susbtitutos para o template 20 * Susbtitutos para o template
21 */ 21 */
22 mustacheHash : function() { 22 mustacheHash : function() {
23 - 23 + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.area.dicionario);
  24 + dicionario["sid"] = i3GEO.configura.sid;
  25 + dicionario["locaplic"] = i3GEO.configura.locaplic;
  26 + return dicionario;
24 }, 27 },
25 inicia : function(iddiv) { 28 inicia : function(iddiv) {
  29 + if(i3GEOF.area.MUSTACHE == ""){
  30 + $.get(i3GEO.configura.locaplic + "/ferramentas/area/template_mst.html", function(template) {
  31 + i3GEOF.area.MUSTACHE = template;
  32 + i3GEOF.area.inicia(iddiv);
  33 + });
  34 + return;
  35 + }
26 i3GEO.eventos.cliquePerm.desativa(); 36 i3GEO.eventos.cliquePerm.desativa();
27 $i(iddiv).innerHTML += i3GEOF.area.html(); 37 $i(iddiv).innerHTML += i3GEOF.area.html();
28 i3GEOF.area[i3GEO.Interface["ATUAL"]].inicia(); 38 i3GEOF.area[i3GEO.Interface["ATUAL"]].inicia();
29 - //  
30 - // botao que abre a ferramenta de calculo de perfis.  
31 - // pontosdistobj contem as coordenadas dos pontos  
32 - //  
33 - new YAHOO.widget.Button("i3GEObotaoAreaWkt", {  
34 - onclick : {  
35 - fn : function() {  
36 - i3GEO.mapa.dialogo.wkt2layer(i3GEOF.area.ultimoWkt, i3GEOF.area.ultimaMedida);  
37 - }  
38 - }  
39 - });  
40 -  
41 }, 39 },
42 /* 40 /*
43 * Function: html 41 * Function: html
@@ -49,13 +47,7 @@ i3GEOF.area = @@ -49,13 +47,7 @@ i3GEOF.area =
49 * String com o código html 47 * String com o código html
50 */ 48 */
51 html : function() { 49 html : function() {
52 - var ins = '<div class="bd" style="text-align:left;padding:3px;font-size:10px" >'  
53 - // + '<label class=paragrafo style="float:left;top:5px;position:relative;">Estilo:</label>'  
54 - // + '<div class=styled-select style="width:70px;">' + i3GEO.desenho.caixaEstilos() + '</div><br>'  
55 - + '<div style="text-align:left;padding:3px;font-size:10px" id="mostraarea_calculo" ></div>'  
56 - + '<div style="text-align:left;padding:3px;font-size:10px" id="mostraarea_calculo_parcial" ></div>'  
57 - + '<br><input id=i3GEObotaoAreaWkt size="22" type="button" value="incorporar">'  
58 - + '</div>'; 50 + var ins = Mustache.render(i3GEOF.area.MUSTACHE, i3GEOF.area.mustacheHash());
59 return ins; 51 return ins;
60 }, 52 },
61 /* 53 /*
@@ -72,12 +64,29 @@ i3GEOF.area = @@ -72,12 +64,29 @@ i3GEOF.area =
72 minimiza = ""; 64 minimiza = "";
73 // cria a janela flutuante 65 // cria a janela flutuante
74 titulo = 66 titulo =
75 - "</div>"  
76 - + "<a class='i3GeoTituloJanelaBs' target=_blank href='" 67 + "</div><a class='i3GeoTituloJanelaBs' target=_blank href='"
77 + i3GEO.configura.locaplic 68 + i3GEO.configura.locaplic
78 + "/ajuda_usuario.php?idcategoria=6&idajuda=51' >"+$trad("areaAprox")+"</a>"; 69 + "/ajuda_usuario.php?idcategoria=6&idajuda=51' >"+$trad("areaAprox")+"</a>";
79 janela = 70 janela =
80 - i3GEO.janela.cria("220px", "auto", "", "", "", titulo, "i3GEOF.area", false, "hd", cabecalho, minimiza, "", true, "", "", "nao"); 71 + i3GEO.janela.cria(
  72 + "250px",
  73 + "auto",
  74 + "",
  75 + "",
  76 + "",
  77 + titulo,
  78 + "i3GEOF.area",
  79 + false,
  80 + "hd",
  81 + cabecalho,
  82 + minimiza,
  83 + "",
  84 + true,
  85 + "",
  86 + "",
  87 + "nao",
  88 + ""
  89 + );
81 divid = janela[2].id; 90 divid = janela[2].id;
82 i3GEOF.area.inicia(divid); 91 i3GEOF.area.inicia(divid);
83 temp = 92 temp =
@@ -319,25 +328,22 @@ i3GEOF.area = @@ -319,25 +328,22 @@ i3GEOF.area =
319 var mostra = $i("mostraarea_calculo"), texto; 328 var mostra = $i("mostraarea_calculo"), texto;
320 if (mostra) { 329 if (mostra) {
321 texto = 330 texto =
322 - "<b>" + $trad("d21at")  
323 - + ":</b> " 331 + "total <br>" + $trad("d21at")
  332 + + " km2: "
324 + (area / 1000000).toFixed(3) 333 + (area / 1000000).toFixed(3)
325 - + " km2"  
326 - + "<br><b>" 334 + + "<br>"
327 + $trad("d21at") 335 + $trad("d21at")
328 - + ":</b> " 336 + + " ha: "
329 + (area / 10000).toFixed(2) 337 + (area / 10000).toFixed(2)
330 - + " ha"  
331 - + "<br><b>" 338 + + "<br>"
332 + $trad("x98") 339 + $trad("x98")
333 - + ":</b> " 340 + + " km: "
334 + (per).toFixed(2) 341 + (per).toFixed(2)
335 - + " km"  
336 + "<br>" 342 + "<br>"
337 + $trad("x25") 343 + $trad("x25")
338 + ": " 344 + ": "
339 + i3GEO.calculo.metododistancia; 345 + i3GEO.calculo.metododistancia;
340 - mostra.innerHTML = texto; 346 + mostra.innerHTML = texto + "<hr>";
341 i3GEOF.area.ultimaMedida = (area / 1000000).toFixed(3) + " km2"; 347 i3GEOF.area.ultimaMedida = (area / 1000000).toFixed(3) + " km2";
342 } 348 }
343 }, 349 },
@@ -348,28 +354,24 @@ i3GEOF.area = @@ -348,28 +354,24 @@ i3GEOF.area =
348 var mostra = $i("mostraarea_calculo_parcial"), texto; 354 var mostra = $i("mostraarea_calculo_parcial"), texto;
349 if (mostra) { 355 if (mostra) {
350 texto = 356 texto =
351 - "<b>" + $trad("d21at")  
352 - + ":</b> " 357 + "parcial <br>" + $trad("d21at")
  358 + + " km2:"
353 + (area / 1000000).toFixed(3) 359 + (area / 1000000).toFixed(3)
354 - + " km2"  
355 - + "<br><b>" 360 + + "<br>"
356 + $trad("d21at") 361 + $trad("d21at")
357 - + ":</b> " 362 + + " ha: "
358 + (area / 10000).toFixed(2) 363 + (area / 10000).toFixed(2)
359 - + " ha"  
360 - + "<br><b>" 364 + + "<br>"
361 + $trad("x95") 365 + $trad("x95")
362 - + ":</b> " 366 + + " km: "
363 + trecho.toFixed(3) 367 + trecho.toFixed(3)
364 - + " km"  
365 - + "<br><b>" 368 + + "<br>"
366 + $trad("x98") 369 + $trad("x98")
367 - + ":</b> " 370 + + " km: "
368 + (per).toFixed(3) 371 + (per).toFixed(3)
369 - + " km"  
370 - + "<br><b>" 372 + + "<br>"
371 + $trad("x23") 373 + $trad("x23")
372 - + " (DMS):</b> " 374 + + " (DMS):"
373 + direcao; 375 + direcao;
374 mostra.innerHTML = texto; 376 mostra.innerHTML = texto;
375 } 377 }
@@ -544,25 +546,22 @@ i3GEOF.area = @@ -544,25 +546,22 @@ i3GEOF.area =
544 var mostra = $i("mostraarea_calculo"), texto; 546 var mostra = $i("mostraarea_calculo"), texto;
545 if (mostra) { 547 if (mostra) {
546 texto = 548 texto =
547 - "<b>" + $trad("d21at")  
548 - + ":</b> " 549 + "total<br>" + $trad("d21at")
  550 + + " km2: "
549 + (area / 1000000).toFixed(3) 551 + (area / 1000000).toFixed(3)
550 - + " km2"  
551 - + "<br><b>" 552 + + "<br>"
552 + $trad("d21at") 553 + $trad("d21at")
553 - + ":</b> " 554 + + " ha: "
554 + (area / 10000).toFixed(2) 555 + (area / 10000).toFixed(2)
555 - + " ha"  
556 - + "<br><b>" 556 + + "<br>"
557 + $trad("x98") 557 + $trad("x98")
558 - + ":</b> " 558 + + " km: "
559 + (per).toFixed(2) 559 + (per).toFixed(2)
560 - + " km"  
561 + "<br>" 560 + "<br>"
562 + $trad("x25") 561 + $trad("x25")
563 + ": " 562 + ": "
564 + i3GEO.calculo.metododistancia; 563 + i3GEO.calculo.metododistancia;
565 - mostra.innerHTML = texto; 564 + mostra.innerHTML = texto + "<hr>";
566 i3GEOF.area.ultimaMedida = (area / 1000000).toFixed(3) + " km2"; 565 i3GEOF.area.ultimaMedida = (area / 1000000).toFixed(3) + " km2";
567 } 566 }
568 }, 567 },
@@ -573,28 +572,24 @@ i3GEOF.area = @@ -573,28 +572,24 @@ i3GEOF.area =
573 var mostra = $i("mostraarea_calculo_parcial"), texto; 572 var mostra = $i("mostraarea_calculo_parcial"), texto;
574 if (mostra) { 573 if (mostra) {
575 texto = 574 texto =
576 - "<b>" + $trad("d21at")  
577 - + ":</b> " 575 + "parcial<br>" + $trad("d21at")
  576 + + " km2: "
578 + (area / 1000000).toFixed(3) 577 + (area / 1000000).toFixed(3)
579 - + " km2"  
580 - + "<br><b>" 578 + + "<br>"
581 + $trad("d21at") 579 + $trad("d21at")
582 - + ":</b> " 580 + + " ha: "
583 + (area / 10000).toFixed(2) 581 + (area / 10000).toFixed(2)
584 - + " ha"  
585 - + "<br><b>" 582 + + "<br>"
586 + $trad("x95") 583 + $trad("x95")
587 - + ":</b> " 584 + + " km: "
588 + trecho.toFixed(3) 585 + trecho.toFixed(3)
589 - + " km"  
590 - + "<br><b>" 586 + + "<br>"
591 + $trad("x98") 587 + $trad("x98")
592 - + ":</b> " 588 + + " km: "
593 + (per).toFixed(3) 589 + (per).toFixed(3)
594 - + " km"  
595 - + "<br><b>" 590 + + "<br>"
596 + $trad("x23") 591 + $trad("x23")
597 - + " (DMS):</b> " 592 + + " (DMS): "
598 + direcao; 593 + direcao;
599 mostra.innerHTML = texto; 594 mostra.innerHTML = texto;
600 } 595 }
ferramentas/area/template_mst.html
1 -<div></div>  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +<div class='container-fluid'>
  3 + <h5 class="alert alert-info">{{{inicia}}}</h5>
  4 + <div id="mostraarea_calculo"></div>
  5 + <div id="mostraarea_calculo_parcial"></div>
  6 + <button onclick="i3GEO.mapa.dialogo.wkt2layer(i3GEOF.area.ultimoWkt, i3GEOF.area.ultimaMedida);" class='btn btn-primary btn-sm btn-raised'>{{{incorporar}}}</button>
  7 +</div>
3 \ No newline at end of file 8 \ No newline at end of file