Commit 0ac84d78c420cbd58a0babc1253e13bfb4dca49e

Authored by Edmar Moretti
1 parent 65744aed
Exists in master

Adaptações para versão 7 do Mapserver

classesphp/classe_analise.php
@@ -1132,7 +1132,7 @@ class Analise @@ -1132,7 +1132,7 @@ class Analise
1132 } 1132 }
1133 if ($layer->getResult(0) !== FALSE) 1133 if ($layer->getResult(0) !== FALSE)
1134 { 1134 {
1135 - if($this->v == 6) 1135 + if($this->v >= 6)
1136 { 1136 {
1137 $shape = $layer->getShape($layer->getResult(0)); 1137 $shape = $layer->getShape($layer->getResult(0));
1138 } 1138 }
@@ -1261,7 +1261,7 @@ class Analise @@ -1261,7 +1261,7 @@ class Analise
1261 1261
1262 for ($i = 0; $i < $res_count; ++$i) 1262 for ($i = 0; $i < $res_count; ++$i)
1263 { 1263 {
1264 - if($this->v == 6) 1264 + if($this->v >= 6)
1265 { 1265 {
1266 $shapesdestino[] = $layerdestino->getShape($layerdestino->getResult($i)); 1266 $shapesdestino[] = $layerdestino->getShape($layerdestino->getResult($i));
1267 } 1267 }
@@ -2200,7 +2200,7 @@ class Analise @@ -2200,7 +2200,7 @@ class Analise
2200 $layerPt->open(); 2200 $layerPt->open();
2201 $res_count = $layerPt->getNumresults(); 2201 $res_count = $layerPt->getNumresults();
2202 for ($i = 0; $i < $res_count; ++$i){ 2202 for ($i = 0; $i < $res_count; ++$i){
2203 - if($this->v == 6){ 2203 + if($this->v >= 6){
2204 $s = $layerPt->getShape($layerPt->getResult($i)); 2204 $s = $layerPt->getShape($layerPt->getResult($i));
2205 } 2205 }
2206 else{ 2206 else{
classesphp/classe_atributos.php
@@ -214,7 +214,7 @@ class Atributos @@ -214,7 +214,7 @@ class Atributos
214 //$this->layer->setfilter(""); 214 //$this->layer->setfilter("");
215 $ext = ""; 215 $ext = "";
216 //procura o registro e pega a extens&atilde;o geogr&aacute;fica 216 //procura o registro e pega a extens&atilde;o geogr&aacute;fica
217 - if($this->v == 6){ 217 + if($this->v >= 6){
218 $this->layer->open(); 218 $this->layer->open();
219 $shape = $this->layer->getShape(new resultObj($registro)); 219 $shape = $this->layer->getShape(new resultObj($registro));
220 //$shape = $this->layer->getShape($this->layer->getResult($registro)); 220 //$shape = $this->layer->getShape($this->layer->getResult($registro));
@@ -505,7 +505,7 @@ class Atributos @@ -505,7 +505,7 @@ class Atributos
505 $valoresunicos = array(); 505 $valoresunicos = array();
506 for ($i = $inicio; $i < $res_count; ++$i){ 506 for ($i = $inicio; $i < $res_count; ++$i){
507 $valitem = array(); 507 $valitem = array();
508 - if($this->v == 6){ 508 + if($this->v >= 6){
509 $shape = $this->layer->getShape($this->layer->getResult($i)); 509 $shape = $this->layer->getShape($this->layer->getResult($i));
510 $indx = $shape->index; 510 $indx = $shape->index;
511 } 511 }
@@ -621,7 +621,7 @@ class Atributos @@ -621,7 +621,7 @@ class Atributos
621 $sopen = $this->layer->open(); 621 $sopen = $this->layer->open();
622 for ($i = 0; $i < $res_count; ++$i){ 622 for ($i = 0; $i < $res_count; ++$i){
623 $valitem = array(); 623 $valitem = array();
624 - if($this->v == 6){ 624 + if($this->v >= 6){
625 $shape = $this->layer->getShape($this->layer->getResult($i)); 625 $shape = $this->layer->getShape($this->layer->getResult($i));
626 $indx = $shape->index; 626 $indx = $shape->index;
627 } 627 }
@@ -732,7 +732,7 @@ class Atributos @@ -732,7 +732,7 @@ class Atributos
732 $palavra = $this->remove_accents(strtolower($palavra)); 732 $palavra = $this->remove_accents(strtolower($palavra));
733 for ($i = 0; $i < $res_count; ++$i) { 733 for ($i = 0; $i < $res_count; ++$i) {
734 $valitem = array(); 734 $valitem = array();
735 - if($this->v == 6){ 735 + if($this->v >= 6){
736 $shape = $l->getShape($l->getResult($i)); 736 $shape = $l->getShape($l->getResult($i));
737 $indx = $shape->index; 737 $indx = $shape->index;
738 } 738 }
@@ -1930,7 +1930,7 @@ class Atributos @@ -1930,7 +1930,7 @@ class Atributos
1930 for ($i = 0; $i < $res_count; ++$i) 1930 for ($i = 0; $i < $res_count; ++$i)
1931 { 1931 {
1932 $valori = array(); 1932 $valori = array();
1933 - if($this->v == 6) 1933 + if($this->v >= 6)
1934 { 1934 {
1935 $shape = $layer->getShape($layer->getResult($i)); 1935 $shape = $layer->getShape($layer->getResult($i));
1936 } 1936 }
@@ -2308,7 +2308,7 @@ class Atributos @@ -2308,7 +2308,7 @@ class Atributos
2308 } 2308 }
2309 for ($i = 0; $i < $res_count; ++$i) { 2309 for ($i = 0; $i < $res_count; ++$i) {
2310 $valori = array(); 2310 $valori = array();
2311 - if($this->v == 6){ 2311 + if($this->v >= 6){
2312 $shape = $layer->getShape($layer->getResult($i)); 2312 $shape = $layer->getShape($layer->getResult($i));
2313 } 2313 }
2314 else{ 2314 else{
classesphp/classe_legenda.php
@@ -656,8 +656,8 @@ class Legenda @@ -656,8 +656,8 @@ class Legenda
656 { 656 {
657 $mapatemp = ms_newMapObj($this->localaplicacao."\\aplicmap\\".$t); 657 $mapatemp = ms_newMapObj($this->localaplicacao."\\aplicmap\\".$t);
658 } 658 }
659 - else  
660 - {$mapatemp = ms_newMapObj($this->localaplicacao."/aplicmap/".$t); 659 + else{
  660 + $mapatemp = ms_newMapObj($this->localaplicacao."/aplicmap/".$t);
661 } 661 }
662 $l = $mapatemp->getlayer(0); 662 $l = $mapatemp->getlayer(0);
663 663
@@ -665,21 +665,38 @@ class Legenda @@ -665,21 +665,38 @@ class Legenda
665 { 665 {
666 $novoss = dirname($this->mapa->symbolsetfilename)."\\".basename($mapatemp->symbolsetfilename); 666 $novoss = dirname($this->mapa->symbolsetfilename)."\\".basename($mapatemp->symbolsetfilename);
667 } 667 }
668 - else  
669 - {$novoss = dirname($this->mapa->symbolsetfilename)."/".basename($mapatemp->symbolsetfilename); 668 + else{
  669 + $novoss = dirname($this->mapa->symbolsetfilename)."/".basename($mapatemp->symbolsetfilename);
670 } 670 }
  671 +
671 $this->mapa->setsymbolset($novoss); 672 $this->mapa->setsymbolset($novoss);
  673 +
672 $ns = $this->mapa->getnumsymbols(); 674 $ns = $this->mapa->getnumsymbols();
673 - for ($i=0;$i < $ns;++$i)  
674 - { 675 + $inis = 0;
  676 +
  677 + //na versao 7 nao tem o simbolo 0
  678 + if($this->v >= 7){
  679 + $inis = 1;
  680 + //se for versao 7 inclui um primeiro simbolo com valor 0 e imagem
  681 + $oSymbol = $this->mapa->getSymbolObjectById(1);
  682 + $adiciona = ms_newLayerObj($this->mapa, $l);
  683 + $nomel = $l->name;
  684 + $tematemp= $this->mapa->getlayerbyname($nomel);
  685 + $c = $tematemp->getClass(0);
  686 + $e = $c->getstyle(0);
  687 + $e->set("size",1);
  688 + $e->set("width",1);
  689 + $ico = $c->createLegendIcon(40,40);
  690 + $nimg = $ico->saveWebImage();
  691 + $pat = $this->mapa->web->imageurl;
  692 + $ins .= "<img src='".$nimg."' style='cursor:pointer;border: 5px solid #FFFFFF' title='0' onclick='".$onclick."'>";
  693 + }
  694 + for ($i=$inis;$i < $ns;++$i){
675 $oSymbol = $this->mapa->getSymbolObjectById($i); 695 $oSymbol = $this->mapa->getSymbolObjectById($i);
676 -  
677 $nomes = $oSymbol->name; 696 $nomes = $oSymbol->name;
678 - if($nomes == "")  
679 - { 697 + if($nomes == ""){
680 $nomes = $i; 698 $nomes = $i;
681 } 699 }
682 -  
683 $adiciona = ms_newLayerObj($this->mapa, $l); 700 $adiciona = ms_newLayerObj($this->mapa, $l);
684 $nomel = $l->name; 701 $nomel = $l->name;
685 $tematemp= $this->mapa->getlayerbyname($nomel); 702 $tematemp= $this->mapa->getlayerbyname($nomel);
@@ -688,11 +705,8 @@ class Legenda @@ -688,11 +705,8 @@ class Legenda
688 $e->set("symbolname",$nomes); 705 $e->set("symbolname",$nomes);
689 $e->set("size",$tamanho); 706 $e->set("size",$tamanho);
690 $e->set("width",$width); 707 $e->set("width",$width);
691 -  
692 $ico = $c->createLegendIcon(40,40); 708 $ico = $c->createLegendIcon(40,40);
693 -  
694 $nimg = $ico->saveWebImage(); 709 $nimg = $ico->saveWebImage();
695 -  
696 $pat = $this->mapa->web->imageurl; 710 $pat = $this->mapa->web->imageurl;
697 $ins .= "<img src='".$nimg."' style='cursor:pointer;border: 5px solid #FFFFFF' title=".$nomes." onclick='".$onclick."'>"; 711 $ins .= "<img src='".$nimg."' style='cursor:pointer;border: 5px solid #FFFFFF' title=".$nomes." onclick='".$onclick."'>";
698 } 712 }
@@ -701,8 +715,7 @@ class Legenda @@ -701,8 +715,7 @@ class Legenda
701 //copy ($dir."/simbolos".$tipo.".inc",$dir_tmp."/comum/simbolos".$tipo.".inc"); 715 //copy ($dir."/simbolos".$tipo.".inc",$dir_tmp."/comum/simbolos".$tipo.".inc");
702 return $ins; 716 return $ins;
703 } 717 }
704 - else  
705 - { 718 + else {
706 $res = ""; 719 $res = "";
707 include_once $dir."/simbolos".$tipo.".inc"; 720 include_once $dir."/simbolos".$tipo.".inc";
708 return $res; 721 return $res;
@@ -728,8 +741,7 @@ class Legenda @@ -728,8 +741,7 @@ class Legenda
728 $tipoLayer = $this->layer->type; 741 $tipoLayer = $this->layer->type;
729 $classe = $this->layer->getclass($classe); 742 $classe = $this->layer->getclass($classe);
730 $numestilos = $classe->numstyles; 743 $numestilos = $classe->numstyles;
731 - for ($i=0;$i<$numestilos;++$i)  
732 - { 744 + for ($i=0;$i<$numestilos;++$i){
733 $linha = array(); 745 $linha = array();
734 $estilo = $classe->getstyle($i); 746 $estilo = $classe->getstyle($i);
735 $linha[] = $i; 747 $linha[] = $i;
@@ -739,7 +751,7 @@ class Legenda @@ -739,7 +751,7 @@ class Legenda
739 $linha[] = $estilo->symbolname; 751 $linha[] = $estilo->symbolname;
740 $linha[] = $estilo->size; 752 $linha[] = $estilo->size;
741 $linha[] = $estilo->opacity; 753 $linha[] = $estilo->opacity;
742 - if($this->v == 6){ 754 + if($this->v >= 6){
743 $linha[] = $estilo->width; 755 $linha[] = $estilo->width;
744 $s = $estilo->symbol; 756 $s = $estilo->symbol;
745 $linha[] = implode(" ",$s->getPatternArray); 757 $linha[] = implode(" ",$s->getPatternArray);
@@ -832,11 +844,11 @@ class Legenda @@ -832,11 +844,11 @@ class Legenda
832 { 844 {
833 $estilo->set("size",$size); 845 $estilo->set("size",$size);
834 } 846 }
835 - if ((isset ($width)) && ($width != "-1") && ($this->v == 6)) 847 + if ((isset ($width)) && ($width != "-1") && ($this->v >= 6))
836 { 848 {
837 $estilo->set("width",$width); 849 $estilo->set("width",$width);
838 } 850 }
839 - if ((isset ($pattern)) && ($pattern != "-1") && ($this->v == 6) && ($pattern != "")) 851 + if ((isset ($pattern)) && ($pattern != "-1") && ($this->v >= 6) && ($pattern != ""))
840 { 852 {
841 $estilo->updatefromstring("STYLE PATTERN ".$pattern." END"); 853 $estilo->updatefromstring("STYLE PATTERN ".$pattern." END");
842 } 854 }
@@ -1054,7 +1066,7 @@ class Legenda @@ -1054,7 +1066,7 @@ class Legenda
1054 case "pattern": 1066 case "pattern":
1055 if(!empty($pattern)){ 1067 if(!empty($pattern)){
1056 $pattern = str_replace(","," ",$valor); 1068 $pattern = str_replace(","," ",$valor);
1057 - if ($this->v == 6){ 1069 + if ($this->v >= 6){
1058 $estilo->updatefromstring("STYLE PATTERN ".$valor." END"); 1070 $estilo->updatefromstring("STYLE PATTERN ".$valor." END");
1059 } 1071 }
1060 } 1072 }
classesphp/classe_selecao.php
@@ -276,7 +276,7 @@ $buffer - Opcional @@ -276,7 +276,7 @@ $buffer - Opcional
276 $res_count = $layero->getNumresults(); 276 $res_count = $layero->getNumresults();
277 for ($i = 0; $i < $res_count; ++$i) 277 for ($i = 0; $i < $res_count; ++$i)
278 { 278 {
279 - if($this->v == 6) 279 + if($this->v >= 6)
280 {$sh = $layero->getShape($layero->getResult($i));} 280 {$sh = $layero->getShape($layero->getResult($i));}
281 else{ 281 else{
282 $result = $layero->getResult($i); 282 $result = $layero->getResult($i);
@@ -339,7 +339,7 @@ $buffer - Opcional @@ -339,7 +339,7 @@ $buffer - Opcional
339 $conta = $layero->getNumresults(); 339 $conta = $layero->getNumresults();
340 for ($k = 0; $k < $conta; $k++) 340 for ($k = 0; $k < $conta; $k++)
341 { 341 {
342 - if($this->v == 6) 342 + if($this->v >= 6)
343 {$s = @$layero->getShape($layero->getResult($k));} 343 {$s = @$layero->getShape($layero->getResult($k));}
344 else 344 else
345 {$s = @$layero->getfeature($k,-1);} 345 {$s = @$layero->getfeature($k,-1);}
classesphp/classe_shp.php
@@ -438,7 +438,7 @@ array(&quot;layerprj&quot;=&gt;$xylayer,&quot;mapprj&quot;=&gt;$xymapa) @@ -438,7 +438,7 @@ array(&quot;layerprj&quot;=&gt;$xylayer,&quot;mapprj&quot;=&gt;$xymapa)
438 $sopen = $this->layer->open(); 438 $sopen = $this->layer->open();
439 if($sopen == MS_FAILURE){return "erro";} 439 if($sopen == MS_FAILURE){return "erro";}
440 $xy = array(); 440 $xy = array();
441 - if($this->v == 6) 441 + if($this->v >= 6)
442 {$shape = $this->layer->getShape($this->layer->getshape(new resultObj($res_count - 1)));} 442 {$shape = $this->layer->getShape($this->layer->getshape(new resultObj($res_count - 1)));}
443 else{ 443 else{
444 $result = $this->layer->getResult($res_count - 1); 444 $result = $this->layer->getResult($res_count - 1);
classesphp/mapa_openlayers.php
@@ -59,9 +59,9 @@ Arquivo: @@ -59,9 +59,9 @@ Arquivo:
59 i3geo/classesphp/mapa_openlayers.php 59 i3geo/classesphp/mapa_openlayers.php
60 60
61 */ 61 */
  62 +
62 error_reporting(0); 63 error_reporting(0);
63 inicializa(); 64 inicializa();
64 -  
65 // 65 //
66 //calcula a extensao geografica com base no x,y,z 66 //calcula a extensao geografica com base no x,y,z
67 //nos casos do modo notile, a requisicao e feita como se fosse um wms 67 //nos casos do modo notile, a requisicao e feita como se fosse um wms
@@ -145,7 +145,6 @@ if($_GET[&quot;REQUEST&quot;] == &quot;GetFeatureInfo&quot; || strtolower($_GET[&quot;REQUEST&quot;]) == &quot;getf @@ -145,7 +145,6 @@ if($_GET[&quot;REQUEST&quot;] == &quot;GetFeatureInfo&quot; || strtolower($_GET[&quot;REQUEST&quot;]) == &quot;getf
145 if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){ 145 if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
146 carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]); 146 carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]);
147 } 147 }
148 -  
149 // 148 //
150 //map_fileX e para o caso register_globals = On no PHP.INI 149 //map_fileX e para o caso register_globals = On no PHP.INI
151 // 150 //
@@ -244,7 +243,6 @@ if(!isset($_GET[&quot;telaR&quot;])){//no caso de projecoes remotas, o mapfile nao e alter @@ -244,7 +243,6 @@ if(!isset($_GET[&quot;telaR&quot;])){//no caso de projecoes remotas, o mapfile nao e alter
244 } 243 }
245 } 244 }
246 } 245 }
247 -  
248 if (!function_exists('imagepng')){ 246 if (!function_exists('imagepng')){
249 $_GET["TIPOIMAGEM"] = ""; 247 $_GET["TIPOIMAGEM"] = "";
250 } 248 }
@@ -562,6 +560,9 @@ function inicializa(){ @@ -562,6 +560,9 @@ function inicializa(){
562 ilegal(); 560 ilegal();
563 } 561 }
564 session_start(); 562 session_start();
  563 + if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
  564 + return;
  565 + }
565 if(@$_SESSION["fingerprint"]){ 566 if(@$_SESSION["fingerprint"]){
566 $f = explode(",",$_SESSION["fingerprint"]); 567 $f = explode(",",$_SESSION["fingerprint"]);
567 if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $f[0] && !in_array($_GET["telaR"],$f) ) 568 if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $f[0] && !in_array($_GET["telaR"],$f) )
classesphp/proxy.php
@@ -7,12 +7,22 @@ if(!$ch){ @@ -7,12 +7,22 @@ if(!$ch){
7 echo "erro curl_init"; 7 echo "erro curl_init";
8 exit; 8 exit;
9 } 9 }
10 -curl_setopt($ch, CURLOPT_URL, $_GET["url"]); 10 +if($_GET["url"]){
  11 + curl_setopt($ch, CURLOPT_URL, $_GET["url"]);
  12 +}
  13 +else{
  14 + curl_setopt($ch, CURLOPT_URL, $_SERVER["QUERY_STRING"]);
  15 +}
11 curl_setopt($ch, CURLOPT_HEADER, 0); 16 curl_setopt($ch, CURLOPT_HEADER, 0);
12 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 17 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
13 if(isset($i3geo_proxy_server) && $i3geo_proxy_server != ""){ 18 if(isset($i3geo_proxy_server) && $i3geo_proxy_server != ""){
14 curl_setopt($ch, CURLOPT_PROXY, $i3geo_proxy_server); 19 curl_setopt($ch, CURLOPT_PROXY, $i3geo_proxy_server);
15 } 20 }
16 $resultado = curl_exec($ch); 21 $resultado = curl_exec($ch);
17 -echo $resultado; 22 +if($_GET["tipoRetornoProxy"] == "string"){
  23 + echo '"'.$resultado.'"';
  24 +}
  25 +else{
  26 + echo $resultado;
  27 +}
18 ?> 28 ?>
19 \ No newline at end of file 29 \ No newline at end of file