Commit 299fe114008962ec7fbadba1ceb3244f98f3278a

Authored by Edmar Moretti
1 parent b531c857

--no commit message

Showing 1 changed file with 332 additions and 303 deletions   Show diff stats
ferramentas/editorol/editorol.js
@@ -908,7 +908,7 @@ i3GEO.editorOL = @@ -908,7 +908,7 @@ i3GEO.editorOL =
908 }; 908 };
909 return temp; 909 return temp;
910 }, 910 },
911 - botaoZoombox : function(){ 911 + botaoZoomBox : function(){
912 var temp = document.createElement("div"); 912 var temp = document.createElement("div");
913 temp.className = "editorOLzoomboxItemInactive olButton"; 913 temp.className = "editorOLzoomboxItemInactive olButton";
914 temp.title = "zoombox"; 914 temp.title = "zoombox";
@@ -960,7 +960,7 @@ i3GEO.editorOL = @@ -960,7 +960,7 @@ i3GEO.editorOL =
960 return temp; 960 return temp;
961 }, 961 },
962 botaoDistancia : function(){ 962 botaoDistancia : function(){
963 - temp = document.createElement("div"); 963 + var temp = document.createElement("div");
964 temp.className = "editorOLdistanciaItemInactive olButton"; 964 temp.className = "editorOLdistanciaItemInactive olButton";
965 temp.title = $trad("d21t"); 965 temp.title = $trad("d21t");
966 temp.onclick = function(){ 966 temp.onclick = function(){
@@ -969,6 +969,325 @@ i3GEO.editorOL = @@ -969,6 +969,325 @@ i3GEO.editorOL =
969 }; 969 };
970 return temp; 970 return temp;
971 }, 971 },
  972 + botaoArea: function(){
  973 + var temp = document.createElement("div");
  974 + temp.className = "editorOLareaItemInactive olButton";
  975 + temp.title = $trad("d21at");
  976 + temp.onclick = function(){
  977 + i3GEO.editorOL.marcaBotao("editorOLarea");
  978 + i3GEO.barraDeBotoes.defBotao("area").funcaoonclick;
  979 + };
  980 + return temp;
  981 + },
  982 + botaoLinha: function(){
  983 + var temp = document.createElement("div");
  984 + temp.className = "editorOLlinhaItemInactive olButton";
  985 + temp.title = $trad("dlinha");
  986 + temp.onclick = function(){
  987 + i3GEO.eventos.cliquePerm.desativa();
  988 + i3GEO.editorOL.marcaBotao("editorOLlinha");
  989 + var draw = new ol.interaction.Draw({
  990 + type : "LineString"
  991 + });
  992 + //adiciona a interacao para poder ser removida
  993 + i3GEO.editorOL.interacoes.push(draw);
  994 + //desativa ol.interaction.DoubleClickZoom
  995 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  996 + draw.on("drawend", function(evt) {
  997 + evt.feature.setStyle(
  998 + new ol.style.Style({
  999 + stroke: new ol.style.Stroke({
  1000 + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  1001 + width: i3GEO.editorOL.simbologia.strokeWidth
  1002 + }),
  1003 + fill: new ol.style.Fill({
  1004 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
  1005 + })
  1006 + })
  1007 + );
  1008 + evt.feature.setId(i3GEO.util.uid());
  1009 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1010 + draw.setActive(false);
  1011 + draw.setActive(true);
  1012 + if (document.getElementById("panellistagEditor")) {
  1013 + i3GEO.editorOL.listaGeometrias();
  1014 + }
  1015 + });
  1016 + i3geoOL.addInteraction(draw);
  1017 + };
  1018 + return temp;
  1019 + },
  1020 + //TODO falta definir imagem
  1021 + botaoPonto: function(){
  1022 + i3GEO.eventos.cliquePerm.desativa();
  1023 + var temp = document.createElement("div");
  1024 + temp.className = "editorOLpontoItemInactive olButton";
  1025 + temp.title = $trad("dponto");
  1026 + temp.onclick = function(){
  1027 + i3GEO.eventos.cliquePerm.desativa();
  1028 + i3GEO.editorOL.marcaBotao("editorOLponto");
  1029 + var draw = new ol.interaction.Draw({
  1030 + type : "Point"
  1031 + });
  1032 + //adiciona a interacao para poder ser removida
  1033 + i3GEO.editorOL.interacoes.push(draw);
  1034 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1035 + draw.on("drawend", function(evt) {
  1036 + evt.feature.setStyle(
  1037 + new ol.style.Style({
  1038 + image: new ol.style.Circle({
  1039 + radius: i3GEO.editorOL.simbologia.pointRadius,
  1040 + fill: new ol.style.Fill({
  1041 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
  1042 + }),
  1043 + stroke: new ol.style.Stroke({
  1044 + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  1045 + width: i3GEO.editorOL.simbologia.pointRadius / 3
  1046 + })
  1047 + })
  1048 + })
  1049 + );
  1050 + evt.feature.setId(i3GEO.util.uid());
  1051 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1052 + draw.setActive(false);
  1053 + draw.setActive(true);
  1054 + if (document.getElementById("panellistagEditor")) {
  1055 + i3GEO.editorOL.listaGeometrias();
  1056 + }
  1057 + });
  1058 + i3geoOL.addInteraction(draw);
  1059 + };
  1060 + return temp;
  1061 + },
  1062 + botaoPoligono: function(){
  1063 + i3GEO.eventos.cliquePerm.desativa();
  1064 + var temp = document.createElement("div");
  1065 + temp.className = "editorOLpoligonoItemInactive olButton";
  1066 + temp.title = $trad("dpol");
  1067 + temp.onclick = function(){
  1068 + i3GEO.editorOL.marcaBotao("editorOLpoligono");
  1069 + var draw = new ol.interaction.Draw({
  1070 + type : "Polygon"
  1071 + });
  1072 + /*
  1073 + snap = new ol.interaction.Snap({
  1074 + source: i3GEO.desenho.layergrafico.getSource()
  1075 + });
  1076 + i3GEO.editorOL.interacoes.push(snap);
  1077 + */
  1078 + //adiciona a interacao para poder ser removida
  1079 + i3GEO.editorOL.interacoes.push(draw);
  1080 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1081 + draw.on("drawend", function(evt) {
  1082 + evt.feature.setStyle(
  1083 + new ol.style.Style({
  1084 + stroke: new ol.style.Stroke({
  1085 + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  1086 + width: i3GEO.editorOL.simbologia.strokeWidth
  1087 + }),
  1088 + fill: new ol.style.Fill({
  1089 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
  1090 + })
  1091 + })
  1092 + );
  1093 + evt.feature.setId(i3GEO.util.uid());
  1094 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1095 + draw.setActive(false);
  1096 + draw.setActive(true);
  1097 + if (document.getElementById("panellistagEditor")) {
  1098 + i3GEO.editorOL.listaGeometrias();
  1099 + }
  1100 + });
  1101 + i3geoOL.addInteraction(draw);
  1102 + };
  1103 + return temp;
  1104 + },
  1105 + botaoTexto: function(){
  1106 + i3GEO.eventos.cliquePerm.desativa();
  1107 + var temp = document.createElement("div");
  1108 + temp.className = "editorOLtextoItemInactive olButton";
  1109 + temp.title = $trad("dtexto");
  1110 + temp.onclick = function(){
  1111 + i3GEO.eventos.cliquePerm.desativa();
  1112 + i3GEO.editorOL.marcaBotao("editorOLtexto");
  1113 + var draw = new ol.interaction.Draw({
  1114 + type : "Point"
  1115 + });
  1116 + //adiciona a interacao para poder ser removida
  1117 + i3GEO.editorOL.interacoes.push(draw);
  1118 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1119 + draw.on("drawend", function(evt) {
  1120 + var texto = window.prompt("Texto", "");
  1121 + evt.feature.setStyle(
  1122 + new ol.style.Style({
  1123 + text: new ol.style.Text({
  1124 + text: texto,
  1125 + font: 'Bold ' + parseInt(i3GEO.editorOL.simbologia.fontSize,10) + 'px Arial',
  1126 + textAlign: 'left',
  1127 + stroke: new ol.style.Stroke({
  1128 + color: 'white',
  1129 + width: i3GEO.editorOL.simbologia.strokeWidth
  1130 + }),
  1131 + fill: new ol.style.Fill({
  1132 + color: i3GEO.editorOL.simbologia.fontColor
  1133 + }),
  1134 + zIndex: 2000
  1135 + })
  1136 + })
  1137 + );
  1138 + evt.feature.setId(i3GEO.util.uid());
  1139 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1140 + draw.setActive(false);
  1141 + draw.setActive(true);
  1142 + i3GEO.editorOL.marcaBotao();
  1143 + });
  1144 + i3geoOL.addInteraction(draw);
  1145 + };
  1146 + return temp;
  1147 + },
  1148 + botaoSelecao: function(){
  1149 + i3GEO.eventos.cliquePerm.desativa();
  1150 + var temp = document.createElement("div");
  1151 + temp.className = "editorOLselecaoItemInactive olButton";
  1152 + temp.title = $trad("d24t");
  1153 + temp.onclick = function(){
  1154 + i3GEO.editorOL.marcaBotao("editorOLselecao");
  1155 + var sel = new ol.interaction.Select();
  1156 + //adiciona a interacao para poder ser removida
  1157 + i3GEO.editorOL.interacoes.push(sel);
  1158 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1159 + sel.on("select", function(evt) {
  1160 + var s,i, n, id, f;
  1161 + n = evt.selected.length;
  1162 + for(i=0; i<n; i++){
  1163 + f = evt.selected[i];
  1164 + id = f.getId();
  1165 + if(id && i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){
  1166 + i3GEO.editorOL.unselFeature(id);
  1167 + }
  1168 + else{
  1169 + id = i3GEO.util.uid();
  1170 + i3GEO.editorOL.idsSelecionados.push(id);
  1171 + f.setId(id);
  1172 + s = f.getStyle();
  1173 + if(s.getImage()){
  1174 + f.setProperties({
  1175 + fillColor: s.getImage().getFill().getColor(),
  1176 + strokeColor: s.getImage().getStroke().getColor()
  1177 + });
  1178 + f.setStyle(
  1179 + new ol.style.Style({
  1180 + image: new ol.style.Circle({
  1181 + radius: i3GEO.editorOL.simbologia.pointRadius,
  1182 + fill: new ol.style.Fill({
  1183 + color: 'rgba(255, 255, 255, 0.5)'
  1184 + }),
  1185 + stroke: new ol.style.Stroke({
  1186 + color: 'blue',
  1187 + width: i3GEO.editorOL.simbologia.pointRadius / 3
  1188 + })
  1189 + })
  1190 + })
  1191 + );
  1192 + }
  1193 + else{
  1194 + f.setProperties({
  1195 + fillColor: s.getFill().getColor(),
  1196 + strokeColor: s.getStroke().getColor()
  1197 + });
  1198 + s.getFill().setColor('rgba(255, 255, 255, 0.5)');
  1199 + s.getStroke().setColor('blue');
  1200 + }
  1201 + }
  1202 + }
  1203 + if (n === 0){
  1204 + i3GEO.editorOL.unselTodos();
  1205 + }
  1206 + });
  1207 + i3geoOL.addInteraction(sel);
  1208 + };
  1209 + return temp;
  1210 + },
  1211 + botaoSelecaoTudo: function(){
  1212 + var temp = document.createElement("div");
  1213 + temp.className = "editorOLselecaoTudoItemInactive olButton";
  1214 + temp.title = $trad("studo");
  1215 + temp.onclick = function(){
  1216 + i3GEO.editorOL.marcaBotao();
  1217 + i3GEO.editorOL.selTodos();
  1218 + };
  1219 + return temp;
  1220 + },
  1221 + botaoApaga: function(){
  1222 + var temp = document.createElement("div");
  1223 + temp.className = "editorOLapagaItemInactive olButton";
  1224 + temp.title = $trad("excsel");
  1225 + temp.onclick = function(){
  1226 + var x, nsel = i3GEO.editorOL.idsSelecionados.length;
  1227 + i3GEO.editorOL.featuresBackup = [];
  1228 + i3GEO.editorOL.marcaBotao();
  1229 + if(nsel > 0){
  1230 + x = window.confirm($trad("excsel") + "?");
  1231 + if(x){
  1232 + i3GEO.editorOL.removeFeaturesSel();
  1233 + i3GEO.desenho.layergrafico.getSource().changed();
  1234 + }
  1235 + }
  1236 + else{
  1237 + i3GEO.janela.tempoMsg($trad("selum"));
  1238 + }
  1239 + };
  1240 + return temp;
  1241 + },
  1242 + botaoFrente: function(){
  1243 + var temp = document.createElement("div");
  1244 + temp.className = "editorOLfrenteItemInactive olButton";
  1245 + temp.title = $trad("frente");
  1246 + temp.onclick = function(){
  1247 + var nsel = i3GEO.editorOL.idsSelecionados.length;
  1248 + if(nsel > 0){
  1249 + i3GEO.editorOL.marcaBotao();
  1250 + i3GEO.editorOL.trazParaFrente();
  1251 + }
  1252 + else{
  1253 + i3GEO.janela.tempoMsg($trad("selum"));
  1254 + }
  1255 + };
  1256 + return temp;
  1257 + },
  1258 + //FIXME Translate nao funciona nessa versao do openlayers 3x precisa atualizar
  1259 + botaoEdita: function(){
  1260 + i3GEO.eventos.cliquePerm.desativa();
  1261 + var temp = document.createElement("div");
  1262 + temp.className = "editorOLeditaItemInactive olButton";
  1263 + temp.title = $trad("dpol");
  1264 + temp.onclick = function(){
  1265 + i3GEO.editorOL.featuresBackup = [];
  1266 + var draw, nsel, f, c;
  1267 + nsel = i3GEO.editorOL.idsSelecionados.length;
  1268 + if(nsel > 0){
  1269 + i3GEO.editorOL.marcaBotao("editorOLedita");
  1270 + f = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]);
  1271 + i3GEO.editorOL.featuresBackup.push(f.clone());
  1272 + c = new ol.Collection();
  1273 + c.push(f);
  1274 + draw = new ol.interaction.Modify({
  1275 + features: c
  1276 + });
  1277 + //adiciona a interacao para poder ser removida
  1278 + i3GEO.editorOL.interacoes.push(draw);
  1279 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1280 + i3geoOL.addInteraction(draw);
  1281 + }
  1282 + else{
  1283 + i3GEO.janela.tempoMsg($trad("selum"));
  1284 + }
  1285 + };
  1286 + return temp;
  1287 + },
  1288 + botao: function(){
  1289 + return temp;
  1290 + },
