editor.js
5.22 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
if (typeof (i3GEO) === 'undefined') {
var i3GEO = {};
}
i3GEO.editor =
{
//se for vazio, nao cria os botoes
//o objeto com os botoes que serao ativados ou nao, pode ser enviado
//como um parametro na funcao:
//i3GEO.editorOL.criaBotoes(botoes);
//caso contrario, utiliza-se i3GEO.editorOL.botoes
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,//inclui tambem o botao de unseltodos
'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() {
if(i3GEOF){
if(i3GEOF.area && i3GEOF.area.isOn()){
return;
}
if(i3GEOF.distancia && i3GEOF.distancia.isOn()){
return;
}
}
i3GEO.eventos.cliquePerm.desativa();
i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial");
},
// carrega as opcoes de edicao se a interface for do googlemaps
googlemaps : {
//removido em funcao da politica do google de impedir engenharia reversa em sua base de dados
inicia : function(idjanela) {
}
},
openlayers : {
inicia : function(idjanela) {
if (!i3GEO.editorOL) {
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();
};
}
if(jQuery.isEmptyObject(i3GEO.editorOL.botoes)){
i3GEO.editorOL.botoes = i3GEO.editor.botoes;
}
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.editor.botoes != "") {
i3GEO.editorOL.criaBotoes(i3GEO.editor.botoes);
}
}
}
};