Commit c7193a1da28d5e581bedf60efd044b89f78b167d

Authored by Edmar Moretti
1 parent c7e4a4f9

Alterado o modo de inclusão de camadas do tipo WMS. As camadas agora acessam dir…

…etamente o web service na interface OpenLayers quando o cache da camada não estiver ativado.
admin/js/editormapfile.js
@@ -1118,7 +1118,7 @@ function montaEditorMetadados(dados) @@ -1118,7 +1118,7 @@ function montaEditorMetadados(dados)
1118 {ajuda:"Extensão geográfica máxima do tema, no formato xmin ymin xmax ymax. É utilizado na opção de 'zoom para o tema'. Quando o tema é baseado em shapefile, esse metadata não é necessário, pois o mapserver consegue calcular a extensão. Já em outros tipos de dados, como Postgis, o parâmetro é necessário. Nesse caso, se não for indicado, o botão de zoom para o tema não será visível para o usuário", 1118 {ajuda:"Extensão geográfica máxima do tema, no formato xmin ymin xmax ymax. É utilizado na opção de 'zoom para o tema'. Quando o tema é baseado em shapefile, esse metadata não é necessário, pois o mapserver consegue calcular a extensão. Já em outros tipos de dados, como Postgis, o parâmetro é necessário. Nesse caso, se não for indicado, o botão de zoom para o tema não será visível para o usuário",
1119 titulo:"Extensao (EXTENSAO)",id:"extensao",value:dados.extensao,tipo:"text"}, 1119 titulo:"Extensao (EXTENSAO)",id:"extensao",value:dados.extensao,tipo:"text"},
1120 {ajuda:"Ativa ou não a manutenção de um cache para armazenar as imagens geradas para montar o mapa. Essa opção afeta apenas as interfaces do i3Geo que utilizam o modo TILE (como a interface OpenLayers). O cache é mantido no diretório temporário utilizado pelo i3Geo, na pasta chamada cache. Para cada camada é criada uma sub-pasta. Para limpar o cache, utilize a opção existente junto ao nó principal desse mapfile", 1120 {ajuda:"Ativa ou não a manutenção de um cache para armazenar as imagens geradas para montar o mapa. Essa opção afeta apenas as interfaces do i3Geo que utilizam o modo TILE (como a interface OpenLayers). O cache é mantido no diretório temporário utilizado pelo i3Geo, na pasta chamada cache. Para cada camada é criada uma sub-pasta. Para limpar o cache, utilize a opção existente junto ao nó principal desse mapfile",
1121 - titulo:"Cache de mapas (CACHE)",id:"",value:dados.cache,tipo:"text",div:"<div id=cCache ></div>"}, 1121 + titulo:"Cache de mapas. Camadas WMS são acessadas diretamente do servidor de origem quando o cache estiver inativo. (CACHE)",id:"",value:dados.cache,tipo:"text",div:"<div id=cCache ></div>"},
1122 {ajuda:"Indica se a extensão geográfica do mapa deve ser alterada quando o tema for adicionado ao mapa", 1122 {ajuda:"Indica se a extensão geográfica do mapa deve ser alterada quando o tema for adicionado ao mapa",
1123 titulo:"Aplica extensao (APLICAEXTENSAO)",id:"",value:dados.aplicaextensao,tipo:"text",div:"<div id=cAplicaextensao ></div>"}, 1123 titulo:"Aplica extensao (APLICAEXTENSAO)",id:"",value:dados.aplicaextensao,tipo:"text",div:"<div id=cAplicaextensao ></div>"},
1124 {ajuda:"Indica se o usuário pode abrir o editor de SQL para poder alterar o elemento DATA do Mapfile.", 1124 {ajuda:"Indica se o usuário pode abrir o editor de SQL para poder alterar o elemento DATA do Mapfile.",
classesjs/classe_arvoredecamadas.js
@@ -553,10 +553,9 @@ i3GEO.arvoreDeCamadas = { @@ -553,10 +553,9 @@ i3GEO.arvoreDeCamadas = {
553 */ 553 */
554 ativaDragDrop: function(){ 554 ativaDragDrop: function(){
555 if(typeof(console) !== 'undefined'){console.info("i3GEO.arvoreDeCamadas.ativaDragDrop()");} 555 if(typeof(console) !== 'undefined'){console.info("i3GEO.arvoreDeCamadas.ativaDragDrop()");}
556 - var Dom,Event,DDM;  
557 - Dom = YAHOO.util.Dom;  
558 - Event = YAHOO.util.Event;  
559 - DDM = YAHOO.util.DragDropMgr; 556 + var Dom = YAHOO.util.Dom,
  557 + Event = YAHOO.util.Event,
  558 + DDM = YAHOO.util.DragDropMgr;
560 YAHOO.example.DDList = ""; 559 YAHOO.example.DDList = "";
561 YAHOO.example.DDApp = { 560 YAHOO.example.DDApp = {
562 init: function() 561 init: function()
@@ -578,14 +577,15 @@ i3GEO.arvoreDeCamadas = { @@ -578,14 +577,15 @@ i3GEO.arvoreDeCamadas = {
578 YAHOO.example.DDList = function(id, sGroup, config) { 577 YAHOO.example.DDList = function(id, sGroup, config) {
579 YAHOO.example.DDList.superclass.constructor.call(this, id, sGroup, config); 578 YAHOO.example.DDList.superclass.constructor.call(this, id, sGroup, config);
580 this.logger = this.logger || YAHOO; 579 this.logger = this.logger || YAHOO;
581 - Dom.setStyle(this.getDragEl(), "opacity", 0.67); // The proxy is slightly transparent 580 + YAHOO.util.Dom.setStyle(this.getDragEl(), "opacity", 0.67); // The proxy is slightly transparent
582 this.goingUp = false; 581 this.goingUp = false;
583 this.lastY = 0; 582 this.lastY = 0;
584 }; 583 };
585 YAHOO.extend( 584 YAHOO.extend(
586 YAHOO.example.DDList, YAHOO.util.DDProxy, { 585 YAHOO.example.DDList, YAHOO.util.DDProxy, {
587 startDrag: function(x, y){ 586 startDrag: function(x, y){
588 - var dragEl,clickEl; 587 + var dragEl,clickEl,
  588 + Dom = YAHOO.util.Dom;
589 this.logger.log(this.id + " startDrag"); 589 this.logger.log(this.id + " startDrag");
590 // make the proxy look like the source element 590 // make the proxy look like the source element
591 dragEl = this.getDragEl(); 591 dragEl = this.getDragEl();
@@ -616,6 +616,7 @@ i3GEO.arvoreDeCamadas = { @@ -616,6 +616,7 @@ i3GEO.arvoreDeCamadas = {
616 // Hide the proxy and show the source element when finished with the animation 616 // Hide the proxy and show the source element when finished with the animation
617 a.onComplete.subscribe( 617 a.onComplete.subscribe(
618 function(){ 618 function(){
  619 + var Dom = YAHOO.util.Dom;
619 Dom.setStyle(proxyid, "visibility", "hidden"); 620 Dom.setStyle(proxyid, "visibility", "hidden");
620 Dom.setStyle(thisid, "visibility", ""); 621 Dom.setStyle(thisid, "visibility", "");
621 } 622 }
@@ -624,7 +625,9 @@ i3GEO.arvoreDeCamadas = { @@ -624,7 +625,9 @@ i3GEO.arvoreDeCamadas = {
624 YAHOO.util.Dom.setStyle('i3geo_lixeira', 'border', '0px solid blue'); 625 YAHOO.util.Dom.setStyle('i3geo_lixeira', 'border', '0px solid blue');
625 }, 626 },
626 onDragDrop: function(e, id){ 627 onDragDrop: function(e, id){
627 - var pt,region,tema,destEl,els,lista,noid,temp; 628 + var pt,region,tema,destEl,els,lista,noid,temp,
  629 + DDM = YAHOO.util.DragDropMgr,
  630 + Dom = YAHOO.util.Dom;
628 if (DDM.interactionInfo.drop.length === 1){ 631 if (DDM.interactionInfo.drop.length === 1){
629 pt = DDM.interactionInfo.point; 632 pt = DDM.interactionInfo.point;
630 region = DDM.interactionInfo.sourceRegion; 633 region = DDM.interactionInfo.sourceRegion;
@@ -679,7 +682,7 @@ i3GEO.arvoreDeCamadas = { @@ -679,7 +682,7 @@ i3GEO.arvoreDeCamadas = {
679 onDragOver: function(e, id){ 682 onDragOver: function(e, id){
680 var srcEl,destEl; 683 var srcEl,destEl;
681 srcEl = this.getEl(); 684 srcEl = this.getEl();
682 - destEl = Dom.get(id); 685 + destEl = YAHOO.util.Dom.get(id);
683 // We are only concerned with list items, we ignore the dragover 686 // We are only concerned with list items, we ignore the dragover
684 // notifications for the list. 687 // notifications for the list.
685 if ($i("i3geo_lixeira") && id === "i3geo_lixeira") 688 if ($i("i3geo_lixeira") && id === "i3geo_lixeira")
@@ -1275,7 +1278,8 @@ i3GEO.arvoreDeCamadas = { @@ -1275,7 +1278,8 @@ i3GEO.arvoreDeCamadas = {
1275 */ 1278 */
1276 pegaTema: function(idtema){ 1279 pegaTema: function(idtema){
1277 if(typeof(console) !== 'undefined'){console.info("i3GEO.arvoreDeCamadas.pegaTema()");} 1280 if(typeof(console) !== 'undefined'){console.info("i3GEO.arvoreDeCamadas.pegaTema()");}
1278 - var i,v = "", 1281 + var i,
  1282 + v = "",
1279 c = i3GEO.arvoreDeCamadas.CAMADAS.length; 1283 c = i3GEO.arvoreDeCamadas.CAMADAS.length;
1280 for (i=0; i<c; i += 1){ 1284 for (i=0; i<c; i += 1){
1281 if(i3GEO.arvoreDeCamadas.CAMADAS[i].name === idtema){ 1285 if(i3GEO.arvoreDeCamadas.CAMADAS[i].name === idtema){
classesjs/classe_interface.js
@@ -770,7 +770,7 @@ i3GEO.Interface = { @@ -770,7 +770,7 @@ i3GEO.Interface = {
770 i3GEO.ajuda.ativaLetreiro(i3GEO.parametros.mensagens); 770 i3GEO.ajuda.ativaLetreiro(i3GEO.parametros.mensagens);
771 i3GEO.idioma.mostraSeletor(); 771 i3GEO.idioma.mostraSeletor();
772 i3GEO.gadgets.mostraEscalaNumerica(); 772 i3GEO.gadgets.mostraEscalaNumerica();
773 - i3GEO.arvoreDeCamadas.ATIVATEMA = "i3GEO.Interface.openlayers.ligaDesliga(i3GEO.Interface)"; 773 + i3GEO.arvoreDeCamadas.ATIVATEMA = "i3GEO.Interface.openlayers.ligaDesliga(this)";
774 // 774 //
775 //i3GEO.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo) 775 //i3GEO.arvoreDeCamadas.CAMADAS é definido na inicialização (classe_i3geo)
776 // 776 //
@@ -825,16 +825,23 @@ i3GEO.Interface = { @@ -825,16 +825,23 @@ i3GEO.Interface = {
825 if(i3geoOL.getLayersByName(camada.name).length === 0){ 825 if(i3geoOL.getLayersByName(camada.name).length === 0){
826 urllayer = url+"&layer="+camada.name; 826 urllayer = url+"&layer="+camada.name;
827 try{ 827 try{
828 - if(camada.escondido === "sim" || camada.connectiontype === 10 || camada.type === 0 || camada.type === 4 || camada.type === 8 )  
829 - {opcoes.singleTile = true;}  
830 - else{  
831 - temp = camada.type === 3 ? opcoes.singleTile = false : opcoes.singleTile = !(i3GEO.Interface.openlayers.TILES);  
832 - }  
833 temp = camada.type === 0 ? opcoes.gutter = 20 : opcoes.gutter = 0; 828 temp = camada.type === 0 ? opcoes.gutter = 20 : opcoes.gutter = 0;
834 temp = camada.transitioneffect === "nao" ? opcoes.transitionEffect = "null" : opcoes.transitionEffect = "resize"; 829 temp = camada.transitioneffect === "nao" ? opcoes.transitionEffect = "null" : opcoes.transitionEffect = "resize";
  830 + if(camada.connectiontype === 7 && camada.wmsurl !== ""){
  831 + urllayer = camada.wmsurl;
  832 + layer = new OpenLayers.Layer.WMS(camada.name, urllayer,{format:camada.wmsformat,transparent:true},opcoes);
  833 + }
  834 + else{
  835 + if(camada.escondido === "sim" || camada.connectiontype === 10 || camada.type === 0 || camada.type === 4 || camada.type === 8 )
  836 + {opcoes.singleTile = true;}
  837 + else{
  838 + temp = camada.type === 3 ? opcoes.singleTile = false : opcoes.singleTile = !(i3GEO.Interface.openlayers.TILES);
  839 + }
  840 + layer = new OpenLayers.Layer.WMS(camada.name, urllayer,{map_imagetype:i3GEO.Interface.OUTPUTFORMAT},opcoes);
  841 + }
835 } 842 }
836 catch(e){} 843 catch(e){}
837 - layer = new OpenLayers.Layer.WMS(camada.name, urllayer,{map_imagetype:i3GEO.Interface.OUTPUTFORMAT},opcoes); 844 +
838 if(camada.escondido === "sim") 845 if(camada.escondido === "sim")
839 {layer.transitionEffect = "null";} 846 {layer.transitionEffect = "null";}
840 i3geoOL.addLayer(layer); 847 i3geoOL.addLayer(layer);
classesjs/classe_mapa.js
@@ -99,7 +99,8 @@ i3GEO.mapa = { @@ -99,7 +99,8 @@ i3GEO.mapa = {
99 codigo {string} - código da camada 99 codigo {string} - código da camada
100 */ 100 */
101 ativaTema: function(codigo){ 101 ativaTema: function(codigo){
102 - i3GEO.util.defineValor("arrastar_"+i3GEO.temaAtivo,"style.color",""); 102 + if(i3GEO.temaAtivo !== "")
  103 + {i3GEO.util.defineValor("arrastar_"+i3GEO.temaAtivo,"style.color","");}
103 i3GEO.temaAtivo = codigo; 104 i3GEO.temaAtivo = codigo;
104 i3GEO.util.defineValor("arrastar_"+codigo,"style.color","brown"); 105 i3GEO.util.defineValor("arrastar_"+codigo,"style.color","brown");
105 }, 106 },
classesphp/classe_mapa.php
@@ -241,6 +241,12 @@ string - javascript com os parametros @@ -241,6 +241,12 @@ string - javascript com os parametros
241 $aplicaextensao = "nao"; 241 $aplicaextensao = "nao";
242 if(strtoupper($oLayer->getmetadata("aplicaextensao")) == "SIM") 242 if(strtoupper($oLayer->getmetadata("aplicaextensao")) == "SIM")
243 {$aplicaextensao = "sim";} 243 {$aplicaextensao = "sim";}
  244 + $wmsurl = "";
  245 + $wmsformat = "";
  246 + if($ct == 7 && strtoupper($oLayer->getmetadata("cache")) != "SIM"){
  247 + $wmsurl = ($oLayer->connection)."&layers=".($oLayer->getmetadata("wms_name"))."&style=".($oLayer->getmetadata("wms_style"));
  248 + $wmsformat = $oLayer->getmetadata("wms_format");
  249 + }
244 $temas[] = array( 250 $temas[] = array(
245 "name"=>($oLayer->name), 251 "name"=>($oLayer->name),
246 "status"=>($oLayer->status), 252 "status"=>($oLayer->status),
@@ -264,7 +270,9 @@ string - javascript com os parametros @@ -264,7 +270,9 @@ string - javascript com os parametros
264 "permitecomentario"=>$permitecomentario, 270 "permitecomentario"=>$permitecomentario,
265 "exttema"=>$exttema, 271 "exttema"=>$exttema,
266 "aplicaextensao"=>$aplicaextensao, 272 "aplicaextensao"=>$aplicaextensao,
267 - "transitioneffect"=>$transitioneffect 273 + "transitioneffect"=>$transitioneffect,
  274 + "wmsurl"=>$wmsurl,
  275 + "wmsformat"=>$wmsformat
268 ); 276 );
269 } 277 }
270 } 278 }
interface/openlayers.htm
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <meta http-equiv="Category" content="I3Geo Mapa interativo MMA geoprocessamento sig mobile"> 4 <meta http-equiv="Category" content="I3Geo Mapa interativo MMA geoprocessamento sig mobile">
5 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> 5 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
6 <title>i3GEO - OpenLayers</title> 6 <title>i3GEO - OpenLayers</title>
7 -<script type="text/javascript" src="../classesjs/i3geo.js"></script> 7 +<script type="text/javascript" src="../classesjs/i3geonaocompacto.js"></script>
8 <script type="text/javascript" src="../pacotes/openlayers/OpenLayers29.js.php"></script> 8 <script type="text/javascript" src="../pacotes/openlayers/OpenLayers29.js.php"></script>
9 </head> 9 </head>
10 <body id="i3geo"> 10 <body id="i3geo">