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 317 var janela;
318 318 i3GEO.eventos.cliquePerm.ativa();
319 319 //@TODO remover
320   - if(i3GEO.Interface.ATUAL !== "openlayers" && i3GEO.Interface.ATUAL !== "googlemaps"){
  320 + if(i3GEO.Interface.ATUAL === "googleearth"){
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"))
... ... @@ -554,10 +554,11 @@ i3GEO.analise = {
554 554 * Executa a funcao de inicializacao do desenho, que cria o layer para receber os graficos
555 555 */
556 556 inicia: function(){
557   - var linha,evtclick,evtmousemove,
  557 + var linha,
558 558 estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao];
559 559 i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
560 560 i3GeoMap.setOptions({disableDoubleClickZoom:true});
  561 + i3GeoMap.setOptions({draggableCursor:'crosshair'});
561 562 i3GEO.analise.medeDistancia.pontos = {
562 563 xpt: [],
563 564 ypt: [],
... ... @@ -568,15 +569,56 @@ i3GEO.analise = {
568 569 polygon: null
569 570 };
570 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 574 // When the map is clicked, pass the LatLng obect to the measureAdd function
573 575 pontos.mvcLine.push(evt.latLng);
574 576 pontos.xpt.push(evt.latLng.lng());
575 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 618 //mais um ponto para criar uma linha movel
577 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 622 // If there is more than one vertex on the line
581 623 if (pontos.mvcLine.getLength() > 1) {
582 624 // If the line hasn't been created yet
... ... @@ -585,9 +627,9 @@ i3GEO.analise = {
585 627 pontos.line = new google.maps.Polyline({
586 628 map: i3GeoMap,
587 629 clickable: false,
588   - strokeColor: "#FF0000",
  630 + strokeColor: estilo.linecolor,
589 631 strokeOpacity: 1,
590   - strokeWeight: 3,
  632 + strokeWeight: estilo.linewidth,
591 633 path:pontos.mvcLine
592 634 });
593 635 }
... ... @@ -595,9 +637,9 @@ i3GEO.analise = {
595 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 643 i3GEO.analise.medeDistancia.googlemaps.inicia();
602 644 });
603 645  
... ... @@ -621,12 +663,16 @@ i3GEO.analise = {
621 663 * Os raios e pontos sao sempre removidos
622 664 */
623 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 669 i3GeoMap.setOptions({disableDoubleClickZoom:false});
  670 + i3GeoMap.setOptions({draggableCursor:""});
625 671 /*
626 672 var temp,
627 673 controle = i3geoOL.getControlsBy("id","i3GeoMedeDistancia"),
628 674 f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeDistancia");
629   -
  675 +
630 676 if(controle.length > 0){
631 677 controle[0].deactivate();
632 678 i3geoOL.removeControl(controle[0]);
... ... @@ -641,7 +687,7 @@ i3GEO.analise = {
641 687 if(f && f.length > 0){
642 688 i3GEO.desenho.layergrafico.destroyFeatures(f);
643 689 }
644   - */
  690 + */
645 691 },
646 692 /**
647 693 * Mostra a totalizacao das linhas ja digitalizadas
... ...