Commit fb0b02eee748cdd72459c7706b691bfae51a6e2d

Authored by Edmar Moretti
1 parent dc77e620

Inclusão da ferramenta de importação de camadas por meio de um xml no padrão WMC (web map context)

admin/admin.db
No preview for this file type
aplicmap/dados/testewmc.xml 0 → 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
  2 +<ViewContext version="1.1.0" id="GERAL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.opengis.net/context" xmlns:sld="http://www.opengis.net/sld" xsi:schemaLocation="http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd">
  3 + <General>
  4 + <Window width="1267" height="617"/>
  5 + <!-- Bounding box corners and spatial reference system -->
  6 + <BoundingBox SRS="EPSG:4291" minx="-103.280641" miny="-39.392568" maxx="-2.817137" maxy="9.490149"/>
  7 + <!-- Title of Context -->
  8 + <Title>i3Geo</Title>
  9 + <ContactInformation>
  10 + </ContactInformation>
  11 + </General>
  12 + <LayerList>
  13 + <Layer queryable="1" hidden="1">
  14 + <Server service="OGC:WMS" version="1.0.0" title="Localidades">
  15 + <OnlineResource xlink:type="simple" xlink:href="http://localhost:80/i3geo/ogc.php?tema=locali"/>
  16 + </Server>
  17 + <Name>locali</Name>
  18 + <Title>Localidades</Title>
  19 + <SRS>EPSG:4291 EPSG:4326</SRS>
  20 + <FormatList>
  21 + <Format>image/gif</Format>
  22 + <Format current="1">image/png</Format>
  23 + <Format>image/png; mode=24bit</Format>
  24 + <Format>image/jpeg</Format>
  25 + <Format>image/wbmp</Format>
  26 + <Format>image/tiff</Format>
  27 + </FormatList>
  28 + </Layer>
  29 + </LayerList>
  30 +</ViewContext>
