Commit 4309250a3937d762271002faa7b2dd3d596cd53b
1 parent
07e4b064
Exists in
master
and in
7 other branches
Inclusão da função gráfico de perfil em outras ferramentas
Showing
7 changed files
with
152 additions
and
8 deletions
Show diff stats
classesjs/classe_util.js
@@ -1506,7 +1506,7 @@ i3GEO.util = { | @@ -1506,7 +1506,7 @@ i3GEO.util = { | ||
1506 | nome = retorno[i].tema; | 1506 | nome = retorno[i].tema; |
1507 | tema = retorno[i].name; | 1507 | tema = retorno[i].name; |
1508 | } | 1508 | } |
1509 | - if(retorno[i].escondido.toLowerCase() !== "sim") | 1509 | + if(retorno[i].escondido !== "sim") |
1510 | {comboTemas += "<option value="+tema+" >"+nome+"</option>";} | 1510 | {comboTemas += "<option value="+tema+" >"+nome+"</option>";} |
1511 | } | 1511 | } |
1512 | comboTemas += "</select>"; | 1512 | comboTemas += "</select>"; |
classesphp/classe_atributos.php
@@ -276,6 +276,7 @@ Pega todos os valores dos itens de uma tabela de um tema. | @@ -276,6 +276,7 @@ Pega todos os valores dos itens de uma tabela de um tema. | ||
276 | O range de busca pode ser limitado. | 276 | O range de busca pode ser limitado. |
277 | 277 | ||
278 | parameters: | 278 | parameters: |
279 | + | ||
279 | $itemtema - Tema que será processado. | 280 | $itemtema - Tema que será processado. |
280 | 281 | ||
281 | $tipo - Tipo de abrangência espacial (brasil ou mapa). | 282 | $tipo - Tipo de abrangência espacial (brasil ou mapa). |
classesphp/classe_shp.php
@@ -302,10 +302,13 @@ Include: | @@ -302,10 +302,13 @@ Include: | ||
302 | /* | 302 | /* |
303 | function: listaPontosShape | 303 | function: listaPontosShape |
304 | 304 | ||
305 | -Lista as coordenadas dos pontos de um shapefile | 305 | +Lista as coordenadas dos pontos de um layer |
306 | + | ||
307 | +Funciona apenas com elementos do tipo ponto | ||
306 | 308 | ||
307 | return: | 309 | return: |
308 | -string - xy | 310 | + |
311 | +array - xy | ||
309 | */ | 312 | */ |
310 | function listaPontosShape() | 313 | function listaPontosShape() |
311 | { | 314 | { |
@@ -333,6 +336,46 @@ string - xy | @@ -333,6 +336,46 @@ string - xy | ||
333 | return $xy; | 336 | return $xy; |
334 | } | 337 | } |
335 | /* | 338 | /* |
339 | +function: listaPontosShapeSel | ||
340 | + | ||
341 | +Lista as coordenadas dos elementos selecionados de um layer | ||
342 | + | ||
343 | +Funciona com elementos pontuais ou lineares | ||
344 | + | ||
345 | +return: | ||
346 | + | ||
347 | +array - xy | ||
348 | +*/ | ||
349 | + function listaPontosShapeSel() | ||
350 | + { | ||
351 | + //error_reporting(E_ALL); | ||
352 | + if(!$this->layer){return "erro";} | ||
353 | + $this->layer->set("template","none.htm"); | ||
354 | + $this->layer->setfilter(""); | ||
355 | + $existesel = carregaquery($this->arquivo,&$this->layer,&$this->mapa); | ||
356 | + $sopen = $this->layer->open(); | ||
357 | + if($sopen == MS_FAILURE){return "erro";} | ||
358 | + $res_count = $this->layer->getNumresults(); | ||
359 | + $xy = array(); | ||
360 | + for ($i = 0; $i < $res_count; ++$i) | ||
361 | + { | ||
362 | + $result = $this->layer->getResult($i); | ||
363 | + $shp_index = $result->shapeindex; | ||
364 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
365 | + $nlinhas = $shape->numlines; | ||
366 | + for($j = 0;$j < $nlinhas; ++$j){ | ||
367 | + $lin = $shape->line($j); | ||
368 | + $npontos = $lin->numpoints; | ||
369 | + for($k = 0;$k < $npontos; ++$k){ | ||
370 | + $pt = $lin->point($k); | ||
371 | + $xy[] = array("x"=>$pt->x,"y"=>$pt->y); | ||
372 | + } | ||
373 | + } | ||
374 | + } | ||
375 | + $fechou = $this->layer->close(); | ||
376 | + return $xy; | ||
377 | + } | ||
378 | +/* | ||
336 | function: ultimoXY | 379 | function: ultimoXY |
337 | 380 | ||
338 | Obtém as coordenadas xy do último ponto existente no layer. O último ponto é considerado entre aqueles que estão visíveis no mapa atual | 381 | Obtém as coordenadas xy do último ponto existente no layer. O último ponto é considerado entre aqueles que estão visíveis no mapa atual |
classesphp/mapa_controle.php
@@ -1634,6 +1634,18 @@ Lista os pontos dos elementos de um arquivo shp. | @@ -1634,6 +1634,18 @@ Lista os pontos dos elementos de um arquivo shp. | ||
1634 | $retorno = $m->listaPontosShape(); | 1634 | $retorno = $m->listaPontosShape(); |
1635 | break; | 1635 | break; |
1636 | /* | 1636 | /* |
1637 | +Valor: LISTAPONTOSSHAPESEL | ||
1638 | + | ||
1639 | +Lista os pontos dos elementos selecionados de um layer | ||
1640 | + | ||
1641 | +<SHP->listaPontosShapeSel> | ||
1642 | +*/ | ||
1643 | + case "LISTAPONTOSSHAPESEL": | ||
1644 | + include_once("classe_shp.php"); | ||
1645 | + $m = new SHP($map_file,$tema); | ||
1646 | + $retorno = $m->listaPontosShapeSel(); | ||
1647 | + break; | ||
1648 | +/* | ||
1637 | Valor: CRIASHPVAZIO | 1649 | Valor: CRIASHPVAZIO |
1638 | 1650 | ||
1639 | Cria um shapefile vazio e acrescenta como tema ao mapa. | 1651 | Cria um shapefile vazio e acrescenta como tema ao mapa. |
ferramentas/inserexy2/index.js.php
@@ -18,7 +18,7 @@ Licenca: | @@ -18,7 +18,7 @@ Licenca: | ||
18 | 18 | ||
19 | GPL2 | 19 | GPL2 |
20 | 20 | ||
21 | -I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | 21 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet |
22 | 22 | ||
23 | Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | 23 | Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil |
24 | Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br | 24 | Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br |
@@ -101,6 +101,11 @@ i3GEOF.inserexy = { | @@ -101,6 +101,11 @@ i3GEOF.inserexy = { | ||
101 | {onclick:{fn: i3GEOF.inserexy.criatemaeditavel}} | 101 | {onclick:{fn: i3GEOF.inserexy.criatemaeditavel}} |
102 | ); | 102 | ); |
103 | new YAHOO.widget.Button( | 103 | new YAHOO.widget.Button( |
104 | + "i3GEOinserexybotaoperfil", | ||
105 | + {onclick:{fn: i3GEOF.inserexy.graficoPerfil}} | ||
106 | + ); | ||
107 | + | ||
108 | + new YAHOO.widget.Button( | ||
104 | "i3GEOinserexybotao2", | 109 | "i3GEOinserexybotao2", |
105 | {onclick:{fn: i3GEOF.inserexy.inserir}} | 110 | {onclick:{fn: i3GEOF.inserexy.inserir}} |
106 | ); | 111 | ); |
@@ -163,6 +168,7 @@ i3GEOF.inserexy = { | @@ -163,6 +168,7 @@ i3GEOF.inserexy = { | ||
163 | ' <div id=i3GEOinserexyshapefile style="left:0px;text-align:left;">' + | 168 | ' <div id=i3GEOinserexyshapefile style="left:0px;text-align:left;">' + |
164 | ' </div><br>' + | 169 | ' </div><br>' + |
165 | ' <p class=paragrafo ><input id=i3GEOinserexybotaocriatema type="button" size=18 value="Criar um tema editável" />' + | 170 | ' <p class=paragrafo ><input id=i3GEOinserexybotaocriatema type="button" size=18 value="Criar um tema editável" />' + |
171 | + ' <input id=i3GEOinserexybotaoperfil type="button" size=18 value="Gráfico de perfil" /></p>' + | ||
166 | 172 | ||
167 | ' <div id=i3GEOinserexyopcitens style=display:none;left:0px;text-align:left; >' + | 173 | ' <div id=i3GEOinserexyopcitens style=display:none;left:0px;text-align:left; >' + |
168 | ' <p class=paragrafo >Se vc quiser, escolha um item existente no tema e o valor que será incluído quando o ponto for adicionado. Vc pode mudar o valor quando desejar:</p>' + | 174 | ' <p class=paragrafo >Se vc quiser, escolha um item existente no tema e o valor que será incluído quando o ponto for adicionado. Vc pode mudar o valor quando desejar:</p>' + |
@@ -326,8 +332,11 @@ i3GEOF.inserexy = { | @@ -326,8 +332,11 @@ i3GEOF.inserexy = { | ||
326 | }; | 332 | }; |
327 | } | 333 | } |
328 | if(i3GEO.temaAtivo !== ""){ | 334 | if(i3GEO.temaAtivo !== ""){ |
329 | - $i("i3GEOinserexytemasLocais").value = i3GEO.temaAtivo; | ||
330 | - $i("i3GEOinserexytemasLocais").onchange.call(); | 335 | + var temp = $i("i3GEOinserexytemasLocais"); |
336 | + if(temp){ | ||
337 | + temp.value = i3GEO.temaAtivo; | ||
338 | + temp.onchange.call(); | ||
339 | + } | ||
331 | } | 340 | } |
332 | }, | 341 | }, |
333 | "i3GEOinserexyshapefile", | 342 | "i3GEOinserexyshapefile", |
@@ -678,6 +687,36 @@ i3GEOF.inserexy = { | @@ -678,6 +687,36 @@ i3GEOF.inserexy = { | ||
678 | cp.call(i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=mostrawkt&xy="+xy,"xy2wkt",mostra); | 687 | cp.call(i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=mostrawkt&xy="+xy,"xy2wkt",mostra); |
679 | } | 688 | } |
680 | catch(e){alert("Erro: "+e);i3GEOF.inserexy.aguarde.visibility = "hidden";} | 689 | catch(e){alert("Erro: "+e);i3GEOF.inserexy.aguarde.visibility = "hidden";} |
690 | + }, | ||
691 | + /* | ||
692 | + Function: graficoPerfil | ||
693 | + | ||
694 | + Cria um gráfico de perfil com base nos dados inseridos | ||
695 | + */ | ||
696 | + graficoPerfil: function(){ | ||
697 | + try{ | ||
698 | + var divs = $i("i3GEOinserexyguia6obj").getElementsByTagName("div"), | ||
699 | + js = i3GEO.configura.locaplic+"/ferramentas/perfil/index.js.php", | ||
700 | + n = divs.length, | ||
701 | + x = [], | ||
702 | + y = [], | ||
703 | + xy, | ||
704 | + i; | ||
705 | + for (i=0;i<n;i++){ | ||
706 | + xy = divs[i].innerHTML.split(" "); | ||
707 | + x.push(xy[0]); | ||
708 | + y.push(xy[1]); | ||
709 | + } | ||
710 | + if(x.length == 0) | ||
711 | + {alert("Nenhum ponto encontrado");return;} | ||
712 | + pontosdistobj = { | ||
713 | + xpt: x, | ||
714 | + ypt: y | ||
715 | + }; | ||
716 | + i3GEO.util.scriptTag(js,"i3GEOF.perfil.criaJanelaFlutuante(pontosdistobj)","i3GEOF.perfil_script"); | ||
717 | + | ||
718 | + } | ||
719 | + catch(e){alert("Erro: "+e);} | ||
681 | } | 720 | } |
682 | }; | 721 | }; |
683 | <?php error_reporting(0);if(extension_loaded('zlib')){ob_end_flush();}?> | 722 | <?php error_reporting(0);if(extension_loaded('zlib')){ob_end_flush();}?> |
ferramentas/selecao/index.js.php
@@ -132,6 +132,8 @@ i3GEOF.selecao = { | @@ -132,6 +132,8 @@ i3GEOF.selecao = { | ||
132 | if(i3GEO.Interface.ATUAL != "googlemaps" && i3GEO.Interface.ATUAL != "googleearth") | 132 | if(i3GEO.Interface.ATUAL != "googlemaps" && i3GEO.Interface.ATUAL != "googleearth") |
133 | {ins += ' <img id=i3GEOselecaobox onclick="i3GEOF.selecao.tiposel(this)" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/region.png" title="Desenhe um retangulo no mapa para selecionar" style="cursor:pointer;border:1px solid RGB(230,230,230);" />';} | 133 | {ins += ' <img id=i3GEOselecaobox onclick="i3GEOF.selecao.tiposel(this)" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/region.png" title="Desenhe um retangulo no mapa para selecionar" style="cursor:pointer;border:1px solid RGB(230,230,230);" />';} |
134 | ins += ' <img onclick="i3GEOF.selecao.grafico()" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/layer-vector-chart-add.png" title="Grafico" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' + | 134 | ins += ' <img onclick="i3GEOF.selecao.grafico()" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/layer-vector-chart-add.png" title="Grafico" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' + |
135 | + ' <img onclick="i3GEOF.selecao.graficoPerfil()" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/grafico-perfil.png" title="Perfil" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' + | ||
136 | + | ||
135 | ' <img onclick="i3GEOF.selecao.operacao(\'inverte\')" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/undo.png" title="Inverte a selecao" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' + | 137 | ' <img onclick="i3GEOF.selecao.operacao(\'inverte\')" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/undo.png" title="Inverte a selecao" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' + |
136 | ' <img onclick="i3GEOF.selecao.operacao(\'limpa\')" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/erase.png" title="Limpa a selecao" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' + | 138 | ' <img onclick="i3GEOF.selecao.operacao(\'limpa\')" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/erase.png" title="Limpa a selecao" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' + |
137 | ' <img onclick="i3GEOF.selecao.criatema()" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/save1.png" title="Salva a selecao como um novo tema" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' + | 139 | ' <img onclick="i3GEOF.selecao.criatema()" src="'+i3GEO.configura.locaplic+'/imagens/gisicons/save1.png" title="Salva a selecao como um novo tema" style="cursor:pointer;border:1px solid RGB(230,230,230);" />' + |
@@ -904,8 +906,11 @@ i3GEOF.selecao = { | @@ -904,8 +906,11 @@ i3GEOF.selecao = { | ||
904 | aplicaselecaoTema: function(){ | 906 | aplicaselecaoTema: function(){ |
905 | if(i3GEOF.selecao.aguarde.visibility === "visible") | 907 | if(i3GEOF.selecao.aguarde.visibility === "visible") |
906 | {return;} | 908 | {return;} |
907 | - if($i("i3GEOselecaotemasLigados").value === "") | ||
908 | - {alert("Escolha um tema");return;} | 909 | + if($i("i3GEOselecaotemasLigados").value === ""){ |
910 | + alert("Escolha um tema"); | ||
911 | + i3GEOF.selecao.aguarde.visibility = "hidden"; | ||
912 | + return; | ||
913 | + } | ||
909 | try{ | 914 | try{ |
910 | i3GEOF.selecao.aguarde.visibility = "visible"; | 915 | i3GEOF.selecao.aguarde.visibility = "visible"; |
911 | var temp = function(retorno){ | 916 | var temp = function(retorno){ |
@@ -929,6 +934,50 @@ i3GEOF.selecao = { | @@ -929,6 +934,50 @@ i3GEOF.selecao = { | ||
929 | */ | 934 | */ |
930 | grafico: function(){ | 935 | grafico: function(){ |
931 | i3GEO.analise.dialogo.graficoInterativo(); | 936 | i3GEO.analise.dialogo.graficoInterativo(); |
937 | + }, | ||
938 | + /* | ||
939 | + Function: graficoPerfil | ||
940 | + | ||
941 | + Abre uma janela flutuante para criar gráficos de perfil | ||
942 | + */ | ||
943 | + graficoPerfil: function(){ | ||
944 | + var cp,p,temp; | ||
945 | + if(i3GEOF.selecao.aguarde.visibility === "visible") | ||
946 | + {return;} | ||
947 | + if($i("i3GEOselecaotemasLigados").value === "") | ||
948 | + {alert("Escolha um tema");return;} | ||
949 | + try{ | ||
950 | + i3GEOF.selecao.aguarde.visibility = "visible"; | ||
951 | + var temp = function(retorno){ | ||
952 | + i3GEOF.selecao.aguarde.visibility = "hidden"; | ||
953 | + if (retorno.data != undefined){ | ||
954 | + var x = [], | ||
955 | + y = [], | ||
956 | + i, | ||
957 | + n = retorno.data.length, | ||
958 | + js = i3GEO.configura.locaplic+"/ferramentas/perfil/index.js.php"; | ||
959 | + for (i=0;i<n; i++){ | ||
960 | + x.push(retorno.data[i].x); | ||
961 | + y.push(retorno.data[i].y); | ||
962 | + } | ||
963 | + if(x.length == 0) | ||
964 | + {alert("Nenhum ponto encontrado");return;} | ||
965 | + pontosdistobj = { | ||
966 | + xpt: x, | ||
967 | + ypt: y | ||
968 | + }; | ||
969 | + i3GEO.util.scriptTag(js,"i3GEOF.perfil.criaJanelaFlutuante(pontosdistobj)","i3GEOF.perfil_script"); | ||
970 | + } | ||
971 | + }; | ||
972 | + cp = new cpaint(); | ||
973 | + cp.set_response_type("JSON"); | ||
974 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=listaPontosShapeSel&tema="+i3GEO.temaAtivo; | ||
975 | + cp.call(p,"listaPontosShape",temp); | ||
976 | + } | ||
977 | + catch(e){ | ||
978 | + alert("Erro: "+e); | ||
979 | + i3GEOF.selecao.aguarde.visibility = "hidden"; | ||
980 | + } | ||
932 | } | 981 | } |
933 | 982 | ||
934 | }; | 983 | }; |
557 Bytes