Commit a00a65f9d3ab78ac4f980f2145ecb4e1aa1b0e9c

Authored by Edmar Moretti
1 parent 0462d14b

--no commit message

admin/admin.db
No preview for this file type
admin/js/menu.js
... ... @@ -62,7 +62,7 @@ function montaTabela_M(dados)
62 62 var formatTexto = function(elCell, oRecord, oColumn, oData)
63 63 {
64 64 if(oData === ""){
65   - oData = "<span style='color:gray' >Clique para editar, tecle enter e depois salve</span>";
  65 + oData = "<span style='color:gray' ></span>";
66 66 }
67 67 elCell.innerHTML = "<pre ><p style=cursor:pointer title='clique para editar'>" + oData + "</pre>";
68 68 };
... ...
admin/php/conexaopostgresql.php
... ... @@ -9,5 +9,5 @@ catch (PDOException $e)
9 9 print "Erro : " . $e->getMessage() . "<br/> Se vc estiver usando SQLITE, talvez exista alguma incompatibilidade entre o PHP e o banco admin.db. Vc pode apagar o arquivo menutemas/admin.db e recria-lo com admin/php/criasqlite.php";
10 10 die();
11 11 }
12   -$convUTF = false;
  12 +$convUTF = true;
13 13 ?>
... ...
ogc.php
... ... @@ -57,6 +57,7 @@ ogc.php?intervalo=0,50
57 57 //
58 58 //validações e includes
59 59 //
  60 +$cache = true;
60 61 if (!function_exists('ms_GetVersion'))
61 62 {
62 63 if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
... ... @@ -119,22 +120,29 @@ $versao = $versao[&quot;principal&quot;];
119 120 $req = ms_newowsrequestobj();
120 121 $tipo = "";
121 122 $_GET = array_merge($_GET,$_POST);
  123 +if(isset($_GET["sld"]) || isset($_GET["filter"]))
  124 +{$cache = false;}
122 125 foreach ($_GET as $k=>$v)
123 126 {
124 127 $req->setParameter($k, $v);
125   - if(strtolower($v) == "getcapabilities")
126   - {$tipo = "metadados";}
  128 + if(strtolower($v) == "getcapabilities"){
  129 + $tipo = "metadados";
  130 + $cache = false;
  131 + }
127 132 if(strtolower($k) == "layers")
128 133 {$tema = $v;}
129 134 if(strtolower($k) == "layer")
130 135 {$tema = $v;}
131 136 }
132 137 $listaepsg = $srs." 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";
  138 +
133 139 if(count($_GET) == 0){
134 140 $tipo="intervalo";
135 141 $req->setParameter("REQUEST", "getCapabilities");
136 142 $req->setParameter("SERVICE", "WMS");
  143 + $cache = false;
137 144 }
  145 +
138 146 if(isset($tema) && $tipo != "metadados")
139 147 {$tipo = "";}
140 148 if(!isset($version))
... ... @@ -160,9 +168,6 @@ $oMap-&gt;setmetadata(&quot;ows_onlineresource&quot;,$or);
160 168 $oMap->setmetadata("wms_onlineresource",$or);
161 169 $oMap->setmetadata("wms_title",$tituloInstituicao." - i3geo");
162 170 $oMap->setmetadata("wfs_title",$tituloInstituicao." - i3geo");
163   -//qd definido aqui, não funciona no qgis
164   -//$oMap->setmetadata("ows_srs",$listaepsg);
165   -//$oMap->setmetadata("wms_srs",$listaepsg);
166 171 $oMap->setmetadata("wms_attribution_logourl_format","image/png");
167 172 $oMap->setmetadata("wms_attribution_logourl_height","56");
168 173 $oMap->setmetadata("wms_attribution_logourl_width","85");
... ... @@ -198,6 +203,9 @@ if ($tipo == &quot;&quot; || $tipo == &quot;metadados&quot;)
198 203 if(count($ts)==1)
199 204 {
200 205 $l->set("name",$tx);
  206 + if($cache == true && strtolower($l->getmetadata("cache")) == "sim"){
  207 + carregaCacheImagem($_GET["BBOX"],$t,$_GET["WIDTH"],$_GET["HEIGHT"]);
  208 + }
201 209 }
202 210 $l->setmetadata("gml_include_items","all");
203 211 $l->set("dump",MS_TRUE);
... ... @@ -312,12 +320,12 @@ else
312 320  
313 321 $l->setmetadata("ows_title",pegaNome($l));
314 322 $l->setmetadata("ows_srs",$listaepsg);
315   - //$l->setmetadata("wms_srs","EPSG:4291 EPSG:4326");
316 323 $l->set("status",MS_OFF);
317 324 $l->setmetadata("gml_include_items","all");
318 325 $l->set("dump",MS_TRUE);
319 326 $l->setmetadata("WMS_INCLUDE_ITEMS","all");
320 327 $l->setmetadata("WFS_INCLUDE_ITEMS","all");
  328 +
321 329 $l->setmetadata("ows_metadataurl_href",$c["fonte"]);
322 330 $l->setmetadata("ows_metadataurl_type","TC211");
323 331 $l->setmetadata("ows_metadataurl_format","text/html");
... ... @@ -328,7 +336,7 @@ else
328 336 $l->setmetadata("wms_attribution_logourl_height","50");
329 337 $l->setmetadata("wms_attribution_logourl_width","50");
330 338 $l->setmetadata("wms_attribution_logourl_href",$mini);
331   - }
  339 + }
