Commit c473211a4a3ad84a2afb9c9ebdb017c1e0f02c51
1 parent
01688964
Exists in
master
and in
7 other branches
--no commit message
Showing
3 changed files
with
68 additions
and
57 deletions
Show diff stats
admin/admin.db
No preview for this file type
classesphp/mapa_openlayers.php
| ... | ... | @@ -147,7 +147,7 @@ if(!empty($_GET["request"])){ |
| 147 | 147 | $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php"; |
| 148 | 148 | $qy = file_exists($qyfile); |
| 149 | 149 | |
| 150 | -if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){ | |
| 150 | +if($_GET["REQUEST"] == "getlegendgraphic" || $_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){ | |
| 151 | 151 | $_GET["DESLIGACACHE"] = "sim"; |
| 152 | 152 | } |
| 153 | 153 | else{ |
| ... | ... | @@ -228,6 +228,15 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | + if($_GET["REQUEST"] == "getlegendgraphic"){ | |
| 232 | + $nclass = $l->numclasses; | |
| 233 | + for($ic=0;$ic<$nclass;$ic++){ | |
| 234 | + $classe = $l->getclass($ic); | |
| 235 | + if($classe->title === ""){ | |
| 236 | + $classe->title = $classe->name; | |
| 237 | + } | |
| 238 | + } | |
| 239 | + } | |
| 231 | 240 | if($layerName == $_GET["layer"]){ |
| 232 | 241 | if(strtolower($l->getmetadata("cache")) == "sim"){ |
| 233 | 242 | $cache = true; |
| ... | ... | @@ -251,7 +260,6 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter |
| 251 | 260 | } |
| 252 | 261 | } |
| 253 | 262 | } |
| 254 | - | |
| 255 | 263 | if (!function_exists('imagepng')){ |
| 256 | 264 | $_GET["TIPOIMAGEM"] = ""; |
| 257 | 265 | } |
| ... | ... | @@ -259,7 +267,6 @@ if (!function_exists('imagepng')){ |
| 259 | 267 | if($_GET["layer"] == ""){ |
| 260 | 268 | $cache = true; |
| 261 | 269 | } |
| 262 | - | |
| 263 | 270 | if(($_GET == false) || ($qy) || (strtolower($_GET["DESLIGACACHE"]) == "sim")){ |
| 264 | 271 | $cache = false; |
| 265 | 272 | } |
| ... | ... | @@ -282,7 +289,7 @@ if(isset($_GET["mapext"])){ |
| 282 | 289 | // |
| 283 | 290 | //qd a cahamda e para um WMS, redireciona para ogc.php |
| 284 | 291 | // |
| 285 | -if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ | |
| 292 | +if($_GET["REQUEST"] == "getlegendgraphic" || $_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ | |
| 286 | 293 | $req = ms_newowsrequestobj(); |
| 287 | 294 | if($_GET["BBOX"]){ |
| 288 | 295 | $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]); | ... | ... |
ferramentas/editorol/editorol.js
| ... | ... | @@ -152,11 +152,6 @@ i3GEO.editorOL = |
| 152 | 152 | var alayers = [], fundo = (i3GEO.editorOL.fundo).split(","), nfundo = fundo.length, ncontroles = |
| 153 | 153 | i3GEO.editorOL.controles.length, i, n, temp; |
| 154 | 154 | |
| 155 | - // TODO layerswitcher no OL3 | |
| 156 | - /* | |
| 157 | - * if (i3GEO.editorOL.ativalayerswitcher === "false") { i3GEO.editorOL.ativalayerswitcher = false; } if | |
| 158 | - * (i3GEO.editorOL.ativalayerswitcher === "true") { i3GEO.editorOL.ativalayerswitcher = true; } | |
| 159 | - */ | |
| 160 | 155 | if (i3GEO.editorOL.ativarodadomouse === "false") { |
| 161 | 156 | i3GEO.editorOL.ativarodadomouse = false; |
| 162 | 157 | } |
| ... | ... | @@ -577,59 +572,68 @@ i3GEO.editorOL = |
| 577 | 572 | i3GEO.editorOL.mapa.zoomToExtent(b); |
| 578 | 573 | }, |
| 579 | 574 | mostraLegenda : function() { |
| 580 | - var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, ins = "", i, icone = "", url, fers, f = "", fer = ""; | |
| 575 | + var prop, layer, layers = i3GEO.editorOL.mapa.getLayers(), nlayers = layers.getLength(), ins = "", i, icone = "", url, f = ""; | |
| 581 | 576 | for (i = 0; i < nlayers; i++) { |
| 582 | - try { | |
| 583 | - if (layers[i].get("isBaseLayer") === false) { | |
| 584 | - url = layers[i].getFullRequestString({ | |
| 585 | - "request" : "getlegendgraphic" | |
| 586 | - }); | |
| 587 | - //i3GEO.editorOL.mapa.getLayers().item(0).getSource().getUrls()[0] | |
| 588 | - icone = ""; | |
| 589 | - if (i3GEO.editorOL.legendahtml === true) { | |
| 590 | - // os parametros FORMAT e SERVICE sao inseridos de forma redundante para grantir | |
| 591 | - // caso seja um TMS | |
| 592 | - url = url.replace("image%2Fpng", "text/html") + "&FORMAT=text/html&SERVICE=WMS"; | |
| 593 | - // verifica se a camada veio de um plugin de classe_plugini3geo | |
| 594 | - // e insere o icone se for necessario | |
| 595 | - if (layers[i].options.plugini3geo) { | |
| 596 | - if (layers[i].params.LAYERS) { | |
| 597 | - // wms | |
| 598 | - icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].params.LAYERS); | |
| 599 | - } else { | |
| 600 | - // tms | |
| 601 | - icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].layers); | |
| 602 | - } | |
| 577 | + layer = layers.item(i); | |
| 578 | + prop = layer.getProperties(); | |
| 579 | + //monta a url para fazer a requisicao da legenda | |
| 580 | + //para os temas que nao sao baselayers | |
| 581 | + if(prop.source.getUrls){ | |
| 582 | + url = prop.source.getUrls()[0]; | |
| 583 | + url = url.replace("&cache=sim", "&DESLIGACACHE=sim"); | |
| 584 | + url = url.replace("&Z=${z}&X=${x}&Y=${y}", ""); | |
| 585 | + url = url.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 586 | + url += "&REQUEST=getlegendgraphic&service=wms&version=1.0.0"; | |
| 587 | + if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 588 | + url += "&SRS=EPSG:3857"; | |
| 589 | + } | |
| 590 | + icone = ""; | |
| 591 | + //TODO criar a legenda para uso no mashup | |
| 592 | + //caso do mashup | |
| 593 | + if (i3GEO.editorOL.legendahtml === true) { | |
| 594 | + // os parametros FORMAT e SERVICE sao inseridos de forma redundante para grantir | |
| 595 | + // caso seja um TMS | |
| 596 | + url = url.replace("image%2Fpng", "text/html") + "&FORMAT=text/html&SERVICE=WMS"; | |
| 597 | + // verifica se a camada veio de um plugin de classe_plugini3geo | |
| 598 | + // e insere o icone se for necessario | |
| 599 | + /* | |
| 600 | + if (layers[i].options.plugini3geo) { | |
| 601 | + if (layers[i].params.LAYERS) { | |
| 602 | + // wms | |
| 603 | + icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].params.LAYERS); | |
| 604 | + } else { | |
| 605 | + // tms | |
| 606 | + icone = i3GEO.pluginI3geo[layers[i].options.plugini3geo].iconeArvoreDeCamadas(layers[i].layers); | |
| 603 | 607 | } |
| 604 | - // | |
| 605 | - // verifica se a camada tem ferramentas parametrizadas | |
| 606 | - // insere o icone | |
| 607 | - // | |
| 608 | - fers = layers[i].options.ferramentas; | |
| 609 | - for (fer in fers) { | |
| 610 | - if (i3GEO.configura.ferramentasLayers[fer]) { | |
| 611 | - icone = i3GEO.configura.ferramentasLayers[fer].icone(layers[i]); | |
| 612 | - } | |
| 608 | + } | |
| 609 | + // | |
| 610 | + // verifica se a camada tem ferramentas parametrizadas | |
| 611 | + // insere o icone | |
| 612 | + // | |
| 613 | + fers = layers[i].options.ferramentas; | |
| 614 | + for (fer in fers) { | |
| 615 | + if (i3GEO.configura.ferramentasLayers[fer]) { | |
| 616 | + icone = i3GEO.configura.ferramentasLayers[fer].icone(layers[i]); | |
| 613 | 617 | } |
| 614 | - ins += icone + layers[i].name + "<br><div id=legendaL_" + i + " ></div><br>"; | |
| 615 | - // necessario pq nao e sincrono | |
| 616 | - eval("var f = function(retorno){document.getElementById('legendaL_" + i | |
| 617 | - + "').innerHTML = retorno.responseText;};"); | |
| 618 | - url = url.replace("LAYERS", "LAYER"); | |
| 619 | - var config = { | |
| 620 | - method : "GET", | |
| 621 | - url : url, | |
| 622 | - callback : f | |
| 623 | - }; | |
| 624 | - OpenLayers.Request.issue(config); | |
| 625 | - } else { | |
| 626 | - url = url.replace("LAYERS", "LAYER"); | |
| 627 | - url = url.replace("&Z=${z}&X=${x}&Y=${y}", ""); | |
| 628 | - url = url.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 629 | - ins += layers[i].name + "<br><img src='" + url + "&SERVICE=wms' /><br>"; | |
| 630 | 618 | } |
| 619 | + */ | |
| 620 | + ins += icone + prop.name + "<br><div id=legendaL_" + i + " ></div><br>"; | |
| 621 | + // necessario pq nao e sincrono | |
| 622 | + eval("var f = function(retorno){document.getElementById('legendaL_" + i | |
| 623 | + + "').innerHTML = retorno.responseText;};"); | |
| 624 | + url = url.replace("LAYERS", "LAYER"); | |
| 625 | + var config = { | |
| 626 | + method : "GET", | |
| 627 | + url : url, | |
| 628 | + callback : f | |
| 629 | + }; | |
| 630 | + OpenLayers.Request.issue(config); | |
| 631 | + } else if (prop.isBaseLayer === false && prop.visible === true) { | |
| 632 | + //caso a legenda seja aberta dentro do i3Geo | |
| 633 | + url = url.replace("LAYERS", "LAYER"); | |
| 634 | + url += "&FORMAT=image/png"; | |
| 635 | + ins += prop.title + "<br><img src='" + url + "' /><br>"; | |
| 631 | 636 | } |
| 632 | - } catch (e) { | |
| 633 | 637 | } |
| 634 | 638 | } |
| 635 | 639 | if (!document.getElementById("panellegendaeditorOL")) { | ... | ... |