Commit 733a4a0267a3df65a33ab26e552c320c46ab83cc

Authored by Edmar Moretti
1 parent ae80570d

Inclusão da ferramenta "tela remota"

admin/admin.db
No preview for this file type
classesphp/mapa_googleearth.php
... ... @@ -74,6 +74,9 @@ function retornaKml(){
74 74 //$url = $servidor.'http://localhost:80/cgi-bin/mapserv.exe?map=c:/ms4w/tmp/ms_tmp/rPzBHuOtQa/rPzBHuOtQa.map&width=1500&height=1500&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4291&STYLES=&FORMAT=image/jpeg&TRANSPARENT=TRUE&layers=estadosl';
75 75 $serv = strtolower($protocolo[0]) . '://'.$_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] ? ':'.$_SERVER['SERVER_PORT'] : '') . $_SERVER['PHP_SELF'];
76 76 $url = $serv."?g_sid=".$_GET["g_sid"]."&WIDTH=1500&HEIGHT=1500&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image/png&TRANSPARENT=TRUE&layer=".$_GET["layer"]."&TIPOIMAGEM=".$_GET["TIPOIMAGEM"];
  77 + if(isset($_GET["telaR"])){
  78 + $url .= "&telaR=".$_GET["telaR"];
  79 + }
77 80 $kml = '
78 81 <kml xmlns="http://earth.google.com/kml/2.0">
79 82 <Document>
... ... @@ -136,44 +139,54 @@ function retornaWms($map_file,$postgis_mapa){
136 139 {$mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);}
137 140 }
138 141 $layersNames = $mapa->getalllayernames();
139   - foreach ($layersNames as $layerName)
140   - {
141   - $l = $mapa->getLayerByname($layerName);
142   - if ($l->getmetadata("classesnome") != "")
143   - {
144   - include_once("funcoes_gerais.php");
145   - autoClasses(&$l,$mapa);
146   - }
147   - if($layerName != $_GET["layer"])
148   - {$l->set("status",MS_OFF);}
149   - if($layerName == $_GET["layer"] || $l->group == $_GET["layer"] && $l->group != "")
  142 + $o = $mapa->outputformat;
  143 + $o->set("imagemode",MS_IMAGEMODE_RGBA);
  144 + if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao´e alterado
  145 + foreach ($layersNames as $layerName)
150 146 {
151   - $l->set("status",MS_DEFAULT);
152   - if (isset($postgis_mapa) && ($postgis_mapa != "") && ($postgis_mapa != " "))
  147 + $l = $mapa->getLayerByname($layerName);
  148 + if ($l->getmetadata("classesnome") != "")
  149 + {
  150 + include_once("funcoes_gerais.php");
  151 + autoClasses(&$l,$mapa);
  152 + }
  153 + if($layerName != $_GET["layer"])
  154 + {$l->set("status",MS_OFF);}
  155 + if($layerName == $_GET["layer"] || $l->group == $_GET["layer"] && $l->group != "")
153 156 {
154   - if ($l->connectiontype == MS_POSTGIS)
  157 + $l->set("status",MS_DEFAULT);
  158 + if (isset($postgis_mapa) && ($postgis_mapa != "") && ($postgis_mapa != " "))
155 159 {
156   - $lcon = $l->connection;
157   - if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa))))
  160 + if ($l->connectiontype == MS_POSTGIS)
158 161 {
159   - if(($lcon == " ") || ($lcon == ""))
160   - {$l->set("connection",$postgis_mapa);}
161   - else
162   - {$l->set("connection",$postgis_mapa[$lcon]);}
  162 + $lcon = $l->connection;
  163 + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa))))
  164 + {
  165 + if(($lcon == " ") || ($lcon == ""))
  166 + {$l->set("connection",$postgis_mapa);}
  167 + else
  168 + {$l->set("connection",$postgis_mapa[$lcon]);}
  169 + }
163 170 }
164   - }
165 171  
  172 + }
166 173 }
  174 + $l->set("template","none.htm");
167 175 }
168   - $l->set("template","none.htm");
  176 + }
  177 + else{
  178 + $mapa->selectOutputFormat("jpeg");
  179 + $of = $mapa->outputformat;
  180 + $of->set("imagemode",MS_IMAGEMODE_RGBA);
  181 + $of->set("driver","AGG/PNG");
  182 + $of->set("transparent",MS_ON);
169 183 }
170 184 $mapa->setsize($_GET["WIDTH"],$_GET["HEIGHT"]);
171 185 if(isset($_GET["mapext"])){
172 186 $mapext = explode(" ",$_GET["mapext"]);
173 187 $mapa->setExtent($mapext[0],$mapext[1],$mapext[2],$mapext[3]);
174 188 }
175   - $o = $mapa->outputformat;
176   - $o->set("imagemode",MS_IMAGEMODE_RGBA);
  189 +
