Commit 722b43fef7dc17dc40efbe81efa8719eda7e4852
1 parent
d1e54527
Exists in
master
and in
7 other branches
Reformulação dos códigos #134
Showing
2 changed files
with
289 additions
and
302 deletions
Show diff stats
ferramentas/analisageometrias/index.htm
| ... | ... | @@ -1,91 +0,0 @@ |
| 1 | -<html> | |
| 2 | -<head> | |
| 3 | -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | |
| 4 | -<link rel="stylesheet" type="text/css" href="../../css/i3geo_ferramentas.css"> | |
| 5 | -<title></title> | |
| 6 | -<style type="text/css" >button{background:url(../../imagens/tic.png) 98% 50% no-repeat;}</style> | |
| 7 | -<link rel="stylesheet" type="text/css" href="../../pacotes/yui270/build/button/assets/skins/sam/button.css"/> | |
| 8 | -<style type="text/css"> | |
| 9 | -body { | |
| 10 | - margin:0; | |
| 11 | - padding:0;border:0px; | |
| 12 | -} | |
| 13 | -</style> | |
| 14 | -</head> | |
| 15 | -<body name="ancora" class="yui-skin-sam" > | |
| 16 | - <div id=guiasYUI class="yui-navset" style="top:0px;cursor:pointer;left:0px;"> | |
| 17 | - <ul class="yui-nav" style="border-width:0pt 0pt 0px;border-color:rgb(240,240,240);border-bottom-color:white;"> | |
| 18 | - <li><a href="#ancora"><em><div id="guia1" style="text-align:center;font-size:10px;left:0px;" >Capturar</div></em></a></li> | |
| 19 | - <li><a href="#ancora"><em><div id="guia2" style="text-align:center;font-size:10px;left:0px;" >Listar</div></em></a></li> | |
| 20 | - <li><a href="#ancora"><em><div id="guia3" style="text-align:center;font-size:10px;left:0px;" >Análise</div></em></a></li> | |
| 21 | - </ul> | |
| 22 | - </div> | |
| 23 | - <div id=geral style="left:0px;top:0px;" > | |
| 24 | - <div id=guia1obj style="width:95%;text-align:left;position:relative;top:0px;left:5px"> | |
| 25 | - <div id=opc1 style=left:0px > | |
| 26 | - Escolha o tema que receberá a seleção: | |
| 27 | - <div id="temas" style="width:90%;text-align:left;left:0px"> | |
| 28 | - </div> | |
| 29 | - <br>Tipo de seleção: | |
| 30 | - <div id="operacao" style="width:90%;text-align:left;left:0px"> | |
| 31 | - </div> | |
| 32 | - <div onclick="capturageo()" style="width:90%;text-align:left;left:0px"> | |
| 33 | - <br><input id=botao1 size=45 type=button value="Capturar as geometrias selecionadas"/><br><br> | |
| 34 | - </div> | |
| 35 | - </div> | |
| 36 | - <div id=men1 style="top:5px;left:0px">Após escolher o tema, clique no mapa para selecionar os elementos desejados, caso vc já não tenha feito isso ou caso deseje alterar a seleção. Concluída a seleção, clique no botão de captura para obter as geometrias. <br>As geometrias capturadas podem ser vistas na segunda guia. | |
| 37 | - </div> | |
| 38 | - </div> | |
| 39 | - <div id=guia2obj style="width:90%;display:none;left:0px"> | |
| 40 | - <div id=listadegeometrias style="width:95%;text-align:left;left:0px;"> | |
| 41 | - </div> | |
| 42 | - <div style="text-align:left;left:0px" id=men3 > | |
| 43 | - Marque as geometrias para aplicar os processos desejados. | |
| 44 | - </div> | |
| 45 | - </div> | |
| 46 | - <div id=guia3obj style="width:95%;display:none;left:5px"> | |
| 47 | - <div id=opc2 style="text-align:left;left:0px"> | |
| 48 | - <div onclick='calculo()' style="text-align:left;left:0px"> | |
| 49 | - Operações que obtém descrições sobre a geometria, retornando valores que são adicionados aos itens da geometria:<br> | |
| 50 | - <br><input id=botao2 type=buttom size=25 value="Cálculos" /> | |
| 51 | - </div> | |
| 52 | - <select id=calculos style=position:relative;top:-20px;left:120px > | |
| 53 | - <option value="" selected >---</option> | |
| 54 | - <option value=area >área</option> | |
| 55 | - <option value=perimetro >perímetro</option> | |
| 56 | - </select><br> | |
| 57 | - <div onclick='funcoes()' style="text-align:left;left:0px"> | |
| 58 | - Operações que criam novas geometrias a partir de duas ou mais geometrias:<br> | |
| 59 | - <br><input id=botao3 type=button size=25 value='Funções nG' /> | |
| 60 | - </div> | |
| 61 | - <select id=funcoes style=position:relative;top:-20px;left:120px > | |
| 62 | - <option value="" selected >---</option> | |
| 63 | - <option value=union_geos >União</option> | |
| 64 | - <option value=intersection >Intersecção</option> | |
| 65 | - <option value=difference >Diferença</option> | |
| 66 | - <option value=symdifference >Diferença inversa</option> | |
| 67 | - <option value=convexhull >Convexo</option> | |
| 68 | - </select> | |
| 69 | - <div onclick='funcoes1()' style="text-align:left;left:0px"> | |
| 70 | - Operações que atuam sobre uma única geometria:<br> | |
| 71 | - <br><input id=botaof1 type=button size=25 value='Funções 1G' /> | |
| 72 | - </div> | |
| 73 | - <select id=funcoes1 style=position:relative;top:-20px;left:120px > | |
| 74 | - <option value="" selected >---</option> | |
| 75 | - <option value=convexhull >convexo</option> | |
| 76 | - <option value=boundary >entorno</option> | |
| 77 | - </select> | |
| 78 | - </div> | |
| 79 | - <div id=men2 style="text-align:left;left:0px" > | |
| 80 | - As operações de análise são executadas sobre as geometrias selecionadas. | |
| 81 | - Para maiores informações, veja: <a href='http://www.opengeospatial.org/standards/sfs' target=blank >OGC</a>, <a href='http://postgis.refractions.net/docs/ch06.html' target=blank >PostGis, </a>e <a href='http://www.vividsolutions.com/jts/tests/index.html' target=blank >JTS</a> | |
| 82 | - <br>Algumas funções para operarem corretamente sobre temas pontuais, precisam que antes seja feita a união dos pontos em uma nova geometria. | |
| 83 | - </div> | |
| 84 | - </div> | |
| 85 | - </div> | |
| 86 | - <!--mantido aqui apenas para compatibilidade--> | |
| 87 | - <input type=hidden id=toleranciapt value=0 /> | |
| 88 | - <script src="../i3geo_tudo_compacto.js.php" type="text/javascript"></script> | |
| 89 | - <script language="JavaScript" type="text/javascript" src="index.js"></script> | |
| 90 | -</body> | |
| 91 | -</html> | |
| 92 | 0 | \ No newline at end of file |
ferramentas/analisageometrias/index.js.php
| 1 | +<?php 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 */ | |
| 1 | 3 | /* |
| 2 | 4 | Title: Ferramenta análise de geometrias |
| 3 | 5 | |
| ... | ... | @@ -37,6 +39,12 @@ O tema que será utilizado é o que estiver armazenado na variável global i3GEO.te |
| 37 | 39 | */ |
| 38 | 40 | i3GEOF.analisaGeometrias = { |
| 39 | 41 | /* |
| 42 | + Variavel: aguarde | |
| 43 | + | |
| 44 | + Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. | |
| 45 | + */ | |
| 46 | + aguarde: "", | |
| 47 | + /* | |
| 40 | 48 | Function: inicia |
| 41 | 49 | |
| 42 | 50 | Inicia a ferramenta. É chamado por criaJanelaFlutuante |
| ... | ... | @@ -51,26 +59,34 @@ i3GEOF.analisaGeometrias = { |
| 51 | 59 | i3GEO.guias.mostraGuiaFerramenta("i3GEOanalisageometrias1","i3GEOanalisageometrias"); |
| 52 | 60 | //eventos das guias |
| 53 | 61 | $i("i3GEOanalisageometrias1").onclick = function() |
| 54 | - {i3GEO.guias.mostraGuiaFerramenta("i3GEOanalisageometriasa1","i3GEOanalisageometrias");}; | |
| 55 | - $i("i3GEOanalisageometrias2").onclick = function() | |
| 56 | - {i3GEO.guias.mostraGuiaFerramenta("i3GEOanalisageometrias2","i3GEOanalisageometrias");}; | |
| 57 | - | |
| 62 | + {i3GEO.guias.mostraGuiaFerramenta("i3GEOanalisageometrias1","i3GEOanalisageometrias");}; | |
| 63 | + $i("i3GEOanalisageometrias2").onclick = function(){ | |
| 64 | + if($i("i3GEOanalisageometrias2obj").style.display === "block") | |
| 65 | + {return;} | |
| 66 | + i3GEOF.analisaGeometrias.aguarde.visibility = "visible"; | |
| 67 | + i3GEO.guias.mostraGuiaFerramenta("i3GEOanalisageometrias2","i3GEOanalisageometrias"); | |
| 68 | + i3GEOF.analisaGeometrias.listaGeo(); | |
| 69 | + }; | |
| 70 | + $i("i3GEOanalisageometrias3").onclick = function() | |
| 71 | + {i3GEO.guias.mostraGuiaFerramenta("i3GEOanalisageometrias3","i3GEOanalisageometrias");}; | |
| 58 | 72 | new YAHOO.widget.Button( |
| 59 | 73 | "i3GEOanalisageometriasbotao1", |
| 60 | 74 | {onclick:{fn: i3GEOF.analisaGeometrias.capturageo}} |
| 61 | 75 | ); |
| 62 | 76 | i3GEO.util.mensagemAjuda("i3GEOanalisageometriasmen1",$i("i3GEOanalisageometriasmen1").innerHTML); |
| 77 | + i3GEO.util.mensagemAjuda("i3GEOanalisageometriasmen2",$i("i3GEOanalisageometriasmen2").innerHTML); | |
| 78 | + i3GEO.util.mensagemAjuda("i3GEOanalisageometriasmen3",$i("i3GEOanalisageometriasmen3").innerHTML); | |
| 63 | 79 | g_tipoacao=""; |
| 64 | 80 | g_operacao=""; |
| 65 | 81 | i3GEOF.analisaGeometrias.ativaFoco(); |
| 66 | - var combot = "<select style='font-size:11px' id='i3GEOanalisageometriastipoOperacao' onchange='i3GEOF.analisaGeometrias.operacao(this)' >" | |
| 67 | - combot += "<option value='adiciona' >Adiciona</option>" | |
| 68 | - combot += "<option value='retira' >Retira</option>" | |
| 69 | - combot += "<option value='inverte' >Inverte</option>" | |
| 70 | - combot += "<option value='limpa' >Limpa</option>" | |
| 71 | - combot += "</select>" | |
| 72 | - $i("i3GEOanalisageometriasoperacao").innerHTML = combot | |
| 73 | - | |
| 82 | + var combot = "<select style='font-size:11px' id='i3GEOanalisageometriastipoOperacao' onchange='i3GEOF.analisaGeometrias.operacao(this)' >"; | |
| 83 | + combot += "<option value='adiciona' >Adiciona</option>"; | |
| 84 | + combot += "<option value='retira' >Retira</option>"; | |
| 85 | + combot += "<option value='inverte' >Inverte</option>"; | |
| 86 | + combot += "<option value='limpa' >Limpa</option>"; | |
| 87 | + combot += "</select>"; | |
| 88 | + $i("i3GEOanalisageometriasoperacao").innerHTML = combot; | |
| 89 | + i3GEOF.analisaGeometrias.aguarde.visibility = "hidden"; | |
| 74 | 90 | } |
| 75 | 91 | catch(erro){alert(erro);} |
| 76 | 92 | }, |
| ... | ... | @@ -105,10 +121,39 @@ i3GEOF.analisaGeometrias = { |
| 105 | 121 | ins += ' </div>'; |
| 106 | 122 | ins += ' </div>'; |
| 107 | 123 | ins += ' <div class=guiaobj id="i3GEOanalisageometrias2obj" style="left:1px;display:none;">'; |
| 108 | - | |
| 124 | + ins += ' <div id=i3GEOanalisageometriaslistadegeometrias style="width:95%;text-align:left;left:0px;">'; | |
| 125 | + ins += ' </div><br><br>'; | |
| 126 | + ins += ' <div style="text-align:left;left:0px" id=i3GEOanalisageometriasmen3 >'; | |
| 127 | + ins += ' <p class=paragrafo >Marque as geometrias para aplicar os processos desejados.'; | |
| 128 | + ins += ' </div>'; | |
| 109 | 129 | ins += ' </div>'; |
| 110 | 130 | ins += ' <div class=guiaobj id="i3GEOanalisageometrias3obj" style="left:1px;display:none;">'; |
| 111 | - | |
| 131 | + ins += ' <p class=paragrafo >Operações que obtém descrições sobre a geometria, retornando valores que são adicionados aos itens da geometria:'; | |
| 132 | + ins += ' <br><select onchange="i3GEOF.analisaGeometrias.calculo(this)" >'; | |
| 133 | + ins += ' <option value="" selected >---</option>'; | |
| 134 | + ins += ' <option value=area >área</option>'; | |
| 135 | + ins += ' <option value=perimetro >perímetro</option>'; | |
| 136 | + ins += ' </select><br>'; | |
| 137 | + ins += ' <p class=paragrafo >Operações que criam novas geometrias a partir de duas ou mais geometrias:'; | |
| 138 | + ins += ' <br><select onchange="i3GEOF.analisaGeometrias.funcoes(this)" >'; | |
| 139 | + ins += ' <option value="" selected >---</option>'; | |
| 140 | + ins += ' <option value=union_geos >União</option>'; | |
| 141 | + ins += ' <option value=intersection >Intersecção</option>'; | |
| 142 | + ins += ' <option value=difference >Diferença</option>'; | |
| 143 | + ins += ' <option value=symdifference >Diferença inversa</option>'; | |
| 144 | + ins += ' <option value=convexhull >Convexo</option>'; | |
| 145 | + ins += ' </select>'; | |
| 146 | + ins += ' <p class=paragrafo >Operações que atuam sobre uma única geometria:'; | |
| 147 | + ins += ' <br><select onchange="i3GEOF.analisaGeometrias.funcoes1(this)" >'; | |
| 148 | + ins += ' <option value="" selected >---</option>'; | |
| 149 | + ins += ' <option value=convexhull >convexo</option>'; | |
| 150 | + ins += ' <option value=boundary >entorno</option>'; | |
| 151 | + ins += ' </select>'; | |
| 152 | + ins += ' <div id=i3GEOanalisageometriasmen2 style="text-align:left;left:0px" >'; | |
| 153 | + ins += ' <p class=paragrafo >As operações de análise são executadas sobre as geometrias selecionadas.'; | |
| 154 | + ins += ' <p class=paragrafo >Para maiores informações, veja: <a href="http://www.opengeospatial.org/standards/sfs" target=blank >OGC</a>, <a href="http://postgis.refractions.net/docs/ch06.html" target=blank >PostGis, </a>e <a href="http://www.vividsolutions.com/jts/tests/index.html" target=blank >JTS</a>'; | |
| 155 | + ins += ' <p class=paragrafo >Algumas funções para operarem corretamente sobre temas pontuais, precisam que antes seja feita a união dos pontos em uma nova geometria.'; | |
| 156 | + ins += ' </div>'; | |
| 112 | 157 | ins += ' </div>'; |
| 113 | 158 | ins += '</div> '; |
| 114 | 159 | return ins; |
| ... | ... | @@ -137,7 +182,7 @@ i3GEOF.analisaGeometrias = { |
| 137 | 182 | titulo = "Análise de geometrias <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=3&idajuda=23' > </a>"; |
| 138 | 183 | janela = i3GEO.janela.cria( |
| 139 | 184 | "500px", |
| 140 | - "400px", | |
| 185 | + "300px", | |
| 141 | 186 | "", |
| 142 | 187 | "", |
| 143 | 188 | "", |
| ... | ... | @@ -149,15 +194,14 @@ i3GEOF.analisaGeometrias = { |
| 149 | 194 | minimiza |
| 150 | 195 | ); |
| 151 | 196 | divid = janela[2].id; |
| 152 | - | |
| 153 | - /* | |
| 154 | - if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEOF.insereGrafico.insere()") < 0) | |
| 155 | - {i3GEO.eventos.MOUSECLIQUE.push("i3GEOF.insereGrafico.insere()");} | |
| 197 | + i3GEOF.analisaGeometrias.aguarde = $i("i3GEOF.analisaGeometrias_imagemCabecalho").style; | |
| 198 | + i3GEOF.analisaGeometrias.aguarde.visibility = "visible"; | |
| 199 | + if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEOF.analisaGeometrias.selecionaElemento()") < 0) | |
| 200 | + {i3GEO.eventos.MOUSECLIQUE.push("i3GEOF.analisaGeometrias.selecionaElemento()");} | |
| 156 | 201 | temp = function(){ |
| 157 | - i3GEO.eventos.MOUSECLIQUE.remove("i3GEOF.insereGrafico.insere()"); | |
| 202 | + i3GEO.eventos.MOUSECLIQUE.remove("i3GEOF.analisaGeometrias.selecionaElemento()"); | |
| 158 | 203 | }; |
| 159 | - YAHOO.util.Event.addListener(janela[0].close, "click", temp); | |
| 160 | - */ | |
| 204 | + YAHOO.util.Event.addListener(janela[0].close, "click", temp); | |
| 161 | 205 | i3GEOF.analisaGeometrias.inicia(divid); |
| 162 | 206 | }, |
| 163 | 207 | /* |
| ... | ... | @@ -166,13 +210,30 @@ i3GEOF.analisaGeometrias = { |
| 166 | 210 | Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado |
| 167 | 211 | */ |
| 168 | 212 | ativaFoco: function(){ |
| 169 | - if(g_tipoacao !== 'analisageometrias'){ | |
| 213 | + if(g_operacao !== 'analisageometrias'){ | |
| 214 | + i3GEO.barraDeBotoes.ativaIcone("selecao"); | |
| 170 | 215 | g_tipoacao='analisageometrias'; |
| 171 | 216 | g_operacao='analisageometrias'; |
| 172 | 217 | i3GEOF.analisaGeometrias.comboTemas(); |
| 218 | + var temp = $i(i3GEO.Interface.IDMAPA); | |
| 219 | + if(temp){ | |
| 220 | + temp.title = ""; | |
| 221 | + temp.style.cursor="pointer"; | |
| 222 | + } | |
| 173 | 223 | } |
| 174 | 224 | }, |
| 175 | 225 | /* |
| 226 | + Function: selecionaElemento | |
| 227 | + | |
| 228 | + Seleciona um elemento do tema ativo quando o usuário clica no mapa | |
| 229 | + | |
| 230 | + É executado no evento de clique no mapa | |
| 231 | + */ | |
| 232 | + selecionaElemento: function(){ | |
| 233 | + if(g_tipoacao === 'analisageometrias') | |
| 234 | + {i3GEO.selecao.porxy(i3GEO.temaAtivo,$i("i3GEOanalisageometriastipoOperacao").value,5);} | |
| 235 | + }, | |
| 236 | + /* | |
| 176 | 237 | Function: comboTemas |
| 177 | 238 | |
| 178 | 239 | Cria o combo com os temas disponíveis (temas ligados) para adição dos gráficos. |
| ... | ... | @@ -194,201 +255,218 @@ i3GEOF.analisaGeometrias = { |
| 194 | 255 | }, |
| 195 | 256 | "i3GEOanalisageometriastemas" |
| 196 | 257 | ); |
| 197 | - } | |
| 198 | -}; | |
| 199 | -/* | |
| 200 | -$i("guia1").onclick = function() | |
| 201 | -{mostraGuia("guia1")} | |
| 202 | -$i("guia2").onclick = function() | |
| 203 | -{mostraGuia("guia2");listageometrias();} | |
| 204 | -$i("guia3").onclick = function() | |
| 205 | -{mostraGuia("guia3");} | |
| 206 | - | |
| 207 | -mensagemAjuda("men2","") | |
| 208 | -mensagemAjuda("men3","") | |
| 209 | - | |
| 210 | -//combo com o tipo de operacao | |
| 211 | -//cria combo com os temas | |
| 212 | -comboTemasLigados("comboTemas",function(retorno) | |
| 213 | -{ | |
| 214 | - window.parent.g_tipoacao = "selecao"; | |
| 215 | - window.parent.i3GEO.eventos.MOUSECLIQUE.push("i3GEO.selecao.clique()"); | |
| 216 | - $i("temas").innerHTML = retorno.dados | |
| 217 | - aguarde("none") | |
| 218 | - $i("comboTemas").onchange = function() | |
| 219 | - {window.parent.i3GEO.temaAtivo = $i("comboTemas").value} | |
| 220 | -},"temas") | |
| 221 | - | |
| 222 | -YAHOO.example.init = function () | |
| 223 | -{ | |
| 224 | - function onPushButtonsMarkupReady() | |
| 225 | - { | |
| 226 | - new YAHOO.widget.Button("botao1"); | |
| 227 | - new YAHOO.widget.Button("botao2"); | |
| 228 | - new YAHOO.widget.Button("botao3"); | |
| 229 | - new YAHOO.widget.Button("botaof1"); | |
| 230 | - } | |
| 231 | - YAHOO.util.Event.onContentReady("botao1", onPushButtonsMarkupReady); | |
| 232 | -}() | |
| 233 | - | |
| 234 | -//executa o tipo de operacao selecionada se for o caso | |
| 235 | -function operacao(tipo) | |
| 236 | -{ | |
| 237 | - if((tipo.value == "limpa") || (tipo.value == "inverte")) | |
| 238 | - { | |
| 239 | - aguarde("block") | |
| 240 | - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=selecaopt&tema="+$i("comboTemas").value+"&tipo="+tipo.value | |
| 241 | - var cp = new cpaint(); | |
| 242 | - //cp.set_debug(2) | |
| 243 | - cp.set_response_type("JSON"); | |
| 244 | - window.parent.g_operacao = "selecao" | |
| 245 | - cp.call(p,"selecaoPT",window.parent.i3GEO.atualiza); | |
| 246 | - } | |
| 247 | -} | |
| 248 | -//captura as geometrias selecionadas e grava em arquivos | |
| 249 | -function capturageo() | |
| 250 | -{ | |
| 251 | - var nome=window.prompt("Nome que sera dado a geometria:") | |
| 252 | - aguarde("block") | |
| 253 | - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=capturageometrias&tema="+$i("comboTemas").value+"&nome="+nome | |
| 254 | - var cp = new cpaint(); | |
| 255 | - //cp.set_debug(2) | |
| 256 | - cp.set_response_type("JSON"); | |
| 257 | - cp.call(p,"capturageo",listageometrias); | |
| 258 | -} | |
| 259 | -//lista as geometrias capturadas | |
| 260 | -function listageometrias() | |
| 261 | -{ | |
| 262 | - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=listageometrias" | |
| 263 | - var cp = new cpaint(); | |
| 264 | - //cp.set_debug(2) | |
| 265 | - cp.set_response_type("JSON"); | |
| 266 | - cp.call(p,"listageometrias",montalistageometrias); | |
| 267 | -} | |
| 268 | -//monta a lista de geometrias | |
| 269 | -function montalistageometrias(retorno) | |
| 270 | -{ | |
| 271 | - if(retorno.data != "") | |
| 272 | - { | |
| 273 | - var ins = "<div onclick='excluirgeo()' style=top:0px; ><br><input id=botao4 type=button size=20 value='Excluir marcados' \></div>" | |
| 274 | - ins += "<div onclick='incmapa()' style=position:absolute;top:14px;left:140px ><input id=botao5 type=button size=20 value='Ver no mapa' \></div><br>" | |
| 275 | - var cor = "rgb(245,245,245)" | |
| 276 | - for (i=0;i<retorno.data.length; i++) | |
| 277 | - { | |
| 278 | - ins += "<table width=700 ><tr style=background-color:"+cor+" >" | |
| 279 | - ins += "<td width=5 ><input type=checkbox id="+retorno.data[i].arquivo+" style=cursor:pointer \></td>" | |
| 280 | - ins += "<td width=55 >"+retorno.data[i].layer+" "+retorno.data[i].arquivo+"</td>" | |
| 281 | - ins += "<td><table>" | |
| 282 | - var temp = retorno.data[i].dados | |
| 283 | - for (j=0;j<temp.length; j++) | |
| 258 | + }, | |
| 259 | + /* | |
| 260 | + Function: capturaGeo | |
| 261 | + | |
| 262 | + Captura as geometrias selecionadas. As geometrias capturadas são armazenadas como objetos | |
| 263 | + serializados no servidor, e podem ser utilizadas nas operações de análise | |
| 264 | + */ | |
| 265 | + capturageo:function(){ | |
| 266 | + if(i3GEOF.analisaGeometrias.aguarde.visibility === "visible") | |
| 267 | + {return;} | |
| 268 | + else | |
| 269 | + {i3GEOF.analisaGeometrias.aguarde.visibility = "visible";} | |
| 270 | + var p, | |
| 271 | + cp = new cpaint(), | |
| 272 | + nome=window.prompt("Nome que sera dado a geometria:"), | |
| 273 | + temp = function(retorno){ | |
| 274 | + if($i("i3GEOanalisageometrias2obj").style.display === "block"){ | |
| 275 | + i3GEOF.analisaGeometrias.aguarde.visibility = "visible"; | |
| 276 | + i3GEOF.analisaGeometrias.listaGeo(); | |
| 277 | + } | |
| 278 | + else{ | |
| 279 | + i3GEOF.analisaGeometrias.aguarde.visibility = "hidden"; | |
| 280 | + } | |
| 281 | + }; | |
| 282 | + try{ | |
| 283 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=capturageometrias&tema="+$i("i3GEOanalisageometriastemasLigados").value+"&nome="+nome; | |
| 284 | + cp.set_response_type("JSON"); | |
| 285 | + cp.call(p,"capturageo",temp); | |
| 286 | + }catch(e){ | |
| 287 | + alert("Ocorreu um erro: "+e); | |
| 288 | + i3GEOF.analisaGeometrias.aguarde.visibility = "hidden"; | |
| 289 | + } | |
| 290 | + }, | |
| 291 | + /* | |
| 292 | + Function: listaGeo | |
| 293 | + | |
| 294 | + Obtém a lista de geometrias armazenadas | |
| 295 | + */ | |
| 296 | + listaGeo: function(){ | |
| 297 | + var montalistageometrias, | |
| 298 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=listageometrias", | |
| 299 | + cp = new cpaint(); | |
| 300 | + montalistageometrias = function(retorno){ | |
| 301 | + if(retorno.data !== "") | |
| 284 | 302 | { |
| 285 | - ins += "<tr><td>"+temp[j].id+"</td><td style=text-align:left >" | |
| 286 | - if (temp[j].imagem != "") | |
| 287 | - {ins += "<img src='"+temp[j].imagem+"' />"} | |
| 288 | - for (k=0;k<temp[j].valores.length; k++) | |
| 303 | + var ins,cor,temp,j,k,i; | |
| 304 | + ins = "<input id=i3GEOanalisageometriasbotao4 type=button size=20 value='Excluir marcados' /> "; | |
| 305 | + ins += "<input id=i3GEOanalisageometriasbotao5 type=i3GEOanalisageometriasbutton size=20 value='Ver no mapa' /><br><br>"; | |
| 306 | + cor = "rgb(245,245,245)"; | |
| 307 | + for (i=0;i<retorno.data.length; i++) | |
| 289 | 308 | { |
| 290 | - ins += temp[j].valores[k].item+" = "+temp[j].valores[k].valor+"<br>" | |
| 291 | - | |
| 309 | + ins += "<table width=90% class=lista4 ><tr style=background-color:"+cor+" >"; | |
| 310 | + ins += "<td width=5 ><input type=checkbox id="+retorno.data[i].arquivo+" style=cursor:pointer /></td>"; | |
| 311 | + ins += "<td width=55 >"+retorno.data[i].layer+" "+retorno.data[i].arquivo+"</td>"; | |
| 312 | + ins += "<td><table>"; | |
| 313 | + temp = retorno.data[i].dados; | |
| 314 | + for (j=0;j<temp.length; j++) | |
| 315 | + { | |
| 316 | + ins += "<tr><td>"+temp[j].id+"</td><td style=text-align:left >"; | |
| 317 | + if (temp[j].imagem !== "") | |
| 318 | + {ins += "<img src='"+temp[j].imagem+"' />";} | |
| 319 | + for (k=0;k<temp[j].valores.length; k++) | |
| 320 | + {ins += temp[j].valores[k].item+" = "+temp[j].valores[k].valor+"<br>";} | |
| 321 | + ins += "</td></tr>"; | |
| 322 | + } | |
| 323 | + ins += "</table></td>"; | |
| 324 | + ins += "</tr></table>"; | |
| 325 | + if (cor === "rgb(245,245,245)") | |
| 326 | + {cor = "rgb(255,255,255)";} | |
| 327 | + else {cor = "rgb(245,245,245)";} | |
| 292 | 328 | } |
| 293 | - ins += "</td></tr>" | |
| 329 | + $i("i3GEOanalisageometriaslistadegeometrias").innerHTML = ins; | |
| 330 | + new YAHOO.widget.Button( | |
| 331 | + "i3GEOanalisageometriasbotao4", | |
| 332 | + {onclick:{fn: i3GEOF.analisaGeometrias.excluirGeo}} | |
| 333 | + ); | |
| 334 | + new YAHOO.widget.Button( | |
| 335 | + "i3GEOanalisageometriasbotao5", | |
| 336 | + {onclick:{fn: i3GEOF.analisaGeometrias.incluirNoMapa}} | |
| 337 | + ); | |
| 338 | + i3GEOF.analisaGeometrias.aguarde.visibility = "hidden"; | |
| 294 | 339 | } |
| 295 | - ins += "</table></td>" | |
| 296 | - ins += "</tr></table>" | |
| 297 | - if (cor == "rgb(245,245,245)"){cor = "rgb(255,255,255)"} | |
| 298 | - else {cor = "rgb(245,245,245)"} | |
| 299 | - } | |
| 300 | - $i("listadegeometrias").innerHTML = ins | |
| 301 | - YAHOO.example.init = function () | |
| 302 | - { | |
| 303 | - function onPushButtonsMarkupReady() | |
| 304 | - { | |
| 305 | - new YAHOO.widget.Button("botao4"); | |
| 306 | - new YAHOO.widget.Button("botao5"); | |
| 340 | + else{ | |
| 341 | + $i("i3GEOanalisageometriaslistadegeometrias").innerHTML = "<p class=paragrafo >Nenhuma geometria disponível."; | |
| 342 | + i3GEOF.analisaGeometrias.aguarde.visibility = "hidden"; | |
| 307 | 343 | } |
| 308 | - YAHOO.util.Event.onContentReady("botao5", onPushButtonsMarkupReady); | |
| 309 | - }() | |
| 310 | - } | |
| 311 | - aguarde("none") | |
| 312 | -} | |
| 313 | -function pegaMarcados() | |
| 314 | -{ | |
| 315 | - var inputs = $i("listadegeometrias").getElementsByTagName("input") | |
| 316 | - var listai = new Array; | |
| 317 | - for (i=0;i<inputs.length; i++) | |
| 318 | - { | |
| 319 | - if (inputs[i].checked == true) | |
| 320 | - {listai.push(inputs[i].id);} | |
| 321 | - } | |
| 322 | - return (listai.join(",")) | |
| 323 | -} | |
| 324 | -function incmapa() | |
| 325 | -{ | |
| 326 | - var lista = pegaMarcados() | |
| 327 | - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=incmapageometrias&lista="+lista | |
| 328 | - var cp = new cpaint(); | |
| 329 | - //cp.set_debug(2) | |
| 330 | - cp.set_response_type("JSON"); | |
| 331 | - cp.call(p,"incmapageometrias",window.parent.remapaf()); | |
| 332 | -} | |
| 333 | -function excluirgeo() | |
| 334 | -{ | |
| 335 | - aguarde("block") | |
| 336 | - var lista = pegaMarcados() | |
| 337 | - $i("listadegeometrias").innerHTML = "" | |
| 338 | - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=removergeometrias&lista="+lista | |
| 339 | - var cp = new cpaint(); | |
| 340 | - //cp.set_debug(2) | |
| 341 | - cp.set_response_type("JSON"); | |
| 342 | - cp.call(p,"removergeometrias",listageometrias); | |
| 343 | -} | |
| 344 | -function calculo() | |
| 345 | -{ | |
| 346 | - operacao = $i("calculos").value | |
| 347 | - if (operacao != "") | |
| 348 | - { | |
| 349 | - aguarde("block") | |
| 350 | - var lista = pegaMarcados() | |
| 351 | - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=calculaGeometrias&operacao="+operacao+"&lista="+lista | |
| 352 | - var cp = new cpaint(); | |
| 353 | - //cp.set_debug(2) | |
| 344 | + }; | |
| 354 | 345 | cp.set_response_type("JSON"); |
| 355 | - cp.call(p,"analisaGeometrias",concluidof); | |
| 356 | - } | |
| 357 | -} | |
| 358 | -function funcoes() | |
| 359 | -{ | |
| 360 | - operacao = $i("funcoes").value | |
| 361 | - if (operacao != "") | |
| 362 | - { | |
| 363 | - aguarde("block") | |
| 364 | - var lista = pegaMarcados() | |
| 365 | - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=funcoesGeometrias&operacao="+operacao+"&lista="+lista | |
| 366 | - var cp = new cpaint(); | |
| 367 | - //cp.set_debug(2) | |
| 346 | + cp.call(p,"listageometrias",montalistageometrias); | |
| 347 | + }, | |
| 348 | + /* | |
| 349 | + Function: excluirGeo | |
| 350 | + | |
| 351 | + Exclui do servidor as geometrias marcadas na lista de geometrias | |
| 352 | + */ | |
| 353 | + excluirGeo: function(){ | |
| 354 | + if(i3GEOF.analisaGeometrias.aguarde.visibility === "visible") | |
| 355 | + {return;} | |
| 356 | + else | |
| 357 | + {i3GEOF.analisaGeometrias.aguarde.visibility = "visible";} | |
| 358 | + var lista,p,cp; | |
| 359 | + lista = i3GEOF.analisaGeometrias.pegaGeometriasMarcadas(); | |
| 360 | + $i("i3GEOanalisageometriaslistadegeometrias").innerHTML = "<p class=paragrafo >Aguarde..."; | |
| 361 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=removergeometrias&lista="+lista; | |
| 362 | + cp = new cpaint(); | |
| 368 | 363 | cp.set_response_type("JSON"); |
| 369 | - cp.call(p,"funcoesGeometrias",concluidof); | |
| 370 | - } | |
| 371 | -} | |
| 372 | -function funcoes1() | |
| 373 | -{ | |
| 374 | - var lista = pegaMarcados(); | |
| 375 | - if(window.confirm("Essa operação funciona apenas se houver uma geometria. Continua?")) | |
| 376 | - { | |
| 377 | - operacao = $i("funcoes1").value | |
| 378 | - if (operacao != "") | |
| 379 | - { | |
| 380 | - aguarde("block") | |
| 381 | - var lista = pegaMarcados() | |
| 382 | - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=funcoesGeometrias&operacao="+operacao+"&lista="+lista | |
| 383 | - var cp = new cpaint(); | |
| 384 | - //cp.set_debug(2) | |
| 364 | + cp.call(p,"removergeometrias",i3GEOF.analisaGeometrias.listaGeo); | |
| 365 | + }, | |
| 366 | + /* | |
| 367 | + Function: incluirNoMapa | |
| 368 | + | |
| 369 | + Inclui no mapa as geometrias marcadas na lista de geometrias | |
| 370 | + */ | |
| 371 | + incluirNoMapa:function(){ | |
| 372 | + if(i3GEOF.analisaGeometrias.aguarde.visibility === "visible") | |
| 373 | + {return;} | |
| 374 | + else | |
| 375 | + {i3GEOF.analisaGeometrias.aguarde.visibility = "visible";} | |
| 376 | + var lista,p,cp, | |
| 377 | + temp = function(){ | |
| 378 | + i3GEO.atualiza(); | |
| 379 | + i3GEOF.analisaGeometrias.aguarde.visibility = "hidden"; | |
| 380 | + }; | |
| 381 | + lista = i3GEOF.analisaGeometrias.pegaGeometriasMarcadas(); | |
| 382 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=incmapageometrias&lista="+lista; | |
| 383 | + cp = new cpaint(); | |
| 384 | + cp.set_response_type("JSON"); | |
| 385 | + cp.call(p,"incmapageometrias",temp); | |
| 386 | + }, | |
| 387 | + /* | |
| 388 | + Function: pegaGeometriasMarcadas | |
| 389 | + | |
| 390 | + Retorna uma lista com os ids das geometrias que estão marcadas (checkbox) | |
| 391 | + */ | |
| 392 | + pegaGeometriasMarcadas:function(){ | |
| 393 | + var inputs = $i("i3GEOanalisageometriaslistadegeometrias").getElementsByTagName("input"), | |
| 394 | + listai = [], | |
| 395 | + n = inputs.length; | |
| 396 | + for (i=0;i<n; i++){ | |
| 397 | + if (inputs[i].checked === true) | |
| 398 | + {listai.push(inputs[i].id);} | |
| 399 | + } | |
| 400 | + return (listai.join(",")); | |
| 401 | + }, | |
| 402 | + /* | |
| 403 | + Function: calculo | |
| 404 | + | |
| 405 | + Realiza cálculos do tipo área e perímetro sobre as geometrias marcadas | |
| 406 | + */ | |
| 407 | + calculo: function(obj){ | |
| 408 | + if (obj.value !== ""){ | |
| 409 | + if(i3GEOF.analisaGeometrias.aguarde.visibility === "visible") | |
| 410 | + {return;} | |
| 411 | + else | |
| 412 | + {i3GEOF.analisaGeometrias.aguarde.visibility = "visible";} | |
| 413 | + var lista = i3GEOF.analisaGeometrias.pegaGeometriasMarcadas(), | |
| 414 | + temp, | |
| 415 | + cp = new cpaint(), | |
| 416 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=calculaGeometrias&operacao="+obj.value+"&lista="+lista; | |
| 417 | + | |
| 418 | + temp = function(){ | |
| 419 | + i3GEOF.analisaGeometrias.aguarde.visibility = "hidden"; | |
| 420 | + }; | |
| 421 | + cp.set_response_type("JSON"); | |
| 422 | + cp.call(p,"analisaGeometrias",temp); | |
| 423 | + } | |
| 424 | + }, | |
| 425 | + /* | |
| 426 | + Function: funcoes | |
| 427 | + | |
| 428 | + Realiza operações geométricas de cruzamento entre geometrias | |
| 429 | + */ | |
| 430 | + funcoes: function(obj){ | |
| 431 | + if (obj.value !== ""){ | |
| 432 | + if(i3GEOF.analisaGeometrias.aguarde.visibility === "visible") | |
| 433 | + {return;} | |
| 434 | + else | |
| 435 | + {i3GEOF.analisaGeometrias.aguarde.visibility = "visible";} | |
| 436 | + var lista = i3GEOF.analisaGeometrias.pegaGeometriasMarcadas(), | |
| 437 | + temp, | |
| 438 | + cp = new cpaint(), | |
| 439 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=funcoesGeometrias&operacao="+obj.value+"&lista="+lista; | |
| 440 | + | |
| 441 | + temp = function(){ | |
| 442 | + i3GEOF.analisaGeometrias.aguarde.visibility = "hidden"; | |
| 443 | + }; | |
| 385 | 444 | cp.set_response_type("JSON"); |
| 386 | - cp.call(p,"funcoesGeometrias",concluidof); | |
| 445 | + cp.call(p,"funcoesGeometrias",temp); | |
| 446 | + } | |
| 447 | + }, | |
| 448 | + /* | |
| 449 | + Function: funcoes1 | |
| 450 | + | |
| 451 | + Realiza operações geométricas em uma única geometria | |
| 452 | + */ | |
| 453 | + funcoes1: function(obj){ | |
| 454 | + if (obj.value !== ""){ | |
| 455 | + if(i3GEOF.analisaGeometrias.aguarde.visibility === "visible") | |
| 456 | + {return;} | |
| 457 | + else | |
| 458 | + {i3GEOF.analisaGeometrias.aguarde.visibility = "visible";} | |
| 459 | + var lista = i3GEOF.analisaGeometrias.pegaGeometriasMarcadas(), | |
| 460 | + temp, | |
| 461 | + cp = new cpaint(), | |
| 462 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=funcoesGeometrias&operacao="+obj.value+"&lista="+lista; | |
| 463 | + | |
| 464 | + temp = function(){ | |
| 465 | + i3GEOF.analisaGeometrias.aguarde.visibility = "hidden"; | |
| 466 | + }; | |
| 467 | + cp.set_response_type("JSON"); | |
| 468 | + cp.call(p,"funcoesGeometrias",temp); | |
| 387 | 469 | } |
| 388 | 470 | } |
| 389 | -} | |
| 390 | -function concluidof() | |
| 391 | -{ | |
| 392 | - aguarde("none") | |
| 393 | -} | |
| 394 | -*/ | |
| 395 | 471 | \ No newline at end of file |
| 472 | +}; | |
| 473 | +<?php if(extension_loaded('zlib')){ob_end_flush();}?> | |
| 396 | 474 | \ No newline at end of file | ... | ... |