classesjs/classe_arvoredetemas.js
@@ -5,7 +5,7 @@ Title: Árvore de temas @@ -5,7 +5,7 @@ Title: Árvore de temas
5 5
6 Arquivo: 6 Arquivo:
7 7
8 -i3geo/classesjs/classe_arvodetemas.js 8 +i3geo/classesjs/classe_arvoredetemas.js
9 9
10 Licenca: 10 Licenca:
11 11
@@ -87,7 +87,9 @@ i3GEO.arvoreDeTemas = { @@ -87,7 +87,9 @@ i3GEO.arvoreDeTemas = {
87 87
88 comentarios: true, 88 comentarios: true,
89 89
90 - bookmark: true 90 + bookmark: true,
  91 +
  92 + importarwmc: true
91 } 93 }
92 94
93 Tipo: 95 Tipo:
@@ -114,7 +116,8 @@ i3GEO.arvoreDeTemas = { @@ -114,7 +116,8 @@ i3GEO.arvoreDeTemas = {
114 carousel: true, 116 carousel: true,
115 uploadgpx: true, 117 uploadgpx: true,
116 comentarios: true, 118 comentarios: true,
117 - bookmark: true 119 + bookmark: true,
  120 + importarwmc: true
118 }, 121 },
119 /* 122 /*
120 Propriedade: FATORESTRELA 123 Propriedade: FATORESTRELA
@@ -1300,48 +1303,53 @@ i3GEO.arvoreDeTemas = { @@ -1300,48 +1303,53 @@ i3GEO.arvoreDeTemas = {
1300 if(typeof(console) !== 'undefined'){console.info("i3GEO.arvoreDeTemas.outrasOpcoesHTML()");} 1303 if(typeof(console) !== 'undefined'){console.info("i3GEO.arvoreDeTemas.outrasOpcoesHTML()");}
1301 var ins = "", 1304 var ins = "",
1302 t = 0, 1305 t = 0,
1303 - imb = i3GEO.util.$im("branco.gif");  
1304 - if(this.OPCOESADICIONAIS.refresh === true){ 1306 + imb = i3GEO.util.$im("branco.gif"),
  1307 + OPCOESADICIONAIS = i3GEO.arvoreDeTemas.OPCOESADICIONAIS;
  1308 + if(OPCOESADICIONAIS.refresh === true){
1305 ins += "<td><img class='refresh' onclick='i3GEO.arvoreDeTemas.atualiza()' src='"+imb+"' style='cursor:pointer;text-align:left' title='Refresh'/><td>"; 1309 ins += "<td><img class='refresh' onclick='i3GEO.arvoreDeTemas.atualiza()' src='"+imb+"' style='cursor:pointer;text-align:left' title='Refresh'/><td>";
1306 t += 20; 1310 t += 20;
1307 } 1311 }
1308 - if(this.OPCOESADICIONAIS.uploadgpx === true){ 1312 + if(OPCOESADICIONAIS.uploadgpx === true){
1309 ins += "<td><img class='uploadgpx' onclick='i3GEO.arvoreDeTemas.dialogo.uploadgpx()' src='"+imb+"' style='cursor:pointer;text-align:left' title='upload GPX'/><td>"; 1313 ins += "<td><img class='uploadgpx' onclick='i3GEO.arvoreDeTemas.dialogo.uploadgpx()' src='"+imb+"' style='cursor:pointer;text-align:left' title='upload GPX'/><td>";
1310 t += 20; 1314 t += 20;
1311 } 1315 }
1312 - if(this.OPCOESADICIONAIS.uploaddbf === true){ 1316 + if(OPCOESADICIONAIS.uploaddbf === true){
1313 ins += "<td><img class='uploaddbf' onclick='i3GEO.arvoreDeTemas.dialogo.uploaddbf()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a2b")+"'/><td>"; 1317 ins += "<td><img class='uploaddbf' onclick='i3GEO.arvoreDeTemas.dialogo.uploaddbf()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a2b")+"'/><td>";
1314 t += 20; 1318 t += 20;
1315 } 1319 }
1316 - if(this.OPCOESADICIONAIS.uploadlocal === true){ 1320 + if(OPCOESADICIONAIS.uploadlocal === true){
1317 ins += "<td><img class='upload' onclick='i3GEO.arvoreDeTemas.dialogo.upload()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a2")+"'/><td>"; 1321 ins += "<td><img class='upload' onclick='i3GEO.arvoreDeTemas.dialogo.upload()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a2")+"'/><td>";
1318 t += 20; 1322 t += 20;
1319 } 1323 }
1320 - if(this.OPCOESADICIONAIS.downloadbase === true){ 1324 + if(OPCOESADICIONAIS.downloadbase === true){
1321 ins += "<td><img onclick='i3GEO.arvoreDeTemas.dialogo.downloadbase()' class='download' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a3")+"'/><td>"; 1325 ins += "<td><img onclick='i3GEO.arvoreDeTemas.dialogo.downloadbase()' class='download' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a3")+"'/><td>";
1322 t += 20; 1326 t += 20;
1323 } 1327 }
1324 - if(this.OPCOESADICIONAIS.conectarwms === true){ 1328 + if(OPCOESADICIONAIS.importarwmc === true){
  1329 + ins += "<td><img onclick='i3GEO.arvoreDeTemas.dialogo.importarwmc()' class='importarwmc' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a3a")+"'/><td>";
  1330 + t += 20;
  1331 + }
  1332 + if(OPCOESADICIONAIS.conectarwms === true){
1325 ins += "<td><img class='conectarwms' onclick='i3GEO.arvoreDeTemas.dialogo.conectarwms()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a4")+"'/><td>"; 1333 ins += "<td><img class='conectarwms' onclick='i3GEO.arvoreDeTemas.dialogo.conectarwms()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a4")+"'/><td>";
1326 t += 20; 1334 t += 20;
1327 } 1335 }
1328 - if(this.OPCOESADICIONAIS.conectarwmst === true){ 1336 + if(OPCOESADICIONAIS.conectarwmst === true){
1329 ins += "<td><img class='conectarwmst' onclick='i3GEO.arvoreDeTemas.dialogo.conectarwmst()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a4b")+"'/><td>"; 1337 ins += "<td><img class='conectarwmst' onclick='i3GEO.arvoreDeTemas.dialogo.conectarwmst()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a4b")+"'/><td>";
1330 t += 20; 1338 t += 20;
1331 } 1339 }
1332 - if(this.OPCOESADICIONAIS.conectargeorss === true){ 1340 + if(OPCOESADICIONAIS.conectargeorss === true){
1333 ins += "<td><img class='conectargeorss' onclick='i3GEO.arvoreDeTemas.dialogo.conectargeorss()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a5")+"'/><td>"; 1341 ins += "<td><img class='conectargeorss' onclick='i3GEO.arvoreDeTemas.dialogo.conectargeorss()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a5")+"'/><td>";
1334 t += 20; 1342 t += 20;
1335 } 1343 }
1336 - if(this.OPCOESADICIONAIS.nuvemTags === true){ 1344 + if(OPCOESADICIONAIS.nuvemTags === true){
1337 ins += "<td><img class='nuvemtags' onclick='i3GEO.arvoreDeTemas.dialogo.nuvemTags()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a5a")+"'/><td>"; 1345 ins += "<td><img class='nuvemtags' onclick='i3GEO.arvoreDeTemas.dialogo.nuvemTags()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a5a")+"'/><td>";
1338 t += 20; 1346 t += 20;
1339 } 1347 }
1340 - if(this.OPCOESADICIONAIS.nuvemTagsFlash === true){ 1348 + if(OPCOESADICIONAIS.nuvemTagsFlash === true){
1341 ins += "<td><img class='nuvemtags' onclick='i3GEO.arvoreDeTemas.dialogo.nuvemTagsFlash()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a5a")+"'/><td>"; 1349 ins += "<td><img class='nuvemtags' onclick='i3GEO.arvoreDeTemas.dialogo.nuvemTagsFlash()' src='"+imb+"' style='cursor:pointer;text-align:left' title='"+$trad("a5a")+"'/><td>";
1342 t += 20; 1350 t += 20;
1343 } 1351 }
1344 - if(this.OPCOESADICIONAIS.carousel === true){ 1352 + if(OPCOESADICIONAIS.carousel === true){
1345 ins += "<td><img class='carouselTemas' onclick='i3GEO.arvoreDeTemas.dialogo.carouselTemas()' src='"+imb+"' style='cursor:pointer;text-align:left' title='Miniaturas'/><td>"; 1353 ins += "<td><img class='carouselTemas' onclick='i3GEO.arvoreDeTemas.dialogo.carouselTemas()' src='"+imb+"' style='cursor:pointer;text-align:left' title='Miniaturas'/><td>";
1346 t += 20; 1354 t += 20;
1347 } 1355 }
@@ -1839,6 +1847,13 @@ i3GEO.arvoreDeTemas = { @@ -1839,6 +1847,13 @@ i3GEO.arvoreDeTemas = {
1839 navegacaoDir: function() 1847 navegacaoDir: function()
1840 {i3GEO.janela.cria("550px","350px",i3GEO.configura.locaplic+"/ferramentas/navegacaodir/index.htm","","","Diret&oacute;rios");}, 1848 {i3GEO.janela.cria("550px","350px",i3GEO.configura.locaplic+"/ferramentas/navegacaodir/index.htm","","","Diret&oacute;rios");},
1841 /* 1849 /*
  1850 + Function: importarwmc
  1851 +
  1852 + Abre a janela para importar um arquivo WMC (Web Map Context)
  1853 + */
  1854 + importarwmc: function()
  1855 + {i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/importarwmc/index.js.php","i3GEOF.importarwmc.criaJanelaFlutuante()","i3GEOF.importarwmc_script");},
  1856 + /*
1842 Function: conectarwms 1857 Function: conectarwms
1843 1858
1844 Abre a janela para adicionar temas tendo como fonte um web service do tipo wms 1859 Abre a janela para adicionar temas tendo como fonte um web service do tipo wms
classesjs/dicionario.js
@@ -825,6 +825,13 @@ en:&quot;Data download&quot;, @@ -825,6 +825,13 @@ en:&quot;Data download&quot;,
825 es:"Download de datos", 825 es:"Download de datos",
826 it:"Download dei dati" 826 it:"Download dei dati"
827 }], 827 }],
  828 +"a3a":[
  829 +{
  830 +pt:"Importar Web Map Context (WMC)",
  831 +en:"Importar Web Map Context (WMC)",
  832 +es:"Importar Web Map Context (WMC)",
  833 +it:"Importar Web Map Context (WMC)"
  834 +}],
828 "a4":[ 835 "a4":[
829 { 836 {
830 pt:"Conectar com servidor WMS", 837 pt:"Conectar com servidor WMS",
classesjs/dicionario_ajuda.js
@@ -830,6 +830,15 @@ g_traducao_ajuda = { @@ -830,6 +830,15 @@ g_traducao_ajuda = {
830 complemento:"", 830 complemento:"",
831 tela:"", 831 tela:"",
832 apijs:"i3GEO.arvoreDeCamadas" 832 apijs:"i3GEO.arvoreDeCamadas"
  833 + },
  834 + "98": {
  835 + titulo: "Importar WMC",
  836 + diretorio:"i3geo/ferramentas/importarwmc",
  837 + categoria:"4",
  838 + pt:"Adiciona ao mapa camadas definidas em um arquivo XML no padrão WMC 'Web Map Context'. O WMC permite que mapas sejam transferidos entre aplicações.",
  839 + complemento:"O arquivo XML pode estar em um servidor ou pode ser feito o upload para o servidor do i3Geo",
  840 + tela:"",
  841 + apijs:"i3GEO.arvoreDeTemas.dialogo.importarwmc()"
833 } 842 }
834 } 843 }
835 }; 844 };
classesphp/classe_mapa.php
@@ -1332,40 +1332,46 @@ Endereço do WMC @@ -1332,40 +1332,46 @@ Endereço do WMC
1332 $w = $this->mapa->web; 1332 $w = $this->mapa->web;
1333 $w->set("template",""); 1333 $w->set("template","");
1334 // adiciona os parametros no nivel do mapa 1334 // adiciona os parametros no nivel do mapa
1335 - $this->mapa->setmetadata("wms_title","I3Geo"); 1335 + $this->mapa->setmetadata("wms_title","i3Geo");
1336 $this->mapa->setmetadata("wms_onlineresource","http://".$h.$nomeurl); 1336 $this->mapa->setmetadata("wms_onlineresource","http://".$h.$nomeurl);
1337 $this->mapa->setmetadata("wms_srs","EPSG:4291"); 1337 $this->mapa->setmetadata("wms_srs","EPSG:4291");
1338 $this->mapa->setmetadata("wms_getcontext_enabled","1"); 1338 $this->mapa->setmetadata("wms_getcontext_enabled","1");
1339 foreach ($this->layers as $layer) 1339 foreach ($this->layers as $layer)
1340 { 1340 {
1341 - $n = pegaNome($layer);  
1342 - $layer->setmetadata("wms_title",$n);  
1343 - $codigo = $layer->getmetadata("nomeoriginal");  
1344 - if($codigo == "")  
1345 - {$codigo = $layer->name;}  
1346 - $layer->setmetadata("wms_server_version","1.0.0");  
1347 - $layer->setmetadata("wms_name",$codigo);  
1348 - $layer->setmetadata("wms_srs","EPSG:4291 EPSG:4326");  
1349 - //$layer->setmetadata("wms_getcontext_enabled","1");  
1350 - $layer->setmetadata("WMS_INCLUDE_ITEMS","all");  
1351 - $layer->setmetadata("wms_onlineresource","http://".$h.$nomeurl);  
1352 - $layer->set("status","ON");  
1353 - $layer->set("template","none.htm");  
1354 - $layer->setmetadata("gml_include_items","all");  
1355 - $layer->set("dump",MS_TRUE);  
1356 - $c = $layer->getclass(0);  
1357 - if ($c->name == "")  
1358 - {$c->name = " ";}  
1359 - if($layer->connectiontype != "WS_WMS" && $layer->getmetadata("permiteogc") == "" && $layer->getmetadata("TEMALOCAL") == ""){  
1360 - if(ms_GetVersionInt() > 50201)  
1361 - {$layer->setconnectiontype(MS_WMS);}  
1362 - else  
1363 - {$layer->set("connectiontype",MS_WMS);}  
1364 - $data = $urli3geo."/ogc.php?tema=".$codigo;  
1365 - $layer->set("connection",$data);  
1366 - $layer->set("data","");  
1367 - if(file_exists("../temas/".$codigo.".map"))  
1368 - {$layer->setmetadata("wms_onlineresource",$data);} 1341 + if($layer->connectiontype != 7 && $layer->connectiontype != 9){
  1342 + $n = pegaNome($layer);
  1343 + $layer->setmetadata("wms_title",$n);
  1344 + $codigo = $layer->getmetadata("nomeoriginal");
  1345 + if($codigo == "")
  1346 + {$codigo = $layer->name;}
  1347 + $layer->setmetadata("wms_server_version","1.0.0");
  1348 + $layer->setmetadata("wms_name",$codigo);
  1349 + $layer->setmetadata("wms_srs","EPSG:4291 EPSG:4326");
  1350 + $layer->setmetadata("WMS_INCLUDE_ITEMS","all");
  1351 + $layer->setmetadata("wms_onlineresource","http://".$h.$nomeurl);
  1352 + $layer->setmetadata("gml_include_items","all");
  1353 + $layer->setmetadata("wms_format","image/png");
  1354 + $layer->setmetadata("wms_formatlist","image/gif,image/png,image/png; mode=24bit,image/jpeg,image/wbmp,image/tiff");
  1355 + $layer->set("dump",MS_TRUE);
  1356 + $layer->set("status","ON");
  1357 + $layer->set("template","none.htm");
  1358 + $c = $layer->getclass(0);
  1359 + if ($c->name == "")
  1360 + {$c->name = " ";}
  1361 + if($layer->connectiontype != "WS_WMS" && $layer->getmetadata("permiteogc") == "" && $layer->getmetadata("TEMALOCAL") == ""){
  1362 + if(ms_GetVersionInt() > 50201)
  1363 + {$layer->setconnectiontype(MS_WMS);}
  1364 + else
  1365 + {$layer->set("connectiontype",MS_WMS);}
  1366 + $data = $urli3geo."/ogc.php?tema=".$codigo;
  1367 + $layer->set("connection",$data);
  1368 + $layer->set("data","");
  1369 + if(file_exists("../temas/".$codigo.".map"))
  1370 + {$layer->setmetadata("wms_onlineresource",$data);}
  1371 + }
  1372 + }
  1373 + else{
  1374 + $layer->setmetadata("wms_onlineresource",$layer->connection);
1369 } 1375 }
1370 } 1376 }
1371 $eb = $this->mapa->scalebar; 1377 $eb = $this->mapa->scalebar;
css/botoes.css
1 /* 1 /*
2 utiliza botões antigos até a versão 4.4 do i3geo 2 utiliza botões antigos até a versão 4.4 do i3geo
3 */ 3 */
4 -#soltaLeg,#uploadgpx,#metar,#carouselTemas,#identificaBalao,#rota,#buscafotos,#area,#confluence,#scielo,#wiki,#inseregrafico,#realca,#reinicia,#google,#zoomtot,#pan,#zoomli,#zoomlo,#zoomiauto,#zoomoauto,#identifica,#lentei,#reinicia,#exten,#selecao,#inserexy,#textofid,#mede,#perfil,#cruza,#tamanho,#imprimir,#salva,#carrega,#referencia,#pegaimagens,#v3d 4 +#importarwmc,#soltaLeg,#uploadgpx,#metar,#carouselTemas,#identificaBalao,#rota,#buscafotos,#area,#confluence,#scielo,#wiki,#inseregrafico,#realca,#reinicia,#google,#zoomtot,#pan,#zoomli,#zoomlo,#zoomiauto,#zoomoauto,#identifica,#lentei,#reinicia,#exten,#selecao,#inserexy,#textofid,#mede,#perfil,#cruza,#tamanho,#imprimir,#salva,#carrega,#referencia,#pegaimagens,#v3d
5 {cursor:pointer;border: 0px solid rgb(50,50,50);border-bottom:1px solid rgb(50,50,50);border-left:1px solid rgb(50,50,50);width:22;height:22;z-index:1000;position:relative;} 5 {cursor:pointer;border: 0px solid rgb(50,50,50);border-bottom:1px solid rgb(50,50,50);border-left:1px solid rgb(50,50,50);width:22;height:22;z-index:1000;position:relative;}
6 #box1 6 #box1
7 {font-size:0px;cursor:crosshair;opacity:.25;background-color: gray;position: absolute;visibility: hidden;width: 0px;height: 0px;border: 2px solid #ff0000;} 7 {font-size:0px;cursor:crosshair;opacity:.25;background-color: gray;position: absolute;visibility: hidden;width: 0px;height: 0px;border: 2px solid #ff0000;}
css/botoes2.css
@@ -740,6 +740,15 @@ @@ -740,6 +740,15 @@
740 width:16px; 740 width:16px;
741 height:16px; 741 height:16px;
742 } 742 }
  743 +.importarwmc
  744 +{
  745 + background-image:URL('../imagens/visual/default/sprite.png');
  746 + background-repeat: no-repeat;
  747 + background-position: 0px -2140px;
  748 + border: 1px solid #DCDCDC;
  749 + cursor:pointer;
  750 + width:16px;
  751 +}