177 190 $legenda = $mapa->legend;
178 191 $legenda->set("status",MS_OFF);
179 192 $escala = $mapa->scalebar;
... ...
ferramentas/telaremota/googleearth1.php 0 → 100644
... ... @@ -0,0 +1,173 @@
  1 +<?php
  2 +include("../../ms_configura.php");
  3 +?>
  4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  5 +<html>
  6 +<head>
  7 +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
  8 +<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=no;">
  9 +<meta name="HandheldFriendly" content="yes" />
  10 +<meta name="MobileOptimized" content="width" />
  11 +<meta name="apple-mobile-web-app-capable" content="yes">
  12 +<script type="text/javascript" src="http://www.google.com/jsapi?key=<?php echo $googleApiKey; ?>"></script>
  13 +<script type="text/javascript" src="../../pacotes/cpaint/cpaint2_compacto.inc.js"></script>
  14 +</head>
  15 +<body onload="inicia()">
  16 +<div id=googleearthdiv style="width:100%;height:100%;z-index:0"></div>
  17 +<script>
  18 +/*
  19 +Title: Interface GoogleEarth para a ferramenta tela remota
  20 +
  21 +Clone de um mapa aberto no i3Geo.
  22 +
  23 +O clone monitora as mudanças no mapa original e aplica a extensão geográfica e recarrega o mapfile utilizado no original.
  24 +
  25 +A abertura de um clone só é possível tendo-se o código de abertura, gerado pela ferramenta Tela Remota do i3Geo
  26 +
  27 +Veja:
  28 +
  29 +<i3GEO.tema.dialogo.telaremota>
  30 +
  31 +Arquivo:
  32 +
  33 +i3geo/ferramentas/telaremota/googleearth1.php
  34 +
  35 +Licenca:
  36 +
  37 +GPL2
  38 +
  39 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  40 +
  41 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  42 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  43 +
  44 +Este programa é software livre; você pode redistribuí-lo
  45 +e/ou modificá-lo sob os termos da Licença Pública Geral
  46 +GNU conforme publicada pela Free Software Foundation;
  47 +
  48 +Este programa é distribuído na expectativa de que seja útil,
  49 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  50 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  51 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  52 +Você deve ter recebido uma cópia da Licença Pública Geral do
  53 +GNU junto com este programa; se não, escreva para a
  54 +Free Software Foundation, Inc., no endereço
  55 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  56 +*/
  57 +google.load("earth", "1");
  58 +mapaRemoto = null;
  59 +remoto = null;
  60 +function inicia(){
  61 + extentAnterior = "";
  62 + contadorSalva = 0;
  63 + $i = function(id){return document.getElementById(id);};
  64 + navn = false;
  65 + //seta as variáveis navn e navm
  66 + navn = false;
  67 + navm = false;
  68 + var app = navigator.appName.substring(0,1);
  69 + if (app==='N'){navn=true;}else{navm=true;}
  70 +
  71 + google.earth.createInstance("googleearthdiv",
  72 + function(objeto){
  73 + mapaRemoto = objeto;
  74 + mapaRemoto.getWindow().setVisibility(true);
  75 + mapaRemoto.getNavigationControl().setVisibility(true);
  76 + layerRoot = mapaRemoto.getLayerRoot();
  77 + layerRoot.enableLayerById(mapaRemoto.LAYER_TERRAIN, true);
  78 + var options = mapaRemoto.getOptions();
  79 + options.setMouseNavigationEnabled(true);
  80 + options.setStatusBarVisibility(true);
  81 + options.setOverviewMapVisibility(true);
  82 + options.setScaleLegendVisibility(true);
  83 + options.setAtmosphereVisibility(true);
  84 + options.setGridVisibility(false);
  85 + remoto = criaLayer();
  86 + recuperaMapa();
  87 + },
  88 + function(){
  89 + alert("Falhou. Vc precisa do plugin instalado");
  90 + }
  91 + );
  92 +}
  93 +function criaLayer(){
  94 + var caminho = window.location.protocol+"//"+window.location.host+window.location.pathname,
  95 + kmlUrl = caminho.replace("/ferramentas/telaremota/googleearth1.php","")+"/classesphp/mapa_googleearth.php?g_sid=<?php echo $_GET["g_sid"];?>&telaR=<?php echo $_GET["telaR"];?>&REQUEST=GetKml&r="+Math.random(),
  96 + linki3geo = mapaRemoto.createLink(''),
  97 + nl = mapaRemoto.createNetworkLink('');
  98 + linki3geo.setHref(kmlUrl);
  99 + nl.setLink(linki3geo);
  100 + nl.setFlyToView(false);
  101 + nl.setName("Remoto");
  102 + nl.setVisibility(true);
  103 + mapaRemoto.getFeatures().appendChild(nl);
  104 + return nl;
  105 +}
  106 +function zoom2ext(ext){
  107 + var r = 6378700,
  108 + lng2,
  109 + lng1,
  110 + lat1,
  111 + lat2,
  112 + ret = ext.split(" "),
  113 + fov = 32,
  114 + camera = mapaRemoto.getView().copyAsCamera(mapaRemoto.ALTITUDE_RELATIVE_TO_GROUND),
  115 + dy,
  116 + dx,
  117 + d,
  118 + dist,
  119 + alt;
  120 + lng2 = (ret[0]*1);
  121 + lng1 = (ret[2]*1);
  122 + lat1 = (ret[1]*1);
  123 + lat2 = (ret[3]*1);
  124 + camera.setLatitude((lat1 + lat2) / 2.0);
  125 + camera.setLongitude((lng1 + lng2) / 2.0);
  126 + camera.setHeading(0.0);
  127 + camera.setTilt(0.0);
  128 + // determine if the rectangle is portrait or landscape
  129 + dy = Math.max(lat1, lat2) - Math.min(lat1, lat2);
  130 + dx = Math.max(lng1, lng2) - Math.min(lng1, lng2);
  131 + // find the longest side
  132 + d = Math.max(dy, dx);
  133 + // convert the longest side degrees to radians
  134 + d = d * Math.PI/180.0;
  135 + // find half the chord length
  136 + dist = r * Math.tan(d / 2);
  137 + // get the altitude using the chord length
  138 + alt = dist/(Math.tan(fov * Math.PI / 180.0));
  139 + camera.setAltitude(alt);
  140 + mapaRemoto.getView().setAbstractView(camera);
  141 +}
  142 +function atualizaMapa(){
  143 + mapaRemoto.getFeatures().removeChild(mapaRemoto.getFeatures().getChildNodes().item(0));
  144 + criaLayer();
  145 +}
  146 +function recuperaMapa(){
  147 + var temp = function(retorno){
  148 + if(!retorno.data){
  149 + setTimeout('recuperaMapa()',<?php echo $_GET["tempo"];?>);
  150 + return;
  151 + }
  152 + retorno = retorno.data;
  153 + if(extentAnterior != retorno.extent){
  154 + zoom2ext(retorno.extent);
  155 + extentAnterior = retorno.extent;
  156 + contadorSalva = retorno.contadorsalva;
  157 + }
  158 + else{
  159 + if(contadorSalva != retorno.contadorsalva){
  160 + atualizaMapa()
  161 + contadorSalva = retorno.contadorsalva;
  162 + }
  163 + }
  164 + setTimeout('recuperaMapa()',<?php echo $_GET["tempo"];?>);
  165 + };
  166 + p = "recuperamapa.php?g_sid=<?php echo $_GET["g_sid"];?>&funcao=recupera";
  167 + cp = new cpaint();
  168 + cp.set_response_type("JSON");
  169 + cp.call(p,"telaremota",temp);
  170 +}
  171 +</script>
  172 +</body>
  173 +</html>
