Commit 5436a944de2086a8113227b3284329251e66d323

Authored by Edmar Moretti
1 parent 5dea5c64

Adaptação da ferramenta que converte o mapa atual em KML para bootstrap e correção de erros

ferramentas/convertemapakml/dependencias.php
@@ -17,17 +17,6 @@ header("Content-type: text/javascript"); @@ -17,17 +17,6 @@ header("Content-type: text/javascript");
17 include("index.js"); 17 include("index.js");
18 include("dicionario.js"); 18 include("dicionario.js");
19 echo "\n"; 19 echo "\n";
20 -/**  
21 - * Inclui o template mustache do HTML usado para criar o conteudo da janela  
22 - */  
23 -echo 'i3GEOF.converteMapaKml.MUSTACHE = "';  
24 -$texto = file_get_contents("template_mst.html");  
25 -$texto = str_replace("\n", "", $texto);  
26 -$texto = str_replace("\r", "", $texto);  
27 -$texto = str_replace("\t", "", $texto);  
28 -$texto = str_replace('"', "'", $texto);  
29 -echo $texto;  
30 -echo '";';  
31 if(extension_loaded('zlib')){ 20 if(extension_loaded('zlib')){
32 ob_end_flush(); 21 ob_end_flush();
33 } 22 }
ferramentas/convertemapakml/index.js
@@ -51,12 +51,8 @@ i3GEOF.converteMapaKml = { @@ -51,12 +51,8 @@ i3GEOF.converteMapaKml = {
51 //TODO verificar funcionamento sem expor mapfile 51 //TODO verificar funcionamento sem expor mapfile
52 mustacheHash : function() { 52 mustacheHash : function() {
53 var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.converteMapaKml.dicionario); 53 var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.converteMapaKml.dicionario);
54 - //lista;  
55 - //lista = i3GEO.arvoreDeCamadas.CAMADAS;  
56 - //tema = lista[0].name;  
57 dicionario["locaplic"] = i3GEO.configura.locaplic; 54 dicionario["locaplic"] = i3GEO.configura.locaplic;
58 - dicionario["parametrosMapfile"] = i3GEO.parametros.mapfile;  
59 - dicionario["tema"] = ""; 55 + dicionario["sid"] = i3GEO.configura.sid;
60 return dicionario; 56 return dicionario;
61 }, 57 },
62 58
@@ -74,6 +70,16 @@ i3GEOF.converteMapaKml = { @@ -74,6 +70,16 @@ i3GEOF.converteMapaKml = {
74 var ins = Mustache.render(i3GEOF.converteMapaKml.MUSTACHE, i3GEOF.converteMapaKml.mustacheHash()); 70 var ins = Mustache.render(i3GEOF.converteMapaKml.MUSTACHE, i3GEOF.converteMapaKml.mustacheHash());
75 $i(divid).innerHTML += ins; 71 $i(divid).innerHTML += ins;
76 }, 72 },
  73 + inicia: function(divid){
  74 + if(i3GEOF.converteMapaKml.MUSTACHE == ""){
  75 + $.get(i3GEO.configura.locaplic + "/ferramentas/convertemapakml/template_mst.html", function(template) {
  76 + i3GEOF.converteMapaKml.MUSTACHE = template;
  77 + i3GEOF.converteMapaKml.inicia(divid);
  78 + });
  79 + return;
  80 + }
  81 + i3GEOF.converteMapaKml.html(divid);
  82 + },
