Commit 06b11e588401da641ea603f420c427aa62ff4a77

Authored by Edmar Moretti
1 parent 0deb1097
Exists in master

Inclusão de parâmetros que permitem controlar as características da legenda quan…

…do embutida na funcao getmap em ogc.php
Showing 1 changed file with 83 additions and 8 deletions   Show diff stats
ogc.php
... ... @@ -31,8 +31,8 @@ Arquivo: i3geo/ogc.php
31 31  
32 32 Parâmetros:
33 33  
34   -lista - (opcional) se for igual a "temas", mostra uma lista de links em HTML dos temas disponíveis,
35   -se for igual a "temaswfs", mostra a lista de links WFS
  34 +lista - (opcional) se for igual a 'temas', mostra uma lista de links em HTML dos temas disponíveis,
  35 +se for igual a 'temaswfs', mostra a lista de links WFS
36 36  
37 37 ajuda - (opcional) mostra uma ajuda ao usuário
38 38  
... ... @@ -40,6 +40,26 @@ tema ou temas - (opcional) nome do tema que será mostrado no servi&ccedil
40 40  
41 41 legenda - (opcional) mostra a legenda no corpo do mapa sim|nao
42 42  
  43 + Ao ativar a legenda dentro do mapa, os seguintes parametros podem ser utilizados para controlar as características:
  44 +
  45 + legenda_imagecolor - cor RGB do fundo da legenda. Quando especificado, o mapa deixa de ser transparente. Exemplo: &legenda_imagecolor=255,0,0
  46 +
  47 + legenda_keysizex - largura da figura de cada classe
  48 +
  49 + legenda_keysizey - altura da figura de cada classe
  50 +
  51 + legenda_keyspacingx - distancia entre a figura e o inicio do texto de cada classe
  52 +
  53 + legenda_keyspacingy - distancia entre as figuras de cada classe
  54 +
  55 + legenda_position - posicao da legenda no mapa ul|uc|ur|ll|lc|lr
  56 +
  57 + legenda_outlinecolor - cor RGB do contorno das figuras de cada classe
  58 +
  59 + legenda_font - fonte (tipogafica) utilizada nos textos (arial, verdana...)
  60 +
  61 + legenda_size - tamanho dos textos
  62 +
43 63 templateLegenda - (opcional) nome de um template HTML para uso em legendas do tipo text/html. Dever ser o caminho relativo a pasta
44 64 onde o i3Geo esta instalado e deve usar a extensao .htm. Sobre templates, veja a documentacao do Mapserver. exemplo &templateLegenda=aplicmap/legenda8.htm
45 65  
... ... @@ -59,7 +79,7 @@ nao deve ser utilizado junto com tema
59 79  
60 80 restauramapa - ID de um mapa salvo no sistema de administracao. O mapa e restaurado e tratado como WMS
61 81  
62   -DESLIGACACHE (opcional) {sim|nao} - forca a nao usar o cache de imagens qd definido como "sim", do contrário, o uso ou não do cache será definido automaticamente
  82 +DESLIGACACHE (opcional) {sim|nao} - forca a nao usar o cache de imagens qd definido como 'sim', do contrário, o uso ou não do cache será definido automaticamente
63 83  
64 84 filtros - filtros podem ser adicionados incluindo o parametro da seguinte forma: &map_layer_<nomedotema>_filter=
65 85  
... ... @@ -79,7 +99,16 @@ ogc.php?tema=bioma
79 99  
80 100 ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo
81 101  
82   -*/
  102 +*/
  103 +
  104 +if(count($_GET) == 0){
  105 + echo "<pre>
  106 +
  107 +
  108 +";
  109 + exit;
  110 +}
  111 +
