Commit b77ac9895c70f7179dd1e66a52a9c3b866dda4f6

Authored by Edmar Moretti
1 parent 8dfa7cf0

Inclusão da opção de localização de coordenadas na versão mobile

classesphp/classe_temas.php
@@ -87,10 +87,12 @@ $map_file - Endereço do mapfile no servidor. @@ -87,10 +87,12 @@ $map_file - Endereço do mapfile no servidor.
87 87
88 $tema - nome do tema que será processado 88 $tema - nome do tema que será processado
89 */ 89 */
90 - function __construct($map_file,$tema) 90 + function __construct($map_file,$tema=null)
91 { 91 {
92 //error_reporting(E_ALL); 92 //error_reporting(E_ALL);
  93 + if (file_exists("funcoes_gerais.php"))
93 require_once("funcoes_gerais.php"); 94 require_once("funcoes_gerais.php");
  95 +
94 $this->mapa = ms_newMapObj($map_file); 96 $this->mapa = ms_newMapObj($map_file);
95 $this->arquivo = $map_file; 97 $this->arquivo = $map_file;
96 if (isset($tema)) 98 if (isset($tema))
mobile/localizarxy.php 0 → 100644
@@ -0,0 +1,131 @@ @@ -0,0 +1,131 @@
  1 +<?php
  2 +/*
  3 +Title: Localiza um lugar no mapa.
  4 +
  5 +Utiliza o web service geonames do MMA.
  6 +
  7 +File: i3geo/mobile/localizar.php
  8 +
  9 +About: Licença
  10 +
  11 +I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  12 +
  13 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  14 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  15 +
  16 +Este programa é software livre; você pode redistribuí-lo
  17 +e/ou modificá-lo sob os termos da Licença Pública Geral
  18 +GNU conforme publicada pela Free Software Foundation;
  19 +tanto a versão 2 da Licença.
  20 +Este programa é distribuído na expectativa de que seja útil,
  21 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  22 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  23 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  24 +Você deve ter recebido uma cópia da Licença Pública Geral do
  25 +GNU junto com este programa; se não, escreva para a
  26 +Free Software Foundation, Inc., no endereço
  27 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  28 +
  29 +Parameters:
  30 +
  31 +tmpfname - nome do mapfile em uso
  32 +*/
  33 +error_reporting(E_ALL);
  34 +require_once("../classesphp/funcoes_gerais.php");
  35 +include_once ("../classesphp/pega_variaveis.php");
  36 +include_once("../classesphp/carrega_ext.php");
  37 +include_once("../classesphp/funcoes_gerais.php");
  38 +include_once("../ms_configura.php");
  39 +
  40 +if (isset($x) && $x != "")
  41 +{
  42 + include("../classesphp/classe_temas.php");
  43 + $m = new Temas($tmpfname);
  44 + $m->insereFeature("ponto","POINT",($x." ".$y),"","","","","","","","","","","","","","","","","","","12","");
  45 + $m->salva();
  46 + echo "Coordenadas $x e $y inseridas.<br>Clique em 'retornar' para voltar ao mapa.<br><br>";
  47 +}
  48 +?>
  49 +<html>
  50 +<style>
  51 +body
  52 +{
  53 + font:14pt arial,helvetica,clean,sans-serif;
  54 + color:rgb(100,100,100);
  55 +}
  56 +p
  57 +{
  58 + font:12pt arial,helvetica,clean,sans-serif;
  59 + color:black;
  60 +}
  61 +input
  62 +{
  63 + font:14pt arial,helvetica,clean,sans-serif;
  64 + color:black;
  65 + cursor:pointer;
  66 + background-color:white;
  67 +}
  68 +h1
  69 +{
  70 + font:16pt arial,helvetica,clean,sans-serif;
  71 + color:brown;
  72 +}
  73 +</style>
  74 +<body>
  75 +<input type='button' value='retorna' style='cursor:pointer;' onclick='retorno()' /><br><br>
  76 +<form id='f' action='localizarxy.php?' method='get'>
  77 + Digite as coordenadas do ponto desejado. Utilize coordenadas na proje&ccedil;&atilde;o geogr&aacute;fica em graus, minutos e segundos.
  78 + Ao digitar o valor de grau, utilize o sinal de "-" antes do valor para indicar que a coordenada est&aacute; ao sul do equador ou oeste,
  79 + por exemplo: -54 00 00 e -12 00 00. Ao digitar os segundos, utilize "." como separador de decimal caso seja necess&aacute;rio.
  80 + Coordenadas X correspondem à longitude e coordenadas y à latitude.<br><br>
  81 + Coordenada X:<br>
  82 + <input type=text name=x id=x value="" size=14 /><br>
  83 + Coordenada Y:<br>
  84 + <input type=text name=y id=y value="" size=14 /><br>
  85 + <input type='hidden' name='tmpfname' value='<?php echo $tmpfname; ?>' />
  86 + <input id='tipo' type=hidden name='tipo' value='retorno' />
  87 +</form>
  88 +<input type='button' id='localizar' value='localizar' style='cursor:pointer;' onclick='localizar()' /><br><br>
  89 +
  90 +
  91 +</body>
  92 +<script>
  93 +function retorno()
  94 +{
  95 + document.getElementById('tipo').value='retorno';
  96 + document.getElementById('f').action = 'mobile.php';
  97 + document.getElementById('f').submit();
  98 +}
  99 +function convdmsdd(cd,cm,cs)
  100 +{
  101 + var sinal = 'positivo';
  102 + if (cd < 0)
  103 + {
  104 + cd = cd * -1;
  105 + sinal = 'negativo';
  106 + }
  107 + spm = cs / 3600;
  108 + mpg = cm / 60;
  109 + var dd = (cd * 1) + (mpg * 1) + (spm * 1);
  110 + if (sinal == 'negativo')
  111 + {dd = dd * -1;}
  112 + return (dd);
  113 +}
  114 +function localizar()
  115 +{
  116 + var x = document.getElementById("x").value.split(" ")
  117 + if(!x[1]) x[1] = 0;
  118 + if(!x[2]) x[2] = 0;
  119 + var x = convdmsdd(x[0],x[1],x[2]);
  120 + document.getElementById("x").value = x
  121 + var y = document.getElementById("y").value.split(" ")
  122 + if(!y[1]) y[1] = 0;
  123 + if(!y[2]) y[2] = 0;
  124 + var y = convdmsdd(y[0],y[1],y[2]);
  125 + document.getElementById("y").value = y
  126 + document.getElementById('tipo').value='executa';
  127 + document.getElementById('f').submit();
  128 +}
  129 +
  130 +</script>
  131 +</html>
0 \ No newline at end of file 132 \ No newline at end of file
mobile/mobile.php
@@ -145,6 +145,11 @@ if ($tipo==&quot;localizar&quot;) @@ -145,6 +145,11 @@ if ($tipo==&quot;localizar&quot;)
145 include("localizar.php"); 145 include("localizar.php");
146 exit; 146 exit;
147 } 147 }
  148 +if ($tipo=="localizarxy")
  149 +{
  150 + include("localizarxy.php");
  151 + exit;
  152 +}
