Commit 723eb94544261fb6e68036992a24467d3101f844

Authored by Edmar Moretti
1 parent 2d6424f2

-

Showing 1 changed file with 57 additions and 11 deletions   Show diff stats
classesjs/classe_analise.js
@@ -317,7 +317,7 @@ i3GEO.analise = { @@ -317,7 +317,7 @@ i3GEO.analise = {
317 var janela; 317 var janela;
318 i3GEO.eventos.cliquePerm.ativa(); 318 i3GEO.eventos.cliquePerm.ativa();
319 //@TODO remover 319 //@TODO remover
320 - if(i3GEO.Interface.ATUAL !== "openlayers" && i3GEO.Interface.ATUAL !== "googlemaps"){ 320 + if(i3GEO.Interface.ATUAL === "googleearth"){
321 i3GEO.Interface.ATUAL !== "googleearth" ? i3GEO.desenho.richdraw.fecha() : i3GEO.Interface.googleearth.removePlacemark("divGeometriasTemp"); 321 i3GEO.Interface.ATUAL !== "googleearth" ? i3GEO.desenho.richdraw.fecha() : i3GEO.Interface.googleearth.removePlacemark("divGeometriasTemp");
322 i3GEO.util.removeChild("pontosins"); 322 i3GEO.util.removeChild("pontosins");
323 if($i("divGeometriasTemp")) 323 if($i("divGeometriasTemp"))
@@ -554,10 +554,11 @@ i3GEO.analise = { @@ -554,10 +554,11 @@ i3GEO.analise = {
554 * Executa a funcao de inicializacao do desenho, que cria o layer para receber os graficos 554 * Executa a funcao de inicializacao do desenho, que cria o layer para receber os graficos
555 */ 555 */
556 inicia: function(){ 556 inicia: function(){
557 - var linha,evtclick,evtmousemove, 557 + var linha,
558 estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao]; 558 estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao];
559 i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); 559 i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
560 i3GeoMap.setOptions({disableDoubleClickZoom:true}); 560 i3GeoMap.setOptions({disableDoubleClickZoom:true});
  561 + i3GeoMap.setOptions({draggableCursor:'crosshair'});
561 i3GEO.analise.medeDistancia.pontos = { 562 i3GEO.analise.medeDistancia.pontos = {
562 xpt: [], 563 xpt: [],
563 ypt: [], 564 ypt: [],
@@ -568,15 +569,56 @@ i3GEO.analise = { @@ -568,15 +569,56 @@ i3GEO.analise = {
568 polygon: null 569 polygon: null
569 }; 570 };
570 var pontos = i3GEO.analise.medeDistancia.pontos; 571 var pontos = i3GEO.analise.medeDistancia.pontos;
571 - evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) { 572 + i3GEO.analise.medeDistancia.googlemaps.evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) {
  573 + var x1,x2,y1,y2,raio,trecho,total,n;
572 // When the map is clicked, pass the LatLng obect to the measureAdd function 574 // When the map is clicked, pass the LatLng obect to the measureAdd function
573 pontos.mvcLine.push(evt.latLng); 575 pontos.mvcLine.push(evt.latLng);
574 pontos.xpt.push(evt.latLng.lng()); 576 pontos.xpt.push(evt.latLng.lng());
575 pontos.ypt.push(evt.latLng.lat()); 577 pontos.ypt.push(evt.latLng.lat());
  578 + n = pontos.xpt.length;
  579 + //desenha um circulo
  580 + if (pontos.mvcLine.getLength() > 1) {
  581 + if($i("pararraios") && $i("pararraios").checked === true ){
  582 + new google.maps.Circle({
  583 + map: i3GeoMap,
  584 + fillOpacity: 0,
  585 + clickable: false,
  586 + strokeColor: estilo.circcolor,
  587 + strokeOpacity: 1,
  588 + strokeWeight: estilo.linewidth,
  589 + center:evt.latLng,
  590 + radius: 50000
  591 + });
  592 + }
  593 + x1 = i3GEO.analise.medeDistancia.pontos.xpt[n-2];
  594 + y1 = i3GEO.analise.medeDistancia.pontos.ypt[n-2];
  595 + x2 = evt.latLng.lng();
  596 + y2 = evt.latLng.lat();
  597 + raio = google.maps.geometry.spherical.computeDistanceBetween(evt.latLng,new google.maps.LatLng(y1,x1))
  598 + trecho = i3GEO.calculo.distancia(x1,y1,x2,y2);
  599 + i3GEO.analise.medeDistancia.pontos.dist.push(trecho);
  600 + total = i3GEO.analise.medeDistancia.googlemaps.somaDist();
  601 + i3GEO.analise.medeDistancia.googlemaps.mostraTotal(trecho,total);
  602 + }
  603 + //desenha uma marca no ponto
  604 + if($i("parartextos") && $i("parartextos").checked === true ){
  605 + new google.maps.Marker({
  606 + map: i3GeoMap,
  607 + fillOpacity: 0,
  608 + clickable: false,
  609 + position:evt.latLng,
  610 + icon: {
  611 + path: google.maps.SymbolPath.CIRCLE,
  612 + scale: 2.5,
  613 + strokeColor: "#ffffff"
  614 + }
  615 + });
  616 + }
  617 + pontos.ypt.push(evt.latLng.lat());
576 //mais um ponto para criar uma linha movel 618 //mais um ponto para criar uma linha movel
577 pontos.mvcLine.push(evt.latLng); 619 pontos.mvcLine.push(evt.latLng);
578 }); 620 });
579 - evtmousemove = google.maps.event.addListener(i3GeoMap, "mousemove", function(evt) { 621 + i3GEO.analise.medeDistancia.googlemaps.evtmousemove = google.maps.event.addListener(i3GeoMap, "mousemove", function(evt) {
580 // If there is more than one vertex on the line 622 // If there is more than one vertex on the line
581 if (pontos.mvcLine.getLength() > 1) { 623 if (pontos.mvcLine.getLength() > 1) {
582 // If the line hasn't been created yet 624 // If the line hasn't been created yet
@@ -585,9 +627,9 @@ i3GEO.analise = { @@ -585,9 +627,9 @@ i3GEO.analise = {
585 pontos.line = new google.maps.Polyline({ 627 pontos.line = new google.maps.Polyline({
586 map: i3GeoMap, 628 map: i3GeoMap,
587 clickable: false, 629 clickable: false,
588 - strokeColor: "#FF0000", 630 + strokeColor: estilo.linecolor,
589 strokeOpacity: 1, 631 strokeOpacity: 1,
590 - strokeWeight: 3, 632 + strokeWeight: estilo.linewidth,
591 path:pontos.mvcLine 633 path:pontos.mvcLine
592 }); 634 });
593 } 635 }
@@ -595,9 +637,9 @@ i3GEO.analise = { @@ -595,9 +637,9 @@ i3GEO.analise = {
595 pontos.mvcLine.push(evt.latLng); 637 pontos.mvcLine.push(evt.latLng);
596 } 638 }
597 }); 639 });
598 - google.maps.event.addListener(i3GeoMap, "dblclick", function(evt) {  
599 - google.maps.event.removeListener(evtclick);  
600 - google.maps.event.removeListener(evtmousemove); 640 + i3GEO.analise.medeDistancia.googlemaps.dblclick = google.maps.event.addListener(i3GeoMap, "dblclick", function(evt) {
  641 + //google.maps.event.removeListener(i3GEO.analise.medeDistancia.googlemaps.evtclick);
  642 + //google.maps.event.removeListener(i3GEO.analise.medeDistancia.googlemaps.evtmousemove);
601 i3GEO.analise.medeDistancia.googlemaps.inicia(); 643 i3GEO.analise.medeDistancia.googlemaps.inicia();
602 }); 644 });
603 645
@@ -621,12 +663,16 @@ i3GEO.analise = { @@ -621,12 +663,16 @@ i3GEO.analise = {
621 * Os raios e pontos sao sempre removidos 663 * Os raios e pontos sao sempre removidos
622 */ 664 */
623 fechaJanela: function(){ 665 fechaJanela: function(){
  666 + //google.maps.event.removeListener(i3GEO.analise.medeDistancia.googlemaps.evtclick);
  667 + //google.maps.event.removeListener(i3GEO.analise.medeDistancia.googlemaps.evtmousemove);
  668 + //google.maps.event.removeListener(i3GEO.analise.medeDistancia.googlemaps.dblclick);
624 i3GeoMap.setOptions({disableDoubleClickZoom:false}); 669 i3GeoMap.setOptions({disableDoubleClickZoom:false});
  670 + i3GeoMap.setOptions({draggableCursor:""});
625 /* 671 /*
626 var temp, 672 var temp,
627 controle = i3geoOL.getControlsBy("id","i3GeoMedeDistancia"), 673 controle = i3geoOL.getControlsBy("id","i3GeoMedeDistancia"),
628 f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeDistancia"); 674 f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeDistancia");
629 - 675 +
630 if(controle.length > 0){ 676 if(controle.length > 0){
631 controle[0].deactivate(); 677 controle[0].deactivate();
632 i3geoOL.removeControl(controle[0]); 678 i3geoOL.removeControl(controle[0]);
@@ -641,7 +687,7 @@ i3GEO.analise = { @@ -641,7 +687,7 @@ i3GEO.analise = {
641 if(f && f.length > 0){ 687 if(f && f.length > 0){
642 i3GEO.desenho.layergrafico.destroyFeatures(f); 688 i3GEO.desenho.layergrafico.destroyFeatures(f);
643 } 689 }
644 - */ 690 + */
645 }, 691 },
646 /** 692 /**
647 * Mostra a totalizacao das linhas ja digitalizadas 693 * Mostra a totalizacao das linhas ja digitalizadas