83 112 include(dirname(__FILE__)."/classesphp/sani_request.php");
84 113 include_once (dirname(__FILE__)."/classesphp/carrega_ext.php");
85 114 include(dirname(__FILE__)."/ms_configura.php");
... ... @@ -425,7 +454,7 @@ else{
425 454 $oMap->setmetadata("wms_attribution_logourl_height","56");
426 455 $oMap->setmetadata("wms_attribution_logourl_width","85");
427 456 $oMap->setmetadata("wms_attribution_logourl_href",$urli3geo."/imagens/i3geo.png");
428   - $oMap->setmetadata("wms_attribution_onlineresource",$urli3geo);
  457 + $oMap->setmetadata("wms_attribution_onlineresource",$urli3geo);
429 458 $oMap->setmetadata("wms_attribution_title",$tituloInstituicao);
430 459 $oMap->setmetadata("ows_enable_request","*");
431 460 //parametro mandatario
... ... @@ -441,7 +470,6 @@ else{
441 470 //para o caso do tema ser um arquivo mapfile existente em uma pasta qualquer
442 471 //$temai3geo = true indica que o layer ser&aacute; buscado na pasta i3geo/temas
443 472 $temai3geo = true;
444   - //FIXME nao aceita gvp quando o caminho e completo
445 473 if(file_exists($_GET["tema"]) && !isset($_GET["id_medida_variavel"])){
446 474 $nmap = ms_newMapobj($_GET["tema"]);
447 475 $temai3geo = false;
... ... @@ -793,7 +821,55 @@ else{
793 821 $legenda = $_GET["legenda"];
794 822 if((isset($legenda)) && (strtolower($legenda) == "sim")){
795 823 $leg = $oMap->legend;
796   - $leg->set("status",MS_EMBED);
  824 + $leg->set("status",MS_EMBED);
  825 + if(!empty($_GET["legenda_imagecolor"])){
  826 + $_GET["legenda_imagecolor"] = str_replace(","," ",$_GET["legenda_imagecolor"]);
  827 + $ncor = explode(" ",$_GET["legenda_imagecolor"]);
  828 + $cor = $leg->imagecolor;
  829 + $cor->setRGB($ncor[0],$ncor[1],$ncor[2]);
  830 + $req->setParameter("TRANSPARENT",0);
  831 + }
  832 + if(!empty($_GET["legenda_keysizex"])){
  833 + $leg->set("keysizex",$_GET["legenda_keysizex"]);
  834 + }
  835 + if(!empty($_GET["legenda_keysizey"])){
  836 + $leg->set("keysizey",$_GET["legenda_keysizey"]);
  837 + }
  838 + if(!empty($_GET["legenda_keyspacingx"])){
  839 + $leg->set("keyspacingx",$_GET["legenda_keyspacingx"]);
  840 + }
  841 + //ul|uc|ur|ll|lc|lr
  842 + if(!empty($_GET["legenda_position"])){
  843 + if($_GET["legenda_position"] == "ul") $leg->set("position",MS_UL);
  844 + if($_GET["legenda_position"] == "uc") $leg->set("position",MS_UC);
  845 + if($_GET["legenda_position"] == "ur") $leg->set("position",MS_UR);
  846 + if($_GET["legenda_position"] == "ll") $leg->set("position",MS_LL);
  847 + if($_GET["legenda_position"] == "lc") $leg->set("position",MS_LC);
  848 + if($_GET["legenda_position"] == "lr") $leg->set("position",MS_LR);
  849 + }
  850 + if(!empty($_GET["legenda_keyspacingy"])){
  851 + $leg->set("keyspacingy",$_GET["legenda_keyspacingy"]);
  852 + }
  853 + if(!empty($_GET["legenda_outlinecolor"])){
  854 + $_GET["legenda_outlinecolor"] = str_replace(","," ",$_GET["legenda_outlinecolor"]);
  855 + $ncor = explode(" ",$_GET["legenda_outlinecolor"]);
  856 + $cor = $leg->outlinecolor;
  857 + $cor->setRGB($ncor[0],$ncor[1],$ncor[2]);
  858 + }
  859 + //fonte e size so com truetype
  860 + if (!empty($_GET["legenda_font"])){
  861 + $label = $leg->label;
  862 + $label->updatefromstring("LABEL TYPE TRUETYPE END");
  863 + $label->set("font",$_GET["legenda_font"]);
  864 + }
  865 + if (!empty($_GET["legenda_size"])){
  866 + $label = $leg->label;
  867 + $label->updatefromstring("LABEL TYPE TRUETYPE END");
  868 + if(empty($_GET["legenda_font"])){
  869 + $label->set("font","arial");
  870 + }
  871 + $label->set("size",$_GET["legenda_size"]);
  872 + }
797 873 }
798 874 $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename));
799 875 $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename));
... ... @@ -1223,7 +1299,6 @@ function carregaCacheImagem($cachedir,$map,$tms){
1223 1299 $nome = $cachedir.$tms;
1224 1300 }
1225 1301 $nome = str_replace(".png","",$nome).".png";
1226   - //TODO verificar esses cabecalhos e comparar com geoserver
1227 1302 if(file_exists($nome)){
1228 1303 ob_clean();
1229 1304 //header('Content-Length: '.filesize($nome));
... ...