Commit 221309ba176f548d5f6ef7d6ae5dbeefe81d7e47

Authored by Edmar Moretti
1 parent bec8827e
Exists in master

--no commit message

Showing 1 changed file with 26 additions and 14 deletions   Show diff stats
classesphp/mapa_openlayers.php
... ... @@ -59,7 +59,10 @@ Arquivo:
59 59 i3geo/classesphp/mapa_openlayers.php
60 60  
61 61 */
62   -
  62 +//para efeitos de compatibilidade
  63 +if (!function_exists('ms_GetVersion')){
  64 + include_once ("carrega_ext.php");
  65 +}
63 66 error_reporting(0);
64 67 inicializa();
65 68 //
... ... @@ -67,6 +70,7 @@ inicializa();
67 70 //nos casos do modo notile, a requisicao e feita como se fosse um wms
68 71 //quando for do tipo tms $_GET["tms"] contem os parametros do tile
69 72 //
  73 +
70 74 if(isset($_GET["tms"])){
71 75 $_GET["WIDTH"] = 256;
72 76 $_GET["HEIGHT"] = 256;
... ... @@ -83,10 +87,11 @@ if(isset($_GET["tms"])){
83 87 $lat2 = ($y+1) / $n * 180.0 - 90.0;
84 88 $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2;
85 89 }
  90 +
86 91 //para o caso da versao 3 do OpenLayers
87   -//excluir?
88   -if(isset($_GET["X"])){
89   - $box = explode(",",$_GET["BBOX"]);
  92 +if(isset($_GET["X"]) && !($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature")){
  93 + $box = str_replace(" ",",",$_GET["BBOX"]);
  94 + $box = explode(",",$box);
90 95 $res = ($box[2] + 180) - ($box[0] + 180);
91 96 $res = $res / 256;
92 97 $z = intval((0.703125 / $res) / 4) + 1;
... ... @@ -98,6 +103,7 @@ if(isset($_GET["X"])){
98 103 $_GET["tms"] = "/".$_GET["layer"]."/".$z."/".$x."/".$y.".png";
99 104 echo $_GET["BBOX"]." ".$_GET["tms"];exit;
100 105 }
  106 +
101 107 if(isset($_GET["TileMatrix"])){
102 108 $_GET["WIDTH"] = 256;
103 109 $_GET["HEIGHT"] = 256;
... ... @@ -128,6 +134,7 @@ if(isset($_GET["TileMatrix"])){
128 134  
129 135 $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2;
130 136 }
  137 +
131 138 $map_fileX = $_SESSION["map_file"];
132 139 //
133 140 //verifica se o request e OGC
... ... @@ -139,12 +146,16 @@ if(!empty($_GET["request"])){
139 146 //
140 147 $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php";
141 148 $qy = file_exists($qyfile);
142   -if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
  149 +
  150 +if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
143 151 $_GET["DESLIGACACHE"] = "sim";
144 152 }
145   -if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
146   - carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]);
  153 +else{
  154 + if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
  155 + carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]);
  156 + }
147 157 }
  158 +
148 159 //
149 160 //map_fileX e para o caso register_globals = On no PHP.INI
150 161 //
... ... @@ -158,9 +169,7 @@ if(isset($_GET["BBOX"])){
158 169 $_GET["map_size"] = $_GET["WIDTH"]." ".$_GET["HEIGHT"];
159 170 }
160 171 $_GET["TIPOIMAGEM"] = trim($_GET["TIPOIMAGEM"]);
161   -
162 172 $mapa = ms_newMapObj($map_fileX);
163   -
164 173 //
165 174 //processa os layers do mapfile
166 175 //
... ... @@ -219,7 +228,6 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
219 228 }
220 229 }
221 230 }
222   -
223 231 if($layerName == $_GET["layer"]){
224 232 if(strtolower($l->getmetadata("cache")) == "sim"){
225 233 $cache = true;
... ... @@ -228,7 +236,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
228 236 $nomecache = $layerName;
229 237 }
230 238 }
231   - if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature" ){
  239 + if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature" ){
232 240 $l->setmetadata("gml_include_items","all");
233 241 $l->set("template","none.htm");
234 242 $l->setmetadata("WMS_INCLUDE_ITEMS","all");
... ... @@ -243,6 +251,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
243 251 }
244 252 }
245 253 }
  254 +
246 255 if (!function_exists('imagepng')){
247 256 $_GET["TIPOIMAGEM"] = "";
248 257 }
... ... @@ -273,9 +282,13 @@ if(isset($_GET["mapext"])){
273 282 //
274 283 //qd a cahamda e para um WMS, redireciona para ogc.php
275 284 //
276   -if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){
  285 +if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){
277 286 $req = ms_newowsrequestobj();
  287 + if($_GET["BBOX"]){
  288 + $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]);
  289 + }
278 290 $_GET = array_merge($_GET,$_POST);
  291 +
279 292 foreach ($_GET as $k=>$v){
280 293 $req->setParameter($k, $v);
281 294 }
... ... @@ -283,7 +296,6 @@ if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){
283 296 $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
284 297 $or = $proto.$server.$_SERVER['PHP_SELF'];
285 298 $mapa->setmetadata("wfs_onlineresource",$or."?".$_SERVER["QUERY_STRING"]);
286   -
287 299 ms_ioinstallstdouttobuffer();
288 300 $mapa->owsdispatch($req);
289 301 $contenttype = ms_iostripstdoutbuffercontenttype();
... ... @@ -560,7 +572,7 @@ function inicializa(){
560 572 ilegal();
561 573 }
562 574 session_start();
563   - if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
  575 + if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
564 576 return;
565 577 }
566 578 if(@$_SESSION["fingerprint"]){
... ...