diff --git a/admin/admin.db b/admin/admin.db index f7ede3e..a7ad40a 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/classesphp/mapa_openlayers.php b/classesphp/mapa_openlayers.php index 12c5f6c..446674e 100644 --- a/classesphp/mapa_openlayers.php +++ b/classesphp/mapa_openlayers.php @@ -147,7 +147,7 @@ if(!empty($_GET["request"])){ $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php"; $qy = file_exists($qyfile); -if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){ +if($_GET["REQUEST"] == "getlegendgraphic" || $_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){ $_GET["DESLIGACACHE"] = "sim"; } else{ @@ -228,6 +228,15 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter } } } + if($_GET["REQUEST"] == "getlegendgraphic"){ + $nclass = $l->numclasses; + for($ic=0;$ic<$nclass;$ic++){ + $classe = $l->getclass($ic); + if($classe->title === ""){ + $classe->title = $classe->name; + } + } + } if($layerName == $_GET["layer"]){ if(strtolower($l->getmetadata("cache")) == "sim"){ $cache = true; @@ -251,7 +260,6 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter } } } - if (!function_exists('imagepng')){ $_GET["TIPOIMAGEM"] = ""; } @@ -259,7 +267,6 @@ if (!function_exists('imagepng')){ if($_GET["layer"] == ""){ $cache = true; } - if(($_GET == false) || ($qy) || (strtolower($_GET["DESLIGACACHE"]) == "sim")){ $cache = false; } @@ -282,7 +289,7 @@ if(isset($_GET["mapext"])){ // //qd a cahamda e para um WMS, redireciona para ogc.php // -if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ +if($_GET["REQUEST"] == "getlegendgraphic" || $_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ $req = ms_newowsrequestobj(); if($_GET["BBOX"]){ $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]); diff --git a/ferramentas/editorol/editorol.js b/ferramentas/editorol/editorol.js index a8075ab..4abe872 100755 --- a/ferramentas/editorol/editorol.js +++ b/ferramentas/editorol/editorol.js @@ -152,11 +152,6 @@ i3GEO.editorOL = var alayers = [], fundo = (i3GEO.editorOL.fundo).split(","), nfundo = fundo.length, ncontroles = i3GEO.editorOL.controles.length, i, n, temp; - // TODO layerswitcher no OL3 - /* - * if (i3GEO.editorOL.ativalayerswitcher === "false") { i3GEO.editorOL.ativalayerswitcher = false; } if - * (i3GEO.editorOL.ativalayerswitcher === "true") { i3GEO.editorOL.ativalayerswitcher = true; } - */ if (i3GEO.editorOL.ativarodadomouse === "false") { i3GEO.editorOL.ativarodadomouse = false; } @@ -577,59 +572,68 @@ i3GEO.editorOL = i3GEO.editorOL.mapa.zoomToExtent(b); }, mostraLegenda : function() { - var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, ins = "", i, icone = "", url, fers, f = "", fer = ""; + var prop, layer, layers = i3GEO.editorOL.mapa.getLayers(), nlayers = layers.getLength(), ins = "", i, icone = "", url, f = ""; for (i = 0; i < nlayers; i++) { - try { - if (layers[i].get("isBaseLayer") === false) { - url = layers[i].getFullRequestString({ - "request" : "getlegendgraphic" - }); - //i3GEO.editorOL.mapa.getLayers().item(0).getSource().getUrls()[0] - icone = ""; - if (i3GEO.editorOL.legendahtml === true) { - // os parametros FORMAT e SERVICE sao inseridos de forma redundante para grantir - // caso seja um TMS - url = url.replace("image%2Fpng", "text/html") + "&FORMAT=text/html&SERVICE=WMS"; - // verifica se a camada veio de um plugin de classe_plugini3geo - // e insere o icone se for necessario - if (layers[i].options.plugini3geo) { - if (layers[i].params.LAYERS) { - // wms - icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].params.LAYERS); - } else { - // tms - icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].layers); - } + layer = layers.item(i); + prop = layer.getProperties(); + //monta a url para fazer a requisicao da legenda + //para os temas que nao sao baselayers + if(prop.source.getUrls){ + url = prop.source.getUrls()[0]; + url = url.replace("&cache=sim", "&DESLIGACACHE=sim"); + url = url.replace("&Z=${z}&X=${x}&Y=${y}", ""); + url = url.replace("Z=${z}&X=${x}&Y=${y}", ""); + url += "&REQUEST=getlegendgraphic&service=wms&version=1.0.0"; + if (i3GEO.Interface.openlayers.googleLike === true) { + url += "&SRS=EPSG:3857"; + } + icone = ""; + //TODO criar a legenda para uso no mashup + //caso do mashup + if (i3GEO.editorOL.legendahtml === true) { + // os parametros FORMAT e SERVICE sao inseridos de forma redundante para grantir + // caso seja um TMS + url = url.replace("image%2Fpng", "text/html") + "&FORMAT=text/html&SERVICE=WMS"; + // verifica se a camada veio de um plugin de classe_plugini3geo + // e insere o icone se for necessario + /* + if (layers[i].options.plugini3geo) { + if (layers[i].params.LAYERS) { + // wms + icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].params.LAYERS); + } else { + // tms + icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].layers); } - // - // verifica se a camada tem ferramentas parametrizadas - // insere o icone - // - fers = layers[i].options.ferramentas; - for (fer in fers) { - if (i3GEO.configura.ferramentasLayers[fer]) { - icone = i3GEO.configura.ferramentasLayers[fer].icone(layers[i]); - } + } + // + // verifica se a camada tem ferramentas parametrizadas + // insere o icone + // + fers = layers[i].options.ferramentas; + for (fer in fers) { + if (i3GEO.configura.ferramentasLayers[fer]) { + icone = i3GEO.configura.ferramentasLayers[fer].icone(layers[i]); } - ins += icone + layers[i].name + "

"; - // necessario pq nao e sincrono - eval("var f = function(retorno){document.getElementById('legendaL_" + i - + "').innerHTML = retorno.responseText;};"); - url = url.replace("LAYERS", "LAYER"); - var config = { - method : "GET", - url : url, - callback : f - }; - OpenLayers.Request.issue(config); - } else { - url = url.replace("LAYERS", "LAYER"); - url = url.replace("&Z=${z}&X=${x}&Y=${y}", ""); - url = url.replace("Z=${z}&X=${x}&Y=${y}", ""); - ins += layers[i].name + "

"; } + */ + ins += icone + prop.name + "

"; + // necessario pq nao e sincrono + eval("var f = function(retorno){document.getElementById('legendaL_" + i + + "').innerHTML = retorno.responseText;};"); + url = url.replace("LAYERS", "LAYER"); + var config = { + method : "GET", + url : url, + callback : f + }; + OpenLayers.Request.issue(config); + } else if (prop.isBaseLayer === false && prop.visible === true) { + //caso a legenda seja aberta dentro do i3Geo + url = url.replace("LAYERS", "LAYER"); + url += "&FORMAT=image/png"; + ins += prop.title + "

"; } - } catch (e) { } } if (!document.getElementById("panellegendaeditorOL")) { -- libgit2 0.21.2