From 2711d9d8d230464c98bb0bfd3c096bc69f6367c1 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Fri, 1 Jul 2011 21:44:00 +0000 Subject: [PATCH] Camadas do tipo WMS agora podem ter o SLD gerado automaticamente com base nas classes definidas (desde que se use CLASSITEM). Dessa forma, a geração do SLD para definir a legenda poderá ser feito de forma mais simples --- admin/admin.db | Bin 71680 -> 0 bytes admin/js/editormapfile.js | 14 ++++++++++++++ admin/php/editormapfile.php | 39 ++++++++++++++++++++++++++------------- classesphp/classe_mapa.php | 24 ++++++++++++++++++++++-- classesphp/mapa_controle.php | 2 ++ ferramentas/legenda/index.js.php | 2 +- ms_criamapa.php | 19 +++++++++++++++++++ temas/biomashpwms.map | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ testamapfile.php | 14 ++++++++++++++ 9 files changed, 183 insertions(+), 16 deletions(-) create mode 100644 temas/biomashpwms.map diff --git a/admin/admin.db b/admin/admin.db index 794bcae..076f268 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/admin/js/editormapfile.js b/admin/js/editormapfile.js index 7946580..d6fbc7b 100644 --- a/admin/js/editormapfile.js +++ b/admin/js/editormapfile.js @@ -126,6 +126,11 @@ objalignment = [ {texto:"MS_ALIGN_CENTER",valor:"1"}, {texto:"MS_ALIGN_RIGHT",valor:"2"} ]; +objtipooriginal = [ + {texto:"poligonal",valor:"poligonal"}, + {texto:"linear",valor:"linear"}, + {texto:"pontual",valor:"pontual"} +]; YAHOO.namespace("example.container"); /* @@ -1206,6 +1211,8 @@ function montaEditorMetadados(dados) }; var paramOWS = { "linhas":[ + {ajuda:"Tipo de representação das feições mostradas da camada. É importante definir esse parâmetro para que as funções de geração de SLD funcionem corretamente.", + titulo:"Tipo de representação (tipooriginal)",id:"",value:dados.tipooriginal,tipo:"text",div:"
"}, {ajuda:"space-delimited list of EPSG projection codes supported by the remote server. You normally get this from the server’s capabilities output. This value should be upper case (EPSG:4236.....not epsg:4236) to avoid problems with case sensitive platforms. The value is used to set the SRS WMS URL parameter", titulo:"wms_srs",id:"wms_srs",value:dados.wms_srs,tipo:"text"}, {ajuda:"comma-separated list of layers to be fetched from the remote WMS server. This value is used to set the LAYERS and QUERY_LAYERS WMS URL parameters.", @@ -1292,6 +1299,13 @@ function montaEditorMetadados(dados) temp += "" $i("cPermitecomentario").innerHTML = temp } + if($i("cTipooriginal")){ + temp = "" + $i("cTipooriginal").innerHTML = temp + } + if($i("cDownload")){ temp = "

'+ '

Aplica um arquivo SLD à camada ativa' + '

'+ diff --git a/ms_criamapa.php b/ms_criamapa.php index db7431e..68628c9 100644 --- a/ms_criamapa.php +++ b/ms_criamapa.php @@ -415,6 +415,7 @@ if(isset($linhas)) if(isset($poligonos)) {inserePoligonosUrl();} + if(isset($url_wms)) {incluiTemaWms();} @@ -586,6 +587,7 @@ function incluiTemasIniciais() $maptemp = @ms_newMapObj($arqtemp); for($i=0;$i<($maptemp->numlayers);++$i) { + //error_reporting(E_ALL); $layern = $maptemp->getLayer($i); if($layern->type == MS_LAYER_RASTER) {$existeraster = true;} @@ -597,6 +599,23 @@ function incluiTemasIniciais() //necessário para não alterar a extensão do mapa por esse parâmetro // $layern->setmetadata("aplicaextensao",""); + //cria e aplica sld se for wms e existirem classes + if($layern->classitem != "" && $layern->connectiontype == 7 && $layern->numclasses > 0 && $layern->getmetadata("wms_sld_body") == ""){ + $tipotemp = $layern->type; + $statustemp = $layern->status; + $tiporep = $layern->getmetadata("tipooriginal"); + $layern->set("type",MS_LAYER_POLYGON); + if ($tiporep == "linear") + {$layern->set("type",MS_LAYER_LINE);} + if ($tiporep == "pontual") + {$layern->set("type",MS_LAYER_POINT);} + $layern->set("status",MS_DEFAULT); + $sld = $layern->generateSLD(); + if($sld != "") + $layern->setmetadata("wms_sld_body",str_replace('"',"'",$sld)); + $layern->set("type",$tipotemp); + $layern->set("status",statustemp); + } ms_newLayerObj(&$mapn, $layern); } } diff --git a/temas/biomashpwms.map b/temas/biomashpwms.map new file mode 100644 index 0000000..65a7d73 --- /dev/null +++ b/temas/biomashpwms.map @@ -0,0 +1,85 @@ +MAP + FONTSET "c:\ms4w\apache\htdocs\i3geo/symbols/fontes.txt" + SYMBOLSET "c:\ms4w\apache\htdocs\i3geo/symbols/simbolos.sym" + LAYER + CLASSITEM "ID" + CONNECTION "http://localhost/i3geo/ogc.php?tema=biomashp" + CONNECTIONTYPE WMS + METADATA + "tipooriginal" "" + "wms_srs" "EPSG:4291" + "wms_exceptions_format" "application/vnd.ogc.se_xml" + "cache" "" + "ltempoitemimagem" "" + "ltempoitemdescricao" "" + "CLASSE" "SIM" + "ltempoiteminicio" "" + "palletestep" "" + "wfs" "nao" + "ltempoitemtip" "" + "permitekmz" "nao" + "temporizador" "" + "ltempoitemtitulo" "" + "description_template" "" + "iconetema" "" + "ltempoitemlink" "" + "TEXTO" "NAO" + "wms_force_separate_request" "1" + "wms_transparent" "" + "wms_name" "biomashp" + "formatosinfo" "text/plain,application/vnd.ogc.gml" + "legendawms" "http://localhost/i3geo/ogc.php?tema=biomashp&service=wms&request=getlegendgraphic&version=1.1.0&service=wms&layer=biomashp&format=image/png" + "palletefile" "" + "ltempoformatodata" "" + "permitedownload" "nao" + "ltempoitemicone" "" + "permitecomentario" "" + "wms_time" "" + "wms_formatlist" "image/png,image/gif,image/png; mode=24bit,image/jpeg,image/vnd.wap.wbmp,image/tiff,image/svg xml" + "wms_format" "image/png" + "wms_sld_body" "" + "itembuscarapida" "" + "wms_connectiontimeout" "30" + "arquivodownload" "" + "arquivokmz" "" + "permiteogc" "nao" + "permitekml" "nao" + "TEMA" "Biomas WMS SLD" + "wms_server_version" "1.1.0" + "editorsql" "" + "ltempoitemfim" "" + "legendaimg" "" + "wms_crs" "EPSG:4291" + "wms_style" "default" + END + NAME "biomashpwms" + OFFSITE 255 255 255 + STATUS OFF + TEMPLATE "none.htm" + OPACITY 50 + TYPE RASTER + UNITS METERS + CLASS + NAME "CAATINGA" + EXPRESSION "2.00" + STYLE + ANGLE 360 + COLOR 138 0 0 + SYMBOL 0 + WIDTH 1 + END + END + CLASS + NAME "AMAZONIA" + EXPRESSION "1.00" + STYLE + ANGLE 360 + COLOR 0 255 0 + SYMBOL 0 + WIDTH 1 + END + END + END + +END + diff --git a/testamapfile.php b/testamapfile.php index 119a2b2..5346b21 100644 --- a/testamapfile.php +++ b/testamapfile.php @@ -196,6 +196,20 @@ function verifica($map,$solegenda) } autoClasses(&$layern,$nmapa); + if($layern->classitem != "" && $layern->connectiontype == 7 && $layern->numclasses > 0 && $layern->getmetadata("wms_sld_body") == ""){ + $tipotemp = $layern->type; + $tiporep = $layern->getmetadata("tipooriginal"); + $layern->set("type",MS_LAYER_POLYGON); + if ($tiporep == "linear") + {$layern->set("type",MS_LAYER_LINE);} + if ($tiporep == "pontual") + {$layern->set("type",MS_LAYER_POINT);} + $sld = $layern->generateSLD(); + if($sld != "") + $layern->setmetadata("wms_sld_body",str_replace('"',"'",$sld)); + $layern->set("type",$tipotemp); + } + ms_newLayerObj($mapa, $layern); if ($layern->data == "") $dados = $layern->connection; -- libgit2 0.21.2