Commit b7292fed97e58aa1b6ae682fd37bd5b47afe49bb
1 parent
5b3e27d1
Exists in
master
and in
7 other branches
Ferramenta Gráfico de perfil
Showing
8 changed files
with
324 additions
and
18 deletions
Show diff stats
classesjs/classe_analise.js
| ... | ... | @@ -58,8 +58,7 @@ i3GEO.analise = { |
| 58 | 58 | Abre a janela de diálogo da ferramenta graficointerativo |
| 59 | 59 | */ |
| 60 | 60 | graficoInterativo: function(){ |
| 61 | - if(typeof(i3GEOF.graficointerativo) === 'undefined') | |
| 62 | - {i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.graficoInterativo()","graficointerativo","graficointerativo");} | |
| 61 | + i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.graficoInterativo()","graficointerativo","graficointerativo"); | |
| 63 | 62 | }, |
| 64 | 63 | /* |
| 65 | 64 | Function: linhaDoTempo |
| ... | ... | @@ -91,6 +90,14 @@ i3GEO.analise = { |
| 91 | 90 | {i3GEO.eventos.NAVEGAMAPA.push("atualizaLinhaDoTempo()");} |
| 92 | 91 | }, |
| 93 | 92 | /* |
| 93 | + Function: perfil | |
| 94 | + | |
| 95 | + Abre a janela de diálogo da ferramenta perfil | |
| 96 | + */ | |
| 97 | + perfil: function(){ | |
| 98 | + i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.perfil()","perfil","perfil"); | |
| 99 | + }, | |
| 100 | + /* | |
| 94 | 101 | Function: gradePontos |
| 95 | 102 | |
| 96 | 103 | Abre a janela de diálogo da ferramenta gradepontos |
| ... | ... | @@ -269,6 +276,7 @@ i3GEO.analise = { |
| 269 | 276 | '<td>' + |
| 270 | 277 | '<input style="cursor:pointer" type="checkbox" id="parartextos" checked />' + |
| 271 | 278 | '</td><td>Textos<td>' + |
| 279 | + '<td> <input id=i3GEObotaoPerfil size="22" type="button" value="perfil"></td>' + | |
| 272 | 280 | '</tr></table></span>' + |
| 273 | 281 | '</div>' + |
| 274 | 282 | '</div>'; |
| ... | ... | @@ -285,6 +293,17 @@ i3GEO.analise = { |
| 285 | 293 | imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); |
| 286 | 294 | YAHOO.janelaDocamede.xp.panel.moveTo(imagemxy[0]+150,imagemxy[1]); |
| 287 | 295 | YAHOO.util.Event.addListener(YAHOO.janelaDocamede.xp.panel.close, "click", i3GEO.analise.medeDistancia.fechaJanela); |
| 296 | + // | |
| 297 | + //botao que abre a ferramenta de cálculo de perfis. | |
| 298 | + //pontosdistobj contém as coordenadas dos pontos | |
| 299 | + // | |
| 300 | + new YAHOO.widget.Button( | |
| 301 | + "i3GEObotaoPerfil", | |
| 302 | + {onclick:{fn: function(){ | |
| 303 | + var js = i3GEO.configura.locaplic+"/ferramentas/perfil/index.js.php"; | |
| 304 | + i3GEO.util.scriptTag(js,"i3GEOF.perfil.criaJanelaFlutuante(pontosdistobj)","i3GEOF.perfil_script"); | |
| 305 | + }}} | |
| 306 | + ); | |
| 288 | 307 | }, |
| 289 | 308 | /* |
| 290 | 309 | Function: fechaJanela |
| ... | ... | @@ -295,6 +314,8 @@ i3GEO.analise = { |
| 295 | 314 | i3GEO.Interface.ATUAL !== "googleearth" ? i3GEO.desenho.richdraw.fecha() : i3GEO.Interface.googleearth.removePlacemark("divGeometriasTemp"); |
| 296 | 315 | i3GEO.util.removeChild("pontosins"); |
| 297 | 316 | i3GEO.util.removeChild("mostradistancia_c"); |
| 317 | + if($i("divGeometriasTemp")) | |
| 318 | + {i3GEO.desenho.richdraw.fecha();} | |
| 298 | 319 | YAHOO.util.Event.removeListener(YAHOO.janelaDocamede.xp.panel.close, "click"); |
| 299 | 320 | i3GEO.eventos.MOUSECLIQUE.remove("i3GEO.analise.medeDistancia.clique()"); |
| 300 | 321 | i3GEO.eventos.MOUSEMOVE.remove("i3GEO.analise.medeDistancia.movimento()"); | ... | ... |
classesjs/classe_janela.js
| ... | ... | @@ -313,11 +313,15 @@ i3GEO.janela = { |
| 313 | 313 | if(ifr == true) |
| 314 | 314 | {YAHOO.janelaDoca.xp.panel.iframe.style.zIndex = 0;} |
| 315 | 315 | if(modal === true){ |
| 316 | - if($i(id+"_mask")) | |
| 317 | - {$i(id+"_mask").style.zIndex = 9000 + i3GEO.janela.ULTIMOZINDEX + 1;} | |
| 316 | + if($i(id+"_mask")){ | |
| 317 | + $i(id+"_mask").style.zIndex = 9000 + i3GEO.janela.ULTIMOZINDEX + 1; | |
| 318 | + i3GEO.janela.ULTIMOZINDEX = 9000 + i3GEO.janela.ULTIMOZINDEX + 1; | |
| 319 | + } | |
| 320 | + } | |
| 321 | + if($i(id+"_c")){ | |
| 322 | + $i(id+"_c").style.zIndex = 23000 + i3GEO.janela.ULTIMOZINDEX + 1; | |
| 323 | + i3GEO.janela.ULTIMOZINDEX = 23000 + i3GEO.janela.ULTIMOZINDEX + 1; | |
| 318 | 324 | } |
| 319 | - if($i(id+"_c")) | |
| 320 | - {$i(id+"_c").style.zIndex = 23000 + i3GEO.janela.ULTIMOZINDEX + 1;} | |
| 321 | 325 | if(funcaoCabecalho) |
| 322 | 326 | {$i(id+'_cabecalho').onclick = funcaoCabecalho;} |
| 323 | 327 | if(funcaoMinimiza) |
| ... | ... | @@ -381,10 +385,8 @@ i3GEO.janela = { |
| 381 | 385 | i3GEO.util.escondePin(); |
| 382 | 386 | i3GEO.util.escondeBox(); |
| 383 | 387 | //fecha o container de desenho de elementos na tela |
| 384 | - if($i("divGeometriasTemp")) | |
| 385 | - {i3GEO.desenho.richdraw.fecha();} | |
| 386 | - //if($i("flamingoi")) | |
| 387 | - //{$i("flamingoi").style.display="block";} | |
| 388 | + //if($i("divGeometriasTemp")) | |
| 389 | + //{i3GEO.desenho.richdraw.fecha();} | |
| 388 | 390 | //executa as funções de fechamento |
| 389 | 391 | if(i3GEO.janela.ANTESFECHA){ |
| 390 | 392 | for(i=0;i<i3GEO.janela.ANTESFECHA.length;i++) | ... | ... |
classesjs/classe_php.js
| ... | ... | @@ -1107,5 +1107,18 @@ i3GEO.php = { |
| 1107 | 1107 | i3GEO.php.verifica(); |
| 1108 | 1108 | var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=alteradata&tema="+tema+"&novodata="+data; |
| 1109 | 1109 | cpJSON.call(p,"alteradata",funcao); |
| 1110 | - } | |
| 1110 | + }, | |
| 1111 | + /* | |
| 1112 | + Function: dadosPerfilRelevo | |
| 1113 | + | |
| 1114 | + <DADOSPERFILRELEVO> | |
| 1115 | + */ | |
| 1116 | + dadosPerfilRelevo: function(funcao,opcao,pontos,amostragem){ | |
| 1117 | + i3GEO.php.verifica(); | |
| 1118 | + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=dadosPerfilRelevo&opcao="+opcao; | |
| 1119 | + var cp = new cpaint(); | |
| 1120 | + cp.set_transfer_mode('POST'); | |
| 1121 | + cp.set_response_type("JSON"); | |
| 1122 | + cp.call(p,"foo",funcao,"&pontos="+pontos+"&amostragem="+amostragem); | |
| 1123 | + } | |
| 1111 | 1124 | }; |
| 1112 | 1125 | \ No newline at end of file | ... | ... |
classesjs/dicionario_ajuda.js
| ... | ... | @@ -812,6 +812,15 @@ g_traducao_ajuda = { |
| 812 | 812 | complemento:"", |
| 813 | 813 | tela:"", |
| 814 | 814 | apijs:"i3GEO.arvoreDeTemas" |
| 815 | + }, | |
| 816 | + "96": { | |
| 817 | + titulo: "Gráfico de perfil", | |
| 818 | + diretorio:"", | |
| 819 | + categoria:"3", | |
| 820 | + pt:"Cria um gráfico de perfil com base em um conjunto de dados contendo os valores de Z.", | |
| 821 | + complemento:"Os valores de Z podem ser obtidos de um tema ou de um serviço do tipo Google API", | |
| 822 | + tela:"", | |
| 823 | + apijs:"i3GEO.analise" | |
| 815 | 824 | } |
| 816 | 825 | } |
| 817 | 826 | }; | ... | ... |
classesphp/graficos.php
| ... | ... | @@ -520,4 +520,19 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="") |
| 520 | 520 | "events"=>$eventos |
| 521 | 521 | ); |
| 522 | 522 | } |
| 523 | +function dadosPerfilRelevo($pontos,$opcao,$amostragem){ | |
| 524 | + if($opcao == "google"){ | |
| 525 | + $urlGoogle = "http://maps.google.com/maps/api/elevation/json?sensor=false&path="; | |
| 526 | + $pontos = str_replace(",","|",$pontos); | |
| 527 | + $pontos = str_replace(" ",",",$pontos); | |
| 528 | + $urlGoogle .= $pontos."&samples=".$amostragem; | |
| 529 | + $curl = curl_init(); | |
| 530 | + curl_setopt ($curl, CURLOPT_URL, $urlGoogle); | |
| 531 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
| 532 | + $result = curl_exec($curl); | |
| 533 | + curl_close ($curl); | |
| 534 | + $result = json_decode( $result, true ); | |
| 535 | + } | |
| 536 | + return $result; | |
| 537 | +} | |
| 523 | 538 | ?> |
| 524 | 539 | \ No newline at end of file | ... | ... |
classesphp/mapa_controle.php
| ... | ... | @@ -1769,7 +1769,7 @@ Valor: DADOSLINHADOTEMPO |
| 1769 | 1769 | |
| 1770 | 1770 | Pega os dados de um tema para geração do gráfico de linha do tempo. |
| 1771 | 1771 | |
| 1772 | -<graficoPizza> | |
| 1772 | +<dadosLinhaDoTempo> | |
| 1773 | 1773 | */ |
| 1774 | 1774 | case "DADOSLINHADOTEMPO": |
| 1775 | 1775 | include_once("graficos.php"); |
| ... | ... | @@ -1778,6 +1778,19 @@ Pega os dados de um tema para geração do gráfico de linha do tempo. |
| 1778 | 1778 | $retorno = dadosLinhaDoTempo($map_file,$tema,$ext); |
| 1779 | 1779 | break; |
| 1780 | 1780 | /* |
| 1781 | +Valor: DADOSPERFILRELEVO | |
| 1782 | + | |
| 1783 | +Pega os dados para elaboração de gráfico de perfil do relevo | |
| 1784 | + | |
| 1785 | +<dadosPerfilRelevo> | |
| 1786 | +*/ | |
| 1787 | + case "DADOSPERFILRELEVO": | |
| 1788 | + include_once("graficos.php"); | |
| 1789 | + if(!isset($ext)) | |
| 1790 | + {$ext = "";} | |
| 1791 | + $retorno = dadosPerfilRelevo($pontos,$opcao,$amostragem); | |
| 1792 | + break; | |
| 1793 | +/* | |
| 1781 | 1794 | Section: Menu de temas |
| 1782 | 1795 | |
| 1783 | 1796 | Obtém a lista de temas, grupos e sub-grupos. | ... | ... |
ferramentas/graficointerativo/index.js.php
| ... | ... | @@ -55,6 +55,12 @@ i3GEOF.graficointerativo = { |
| 55 | 55 | */ |
| 56 | 56 | aguarde: "", |
| 57 | 57 | /* |
| 58 | + Propriedade: titulo | |
| 59 | + | |
| 60 | + Título do gráfico. Se for vazio, será obtido do nome do tema selecionado | |
| 61 | + */ | |
| 62 | + titulo: "", | |
| 63 | + /* | |
| 58 | 64 | Propriedade: tipo |
| 59 | 65 | |
| 60 | 66 | Tipo de gráfico escolhido pelo usuário. |
| ... | ... | @@ -117,10 +123,10 @@ i3GEOF.graficointerativo = { |
| 117 | 123 | |
| 118 | 124 | iddiv {String} - id do div que receberá o conteudo HTML da ferramenta |
| 119 | 125 | |
| 120 | - dados {JSON} - dados para o gráfico (opcional) | |
| 126 | + dados {JSON} - dados para o gráfico (opcional) exemplo ["n;x","'Argentina';33796870","'Paraguay';4773464","'Brazil';151525400","'Chile';13772710"] | |
| 121 | 127 | */ |
| 122 | 128 | inicia: function(iddiv,dados){ |
| 123 | - try{ | |
| 129 | + //try{ | |
| 124 | 130 | $i(iddiv).innerHTML += i3GEOF.graficointerativo.html(); |
| 125 | 131 | $i("i3GEOgraficointerativoAcumula").checked = i3GEOF.graficointerativo.acumula; |
| 126 | 132 | $i("i3GEOgraficointerativoRelativa").checked = i3GEOF.graficointerativo.relativa; |
| ... | ... | @@ -202,8 +208,8 @@ i3GEOF.graficointerativo = { |
| 202 | 208 | i3GEOF.graficointerativo.montaTabelaDados(dados); |
| 203 | 209 | $i("i3GEOgraficointerativoguia4").onclick.call(); |
| 204 | 210 | } |
| 205 | - } | |
| 206 | - catch(erro){alert(erro);} | |
| 211 | + //} | |
| 212 | + //catch(erro){alert(erro);} | |
| 207 | 213 | }, |
| 208 | 214 | /* |
| 209 | 215 | Function: html |
| ... | ... | @@ -350,7 +356,7 @@ i3GEOF.graficointerativo = { |
| 350 | 356 | i3GEO.barraDeBotoes.ativaIcone("graficointerativo"); |
| 351 | 357 | var i = $i("i3GEOF.graficointerativo_c").style; |
| 352 | 358 | i3GEO.janela.ULTIMOZINDEX++; |
| 353 | - i.zIndex = 21000 + i3GEO.janela.ULTIMOZINDEX; | |
| 359 | + i.zIndex = i3GEO.janela.ULTIMOZINDEX; | |
| 354 | 360 | }, |
| 355 | 361 | /* |
| 356 | 362 | Function: ativaTipo |
| ... | ... | @@ -478,7 +484,7 @@ i3GEOF.graficointerativo = { |
| 478 | 484 | i, |
| 479 | 485 | id, |
| 480 | 486 | cor = "#d01f3c"; |
| 481 | - if(!retorno.dados) | |
| 487 | + if(!retorno.dados && retorno.data != undefined) | |
| 482 | 488 | {dados = retorno.data.dados;} |
| 483 | 489 | else |
| 484 | 490 | {dados = retorno;} |
| ... | ... | @@ -556,6 +562,8 @@ i3GEOF.graficointerativo = { |
| 556 | 562 | legendaY = "", |
| 557 | 563 | fill = "#C4B86A", |
| 558 | 564 | pointSize = 2; |
| 565 | + if(i3GEOF.graficointerativo.titulo != "") | |
| 566 | + {titulo = i3GEOF.graficointerativo.titulo} | |
| 559 | 567 | if($i("i3GEOgraficointerativoComboXid")) |
| 560 | 568 | {legendaX = $i("i3GEOgraficointerativoComboXid").value;} |
| 561 | 569 | if($i("i3GEOgraficointerativoComboYid")) | ... | ... |
| ... | ... | @@ -0,0 +1,225 @@ |
| 1 | +<?php error_reporting(0);if(extension_loaded('zlib')){ob_start('ob_gzhandler');} header("Content-type: text/javascript"); ?> | |
| 2 | +/*jslint plusplus:false,white:false,undef: false, rhino: true, onevar: true, evil: true */ | |
| 3 | + | |
| 4 | +/* | |
| 5 | +Title: Perfil | |
| 6 | + | |
| 7 | +Cria um gráfico de perfil do "relevo" | |
| 8 | + | |
| 9 | +Veja: | |
| 10 | + | |
| 11 | +<i3GEO.analise.dialogo.perfil> | |
| 12 | + | |
| 13 | +Arquivo: | |
| 14 | + | |
| 15 | +i3geo/ferramentas/perfil/index.js.php | |
| 16 | + | |
| 17 | +Licenca: | |
| 18 | + | |
| 19 | +GPL2 | |
| 20 | + | |
| 21 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 22 | + | |
| 23 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 24 | +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br | |
| 25 | + | |
| 26 | +Este programa é software livre; você pode redistribuí-lo | |
| 27 | +e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 28 | +GNU conforme publicada pela Free Software Foundation; | |
| 29 | + | |
| 30 | +Este programa é distribuído na expectativa de que seja útil, | |
| 31 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 32 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 33 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 34 | +Você deve ter recebido uma cópia da Licença Pública Geral do | |
| 35 | +GNU junto com este programa; se não, escreva para a | |
| 36 | +Free Software Foundation, Inc., no endereço | |
| 37 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 38 | +*/ | |
| 39 | +if(typeof(i3GEOF) === 'undefined'){ | |
| 40 | + i3GEOF = []; | |
| 41 | +} | |
| 42 | +/* | |
| 43 | +Class: i3GEOF.perfil | |
| 44 | +*/ | |
| 45 | +i3GEOF.perfil = { | |
| 46 | + /* | |
| 47 | + Variavel: pontos | |
| 48 | + | |
| 49 | + Objeto com a lista de pontos iniciais enviadas como parâmetro na inicialização da ferramenta | |
| 50 | + */ | |
| 51 | + pontos: "", | |
| 52 | + /* | |
| 53 | + Variavel: dadosGrafico | |
| 54 | + | |
| 55 | + Dados no formato aceito pela ferramenta i3GEOF.graficointerativo | |
| 56 | + */ | |
| 57 | + dadosGrafico: [], | |
| 58 | + /* | |
| 59 | + Variavel: aguarde | |
| 60 | + | |
| 61 | + Objeto DOM com a imagem de aguarde existente no cabeçalho da janela. | |
| 62 | + */ | |
| 63 | + aguarde: "", | |
| 64 | + /* | |
| 65 | + Function: inicia | |
| 66 | + | |
| 67 | + Inicia a ferramenta. É chamado por criaJanelaFlutuante | |
| 68 | + | |
| 69 | + Parametro: | |
| 70 | + | |
| 71 | + iddiv {String} - id do div que receberá o conteudo HTML da ferramenta | |
| 72 | + */ | |
| 73 | + inicia: function(iddiv){ | |
| 74 | + try{ | |
| 75 | + $i(iddiv).innerHTML += i3GEOF.perfil.html(); | |
| 76 | + new YAHOO.widget.Button( | |
| 77 | + "i3GEOperfilbotao1", | |
| 78 | + {onclick:{fn: i3GEOF.perfil.criaPerfil}} | |
| 79 | + ); | |
| 80 | + } | |
| 81 | + catch(erro){alert(erro);} | |
| 82 | + }, | |
| 83 | + /* | |
| 84 | + Function: html | |
| 85 | + | |
| 86 | + Gera o código html para apresentação das opções da ferramenta | |
| 87 | + | |
| 88 | + Retorno: | |
| 89 | + | |
| 90 | + String com o código html | |
| 91 | + */ | |
| 92 | + html:function(){ | |
| 93 | + var ins = "<p class='paragrafo' >Escolha qual será a fonte dos dados de Z:"; | |
| 94 | + ins += "<p class='paragrafo' ><input style=cursor:pointer checked type=radio name=i3GEOFperfilFonte id=i3GEOFperfilFonteGoogle /> Google"; | |
| 95 | + ins += "<p class='paragrafo' ><input type=text id=i3GEOFperfilAmostragem value=20 size=3 /> Número de pontos que serão obtidos ao longo da linha"; | |
| 96 | + ins += "<br><br><input id=i3GEOperfilbotao1 type='buttom' value='Criar gráfico' />"; | |
| 97 | + ins += "<br><br><div style=text-align:left id=i3GEOperfilfim ></div>"; | |
| 98 | + return ins; | |
| 99 | + }, | |
| 100 | + /* | |
| 101 | + Function: criaJanelaFlutuante | |
| 102 | + | |
| 103 | + Cria a janela flutuante para controle da ferramenta. | |
| 104 | + | |
| 105 | + Parametro: | |
| 106 | + | |
| 107 | + pontos {objeto} - contém as coordenadas dos pontos que serão usados nos cálculos, como no exemplo | |
| 108 | + | |
| 109 | + pontos = {xpt: [],ypt:[]}; //xpt são os valores de x (array) e ypt os valores de y (array) | |
| 110 | + */ | |
| 111 | + criaJanelaFlutuante: function(pontos){ | |
| 112 | + var minimiza,cabecalho,janela,divid,temp,titulo,cabecalho,minimiza; | |
| 113 | + i3GEOF.perfil.pontos = pontos; | |
| 114 | + //cria a janela flutuante | |
| 115 | + titulo = "Perfil <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=3&idajuda=96' > </a>"; | |
| 116 | + cabecalho = function(){}; | |
| 117 | + minimiza = function(){ | |
| 118 | + i3GEO.janela.minimiza("i3GEOF.perfil"); | |
| 119 | + }; | |
| 120 | + janela = i3GEO.janela.cria( | |
| 121 | + "400px", | |
| 122 | + "200px", | |
| 123 | + "", | |
| 124 | + "", | |
| 125 | + "", | |
| 126 | + titulo, | |
| 127 | + "i3GEOF.perfil", | |
| 128 | + false, | |
| 129 | + "hd", | |
| 130 | + cabecalho, | |
| 131 | + minimiza | |
| 132 | + ); | |
| 133 | + divid = janela[2].id; | |
| 134 | + i3GEOF.perfil.aguarde = $i("i3GEOF.perfil_imagemCabecalho").style; | |
| 135 | + i3GEOF.perfil.inicia(divid); | |
| 136 | + }, | |
| 137 | + /* | |
| 138 | + Function: criaPerfil | |
| 139 | + | |
| 140 | + Executa a operação de geração do perfil | |
| 141 | + | |
| 142 | + Veja: | |
| 143 | + | |
| 144 | + <DADOSPERFILRELEVO> | |
| 145 | + */ | |
| 146 | + criaPerfil: function(){ | |
| 147 | + try{ | |
| 148 | + if(i3GEOF.perfil.aguarde.visibility === "visible") | |
| 149 | + {return;} | |
| 150 | + var p, | |
| 151 | + cp; | |
| 152 | + | |
| 153 | + i3GEOF.perfil.aguarde.visibility = "visible"; | |
| 154 | + fim = function(retorno){ | |
| 155 | + i3GEOF.perfil.aguarde.visibility = "hidden"; | |
| 156 | + if (retorno.data === undefined ) | |
| 157 | + {$i("i3GEOperfilfim").innerHTML = "Erro.";return;} | |
| 158 | + else{ | |
| 159 | + if(retorno.data.status != "OK") | |
| 160 | + {$i("i3GEOperfilfim").innerHTML = "Erro ao acessar o serviço de fornecimento dos dados";return;} | |
| 161 | + i3GEOF.perfil.converteDados(retorno.data.results); | |
| 162 | + if(!$i("i3GEOF.graficointerativo_script")){ | |
| 163 | + var js = i3GEO.configura.locaplic+"/ferramentas/graficointerativo/index.js.php"; | |
| 164 | + i3GEO.util.scriptTag(js,"i3GEOF.perfil.iniciaGrafico()","i3GEOF.graficointerativo_script"); | |
| 165 | + } | |
| 166 | + } | |
| 167 | + }; | |
| 168 | + var pontos = i3GEOF.perfil.listaPontos(); | |
| 169 | + i3GEO.php.dadosPerfilRelevo(fim,"google",pontos,$i("i3GEOFperfilAmostragem").value); | |
| 170 | + } | |
| 171 | + catch(e){$i("i3GEOperfilfim").innerHTML = "<p class='paragrafo' >Erro. "+e;i3GEO.janela.fechaAguarde();i3GEOF.perfil.aguarde.visibility = "hidden";} | |
| 172 | + }, | |
| 173 | + /* | |
| 174 | + Function: iniciaGrafico | |
| 175 | + | |
| 176 | + Inicializa o gráfico de perfil definindo os parâmetros da ferramenta i3GEOF.graficointerativo | |
| 177 | + */ | |
| 178 | + iniciaGrafico: function(){ | |
| 179 | + i3GEOF.graficointerativo.tipo = "line"; | |
| 180 | + i3GEOF.graficointerativo.titulo = "Perfil"; | |
| 181 | + i3GEOF.graficointerativo.criaJanelaFlutuante(i3GEOF.perfil.dadosGrafico); | |
| 182 | + }, | |
| 183 | + /* | |
| 184 | + Function: listaPontos | |
| 185 | + | |
| 186 | + Converte o objeto i3GEOF.perfil.pontos em uma string com a lista de pontos | |
| 187 | + | |
| 188 | + Retorno: | |
| 189 | + {string} - x y,x y,x y | |
| 190 | + */ | |
| 191 | + listaPontos: function(){ | |
| 192 | + var n = i3GEOF.perfil.pontos.xpt.length, | |
| 193 | + i = 0, | |
| 194 | + lista = [], | |
| 195 | + xs = i3GEOF.perfil.pontos.xpt, | |
| 196 | + ys = i3GEOF.perfil.pontos.ypt; | |
| 197 | + for(i=0;i<n;i++){ | |
| 198 | + lista.push(ys[i]+" "+xs[i]) | |
| 199 | + } | |
| 200 | + return lista.toString(","); | |
| 201 | + }, | |
| 202 | + /* | |
| 203 | + Function: converteDados | |
| 204 | + | |
| 205 | + Converte os dados com a altimetria para o formato aceito pela ferramenta de gráficos | |
| 206 | + | |
| 207 | + Parametro: | |
| 208 | + | |
| 209 | + google {objeto} - objeto no padrão da API do google veja http://code.google.com/intl/pt-BR/apis/maps/documentation/elevation | |
| 210 | + | |
| 211 | + Retorno: | |
| 212 | + | |
| 213 | + */ | |
| 214 | + converteDados: function(google){ | |
| 215 | + var n = google.length, | |
| 216 | + i = 0, | |
| 217 | + dados = ["n;x"]; | |
| 218 | + for (i==0; i<n;i++){ | |
| 219 | + dados.push(i+";"+google[i].elevation); | |
| 220 | + } | |
| 221 | + i3GEOF.perfil.dadosGrafico = dados; | |
| 222 | + return dados; | |
| 223 | + } | |
| 224 | +}; | |
| 225 | +<?php error_reporting(0);if(extension_loaded('zlib')){ob_end_flush();}?> | |
| 0 | 226 | \ No newline at end of file | ... | ... |