Commit 7ec1d02e644853bd159b2e342fd6758178495b74
1 parent
525cb5b5
Exists in
master
and in
7 other branches
-
Showing
2 changed files
with
327 additions
and
226 deletions
Show diff stats
classesjs/classe_analise.js
| ... | ... | @@ -317,7 +317,7 @@ i3GEO.analise = { |
| 317 | 317 | var janela; |
| 318 | 318 | i3GEO.eventos.cliquePerm.ativa(); |
| 319 | 319 | //@TODO remover |
| 320 | - if(i3GEO.Interface.ATUAL !== "openlayers"){ | |
| 320 | + if(i3GEO.Interface.ATUAL !== "openlayers" && i3GEO.Interface.ATUAL !== "googlemaps"){ | |
| 321 | 321 | i3GEO.Interface.ATUAL !== "googleearth" ? i3GEO.desenho.richdraw.fecha() : i3GEO.Interface.googleearth.removePlacemark("divGeometriasTemp"); |
| 322 | 322 | i3GEO.util.removeChild("pontosins"); |
| 323 | 323 | if($i("divGeometriasTemp")) |
| ... | ... | @@ -436,7 +436,7 @@ i3GEO.analise = { |
| 436 | 436 | //raio |
| 437 | 437 | if($i("pararraios") && $i("pararraios").checked === true ){ |
| 438 | 438 | circ = new OpenLayers.Feature.Vector( |
| 439 | - OpenLayers.Geometry.Polygon.createRegularPolygon( | |
| 439 | + OpenLayers.Geometry.Polygon.createRegularPolygon( | |
| 440 | 440 | point, |
| 441 | 441 | raio, |
| 442 | 442 | 30 |
| ... | ... | @@ -548,29 +548,126 @@ i3GEO.analise = { |
| 548 | 548 | } |
| 549 | 549 | }, |
| 550 | 550 | googlemaps:{ |
| 551 | + /** | |
| 552 | + * Inicializa o processo | |
| 553 | + * Cria a variavel para guardar os pontos | |
| 554 | + * Executa a funcao de inicializacao do desenho, que cria o layer para receber os graficos | |
| 555 | + */ | |
| 551 | 556 | inicia: function(){ |
| 552 | - if (g_tipoacao !== "mede"){ | |
| 553 | - if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEO.analise.medeDistancia.clique()") < 0) | |
| 554 | - {i3GEO.eventos.MOUSECLIQUE.push("i3GEO.analise.medeDistancia.clique()");} | |
| 555 | - if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.analise.medeDistancia.movimento()") < 0) | |
| 556 | - {i3GEO.eventos.MOUSEMOVE.push("i3GEO.analise.medeDistancia.movimento()");} | |
| 557 | - if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.analise.medeDistancia.fechaJanela()") < 0) | |
| 558 | - {i3GEO.eventos.NAVEGAMAPA.push("i3GEO.analise.medeDistancia.fechaJanela()");} | |
| 559 | - $i("mostradistancia").style.display="block"; | |
| 560 | - i3GEO.desenho.criaContainerRichdraw(); | |
| 561 | - i3GEO.desenho.richdraw.lineColor = "black"; | |
| 562 | - i3GEO.desenho.richdraw.lineWidth = "2px"; | |
| 563 | - g_tipoacao = "mede"; | |
| 564 | - } | |
| 565 | - else{ | |
| 566 | - i3GEO.desenho.richdraw.fecha(); | |
| 567 | - var Dom = YAHOO.util.Dom; | |
| 568 | - Dom.setStyle("mostradistancia","display","none"); | |
| 569 | - Dom.setStyle("pontosins","display","none"); | |
| 557 | + var linha,evtclick,evtmousemove, | |
| 558 | + estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao]; | |
| 559 | + i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); | |
| 560 | + i3GeoMap.setOptions({disableDoubleClickZoom:true}); | |
| 561 | + i3GEO.analise.medeDistancia.pontos = { | |
| 562 | + xpt: [], | |
| 563 | + ypt: [], | |
| 564 | + dist: [], | |
| 565 | + mvcLine: new google.maps.MVCArray(), | |
| 566 | + mvcMarkers: new google.maps.MVCArray(), | |
| 567 | + line: null, | |
| 568 | + polygon: null | |
| 569 | + }; | |
| 570 | + var pontos = i3GEO.analise.medeDistancia.pontos; | |
| 571 | + evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) { | |
| 572 | + // When the map is clicked, pass the LatLng obect to the measureAdd function | |
| 573 | + pontos.mvcLine.push(evt.latLng); | |
| 574 | + pontos.xpt.push(evt.latLng.lng()); | |
| 575 | + pontos.ypt.push(evt.latLng.lat()); | |
| 576 | + //mais um ponto para criar uma linha movel | |
| 577 | + pontos.mvcLine.push(evt.latLng); | |
| 578 | + }); | |
| 579 | + evtmousemove = google.maps.event.addListener(i3GeoMap, "mousemove", function(evt) { | |
| 580 | + // If there is more than one vertex on the line | |
| 581 | + if (pontos.mvcLine.getLength() > 1) { | |
| 582 | + // If the line hasn't been created yet | |
| 583 | + if (!pontos.line) { | |
| 584 | + // Create the line (google.maps.Polyline) | |
| 585 | + pontos.line = new google.maps.Polyline({ | |
| 586 | + map: i3GeoMap, | |
| 587 | + clickable: false, | |
| 588 | + strokeColor: "#FF0000", | |
| 589 | + strokeOpacity: 1, | |
| 590 | + strokeWeight: 3, | |
| 591 | + path:pontos.mvcLine | |
| 592 | + }); | |
| 593 | + } | |
| 594 | + pontos.mvcLine.pop(); | |
| 595 | + pontos.mvcLine.push(evt.latLng); | |
| 596 | + } | |
| 597 | + }); | |
| 598 | + google.maps.event.addListener(i3GeoMap, "dblclick", function(evt) { | |
| 599 | + google.maps.event.removeListener(evtclick); | |
| 600 | + google.maps.event.removeListener(evtmousemove); | |
| 601 | + i3GEO.analise.medeDistancia.googlemaps.inicia(); | |
| 602 | + }); | |
| 603 | + | |
| 604 | + }, | |
| 605 | + /** | |
| 606 | + * Soma os valores de distancia guardados em pontos.dist | |
| 607 | + */ | |
| 608 | + somaDist: function(){ | |
| 609 | + var n,i, | |
| 610 | + total = 0; | |
| 611 | + n = i3GEO.analise.medeDistancia.pontos.dist.length; | |
| 612 | + for(i=0;i<n;i++){ | |
| 613 | + total += i3GEO.analise.medeDistancia.pontos.dist[i]; | |
| 570 | 614 | } |
| 615 | + return total; | |
| 571 | 616 | }, |
| 617 | + /** | |
| 618 | + * Fecha a janela que mostra os dados | |
| 619 | + * Pergunta ao usuario se os graficos devem ser removidos | |
| 620 | + * Os graficos sao marcados com o atributo "origem" | |
| 621 | + * Os raios e pontos sao sempre removidos | |
| 622 | + */ | |
| 572 | 623 | fechaJanela: function(){ |
| 573 | - | |
| 624 | + i3GeoMap.setOptions({disableDoubleClickZoom:false}); | |
| 625 | + /* | |
| 626 | + var temp, | |
| 627 | + controle = i3geoOL.getControlsBy("id","i3GeoMedeDistancia"), | |
| 628 | + f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeDistancia"); | |
| 629 | + | |
| 630 | + if(controle.length > 0){ | |
| 631 | + controle[0].deactivate(); | |
| 632 | + i3geoOL.removeControl(controle[0]); | |
| 633 | + } | |
| 634 | + if(f && f.length > 0){ | |
| 635 | + temp = window.confirm($trad("x94")); | |
| 636 | + if(temp){ | |
| 637 | + i3GEO.desenho.layergrafico.destroyFeatures(f); | |
| 638 | + } | |
| 639 | + } | |
| 640 | + f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeDistanciaExcluir"); | |
| 641 | + if(f && f.length > 0){ | |
| 642 | + i3GEO.desenho.layergrafico.destroyFeatures(f); | |
| 643 | + } | |
| 644 | + */ | |
| 645 | + }, | |
| 646 | + /** | |
| 647 | + * Mostra a totalizacao das linhas ja digitalizadas | |
| 648 | + */ | |
| 649 | + mostraTotal: function(trecho,total){ | |
| 650 | + var mostra = $i("mostradistancia_calculo"), | |
| 651 | + texto; | |
| 652 | + if (mostra){ | |
| 653 | + texto = "<b>"+$trad("x96")+":</b> "+total.toFixed(3)+" km"+ | |
| 654 | + "<br><b>"+$trad("x96")+":</b> "+(total*1000).toFixed(2)+" m"+ | |
| 655 | + "<br>"+$trad("x25")+": "+i3GEO.calculo.metododistancia; | |
| 656 | + mostra.innerHTML = texto; | |
| 657 | + } | |
| 658 | + }, | |
| 659 | + /** | |
| 660 | + * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse | |
| 661 | + */ | |
| 662 | + mostraParcial: function(trecho,parcial,direcao){ | |
| 663 | + var mostra = $i("mostradistancia_calculo_movel"), | |
| 664 | + texto; | |
| 665 | + if (mostra){ | |
| 666 | + texto = "<b>"+$trad("x95")+":</b> "+trecho.toFixed(3)+" km"+ | |
| 667 | + "<br><b>"+$trad("x97")+":</b> "+(parcial + trecho).toFixed(3)+" km" + | |
| 668 | + "<br><b>"+$trad("x23")+" (DMS):</b> "+direcao.toFixed(4); | |
| 669 | + mostra.innerHTML = texto; | |
| 670 | + } | |
| 574 | 671 | } |
| 575 | 672 | }, |
| 576 | 673 | googleearth:{ |
| ... | ... | @@ -973,231 +1070,231 @@ i3GEO.analise = { |
| 973 | 1070 | } |
| 974 | 1071 | ); |
| 975 | 1072 | i3geoOL.addControl(poligono); |
| 976 | - } | |
| 977 | - }, | |
| 978 | - /** | |
| 979 | - * Soma os valores de distancia guardados em pontos.dist | |
| 980 | - */ | |
| 981 | - somaDist: function(){ | |
| 982 | - var n,i, | |
| 983 | - total = 0; | |
| 984 | - n = i3GEO.analise.medeArea.pontos.dist.length; | |
| 985 | - for(i=0;i<n;i++){ | |
| 986 | - total += i3GEO.analise.medeArea.pontos.dist[i]; | |
| 987 | - } | |
| 988 | - return total; | |
| 989 | - }, | |
| 990 | - /** | |
| 991 | - * Fecha a janela que mostra os dados | |
| 992 | - * Pergunta ao usuario se os graficos devem ser removidos | |
| 993 | - * Os graficos sao marcados com o atributo "origem" | |
| 994 | - * Os raios e pontos sao sempre removidos | |
| 995 | - */ | |
| 996 | - fechaJanela: function(){ | |
| 997 | - var temp, | |
| 998 | - controle = i3geoOL.getControlsBy("id","i3GeoMedeArea"), | |
| 999 | - f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeArea"); | |
| 1000 | - if(controle.length > 0){ | |
| 1001 | - controle[0].deactivate(); | |
| 1002 | - i3geoOL.removeControl(controle[0]); | |
| 1003 | - } | |
| 1004 | - if(f && f.length > 0){ | |
| 1005 | - temp = window.confirm($trad("x94")); | |
| 1006 | - if(temp){ | |
| 1073 | + } | |
| 1074 | + }, | |
| 1075 | + /** | |
| 1076 | + * Soma os valores de distancia guardados em pontos.dist | |
| 1077 | + */ | |
| 1078 | + somaDist: function(){ | |
| 1079 | + var n,i, | |
| 1080 | + total = 0; | |
| 1081 | + n = i3GEO.analise.medeArea.pontos.dist.length; | |
| 1082 | + for(i=0;i<n;i++){ | |
| 1083 | + total += i3GEO.analise.medeArea.pontos.dist[i]; | |
| 1084 | + } | |
| 1085 | + return total; | |
| 1086 | + }, | |
| 1087 | + /** | |
| 1088 | + * Fecha a janela que mostra os dados | |
| 1089 | + * Pergunta ao usuario se os graficos devem ser removidos | |
| 1090 | + * Os graficos sao marcados com o atributo "origem" | |
| 1091 | + * Os raios e pontos sao sempre removidos | |
| 1092 | + */ | |
| 1093 | + fechaJanela: function(){ | |
| 1094 | + var temp, | |
| 1095 | + controle = i3geoOL.getControlsBy("id","i3GeoMedeArea"), | |
| 1096 | + f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeArea"); | |
| 1097 | + if(controle.length > 0){ | |
| 1098 | + controle[0].deactivate(); | |
| 1099 | + i3geoOL.removeControl(controle[0]); | |
| 1100 | + } | |
| 1101 | + if(f && f.length > 0){ | |
| 1102 | + temp = window.confirm($trad("x94")); | |
| 1103 | + if(temp){ | |
| 1104 | + i3GEO.desenho.layergrafico.destroyFeatures(f); | |
| 1105 | + } | |
| 1106 | + } | |
| 1107 | + f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeAreaExcluir"); | |
| 1108 | + if(f && f.length > 0){ | |
| 1007 | 1109 | i3GEO.desenho.layergrafico.destroyFeatures(f); |
| 1008 | 1110 | } |
| 1009 | - } | |
| 1010 | - f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeAreaExcluir"); | |
| 1011 | - if(f && f.length > 0){ | |
| 1012 | - i3GEO.desenho.layergrafico.destroyFeatures(f); | |
| 1013 | - } | |
| 1014 | - }, | |
| 1015 | - /** | |
| 1016 | - * Mostra a totalizacao das linhas ja digitalizadas | |
| 1017 | - */ | |
| 1018 | - mostraTotal: function(per,area){ | |
| 1019 | - var mostra = $i("mostraarea_calculo"), | |
| 1020 | - texto; | |
| 1021 | - if (mostra){ | |
| 1022 | - texto = "<b>"+$trad("d21at")+":</b> "+(area/1000000).toFixed(3)+" km2"+ | |
| 1023 | - "<br><b>"+$trad("d21at")+":</b> "+(area/10000).toFixed(2)+" ha"+ | |
| 1024 | - "<br><b>"+$trad("x98")+":</b> "+(per).toFixed(2)+" km"+ | |
| 1025 | - "<br>"+$trad("x25")+": "+i3GEO.calculo.metododistancia; | |
| 1026 | - mostra.innerHTML = texto; | |
| 1111 | + }, | |
| 1112 | + /** | |
| 1113 | + * Mostra a totalizacao das linhas ja digitalizadas | |
| 1114 | + */ | |
| 1115 | + mostraTotal: function(per,area){ | |
| 1116 | + var mostra = $i("mostraarea_calculo"), | |
| 1117 | + texto; | |
| 1118 | + if (mostra){ | |
| 1119 | + texto = "<b>"+$trad("d21at")+":</b> "+(area/1000000).toFixed(3)+" km2"+ | |
| 1120 | + "<br><b>"+$trad("d21at")+":</b> "+(area/10000).toFixed(2)+" ha"+ | |
| 1121 | + "<br><b>"+$trad("x98")+":</b> "+(per).toFixed(2)+" km"+ | |
| 1122 | + "<br>"+$trad("x25")+": "+i3GEO.calculo.metododistancia; | |
| 1123 | + mostra.innerHTML = texto; | |
| 1124 | + } | |
| 1125 | + }, | |
| 1126 | + /** | |
| 1127 | + * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse | |
| 1128 | + */ | |
| 1129 | + mostraParcial: function(trecho,per,area,direcao){ | |
| 1130 | + var mostra = $i("mostraarea_calculo_parcial"), | |
| 1131 | + texto; | |
| 1132 | + if (mostra){ | |
| 1133 | + texto = "<b>"+$trad("d21at")+":</b> "+(area/1000000).toFixed(3)+" km2"+ | |
| 1134 | + "<br><b>"+$trad("d21at")+":</b> "+(area/10000).toFixed(2)+" ha"+ | |
| 1135 | + "<br><b>"+$trad("x95")+":</b> "+trecho.toFixed(3)+" km"+ | |
| 1136 | + "<br><b>"+$trad("x98")+":</b> "+(per).toFixed(3)+" km" + | |
| 1137 | + "<br><b>"+$trad("x23")+" (DMS):</b> "+direcao.toFixed(4); | |
| 1138 | + mostra.innerHTML = texto; | |
| 1139 | + } | |
| 1027 | 1140 | } |
| 1028 | 1141 | }, |
| 1029 | - /** | |
| 1030 | - * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse | |
| 1031 | - */ | |
| 1032 | - mostraParcial: function(trecho,per,area,direcao){ | |
| 1033 | - var mostra = $i("mostraarea_calculo_parcial"), | |
| 1034 | - texto; | |
| 1035 | - if (mostra){ | |
| 1036 | - texto = "<b>"+$trad("d21at")+":</b> "+(area/1000000).toFixed(3)+" km2"+ | |
| 1037 | - "<br><b>"+$trad("d21at")+":</b> "+(area/10000).toFixed(2)+" ha"+ | |
| 1038 | - "<br><b>"+$trad("x95")+":</b> "+trecho.toFixed(3)+" km"+ | |
| 1039 | - "<br><b>"+$trad("x98")+":</b> "+(per).toFixed(3)+" km" + | |
| 1040 | - "<br><b>"+$trad("x23")+" (DMS):</b> "+direcao.toFixed(4); | |
| 1041 | - mostra.innerHTML = texto; | |
| 1042 | - } | |
| 1043 | - } | |
| 1044 | - }, | |
| 1045 | - googlemaps: { | |
| 1046 | - inicia: function(){ | |
| 1047 | - var x,y,ll1,ll2,d, | |
| 1048 | - calculo = i3GEO.calculo, | |
| 1049 | - montacontainer = function(){ | |
| 1050 | - var desenho = i3GEO.desenho; | |
| 1051 | - $i("mostraarea_calculo").innerHTML = "Clique no mapa para desenhar o poligono. Clique duas vezes para concluir"; | |
| 1052 | - i3GEO.barraDeBotoes.ativaIcone("area"); | |
| 1053 | - g_tipoacao = "area"; | |
| 1054 | - desenho.criaContainerRichdraw(); | |
| 1055 | - desenho.richdraw.lineColor = "green"; | |
| 1056 | - desenho.richdraw.lineWidth = "2px"; | |
| 1057 | - }; | |
| 1058 | - i3GEO.analise.medeArea.criaJanela(); | |
| 1059 | - if (g_tipoacao !== "area"){ | |
| 1060 | - $i("mostraarea_calculo").innerHTML = ""; | |
| 1061 | - if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEO.analise.medeArea.clique()") < 0) | |
| 1062 | - {i3GEO.eventos.MOUSECLIQUE.push("i3GEO.analise.medeArea.clique()");} | |
| 1063 | - if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.analise.medeArea.movimento()") < 0) | |
| 1064 | - {i3GEO.eventos.MOUSEMOVE.push("i3GEO.analise.medeArea.movimento()");} | |
| 1065 | - if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.analise.medeArea.fechaJanela()") < 0) | |
| 1066 | - {i3GEO.eventos.NAVEGAMAPA.push("i3GEO.analise.medeArea.fechaJanela()");} | |
| 1067 | - // | |
| 1068 | - //a API do Openlayers e GoogleMaps tem uma funcao propria de obtencao da resolucao de cada pixel | |
| 1069 | - //essa funcao e embutida em i3GEO.calculo.tela2dd | |
| 1070 | - // | |
| 1071 | - if(i3GEO.util.in_array(i3GEO.Interface.ATUAL,["openlayers","googlemaps"])){ | |
| 1072 | - x = parseInt(i3GEO.parametros.w / 2,10); | |
| 1073 | - y = parseInt(i3GEO.parametros.h / 2,10); | |
| 1074 | - ll1 = calculo.tela2dd(x,y,"",""); | |
| 1075 | - ll2 = calculo.tela2dd(x + 1,y,"",""); | |
| 1076 | - d = calculo.distancia(ll1[0],ll1[1],ll2[0],ll2[1]); | |
| 1077 | - d = d * 1000; | |
| 1078 | - g_areapixel = d * d; | |
| 1079 | - g_areapixel < 0 ? i3GEO.janela.tempoMsg("Nao e possivel calcular a area. Entre em contato com o administrador do sistema.") : montacontainer(); | |
| 1142 | + googlemaps: { | |
| 1143 | + inicia: function(){ | |
| 1144 | + var x,y,ll1,ll2,d, | |
| 1145 | + calculo = i3GEO.calculo, | |
| 1146 | + montacontainer = function(){ | |
| 1147 | + var desenho = i3GEO.desenho; | |
| 1148 | + $i("mostraarea_calculo").innerHTML = "Clique no mapa para desenhar o poligono. Clique duas vezes para concluir"; | |
| 1149 | + i3GEO.barraDeBotoes.ativaIcone("area"); | |
| 1150 | + g_tipoacao = "area"; | |
| 1151 | + desenho.criaContainerRichdraw(); | |
| 1152 | + desenho.richdraw.lineColor = "green"; | |
| 1153 | + desenho.richdraw.lineWidth = "2px"; | |
| 1154 | + }; | |
| 1155 | + i3GEO.analise.medeArea.criaJanela(); | |
| 1156 | + if (g_tipoacao !== "area"){ | |
| 1157 | + $i("mostraarea_calculo").innerHTML = ""; | |
| 1158 | + if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEO.analise.medeArea.clique()") < 0) | |
| 1159 | + {i3GEO.eventos.MOUSECLIQUE.push("i3GEO.analise.medeArea.clique()");} | |
| 1160 | + if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.analise.medeArea.movimento()") < 0) | |
| 1161 | + {i3GEO.eventos.MOUSEMOVE.push("i3GEO.analise.medeArea.movimento()");} | |
| 1162 | + if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.analise.medeArea.fechaJanela()") < 0) | |
| 1163 | + {i3GEO.eventos.NAVEGAMAPA.push("i3GEO.analise.medeArea.fechaJanela()");} | |
| 1164 | + // | |
| 1165 | + //a API do Openlayers e GoogleMaps tem uma funcao propria de obtencao da resolucao de cada pixel | |
| 1166 | + //essa funcao e embutida em i3GEO.calculo.tela2dd | |
| 1167 | + // | |
| 1168 | + if(i3GEO.util.in_array(i3GEO.Interface.ATUAL,["openlayers","googlemaps"])){ | |
| 1169 | + x = parseInt(i3GEO.parametros.w / 2,10); | |
| 1170 | + y = parseInt(i3GEO.parametros.h / 2,10); | |
| 1171 | + ll1 = calculo.tela2dd(x,y,"",""); | |
| 1172 | + ll2 = calculo.tela2dd(x + 1,y,"",""); | |
| 1173 | + d = calculo.distancia(ll1[0],ll1[1],ll2[0],ll2[1]); | |
| 1174 | + d = d * 1000; | |
| 1175 | + g_areapixel = d * d; | |
| 1176 | + g_areapixel < 0 ? i3GEO.janela.tempoMsg("Nao e possivel calcular a area. Entre em contato com o administrador do sistema.") : montacontainer(); | |
| 1177 | + } | |
| 1080 | 1178 | } |
| 1179 | + else{i3GEO.desenho.richdraw.fecha();} | |
| 1180 | + }, | |
| 1181 | + fechaJanela: function(){ | |
| 1081 | 1182 | } |
| 1082 | - else{i3GEO.desenho.richdraw.fecha();} | |
| 1083 | 1183 | }, |
| 1084 | - fechaJanela: function(){ | |
| 1085 | - } | |
| 1086 | - }, | |
| 1087 | - googleearth: { | |
| 1088 | - inicia: function(){ | |
| 1089 | - var x,y,ll1,ll2,d, | |
| 1090 | - calculo = i3GEO.calculo, | |
| 1091 | - montacontainer = function(){ | |
| 1092 | - var desenho = i3GEO.desenho; | |
| 1093 | - $i("mostraarea_calculo").innerHTML = "Clique no mapa para desenhar o poligono. Clique duas vezes para concluir"; | |
| 1094 | - i3GEO.barraDeBotoes.ativaIcone("area"); | |
| 1095 | - g_tipoacao = "area"; | |
| 1096 | - desenho.criaContainerRichdraw(); | |
| 1097 | - desenho.richdraw.lineColor = "green"; | |
| 1098 | - desenho.richdraw.lineWidth = "2px"; | |
| 1099 | - }; | |
| 1100 | - i3GEO.analise.medeArea.criaJanela(); | |
| 1101 | - if (g_tipoacao !== "area"){ | |
| 1102 | - $i("mostraarea_calculo").innerHTML = ""; | |
| 1103 | - if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEO.analise.medeArea.clique()") < 0) | |
| 1104 | - {i3GEO.eventos.MOUSECLIQUE.push("i3GEO.analise.medeArea.clique()");} | |
| 1105 | - if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.analise.medeArea.movimento()") < 0) | |
| 1106 | - {i3GEO.eventos.MOUSEMOVE.push("i3GEO.analise.medeArea.movimento()");} | |
| 1107 | - if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.analise.medeArea.fechaJanela()") < 0) | |
| 1108 | - {i3GEO.eventos.NAVEGAMAPA.push("i3GEO.analise.medeArea.fechaJanela()");} | |
| 1109 | - // | |
| 1110 | - //a API do Openlayers e GoogleMaps tem uma funcao propria de obtencao da resolucao de cada pixel | |
| 1111 | - //essa funcao e embutida em i3GEO.calculo.tela2dd | |
| 1112 | - // | |
| 1113 | - if(i3GEO.util.in_array(i3GEO.Interface.ATUAL,["openlayers","googlemaps"])){ | |
| 1114 | - x = parseInt(i3GEO.parametros.w / 2,10); | |
| 1115 | - y = parseInt(i3GEO.parametros.h / 2,10); | |
| 1116 | - ll1 = calculo.tela2dd(x,y,"",""); | |
| 1117 | - ll2 = calculo.tela2dd(x + 1,y,"",""); | |
| 1118 | - d = calculo.distancia(ll1[0],ll1[1],ll2[0],ll2[1]); | |
| 1119 | - d = d * 1000; | |
| 1120 | - g_areapixel = d * d; | |
| 1121 | - g_areapixel < 0 ? i3GEO.janela.tempoMsg("Nao e possivel calcular a area. Entre em contato com o administrador do sistema.") : montacontainer(); | |
| 1184 | + googleearth: { | |
| 1185 | + inicia: function(){ | |
| 1186 | + var x,y,ll1,ll2,d, | |
| 1187 | + calculo = i3GEO.calculo, | |
| 1188 | + montacontainer = function(){ | |
| 1189 | + var desenho = i3GEO.desenho; | |
| 1190 | + $i("mostraarea_calculo").innerHTML = "Clique no mapa para desenhar o poligono. Clique duas vezes para concluir"; | |
| 1191 | + i3GEO.barraDeBotoes.ativaIcone("area"); | |
| 1192 | + g_tipoacao = "area"; | |
| 1193 | + desenho.criaContainerRichdraw(); | |
| 1194 | + desenho.richdraw.lineColor = "green"; | |
| 1195 | + desenho.richdraw.lineWidth = "2px"; | |
| 1196 | + }; | |
| 1197 | + i3GEO.analise.medeArea.criaJanela(); | |
| 1198 | + if (g_tipoacao !== "area"){ | |
| 1199 | + $i("mostraarea_calculo").innerHTML = ""; | |
| 1200 | + if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEO.analise.medeArea.clique()") < 0) | |
| 1201 | + {i3GEO.eventos.MOUSECLIQUE.push("i3GEO.analise.medeArea.clique()");} | |
| 1202 | + if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.analise.medeArea.movimento()") < 0) | |
| 1203 | + {i3GEO.eventos.MOUSEMOVE.push("i3GEO.analise.medeArea.movimento()");} | |
| 1204 | + if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.analise.medeArea.fechaJanela()") < 0) | |
| 1205 | + {i3GEO.eventos.NAVEGAMAPA.push("i3GEO.analise.medeArea.fechaJanela()");} | |
| 1206 | + // | |
| 1207 | + //a API do Openlayers e GoogleMaps tem uma funcao propria de obtencao da resolucao de cada pixel | |
| 1208 | + //essa funcao e embutida em i3GEO.calculo.tela2dd | |
| 1209 | + // | |
| 1210 | + if(i3GEO.util.in_array(i3GEO.Interface.ATUAL,["openlayers","googlemaps"])){ | |
| 1211 | + x = parseInt(i3GEO.parametros.w / 2,10); | |
| 1212 | + y = parseInt(i3GEO.parametros.h / 2,10); | |
| 1213 | + ll1 = calculo.tela2dd(x,y,"",""); | |
| 1214 | + ll2 = calculo.tela2dd(x + 1,y,"",""); | |
| 1215 | + d = calculo.distancia(ll1[0],ll1[1],ll2[0],ll2[1]); | |
| 1216 | + d = d * 1000; | |
| 1217 | + g_areapixel = d * d; | |
| 1218 | + g_areapixel < 0 ? i3GEO.janela.tempoMsg("Nao e possivel calcular a area. Entre em contato com o administrador do sistema.") : montacontainer(); | |
| 1219 | + } | |
| 1122 | 1220 | } |
| 1221 | + else{i3GEO.desenho.richdraw.fecha();} | |
| 1222 | + }, | |
| 1223 | + fechaJanela: function(){ | |
| 1123 | 1224 | } |
| 1124 | - else{i3GEO.desenho.richdraw.fecha();} | |
| 1125 | 1225 | }, |
| 1126 | - fechaJanela: function(){ | |
| 1127 | - } | |
| 1128 | - }, | |
| 1129 | 1226 | |
| 1130 | 1227 | |
| 1131 | 1228 | |
| 1132 | - //////////////////////////////////////////// | |
| 1133 | - /* | |
| 1229 | + //////////////////////////////////////////// | |
| 1230 | + /* | |
| 1134 | 1231 | Adiciona uma marca na tela e realiza o calculo de distancia dos pontos inseridos |
| 1135 | - */ | |
| 1136 | - clique: function(){ | |
| 1137 | - var n,m; | |
| 1138 | - pontosdistobj = i3GEO.analise.pontosdistobj; | |
| 1139 | - if (g_tipoacao === "area"){ | |
| 1140 | - n = pontosdistobj.xpt.length; | |
| 1141 | - pontosdistobj.xpt[n] = objposicaocursor.ddx; | |
| 1142 | - pontosdistobj.ypt[n] = objposicaocursor.ddy; | |
| 1143 | - pontosdistobj.xtela[n] = objposicaocursor.telax; | |
| 1144 | - pontosdistobj.ytela[n] = objposicaocursor.telay; | |
| 1145 | - pontosdistobj.ximg[n] = objposicaocursor.imgx; | |
| 1146 | - pontosdistobj.yimg[n] = objposicaocursor.imgy; | |
| 1147 | - pontosdistobj.dist[n] = 0; | |
| 1148 | - //inclui a linha para ligar com o ponto inicial | |
| 1149 | - if (n === 0){ | |
| 1150 | - try { | |
| 1151 | - pontosdistobj.linhastemp = i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, pontosdistobj.ximg[n]-1,pontosdistobj.yimg[n]-1,pontosdistobj.ximg[0]-1,pontosdistobj.yimg[0]-1); | |
| 1232 | + */ | |
| 1233 | + clique: function(){ | |
| 1234 | + var n,m; | |
| 1235 | + pontosdistobj = i3GEO.analise.pontosdistobj; | |
| 1236 | + if (g_tipoacao === "area"){ | |
| 1237 | + n = pontosdistobj.xpt.length; | |
| 1238 | + pontosdistobj.xpt[n] = objposicaocursor.ddx; | |
| 1239 | + pontosdistobj.ypt[n] = objposicaocursor.ddy; | |
| 1240 | + pontosdistobj.xtela[n] = objposicaocursor.telax; | |
| 1241 | + pontosdistobj.ytela[n] = objposicaocursor.telay; | |
| 1242 | + pontosdistobj.ximg[n] = objposicaocursor.imgx; | |
| 1243 | + pontosdistobj.yimg[n] = objposicaocursor.imgy; | |
| 1244 | + pontosdistobj.dist[n] = 0; | |
| 1245 | + //inclui a linha para ligar com o ponto inicial | |
| 1246 | + if (n === 0){ | |
| 1247 | + try { | |
| 1248 | + pontosdistobj.linhastemp = i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, pontosdistobj.ximg[n]-1,pontosdistobj.yimg[n]-1,pontosdistobj.ximg[0]-1,pontosdistobj.yimg[0]-1); | |
| 1249 | + } | |
| 1250 | + catch(e){ | |
| 1251 | + if(typeof(console) !== 'undefined'){console.error(e);} | |
| 1252 | + } | |
| 1152 | 1253 | } |
| 1153 | - catch(e){ | |
| 1154 | - if(typeof(console) !== 'undefined'){console.error(e);} | |
| 1254 | + else{ | |
| 1255 | + if(navm) | |
| 1256 | + {i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, (pontosdistobj.ximg[n-1]),pontosdistobj.yimg[n-1],(pontosdistobj.ximg[n]),pontosdistobj.yimg[n]);} | |
| 1257 | + //parece qe tem um problema de versao do ie aqui | |
| 1258 | + //if(navm) | |
| 1259 | + //{i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, (pontosdistobj.ximg[n-1])-(i3GEO.parametros.w/2),pontosdistobj.yimg[n-1],(pontosdistobj.ximg[n])-(i3GEO.parametros.w/2),pontosdistobj.yimg[n]);} | |
| 1155 | 1260 | } |
| 1261 | + try{ | |
| 1262 | + pontosdistobj.linhas[n] = i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, pontosdistobj.ximg[n]-1,pontosdistobj.yimg[n]-1,pontosdistobj.ximg[n]-1,pontosdistobj.yimg[n]-1); | |
| 1263 | + } | |
| 1264 | + catch(men){ | |
| 1265 | + if(typeof(console) !== 'undefined'){console.error(men);} | |
| 1266 | + } | |
| 1267 | + m = i3GEO.calculo.area(pontosdistobj.xtela,pontosdistobj.ytela,g_areapixel); | |
| 1268 | + i3GEO.util.defineValor("mostraarea_calculo","innerHTML","<br>m2</b>= "+m.toFixed(2)+"<br><b>km2</b>= "+(m/1000000).toFixed(2)+"<br><b>ha</b>= "+(m/10000).toFixed(2)); | |
| 1269 | + if(i3GEO.util.in_array(i3GEO.Interface.ATUAL,["openlayers","googlemaps"])){ | |
| 1270 | + i3GEO.util.insereMarca.cria(objposicaocursor.imgx,objposicaocursor.imgy,i3GEO.analise.medeArea.paraCalculo,"divGeometriasTemp","",i3GEO.configura.locaplic+"/imagens/estasel.png",6,6); | |
| 1271 | + i3GEO.desenho.insereCirculo(objposicaocursor.imgx,objposicaocursor.imgy,3,"white"); | |
| 1272 | + } | |
| 1273 | + if(i3GEO.Interface.ATUAL === "googleearth") | |
| 1274 | + {i3GEO.util.insereMarca.cria(objposicaocursor.ddx,objposicaocursor.ddy,i3GEO.analise.medeArea.paraCalculo,"divGeometriasTemp","");} | |
| 1156 | 1275 | } |
| 1157 | - else{ | |
| 1158 | - if(navm) | |
| 1159 | - {i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, (pontosdistobj.ximg[n-1]),pontosdistobj.yimg[n-1],(pontosdistobj.ximg[n]),pontosdistobj.yimg[n]);} | |
| 1160 | - //parece qe tem um problema de versao do ie aqui | |
| 1161 | - //if(navm) | |
| 1162 | - //{i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, (pontosdistobj.ximg[n-1])-(i3GEO.parametros.w/2),pontosdistobj.yimg[n-1],(pontosdistobj.ximg[n])-(i3GEO.parametros.w/2),pontosdistobj.yimg[n]);} | |
| 1163 | - } | |
| 1164 | - try{ | |
| 1165 | - pontosdistobj.linhas[n] = i3GEO.desenho.richdraw.renderer.create(i3GEO.desenho.richdraw.mode, i3GEO.desenho.richdraw.fillColor, i3GEO.desenho.richdraw.lineColor, i3GEO.desenho.richdraw.lineWidth, pontosdistobj.ximg[n]-1,pontosdistobj.yimg[n]-1,pontosdistobj.ximg[n]-1,pontosdistobj.yimg[n]-1); | |
| 1166 | - } | |
| 1167 | - catch(men){ | |
| 1168 | - if(typeof(console) !== 'undefined'){console.error(men);} | |
| 1169 | - } | |
| 1170 | - m = i3GEO.calculo.area(pontosdistobj.xtela,pontosdistobj.ytela,g_areapixel); | |
| 1171 | - i3GEO.util.defineValor("mostraarea_calculo","innerHTML","<br>m2</b>= "+m.toFixed(2)+"<br><b>km2</b>= "+(m/1000000).toFixed(2)+"<br><b>ha</b>= "+(m/10000).toFixed(2)); | |
| 1172 | - if(i3GEO.util.in_array(i3GEO.Interface.ATUAL,["openlayers","googlemaps"])){ | |
| 1173 | - i3GEO.util.insereMarca.cria(objposicaocursor.imgx,objposicaocursor.imgy,i3GEO.analise.medeArea.paraCalculo,"divGeometriasTemp","",i3GEO.configura.locaplic+"/imagens/estasel.png",6,6); | |
| 1174 | - i3GEO.desenho.insereCirculo(objposicaocursor.imgx,objposicaocursor.imgy,3,"white"); | |
| 1175 | - } | |
| 1176 | - if(i3GEO.Interface.ATUAL === "googleearth") | |
| 1177 | - {i3GEO.util.insereMarca.cria(objposicaocursor.ddx,objposicaocursor.ddy,i3GEO.analise.medeArea.paraCalculo,"divGeometriasTemp","");} | |
| 1178 | - } | |
| 1179 | - }, | |
| 1180 | - /* | |
| 1276 | + }, | |
| 1277 | + /* | |
| 1181 | 1278 | Para o calculo de area e ativa o botao "pan" |
| 1182 | - */ | |
| 1183 | - paraCalculo: function(){ | |
| 1184 | - var botaoPan = $i("pan"); | |
| 1185 | - g_tipoacao = ""; | |
| 1186 | - botaoPan ? botaoPan.onclick.call() : i3GEO.barraDeBotoes.ativaBotoes(); | |
| 1187 | - }, | |
| 1188 | - /* | |
| 1279 | + */ | |
| 1280 | + paraCalculo: function(){ | |
| 1281 | + var botaoPan = $i("pan"); | |
| 1282 | + g_tipoacao = ""; | |
| 1283 | + botaoPan ? botaoPan.onclick.call() : i3GEO.barraDeBotoes.ativaBotoes(); | |
| 1284 | + }, | |
| 1285 | + /* | |
| 1189 | 1286 | Realiza o desenho do poligono conforme o usuario movimenta o mouse |
| 1190 | - */ | |
| 1191 | - movimento: function(){ | |
| 1192 | - var n, | |
| 1193 | - pontosdistobj = i3GEO.analise.pontosdistobj; | |
| 1194 | - if (g_tipoacao === "area"){ | |
| 1195 | - n = pontosdistobj.xpt.length; | |
| 1196 | - if (n > 0){ | |
| 1197 | - i3GEO.desenho.aplica("resizePoligono",pontosdistobj.linhastemp,1); | |
| 1198 | - i3GEO.desenho.aplica("resizeLinha",pontosdistobj.linhas[n-1],n); | |
| 1287 | + */ | |
| 1288 | + movimento: function(){ | |
| 1289 | + var n, | |
| 1290 | + pontosdistobj = i3GEO.analise.pontosdistobj; | |
| 1291 | + if (g_tipoacao === "area"){ | |
| 1292 | + n = pontosdistobj.xpt.length; | |
| 1293 | + if (n > 0){ | |
| 1294 | + i3GEO.desenho.aplica("resizePoligono",pontosdistobj.linhastemp,1); | |
| 1295 | + i3GEO.desenho.aplica("resizeLinha",pontosdistobj.linhas[n-1],n); | |
| 1296 | + } | |
| 1199 | 1297 | } |
| 1200 | 1298 | } |
| 1201 | 1299 | } |
| 1202 | -} | |
| 1203 | 1300 | }; | ... | ... |
classesjs/classe_desenho.js