Commit 057adc9170be2263f9e25ba401c7e2c9510a3169

Authored by Edmar Moretti
1 parent 1bd4b2ac

Modificação do mashup openlayers para passar a utilizar a interface padrão dos mapas

Showing 2 changed files with 64 additions and 9 deletions   Show diff stats
mashups/openlayers.php
... ... @@ -11,6 +11,10 @@ include_once (dirname(__FILE__) . "/../classesphp/funcoes_gerais.php");
11 11 // error_reporting(0);
12 12 // variaveis utilizadas
13 13 $parurl = array_merge($_GET, $_POST);
  14 +if(count($parurl) == 0){
  15 + ajuda();
  16 + exit;
  17 +}
14 18 if (isset($parurl["opacidade"])) {
15 19 $opacidade = $parurl["opacidade"] * 1;
16 20 } else {
... ... @@ -36,6 +40,18 @@ if(!isset($parurl["visiveis"])){
36 40 }
37 41 $visiveis = explode(",", str_replace(" ", ",", $parurl["visiveis"]));
38 42 $off = array_diff($temas, $visiveis);
  43 +//filtros
  44 +$filtros = array();
  45 +foreach($temas as $tema){
  46 + if(isset($parurl["map_layer_".$tema."_filter"])){
  47 + $filtros[] = array(
  48 + "layer"=>$tema,
  49 + "expression"=>$parurl["map_layer_".$tema."_filter"]
  50 + );
  51 + }
  52 +}
  53 +$filtros = json_encode($filtros);
  54 +
39 55 $estilo = "";
40 56 if (isset($parurl["altura"])) {
41 57 $estilo .= ";height:" . $parurl["altura"] . "px";
... ... @@ -69,6 +85,11 @@ if (isset($controles)) {
69 85 if (in_array("overviewmap", $controles)) {
70 86 $objControles[] = "new ol.control.OverviewMap()";
71 87 }
  88 +} else {
  89 + $objControles[] = "new ol.control.Zoom()";
  90 + $objControles[] = "new ol.control.ZoomSlider()";
  91 + $objControles[] = "new ol.control.ScaleLine()";
  92 + $objControles[] = "new ol.control.MousePosition({coordinateFormat : function(c){return ol.coordinate.toStringHDMS(c);}})";
72 93 }
73 94 $botoes = $parurl["botoes"];
74 95 //
... ... @@ -214,7 +235,36 @@ if (isset($botoes)) {
214 235 }
215 236 $botoes = "{" . implode(",", $objBotoes) . "}";
216 237 } else {
217   - $botoes = "{}";
  238 + $objBotoes[] = "'imprimir':true";
  239 + $objBotoesHtml["zoombox"] = "";
  240 + $objBotoesHtml["analise"] = "";
  241 + $objBotoesHtml["camadas"] = "";
  242 + $objBotoesHtml["catalogo"] = "";
  243 + $objBotoesHtml["legenda"] = "";
  244 + $objBotoesHtml["procura"] = "";
  245 + $objBotoesHtml["identifica"] = "";
  246 + $objBotoesHtml["zoomtot"] = "";
  247 + $objBotoesHtml["zoomanterior"] = "";
  248 + $objBotoesHtml["zoomproximo"] = "";
  249 + $objBotoesHtml["grid"] = "";
  250 + $objBotoesHtml["marcador"] = "";
  251 + $objBotoes[] = "'distancia':true";
  252 + $objBotoes[] = "'area':true";
  253 + $objBotoes[] = "'linha':true";
  254 + $objBotoes[] = "'ponto':true";
  255 + $objBotoes[] = "'poligono':true";
  256 + $objBotoes[] = "'edita':true";
  257 + $objBotoes[] = "'listag':true";
  258 + $objBotoes[] = "'corta':true";
  259 + $objBotoes[] = "'apaga':true";
  260 + $objBotoes[] = "'salva':true";
  261 + $objBotoes[] = "'tools':true";
  262 + $objBotoes[] = "'undo':true";
  263 + $objBotoes[] = "'propriedades':true";
  264 + $objBotoes[] = "'frente':true";
  265 +
  266 + $botoes = "{" . implode(",", $objBotoes) . "}";
  267 +
218 268 }
219 269 if (isset($parurl["kml"])) {
220 270 $kml = $parurl["kml"];
... ... @@ -255,11 +305,11 @@ if(isset($parurl["tiles"])){
255 305 else{
256 306 $tiles = "true";
257 307 }
258   -if(isset($parurl["ativarodadomouse"]) && $parurl["ativarodadomouse"] == "true"){
259   - $ativarodadomouse = "new ol.interaction.MouseWheelZoom(),";
  308 +if(isset($parurl["ativarodadomouse"]) && $parurl["ativarodadomouse"] == "false"){
  309 + $ativarodadomouse = "";
260 310 }
261 311 else{
262   - $ativarodadomouse = "";
  312 + $ativarodadomouse = "new ol.interaction.MouseWheelZoom(),";
263 313 }
264 314 $legendahtml = $parurl["legendahtml"];
265 315 $layerDefault = $parurl["layerDefault"];
... ... @@ -435,6 +485,13 @@ function ajuda()
435 485 width: auto;
436 486 max-width: 70px;
437 487 }
  488 +
  489 +.ol-mouse-position {
  490 + left: 10px;
  491 + position: absolute;
  492 + bottom: 5px;
  493 + top: auto;
  494 +}
438 495 </style>
439 496 </head>
440 497 <!-- As palavras entre {{{}}} sao utilizadas para a traducao. Veja i3geo/js/dicionario.js
... ... @@ -1034,10 +1091,7 @@ function ajuda()
1034 1091 //filtros que serao aplicados aos layers. Utilize a expressaso conforme definido na documentacao
1035 1092 //do mapserver, exemplo
1036 1093 //{layer: "_lbiomashp",expression: "(('[CD_LEGENDA]'='CAATINGA'))"} ou {layer: "_lbiomashp",expression: "cd_legenda='CAATINGA'"}
1037   - filters: [{
1038   - layer: "",
1039   - expression: ""
1040   - }],
  1094 + filters: <?php echo $filtros;?>,
1041 1095 //id de um mapa salvo e que sera recuperado
1042 1096 restoreMapId : <?php echo $restauramapa;?>,
1043 1097 cacheOff : '<?php echo $DESLIGACACHE;?>'
... ... @@ -1068,6 +1122,7 @@ function ajuda()
1068 1122 //$('.iconeGuiaMovel').tooltip('show');
1069 1123 $("#i3GEOguiaMovelConteudo").mCustomScrollbar({scrollbarPosition: "outside",theme:"inset-2-dark"});
1070 1124 adicionaBotoesEditor();
  1125 + $i("openlayers").style.backgroundColor = "rgb(255,255,255)";
1071 1126 },
1072 1127 //parametros de configuracao de diferentes componentes do mapa, como o catalogo de temas, balao de info, etc
1073 1128 components : {
... ...
ogc.php
... ... @@ -488,7 +488,7 @@ if(!empty($_GET[&quot;restauramapa&quot;])){
488 488 //para operar como o Geoserver, abre o openlayers
489 489 //
490 490 if(isset($format) && strtolower($format) == "application/openlayers"){
491   - $urln = dirname($_SERVER["PHP_SELF"])."/mashups/openlayers.php?layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica,legenda";
  491 + $urln = dirname($_SERVER["PHP_SELF"])."/mashups/openlayers.php?layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica,legenda&ativarodadomouse=true";
492 492 //caso exista o openlayers3
493 493 //if(file_exists(dirname(__FILE__)."/mashups/openlayers3.php")){
494 494 // $urln = dirname($_SERVER["PHP_SELF"])."/mashups/openlayers3.php?layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica,legenda";
... ...