Commit 4c712195e87ce51aa28c1187325f5d02b3290a6e

Authored by Edmar Moretti
1 parent 5ddcd23c

inclusão da opção de identificação na versão mobile

Showing 1 changed file with 179 additions and 0 deletions   Show diff stats
mobile/identifica.php 0 → 100644
... ... @@ -0,0 +1,179 @@
  1 +<?php
  2 +/*
  3 +Title: Identifica elementos no mapa em determinada coordenada x e y
  4 +
  5 +File: i3geo/mobile/adicionatema.php
  6 +
  7 +About: Licença
  8 +
  9 +I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  10 +
  11 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  12 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  13 +
  14 +Este programa é software livre; você pode redistribuí-lo
  15 +e/ou modificá-lo sob os termos da Licença Pública Geral
  16 +GNU conforme publicada pela Free Software Foundation;
  17 +tanto a versão 2 da Licença.
  18 +Este programa é distribuído na expectativa de que seja útil,
  19 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  20 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  21 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  22 +Você deve ter recebido uma cópia da Licença Pública Geral do
  23 +GNU junto com este programa; se não, escreva para a
  24 +Free Software Foundation, Inc., no endereço
  25 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  26 +
  27 +Parameters:
  28 +
  29 +tmpfname - nome do mapfile em uso
  30 +*/
  31 +
  32 +error_reporting(0);
  33 +require_once("../classesphp/funcoes_gerais.php");
  34 +include_once ("../classesphp/pega_variaveis.php");
  35 +include_once("../classesphp/carrega_ext.php");
  36 +require_once("../classesphp/classe_vermultilayer.php");
  37 +require_once("../classesphp/classe_atributos.php");
  38 +?>
  39 +<html>
  40 +<style>
  41 +body
  42 +{
  43 + font:14pt arial,helvetica,clean,sans-serif;
  44 + color:rgb(100,100,100);
  45 +}
  46 +p
  47 +{
  48 + font:12pt arial,helvetica,clean,sans-serif;
  49 + color:black;
  50 +}
  51 +input
  52 +{
  53 + font:14pt arial,helvetica,clean,sans-serif;
  54 + color:black;
  55 + cursor:pointer;
  56 + background-color:white;
  57 +}
  58 +h1
  59 +{
  60 + font:16pt arial,helvetica,clean,sans-serif;
  61 + color:brown;
  62 +}
  63 +</style>
  64 +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
  65 +<link rel="stylesheet" type="text/css" href="../css/i3geo_ferramentas.css">
  66 +<body>
  67 +<form id='f' action='mobile.php?' method='get'>
  68 + <input type='hidden' name='tmpfname' value='<?php echo $tmpfname; ?>' />
  69 + <input id='tipo' type=hidden name='tipo' value='retorno' />
  70 + <input id='tema' type=hidden name='tema' value='' />
  71 +</form>
  72 +<input type='button' value='retorna' style='cursor:pointer;' onclick='retorno()' />
  73 +<br><br>
  74 +<?php
  75 +if (!isset($tema)){$tema = "";}
  76 +if (!isset($resolucao)){$resolucao = 5;}
  77 +$xy = imagem2xy($tmpfname,($x." ".$y));
  78 +$m = new Atributos($tmpfname);
  79 +$retorno = $m->identifica("ligados",implode(",",$xy),$resolucao);
  80 +echo "Coordenadas: ".implode(",",$xy)."<br><br>";
  81 +?>
  82 +<div id=ocorrencia ></div>
  83 +<br><input type='button' value='retorna' style='cursor:pointer;' onclick='retorno()' /><br>
  84 +</body>
  85 +<script>
  86 +
  87 +function mostraf(retorno)
  88 +{
  89 + var res = ""
  90 + if (retorno != undefined)
  91 + {
  92 + var re = new RegExp("zzzzzzzzzz","g")
  93 + var retorno = retorno.replace(re,"<br>")
  94 + var re = new RegExp('" ',"g")
  95 + var retorno = retorno.replace(re,'"<br>')
  96 + var re = new RegExp("' ","g")
  97 + var retorno = retorno.replace(re,"'<br>")
  98 + var reg = /Erro./;
  99 + if (retorno.search(reg) != -1)
  100 + {
  101 + document.getElementById("ocorrencia").innerHTML="OOps! Ocorreu um erro\n"+retorno;
  102 + return;
  103 + }
  104 + var octemas = retorno.split("!")
  105 + for (octemasc=0;octemasc<octemas.length;octemasc++)
  106 + {
  107 + var titulo = octemas[octemasc].split("@")
  108 + var contat = 0
  109 + if (!titulo[1])
  110 + {
  111 + break
  112 + }
  113 + var ocs = titulo[1].split("*")
  114 + res += "<div style='color:black;font-size:14px;left:2px;text-align:left;background-color:white;width:80%' >"+titulo[0]+"</div>"
  115 + //verifica se é WS
  116 + var pares = ocs[1].split("##")
  117 + var valores = pares[0].split("#")
  118 + //dados vem de uma chamada WS
  119 + if (valores[1] == undefined)
  120 + {
  121 + res += "<div style=text-align:left;font-size:14px >Resultado: <pre><i>" + valores[0] + "</i></pre></div>"
  122 + res += "<div>------</div>"
  123 + document.getElementById("ocorrencia").innerHTML=res
  124 + //return
  125 + }
  126 + var contao = 0
  127 + for (oc=0;oc<ocs.length;oc++)
  128 + {
  129 + if (ocs[oc] != "")
  130 + {
  131 + var pares = ocs[oc].split("##")
  132 + if (contao == 1){var ver = true}
  133 + else {var ver = false}
  134 + var contav = 0
  135 + var cor = "RGB(245,245,245)";
  136 + for (par=0;par<pares.length;par++)
  137 + {
  138 + var valores = pares[par].split("#")
  139 + var vlink = valores[2]
  140 + if ((valores[2] != " ") && (valores[2] != undefined))
  141 + {res = res + "<div style='font-size:14px;width:80%;text-align:left;background-color:"+cor+"' >&nbsp;&nbsp;" + valores[0] + " <a href='" + vlink + "' > link</a></div>"}
  142 + else if ((valores[2] == " ") || (valores[2] != undefined))
  143 + {
  144 + var testaIcone = (valores[0].split(".png")).length
  145 + if (testaIcone == 1) //nao é do tipo ícone
  146 + {res = res + "<div style='font-size:14px;border-top:0px solid brown;width:90%;text-align:left;background-color:"+cor+"' ><b>&nbsp;&nbsp;" + valores[0] + " </b>" + valores[1] + "</div>"}
  147 + else //corrige o caminho do ícone
  148 + {
  149 + var i = valores[0].replace("..","../..")
  150 + res = res + "<div style='width:80%;text-align:left;background-color:"+cor+"' >" + i + " <i>" + valores[1] + "</i></div>"
  151 + }
  152 + }
  153 + contav = contav + 1
  154 + if (cor == "RGB(245,245,245)"){cor = "RGB(230,230,230)";}
  155 + else
  156 + {cor = "RGB(245,245,245)";}
  157 + }
  158 + //res += "<div style='border-top:1px solid gray;background-color:gray;width:100%;' ><br></div>"
  159 + }
  160 + contao = contao + 1
  161 + }
  162 + }
  163 + document.getElementById("ocorrencia").innerHTML=res
  164 + }
  165 + else
  166 + {
  167 + aguarde("none")
  168 + document.getElementById("ocorrencia").innerHTML = "<p style=color:red >Ocorreu um erro<br>"
  169 + }
  170 +}
  171 +function retorno()
  172 +{
  173 + document.getElementById('tipo').value='retorno';
  174 + document.getElementById('f').action = 'mobile.php';
  175 + document.getElementById('f').submit();
  176 +}
  177 +mostraf(<?php echo '"'.(mb_convert_encoding($retorno,"ISO-8859-1","UTF-8")).'"'; ?>)
  178 +</script>
  179 +</html>
0 180 \ No newline at end of file
... ...