332 340 ms_newLayerObj($oMap, $l);
333 341 }
334 342 }
... ... @@ -346,7 +354,7 @@ if(strtolower($request) == &quot;getcapabilities&quot;)
346 354 //header("Content-type: application/xml");
347 355 header("Content-type: $contenttype");
348 356  
349   -ms_iogetStdoutBufferBytes();
  357 +$buffer = ms_iogetStdoutBufferBytes();
350 358 ms_ioresethandlers();
351 359 //
352 360 //funções
... ... @@ -416,6 +424,49 @@ function ogc_imprimeListaDeTemas()
416 424 }
417 425 echo $imprimir."</body></html>";
418 426 }
  427 +function carregaCacheImagem($bbox,$layer,$w,$h){
  428 + global $dir_tmp;
  429 +
  430 + $nome = $w.$h.$bbox.".png";
  431 + $nome = $dir_tmp."/cache/".$layer."/".$nome;
  432 + if(file_exists($nome))
  433 + {
  434 + if (!function_exists('imagepng'))
  435 + {
  436 + $s = PHP_SHLIB_SUFFIX;
  437 + @dl( 'php_gd2.'.$s );
  438 + if (!function_exists('imagepng'))
  439 + @dl( 'php_gd.'.$s );
  440 + }
  441 + @$img = imagecreatefrompng($nome);
  442 + if(!$img)
  443 + {
  444 + /* Create a blank image */
  445 + $img = imagecreatetruecolor($w, $h);
  446 + imagealphablending($img, false);
  447 + imagesavealpha($img, true);
  448 +
  449 + $bgc = imagecolorallocatealpha($img, 255, 255, 255,127);
  450 + $tc = imagecolorallocate($img, 255, 0, 0);
  451 +
  452 + imagefilledrectangle($img, 0, 0, $w, $h, $bgc);
  453 + /* Output an error message */
  454 + imagestring($img, 3, 5, 5, 'Erro ao ler ' . $nome, $tc);
  455 + }
  456 + else
  457 + {
  458 + imagealphablending($img, false);
  459 + imagesavealpha($img, true);
  460 + }
  461 + ob_clean();
  462 + error_reporting(0);
  463 + echo header("Content-type: image/png \n\n");
  464 + imagepng($img);
  465 + imagedestroy($img);
  466 + exit;
  467 + }
  468 +}
  469 +
419 470 ?>
420 471  
421 472  
... ...
temas/biomashp.map
... ... @@ -7,7 +7,7 @@ MAP
7 7 GROUP "biomashp"
8 8 METADATA
9 9 "ltempoitemimagem" ""
10   - "cache" ""
  10 + "cache" "sim"
11 11 "CLASSE" "SIM"
12 12 "ltempoitemdescricao" ""
13 13 "palletestep" ""
... ...
temas/locali.map
... ... @@ -7,7 +7,7 @@ MAP
7 7 METADATA
8 8 "LTEMPOITEMIMAGEM" ""
9 9 "TIP" "TIPO,ANOCRIA,NOMELOC"
10   - "cache" ""
  10 + "cache" "sim"
11 11 "LTEMPOITEMDESCRICAO" "TIPO"
12 12 "CLASSE" "SIM"
13 13 "palletestep" ""
... ...