Commit e1fbe0b10c157415610790ece1b44ac09444cbbe

Authored by Edmar Moretti
1 parent 66a9b037

Inclusão de projeto gvsig no gerador de WMS

imagens/gisicons/player-forward.png 0 → 100644

1017 Bytes

imagens/gisicons/player-next.png 0 → 100644

923 Bytes

imagens/gisicons/player-pause.png 0 → 100644

513 Bytes

imagens/gisicons/player-repeat-back-forward.png 0 → 100644

1.06 KB

imagens/gisicons/player-stop.png 0 → 100644

518 Bytes

@@ -60,20 +60,9 @@ ogc.php?intervalo=0,50 @@ -60,20 +60,9 @@ ogc.php?intervalo=0,50
60 //validações e includes 60 //validações e includes
61 // 61 //
62 $cache = true; 62 $cache = true;
63 -if (!function_exists('ms_GetVersion'))  
64 -{  
65 - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))  
66 - {  
67 - if(!@dl('php_mapscript_48.dll'))  
68 - dl('php_mapscript.dll');  
69 - }  
70 - else  
71 - {dl('php_mapscript.so');}  
72 -}  
73 -require_once("classesphp/carrega_ext.php");  
74 -include("ms_configura.php");  
75 -include("classesphp/pega_variaveis.php");  
76 -//include("classesphp/classe_menutemas.php"); 63 +require_once(__DIR__."/classesphp/carrega_ext.php");
  64 +include(__DIR__."/ms_configura.php");
  65 +include(__DIR__."/classesphp/pega_variaveis.php");
77 if(!isset($temas) && isset($tema)) 66 if(!isset($temas) && isset($tema))
78 {$temas = $tema;} 67 {$temas = $tema;}
79 // 68 //
@@ -82,7 +71,7 @@ if(!isset($temas) && isset($tema)) @@ -82,7 +71,7 @@ if(!isset($temas) && isset($tema))
82 if(isset($format) && strtolower($format) == "application/openlayers"){ 71 if(isset($format) && strtolower($format) == "application/openlayers"){
83 if(!isset($layers)) 72 if(!isset($layers))
84 {$layers = $temas;} 73 {$layers = $temas;}
85 - $urln = "mashups/openlayers.php?temas=".$layers."&layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica"; 74 + $urln = __DIR__."/mashups/openlayers.php?temas=".$layers."&layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica";
86 if(!headers_sent()) 75 if(!headers_sent())
87 {header("Location:".$urln);} 76 {header("Location:".$urln);}
88 else 77 else
@@ -100,24 +89,22 @@ $urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]); @@ -100,24 +89,22 @@ $urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]);
100 // 89 //
101 //imprime na tela a ajuda 90 //imprime na tela a ajuda
102 // 91 //
103 -if(isset($ajuda))  
104 -{ 92 +if(isset($ajuda)){
105 ogc_imprimeAjuda(); 93 ogc_imprimeAjuda();
106 exit; 94 exit;
107 } 95 }
108 // 96 //
109 //imprime na tela a lista de temas disponíveis 97 //imprime na tela a lista de temas disponíveis
110 // 98 //
111 -if(isset($lista) && $lista == "temas")  
112 -{  
113 - include_once("classesphp/classe_menutemas.php"); 99 +if(isset($lista) && $lista == "temas"){
  100 + include_once(__DIR__."/classesphp/classe_menutemas.php");
114 ogc_imprimeListaDeTemas(); 101 ogc_imprimeListaDeTemas();
115 exit; 102 exit;
116 } 103 }
117 // 104 //
118 //cria o web service 105 //cria o web service
119 // 106 //
120 -include("classesphp/funcoes_gerais.php"); 107 +include(__DIR__."/classesphp/funcoes_gerais.php");
121 error_reporting(0); 108 error_reporting(0);
122 $versao = versao(); 109 $versao = versao();
123 $versao = $versao["principal"]; 110 $versao = $versao["principal"];
@@ -125,25 +112,26 @@ $req = ms_newowsrequestobj(); @@ -125,25 +112,26 @@ $req = ms_newowsrequestobj();
125 $tipo = ""; 112 $tipo = "";
126 $_GET = array_merge($_GET,$_POST); 113 $_GET = array_merge($_GET,$_POST);
127 114
128 -if(isset($_GET["sld"]) || isset($_GET["filter"]))  
129 -{$cache = false;}  
130 -foreach ($_GET as $k=>$v)  
131 -{ 115 +if(isset($_GET["sld"]) || isset($_GET["filter"])){
  116 + $cache = false;
  117 +}
  118 +foreach ($_GET as $k=>$v){
132 $req->setParameter($k, $v); 119 $req->setParameter($k, $v);
133 if(strtolower($v) == "getcapabilities"){ 120 if(strtolower($v) == "getcapabilities"){
134 $tipo = "metadados"; 121 $tipo = "metadados";
135 $cache = false; 122 $cache = false;
136 } 123 }
137 - if(strtolower($k) == "layers") 124 + if(strtolower($k) == "layers" && empty($_GET["tema"]))
138 {$tema = $v;} 125 {$tema = $v;}
139 - if(strtolower($k) == "layer") 126 + if(strtolower($k) == "layer" && empty($_GET["tema"]))
140 {$tema = $v;} 127 {$tema = $v;}
141 } 128 }
142 -if(empty($srs))  
143 -{$srs = "";}  
144 -if(!empty($SRS))  
145 -{$srs = $SRS;}  
146 - 129 +if(empty($srs)){
  130 + $srs = "";
  131 +}
  132 +if(!empty($SRS)){
  133 + $srs = $SRS;
  134 +}