972 criaBotoes : function(botoes) { 1291 criaBotoes : function(botoes) {
973 if($i("i3GEObarraEdicao")){ 1292 if($i("i3GEObarraEdicao")){
974 $i("i3GEObarraEdicao").style.display = "block"; 1293 $i("i3GEObarraEdicao").style.display = "block";
@@ -1005,325 +1324,35 @@ i3GEO.editorOL = @@ -1005,325 +1324,35 @@ i3GEO.editorOL =
1005 i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoDistancia()); 1324 i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoDistancia());
1006 } 1325 }
1007 if (botoes.area === true) { 1326 if (botoes.area === true) {
1008 - temp = document.createElement("div");  
1009 - temp.className = "editorOLareaItemInactive olButton";  
1010 - temp.title = $trad("d21at");  
1011 - temp.onclick = function(){  
1012 - i3GEO.editorOL.marcaBotao("editorOLarea");  
1013 - i3GEO.barraDeBotoes.defBotao("area").funcaoonclick;  
1014 - };  
1015 - i3GEOpanelEditor.appendChild(temp); 1327 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoArea());
1016 } 1328 }
1017 if (botoes.linha === true) { 1329 if (botoes.linha === true) {
1018 - temp = document.createElement("div");  
1019 - temp.className = "editorOLlinhaItemInactive olButton";  
1020 - temp.title = $trad("dlinha");  
1021 - temp.onclick = function(){  
1022 - i3GEO.eventos.cliquePerm.desativa();  
1023 - i3GEO.editorOL.marcaBotao("editorOLlinha");  
1024 - var draw = new ol.interaction.Draw({  
1025 - type : "LineString"  
1026 - });  
1027 - //adiciona a interacao para poder ser removida  
1028 - i3GEO.editorOL.interacoes.push(draw);  
1029 - //desativa ol.interaction.DoubleClickZoom  
1030 - i3GEO.Interface.openlayers.interacoes[0].setActive(false);  
1031 - draw.on("drawend", function(evt) {  
1032 - evt.feature.setStyle(  
1033 - new ol.style.Style({  
1034 - stroke: new ol.style.Stroke({  
1035 - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',  
1036 - width: i3GEO.editorOL.simbologia.strokeWidth  
1037 - }),  
1038 - fill: new ol.style.Fill({  
1039 - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'  
1040 - })  
1041 - })  
1042 - );  
1043 - evt.feature.setId(i3GEO.util.uid());  
1044 - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);  
1045 - draw.setActive(false);  
1046 - draw.setActive(true);  
1047 - if (document.getElementById("panellistagEditor")) {  
1048 - i3GEO.editorOL.listaGeometrias();  
1049 - }  
1050 - });  
1051 - i3geoOL.addInteraction(draw);  
1052 - };  
1053 - i3GEOpanelEditor.appendChild(temp); 1330 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLinha());
1054 } 1331 }
1055 - //TODO falta definir imagem  
1056 if (botoes.ponto === true) { 1332 if (botoes.ponto === true) {
1057 - i3GEO.eventos.cliquePerm.desativa();  
1058 - temp = document.createElement("div");  
1059 - temp.className = "editorOLpontoItemInactive olButton";  
1060 - temp.title = $trad("dponto");  
1061 - temp.onclick = function(){  
1062 - i3GEO.eventos.cliquePerm.desativa();  
1063 - i3GEO.editorOL.marcaBotao("editorOLponto");  
1064 - var draw = new ol.interaction.Draw({  
1065 - type : "Point"  
1066 - });  
1067 - //adiciona a interacao para poder ser removida  
1068 - i3GEO.editorOL.interacoes.push(draw);  
1069 - i3GEO.Interface.openlayers.interacoes[0].setActive(false);  
1070 - draw.on("drawend", function(evt) {  
1071 - evt.feature.setStyle(  
1072 - new ol.style.Style({  
1073 - image: new ol.style.Circle({  
1074 - radius: i3GEO.editorOL.simbologia.pointRadius,  
1075 - fill: new ol.style.Fill({  
1076 - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'  
1077 - }),  
1078 - stroke: new ol.style.Stroke({  
1079 - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',  
1080 - width: i3GEO.editorOL.simbologia.pointRadius / 3  
1081 - })  
1082 - })  
1083 - })  
1084 - );  
1085 - evt.feature.setId(i3GEO.util.uid());  
1086 - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);  
1087 - draw.setActive(false);  
1088 - draw.setActive(true);  
1089 - if (document.getElementById("panellistagEditor")) {  
1090 - i3GEO.editorOL.listaGeometrias();  
1091 - }  
1092 - });  
1093 - i3geoOL.addInteraction(draw);  
1094 - };  
1095 - i3GEOpanelEditor.appendChild(temp); 1333 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPonto());
1096 } 1334 }
1097 if (botoes.poligono === true) { 1335 if (botoes.poligono === true) {
1098 - i3GEO.eventos.cliquePerm.desativa();  
1099 - temp = document.createElement("div");  
1100 - temp.className = "editorOLpoligonoItemInactive olButton";  
1101 - temp.title = $trad("dpol");  
1102 - temp.onclick = function(){  
1103 - i3GEO.editorOL.marcaBotao("editorOLpoligono");  
1104 - var draw = new ol.interaction.Draw({  
1105 - type : "Polygon"  
1106 - });  
1107 - /*  
1108 - snap = new ol.interaction.Snap({  
1109 - source: i3GEO.desenho.layergrafico.getSource()  
1110 - });  
1111 - i3GEO.editorOL.interacoes.push(snap);  
1112 - */  
1113 - //adiciona a interacao para poder ser removida  
1114 - i3GEO.editorOL.interacoes.push(draw);  
1115 - i3GEO.Interface.openlayers.interacoes[0].setActive(false);  
1116 - draw.on("drawend", function(evt) {  
1117 - evt.feature.setStyle(  
1118 - new ol.style.Style({  
1119 - stroke: new ol.style.Stroke({  
1120 - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',  
1121 - width: i3GEO.editorOL.simbologia.strokeWidth  
1122 - }),  
1123 - fill: new ol.style.Fill({  
1124 - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'  
1125 - })  
1126 - })  
1127 - );  
1128 - evt.feature.setId(i3GEO.util.uid());  
1129 - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);  
1130 - draw.setActive(false);  
1131 - draw.setActive(true);  
1132 - if (document.getElementById("panellistagEditor")) {  
1133 - i3GEO.editorOL.listaGeometrias();  
1134 - }  
1135 - });  
1136 - i3geoOL.addInteraction(draw);  
1137 - };  
1138 - i3GEOpanelEditor.appendChild(temp); 1336 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPoligono());
1139 } 1337 }
1140 -  
1141 if (botoes.texto === true) { 1338 if (botoes.texto === true) {
1142 - i3GEO.eventos.cliquePerm.desativa();  
1143 - temp = document.createElement("div");  
1144 - temp.className = "editorOLtextoItemInactive olButton";  
1145 - temp.title = $trad("dtexto");  
1146 - temp.onclick = function(){  
1147 - i3GEO.eventos.cliquePerm.desativa();  
1148 - i3GEO.editorOL.marcaBotao("editorOLtexto");  
1149 - var draw = new ol.interaction.Draw({  
1150 - type : "Point"  
1151 - });  
1152 - //adiciona a interacao para poder ser removida  
1153 - i3GEO.editorOL.interacoes.push(draw);  
1154 - i3GEO.Interface.openlayers.interacoes[0].setActive(false);  
1155 - draw.on("drawend", function(evt) {  
1156 - var texto = window.prompt("Texto", "");  
1157 - evt.feature.setStyle(  
1158 - new ol.style.Style({  
1159 - text: new ol.style.Text({  
1160 - text: texto,  
1161 - font: 'Bold ' + parseInt(i3GEO.editorOL.simbologia.fontSize,10) + 'px Arial',  
1162 - textAlign: 'left',  
1163 - stroke: new ol.style.Stroke({  
1164 - color: 'white',  
1165 - width: i3GEO.editorOL.simbologia.strokeWidth  
1166 - }),  
1167 - fill: new ol.style.Fill({  
1168 - color: i3GEO.editorOL.simbologia.fontColor  
1169 - }),  
1170 - zIndex: 2000  
1171 - })  
1172 - })  
1173 - );  
1174 - evt.feature.setId(i3GEO.util.uid());  
1175 - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);  
1176 - draw.setActive(false);  
1177 - draw.setActive(true);  
1178 - i3GEO.editorOL.marcaBotao();  
1179 - });  
1180 - i3geoOL.addInteraction(draw);  
1181 - };  
1182 - i3GEOpanelEditor.appendChild(temp); 1339 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTexto());
1183 } 1340 }
1184 -  
1185 if (botoes.selecao === true) { 1341 if (botoes.selecao === true) {
1186 - i3GEO.eventos.cliquePerm.desativa();  
1187 - temp = document.createElement("div");  
1188 - temp.className = "editorOLselecaoItemInactive olButton";  
1189 - temp.title = $trad("d24t");  
1190 - temp.onclick = function(){  
1191 - i3GEO.editorOL.marcaBotao("editorOLselecao");  
1192 - var sel = new ol.interaction.Select();  
1193 - //adiciona a interacao para poder ser removida  
1194 - i3GEO.editorOL.interacoes.push(sel);  
1195 - i3GEO.Interface.openlayers.interacoes[0].setActive(false);  
1196 - sel.on("select", function(evt) {  
1197 - var s,i, n, id, f;  
1198 - n = evt.selected.length;  
1199 - for(i=0; i<n; i++){  
1200 - f = evt.selected[i];  
1201 - id = f.getId();  
1202 - if(id && i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){  
1203 - i3GEO.editorOL.unselFeature(id);  
1204 - }  
1205 - else{  
1206 - id = i3GEO.util.uid();  
1207 - i3GEO.editorOL.idsSelecionados.push(id);  
1208 - f.setId(id);  
1209 - s = f.getStyle();  
1210 - if(s.getImage()){  
1211 - f.setProperties({  
1212 - fillColor: s.getImage().getFill().getColor(),  
1213 - strokeColor: s.getImage().getStroke().getColor()  
1214 - });  
1215 - f.setStyle(  
1216 - new ol.style.Style({  
1217 - image: new ol.style.Circle({  
1218 - radius: i3GEO.editorOL.simbologia.pointRadius,  
1219 - fill: new ol.style.Fill({  
1220 - color: 'rgba(255, 255, 255, 0.5)'  
1221 - }),  
1222 - stroke: new ol.style.Stroke({  
1223 - color: 'blue',  
1224 - width: i3GEO.editorOL.simbologia.pointRadius / 3  
1225 - })  
1226 - })  
1227 - })  
1228 - );  
1229 - }  
1230 - else{  
1231 - f.setProperties({  
1232 - fillColor: s.getFill().getColor(),  
1233 - strokeColor: s.getStroke().getColor()  
1234 - });  
1235 - s.getFill().setColor('rgba(255, 255, 255, 0.5)');  
1236 - s.getStroke().setColor('blue');  
1237 - }  
1238 - }  
1239 - }  
1240 - if (n === 0){  
1241 - i3GEO.editorOL.unselTodos();  
1242 - }  
1243 - });  
1244 - i3geoOL.addInteraction(sel);  
1245 - };  
1246 - i3GEOpanelEditor.appendChild(temp); 1342 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecao());
1247 } 1343 }
1248 -  
1249 if (botoes.selecaotudo === true) { 1344 if (botoes.selecaotudo === true) {
1250 - temp = document.createElement("div");  
1251 - temp.className = "editorOLselecaoTudoItemInactive olButton";  
1252 - temp.title = $trad("studo");  
1253 - temp.onclick = function(){  
1254 - i3GEO.editorOL.marcaBotao();  
1255 - i3GEO.editorOL.selTodos();  
1256 - };  
1257 - i3GEOpanelEditor.appendChild(temp);  
1258 - }  
1259 1345
  1346 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecaoTudo());
  1347 + }
