Commit 84221d2bed89426384ced117c6393c6b60e27ce1

Authored by Edmar Moretti
1 parent d97b1a46

Alteração na forma como urls kml são inseridas no mapa

admin/admin.db
No preview for this file type
ferramentas/carregakml/index.js
@@ -150,12 +150,19 @@ i3GEOF.carregakml = { @@ -150,12 +150,19 @@ i3GEOF.carregakml = {
150 Adiciona o KML ao mapa 150 Adiciona o KML ao mapa
151 */ 151 */
152 adiciona: function(){ 152 adiciona: function(){
153 - if(i3GEOF.carregakml.aguarde.visibility === "visible")  
154 - {return;}  
155 - var url = $i("i3GEOcarregakmlurl").value; 153 + var url, temp, cp, p;
  154 + if(i3GEOF.carregakml.aguarde.visibility === "visible"){
  155 + return;
  156 + }
  157 + url = $i("i3GEOcarregakmlurl").value;
156 if(url !== ""){ 158 if(url !== ""){
157 - i3GEOF.carregakml.aguarde.visibility = "visible";  
158 - i3GEO.Interface[i3GEO.Interface.ATUAL].adicionaKml(false,url,url,true); 159 + temp = function(retorno){
  160 + i3GEO.atualiza();
  161 + };
  162 + cp = new cpaint();
  163 + cp.set_response_type("JSON");
  164 + p = i3GEO.configura.locaplic+"/ferramentas/carregakml/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=crialayer&url="+url;
  165 + cp.call(p,"foo",temp);
159 i3GEOF.carregakml.aguarde.visibility = "hidden"; 166 i3GEOF.carregakml.aguarde.visibility = "hidden";
160 } 167 }
161 } 168 }
ferramentas/conectarservicos/index.js
@@ -154,7 +154,7 @@ i3GEOF.conectarservicos = @@ -154,7 +154,7 @@ i3GEOF.conectarservicos =
154 * Cria a janela flutuante para controle da ferramenta. 154 * Cria a janela flutuante para controle da ferramenta.
155 */ 155 */
156 iniciaJanelaFlutuante : function() { 156 iniciaJanelaFlutuante : function() {
157 - var minimiza, cabecalho, janela, divid, temp, titulo; 157 + var minimiza, cabecalho, janela, divid, titulo;
158 if($i("i3GEOF.conectarservicos")){ 158 if($i("i3GEOF.conectarservicos")){
159 return; 159 return;
160 } 160 }
ferramentas/mascara/index.js
@@ -194,7 +194,7 @@ i3GEOF.mascara = { @@ -194,7 +194,7 @@ i3GEOF.mascara = {
194 + "&funcao=aplicar" 194 + "&funcao=aplicar"
195 + "&tema=" + tema 195 + "&tema=" + tema
196 + "&mascarar=" + mascarar.join(","); 196 + "&mascarar=" + mascarar.join(",");
197 - cp = new cpaint() 197 + cp = new cpaint();
198 fim = function(retorno){ 198 fim = function(retorno){
199 i3GEO.Interface.atualizaMapa(); 199 i3GEO.Interface.atualizaMapa();
200 i3GEOF.mascara.aguarde.visibility = "hidden"; 200 i3GEOF.mascara.aguarde.visibility = "hidden";
js/interface.js
@@ -728,7 +728,7 @@ i3GEO.Interface = @@ -728,7 +728,7 @@ i3GEO.Interface =
728 autoPanAnimation : { 728 autoPanAnimation : {
729 duration : 250 729 duration : 250
730 }, 730 },
731 - width : '200px', 731 + minWidth : '200px',
732 baloes : [] 732 baloes : []
733 }, 733 },
734 balao : function(texto, completo, x, y) { 734 balao : function(texto, completo, x, y) {
@@ -748,7 +748,7 @@ i3GEO.Interface = @@ -748,7 +748,7 @@ i3GEO.Interface =
748 removeBaloes(); 748 removeBaloes();
749 } 749 }
750 painel = document.createElement("div"); 750 painel = document.createElement("div");
751 - painel.style.width = p.width; 751 + painel.style.minWidth = p.minWidth;
752 painel.className = "ol-popup"; 752 painel.className = "ol-popup";
753 753
754 cabecalho = document.createElement("div"); 754 cabecalho = document.createElement("div");
@@ -972,7 +972,6 @@ i3GEO.Interface = @@ -972,7 +972,6 @@ i3GEO.Interface =
972 // insere a lista de layers de fundo 972 // insere a lista de layers de fundo
973 // 973 //
974 temp = $i("listaLayersBase"); 974 temp = $i("listaLayersBase");
975 - // FIXME testar isso  
976 if (temp && i3GEO.arvoreDeCamadas.INCLUILFUNDO === false) { 975 if (temp && i3GEO.arvoreDeCamadas.INCLUILFUNDO === false) {
977 // 976 //
978 // torna false a variavel que pode permitir que as camadas de fundo 977 // torna false a variavel que pode permitir que as camadas de fundo
@@ -1058,9 +1057,6 @@ i3GEO.Interface = @@ -1058,9 +1057,6 @@ i3GEO.Interface =
1058 // verifica se nas preferencias existem ferramentas que devem ser 1057 // verifica se nas preferencias existem ferramentas que devem ser
1059 // abertas 1058 // abertas
1060 i3GEO.configura.iniciaFerramentas.executa(); 1059 i3GEO.configura.iniciaFerramentas.executa();
1061 -  
1062 - // FIXME nao esta funcionando  
1063 - // i3GEO.Interface.openlayers.sobeLayersGraficos();  
1064 }, 1060 },
1065 /** 1061 /**
1066 * Aplica um valor de opacidade aos layers do mapa 1062 * Aplica um valor de opacidade aos layers do mapa
@@ -1217,68 +1213,48 @@ i3GEO.Interface = @@ -1217,68 +1213,48 @@ i3GEO.Interface =
1217 insereLayerKml : function(id, url) { 1213 insereLayerKml : function(id, url) {
1218 var l, temp; 1214 var l, temp;
1219 url = i3GEO.configura.locaplic + "/classesphp/proxy.php?url=" + url; 1215 url = i3GEO.configura.locaplic + "/classesphp/proxy.php?url=" + url;
1220 - /*  
1221 - * eval(id + " = new OpenLayers.Layer.Vector('" + id + "',  
1222 - * {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new  
1223 - * OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '" + url + "',format: new  
1224 - * OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})"); eval("i3geoOL.addLayer(" + id +  
1225 - * ");"); eval("temp = " + id + ".div;");  
1226 - */  
1227 - l = new OpenLayers.Layer.Vector(id, {  
1228 - displayOutsideMaxExtent : true,  
1229 - displayInLayerSwitcher : false,  
1230 - visibility : true,  
1231 - strategies : [  
1232 - new OpenLayers.Strategy.Fixed()  
1233 - ],  
1234 - protocol : new OpenLayers.Protocol.HTTP({ 1216 + l = new ol.layer.Vector({
  1217 + title : url,
  1218 + name : id,
  1219 + isBaseLayer : false,
  1220 + source : new ol.source.Vector({
1235 url : url, 1221 url : url,
1236 - format : new OpenLayers.Format.KML({  
1237 - extractStyles : true,  
1238 - extractAttributes : true,  
1239 - maxDepth : 5  
1240 - }) 1222 + format : new ol.format.KML({
  1223 + extractStyles : true
  1224 + }),
  1225 + tipoServico : "kml"
1241 }) 1226 })
1242 }); 1227 });
1243 i3geoOL.addLayer(l); 1228 i3geoOL.addLayer(l);
1244 - temp = l.div;  
1245 - temp.onclick =  
1246 - function(e) {  
1247 - var targ = "", id, temp, features, n, i, j = "", html = "";  
1248 - if (!e) {  
1249 - e = window.event;  
1250 - }  
1251 - if (e.target) {  
1252 - targ = e.target;  
1253 - } else if (e.srcElement) {  
1254 - targ = e.srcElement;  
1255 - }  
1256 - if (targ.id) {  
1257 - temp = targ.id.split("_Point");  
1258 - if (temp[0] === "OpenLayers_Geometry") {  
1259 - id = targ.id;  
1260 - temp = i3geoOL.getLayer(this.id);  
1261 - features = temp.features;  
1262 - n = features.length;  
1263 - for (i = 0; i < n; i++) {  
1264 - if (features[i].geometry.id === id) {  
1265 - for (j in features[i].attributes) {  
1266 - html += j + ": " + features[i].attributes[j];  
1267 - }  
1268 - g = features[i].geometry;  
1269 - i3geoOL.addPopup(new OpenLayers.Popup.FramedCloud(  
1270 - "kml",  
1271 - new OpenLayers.LonLat(g.x, g.y),  
1272 - null,  
1273 - html,  
1274 - null,  
1275 - true)); 1229 + temp = function(pixel) {
  1230 + var feature, chaves, c, i = 0, html = "", prop, g;
1276 1231
1277 - }  
1278 - } 1232 + feature = i3geoOL.forEachFeatureAtPixel(pixel, function(feature, layer) {
  1233 + return feature;
  1234 + });
  1235 + if (feature) {
  1236 + i3GEO.Interface.openlayers.BALAOPROP.removeAoAdicionar = false;
  1237 + i3GEO.Interface.openlayers.BALAOPROP.classeCadeado = "i3GEOiconeFechado";
  1238 + chaves = feature.getKeys();
  1239 + prop = feature.getProperties();
  1240 + c = chaves.length;
  1241 + for (i = 0; i < c; i++) {
  1242 + if (chaves[i] != "geometry" && chaves[i] != "styleUrl") {
  1243 + html += chaves[i] + ": " + prop[chaves[i]];
1279 } 1244 }
1280 } 1245 }
1281 - }; 1246 + g = feature.getGeometry().getCoordinates();
  1247 + i3GEO.Interface.openlayers.balao(html, "", g[0], g[1], "kml");
  1248 + }
  1249 + };
  1250 + i3geoOL.on('click', function(evt) {
  1251 + evt.stopPropagation();
  1252 + evt.preventDefault();
  1253 + if (evt.dragging) {
  1254 + return;
  1255 + }
  1256 + temp(i3geoOL.getEventPixel(evt.originalEvent));
  1257 + });
1282 }, 1258 },
1283 ativaDesativaCamadaKml : function(obj, url) { 1259 ativaDesativaCamadaKml : function(obj, url) {
1284 if (!obj.checked) { 1260 if (!obj.checked) {
@@ -1378,7 +1354,7 @@ i3GEO.Interface = @@ -1378,7 +1354,7 @@ i3GEO.Interface =
1378 && camada.wmsurl !== "" 1354 && camada.wmsurl !== ""
1379 && camada.usasld.toLowerCase() != "sim") { 1355 && camada.usasld.toLowerCase() != "sim") {
1380 urllayer = camada.wmsurl; 1356 urllayer = camada.wmsurl;
1381 - if (camada.wmstile == 10){ 1357 + if (camada.wmstile == 10) {
1382 // TODO testar isso 1358 // TODO testar isso
1383 source = new ol.source.WMTS({ 1359 source = new ol.source.WMTS({
1384 url : urllayer, 1360 url : urllayer,
@@ -1470,7 +1446,9 @@ i3GEO.Interface = @@ -1470,7 +1446,9 @@ i3GEO.Interface =
1470 opcoes.name = camada.name; 1446 opcoes.name = camada.name;
1471 } 1447 }
1472 source.set("name", camada.name); 1448 source.set("name", camada.name);
1473 - source.set("parametrosUrl", {par : ""}); 1449 + source.set("parametrosUrl", {
  1450 + par : ""
  1451 + });
1474 opcoes.source = source; 1452 opcoes.source = source;
1475 opcoes.isBaseLayer = false; 1453 opcoes.isBaseLayer = false;
1476 opcoes.visible = true; 1454 opcoes.visible = true;
@@ -1571,15 +1549,15 @@ i3GEO.Interface = @@ -1571,15 +1549,15 @@ i3GEO.Interface =
1571 param[parametro] = valor; 1549 param[parametro] = valor;
1572 chaves = i3GEO.util.listaTodasChaves(param); 1550 chaves = i3GEO.util.listaTodasChaves(param);
1573 n = chaves.length; 1551 n = chaves.length;
1574 - for(j = 0; j < n; j++){ 1552 + for (j = 0; j < n; j++) {
1575 k = chaves[j]; 1553 k = chaves[j];
1576 - if(param[k] != "" && k != "par"){ 1554 + if (param[k] != "" && k != "par") {
1577 url += "&" + k + "=" + param[k]; 1555 url += "&" + k + "=" + param[k];
1578 } 1556 }
1579 } 1557 }
1580 param.par = url; 1558 param.par = url;
1581 console.info(url); 1559 console.info(url);
1582 - source.set("parametrosUrl",param); 1560 + source.set("parametrosUrl", param);
1583 } 1561 }
1584 } 1562 }
1585 }, 1563 },
@@ -1713,10 +1691,9 @@ i3GEO.Interface = @@ -1713,10 +1691,9 @@ i3GEO.Interface =
1713 */ 1691 */
1714 atualizaTema : function(retorno, tema) { 1692 atualizaTema : function(retorno, tema) {
1715 var layer = i3geoOL.getLayersByName(tema), objtemas, funcaoLoad, servico, source; 1693 var layer = i3geoOL.getLayersByName(tema), objtemas, funcaoLoad, servico, source;
1716 - if(layer.length == 0){ 1694 + if (layer.length == 0) {
1717 return ""; 1695 return "";
1718 - }  
1719 - else{ 1696 + } else {
1720 layer = layer[0]; 1697 layer = layer[0];
1721 } 1698 }
1722 if (layer && layer != undefined) { 1699 if (layer && layer != undefined) {
@@ -1778,11 +1755,11 @@ i3GEO.Interface = @@ -1778,11 +1755,11 @@ i3GEO.Interface =
1778 // 1755 //
1779 i3geoOL.on("pointerdrag", function(e) { 1756 i3geoOL.on("pointerdrag", function(e) {
1780 i3GEO.Interface.STATUS.pan = true; 1757 i3GEO.Interface.STATUS.pan = true;
1781 - var xy; 1758 + //var xy;
1782 modoAtual = "move"; 1759 modoAtual = "move";
1783 i3GEO.barraDeBotoes.BOTAOCLICADO = "pan"; 1760 i3GEO.barraDeBotoes.BOTAOCLICADO = "pan";
1784 - xy = i3GEO.navega.centroDoMapa();  
1785 - i3GEO.navega.marcaCentroDoMapa(xy); 1761 + //xy = i3GEO.navega.centroDoMapa();
  1762 + //i3GEO.navega.marcaCentroDoMapa(xy);
1786 }); 1763 });
1787 i3geoOL.on("click", function(e) { 1764 i3geoOL.on("click", function(e) {
1788 e.stopPropagation(); 1765 e.stopPropagation();
@@ -2594,10 +2571,10 @@ i3GEO.Interface = @@ -2594,10 +2571,10 @@ i3GEO.Interface =
2594 i3GEOtouchesPosMapa = ""; 2571 i3GEOtouchesPosMapa = "";
2595 modoAtual = ""; 2572 modoAtual = "";
2596 google.maps.event.addListener(i3GeoMap, "dragstart", function() { 2573 google.maps.event.addListener(i3GeoMap, "dragstart", function() {
2597 - var xy; 2574 + //var xy;
2598 modoAtual = "move"; 2575 modoAtual = "move";
2599 - xy = i3GEO.navega.centroDoMapa();  
2600 - i3GEO.navega.marcaCentroDoMapa(xy); 2576 + //xy = i3GEO.navega.centroDoMapa();
  2577 + //i3GEO.navega.marcaCentroDoMapa(xy);
2601 i3GEO.eventos.cliquePerm.status = false; 2578 i3GEO.eventos.cliquePerm.status = false;
2602 }); 2579 });
2603 google.maps.event.addListener(i3GeoMap, "dragend", function() { 2580 google.maps.event.addListener(i3GeoMap, "dragend", function() {
@@ -1389,7 +1389,12 @@ i3GEO.mapa = @@ -1389,7 +1389,12 @@ i3GEO.mapa =
1389 return; 1389 return;
1390 } 1390 }
1391 var ntemas, etiquetas, j, retorna, x = objposicaocursor.ddx, y = objposicaocursor.ddy; 1391 var ntemas, etiquetas, j, retorna, x = objposicaocursor.ddx, y = objposicaocursor.ddy;
1392 - 1392 + if(x === -1 || y === -1){
  1393 + return;
  1394 + }
  1395 + //para evitar duplo clique
  1396 + objposicaocursor.ddx = -1;
  1397 + objposicaocursor.ddy = -1;
1393 ntemas = i3GEO.arvoreDeCamadas.CAMADAS.length; 1398 ntemas = i3GEO.arvoreDeCamadas.CAMADAS.length;
1394 etiquetas = false; 1399 etiquetas = false;
1395 for (j = 0; j < ntemas; j += 1) { 1400 for (j = 0; j < ntemas; j += 1) {
js/plugini3geo.js
@@ -894,66 +894,51 @@ i3GEO.pluginI3geo = @@ -894,66 +894,51 @@ i3GEO.pluginI3geo =
894 return []; 894 return [];
895 }, 895 },
896 inicia : function(camada, objMapa) { 896 inicia : function(camada, objMapa) {
897 - var layerkml; 897 + var layerkml, url, temp;
898 url = i3GEO.configura.locaplic + "/classesphp/proxy.php?url=" + camada.plugini3geo.parametros.url; 898 url = i3GEO.configura.locaplic + "/classesphp/proxy.php?url=" + camada.plugini3geo.parametros.url;
899 - layerkml = new OpenLayers.Layer.Vector(camada.name, {  
900 - displayOutsideMaxExtent : true,  
901 - displayInLayerSwitcher : false,  
902 - visibility : true,  
903 - strategies : [  
904 - new OpenLayers.Strategy.Fixed()  
905 - ],  
906 - protocol : new OpenLayers.Protocol.HTTP({ 899 + layerkml = new ol.layer.Vector({
  900 + name : camada.name,
  901 + isBaseLayer : false,
  902 + source : new ol.source.Vector({
907 url : url, 903 url : url,
908 - format : new OpenLayers.Format.KML({  
909 - extractStyles : true,  
910 - extractAttributes : true,  
911 - maxDepth : 5  
912 - }) 904 + format : new ol.format.KML({
  905 + extractStyles : true
  906 + }),
  907 + tipoServico : "kml"
913 }) 908 })
914 }); 909 });
915 i3geoOL.addLayer(layerkml); 910 i3geoOL.addLayer(layerkml);
916 -  
917 if (!objMapa) { 911 if (!objMapa) {
918 objMapa = i3geoOL; 912 objMapa = i3geoOL;
919 } 913 }
920 - layerkml.div.onclick =  
921 - function(e) {  
922 - var targ = "", id, temp, features, n, i, j = "", html = "";  
923 - if (!e) {  
924 - e = window.event;  
925 - }  
926 - if (e.target) {  
927 - targ = e.target;  
928 - } else if (e.srcElement) {  
929 - targ = e.srcElement;  
930 - }  
931 - if (targ.id) {  
932 - temp = targ.id.split("_Point");  
933 - if (temp[0] === "OpenLayers_Geometry") {  
934 - id = targ.id;  
935 - temp = i3geoOL.getLayer(this.id);  
936 - features = temp.features;  
937 - n = features.length;  
938 - for (i = 0; i < n; i++) {  
939 - if (features[i].geometry.id === id) {  
940 - for (j in features[i].attributes) {  
941 - html += j + ": " + features[i].attributes[j];  
942 - }  
943 - g = features[i].geometry;  
944 - i3geoOL.addPopup(new OpenLayers.Popup.FramedCloud(  
945 - "kml",  
946 - new OpenLayers.LonLat(g.x, g.y),  
947 - null,  
948 - html,  
949 - null,  
950 - true));  
951 -  
952 - }  
953 - } 914 + temp = function(pixel) {
  915 + var feature, chaves, c, i = 0, html = "", prop, g;
  916 + feature = i3geoOL.forEachFeatureAtPixel(pixel, function(feature, layer) {
  917 + return feature;
  918 + });
  919 + if (feature) {
  920 + i3GEO.Interface.openlayers.BALAOPROP.removeAoAdicionar = false;
  921 + i3GEO.Interface.openlayers.BALAOPROP.classeCadeado = "i3GEOiconeFechado";
  922 + chaves = feature.getKeys();
  923 + prop = feature.getProperties();
  924 + c = chaves.length;
  925 + for (i = 0; i < c; i++) {
  926 + if (chaves[i] != "geometry" && chaves[i] != "styleUrl") {
  927 + html += chaves[i] + ": " + prop[chaves[i]];
954 } 928 }
955 } 929 }
956 - }; 930 + g = feature.getGeometry().getCoordinates();
  931 + i3GEO.Interface.openlayers.balao(html, "", g[0], g[1], "kml");
  932 + }
  933 + };
  934 + i3geoOL.on('click', function(evt) {
  935 + evt.stopPropagation();
  936 + evt.preventDefault();
  937 + if (evt.dragging) {
  938 + return;
  939 + }
  940 + temp(i3geoOL.getEventPixel(evt.originalEvent));
  941 + });
957 942
958 i3GEO.janela.fechaAguarde("aguardePlugin"); 943 i3GEO.janela.fechaAguarde("aguardePlugin");
959 i3GEO.eventos.cliquePerm.ativo = false; 944 i3GEO.eventos.cliquePerm.ativo = false;
temas/_lmapakml.map
@@ -2,7 +2,6 @@ MAP @@ -2,7 +2,6 @@ MAP
2 FONTSET "../symbols/fontes.txt" 2 FONTSET "../symbols/fontes.txt"
3 SYMBOLSET "../symbols/simbolosv6.sym" 3 SYMBOLSET "../symbols/simbolosv6.sym"
4 LAYER 4 LAYER
5 -  
6 METADATA 5 METADATA
7 "CLASSE" "SIM" 6 "CLASSE" "SIM"
8 "PLUGINI3GEO" '{"plugin":"layerkml","parametros":{"url":"http://dev.openlayers.org/examples/kml/sundials.kml"}}' 7 "PLUGINI3GEO" '{"plugin":"layerkml","parametros":{"url":"http://dev.openlayers.org/examples/kml/sundials.kml"}}'
@@ -22,6 +21,4 @@ MAP @@ -22,6 +21,4 @@ MAP
22 END # STYLE 21 END # STYLE
23 END # CLASS 22 END # CLASS
24 END # LAYER 23 END # LAYER
25 -  
26 -END # MAP  
27 - 24 +END # MAP
28 \ No newline at end of file 25 \ No newline at end of file