From 0ac84d78c420cbd58a0babc1253e13bfb4dca49e Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Mon, 26 Oct 2015 00:10:04 +0000 Subject: [PATCH] Adaptações para versão 7 do Mapserver --- classesphp/classe_analise.php | 6 +++--- classesphp/classe_atributos.php | 12 ++++++------ classesphp/classe_legenda.php | 54 +++++++++++++++++++++++++++++++++--------------------- classesphp/classe_selecao.php | 4 ++-- classesphp/classe_shp.php | 2 +- classesphp/mapa_openlayers.php | 7 ++++--- classesphp/proxy.php | 14 ++++++++++++-- 7 files changed, 61 insertions(+), 38 deletions(-) diff --git a/classesphp/classe_analise.php b/classesphp/classe_analise.php index de36ffc..38619ca 100644 --- a/classesphp/classe_analise.php +++ b/classesphp/classe_analise.php @@ -1132,7 +1132,7 @@ class Analise } if ($layer->getResult(0) !== FALSE) { - if($this->v == 6) + if($this->v >= 6) { $shape = $layer->getShape($layer->getResult(0)); } @@ -1261,7 +1261,7 @@ class Analise for ($i = 0; $i < $res_count; ++$i) { - if($this->v == 6) + if($this->v >= 6) { $shapesdestino[] = $layerdestino->getShape($layerdestino->getResult($i)); } @@ -2200,7 +2200,7 @@ class Analise $layerPt->open(); $res_count = $layerPt->getNumresults(); for ($i = 0; $i < $res_count; ++$i){ - if($this->v == 6){ + if($this->v >= 6){ $s = $layerPt->getShape($layerPt->getResult($i)); } else{ diff --git a/classesphp/classe_atributos.php b/classesphp/classe_atributos.php index 670e242..df75ea0 100644 --- a/classesphp/classe_atributos.php +++ b/classesphp/classe_atributos.php @@ -214,7 +214,7 @@ class Atributos //$this->layer->setfilter(""); $ext = ""; //procura o registro e pega a extensão geográfica - if($this->v == 6){ + if($this->v >= 6){ $this->layer->open(); $shape = $this->layer->getShape(new resultObj($registro)); //$shape = $this->layer->getShape($this->layer->getResult($registro)); @@ -505,7 +505,7 @@ class Atributos $valoresunicos = array(); for ($i = $inicio; $i < $res_count; ++$i){ $valitem = array(); - if($this->v == 6){ + if($this->v >= 6){ $shape = $this->layer->getShape($this->layer->getResult($i)); $indx = $shape->index; } @@ -621,7 +621,7 @@ class Atributos $sopen = $this->layer->open(); for ($i = 0; $i < $res_count; ++$i){ $valitem = array(); - if($this->v == 6){ + if($this->v >= 6){ $shape = $this->layer->getShape($this->layer->getResult($i)); $indx = $shape->index; } @@ -732,7 +732,7 @@ class Atributos $palavra = $this->remove_accents(strtolower($palavra)); for ($i = 0; $i < $res_count; ++$i) { $valitem = array(); - if($this->v == 6){ + if($this->v >= 6){ $shape = $l->getShape($l->getResult($i)); $indx = $shape->index; } @@ -1930,7 +1930,7 @@ class Atributos for ($i = 0; $i < $res_count; ++$i) { $valori = array(); - if($this->v == 6) + if($this->v >= 6) { $shape = $layer->getShape($layer->getResult($i)); } @@ -2308,7 +2308,7 @@ class Atributos } for ($i = 0; $i < $res_count; ++$i) { $valori = array(); - if($this->v == 6){ + if($this->v >= 6){ $shape = $layer->getShape($layer->getResult($i)); } else{ diff --git a/classesphp/classe_legenda.php b/classesphp/classe_legenda.php index 63d2f9e..5942b26 100644 --- a/classesphp/classe_legenda.php +++ b/classesphp/classe_legenda.php @@ -656,8 +656,8 @@ class Legenda { $mapatemp = ms_newMapObj($this->localaplicacao."\\aplicmap\\".$t); } - else - {$mapatemp = ms_newMapObj($this->localaplicacao."/aplicmap/".$t); + else{ + $mapatemp = ms_newMapObj($this->localaplicacao."/aplicmap/".$t); } $l = $mapatemp->getlayer(0); @@ -665,21 +665,38 @@ class Legenda { $novoss = dirname($this->mapa->symbolsetfilename)."\\".basename($mapatemp->symbolsetfilename); } - else - {$novoss = dirname($this->mapa->symbolsetfilename)."/".basename($mapatemp->symbolsetfilename); + else{ + $novoss = dirname($this->mapa->symbolsetfilename)."/".basename($mapatemp->symbolsetfilename); } + $this->mapa->setsymbolset($novoss); + $ns = $this->mapa->getnumsymbols(); - for ($i=0;$i < $ns;++$i) - { + $inis = 0; + + //na versao 7 nao tem o simbolo 0 + if($this->v >= 7){ + $inis = 1; + //se for versao 7 inclui um primeiro simbolo com valor 0 e imagem + $oSymbol = $this->mapa->getSymbolObjectById(1); + $adiciona = ms_newLayerObj($this->mapa, $l); + $nomel = $l->name; + $tematemp= $this->mapa->getlayerbyname($nomel); + $c = $tematemp->getClass(0); + $e = $c->getstyle(0); + $e->set("size",1); + $e->set("width",1); + $ico = $c->createLegendIcon(40,40); + $nimg = $ico->saveWebImage(); + $pat = $this->mapa->web->imageurl; + $ins .= ""; + } + for ($i=$inis;$i < $ns;++$i){ $oSymbol = $this->mapa->getSymbolObjectById($i); - $nomes = $oSymbol->name; - if($nomes == "") - { + if($nomes == ""){ $nomes = $i; } - $adiciona = ms_newLayerObj($this->mapa, $l); $nomel = $l->name; $tematemp= $this->mapa->getlayerbyname($nomel); @@ -688,11 +705,8 @@ class Legenda $e->set("symbolname",$nomes); $e->set("size",$tamanho); $e->set("width",$width); - $ico = $c->createLegendIcon(40,40); - $nimg = $ico->saveWebImage(); - $pat = $this->mapa->web->imageurl; $ins .= ""; } @@ -701,8 +715,7 @@ class Legenda //copy ($dir."/simbolos".$tipo.".inc",$dir_tmp."/comum/simbolos".$tipo.".inc"); return $ins; } - else - { + else { $res = ""; include_once $dir."/simbolos".$tipo.".inc"; return $res; @@ -728,8 +741,7 @@ class Legenda $tipoLayer = $this->layer->type; $classe = $this->layer->getclass($classe); $numestilos = $classe->numstyles; - for ($i=0;$i<$numestilos;++$i) - { + for ($i=0;$i<$numestilos;++$i){ $linha = array(); $estilo = $classe->getstyle($i); $linha[] = $i; @@ -739,7 +751,7 @@ class Legenda $linha[] = $estilo->symbolname; $linha[] = $estilo->size; $linha[] = $estilo->opacity; - if($this->v == 6){ + if($this->v >= 6){ $linha[] = $estilo->width; $s = $estilo->symbol; $linha[] = implode(" ",$s->getPatternArray); @@ -832,11 +844,11 @@ class Legenda { $estilo->set("size",$size); } - if ((isset ($width)) && ($width != "-1") && ($this->v == 6)) + if ((isset ($width)) && ($width != "-1") && ($this->v >= 6)) { $estilo->set("width",$width); } - if ((isset ($pattern)) && ($pattern != "-1") && ($this->v == 6) && ($pattern != "")) + if ((isset ($pattern)) && ($pattern != "-1") && ($this->v >= 6) && ($pattern != "")) { $estilo->updatefromstring("STYLE PATTERN ".$pattern." END"); } @@ -1054,7 +1066,7 @@ class Legenda case "pattern": if(!empty($pattern)){ $pattern = str_replace(","," ",$valor); - if ($this->v == 6){ + if ($this->v >= 6){ $estilo->updatefromstring("STYLE PATTERN ".$valor." END"); } } diff --git a/classesphp/classe_selecao.php b/classesphp/classe_selecao.php index 9d05740..50c1f74 100644 --- a/classesphp/classe_selecao.php +++ b/classesphp/classe_selecao.php @@ -276,7 +276,7 @@ $buffer - Opcional $res_count = $layero->getNumresults(); for ($i = 0; $i < $res_count; ++$i) { - if($this->v == 6) + if($this->v >= 6) {$sh = $layero->getShape($layero->getResult($i));} else{ $result = $layero->getResult($i); @@ -339,7 +339,7 @@ $buffer - Opcional $conta = $layero->getNumresults(); for ($k = 0; $k < $conta; $k++) { - if($this->v == 6) + if($this->v >= 6) {$s = @$layero->getShape($layero->getResult($k));} else {$s = @$layero->getfeature($k,-1);} diff --git a/classesphp/classe_shp.php b/classesphp/classe_shp.php index 0b38721..cbf5387 100644 --- a/classesphp/classe_shp.php +++ b/classesphp/classe_shp.php @@ -438,7 +438,7 @@ array("layerprj"=>$xylayer,"mapprj"=>$xymapa) $sopen = $this->layer->open(); if($sopen == MS_FAILURE){return "erro";} $xy = array(); - if($this->v == 6) + if($this->v >= 6) {$shape = $this->layer->getShape($this->layer->getshape(new resultObj($res_count - 1)));} else{ $result = $this->layer->getResult($res_count - 1); diff --git a/classesphp/mapa_openlayers.php b/classesphp/mapa_openlayers.php index dd4854f..84b497c 100644 --- a/classesphp/mapa_openlayers.php +++ b/classesphp/mapa_openlayers.php @@ -59,9 +59,9 @@ Arquivo: i3geo/classesphp/mapa_openlayers.php */ + error_reporting(0); inicializa(); - // //calcula a extensao geografica com base no x,y,z //nos casos do modo notile, a requisicao e feita como se fosse um wms @@ -145,7 +145,6 @@ if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getf if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){ carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]); } - // //map_fileX e para o caso register_globals = On no PHP.INI // @@ -244,7 +243,6 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter } } } - if (!function_exists('imagepng')){ $_GET["TIPOIMAGEM"] = ""; } @@ -562,6 +560,9 @@ function inicializa(){ ilegal(); } session_start(); + if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){ + return; + } if(@$_SESSION["fingerprint"]){ $f = explode(",",$_SESSION["fingerprint"]); if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $f[0] && !in_array($_GET["telaR"],$f) ) diff --git a/classesphp/proxy.php b/classesphp/proxy.php index 8461934..22d2aaa 100644 --- a/classesphp/proxy.php +++ b/classesphp/proxy.php @@ -7,12 +7,22 @@ if(!$ch){ echo "erro curl_init"; exit; } -curl_setopt($ch, CURLOPT_URL, $_GET["url"]); +if($_GET["url"]){ + curl_setopt($ch, CURLOPT_URL, $_GET["url"]); +} +else{ + curl_setopt($ch, CURLOPT_URL, $_SERVER["QUERY_STRING"]); +} curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); if(isset($i3geo_proxy_server) && $i3geo_proxy_server != ""){ curl_setopt($ch, CURLOPT_PROXY, $i3geo_proxy_server); } $resultado = curl_exec($ch); -echo $resultado; +if($_GET["tipoRetornoProxy"] == "string"){ + echo '"'.$resultado.'"'; +} +else{ + echo $resultado; +} ?> \ No newline at end of file -- libgit2 0.21.2