1260 if (botoes.apaga === true) { 1348 if (botoes.apaga === true) {
1261 - temp = document.createElement("div");  
1262 - temp.className = "editorOLapagaItemInactive olButton";  
1263 - temp.title = $trad("excsel");  
1264 - temp.onclick = function(){  
1265 - var x, nsel = i3GEO.editorOL.idsSelecionados.length;  
1266 - i3GEO.editorOL.featuresBackup = [];  
1267 - i3GEO.editorOL.marcaBotao();  
1268 - if(nsel > 0){  
1269 - x = window.confirm($trad("excsel") + "?");  
1270 - if(x){  
1271 - i3GEO.editorOL.removeFeaturesSel();  
1272 - i3GEO.desenho.layergrafico.getSource().changed();  
1273 - }  
1274 - }  
1275 - else{  
1276 - i3GEO.janela.tempoMsg($trad("selum"));  
1277 - }  
1278 - };  
1279 - i3GEOpanelEditor.appendChild(temp); 1349 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoApaga());
1280 } 1350 }
1281 -  
1282 if (botoes.frente === true) { 1351 if (botoes.frente === true) {
1283 - temp = document.createElement("div");  
1284 - temp.className = "editorOLfrenteItemInactive olButton";  
1285 - temp.title = $trad("frente");  
1286 - temp.onclick = function(){  
1287 - var nsel = i3GEO.editorOL.idsSelecionados.length;  
1288 - if(nsel > 0){  
1289 - i3GEO.editorOL.marcaBotao();  
1290 - i3GEO.editorOL.trazParaFrente();  
1291 - }  
1292 - else{  
1293 - i3GEO.janela.tempoMsg($trad("selum"));  
1294 - }  
1295 - };  
1296 - i3GEOpanelEditor.appendChild(temp); 1352 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFrente());
1297 } 1353 }
1298 - //TODO Translate nao funciona nessa versao do openlayers 3x precisa atualizar  
1299 if (botoes.edita === true) { 1354 if (botoes.edita === true) {
1300 - i3GEO.eventos.cliquePerm.desativa();  
1301 - temp = document.createElement("div");  
1302 - temp.className = "editorOLeditaItemInactive olButton";  
1303 - temp.title = $trad("dpol");  
1304 - temp.onclick = function(){  
1305 - i3GEO.editorOL.featuresBackup = [];  
1306 - var draw, nsel, f, c;  
1307 - nsel = i3GEO.editorOL.idsSelecionados.length;  
1308 - if(nsel > 0){  
1309 - i3GEO.editorOL.marcaBotao("editorOLedita");  
1310 - f = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]);  
1311 - i3GEO.editorOL.featuresBackup.push(f.clone());  
1312 - c = new ol.Collection();  
1313 - c.push(f);  
1314 - draw = new ol.interaction.Modify({  
1315 - features: c  
1316 - });  
1317 - //adiciona a interacao para poder ser removida  
1318 - i3GEO.editorOL.interacoes.push(draw);  
1319 - i3GEO.Interface.openlayers.interacoes[0].setActive(false);  
1320 - i3geoOL.addInteraction(draw);  
1321 - }  
1322 - else{  
1323 - i3GEO.janela.tempoMsg($trad("selum"));  
1324 - }  
1325 - };  
1326 - i3GEOpanelEditor.appendChild(temp); 1355 + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoEdita());
1327 } 1356 }
1328 if (botoes.edita === true && botoes.corta === true && i3GEO.php) { 1357 if (botoes.edita === true && botoes.corta === true && i3GEO.php) {
1329 i3GEO.eventos.cliquePerm.desativa(); 1358 i3GEO.eventos.cliquePerm.desativa();