... ...
ferramentas/telaremota/googlemaps1.php
... ... @@ -12,6 +12,47 @@
12 12 <body onload="inicia()">
13 13 <div id=googlemapsdiv style="width:100%;height:100%;"></div>
14 14 <script>
  15 +<<<<<<< .mine
  16 +/*
  17 +Title: Interface GoogleMaps para a ferramenta tela remota
  18 +
  19 +Clone de um mapa aberto no i3Geo.
  20 +
  21 +O clone monitora as mudanças no mapa original e aplica a extensão geográfica e recarrega o mapfile utilizado no original.
  22 +
  23 +A abertura de um clone só é possível tendo-se o código de abertura, gerado pela ferramenta Tela Remota do i3Geo
  24 +
  25 +Veja:
  26 +
  27 +<i3GEO.tema.dialogo.telaremota>
  28 +
  29 +Arquivo:
  30 +
  31 +i3geo/ferramentas/telaremota/googlemaps1.php
  32 +
  33 +Licenca:
  34 +
  35 +GPL2
  36 +
  37 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  38 +
  39 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  40 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  41 +
  42 +Este programa é software livre; você pode redistribuí-lo
  43 +e/ou modificá-lo sob os termos da Licença Pública Geral
  44 +GNU conforme publicada pela Free Software Foundation;
  45 +
  46 +Este programa é distribuído na expectativa de que seja útil,
  47 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  48 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  49 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  50 +Você deve ter recebido uma cópia da Licença Pública Geral do
  51 +GNU junto com este programa; se não, escreva para a
  52 +Free Software Foundation, Inc., no endereço
  53 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  54 +*/
  55 +=======