147 $listaepsg = $srs." EPSG:4618 EPSG:4291 EPSG:4326 EPSG:22521 EPSG:22522 EPSG:22523 EPSG:22524 EPSG:22525 EPSG:29101 EPSG:29119 EPSG:29120 EPSG:29121 EPSG:29122 EPSG:29177 EPSG:29178 EPSG:29179 EPSG:29180 EPSG:29181 EPSG:29182 EPSG:29183 EPSG:29184 EPSG:29185"; 135 $listaepsg = $srs." EPSG:4618 EPSG:4291 EPSG:4326 EPSG:22521 EPSG:22522 EPSG:22523 EPSG:22524 EPSG:22525 EPSG:29101 EPSG:29119 EPSG:29120 EPSG:29121 EPSG:29122 EPSG:29177 EPSG:29178 EPSG:29179 EPSG:29180 EPSG:29181 EPSG:29182 EPSG:29183 EPSG:29184 EPSG:29185";
148 if(count($_GET) == 0){ 136 if(count($_GET) == 0){
149 $tipo="intervalo"; 137 $tipo="intervalo";
@@ -151,16 +139,17 @@ if(count($_GET) == 0){ @@ -151,16 +139,17 @@ if(count($_GET) == 0){
151 $req->setParameter("SERVICE", "WMS"); 139 $req->setParameter("SERVICE", "WMS");
152 $cache = false; 140 $cache = false;
153 } 141 }
154 -if(isset($tema) && $tipo != "metadados")  
155 -{$tipo = "";}  
156 -if(!isset($version))  
157 -{$req->setParameter("VeRsIoN","1.1.0");} 142 +if(isset($tema) && $tipo != "metadados"){
  143 + $tipo = "";
  144 +}
  145 +if(!isset($version)){
  146 + $req->setParameter("VeRsIoN","1.1.0");
  147 +}
158 $oMap = ms_newMapobj($locaplic."/aplicmap/ogcwsv".$versao.".map"); 148 $oMap = ms_newMapobj($locaplic."/aplicmap/ogcwsv".$versao.".map");
159 // 149 //
160 //altera os caminhos das imagens 150 //altera os caminhos das imagens
161 // 151 //
162 -if((isset($legenda)) && (strtolower($legenda) == "sim"))  
163 -{ 152 +if((isset($legenda)) && (strtolower($legenda) == "sim")){
164 $leg = $oMap->legend; 153 $leg = $oMap->legend;
165 $leg->set("status",MS_EMBED); 154 $leg->set("status",MS_EMBED);
166 $cache = false; 155 $cache = false;
@@ -168,8 +157,9 @@ if((isset($legenda)) && (strtolower($legenda) == "sim")) @@ -168,8 +157,9 @@ if((isset($legenda)) && (strtolower($legenda) == "sim"))
168 $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://"; 157 $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://";
169 $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; 158 $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
170 $or = $proto.$server.$_SERVER['PHP_SELF']; 159 $or = $proto.$server.$_SERVER['PHP_SELF'];
171 -if((isset($tema)) && ($tema != "") && ($tipo=="metadados"))  
172 -{$or = $or."?tema=".$tema."&";} 160 +if((isset($tema)) && ($tema != "") && ($tipo=="metadados")){
  161 + $or = $or."?tema=".$tema."&";
  162 +}
173 // 163 //
174 //parametros no nível maior 164 //parametros no nível maior
175 // 165 //
@@ -186,10 +176,12 @@ $oMap->setmetadata("wms_attribution_title",$tituloInstituicao); @@ -186,10 +176,12 @@ $oMap->setmetadata("wms_attribution_title",$tituloInstituicao);
186 $oMap->setmetadata("ows_enable_request","*"); 176 $oMap->setmetadata("ows_enable_request","*");
187 $e = $oMap->extent; 177 $e = $oMap->extent;
188 $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); 178 $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy);
189 -if (!isset($intervalo))  
190 -{$intervalo = "0,5000";}  
191 -else  
192 -{$tipo = "intervalo";} 179 +if (!isset($intervalo)){
  180 + $intervalo = "0,5000";
  181 +}
  182 +else{
  183 + $tipo = "intervalo";
  184 +}
193 if(!isset($tema)){ 185 if(!isset($tema)){
194 if(!isset($intervalo)) 186 if(!isset($intervalo))
195 {$intervalo = "0,5000";} 187 {$intervalo = "0,5000";}
@@ -301,6 +293,7 @@ if ($tipo == "" || $tipo == "metadados"){ @@ -301,6 +293,7 @@ if ($tipo == "" || $tipo == "metadados"){
301 $oMap = $gm->addLayers($oMap,$gvsigview,$dataView["layerNames"]); 293 $oMap = $gm->addLayers($oMap,$gvsigview,$dataView["layerNames"]);
302 $numlayers = $oMap->numlayers; 294 $numlayers = $oMap->numlayers;
303 $layers = array(); 295 $layers = array();
  296 + //$layers[] = "default";
304 for ($i=0;$i < $numlayers;$i++){ 297 for ($i=0;$i < $numlayers;$i++){
305 $l = $oMap->getlayer($i); 298 $l = $oMap->getlayer($i);
306 $l->setmetadata("gml_include_items","all"); 299 $l->setmetadata("gml_include_items","all");
@@ -309,10 +302,29 @@ if ($tipo == &quot;&quot; || $tipo == &quot;metadados&quot;){ @@ -309,10 +302,29 @@ if ($tipo == &quot;&quot; || $tipo == &quot;metadados&quot;){
309 $l->setmetadata("WFS_INCLUDE_ITEMS","all"); 302 $l->setmetadata("WFS_INCLUDE_ITEMS","all");
310 $l->setmetadata("ows_srs",$listaepsg); 303 $l->setmetadata("ows_srs",$listaepsg);
311 $l->setmetadata("ows_title",$l->getmetadata("TEMA")); 304 $l->setmetadata("ows_title",$l->getmetadata("TEMA"));
312 - $l->set("status",MS_DEFAULT); 305 + $l->set("status",MS_OFF);
313 $layers[] = $l->name; 306 $layers[] = $l->name;
  307 + if(file_exists($locaplic."/temas/miniaturas/".$tx.".map.mini.png")){
  308 + $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$tx.".map.mini.png";
  309 + $l->setmetadata("wms_attribution_logourl_format","image/png");
  310 + $l->setmetadata("wms_attribution_logourl_height","50");
  311 + $l->setmetadata("wms_attribution_logourl_width","50");
  312 + $l->setmetadata("wms_attribution_logourl_href",$mini);
  313 + }
  314 + if($l->type == MS_LAYER_RASTER && $l->numclasses > 0){
  315 + $c = $l->getclass(0);
  316 + if($c->name == "")
  317 + {$c->name = " ";}
  318 + }
  319 + //inclui extensao geografica
  320 + $extensao = $l->getmetadata("EXTENSAO");
  321 + if($extensao == ""){
  322 + $extensao = $extensaoMap;
  323 + }
  324 + $l->setmetadata("wms_extent",$extensao);
314 } 325 }
315 $req->setParameter("LAYERS", implode(",",$layers)); 326 $req->setParameter("LAYERS", implode(",",$layers));
  327 + $req->setParameter("STYLES", "");
316 //r_dump($req);exit; 328 //r_dump($req);exit;
317 } 329 }
318 } 330 }