743 button{background:url(../imagens/tic2.png) 98% 50% no-repeat;} 752 button{background:url(../imagens/tic2.png) 98% 50% no-repeat;}
744 #encolheFerramentas 753 #encolheFerramentas
745 {background-image:URL('../imagens/encolhe.png');background-repeat: no-repeat;background-position:center;cursor:pointer;} 754 {background-image:URL('../imagens/encolhe.png');background-repeat: no-repeat;background-position:center;cursor:pointer;}
746 \ No newline at end of file 755 \ No newline at end of file
ferramentas/identifica/twitter.php
@@ -24,7 +24,7 @@ $s = PHP_SHLIB_SUFFIX; @@ -24,7 +24,7 @@ $s = PHP_SHLIB_SUFFIX;
24 if(!function_exists('curl_init')) 24 if(!function_exists('curl_init'))
25 {@dl( 'php_curl'.'.'.$s );} 25 {@dl( 'php_curl'.'.'.$s );}
26 if(!function_exists('curl_init')) 26 if(!function_exists('curl_init'))
27 -{echo "curl não instalado";} 27 +{echo "curl não instalado";return;}
28 $curl = curl_init(); 28 $curl = curl_init();
29 curl_setopt ($curl, CURLOPT_URL, "http://search.twitter.com/search.json?geocode=".$_GET["y"].",".$_GET["x"].",".$km."km"); 29 curl_setopt ($curl, CURLOPT_URL, "http://search.twitter.com/search.json?geocode=".$_GET["y"].",".$_GET["x"].",".$km."km");
30 //teste 30 //teste
ferramentas/importarwmc/index.js.php 0 → 100644
@@ -0,0 +1,134 @@ @@ -0,0 +1,134 @@
  1 +<?php error_reporting(0);if(extension_loaded('zlib')){ob_start('ob_gzhandler');} header("Content-type: text/javascript"); ?>
  2 +/*jslint plusplus:false,white:false,undef: false, rhino: true, onevar: true, evil: true */
  3 +/*
  4 +Title: Importar WMC
  5 +
  6 +Importa um arquivo WMC (Web Map Context) e acrescenta ascamadas ao mapa atual.
  7 +
  8 +Veja:
  9 +
  10 +<i3GEO.arvoreDeTemas.dialogo.importarwmc>
  11 +
  12 +Arquivo:
  13 +
  14 +i3geo/ferramentas/importarwmc/index.js.php
  15 +
  16 +Licenca:
  17 +
  18 +GPL2
  19 +
  20 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  21 +
  22 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  23 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  24 +
  25 +Este programa é software livre; você pode redistribuí-lo
  26 +e/ou modificá-lo sob os termos da Licença Pública Geral
  27 +GNU conforme publicada pela Free Software Foundation;
  28 +
  29 +Este programa é distribuído na expectativa de que seja útil,
  30 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  31 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  32 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  33 +Você deve ter recebido uma cópia da Licença Pública Geral do
  34 +GNU junto com este programa; se não, escreva para a
  35 +Free Software Foundation, Inc., no endereço
  36 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  37 +*/
  38 +
  39 +
  40 +if(typeof(i3GEOF) === 'undefined'){
  41 + i3GEOF = [];
  42 +}
  43 +/*
  44 +Classe: i3GEOF.importarwmc
  45 +*/
  46 +i3GEOF.importarwmc = {
  47 + /*
  48 + Variavel: aguarde
  49 +
  50 + Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela.
  51 + */
  52 + aguarde: "",
  53 + /*
  54 + Function: inicia
  55 +
  56 + Inicia a ferramenta. É chamado por criaJanelaFlutuante
  57 +
  58 + Parametro:
  59 +
  60 + iddiv {String} - id do div que receberá o conteudo HTML da ferramenta
  61 + */
  62 + inicia: function(iddiv){
  63 + try{
  64 + $i(iddiv).innerHTML += i3GEOF.importarwmc.html();
  65 + new YAHOO.widget.Button(
  66 + "i3GEOimportarwmcbotao1",
  67 + {onclick:{fn: i3GEOF.importarwmc.submete}}
  68 + );
  69 + }
  70 + catch(erro){alert(erro);}
  71 + },
  72 + /*
  73 + Function: html
  74 +
  75 + Gera o código html para apresentação das opções da ferramenta
  76 +
  77 + Retorno:
  78 +
  79 + String com o código html
  80 + */
  81 + html:function(){
  82 + var ins = '<form id=i3GEOimportarwmcf target="i3GEOimportarwmciframe" action="'+i3GEO.configura.locaplic+'/ferramentas/importarwmc/upload.php" method="post" ENCTYPE="multipart/form-data">' +
  83 + '<p class="paragrafo" >Arquivo: <br><input class=digitar type="file" size=42 name="i3GEOimportarwmc" style="top:0px;left:0px;cursor:pointer;"></p>' +
  84 + '<p class="paragrafo" >Ou URL: <br><input class=digitar type="text" size=42 name="i3GEOimportarwmcurl" style="top:0px;left:0px;cursor:text;"></p>' +
  85 + '<br><p class="paragrafo" ><input id=i3GEOimportarwmcbotao1 type="button" value="Importar" size=12 name="submit">' +
  86 + '<input type=hidden name=g_sid value="'+i3GEO.configura.sid+'" >' +
  87 + '<input type="hidden" name="MAX_FILE_SIZE" value="100000">' +
  88 + '</form>' +
  89 + '<br><iframe name=i3GEOimportarwmciframe style="text-align:left;" width="98%" height="60px"></iframe>';
  90 + return ins;
  91 + },
  92 + /*
  93 + Function: criaJanelaFlutuante
  94 +
  95 + Cria a janela flutuante para controle da ferramenta.
  96 + */
  97 + criaJanelaFlutuante: function(){
  98 + var janela,divid,temp,titulo,cabecalho,minimiza;
  99 + cabecalho = function(){};
  100 + minimiza = function(){
  101 + i3GEO.janela.minimiza("i3GEOF.importarwmc");
  102 + };
  103 + titulo = "Upload de arquivo importarwmc <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=4&idajuda=27' >&nbsp;&nbsp;&nbsp;</a>";
  104 + janela = i3GEO.janela.cria(
  105 + "320px",
  106 + "280px",
  107 + "",
  108 + "",
  109 + "",
  110 + titulo,
  111 + "i3GEOF.importarwmc",
  112 + false,
  113 + "hd",
  114 + cabecalho,
  115 + minimiza
  116 + );
  117 + divid = janela[2].id;
  118 + $i("i3GEOF.importarwmc_corpo").style.backgroundColor = "white";
  119 + i3GEOF.importarwmc.aguarde = $i("i3GEOF.importarwmc_imagemCabecalho").style;
  120 + i3GEOF.importarwmc.inicia(divid);
  121 + },
  122 + /*
  123 + Function: submete
  124 +
  125 + Submete o arquivo ao servidor.
  126 + */
  127 + submete: function(){
  128 + if(i3GEOF.importarwmc.aguarde.visibility==="visible")
  129 + {return;}
  130 + i3GEOF.importarwmc.aguarde.visibility="visible";
  131 + $i("i3GEOimportarwmcf").submit();
  132 + }
  133 +};
  134 +<?php error_reporting(0);if(extension_loaded('zlib')){ob_end_flush();}?>
