From 5436a944de2086a8113227b3284329251e66d323 Mon Sep 17 00:00:00 2001 From: edmarmoretti Date: Sun, 13 Aug 2017 10:21:46 -0300 Subject: [PATCH] Adaptação da ferramenta que converte o mapa atual em KML para bootstrap e correção de erros --- ferramentas/convertemapakml/dependencias.php | 11 ----------- ferramentas/convertemapakml/index.js | 18 ++++++++++++------ ferramentas/convertemapakml/template_mst.html | 34 +++++++++++++++++----------------- ferramentas/convertews/index.js | 6 ------ pacotes/kmlmapserver/classes/layerserver.class.php | 48 +++++++++++++++++++----------------------------- pacotes/kmlmapserver/kmlservice.php | 10 +++++++++- 6 files changed, 57 insertions(+), 70 deletions(-) diff --git a/ferramentas/convertemapakml/dependencias.php b/ferramentas/convertemapakml/dependencias.php index 6f48d80..279d4b8 100755 --- a/ferramentas/convertemapakml/dependencias.php +++ b/ferramentas/convertemapakml/dependencias.php @@ -17,17 +17,6 @@ header("Content-type: text/javascript"); include("index.js"); include("dicionario.js"); echo "\n"; -/** - * Inclui o template mustache do HTML usado para criar o conteudo da janela - */ -echo 'i3GEOF.converteMapaKml.MUSTACHE = "'; -$texto = file_get_contents("template_mst.html"); -$texto = str_replace("\n", "", $texto); -$texto = str_replace("\r", "", $texto); -$texto = str_replace("\t", "", $texto); -$texto = str_replace('"', "'", $texto); -echo $texto; -echo '";'; if(extension_loaded('zlib')){ ob_end_flush(); } diff --git a/ferramentas/convertemapakml/index.js b/ferramentas/convertemapakml/index.js index 4eba822..a78a255 100755 --- a/ferramentas/convertemapakml/index.js +++ b/ferramentas/convertemapakml/index.js @@ -51,12 +51,8 @@ i3GEOF.converteMapaKml = { //TODO verificar funcionamento sem expor mapfile mustacheHash : function() { var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.converteMapaKml.dicionario); - //lista; - //lista = i3GEO.arvoreDeCamadas.CAMADAS; - //tema = lista[0].name; dicionario["locaplic"] = i3GEO.configura.locaplic; - dicionario["parametrosMapfile"] = i3GEO.parametros.mapfile; - dicionario["tema"] = ""; + dicionario["sid"] = i3GEO.configura.sid; return dicionario; }, @@ -74,6 +70,16 @@ i3GEOF.converteMapaKml = { var ins = Mustache.render(i3GEOF.converteMapaKml.MUSTACHE, i3GEOF.converteMapaKml.mustacheHash()); $i(divid).innerHTML += ins; }, + inicia: function(divid){ + if(i3GEOF.converteMapaKml.MUSTACHE == ""){ + $.get(i3GEO.configura.locaplic + "/ferramentas/convertemapakml/template_mst.html", function(template) { + i3GEOF.converteMapaKml.MUSTACHE = template; + i3GEOF.converteMapaKml.inicia(divid); + }); + return; + } + i3GEOF.converteMapaKml.html(divid); + }, /* Function: iniciaJanelaFlutuante @@ -110,6 +116,6 @@ i3GEOF.converteMapaKml = { "13" ); divid = janela[2].id; - i3GEOF.converteMapaKml.html(divid); + i3GEOF.converteMapaKml.inicia(divid); } }; diff --git a/ferramentas/convertemapakml/template_mst.html b/ferramentas/convertemapakml/template_mst.html index 497bb66..a846078 100755 --- a/ferramentas/convertemapakml/template_mst.html +++ b/ferramentas/convertemapakml/template_mst.html @@ -1,20 +1,20 @@ -
-

- {{{ajuda}}} como o - Google Earth - . {{{ajuda2}}} -

+

+
{{{ajuda}}}
+
{{{ajuda2}}}
+ +
Clique aqui {{{ajuda3}}} -

- {{{wms}}} -

-

- -

-

{{{ajuda4}}} -

- -

+
+
+ {{{wms}}} +
+
+ + {{{locaplic}}}/pacotes/kmlmapserver/kmlservice.php?sid={{{sid}}}&request=kml +
+
{{{ajuda4}}}
+
+ {{{locaplic}}}/kml.php +
\ No newline at end of file diff --git a/ferramentas/convertews/index.js b/ferramentas/convertews/index.js index 7879f6a..c5929f5 100755 --- a/ferramentas/convertews/index.js +++ b/ferramentas/convertews/index.js @@ -47,12 +47,6 @@ i3GEOF.converteMapaWS = { Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. */ aguarde: "", - /* - Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário - */ - criaJanelaFlutuante: function(){ - i3GEOF.converteMapaWS.iniciaDicionario(); - }, /** * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php */ diff --git a/pacotes/kmlmapserver/classes/layerserver.class.php b/pacotes/kmlmapserver/classes/layerserver.class.php index 9c86507..579b929 100755 --- a/pacotes/kmlmapserver/classes/layerserver.class.php +++ b/pacotes/kmlmapserver/classes/layerserver.class.php @@ -109,33 +109,26 @@ class LayerServer { * your encoding is different, you can set it through CGI style parameters */ var $encoding; - /** * send networklink * wether folder should contain networklinks instead of real geometries * it is automatically set when all layers are requested */ var $_networklink; - - /** * Initialize * */ function LayerServer(){ $this->errors = array(); - // Load request parameters - $this->get_request(); - - $this->style_counter = 0; - - // Load map - if(!$this->has_error()) { - $this->load_map(); - } - + // Load request parameters + $this->get_request(); + $this->style_counter = 0; + // Load map + if(!$this->has_error()) { + $this->load_map(); + } } - /** * Run the server and sends data * @return string or void @@ -975,28 +968,21 @@ class LayerServer { function set_error($message, $layer = 'Error'){ $this->errors[$layer][] = $message; } - - /** * Load the map and create the map instance */ function load_map(){ - if(!file_exists($this->map) && is_readable($this->map)){ - $this->set_error('Cannot read mapfile '. $this->map); - } else { + if(!file_exists($this->map) && is_readable($this->map)){ + $this->set_error('Cannot read mapfile '. $this->map); + } else { $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); $servidor = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST']; $temp = $this->map; - if(file_exists(dirname(__FILE__)."/ms_configura.php")){ - include(dirname(__FILE__)."/ms_configura.php"); - } - if(file_exists(dirname(__FILE__)."/../../ms_configura.php")){ - include(dirname(__FILE__)."/../../ms_configura.php"); - } if(file_exists(dirname(__FILE__)."/../../../ms_configura.php")){ include(dirname(__FILE__)."/../../../ms_configura.php"); - } - + } else { + include(dirname(__FILE__)."/../../ms_configura.php"); + } if(!file_exists($this->map)){ $maptemp = ms_newMapObj($locaplic."/temas/".$this->map.".map"); //if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) @@ -1131,8 +1117,12 @@ class LayerServer { if($k != ""){ return $k; } - include(dirname(__FILE__)."/../../ms_configura.php"); - return $dir_tmp.'/'. md5($_SERVER['QUERY_STRING']) . ($this->_zipped ? '.kmz' : '.kml'); + if(file_exists(dirname(__FILE__)."/../../../ms_configura.php")){ + include(dirname(__FILE__)."/../../../ms_configura.php"); + } else { + include(dirname(__FILE__)."/../../ms_configura.php"); + } + return $dir_tmp.'/'. md5($_SERVER['QUERY_STRING']) . ($this->_zipped ? '.kmz' : '.kml'); } /** diff --git a/pacotes/kmlmapserver/kmlservice.php b/pacotes/kmlmapserver/kmlservice.php index 955d706..a993611 100755 --- a/pacotes/kmlmapserver/kmlservice.php +++ b/pacotes/kmlmapserver/kmlservice.php @@ -26,6 +26,14 @@ http://10.1.1.34:80/i3geo/pacotes/kmlmapserver/kmlservice.php?map=bioma&typename */ error_reporting(0); set_time_limit(0); +//para o caso do mapa ser o que esta em uso +if(!empty($_GET["sid"])){ + session_name("i3GeoPHP"); + session_id($_GET["sid"]); + session_start(); + $_GET["map"] = $_SESSION["map_file"]; + $_REQUEST["map"] = $_SESSION["map_file"]; +} include 'classes/kmlserver.class.php'; $server = new KmlServer(); -?> \ No newline at end of file +?> -- libgit2 0.21.2