Commit f9e8da49ca901373d5ef23686b3550b07b2f5fe0

Authored by Edmar Moretti
1 parent 47e5979c

Correção na ferramenta telaremota

ferramentas/telaremota/index.js
@@ -85,8 +85,19 @@ i3GEOF.telaremota = { @@ -85,8 +85,19 @@ i3GEOF.telaremota = {
85 ins += '<p class="paragrafo" ><div id=i3GEOtelaremotaResultado style=text-align:left ></div>'; 85 ins += '<p class="paragrafo" ><div id=i3GEOtelaremotaResultado style=text-align:left ></div>';
86 $i(divid).innerHTML += ins; 86 $i(divid).innerHTML += ins;
87 mostraLink = function(retorno){ 87 mostraLink = function(retorno){
  88 + //pega o fundo no caso do openlayers - o objeto fundo deve existir no php que abre a tela remota
  89 + var fundo = "";
  90 + if(i3GEO.Interface.ATUAL === "openlayers"){
  91 + var n = i3GEO.Interface.openlayers.LAYERSADICIONAIS.length;
  92 + var i;
  93 + for(i= 0; i < n; i++){
  94 + if(i3GEO.Interface.openlayers.LAYERSADICIONAIS[i].isBaseLayer === true && i3GEO.Interface.openlayers.LAYERSADICIONAIS[i].visibility === true){
  95 + fundo = i;
  96 + }
  97 + }
  98 + }
88 var ins = ""; 99 var ins = "";
89 - var url1 = "?tempo=7000&telaR="+retorno.data+"&g_sid="+i3GEO.configura.sid; 100 + var url1 = "?tempo=7000&telaR="+retorno.data+"&g_sid="+i3GEO.configura.sid+"&fundo=" + fundo;
90 var url2 = i3GEO.configura.locaplic+"/ferramentas/telaremota/openlayers1.php"+url1; 101 var url2 = i3GEO.configura.locaplic+"/ferramentas/telaremota/openlayers1.php"+url1;
91 ins += "<p style='font-size:13px;text-align:left' >Openlayers:</p><br>"; 102 ins += "<p style='font-size:13px;text-align:left' >Openlayers:</p><br>";
92 ins += "<a href="+url2+" target=_blank >"+url2+"</a>"; 103 ins += "<a href="+url2+" target=_blank >"+url2+"</a>";
ferramentas/telaremota/openlayers1.php
  1 +<?php
  2 +include("../../classesphp/pega_variaveis.php");
  3 +if(!isset($fundo)){
  4 + $fundo = "''";
  5 +}
  6 +?>
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd"> 7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html> 8 <html>
3 <head> 9 <head>
@@ -112,7 +118,7 @@ function inicia(){ @@ -112,7 +118,7 @@ function inicia(){
112 if (app==='N'){navn=true;}else{navm=true;} 118 if (app==='N'){navn=true;}else{navm=true;}
113 OpenLayers.ImgPath = "../../pacotes/openlayers/img/" 119 OpenLayers.ImgPath = "../../pacotes/openlayers/img/"
114 OpenLayers.Lang.setCode("pt-BR"); 120 OpenLayers.Lang.setCode("pt-BR");
115 - var urlLayer = "../../classesphp/mapa_openlayers.php?DESLIGACACHE=sim&g_sid=<?php echo $_GET["g_sid"];?>&telaR=<?php echo $_GET["telaR"];?>"; 121 + var urlLayer = "../../classesphp/mapa_openlayers.php?DESLIGACACHE=sim&g_sid=<?php echo $g_sid;?>&telaR=<?php echo $telaR;?>";
116 122
117 var remoto = new OpenLayers.Layer.WMS( 123 var remoto = new OpenLayers.Layer.WMS(
118 "Remoto", 124 "Remoto",
@@ -120,18 +126,68 @@ function inicia(){ @@ -120,18 +126,68 @@ function inicia(){
120 {transparent: "false", format: "image/png"}, 126 {transparent: "false", format: "image/png"},
121 {isBaseLayer:false,singleTile:true,buffer:0,gutter:0,ratio:1} 127 {isBaseLayer:false,singleTile:true,buffer:0,gutter:0,ratio:1}
122 ); 128 );
123 - var remotoFundo = new OpenLayers.Layer.WMS(  
124 - "Fundo",  
125 - urlLayer+"&tipolayer=fundo",  
126 - {transparent: "false", format: "image/png"},  
127 - {isBaseLayer:true,singleTile:true,visibility:true,buffer:0,gutter:0,ratio:1}  
128 - );  
129 - var bra = new OpenLayers.Layer.WMS(  
130 - "Base carto MMA",  
131 - "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map",  
132 - {layers:"baseraster",srs:"EPSG:4618",format:"image/png"},  
133 - {isBaseLayer:true,visibility:false}  
134 - ); 129 +
  130 + var eng = new OpenLayers.Layer.ArcGIS93Rest(
  131 + "ESRI National Geographic",
  132 + "http://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/export",
  133 + {
  134 + format : "jpeg"
  135 + }, {
  136 + isBaseLayer : true,
  137 + visibility : true
  138 + });
  139 + var oce = new OpenLayers.Layer.ArcGIS93Rest(
  140 + "ESRI Ocean Basemap",
  141 + "http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",
  142 + {
  143 + format : "jpeg"
  144 + }, {
  145 + isBaseLayer : true,
  146 + visibility : true
  147 + });
  148 + var ims = new OpenLayers.Layer.ArcGIS93Rest(
  149 + "ESRI Imagery World 2D",
  150 + "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",
  151 + {
  152 + format : "jpeg"
  153 + }, {
  154 + isBaseLayer : true,
  155 + visibility : true
  156 + });
  157 + var wsm = new OpenLayers.Layer.ArcGIS93Rest(
  158 + "ESRI World Street Map",
  159 + "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",
  160 + {
  161 + format : "jpeg"
  162 + }, {
  163 + isBaseLayer : true,
  164 + visibility : true
  165 + });
  166 + var bra = new OpenLayers.Layer.WMS(
  167 + "Base carto MMA",
  168 + "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map",
  169 + {
  170 + layers : "baseraster",
  171 + srs : "EPSG:4618",
  172 + format : "image/png",
  173 + isBaseLayer : false
  174 + }, {
  175 + isBaseLayer : true,
  176 + visibility : true
  177 + });
  178 +
  179 + var tms = new OpenLayers.Layer.TMS("OSGEO",
  180 + "http://tilecache.osgeo.org/wms-c/Basic.py/", {
  181 + layername : "basic",
  182 + type : "png",
  183 + // set if different than the bottom left of map.maxExtent
  184 + tileOrigin : new OpenLayers.LonLat(-180, -90),
  185 + isBaseLayer : true,
  186 + visibility : true
  187 + });
  188 +
  189 + var LAYERSADICIONAIS = [ eng, oce, ims, wsm, tms, bra ];
  190 +
135 mapaRemoto = new OpenLayers.Map({ 191 mapaRemoto = new OpenLayers.Map({
136 div: "openlayers", 192 div: "openlayers",
137 controls: [ 193 controls: [
@@ -139,9 +195,14 @@ function inicia(){ @@ -139,9 +195,14 @@ function inicia(){
139 new OpenLayers.Control.LayerSwitcher(), 195 new OpenLayers.Control.LayerSwitcher(),
140 new OpenLayers.Control.ScaleLine(), 196 new OpenLayers.Control.ScaleLine(),
141 new OpenLayers.Control.Navigation() 197 new OpenLayers.Control.Navigation()
142 - ]  
143 - });  
144 - mapaRemoto.addLayers([remotoFundo,bra,remoto]); 198 + ]
  199 + });
  200 + if(<?php echo $fundo; ?> !== ""){
  201 + mapaRemoto.addLayers([LAYERSADICIONAIS[<?php echo $fundo; ?>],remoto]);
  202 + }
  203 + else{
  204 + mapaRemoto.addLayers([remoto]);
  205 + }
145 recuperaMapa(); 206 recuperaMapa();
146 } 207 }
147 function zoom2ext(ext){ 208 function zoom2ext(ext){
@@ -155,11 +216,13 @@ function atualizaMapa(){ @@ -155,11 +216,13 @@ function atualizaMapa(){
155 nlayers = layers.length, 216 nlayers = layers.length,
156 i; 217 i;
157 for(i=0;i<nlayers;i++){ 218 for(i=0;i<nlayers;i++){
158 - layers[i].mergeNewParams({r:Math.random()});  
159 - layers[i].url = layers[i].url.replace("&&&&&&&&&&&&&&","");  
160 - layers[i].url = layers[i].url+"&&";  
161 - if(layers[i].visibility === true){  
162 - layers[i].redraw(); 219 + if(layers[i].isBaseLayer === false){
  220 + layers[i].mergeNewParams({r:Math.random()});
  221 + layers[i].url = layers[i].url.replace("&&&&&&&&&&&&&&","");
  222 + layers[i].url = layers[i].url+"&&";
  223 + if(layers[i].visibility === true){
  224 + layers[i].redraw();
  225 + }
163 } 226 }
164 } 227 }
165 } 228 }