77 /* 83 /*
78 Function: iniciaJanelaFlutuante 84 Function: iniciaJanelaFlutuante
79 85
@@ -110,6 +116,6 @@ i3GEOF.converteMapaKml = { @@ -110,6 +116,6 @@ i3GEOF.converteMapaKml = {
110 "13" 116 "13"
111 ); 117 );
112 divid = janela[2].id; 118 divid = janela[2].id;
113 - i3GEOF.converteMapaKml.html(divid); 119 + i3GEOF.converteMapaKml.inicia(divid);
114 } 120 }
115 }; 121 };
ferramentas/convertemapakml/template_mst.html
1 -<div style='margin-left: 5px;'>  
2 - <p class='paragrafo'>  
3 - {{{ajuda}}} como o  
4 - <a href='http://earth.google.com/intl/pt/' target='_blank'> Google Earth</a>  
5 - . {{{ajuda2}}}  
6 - <p class='paragrafo'> 1 +<div class='container-fluid'>
  2 + <h5>{{{ajuda}}}</h5>
  3 + <h5>{{{ajuda2}}}</h5>
  4 +
  5 + <h5>
7 <a href='{{{locaplic}}}/documentacao/ajuda/googleearth.htm' target='_blank'> Clique aqui </a> 6 <a href='{{{locaplic}}}/documentacao/ajuda/googleearth.htm' target='_blank'> Clique aqui </a>
8 {{{ajuda3}}} 7 {{{ajuda3}}}
9 - <p class='paragrafo'>  
10 - <b>{{{wms}}} </b>  
11 - </p>  
12 - <p class='paragrafo'>  
13 - <textarea cols='55' rows='3' style='cursor: pointer' onclick='javascript:this.select()'>  
14 - {{{locaplic}}}/pacotes/kmlmapserver/kmlservice.php?map={{{parametrosMapfile}}}&amp;typename={{{tema}}}&amp;request=kml</textarea>  
15 - </p>  
16 - <p class='paragrafo'>{{{ajuda4}}}  
17 - <p class='paragrafo'>  
18 - <textarea cols='55' rows='2' style='cursor: pointer' onclick='javascript:this.select()'>{{{locaplic}}}/kml.php </textarea>  
19 - </p> 8 + </h5>
  9 + <h5>
  10 + <b>{{{wms}}}</b>
  11 + </h5>
  12 + <h5>
  13 + <a href='{{{locaplic}}}/pacotes/kmlmapserver/kmlservice.php?sid={{{sid}}}&request=kml' target="_blank">
  14 + {{{locaplic}}}/pacotes/kmlmapserver/kmlservice.php?sid={{{sid}}}&amp;request=kml </a>
  15 + </h5>
  16 + <h5>{{{ajuda4}}}</h5>
  17 + <h5>
  18 + <a href='{{{locaplic}}}/kml.php' target='_blank'>{{{locaplic}}}/kml.php</a>
  19 + </h5>
20 </div> 20 </div>
21 \ No newline at end of file 21 \ No newline at end of file
ferramentas/convertews/index.js
@@ -47,12 +47,6 @@ i3GEOF.converteMapaWS = { @@ -47,12 +47,6 @@ i3GEOF.converteMapaWS = {
47 Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela. 47 Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
48 */ 48 */
49 aguarde: "", 49 aguarde: "",
50 - /*  
51 - Para efeitos de compatibilidade antes da vers&atilde;o 4.7 que n&atilde;o tinha dicion&aacute;rio  
52 - */  
53 - criaJanelaFlutuante: function(){  
54 - i3GEOF.converteMapaWS.iniciaDicionario();  
55 - },  
56 /** 50 /**
57 * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php 51 * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php
58 */ 52 */
pacotes/kmlmapserver/classes/layerserver.class.php
@@ -109,33 +109,26 @@ class LayerServer { @@ -109,33 +109,26 @@ class LayerServer {
109 * your encoding is different, you can set it through CGI style parameters 109 * your encoding is different, you can set it through CGI style parameters
110 */ 110 */
111 var $encoding; 111 var $encoding;
112 -  
113 /** 112 /**
114 * send networklink 113 * send networklink
115 * wether folder should contain networklinks instead of real geometries 114 * wether folder should contain networklinks instead of real geometries
116 * it is automatically set when all layers are requested 115 * it is automatically set when all layers are requested
117 */ 116 */
118 var $_networklink; 117 var $_networklink;
119 -  
120 -  
121 /** 118 /**
122 * Initialize 119 * Initialize
123 * 120 *
124 */ 121 */
125 function LayerServer(){ 122 function LayerServer(){
126 $this->errors = array(); 123 $this->errors = array();
127 - // Load request parameters  
128 - $this->get_request();  
129 -  
130 - $this->style_counter = 0;  
131 -  
132 - // Load map  
133 - if(!$this->has_error()) {  
134 - $this->load_map();  
135 - }  
136 - 124 + // Load request parameters
  125 + $this->get_request();
  126 + $this->style_counter = 0;
  127 + // Load map
  128 + if(!$this->has_error()) {
  129 + $this->load_map();
  130 + }
137 } 131 }
138 -  
139 /** 132 /**
140 * Run the server and sends data 133 * Run the server and sends data
141 * @return string or void 134 * @return string or void
@@ -975,28 +968,21 @@ class LayerServer { @@ -975,28 +968,21 @@ class LayerServer {
975 function set_error($message, $layer = 'Error'){ 968 function set_error($message, $layer = 'Error'){
976 $this->errors[$layer][] = $message; 969 $this->errors[$layer][] = $message;
977 } 970 }
978 -  
979 -  
980 /** 971 /**
981 * Load the map and create the map instance 972 * Load the map and create the map instance
982 */ 973 */
983 function load_map(){ 974 function load_map(){
984 - if(!file_exists($this->map) && is_readable($this->map)){  
985 - $this->set_error('Cannot read mapfile '. $this->map);  
986 - } else { 975 + if(!file_exists($this->map) && is_readable($this->map)){
  976 + $this->set_error('Cannot read mapfile '. $this->map);
  977 + } else {
987 $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); 978 $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']);
988 $servidor = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST']; 979 $servidor = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST'];
989 $temp = $this->map; 980 $temp = $this->map;
990 - if(file_exists(dirname(__FILE__)."/ms_configura.php")){  
991 - include(dirname(__FILE__)."/ms_configura.php");  
992 - }  
993 - if(file_exists(dirname(__FILE__)."/../../ms_configura.php")){  
994 - include(dirname(__FILE__)."/../../ms_configura.php");  
995 - }  
996 if(file_exists(dirname(__FILE__)."/../../../ms_configura.php")){ 981 if(file_exists(dirname(__FILE__)."/../../../ms_configura.php")){
997 include(dirname(__FILE__)."/../../../ms_configura.php"); 982 include(dirname(__FILE__)."/../../../ms_configura.php");
998 - }  
999 - 983 + } else {
  984 + include(dirname(__FILE__)."/../../ms_configura.php");
  985 + }
1000 if(!file_exists($this->map)){ 986 if(!file_exists($this->map)){
1001 $maptemp = ms_newMapObj($locaplic."/temas/".$this->map.".map"); 987 $maptemp = ms_newMapObj($locaplic."/temas/".$this->map.".map");
1002 //if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) 988 //if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
@@ -1131,8 +1117,12 @@ class LayerServer { @@ -1131,8 +1117,12 @@ class LayerServer {
1131 if($k != ""){ 1117 if($k != ""){
1132 return $k; 1118 return $k;
1133 } 1119 }
1134 - include(dirname(__FILE__)."/../../ms_configura.php");  
1135 - return $dir_tmp.'/'. md5($_SERVER['QUERY_STRING']) . ($this->_zipped ? '.kmz' : '.kml'); 1120 + if(file_exists(dirname(__FILE__)."/../../../ms_configura.php")){
  1121 + include(dirname(__FILE__)."/../../../ms_configura.php");
  1122 + } else {
  1123 + include(dirname(__FILE__)."/../../ms_configura.php");
  1124 + }
  1125 + return $dir_tmp.'/'. md5($_SERVER['QUERY_STRING']) . ($this->_zipped ? '.kmz' : '.kml');
1136 } 1126 }
1137 1127
1138 /** 1128 /**
pacotes/kmlmapserver/kmlservice.php
@@ -26,6 +26,14 @@ http://10.1.1.34:80/i3geo/pacotes/kmlmapserver/kmlservice.php?map=bioma&amp;typename @@ -26,6 +26,14 @@ http://10.1.1.34:80/i3geo/pacotes/kmlmapserver/kmlservice.php?map=bioma&amp;typename
26 */ 26 */
27 error_reporting(0); 27 error_reporting(0);
28 set_time_limit(0); 28 set_time_limit(0);
  29 +//para o caso do mapa ser o que esta em uso
  30 +if(!empty($_GET["sid"])){
  31 + session_name("i3GeoPHP");
  32 + session_id($_GET["sid"]);
  33 + session_start();
  34 + $_GET["map"] = $_SESSION["map_file"];
  35 + $_REQUEST["map"] = $_SESSION["map_file"];
  36 +}
29 include 'classes/kmlserver.class.php'; 37 include 'classes/kmlserver.class.php';
30 $server = new KmlServer(); 38 $server = new KmlServer();
31 -?>  
32 \ No newline at end of file 39 \ No newline at end of file
  40 +?>