editor.js
4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
if (typeof (i3GEO) === 'undefined') {
var i3GEO = {};
}
i3GEO.editor =
{
botoes : {
'zoomin' : false,
'zoomout' : false,
'pan' : false,
'zoombox' : false,
'zoomtot' : false,
'legenda' : false,
'distancia' : false,
'area' : false,
'identifica' : false,
'linha' : true,
'ponto' : true,
'poligono' : true,
'texto' : true,
'corta' : true,
'edita' : true,
'listag' : true,
'selecao' : true,
'selecaotudo' : true,
'apaga' : true,
'procura' : false,
'propriedades' : true,
'salva' : true,
'ajuda' : true,
'fecha' : true,
'tools' : true,
'undo' : true,
'frente' : true
},
/**
* Function: inicia
*
* Abre as opções do editor conforme a interface em uso
*/
inicia : function() {
i3GEO.eventos.cliquePerm.desativa();
i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial");
},
// carrega as opcoes de edicao se a interface for do googlemaps
googlemaps : {
inicia : function(idjanela) {
var temp =
function() {
var cabecalho, minimiza, fecha, janela = YAHOO.i3GEO.janela.manager.find("i3GEOjanelaEditor");
if (janela) {
janela.destroy();
}
cabecalho = function() {
};
minimiza = function() {
i3GEO.janela.minimiza("i3GEOjanelaEditor");
};
janela =
i3GEO.janela.cria(
"350px",
"100px",
"",
"",
"",
"<div class='i3GeoTituloJanela'>Editor</div>",
"i3GEOjanelaEditor",
false,
"hd",
cabecalho,
minimiza);
$i("i3GEOjanelaEditor_corpo").style.backgroundColor = "white";
i3GEO.editorGM.inicia("i3GEOjanelaEditor_corpo");
fecha = function() {
var temp = window.confirm($trad("x94"));
if (i3GEO.eventos) {
i3GEO.eventos.cliquePerm.ativa();
}
if (temp === true) {
i3GEO.desenho.googlemaps.destroyFeatures(i3GEO.desenho.googlemaps.shapes);
}
};
$( janela[0].close ).click(fecha);
};
// @TODO incluir o js compactado ao inves do original
if (!i3GEO.editorGM) {
i3GEO.util.scriptTag(
i3GEO.configura.locaplic + "/ferramentas/editorgm/editorgm_compacto.js",
temp,
"editorgm.js",
true);
} else {
temp.call();
}
}
},
openlayers : {
inicia : function(idjanela) {
if (!i3GEO.editorOL) {
//a barra de botoes utiliza codigo do Opelayers2
i3GEO.util.scriptTag(
i3GEO.configura.locaplic + "/ferramentas/editorol/editorol.js",
"i3GEO.editor.openlayers.ativaPainel('" + idjanela + "')",
"editorol.js",
true);
} else {
if (!i3GEO.desenho.layergrafico) {
i3GEO.desenho.openlayers.criaLayerGrafico();
i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico]);
}
if (!i3GEO.editorOL.backup) {
i3GEO.editorOL.backup = new ol.layer.Vector({
source : new ol.source.Vector({
features : new ol.Collection(),
useSpatialIndex : false,
name : "Backup"
}),
visible: false
});
i3GEO.editorOL.backup.setMap(i3geoOL);
i3GEO.editorOL.backup.getFeatures = function(){
return i3GEO.editorOL.backup.getSource().getFeatures();
};
}
i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);
}
},
criaJanela : function() {
if ($i("i3GEOjanelaEditor")) {
return "i3GEOjanelaEditor";
}
var janela, divid, titulo, cabecalho, minimiza;
cabecalho = function() {
};
minimiza = function() {
i3GEO.janela.minimiza("i3GEOjanelaEditor");
};
// cria a janela flutuante
titulo = "<div class='i3GeoTituloJanela'>"+$trad("u29")+"</div>";
janela = i3GEO.janela.cria("300px", "200px", "", "", "", titulo, "i3GEOjanelaEditor", false, "hd", cabecalho, minimiza);
divid = janela[2].id;
$i("i3GEOjanelaEditor_corpo").style.backgroundColor = "white";
$i("i3GEOjanelaEditor_corpo").style.textAlign = "left";
return divid;
},
//TODO utilizar uma janela flutuante ao inves de uma fila de icones
ativaPainel : function(idjanela) {
i3GEO.editorOL.fundo = "";// i3GEO.editorOL é criado pelo script carregado
i3GEO.editorOL.mapa = i3geoOL;
i3GEO.editorOL.maxext = "";
i3GEO.editorOL.controles = [];
if (!i3GEO.desenho.layergrafico) {
i3GEO.desenho.openlayers.criaLayerGrafico();
}
if (idjanela) {
i3GEO.editorOL.criaBotoes(i3GEO.editor.botoes);
}
}
}
};