From bc360fd6a518938ef7360e6e2a684b5d33f2a850 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 29 Oct 2015 00:54:13 +0000 Subject: [PATCH] Adaptações para versão 7 do Mapserver --- aplicmap/geral1debianv7.map | 1 + classesphp/proxy.php | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- ferramentas/editorol/editorol.js | 120 +++++++++++++++++++++--------------------------------------------------------------------------------------------------- temas/_ltestegml.map | 3 ++- 4 files changed, 78 insertions(+), 105 deletions(-) diff --git a/aplicmap/geral1debianv7.map b/aplicmap/geral1debianv7.map index f6afa32..555012e 100755 --- a/aplicmap/geral1debianv7.map +++ b/aplicmap/geral1debianv7.map @@ -36,6 +36,7 @@ MAP UNITS DD NAME "GERAL" DEBUG OFF + #CONFIG "CPL_DEBUG" "ON" #CONFIG "MS_ERRORFILE" "/tmp/ms_tmp/ms_error.txt" # #utilize o agg apenas com mapserver 5x diff --git a/classesphp/proxy.php b/classesphp/proxy.php index ae06979..55745f3 100644 --- a/classesphp/proxy.php +++ b/classesphp/proxy.php @@ -1,4 +1,16 @@ setConnectionType(MS_OGR); + $layer->set("connection",$nomegml); + $layer->set("template","none.html"); + $layer->set("type",MS_LAYER_POLYGON); + $layer->set("name",$nome); + $layer->set("status",MS_DEFAULT); + $layer->setmetadata("tema",$nome); + $classe = ms_newClassObj($layer); + $novoestilo = ms_newStyleObj($classe); + $ncor = $novoestilo->color; + $ncor->setrgb(255,255,255); + //$map->save($nomemap); + //exit; + $layer->queryByrect($map->extent); + $sopen = $layer->open(); + $shape = $layer->getShape($layer->getResult(0)); + $wkt = $shape->towkt(); + return json_encode(array($wkt)); +} + ?> \ No newline at end of file diff --git a/ferramentas/editorol/editorol.js b/ferramentas/editorol/editorol.js index 09cd4b7..a2c61eb 100755 --- a/ferramentas/editorol/editorol.js +++ b/ferramentas/editorol/editorol.js @@ -664,7 +664,6 @@ i3GEO.editorOL = i3GEO.editorOL.mapa.zoomToExtent(b); }, mostraLegenda : function() { - //TODO testar no mashup var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, ins = "", i, icone = "", url, fers, f = "", fer = ""; for (i = 0; i < nlayers; i++) { try { @@ -790,26 +789,31 @@ i3GEO.editorOL = "&filter=Geometry" + poligono + ""; retorno = function(r){ - //FIXME nao funciona - //parser gml - var f,c,format; - /* - format = new ol.format.GML2({ - featurePrefix: "ms", - geometryName : "msGeometry", - featureNS : "http://mapserver.gis.umn.edu/mapserver" - }); - */ - //console.info(r[0]) - format = new ol.format.GML2(); - f = format.readFeatures(r[0]); - //console.info(f); + var fs,c,format, f, n, i; + format = new ol.format.WKT(); + fs = format.readFeatures(r[0]); + n = fs.length; c = i3GEO.desenho.layergrafico.getSource(); - c.addFeature(f); + for(i=0; iedita geometria
"; - } - formata = function(texto) { - var temp, temp1, n, i, f = [], textoN = texto.split(":"); - try { - if (textoN.length > 1) { - temp = textoN[2].replace(/\n\r/g, ""); - temp = temp.replace(/'/g, ""); - temp = temp.replace(/\n/g, "|"); - temp = temp.replace(/_/g, " "); - temp = temp.replace(/=/g, ":"); - temp = temp.split("|"); - n = temp.length; - for (i = 0; i < n; i++) { - temp1 = temp[i].replace(/^\s+/, ""); - temp1 = temp1.replace(/\s+$/, ""); - if (temp1 != "") - f.push(temp1); - } - texto = f.join("

"); - } - } catch (e) { - } - return texto; - }; - i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken", i3GEO.editorOL.mapa - .getLonLatFromPixel(event.xy), null, "
" + lonlattexto - + "
"
-										+ formata(event.text)
-										+ "
", null, true)); - i3GEO.editorOL.removeClone(); - }, - beforegetfeatureinfo : function(event) { - var ativo = [ - i3GEO.editorOL.layerAtivo() - ]; - // se for TMS tem de pegar o clone wms - if (ativo[0].serviceVersion === "&tms=" || ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS" - || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM") { - ativo = [ - i3GEO.editorOL.layertms2wms(ativo[0]) - ]; - } - ativo[0].projection = new OpenLayers.Projection("EPSG:4326"); - event.object.layers = ativo; - botaoIdentifica.layers = ativo; - botaoIdentifica.url = ativo[0].url; - }, - activate : function() { - i3GEO.editorOL.criaJanelaAtivaTema(); - } - } - }); - // button.events.register("getfeatureinfo", this, showInfo); - controles.push(botaoIdentifica); - adiciona = true; - - } - */ }, removeFeaturesSel : function(){ diff --git a/temas/_ltestegml.map b/temas/_ltestegml.map index f3925f0..e860199 100644 --- a/temas/_ltestegml.map +++ b/temas/_ltestegml.map @@ -3,10 +3,11 @@ MAP SYMBOLSET "../symbols/simbolos.sym" LAYER CONNECTION "/var/www/i3geo/aplicmap/dados/ucsfi.gml" + #CONNECTION "/tmp/ms_tmp/gml_UGJUDdOMyt.gml" CONNECTIONTYPE OGR METADATA "METAESTAT_ID_MEDIDA_VARIAVEL" "" - "cache" "sim" + "cache" "nao" "CLASSE" "SIM" "permitekmz" "nao" "METAESTAT_CODIGO_TIPO_REGIAO" "" -- libgit2 0.21.2