From 057adc9170be2263f9e25ba401c7e2c9510a3169 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 21 Sep 2017 14:37:28 -0300 Subject: [PATCH] Modificação do mashup openlayers para passar a utilizar a interface padrão dos mapas --- mashups/openlayers.php | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- ogc.php | 2 +- 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/mashups/openlayers.php b/mashups/openlayers.php index 56d158d..56bb30e 100755 --- a/mashups/openlayers.php +++ b/mashups/openlayers.php @@ -11,6 +11,10 @@ include_once (dirname(__FILE__) . "/../classesphp/funcoes_gerais.php"); // error_reporting(0); // variaveis utilizadas $parurl = array_merge($_GET, $_POST); +if(count($parurl) == 0){ + ajuda(); + exit; +} if (isset($parurl["opacidade"])) { $opacidade = $parurl["opacidade"] * 1; } else { @@ -36,6 +40,18 @@ if(!isset($parurl["visiveis"])){ } $visiveis = explode(",", str_replace(" ", ",", $parurl["visiveis"])); $off = array_diff($temas, $visiveis); +//filtros +$filtros = array(); +foreach($temas as $tema){ + if(isset($parurl["map_layer_".$tema."_filter"])){ + $filtros[] = array( + "layer"=>$tema, + "expression"=>$parurl["map_layer_".$tema."_filter"] + ); + } +} +$filtros = json_encode($filtros); + $estilo = ""; if (isset($parurl["altura"])) { $estilo .= ";height:" . $parurl["altura"] . "px"; @@ -69,6 +85,11 @@ if (isset($controles)) { if (in_array("overviewmap", $controles)) { $objControles[] = "new ol.control.OverviewMap()"; } +} else { + $objControles[] = "new ol.control.Zoom()"; + $objControles[] = "new ol.control.ZoomSlider()"; + $objControles[] = "new ol.control.ScaleLine()"; + $objControles[] = "new ol.control.MousePosition({coordinateFormat : function(c){return ol.coordinate.toStringHDMS(c);}})"; } $botoes = $parurl["botoes"]; // @@ -214,7 +235,36 @@ if (isset($botoes)) { } $botoes = "{" . implode(",", $objBotoes) . "}"; } else { - $botoes = "{}"; + $objBotoes[] = "'imprimir':true"; + $objBotoesHtml["zoombox"] = ""; + $objBotoesHtml["analise"] = ""; + $objBotoesHtml["camadas"] = ""; + $objBotoesHtml["catalogo"] = ""; + $objBotoesHtml["legenda"] = ""; + $objBotoesHtml["procura"] = ""; + $objBotoesHtml["identifica"] = ""; + $objBotoesHtml["zoomtot"] = ""; + $objBotoesHtml["zoomanterior"] = ""; + $objBotoesHtml["zoomproximo"] = ""; + $objBotoesHtml["grid"] = ""; + $objBotoesHtml["marcador"] = ""; + $objBotoes[] = "'distancia':true"; + $objBotoes[] = "'area':true"; + $objBotoes[] = "'linha':true"; + $objBotoes[] = "'ponto':true"; + $objBotoes[] = "'poligono':true"; + $objBotoes[] = "'edita':true"; + $objBotoes[] = "'listag':true"; + $objBotoes[] = "'corta':true"; + $objBotoes[] = "'apaga':true"; + $objBotoes[] = "'salva':true"; + $objBotoes[] = "'tools':true"; + $objBotoes[] = "'undo':true"; + $objBotoes[] = "'propriedades':true"; + $objBotoes[] = "'frente':true"; + + $botoes = "{" . implode(",", $objBotoes) . "}"; + } if (isset($parurl["kml"])) { $kml = $parurl["kml"]; @@ -255,11 +305,11 @@ if(isset($parurl["tiles"])){ else{ $tiles = "true"; } -if(isset($parurl["ativarodadomouse"]) && $parurl["ativarodadomouse"] == "true"){ - $ativarodadomouse = "new ol.interaction.MouseWheelZoom(),"; +if(isset($parurl["ativarodadomouse"]) && $parurl["ativarodadomouse"] == "false"){ + $ativarodadomouse = ""; } else{ - $ativarodadomouse = ""; + $ativarodadomouse = "new ol.interaction.MouseWheelZoom(),"; } $legendahtml = $parurl["legendahtml"]; $layerDefault = $parurl["layerDefault"]; @@ -435,6 +485,13 @@ function ajuda() width: auto; max-width: 70px; } + +.ol-mouse-position { + left: 10px; + position: absolute; + bottom: 5px; + top: auto; +}