148 if ($tipo =="autopan") 153 if ($tipo =="autopan")
149 { 154 {
150 include("../classesphp/classe_navegacao.php"); 155 include("../classesphp/classe_navegacao.php");
@@ -184,6 +189,7 @@ if(!isset($maparef)){$maparef = &quot;&quot;;} @@ -184,6 +189,7 @@ if(!isset($maparef)){$maparef = &quot;&quot;;}
184 <option value='ativatexto'>ativar textos</option> 189 <option value='ativatexto'>ativar textos</option>
185 <option value='legenda'>ver a legenda</option> 190 <option value='legenda'>ver a legenda</option>
186 <option value='localizar'>localizar lugares</option> 191 <option value='localizar'>localizar lugares</option>
  192 + <option value='localizarxy'>localizar coordenada</option>
187 </select> 193 </select>
188 </div> 194 </div>
189 <form id='f' action='mobile.php?' method='get'> 195 <form id='f' action='mobile.php?' method='get'>
@@ -299,6 +305,8 @@ function op(valor) @@ -299,6 +305,8 @@ function op(valor)
299 {document.getElementById('f').action = "index.php?"} 305 {document.getElementById('f').action = "index.php?"}
300 if (valor=="ativatexto") 306 if (valor=="ativatexto")
301 {document.getElementById('f').action = "ativatexto.php?"} 307 {document.getElementById('f').action = "ativatexto.php?"}
  308 + if (valor=="localizarxy")
  309 + {document.getElementById('f').action = "localizarxy.php?"}
302 document.getElementById('f').submit(); 310 document.getElementById('f').submit();
303 } 311 }
304 function maparef() 312 function maparef()