ferramentas/importarwmc/upload.php 0 → 100644
@@ -0,0 +1,89 @@ @@ -0,0 +1,89 @@
  1 +<?php
  2 +require_once("../../classesphp/funcoes_gerais.php");
  3 +include_once ("../../classesphp/carrega_ext.php");
  4 +error_reporting(E_ALL);
  5 +session_name("i3GeoPHP");
  6 +if (isset($_POST["g_sid"]))
  7 +{session_id($_POST["g_sid"]);}
  8 +session_start();
  9 +$map_file = $_SESSION["map_file"];
  10 +?>
  11 +<html>
  12 +<head>
  13 +<link rel="stylesheet" type="text/css" href="../../css/geral.css" />
  14 +<title></title>
  15 +</head>
  16 +<body name="ancora" bgcolor="white" style="background-color:white;text-align:left;">
  17 +<p>
  18 +<?php
  19 +error_reporting(E_ALL);
  20 +require_once ("../../ms_configura.php");
  21 +$dirmap = dirname($map_file);
  22 +$arquivo = "";
  23 +if(isset($_FILES['i3GEOimportarwmc']['name']) && !($_POST["i3GEOimportarwmcurl"]))
  24 +{
  25 + echo "<p class='paragrafo' >Carregando o arquivo...</p>";
  26 + //verifica nomes
  27 + verificaNome($_FILES['i3GEOimportarwmc']['name']);
  28 + //sobe arquivo
  29 + $Arquivo = $_FILES['i3GEOimportarwmc']['tmp_name'];
  30 + $status = move_uploaded_file($Arquivo,$dirmap."/".$_FILES['i3GEOimportarwmc']['name']);
  31 + $arquivo = $dirmap."/".$_FILES['i3GEOimportarwmc']['name'];
  32 +}
  33 +if($_POST["i3GEOimportarwmcurl"])
  34 +{
  35 + $s = PHP_SHLIB_SUFFIX;
  36 + if(!function_exists('curl_init'))
  37 + {@dl( 'php_curl'.'.'.$s );}
  38 + if(!function_exists('curl_init'))
  39 + {echo "curl não instalado";}
  40 + else{
  41 + $curl = curl_init();
  42 + curl_setopt ($curl, CURLOPT_URL, $_POST["i3GEOimportarwmcurl"]);
  43 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  44 + $result = curl_exec($curl);
  45 + curl_close ($curl);
  46 + $arquivo = $dirmap."/".nomeRandomico();
  47 + gravaDados(array($result),$arquivo);
  48 + }
  49 +}
  50 +if($arquivo != "")
  51 +{incluiWMC();}
  52 +paraAguarde();
  53 +function incluiWMC(){
  54 + global $map_file,$arquivo;
  55 + $mapa = ms_newMapObj($map_file);
  56 + $mapa->loadMapContext($arquivo,"MS_TRUE");
  57 + $layers = $mapa->getalllayernames();
  58 + foreach($layers as $nome){
  59 + $l = $mapa->getlayerbyname($nome);
  60 + $con = $l->connectiontype;
  61 + if(($con == 7 || $con == 9) && $l->getmetadata("tema") == ""){
  62 + if($l->getmetadata("wms_title") != "")
  63 + {$l->setmetadata("tema",$l->getmetadata("wms_title"));}
  64 + else
  65 + {$l->setmetadata("tema",$l->getmetadata("wms_name"));}
  66 + }
  67 + }
  68 + $mapa->save($map_file);
  69 + echo "Arquivo carregado com sucesso!";
  70 +}
  71 +function paraAguarde(){
  72 + echo "<script>window.parent.i3GEOF.importarwmc.aguarde.visibility='hidden';</script>";
  73 + echo "<script>window.parent.i3GEO.atualiza()</script>";
  74 +}
  75 +function verificaNome($nome)
  76 +{
  77 + $nome = strtolower($nome);
  78 + $lista = explode(".",$nome);
  79 + $extensao = $lista[count($lista) - 1];
  80 + if($extensao != "xml")
  81 + {
  82 + echo "Nome de arquivo inválido.";
  83 + paraAguarde();
  84 + exit;
  85 + }
  86 +}
  87 +?>
  88 +</body>
  89 +</html>
