Commit 28cecf2e816fa449ac090887c621c9c9b83708dc

Authored by Edmar Moretti
1 parent 79b4dd08

-

ferramentas/editorol/editorol.js
... ... @@ -165,6 +165,8 @@ i3GEO.editorOL =
165 165 fundo : "e_ims,e_wsm,ol_mma,ol_wms,top_wms",
166 166 kml : [],
167 167 layersIniciais : [],
  168 + //essa configuracao dos botoes afeta apenas o mashup
  169 + //para a configuração do editor dentro de um mapa normal, veja i3GEO.barraDebotoes.editor.ativaPainel()
168 170 botoes : {
169 171 'pan' : true,
170 172 'zoombox' : true,
... ... @@ -359,10 +361,11 @@ i3GEO.editorOL =
359 361 i3GEO.desenho.openlayers.criaLayerGrafico();
360 362 },
361 363 layersLigados : function() {
362   - var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length, ins = [], i;
  364 + var l, layers = i3GEO.editorOL.mapa.getLayers(), nlayers = layers.getLength(), ins = [], i;
363 365 for (i = 0; i < nlayers; i++) {
364   - if (layers[i].visibility === true) {
365   - ins.push(layers[i]);
  366 + l = layers.item(i);
  367 + if (l.getVisible() === true) {
  368 + ins.push(l);
366 369 }
367 370 }
368 371 return ins;
... ... @@ -668,13 +671,15 @@ i3GEO.editorOL =
668 671 i3GEO.editorOL.mapa.zoomToExtent(b);
669 672 },
670 673 mostraLegenda : function() {
  674 + //TODO testar no mashup
671 675 var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, ins = "", i, icone = "", url, fers, f = "", fer = "";
672 676 for (i = 0; i < nlayers; i++) {
673 677 try {
674   - if (layers[i].isBaseLayer === false) {
  678 + if (layers[i].get("isBaseLayer") === false) {
675 679 url = layers[i].getFullRequestString({
676 680 "request" : "getlegendgraphic"
677 681 });
  682 + //i3GEO.editorOL.mapa.getLayers().item(0).getSource().getUrls()[0]
678 683 icone = "";
679 684 if (i3GEO.editorOL.legendahtml === true) {
680 685 // os parametros FORMAT e SERVICE sao inseridos de forma redundante para grantir
... ... @@ -1015,236 +1020,90 @@ i3GEO.editorOL =
1015 1020 i3GEOpanelEditor.appendChild(temp);
1016 1021 largura += 30;
1017 1022 }
1018   - i3GEOpanelEditor.style.width = largura + "px";
1019   - //i3GEO.editorOL.mapa.getTargetElement().appendChild(i3GEOpanelEditor);
1020   - //i3GEO.editorOL.mapa.getViewport().appendChild(i3GEOpanelEditor);
1021   - i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor);
1022   -
1023   - /*
1024   - i3GEOpanelEditor = new OpenLayers.Control.Panel({
1025   - displayClass : "olControlEditingToolbar1 noprint",
1026   - saveState : false,
1027   - activateControl : function(c) {
1028   - this.deactivate();
1029   - this.activate();
1030   - try {
1031   - i3GEO.editorOL.ModifyFeature.deactivate();
1032   - if (i3GEO && i3GEO.barraDeBotoes) {
1033   - i3GEO.barraDeBotoes.ativaPadrao();
1034   - }
1035   - } catch (e) {
1036   - }
1037   - if (!c.trigger) {
1038   - c.activate();
1039   - } else {
1040   - c.trigger.call();
1041   - }
1042   - }
1043   - });
1044   - if (botoes.procura === false) {
1045   - button = new OpenLayers.Control.Button({
1046   - displayClass : "editorOLprocura",
1047   - trigger : function() {
1048   - YAHOO.procura.container.panel.show();
1049   - },
1050   - title : $trad("t23"),
1051   - type : OpenLayers.Control.TYPE_BUTTON
1052   - });
1053   - controles.push(button);
1054   - adiciona = true;
1055   - }
1056 1023 if (botoes.pan === true) {
1057   - controles.push(new OpenLayers.Control.Navigation({
1058   - title : "pan",
1059   - displayClass : "editorOLpan",
1060   - type : OpenLayers.Control.TYPE_TOOL
1061   - }));
1062   - adiciona = true;
  1024 + temp = document.createElement("div");
  1025 + temp.className = "editorOLpanItemInactive olButton";
  1026 + temp.title = "pan";
  1027 + temp.onclick = function(){
  1028 + };
  1029 + i3GEOpanelEditor.appendChild(temp);
  1030 + largura += 30;
1063 1031 }
1064 1032 if (botoes.zoombox === true) {
1065   - controles.push(new OpenLayers.Control.ZoomBox({
1066   - title : "zoombox",
1067   - displayClass : "editorOLzoombox",
1068   - type : OpenLayers.Control.TYPE_TOOL
1069   - }));
1070   - adiciona = true;
  1033 + temp = document.createElement("div");
  1034 + temp.className = "editorOLzoomboxItemInactive olButton";
  1035 + temp.title = "zoombox";
  1036 + temp.onclick = i3GEO.barraDeBotoes.defBotao("zoomli").funcaoonclick;
  1037 + i3GEOpanelEditor.appendChild(temp);
  1038 + largura += 30;
1071 1039 }
1072 1040 if (botoes.zoomtot === true) {
1073   - button = new OpenLayers.Control.Button({
1074   - displayClass : "editorOLzoomtot",
1075   - trigger : function() {
1076   - if (i3GEO.editorOL.mapext && i3GEO.editorOL.mapext != "") {
1077   - i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext);
1078   - } else {
1079   - i3GEO.editorOL.mapa.zoomToMaxExtent();
1080   - }
1081   - },
1082   - title : $trad("d2t"),
1083   - type : OpenLayers.Control.TYPE_BUTTON
1084   - });
1085   - controles.push(button);
1086   - adiciona = true;
  1041 + temp = document.createElement("div");
  1042 + temp.className = "editorOLzoomtotItemInactive olButton";
  1043 + temp.title = $trad("d2t");
  1044 + temp.onclick = function(){
  1045 + if (i3GEO.editorOL.mapext && i3GEO.editorOL.mapext != "") {
  1046 + i3GEO.Interface.openlayers.zoom2ext(i3GEO.editorOL.mapext.join(" "));
  1047 + } else {
  1048 + i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal);
  1049 + }
  1050 + };
  1051 + i3GEOpanelEditor.appendChild(temp);
  1052 + largura += 30;
1087 1053 }
1088 1054 if (botoes.zoomin === true) {
1089   - button = new OpenLayers.Control.Button({
1090   - displayClass : "editorOLzoomin",
1091   - trigger : function() {
1092   - i3GEO.editorOL.mapa.zoomIn();
1093   - },
1094   - title : $trad("d5t"),
1095   - type : OpenLayers.Control.TYPE_BUTTON
1096   - });
1097   - controles.push(button);
1098   - adiciona = true;
  1055 + temp = document.createElement("div");
  1056 + temp.className = "editorOLzoominItemInactive olButton";
  1057 + temp.title = $trad("d5t");
  1058 + temp.onclick = function(){
  1059 + var v = i3GEO.editorOL.mapa.getView();
  1060 + v.setZoom(v.getZoom() + 1);
  1061 + };
  1062 + i3GEOpanelEditor.appendChild(temp);
  1063 + largura += 30;
1099 1064 }
1100 1065 if (botoes.zoomout === true) {
1101   - button = new OpenLayers.Control.Button({
1102   - displayClass : "editorOLzoomout",
1103   - trigger : function() {
1104   - i3GEO.editorOL.mapa.zoomOut();
1105   - },
1106   - title : $trad("d6t"),
1107   - type : OpenLayers.Control.TYPE_BUTTON
1108   - });
1109   - controles.push(button);
1110   - adiciona = true;
  1066 + temp = document.createElement("div");
  1067 + temp.className = "editorOLzoomoutItemInactive olButton";
  1068 + temp.title = $trad("d5t");
  1069 + temp.onclick = function(){
  1070 + var v = i3GEO.editorOL.mapa.getView();
  1071 + v.setZoom(v.getZoom() - 1);
  1072 + };
  1073 + i3GEOpanelEditor.appendChild(temp);
  1074 + largura += 30;
1111 1075 }
1112 1076 if (botoes.legenda === true) {
1113   - button = new OpenLayers.Control.Button({
1114   - displayClass : "editorOLlegenda",
1115   - trigger : function() {
1116   - i3GEO.editorOL.mostraLegenda();
1117   - },
1118   - title : $trad("p3"),
1119   - type : OpenLayers.Control.TYPE_BUTTON
1120   - });
1121   - controles.push(button);
1122   - adiciona = true;
  1077 + temp = document.createElement("div");
  1078 + temp.className = "editorOLlegendaItemInactive olButton";
  1079 + temp.title = $trad("p3");
  1080 + temp.onclick = function(){
  1081 + i3GEO.editorOL.mostraLegenda();
  1082 + };
  1083 + i3GEOpanelEditor.appendChild(temp);
  1084 + largura += 30;
1123 1085 }
1124 1086 if (botoes.distancia === true) {
1125   - button = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, {
1126   - handlerOptions : {
1127   - layerOptions : {
1128   - styleMap : styleMap
1129   - }
1130   - },
1131   - persist : true,
1132   - displayClass : "editorOLdistancia",
1133   - title : $trad("d21t"),
1134   - type : OpenLayers.Control.TYPE_TOOL
1135   - });
1136   - button.events.on({
1137   - "measure" : function(event) {
1138   - var units = event.units, measure = event.measure;
1139   - alert($trad("d21t") + ": " + measure.toFixed(3) + " " + units);
1140   - }
1141   - });
1142   - controles.push(button);
1143   - adiciona = true;
  1087 + temp = document.createElement("div");
  1088 + temp.className = "editorOLdistanciaItemInactive olButton";
  1089 + temp.title = $trad("d21t");
  1090 + temp.onclick = i3GEO.barraDeBotoes.defBotao("mede").funcaoonclick;
  1091 + i3GEOpanelEditor.appendChild(temp);
  1092 + largura += 30;
1144 1093 }
1145 1094 if (botoes.area === true) {
1146   - button = new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon, {
1147   - handlerOptions : {
1148   - layerOptions : {
1149   - styleMap : styleMap
1150   - }
1151   - },
1152   - persist : true,
1153   - displayClass : "editorOLarea",
1154   - title : $trad("d21at"),
1155   - type : OpenLayers.Control.TYPE_TOOL
1156   - });
1157   - button.events.on({
1158   - "measure" : function(event) {
1159   - var units = event.units;
1160   - var measure = event.measure;
1161   - alert($trad("d21at") + ": " + measure.toFixed(3) + " " + units + "2");
1162   - }
1163   - });
1164   - controles.push(button);
1165   - adiciona = true;
1166   - }
1167   - if (botoes.identifica === true) {
1168   - //TODO incluir codigo ol3
1169   -
1170   - botaoIdentifica =
1171   - new OpenLayers.Control.WMSGetFeatureInfo(
1172   - {
1173   - maxFeatures : 1,
1174   - infoFormat : 'text/plain', // 'application/vnd.ogc.gml',
1175   - layers : [
1176   - i3GEO.editorOL.layerAtivo()
1177   - ],
1178   - queryVisible : true,
1179   - title : $trad("d7t"),
1180   - type : OpenLayers.Control.TYPE_TOOL,
1181   - displayClass : "editorOLidentifica",
1182   - eventListeners : {
1183   - getfeatureinfo : function(event) {
1184   - var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), lonlattexto = "<hr>", formata;
1185   - if (botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true) {
1186   - lonlattexto +=
1187   - "<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\"" + lonlat.lon
1188   - + ","
1189   - + lonlat.lat
1190   - + "\")'>edita geometria</span></pre><br>";
1191   - }
1192   - formata = function(texto) {
1193   - var temp, temp1, n, i, f = [], textoN = texto.split(":");
1194   - try {
1195   - if (textoN.length > 1) {
1196   - temp = textoN[2].replace(/\n\r/g, "");
1197   - temp = temp.replace(/'/g, "");
1198   - temp = temp.replace(/\n/g, "|");
1199   - temp = temp.replace(/_/g, " ");
1200   - temp = temp.replace(/=/g, ":");
1201   - temp = temp.split("|");
1202   - n = temp.length;
1203   - for (i = 0; i < n; i++) {
1204   - temp1 = temp[i].replace(/^\s+/, "");
1205   - temp1 = temp1.replace(/\s+$/, "");
1206   - if (temp1 != "")
1207   - f.push(temp1);
1208   - }
1209   - texto = f.join("<br><br>");
1210   - }
1211   - } catch (e) {
1212   - }
1213   - return texto;
1214   - };
1215   - i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken", i3GEO.editorOL.mapa
1216   - .getLonLatFromPixel(event.xy), null, "<div style=text-align:left >" + lonlattexto
1217   - + "<pre>"
1218   - + formata(event.text)
1219   - + "</pre></div>", null, true));
1220   - i3GEO.editorOL.removeClone();
1221   - },
1222   - beforegetfeatureinfo : function(event) {
1223   - var ativo = [
1224   - i3GEO.editorOL.layerAtivo()
1225   - ];
1226   - // se for TMS tem de pegar o clone wms
1227   - if (ativo[0].serviceVersion === "&tms=" || ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"
1228   - || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM") {
1229   - ativo = [
1230   - i3GEO.editorOL.layertms2wms(ativo[0])
1231   - ];
1232   - }
1233   - ativo[0].projection = new OpenLayers.Projection("EPSG:4326");
1234   - event.object.layers = ativo;
1235   - botaoIdentifica.layers = ativo;
1236   - botaoIdentifica.url = ativo[0].url;
1237   - },
1238   - activate : function() {
1239   - i3GEO.editorOL.criaJanelaAtivaTema();
1240   - }
1241   - }
1242   - });
1243   - // button.events.register("getfeatureinfo", this, showInfo);
1244   - controles.push(botaoIdentifica);
1245   - adiciona = true;
1246   -
  1095 + temp = document.createElement("div");
  1096 + temp.className = "editorOLareaItemInactive olButton";
  1097 + temp.title = $trad("d21at");
  1098 + temp.onclick = i3GEO.barraDeBotoes.defBotao("area").funcaoonclick;
  1099 + i3GEOpanelEditor.appendChild(temp);
  1100 + largura += 30;
1247 1101 }
  1102 + i3GEOpanelEditor.style.width = largura + "px";
  1103 + i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor);
  1104 +
  1105 + /*
  1106 +
1248 1107 if (botoes.linha === true) {
1249 1108  
1250 1109 button = new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico, OpenLayers.Handler.Path, {
... ... @@ -1669,6 +1528,88 @@ i3GEO.editorOL =
1669 1528 adiciona = true;
1670 1529  
1671 1530 }
  1531 + if (botoes.identifica === true) {
  1532 + //TODO incluir codigo ol3
  1533 +
  1534 + botaoIdentifica =
  1535 + new OpenLayers.Control.WMSGetFeatureInfo(
  1536 + {
  1537 + maxFeatures : 1,
  1538 + infoFormat : 'text/plain', // 'application/vnd.ogc.gml',
  1539 + layers : [
  1540 + i3GEO.editorOL.layerAtivo()
  1541 + ],
  1542 + queryVisible : true,
  1543 + title : $trad("d7t"),
  1544 + type : OpenLayers.Control.TYPE_TOOL,
  1545 + displayClass : "editorOLidentifica",
  1546 + eventListeners : {
  1547 + getfeatureinfo : function(event) {
  1548 + var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy), lonlattexto = "<hr>", formata;
  1549 + if (botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true) {
  1550 + lonlattexto +=
  1551 + "<pre><span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\"" + lonlat.lon
  1552 + + ","
  1553 + + lonlat.lat
  1554 + + "\")'>edita geometria</span></pre><br>";
  1555 + }
  1556 + formata = function(texto) {
  1557 + var temp, temp1, n, i, f = [], textoN = texto.split(":");
  1558 + try {
  1559 + if (textoN.length > 1) {
  1560 + temp = textoN[2].replace(/\n\r/g, "");
  1561 + temp = temp.replace(/'/g, "");
  1562 + temp = temp.replace(/\n/g, "|");
  1563 + temp = temp.replace(/_/g, " ");
  1564 + temp = temp.replace(/=/g, ":");
  1565 + temp = temp.split("|");
  1566 + n = temp.length;
  1567 + for (i = 0; i < n; i++) {
  1568 + temp1 = temp[i].replace(/^\s+/, "");
  1569 + temp1 = temp1.replace(/\s+$/, "");
  1570 + if (temp1 != "")
  1571 + f.push(temp1);
  1572 + }
  1573 + texto = f.join("<br><br>");
  1574 + }
  1575 + } catch (e) {
  1576 + }
  1577 + return texto;
  1578 + };
  1579 + i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud("chicken", i3GEO.editorOL.mapa
  1580 + .getLonLatFromPixel(event.xy), null, "<div style=text-align:left >" + lonlattexto
  1581 + + "<pre>"
  1582 + + formata(event.text)
  1583 + + "</pre></div>", null, true));
  1584 + i3GEO.editorOL.removeClone();
  1585 + },
  1586 + beforegetfeatureinfo : function(event) {
  1587 + var ativo = [
  1588 + i3GEO.editorOL.layerAtivo()
  1589 + ];
  1590 + // se for TMS tem de pegar o clone wms
  1591 + if (ativo[0].serviceVersion === "&tms=" || ativo[0].CLASS_NAME == "OpenLayers.Layer.TMS"
  1592 + || ativo[0].CLASS_NAME == "OpenLayers.Layer.OSM") {
  1593 + ativo = [
  1594 + i3GEO.editorOL.layertms2wms(ativo[0])
  1595 + ];
  1596 + }
  1597 + ativo[0].projection = new OpenLayers.Projection("EPSG:4326");
  1598 + event.object.layers = ativo;
  1599 + botaoIdentifica.layers = ativo;
  1600 + botaoIdentifica.url = ativo[0].url;
  1601 + },
  1602 + activate : function() {
  1603 + i3GEO.editorOL.criaJanelaAtivaTema();
  1604 + }
  1605 + }
  1606 + });
  1607 + // button.events.register("getfeatureinfo", this, showInfo);
  1608 + controles.push(botaoIdentifica);
  1609 + adiciona = true;
  1610 +
  1611 + }
  1612 +
1672 1613 //
1673 1614 // controle que permite o snap
1674 1615 //
... ...
js/analise.js
... ... @@ -1148,7 +1148,7 @@ i3GEO.analise =
1148 1148 */
1149 1149 inicia : function() {
1150 1150 var m = i3GEO.analise.medeArea.openlayers;
1151   - i3GEO.analise.openlayers.medeArea.estilo = new ol.style.Style({
  1151 + m.estilo = new ol.style.Style({
1152 1152 stroke: new ol.style.Stroke({
1153 1153 color: '#ffcc33',
1154 1154 width: 5
... ... @@ -1157,7 +1157,6 @@ i3GEO.analise =
1157 1157 color: 'rgba(255, 153, 0, 0.8)'
1158 1158 })
1159 1159 });
1160   -
1161 1160 i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
1162 1161 m.removeControle();
1163 1162 m.draw = new ol.interaction.Draw({
... ...
js/barradebotoes.js
... ... @@ -944,7 +944,6 @@ i3GEO.barraDeBotoes =
944 944 l = 0;
945 945 for (i = 0; i < n; i += 1) {
946 946 if (chaves[i] && i3GEO.barraDeBotoes.INCLUIBOTAO[chaves[i]] && i3GEO.barraDeBotoes.INCLUIBOTAO[chaves[i]] === true) {
947   -
948 947 botao = i3GEO.barraDeBotoes.defBotao(chaves[i]);
949 948 if (botao === false || i3GEO.barraDeBotoes.AJUDA === false) {
950 949 titulo = "";
... ... @@ -1793,12 +1792,14 @@ i3GEO.barraDeBotoes =
1793 1792 i3GEO.editorOL.maxext = "";
1794 1793 i3GEO.editorOL.controles = [];
1795 1794 i3GEO.editorOL.botoes = {
1796   - 'pan' : false,
1797   - 'zoombox' : false,
1798   - 'zoomtot' : false,
1799   - 'legenda' : false,
1800   - 'distancia' : false,
1801   - 'area' : false,
  1795 + 'zoomin' : true,
  1796 + 'zoomout' : true,
  1797 + 'pan' : true,
  1798 + 'zoombox' : true,
  1799 + 'zoomtot' : true,
  1800 + 'legenda' : true,
  1801 + 'distancia' : true,
  1802 + 'area' : true,
1802 1803 'identifica' : true,
1803 1804 'linha' : true,
1804 1805 'ponto' : true,
... ...
js/configura.js
... ... @@ -1240,12 +1240,6 @@ i3GEO.configura =
1240 1240 i3GEO.Interface.googlemaps.zoom2extent(i3GEO.parametros.extentTotal);
1241 1241 return;
1242 1242 }
1243   - i3GEO.navega.zoomExt(
1244   - i3GEO.configura.locaplic,
1245   - i3GEO.configura.sid,
1246   - i3GEO.configura.tipoimagem,
1247   - i3GEO.parametros.extentTotal);
1248   - marcadorZoom = "";
1249 1243 }
1250 1244 },
1251 1245 {
... ... @@ -1297,12 +1291,10 @@ i3GEO.configura =
1297 1291 draggable : true
1298 1292 });
1299 1293 i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
1300   - return;
1301 1294 }
1302 1295 if (i3GEO.Interface.ATUAL === "openlayers") {
1303   - i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
  1296 + //i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
1304 1297 // i3GEO.Interface.openlayers.OLpanel.activateControl(i3GEO.Interface.openlayers.OLzoom);
1305   - return;
1306 1298 }
1307 1299 }
1308 1300 },
... ...