15 56 /*
16 57 Title: Tela remota - Google Maps
17 58  
... ... @@ -53,6 +94,7 @@ GNU junto com este programa; se não, escreva para a
53 94 Free Software Foundation, Inc., no endereço
54 95 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
55 96 */
  97 +>>>>>>> .r2067
56 98 function inicia(){
57 99 extentAnterior = "";
58 100 contadorSalva = 0;
... ...
ferramentas/telaremota/index.js.php
... ... @@ -70,6 +70,9 @@ i3GEOF.telaremota = {
70 70 var url2 = i3GEO.configura.locaplic+"/ferramentas/telaremota/googlemaps1.php"+url1;
71 71 ins += "<br><br><p style='font-size:13px;text-align:left' >Google Maps:</p><br>";
72 72 ins += "<a href="+url2+" target=_blank >"+url2+"</a>";
  73 + var url2 = i3GEO.configura.locaplic+"/ferramentas/telaremota/googleearth1.php"+url1;
  74 + ins += "<br><br><p style='font-size:13px;text-align:left' >Google Earth:</p><br>";
  75 + ins += "<a href="+url2+" target=_blank >"+url2+"</a>";
73 76 $i("i3GEOtelaremotaResultado").innerHTML = ins;
74 77 i3GEOF.telaremota.aguarde.visibility = "hidden";
75 78 }
... ...
ferramentas/telaremota/openlayers1.php
... ... @@ -12,6 +12,47 @@
12 12 <body onload="inicia()">
13 13 <div id=openlayers style="width:100%;height:100%;"></div>
14 14 <script>
  15 +<<<<<<< .mine
  16 +/*
  17 +Title: Interface OpenLayers para a ferramenta tela remota
  18 +
  19 +Clone de um mapa aberto no i3Geo.
  20 +
  21 +O clone monitora as mudanças no mapa original e aplica a extensão geográfica e recarrega o mapfile utilizado no original.
  22 +
  23 +A abertura de um clone só é possível tendo-se o código de abertura, gerado pela ferramenta Tela Remota do i3Geo
  24 +
  25 +Veja:
  26 +
  27 +<i3GEO.tema.dialogo.telaremota>
  28 +
  29 +Arquivo:
  30 +
  31 +i3geo/ferramentas/telaremota/openlayers1.php
  32 +
  33 +Licenca:
  34 +
  35 +GPL2
  36 +
  37 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  38 +
  39 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  40 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  41 +
  42 +Este programa é software livre; você pode redistribuí-lo
  43 +e/ou modificá-lo sob os termos da Licença Pública Geral
  44 +GNU conforme publicada pela Free Software Foundation;
  45 +
  46 +Este programa é distribuído na expectativa de que seja útil,
  47 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  48 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  49 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  50 +Você deve ter recebido uma cópia da Licença Pública Geral do
  51 +GNU junto com este programa; se não, escreva para a
  52 +Free Software Foundation, Inc., no endereço
  53 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  54 +*/
  55 +=======
15 56 /*
16 57 Title: Tela remota - OpenLayers
17 58  
... ... @@ -53,6 +94,7 @@ GNU junto com este programa; se não, escreva para a
53 94 Free Software Foundation, Inc., no endereço
54 95 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
55 96 */
  97 +>>>>>>> .r2067
56 98 function inicia(){
57 99 extentAnterior = "";
58 100 contadorSalva = 0;
... ...
ferramentas/telaremota/recuperamapa.php
1 1 <?php
  2 +/*
  3 +Title: Monotor remoto
  4 +
  5 +Monitora as mudanças em um mapa original. Obtém os dados necessários para atualizar o mapa clonado.
  6 +
  7 +Veja:
  8 +
  9 +<i3GEO.tema.dialogo.telaremota>
  10 +
  11 +Arquivo:
  12 +
  13 +i3geo/ferramentas/telaremota/openlayers1.php
  14 +
  15 +Licenca:
  16 +
  17 +GPL2
  18 +
  19 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  20 +
  21 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  22 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  23 +
  24 +Este programa é software livre; você pode redistribuí-lo
  25 +e/ou modificá-lo sob os termos da Licença Pública Geral
  26 +GNU conforme publicada pela Free Software Foundation;
  27 +
  28 +Este programa é distribuído na expectativa de que seja útil,
  29 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  30 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  31 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  32 +Você deve ter recebido uma cópia da Licença Pública Geral do
  33 +GNU junto com este programa; se não, escreva para a
  34 +Free Software Foundation, Inc., no endereço
  35 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  36 +*/
2 37 session_name("i3GeoPHP");
3 38 session_id($_GET["g_sid"]);
4 39 session_start();
... ...