index.php
8.86 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<?php
include("../../ms_configura.php");
include("../blacklist.php");
verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false);
?>
<html>
<head>
<script src="../../pacotes/ol4/ol.js"></script>
<script src="../../js/i3geonaocompacto.js" type="text/javascript"></script>
<script>
Timeline_ajax_url="../../pacotes/simile/timeline_2.3.0/timeline_ajax/simile-ajax-api.js";
Timeline_urlPrefix='../../pacotes/simile/timeline_2.3.0/timeline_js/';
Timeline_parameters='bundle=true';
</script>
<script src="../../pacotes/simile/timeline_2.3.0/timeline_js/timeline-api.js" type="text/javascript"></script>
<style>
.timeline-band-1 .timeline-ether-bg
{background-color:white;}
.timeline-event-bubble-title
{visibility:hidden;display:none;}
</style>
</head>
<body onload="inicializa()" onresize="onResize()">
<img onclick="config()" class='ticPropriedades2' style='cursor: pointer;float: left;width: 20px;height: 20px;top: 5px;position: relative;' title='config' src='../../imagens/branco.gif'>
<div class="styled-select" style="width:90%;" id="combotemas" ></div>
<div class=paragrafo id="totaleventos" ></div>
<div class=paragrafo id="tl" style="height: 80%; border: 0px solid #aaa;overflow-x:hidden; overflow-y:scroll"> </div>
<script>
/*
Title: Linha do tempo
Cria um gráfico de linha do tempo, tendo como base os atributos dos elementos de um tema visíveis na extensão geográfica
do mapa atual. Para possibilitar a geração do gráfico, o layer deve estar configurado corretamente, contendo os METADATA
específicos para essa ferramenta (veja o editor de mapfile do sistema de administração do i3Geo). Essa ferramenta é baseada
no pacote TIMELINE, distribuído junto com o i3Geo.
Veja:
<i3GEO.analise.dialogo.linhaDoTempo>
Arquivo:
i3geo/ferramentas/linhadotempo/index.php
Licenca:
GPL2
i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
Este programa é software livre; você pode redistribuí-lo
e/ou modificá-lo sob os termos da Licença Pública Geral
GNU conforme publicada pela Free Software Foundation;
Este programa é distribuído na expectativa de que seja útil,
porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
Consulte a Licença Pública Geral do GNU para mais detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral do
GNU junto com este programa; se não, escreva para a
Free Software Foundation, Inc., no endereço
59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
*/
$i = function(id){
return document.getElementById(id);
};
cpJSON = new cpaint();
cpJSON.set_response_type("JSON");
var tl;
var eventSource1 = new Timeline.DefaultEventSource();
MARCA = false;
/*
Function: inicializa
Inicializa a ferramenta construindo o combo para escolha do tema que será usado no gráfico
Veja:
<i3GEO.util.comboTemas>
*/
function inicializa(){
document.body.className = "";
document.body.style.background = "white";
document.body.style.margin = "5px";
i3GEO.arvoreDeCamadas.CAMADAS = window.parent.i3GEO.arvoreDeCamadas.CAMADAS;
i3GEO.util.comboTemas(
"tema",
function(retorno){
$i("combotemas").innerHTML = retorno.dados;
if ($i("tema")){
$i("tema").onchange = function(){
if($i("tema").value === ""){
return;
}
bandas();
carregaDados();
window.parent.i3GEO.mapa.ativaTema($i("tema").value);
};
}
window.parent.i3GEO.temaAtivo = $i("tema").value;
if(window.parent.i3GEO.temaAtivo !== ""){
$i("tema").value = window.parent.i3GEO.temaAtivo;
if($i("tema").value !== ""){
$i("tema").onchange.call();
}
}
},
"combotemas",
"",
false,
"linhaDoTempo"
);
}
/*
Function: bandas
Cria o objeto bandInfos com os parâmetros necessários para a criação do gráfico
*/
function bandas(){
tl_el = $i("tl");
tl_el.innerHTML = "<span style=color:red; >"+$trad("o1")+"</span>";
var theme1 = Timeline.ClassicTheme.create();
theme1.event.bubble.width = 250;
if(navn){
theme1.autoWidth = false;
bandInfos = [
Timeline.createBandInfo({
width: "20%",
intervalUnit: Timeline.DateTime.DECADE,
intervalPixels: 200,
overview: true,
eventSource: eventSource1
}),
Timeline.createBandInfo({
width: "80%",
intervalUnit: Timeline.DateTime.YEAR,
intervalPixels: 200,
eventSource: eventSource1,
theme: theme1,
layout: 'original' // original, overview, detailed
})
];
bandInfos[1].syncWith = 0;
bandInfos[0].highlight = true;
}
else{
theme1.autoWidth = false;
bandInfos = [
Timeline.createBandInfo({
width: "100%",
intervalUnit: Timeline.DateTime.DECADE,
intervalPixels: 200,
eventSource: eventSource1,
theme: theme1,
layout: 'original' // original, overview, detailed
})
];
}
var url = '.'; // The base url for image, icon and background image
}
/*
Function: carregaDados
Obtém os dados que serão incluídos no gráfico. É criado o objeto Timeline chamado tl
Veja:
<DADOSLINHADOTEMPO>
*/
function carregaDados(){
//alert(window.parent.i3GEO.parametros.mapexten)
tl_el.innerHTML = "<span style=color:red; >"+$trad("o1")+"</span>";
var retorna = function(retorno){
eventSource1.clear();
$i("totaleventos").innerHTML = retorno.data.events.length+" eventos";
tl = Timeline.create(tl_el, bandInfos, Timeline.HORIZONTAL);
eventSource1.loadJSON(retorno.data, '.'); // The data was stored into the
tl.layout(); // display the Timeline
tl.getBand(0).scrollToCenter(Timeline.DateTime.parseGregorianDateTime(retorno.data.maiorano));
}
var ext = window.parent.i3GEO.util.extOSM2Geo(window.parent.i3GEO.parametros.mapexten);
var p = window.parent.i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=dadosLinhaDoTempo&g_sid="+window.parent.i3GEO.configura.sid+"&tema="+$i("tema").value+"&ext="+ext;
cpJSON.call(p,"void",retorna);
}
/*
Function: tituloover
Indica no mapa a localização de um evento quando o usuário passa o mouse sobre o título de um evento
Parametro:
wkt {String} - coordenadas do evento no formato WKT
*/
function tituloover(wkt){
//@FIXME nao funciona no OSM
var wi = window.parent;
if(wi.i3GEO.Interface.openlayers.googleLike === true){
return;
}
try{
if(!wi){return;}
if(!wi.i3GEO){return;}
if(!wi.i3GEO.calculo){return;}
}
catch(e){if(typeof(console) !== 'undefined'){console.error(e);};return;}
re = new RegExp("POINT", "g");
wkt = wkt.replace(re,"");
wkt = wkt.split("(")[1].split(")")[0];
wkt = wkt.split(" ");
if(MARCA === false){
MARCA = wi.i3GEO.desenho.addPin(wkt[0],wkt[1],"","",wi.i3GEO.configura.locaplic+'/imagens/google/confluence.png',"linhadotempo");
}
else{
wi.i3GEO.desenho.movePin(MARCA,wkt[0],wkt[1]);
}
}
/*
Function: tituloclique
Seleciona os elementos do tema ativo com base na coordenada do evento
Parametro:
wkt {String} - coordenadas do evento no formato WKT
*/
function tituloclique(wkt){
try{
if(!window.parent){return;}
if(!window.parent.i3GEO){return;}
if(!window.parent.i3GEO.calculo){return;}
}
catch(e){if(typeof(console) !== 'undefined'){console.error(e);};return;}
re = new RegExp("POINT", "g");
wkt = wkt.replace(re,"");
wkt = wkt.split("(")[1].split(")")[0];
wkt = wkt.split(" ");
var retorna = function(retorno)
{
window.parent.i3GEO.atualiza(retorno);
window.parent.i3GEO.Interface.atualizaTema(retorno,$i("tema").value);
};
//window.parent.i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1"));
window.parent.i3GEO.php.selecaopt(retorna,$i("tema").value,wkt[0]+" "+wkt[1],"adiciona",0);
}
/*
Function: tituloout
Remove do mapa a marca de localização do evento quando o usuário move o mouse para fora do título do evento
*/
function tituloout(){
var wi = window.parent;
wi.i3GEO.desenho.removePins("linhadotempo");
MARCA = false;
}
/*
Function: onResize
Modifica o tamanho da linha do tempo se a janela da ferramenta tiver seu tamanho modificado
*/
function onResize() {
if (resizeTimerID == null) {
resizeTimerID = window.setTimeout(function() {
resizeTimerID = null;
tl.layout();
}, 500);
}
}
function config(){
i3GEO.configura.locaplic = window.parent.i3GEO.configura.locaplic;
window.parent.i3GEO.mapa.ativaTema($i("tema").value);
window.parent.i3GEO.util.dialogoFerramenta(
"",
"linhadotempo",
"linhadotempo",
"dependencias.php",
"i3GEOF.linhadotempo.iniciaJanelaFlutuante()");
}
</script>
</body>
</html>