Commit 4a0b4de086694d997a5bf3a4fbfca90e8c78f3c1
1 parent
aa8f19d3
Exists in
master
and in
7 other branches
-
Showing
6 changed files
with
205 additions
and
345 deletions
Show diff stats
classesjs/classe_analise.js
| ... | ... | @@ -243,19 +243,6 @@ i3GEO.analise = { |
| 243 | 243 | inicia: function(){ |
| 244 | 244 | if(typeof(console) !== 'undefined'){console.info("i3GEO.analise.medeDistancia.inicia()");} |
| 245 | 245 | i3GEO.eventos.cliquePerm.desativa(); |
| 246 | - //@TODO remover apos concluir a refatoracao do codigo | |
| 247 | - i3GEO.analise.pontosdistobj = { | |
| 248 | - xpt: [], | |
| 249 | - ypt: [], | |
| 250 | - dist: [], | |
| 251 | - distV: [], | |
| 252 | - xtela: [], | |
| 253 | - ytela: [], | |
| 254 | - ximg: [], | |
| 255 | - yimg: [], | |
| 256 | - linhas: [], | |
| 257 | - linhastemp: [] | |
| 258 | - }; | |
| 259 | 246 | i3GEO.analise.medeDistancia.criaJanela(); |
| 260 | 247 | i3GEO.analise.medeDistancia[i3GEO.Interface["ATUAL"]].inicia(); |
| 261 | 248 | }, |
| ... | ... | @@ -730,27 +717,133 @@ i3GEO.analise = { |
| 730 | 717 | } |
| 731 | 718 | }, |
| 732 | 719 | googleearth:{ |
| 720 | + pontosdistobj: { | |
| 721 | + xpt: [], | |
| 722 | + ypt: [], | |
| 723 | + dist: [], | |
| 724 | + distV: [], | |
| 725 | + xtela: [], | |
| 726 | + ytela: [], | |
| 727 | + ximg: [], | |
| 728 | + yimg: [], | |
| 729 | + linhas: [], | |
| 730 | + linhastemp: [] | |
| 731 | + }, | |
| 733 | 732 | inicia: function(){ |
| 734 | - if (g_tipoacao !== "mede"){ | |
| 735 | - if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEO.analise.medeDistancia.clique()") < 0) | |
| 736 | - {i3GEO.eventos.MOUSECLIQUE.push("i3GEO.analise.medeDistancia.clique()");} | |
| 737 | - if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.analise.medeDistancia.movimento()") < 0) | |
| 738 | - {i3GEO.eventos.MOUSEMOVE.push("i3GEO.analise.medeDistancia.movimento()");} | |
| 739 | - if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.analise.medeDistancia.fechaJanela()") < 0) | |
| 740 | - {i3GEO.eventos.NAVEGAMAPA.push("i3GEO.analise.medeDistancia.fechaJanela()");} | |
| 741 | - $i("mostradistancia").style.display="block"; | |
| 742 | - g_tipoacao = "mede"; | |
| 733 | + if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEO.analise.medeDistancia.googleearth.clique()") < 0) | |
| 734 | + {i3GEO.eventos.MOUSECLIQUE.push("i3GEO.analise.medeDistancia.googleearth.clique()");} | |
| 735 | + if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.analise.medeDistancia.googleearth.movimento()") < 0) | |
| 736 | + {i3GEO.eventos.MOUSEMOVE.push("i3GEO.analise.medeDistancia.googleearth.movimento()");} | |
| 737 | + if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.analise.medeDistancia.fechaJanela()") < 0) | |
| 738 | + {i3GEO.eventos.NAVEGAMAPA.push("i3GEO.analise.medeDistancia.fechaJanela()");} | |
| 739 | + }, | |
| 740 | + clique: function(){ | |
| 741 | + var pontosdistobj = i3GEO.analise.medeDistancia.googleearth.pontosdistobj, | |
| 742 | + n,d,decimal,dd; | |
| 743 | + n = pontosdistobj.xpt.length; | |
| 744 | + pontosdistobj.xpt[n] = objposicaocursor.ddx; | |
| 745 | + pontosdistobj.ypt[n] = objposicaocursor.ddy; | |
| 746 | + pontosdistobj.xtela[n] = objposicaocursor.telax; | |
| 747 | + pontosdistobj.ytela[n] = objposicaocursor.telay; | |
| 748 | + pontosdistobj.ximg[n] = objposicaocursor.imgx; | |
| 749 | + pontosdistobj.yimg[n] = objposicaocursor.imgy; | |
| 750 | + pontosdistobj.dist[n] = 0; | |
| 751 | + if (n > 0){ | |
| 752 | + d = i3GEO.calculo.distancia(pontosdistobj.xpt[n-1],pontosdistobj.ypt[n-1],objposicaocursor.ddx,objposicaocursor.ddy); | |
| 753 | + decimal = 0; | |
| 754 | + d = d + ""; | |
| 755 | + d = d.split("."); | |
| 756 | + decimal = d[1].substr(0,5); | |
| 757 | + d = d[0]+"."+decimal; | |
| 758 | + d = d * 1; | |
| 759 | + pontosdistobj.dist[n] = d + pontosdistobj.dist[n-1]; | |
| 760 | + if($i("pararraios") && $i("pararraios").checked === true ){ | |
| 761 | + dd = Math.sqrt(((Math.pow((pontosdistobj.xpt[n] - pontosdistobj.xpt[n-1]),2)) + (Math.pow((pontosdistobj.ypt[n] - pontosdistobj.ypt[n-1]),2)) )); | |
| 762 | + i3GEO.desenho.googleearth.insereCirculo(pontosdistobj.xpt[n],pontosdistobj.ypt[n],dd,"","divGeometriasTemp"); | |
| 763 | + } | |
| 764 | + if($i("parartextos") && $i("parartextos").checked === true ){ | |
| 765 | + i3GEO.desenho.googleearth.insereMarca(d+" km",objposicaocursor.ddx,objposicaocursor.ddy,"","divGeometriasTemp"); | |
| 766 | + } | |
| 767 | + //cria a linha ligando os dois ultimos pontos | |
| 768 | + i3GEO.desenho.googleearth.insereLinha(pontosdistobj.xpt[n-1],pontosdistobj.ypt[n-1],pontosdistobj.xpt[n],pontosdistobj.ypt[n],"","divGeometriasTemp"); | |
| 743 | 769 | } |
| 744 | - else{ | |
| 745 | - var Dom = YAHOO.util.Dom; | |
| 746 | - Dom.setStyle("mostradistancia","display","none"); | |
| 747 | - Dom.setStyle("pontosins","display","none"); | |
| 770 | + }, | |
| 771 | + movimento: function(){ | |
| 772 | + var n,d,r,decimal,da, | |
| 773 | + pontosdistobj = i3GEO.analise.medeDistancia.googleearth.pontosdistobj, | |
| 774 | + calculo = i3GEO.calculo; | |
| 775 | + n = pontosdistobj.xpt.length; | |
| 776 | + if (n > 0){ | |
| 777 | + d = calculo.distancia(pontosdistobj.xpt[n-1],pontosdistobj.ypt[n-1],objposicaocursor.ddx,objposicaocursor.ddy); | |
| 778 | + r = calculo.direcao(pontosdistobj.xpt[n-1],pontosdistobj.ypt[n-1],objposicaocursor.ddx,objposicaocursor.ddy); | |
| 779 | + r = calculo.dd2dms(r,r); | |
| 780 | + r = r[0]; | |
| 781 | + | |
| 782 | + d = d + ""; | |
| 783 | + d = d.split("."); | |
| 784 | + decimal = d[1].substr(0,5); | |
| 785 | + d = d[0]+"."+decimal; | |
| 786 | + d = d * 1; | |
| 787 | + da = d + pontosdistobj.dist[n-1]; | |
| 788 | + da = da + ""; | |
| 789 | + da = da.split("."); | |
| 790 | + decimal = da[1].substr(0,5); | |
| 791 | + da = da[0]+"."+decimal; | |
| 792 | + da = da * 1; | |
| 793 | + i3GEO.analise.medeDistancia.googleearth.mostraParcial(d,da,r); | |
| 748 | 794 | } |
| 749 | 795 | }, |
| 796 | + /** | |
| 797 | + * Fecha a janela que mostra os dados | |
| 798 | + * Pergunta ao usuario se os graficos devem ser removidos | |
| 799 | + * Os graficos sao marcados com o atributo "origem" | |
| 800 | + * Os raios e pontos sao sempre removidos | |
| 801 | + */ | |
| 750 | 802 | fechaJanela: function(){ |
| 751 | - | |
| 803 | + i3GeoMap.setOptions({disableDoubleClickZoom:false}); | |
| 804 | + i3GeoMap.setOptions({draggableCursor:undefined}); | |
| 805 | + var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","medeDistancia"); | |
| 806 | + if(f && f.length > 0){ | |
| 807 | + temp = window.confirm($trad("x94")); | |
| 808 | + if(temp){ | |
| 809 | + i3GEO.desenho.googlemaps.destroyFeatures(f); | |
| 810 | + } | |
| 811 | + } | |
| 812 | + f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","medeDistanciaExcluir"); | |
| 813 | + if(f && f.length > 0){ | |
| 814 | + i3GEO.desenho.googlemaps.destroyFeatures(f); | |
| 815 | + } | |
| 816 | + i3GEO.eventos.MOUSECLIQUE.remove("i3GEO.analise.medeDistancia.googleearth.clique()"); | |
| 817 | + i3GEO.eventos.MOUSEMOVE.remove("i3GEO.analise.medeDistancia.movimento.googleearth()"); | |
| 818 | + i3GEO.eventos.NAVEGAMAPA.remove("i3GEO.analise.medeDistancia.fechaJanela()"); | |
| 819 | + }, | |
| 820 | + /** | |
| 821 | + * Mostra a totalizacao das linhas ja digitalizadas | |
| 822 | + */ | |
| 823 | + mostraTotal: function(trecho,total){ | |
| 824 | + var mostra = $i("mostradistancia_calculo"), | |
| 825 | + texto; | |
| 826 | + if (mostra){ | |
| 827 | + texto = "<b>"+$trad("x96")+":</b> "+total.toFixed(3)+" km"+ | |
| 828 | + "<br><b>"+$trad("x96")+":</b> "+(total*1000).toFixed(2)+" m"+ | |
| 829 | + "<br>"+$trad("x25")+": "+i3GEO.calculo.metododistancia; | |
| 830 | + mostra.innerHTML = texto; | |
| 831 | + } | |
| 832 | + }, | |
| 833 | + /** | |
| 834 | + * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse | |
| 835 | + */ | |
| 836 | + mostraParcial: function(trecho,parcial,direcao){ | |
| 837 | + var mostra = $i("mostradistancia_calculo_movel"), | |
| 838 | + texto; | |
| 839 | + if (mostra){ | |
| 840 | + texto = "<b>"+$trad("x95")+":</b> "+trecho.toFixed(3)+" km"+ | |
| 841 | + "<br><b>"+$trad("x97")+":</b> "+(parcial + trecho).toFixed(3)+" km" + | |
| 842 | + "<br><b>"+$trad("x23")+" (DMS):</b> "+direcao.toFixed(4); | |
| 843 | + mostra.innerHTML = texto; | |
| 844 | + } | |
| 752 | 845 | } |
| 753 | - }, | |
| 846 | + } | |
| 754 | 847 | }, |
| 755 | 848 | /* |
| 756 | 849 | i3GEO.analise.medeArea | ... | ... |
classesjs/classe_configura.js
| ... | ... | @@ -1083,8 +1083,6 @@ i3GEO.configura = { |
| 1083 | 1083 | $i(i3GEO.Interface.IDMAPA).title = ""; |
| 1084 | 1084 | i3GEO.util.mudaCursor(i3GEO.configura.cursores,"distancia",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic); |
| 1085 | 1085 | } |
| 1086 | - g_tipoacao = ""; | |
| 1087 | - g_operacao=""; | |
| 1088 | 1086 | i3GEO.analise.medeDistancia.inicia(); |
| 1089 | 1087 | } |
| 1090 | 1088 | }, |
| ... | ... | @@ -1100,8 +1098,6 @@ i3GEO.configura = { |
| 1100 | 1098 | $i(i3GEO.Interface.IDMAPA).title = ""; |
| 1101 | 1099 | i3GEO.util.mudaCursor(i3GEO.configura.cursores,"area",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic); |
| 1102 | 1100 | } |
| 1103 | - g_tipoacao = ""; | |
| 1104 | - g_operacao=""; | |
| 1105 | 1101 | i3GEO.analise.medeArea.inicia(); |
| 1106 | 1102 | } |
| 1107 | 1103 | }, |
| ... | ... | @@ -1192,7 +1188,6 @@ i3GEO.configura = { |
| 1192 | 1188 | }; |
| 1193 | 1189 | GEvent.addListener(directions, "error", temp); |
| 1194 | 1190 | directions.load("from: "+pontoRota1.lat()+","+pontoRota1.lng()+" to: "+pontoRota2.lat()+","+pontoRota2.lng()); |
| 1195 | - //i3GeoMap.removeOverlay(directions) | |
| 1196 | 1191 | } |
| 1197 | 1192 | }; |
| 1198 | 1193 | rotaEvento = GEvent.addListener(i3GeoMap, "click", parametrosRota); | ... | ... |
classesjs/classe_desenho.js
| 1 | 1 | /* |
| 2 | -Title: Desenho de elementos gráficos | |
| 2 | +Desenho de elementos gráficos | |
| 3 | 3 | |
| 4 | 4 | i3GEO.desenho |
| 5 | 5 | |
| 6 | -Controla as operações de desenho sobre o mapa | |
| 6 | +Funcoes de uso geral para desenho de elementos graficos. | |
| 7 | 7 | |
| 8 | -Por desenho, entende-se elementos que são incluídos graficamente no mapa, | |
| 9 | -como por exemplo, linhas, pontos, círculos, etc e que não compõem layers | |
| 10 | -com dados | |
| 8 | +As funcoes dependem de cada interface em uso no mapa. | |
| 11 | 9 | |
| 12 | -As operações de desenho são baseadas na biblioteca Richdraw (i3geo/pacotes/richdraw) | |
| 13 | - | |
| 14 | -Link: | |
| 15 | - | |
| 16 | -http://starkravingfinkle.org/blog/2006/04/richdraw-simple-vmlsvg-editor/ | |
| 10 | +Aqui estao apenas as funcoes de uso compartilhado. Para mais informacoes veja as opcoes nos editores vetoriais. | |
| 17 | 11 | |
| 18 | 12 | Arquivo: |
| 19 | 13 | |
| ... | ... | @@ -45,15 +39,6 @@ if(typeof(i3GEO) === 'undefined'){ |
| 45 | 39 | var i3GEO = {}; |
| 46 | 40 | } |
| 47 | 41 | i3GEO.desenho = { |
| 48 | - /* | |
| 49 | - Variavel: richdraw | |
| 50 | - | |
| 51 | - Objeto richdraw criado por criaContainerRichdraw | |
| 52 | - | |
| 53 | - Tipo: | |
| 54 | - {richdraw object} | |
| 55 | - */ | |
| 56 | - richdraw: "", | |
| 57 | 42 | layergrafico: null, |
| 58 | 43 | /* |
| 59 | 44 | Propriedade: estilos |
| ... | ... | @@ -241,212 +226,88 @@ i3GEO.desenho = { |
| 241 | 226 | } |
| 242 | 227 | } |
| 243 | 228 | }, |
| 244 | - /* | |
| 245 | - Cria os elementos 'dom' necessários ao uso das funções de desenho sobre o mapa. | |
| 246 | - | |
| 247 | - As ferramentas de cálculo de distâncias e áreas utilizam esse container. | |
| 248 | - | |
| 249 | - Richdraw é uma biblioteca utilizada pelo i3geo para abstrair as diferenças entre as linguagens svg e vml. | |
| 250 | - | |
| 251 | - Essa abstração é necessária devido às diferenças entre os navegadores. | |
| 252 | - | |
| 253 | - O container é criado dentro de um DIV chamado "divGeometriasTemp" | |
| 254 | - | |
| 255 | - Essa função cria também o objeto pontosdistobj que é utilizado para armazenar | |
| 256 | - os dados obtidos da movimentação do mouse sobre o mapa | |
| 257 | - | |
| 258 | - */ | |
| 259 | - criaContainerRichdraw: function(){ | |
| 260 | - if(typeof(console) !== 'undefined'){console.info("i3GEO.desenho.criaContainerRichdraw()");} | |
| 261 | - i3GEO.analise.pontosdistobj = { | |
| 262 | - xpt: [], | |
| 263 | - ypt: [], | |
| 264 | - dist: [], | |
| 265 | - distV: [], | |
| 266 | - xtela: [], | |
| 267 | - ytela: [], | |
| 268 | - ximg: [], | |
| 269 | - yimg: [], | |
| 270 | - linhas: [] | |
| 271 | - }; | |
| 272 | - if(i3GEO.Interface.ATUAL === "googleearth") | |
| 273 | - {return;} | |
| 274 | - try{ | |
| 275 | - var divgeo,renderer; | |
| 276 | - divgeo = i3GEO.desenho.criaDivContainer(); | |
| 277 | - divgeo.innerHTML = ""; | |
| 278 | - // | |
| 279 | - //cria o objeto renderer conforme o browser em uso | |
| 280 | - //esse objeto será utilizado nas funções de desenho | |
| 281 | - //mais detalhes, veja em pacotes/richdraw | |
| 282 | - //Conforme a resposta do navegador, utiliza-se a criação VML ou SVG | |
| 283 | - // | |
| 284 | - try{ | |
| 285 | - renderer = new VMLRenderer(); | |
| 286 | - i3GEO.desenho.richdraw = new RichDrawEditor(divgeo, renderer); | |
| 287 | - } | |
| 288 | - catch(erro){ | |
| 289 | - renderer = new SVGRenderer(); | |
| 290 | - i3GEO.desenho.richdraw = new RichDrawEditor(divgeo, renderer); | |
| 291 | - renderer.svgRoot.style.width = divgeo.style.width; | |
| 292 | - renderer.svgRoot.style.height = divgeo.style.height; | |
| 293 | - } | |
| 294 | - // | |
| 295 | - //definição dos símbolos default para os elementos gráficos | |
| 296 | - // | |
| 297 | - i3GEO.desenho.definePadrao(i3GEO.desenho.estiloPadrao); | |
| 298 | - i3GEO.desenho.richdraw.editCommand('mode', 'line'); | |
| 299 | - divgeo.style.display="block"; | |
| 300 | - // | |
| 301 | - //após o container ser criado, é necessário que as funções | |
| 302 | - //de clique sobre o mapa sejam ativadas | |
| 303 | - //para funcionarem sobre o container | |
| 304 | - // | |
| 305 | - i3GEO.eventos.ativa(divgeo); | |
| 306 | - if($i("localizarxygeoProjxg")){ | |
| 307 | - var temp = function(){ | |
| 308 | - i3GEO.coordenadas.atualizaGeo(objposicaocursor.dmsx,objposicaocursor.dmsy,"localizarxygeoProj"); | |
| 309 | - }; | |
| 310 | - YAHOO.util.Event.addListener(divgeo,"mousemove", temp); | |
| 311 | - } | |
| 312 | - } | |
| 313 | - catch(men){alert("Erro ao tentar criar container richdraw "+men);} | |
| 314 | - }, | |
| 315 | - /* | |
| 316 | - Cria o elemento DIV que será utilizado para renderizar os elementos gráficos. | |
| 317 | - Nesse DIV serão incluídos os elementos de desenho em SVG ou VML | |
| 318 | - | |
| 319 | - O DIV recebe como ID "divGeometriasTemp" | |
| 320 | - | |
| 321 | - Return: | |
| 322 | - | |
| 323 | - DOM object | |
| 324 | - */ | |
| 325 | - criaDivContainer: function(){ | |
| 326 | - desenhoUltimaLinha = ""; | |
| 327 | - desenhoUltimaLinhaPol = ""; | |
| 328 | - if (!$i("divGeometriasTemp")){ | |
| 329 | - var pos,novoel,ne; | |
| 330 | - // | |
| 331 | - //pega a posição da imagem do mapa para posicionar corretamente o container | |
| 332 | - // | |
| 333 | - pos = [0,0]; | |
| 334 | - pos = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
| 335 | - // | |
| 336 | - //cria o container | |
| 337 | - // | |
| 338 | - novoel = document.createElement("div"); | |
| 339 | - novoel.id = "divGeometriasTemp"; | |
| 340 | - ne = novoel.style; | |
| 341 | - ne.cursor="crosshair"; | |
| 342 | - ne.zIndex=0; | |
| 343 | - if(i3GEO.Interface.TABLET === true) | |
| 344 | - {ne.zIndex=5000;} | |
| 345 | - ne.position="absolute"; | |
| 346 | - ne.width=i3GEO.parametros.w + "px"; | |
| 347 | - ne.height=i3GEO.parametros.h + "px"; | |
| 348 | - ne.border="0px solid black"; | |
| 349 | - ne.display="none"; | |
| 350 | - ne.top=pos[1] + "px"; | |
| 351 | - ne.left=pos[0] + "px"; | |
| 352 | - document.body.appendChild(novoel); | |
| 353 | - } | |
| 354 | - return ($i("divGeometriasTemp")); | |
| 355 | - }, | |
| 356 | - /* | |
| 357 | - Desenha ou reposiciona elementos na tela usando a biblioteca richdraw | |
| 358 | - | |
| 359 | - Parametros: | |
| 360 | - | |
| 361 | - tipo {string} - resizelinha|resizePoligono|insereCirculo tipo de operação | |
| 362 | - | |
| 363 | - objeto {object} - objeto gráfico existente no container richdraw | |
| 364 | - | |
| 365 | - n {numeric} - índice do elemento no array pontosdistobj | |
| 366 | - | |
| 367 | - texto {string} - texto que será inserido no tipo "insereTexto" | |
| 368 | - */ | |
| 369 | - aplica: function(tipo,objeto,n,texto){ | |
| 370 | - var dy,dx,w,c, | |
| 371 | - pontosdistobj = i3GEO.analise.pontosdistobj; | |
| 372 | - if(i3GEO.desenho.richdraw && $i(i3GEO.Interface.IDCORPO)){ | |
| 373 | - //pos = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
| 374 | - // | |
| 375 | - //faz o reposicionamento de linhas quando o mouse é movido e a linha está ativa | |
| 376 | - // | |
| 377 | - if((tipo==="resizeLinha") || (tipo==="resizePoligono")){ | |
| 378 | - try | |
| 379 | - {i3GEO.desenho.richdraw.renderer.resize(objeto,0,0,objposicaocursor.imgx,objposicaocursor.imgy);} | |
| 380 | - catch(erro){ | |
| 381 | - if(typeof(console) !== 'undefined'){console.error("i3GEO.desenho "+erro);} | |
| 382 | - } | |
| 383 | - } | |
| 384 | - if(tipo==="insereCirculo"){ | |
| 385 | - dx = Math.pow(((pontosdistobj.xtela[n])*1) - ((pontosdistobj.xtela[n-1])*1),2); | |
| 386 | - dy = Math.pow(((pontosdistobj.ytela[n])*1) - ((pontosdistobj.ytela[n-1])*1),2); | |
| 387 | - w = Math.sqrt(dx + dy); | |
| 388 | - c = ""; | |
| 389 | - if(navn){ | |
| 390 | - c = 'rgba(255,255,255,0'; | |
| 391 | - } | |
| 392 | - if(chro){ | |
| 393 | - c = ""; | |
| 229 | + googleearth:{ | |
| 230 | + insereMarca: function(description,ddx,ddy,name,snippet){ | |
| 231 | + if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.googleearth.insereMarca()");} | |
| 232 | + var placemark = i3GeoMap.createPlacemark(''), | |
| 233 | + point = i3GeoMap.createPoint(''); | |
| 234 | + placemark.setName(name); | |
| 235 | + point.setLatitude(ddy); | |
| 236 | + point.setLongitude(ddx); | |
| 237 | + placemark.setGeometry(point); | |
| 238 | + if(description !== "") | |
| 239 | + {placemark.setDescription(description);} | |
| 240 | + placemark.setSnippet(snippet); | |
| 241 | + i3GeoMap.getFeatures().appendChild(placemark); | |
| 242 | + }, | |
| 243 | + // | |
| 244 | + //código obtido em http://code.google.com/intl/pt-BR/apis/earth/documentation/geometries.html | |
| 245 | + // | |
| 246 | + insereCirculo: function(centerLng,centerLat,radius,name,snippet){ | |
| 247 | + function makeCircle(centerLat, centerLng, radius) { | |
| 248 | + var ring = i3GeoMap.createLinearRing(''), | |
| 249 | + steps = 25, | |
| 250 | + i, | |
| 251 | + pi2 = Math.PI * 2, | |
| 252 | + lat, | |
| 253 | + lng; | |
| 254 | + for (i = 0; i < steps; i++) { | |
| 255 | + lat = centerLat + radius * Math.cos(i / steps * pi2); | |
| 256 | + lng = centerLng + radius * Math.sin(i / steps * pi2); | |
| 257 | + ring.getCoordinates().pushLatLngAlt(lat, lng, 0); | |
| 394 | 258 | } |
| 395 | - i3GEO.desenho.insereCirculo(pontosdistobj.ximg[n-1],pontosdistobj.yimg[n-1],w,c); | |
| 259 | + return ring; | |
| 396 | 260 | } |
| 397 | - if(tipo==="insereTexto"){ | |
| 261 | + var polygonPlacemark = i3GeoMap.createPlacemark(''), | |
| 262 | + poly = i3GeoMap.createPolygon(''), | |
| 263 | + polyStyle; | |
| 264 | + poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND); | |
| 265 | + polygonPlacemark.setGeometry(poly); | |
| 266 | + polygonPlacemark.getGeometry().setOuterBoundary(makeCircle(centerLat, centerLng, radius)); | |
| 267 | + polygonPlacemark.setName(name); | |
| 268 | + polygonPlacemark.setSnippet(snippet); | |
| 269 | + polygonPlacemark.setStyleSelector(i3GeoMap.createStyle('')); | |
| 270 | + polyStyle = polygonPlacemark.getStyleSelector().getPolyStyle(); | |
| 271 | + polyStyle.setFill(0); | |
| 272 | + i3GeoMap.getFeatures().appendChild(polygonPlacemark); | |
| 273 | + }, | |
| 274 | + insereLinha: function(xi,yi,xf,yf,name,snippet){ | |
| 275 | + var lineStringPlacemark = i3GeoMap.createPlacemark(''), | |
| 276 | + lineString, | |
| 277 | + lineStyle; | |
| 278 | + lineStringPlacemark.setName(name); | |
| 279 | + lineString = i3GeoMap.createLineString(''); | |
| 280 | + lineString.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND); | |
| 281 | + lineStringPlacemark.setGeometry(lineString); | |
| 282 | + lineString.getCoordinates().pushLatLngAlt(yi, xi, 0); | |
| 283 | + lineString.getCoordinates().pushLatLngAlt(yf, xf, 0); | |
| 284 | + | |
| 285 | + lineStringPlacemark.setStyleSelector(i3GeoMap.createStyle('')); | |
| 286 | + lineStringPlacemark.setSnippet(snippet); | |
| 287 | + lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle(); | |
| 288 | + lineStyle.setWidth(3); | |
| 289 | + | |
| 290 | + i3GeoMap.getFeatures().appendChild(lineStringPlacemark); | |
| 291 | + }, | |
| 292 | + removePlacemark: function(nome){ | |
| 293 | + var features = i3GeoMap.getFeatures(), | |
| 294 | + n = features.getChildNodes().getLength(), | |
| 295 | + i, | |
| 296 | + nfeatures = []; | |
| 297 | + for(i=0;i<n;i++){ | |
| 398 | 298 | try{ |
| 399 | - i3GEO.desenho.richdraw.renderer.create('text', '', i3GEO.desenho.richdraw.textColor, 1, pontosdistobj.ximg[n-1],pontosdistobj.yimg[n-1],"","",texto); | |
| 400 | - } | |
| 401 | - catch(men){ | |
| 402 | - if(typeof(console) !== 'undefined'){console.error("i3GEO.desenho "+men);} | |
| 299 | + if(features.getChildNodes().item(i).getName() === nome || features.getChildNodes().item(i).getDescription() === nome || features.getChildNodes().item(i).getSnippet() === nome){ | |
| 300 | + //features.getChildNodes().item(i).setVisibility(false); | |
| 301 | + nfeatures.push(features.getChildNodes().item(i)); | |
| 302 | + //features.removeChild(features.getChildNodes().item(i)); | |
| 303 | + } | |
| 403 | 304 | } |
| 305 | + catch(e){} | |
| 306 | + } | |
| 307 | + n = nfeatures.length; | |
| 308 | + for(i=0;i<n;i++){ | |
| 309 | + features.removeChild(nfeatures[i]); | |
| 404 | 310 | } |
| 405 | - } | |
| 406 | - }, | |
| 407 | - /* | |
| 408 | - Insere um circulo no container de elementos gráficos | |
| 409 | - | |
| 410 | - Parametros: | |
| 411 | - | |
| 412 | - x {numerico} - posição do ponto em coordenadas de imagem | |
| 413 | - | |
| 414 | - y {numerico} - posição do ponto em coordenadas de imagem | |
| 415 | - | |
| 416 | - w {numerico} - raio do círculo em pixels | |
| 417 | - | |
| 418 | - b {string} - cor do fundo | |
| 419 | - */ | |
| 420 | - insereCirculo: function(x,y,w,b){ | |
| 421 | - if(!b){ | |
| 422 | - b = ""; | |
| 423 | - } | |
| 424 | - try{ | |
| 425 | - i3GEO.desenho.richdraw.renderer.create('circ', b, i3GEO.desenho.richdraw.circColor, i3GEO.desenho.richdraw.lineWidth, x,y,w,w); | |
| 426 | - } | |
| 427 | - catch(men){ | |
| 428 | - if(typeof(console) !== 'undefined'){console.error(men);} | |
| 429 | - } | |
| 430 | - }, | |
| 431 | - /* | |
| 432 | - Aplica um determinado padrao de estilos para os novos elementos que serão adicionados | |
| 433 | - | |
| 434 | - Para obter o estilo padrao, utilize i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao]; | |
| 435 | - | |
| 436 | - Parametro: | |
| 437 | - | |
| 438 | - padrao {string} - nome do estilo | |
| 439 | - */ | |
| 440 | - definePadrao: function(padrao){ | |
| 441 | - i3GEO.desenho.estiloPadrao = padrao; | |
| 442 | - //@TODO remover apos refatorar o codigo | |
| 443 | - padrao = i3GEO.desenho.estilosOld[padrao]; | |
| 444 | - if(i3GEO.desenho.richdraw){ | |
| 445 | - i3GEO.desenho.richdraw.editCommand('fillcolor', padrao.fillcolor); | |
| 446 | - i3GEO.desenho.richdraw.editCommand('linecolor', padrao.linecolor); | |
| 447 | - i3GEO.desenho.richdraw.editCommand('linewidth', padrao.linewidth); | |
| 448 | - i3GEO.desenho.richdraw.editCommand('circcolor', padrao.circcolor); | |
| 449 | - i3GEO.desenho.richdraw.editCommand('textcolor', padrao.textcolor); | |
| 450 | 311 | } |
| 451 | 312 | }, |
| 452 | 313 | /* | ... | ... |
classesjs/classe_interface.js
| ... | ... | @@ -2660,15 +2660,6 @@ i3GEO.Interface = { |
| 2660 | 2660 | {i3GEO.Interface.googleearth.aguarde.visibility = "hidden";} |
| 2661 | 2661 | } |
| 2662 | 2662 | ); |
| 2663 | - /* | |
| 2664 | - google.earth.addEventListener( | |
| 2665 | - i3GeoMap.getView(), | |
| 2666 | - 'viewchangeend', | |
| 2667 | - function(event){ | |
| 2668 | - i3GEO.eventos.MOUSECLIQUE = []; | |
| 2669 | - } | |
| 2670 | - ); | |
| 2671 | - */ | |
| 2672 | 2663 | }, |
| 2673 | 2664 | recalcPar: function(){ |
| 2674 | 2665 | var bounds; |
| ... | ... | @@ -2717,88 +2708,6 @@ i3GEO.Interface = { |
| 2717 | 2708 | b.setFeature(placemark); |
| 2718 | 2709 | i3GeoMap.setBalloon(b); |
| 2719 | 2710 | }, |
| 2720 | - insereMarca: function(description,ddx,ddy,name,snippet){ | |
| 2721 | - if(typeof(console) !== 'undefined'){console.info("i3GEO.Interface.googleearth.insereMarca()");} | |
| 2722 | - var placemark = i3GeoMap.createPlacemark(''), | |
| 2723 | - point = i3GeoMap.createPoint(''); | |
| 2724 | - placemark.setName(name); | |
| 2725 | - point.setLatitude(ddy); | |
| 2726 | - point.setLongitude(ddx); | |
| 2727 | - placemark.setGeometry(point); | |
| 2728 | - if(description !== "") | |
| 2729 | - {placemark.setDescription(description);} | |
| 2730 | - placemark.setSnippet(snippet); | |
| 2731 | - i3GeoMap.getFeatures().appendChild(placemark); | |
| 2732 | - }, | |
| 2733 | - // | |
| 2734 | - //código obtido em http://code.google.com/intl/pt-BR/apis/earth/documentation/geometries.html | |
| 2735 | - // | |
| 2736 | - insereCirculo: function(centerLng,centerLat,radius,name,snippet){ | |
| 2737 | - function makeCircle(centerLat, centerLng, radius) { | |
| 2738 | - var ring = i3GeoMap.createLinearRing(''), | |
| 2739 | - steps = 25, | |
| 2740 | - i, | |
| 2741 | - pi2 = Math.PI * 2, | |
| 2742 | - lat, | |
| 2743 | - lng; | |
| 2744 | - for (i = 0; i < steps; i++) { | |
| 2745 | - lat = centerLat + radius * Math.cos(i / steps * pi2); | |
| 2746 | - lng = centerLng + radius * Math.sin(i / steps * pi2); | |
| 2747 | - ring.getCoordinates().pushLatLngAlt(lat, lng, 0); | |
| 2748 | - } | |
| 2749 | - return ring; | |
| 2750 | - } | |
| 2751 | - var polygonPlacemark = i3GeoMap.createPlacemark(''), | |
| 2752 | - poly = i3GeoMap.createPolygon(''), | |
| 2753 | - polyStyle; | |
| 2754 | - poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND); | |
| 2755 | - polygonPlacemark.setGeometry(poly); | |
| 2756 | - polygonPlacemark.getGeometry().setOuterBoundary(makeCircle(centerLat, centerLng, radius)); | |
| 2757 | - polygonPlacemark.setName(name); | |
| 2758 | - polygonPlacemark.setSnippet(snippet); | |
| 2759 | - polygonPlacemark.setStyleSelector(i3GeoMap.createStyle('')); | |
| 2760 | - polyStyle = polygonPlacemark.getStyleSelector().getPolyStyle(); | |
| 2761 | - polyStyle.setFill(0); | |
| 2762 | - i3GeoMap.getFeatures().appendChild(polygonPlacemark); | |
| 2763 | - }, | |
| 2764 | - insereLinha: function(xi,yi,xf,yf,name,snippet){ | |
| 2765 | - var lineStringPlacemark = i3GeoMap.createPlacemark(''), | |
| 2766 | - lineString, | |
| 2767 | - lineStyle; | |
| 2768 | - lineStringPlacemark.setName(name); | |
| 2769 | - lineString = i3GeoMap.createLineString(''); | |
| 2770 | - lineString.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND); | |
| 2771 | - lineStringPlacemark.setGeometry(lineString); | |
| 2772 | - lineString.getCoordinates().pushLatLngAlt(yi, xi, 0); | |
| 2773 | - lineString.getCoordinates().pushLatLngAlt(yf, xf, 0); | |
| 2774 | - | |
| 2775 | - lineStringPlacemark.setStyleSelector(i3GeoMap.createStyle('')); | |
| 2776 | - lineStringPlacemark.setSnippet(snippet); | |
| 2777 | - lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle(); | |
| 2778 | - lineStyle.setWidth(3); | |
| 2779 | - | |
| 2780 | - i3GeoMap.getFeatures().appendChild(lineStringPlacemark); | |
| 2781 | - }, | |
| 2782 | - removePlacemark: function(nome){ | |
| 2783 | - var features = i3GeoMap.getFeatures(), | |
| 2784 | - n = features.getChildNodes().getLength(), | |
| 2785 | - i, | |
| 2786 | - nfeatures = []; | |
| 2787 | - for(i=0;i<n;i++){ | |
| 2788 | - try{ | |
| 2789 | - if(features.getChildNodes().item(i).getName() === nome || features.getChildNodes().item(i).getDescription() === nome || features.getChildNodes().item(i).getSnippet() === nome){ | |
| 2790 | - //features.getChildNodes().item(i).setVisibility(false); | |
| 2791 | - nfeatures.push(features.getChildNodes().item(i)); | |
| 2792 | - //features.removeChild(features.getChildNodes().item(i)); | |
| 2793 | - } | |
| 2794 | - } | |
| 2795 | - catch(e){} | |
| 2796 | - } | |
| 2797 | - n = nfeatures.length; | |
| 2798 | - for(i=0;i<n;i++){ | |
| 2799 | - features.removeChild(nfeatures[i]); | |
| 2800 | - } | |
| 2801 | - }, | |
| 2802 | 2711 | /* |
| 2803 | 2712 | Function: adicionaKml |
| 2804 | 2713 | ... | ... |
classesjs/classe_util.js
| ... | ... | @@ -862,7 +862,7 @@ i3GEO.util = { |
| 862 | 862 | if(!srci || srci === "") |
| 863 | 863 | {srci = i3GEO.configura.locaplic+"/imagens/dot2.gif";} |
| 864 | 864 | if(i3GEO.Interface.ATUAL === "googleearth"){ |
| 865 | - i3GEO.Interface.googleearth.insereMarca(texto,xi,yi,container); | |
| 865 | + i3GEO.desenho.googleearth.insereMarca(texto,xi,yi,container); | |
| 866 | 866 | return; |
| 867 | 867 | } |
| 868 | 868 | try{ | ... | ... |
guia_de_migracao.txt
| ... | ... | @@ -19,6 +19,8 @@ Para a versão 6.0 |
| 19 | 19 | |
| 20 | 20 | - a ordem dos botões na barra de botões foi alterada para mostrar primeiro o botão da barra de edição |
| 21 | 21 | |
| 22 | +- as funções de desenho de elementos gráficos utilizados pela interface GoogleEarth foram movidos de classesjs/classe_interface.js para classe_desenho.js | |
| 23 | + | |
| 22 | 24 | |
| 23 | 25 | |
| 24 | 26 | ------------------------------------------------------------------------------------------------- | ... | ... |