0 \ No newline at end of file 90 \ No newline at end of file
ferramentas/upload/upload.php
@@ -82,7 +82,7 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;])) @@ -82,7 +82,7 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;]))
82 } 82 }
83 if(isset($uploadEPSG) && $uploadEPSG != "") 83 if(isset($uploadEPSG) && $uploadEPSG != "")
84 {$novolayer->setProjection("init=epsg:".$uploadEPSG);} 84 {$novolayer->setProjection("init=epsg:".$uploadEPSG);}
85 - $adiciona = ms_newLayerObj($mapa, $novolayer); 85 + //$adiciona = ms_newLayerObj($mapa, $novolayer);
86 $salvo = $mapa->save($map_file); 86 $salvo = $mapa->save($map_file);
87 //grava os templates de cada tema 87 //grava os templates de cada tema
88 echo "<p class='paragrafo' >Tema criado!!! Redesenhando o mapa."; 88 echo "<p class='paragrafo' >Tema criado!!! Redesenhando o mapa.";
ferramentas/uploaddbf/upload.php
@@ -138,7 +138,6 @@ if (isset($_FILES[&#39;i3GEOuploaddbffile&#39;][&#39;name&#39;])) @@ -138,7 +138,6 @@ if (isset($_FILES[&#39;i3GEOuploaddbffile&#39;][&#39;name&#39;]))
138 } 138 }
139 if(isset($uploadEPSG) && $uploaddbfEPSG != "") 139 if(isset($uploadEPSG) && $uploaddbfEPSG != "")
140 {$novolayer->setProjection("init=epsg:".$uploaddbfEPSG);} 140 {$novolayer->setProjection("init=epsg:".$uploaddbfEPSG);}
141 - $adiciona = ms_newLayerObj($mapa, $novolayer);  
142 $salvo = $mapa->save($map_file); 141 $salvo = $mapa->save($map_file);
143 echo "Tema criado!!!"; 142 echo "Tema criado!!!";
144 echo "<script>window.parent.i3GEO.atualiza()</script>"; 143 echo "<script>window.parent.i3GEO.atualiza()</script>";
ferramentas/uploadgpx/upload.php
@@ -73,7 +73,7 @@ if (isset($_FILES[&#39;i3GEOuploadgpx&#39;][&#39;name&#39;])) @@ -73,7 +73,7 @@ if (isset($_FILES[&#39;i3GEOuploadgpx&#39;][&#39;name&#39;]))
73 $novolayer->set("template","none.htm"); 73 $novolayer->set("template","none.htm");
74 if(isset($uploadEPSG) && $uploadEPSG != "") 74 if(isset($uploadEPSG) && $uploadEPSG != "")
75 {$novolayer->setProjection("init=epsg:".$uploadEPSG);} 75 {$novolayer->setProjection("init=epsg:".$uploadEPSG);}
76 - $adiciona = ms_newLayerObj($mapa, $novolayer); 76 + //$adiciona = ms_newLayerObj($mapa, $novolayer);
77 } 77 }
78 $salvo = $mapa->save($map_file); 78 $salvo = $mapa->save($map_file);
79 //grava os templates de cada tema 79 //grava os templates de cada tema
imagens/visual/default/sprite.png

33.6 KB | W: | H:

33.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin