classe_interface.js
23.5 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
/*
Title: Interface
File: i3geo/classesjs/classe_interface.js
About: Licença
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@mma.gov.br
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;
tanto a versão 2 da Licença.
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.
*/
if(typeof(i3GEO) == 'undefined'){
i3GEO = new Array();
}
/*
Class: i3GEO.interface
Funcoes que controlam o comportamento específico de determinadas interfaces
As interfaces são definidas na inicialização do i3Geo, por exemplo, openlayers, flamingo,etc
A classe "interface" contém os métdos específicos utilizados nessas interfaces
Exemplo:
Para iniciar o i3geo com uma interface específica, utilize http://localhost/i3geo/ms_criamapa.php?interface=flamingo.htm
O HTML deve conter as definições da interface criada e deve estar armazenado em i3geo/aplicmap
*/
i3GEO.interface = {
/*
Property: ATUAL
Interface atual em uso.
Default:
padrao
*/
ATUAL: "padrao",
/*
Property: IDCORPO
ID do elemento HTML que receberá o corpo do mapa
*/
IDCORPO: "corpoMapa",
/*
Variable: IDMAPA
ID do elemento HTML criado para conter o mapa
Esse elemento normalmente é criado dentro de IDCORPO dependendo da interface
*/
IDMAPA: "",
/*
Function: redesenha
Aplica o método redesenha da interface atual
*/
redesenha: function(){
eval("i3GEO.interface."+i3GEO.interface.ATUAL+".redesenha()");
},
/*
Function: cria
Cria ou altera os elementos HTML necessários para a interface
Essa função é executada na inicialização do i3geo
Parameters:
w {Integer} - largura do corpo do mapa em pixels
h {Integer} - altura do corpo do mapa em pixels
*/
cria: function(w,h){
eval("i3GEO.interface."+i3GEO.interface.ATUAL+".cria("+w+","+h+")");
},
/*
Function: inicia
Inicia a interface
*/
inicia: function(w,h){
eval("i3GEO.interface."+i3GEO.interface.ATUAL+".inicia()");
},
/*
Function: ativaBotoes
Ativa os botões de ferramentas
*/
ativaBotoes: function(){
eval("i3GEO.interface."+i3GEO.interface.ATUAL+".ativaBotoes()");
},
padrao:{
redesenha:function(){
$i("img").onload = function()
{
$i("img").onload = "";
//atualiza quadro
i3GEO.gadgets.quadros.grava("imagem",i3GEO.parametros.mapimagem);
i3GEO.gadgets.quadros.grava("extensao",i3GEO.parametros.mapexten);
var temp = function(retorno){
eval(retorno.data);
i3GEO.gadgets.quadros.grava("legenda",legimagem);
};
i3GEO.mapa.legendaIMAGEM.obtem(temp);
if ($i("imgtemp"))
{$i("imgtemp").style.display="none";}
//necessário na função de zoom por slide
if ($i("imgClone"))
$i("imgClone").style.display = "none";
$i("img").style.display = "block";
i3GEO.janela.fechaAguarde("ajaxCorpoMapa");
};
if (!$i("imgtemp"))
{
var ndiv = document.createElement("div");
ndiv.id = "imgtemp";
ndiv.style.position = "absolute";
ndiv.style.border = "1px solid blue";
document.getElementById("corpoMapa").appendChild(ndiv);
}
if(g_tipoacao == "pan")
{
$i("imgtemp").style.left = parseInt($i("img").style.left);
$i("imgtemp").style.top = parseInt($i("img").style.top);
$i("imgtemp").style.width = i3GEO.parametros.w;
$i("imgtemp").style.height = i3GEO.parametros.h;
$i("imgtemp").style.display="block";
$i("imgtemp").style.backgroundImage = 'url("'+$i("img").src+'")';
}
$i("img").style.left = 0;
$i("img").style.top = 0;
$i("img").src=i3GEO.parametros.mapimagem;
},
cria:function(){
var ins = "<table>";
ins += "<tr><td class=verdeclaro ></td><td class=verdeclaro ><input style='display:none;position:relative' type=image src='' id='imgN' /></td><td class=verdeclaro ></td></tr>";
ins += "<tr><td class=verdeclaro ><input style='display:none;position:relative' type=image src='' id='imgL' /></td><td class=verdeclaro ><input style='position:relative;top:0px;left:0px'' type=image src='' id='img' /></td><td class=verdeclaro ><input style='display:none;position:relative' type=image src='' id='imgO' /></td></tr>";
ins += "<tr><td class=verdeclaro ></td><td class=verdeclaro ><input style='display:none;position:relative' type=image src='' id='imgS' /></td><td class=verdeclaro ></td></tr>";
ins += "</table>";
$i(i3GEO.interface.IDCORPO).innerHTML = ins;
i3GEO.interface.IDMAPA = "img";
},
inicia:function(){
if ($i("contemImg"))
{var elemento = "contemImg";}
else
{var elemento = "img";}
i3GEO.mapa.ajustaPosicao(elemento);
var i = $i("img");
i.style.width=i3GEO.parametros.w +"px";
i.style.height=i3GEO.parametros.h +"px";
var estilo = $i(i3GEO.interface.IDCORPO).style;
estilo.width=i3GEO.parametros.w +"px";
estilo.height=i3GEO.parametros.h +"px";
estilo.clip = 'rect('+0+" "+(i3GEO.parametros.w)+" "+(i3GEO.parametros.h)+" "+0+')';
objmapaparado = "nao"; //utilizado para verificar se o mouse esta parado
i3GEO.gadgets.mostraMenuSuspenso();
i3GEO.eventos.ativa(i);
i3GEO.gadgets.mostraCoordenadasGEO();
i3GEO.gadgets.mostraCoordenadasUTM();
i3GEO.gadgets.mostraEscalaNumerica();
i3GEO.gadgets.mostraEscalaGrafica();
i3GEO.gadgets.visual.inicia();
i3GEO.idioma.mostraSeletor();
i3GEO.ajuda.ativaLetreiro(i3GEO.parametros.mensagens);
i3GEO.interface.padrao.ativaBotoes();
if (i3GEO.configura.mapaRefDisplay != "none")
{
if (i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay")){i3GEO.configura.mapaRefDisplay = i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay");}
if (i3GEO.configura.mapaRefDisplay == "block"){i3GEO.maparef.inicia();}
}
},
ativaBotoes: function(){
var imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.interface.IDCORPO));
if ($i("barraDeBotoes1")){
var x1 = imagemxy[0]+40;
var y1 = imagemxy[1]+10;
}
if ($i("barraDeBotoes2")){
var x2 = imagemxy[0];
var y2 = imagemxy[1]+10;
}
else{
if ($i("barraDeBotoes1")){
var x1 = imagemxy[0];
var x2 = imagemxy[1]+10;
}
}
if ($i("barraDeBotoes1"))
i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes1","i3geo_barra1",true,x1,y1);
if ($i("barraDeBotoes2"))
i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes2","i3geo_barra2",false,x2,y2);
//ativa as funções dos botões
i3GEO.barraDeBotoes.ativaBotoes();
if (document.getElementById("botao3d"))
{
if (i3GEO.configura.map3d == ""){document.getElementById("botao3d").style.display="none";}
}
}
},
/*
Function: flamingo
Interface baseada no software flamingo (flash)
*/
flamingo:{
redesenha: function(){
var w = parseInt($i("flamingo").style.width);
if (w == i3GEO.parametros.w)
{$i("flamingo").style.height = parseInt($i("flamingo").style.height)+1;}
else
{$i("flamingo").style.height = parseInt($i("flamingo").style.height)-1;}
i3GEO.janela.fechaAguarde();
},
cria: function(w,h){
var i = $i(i3GEO.interface.IDCORPO);
if(i){
var f = $i("flamingo");
if(!f){
var ins = '<div id=flamingo style="width:0px;height:0px;text-align:left;background-image:url(/"'+i3GEO.configura.locaplic+'/imagens/i3geo1bw.jpg/")"></div>';
i.innerHTML = ins;
}
var f = $i("flamingo");
f.style.width = w;
f.style.height = h;
i3GEO.interface.IDMAPA = "flamingo";
}
},
inicia: function(){
var monta = function(retorno){
$i("flamingo").style.height = i3GEO.parametros.h + 45;
childPopups = new Array();
childPopupNr = 0;
var so = new SWFObject(i3GEO.configura.locaplic+"/pacotes/flamingo/flamingo/flamingo.swf?config="+retorno.data, "flamingoi", "100%", "100%", "8", "#eaeaea");
so.addParam("wmode","transparent");
so.write("flamingo");
}
i3GEO.php.flamingo(monta);
i3GEO.eventos.ativa($i("flamingo"));
i3GEO.maparef.atualiza();
if (i3GEO.configura.mapaRefDisplay != "none")
{
if (i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay")){i3GEO.configura.mapaRefDisplay = i3GEO.util.pegaCookie("i3GEO.configura.mapaRefDisplay");}
if (i3GEO.configura.mapaRefDisplay == "block"){i3GEO.maparef.inicia();}
}
},
ativaBotoes: function(){
}
},
/*
Function: openlayers
Interface baseada no software openlayers
O objeto openlayers criado nessa função pode ser acessado na variável i3geoOL
*/
openlayers:{
redesenha: function(){
if($i("openlayers_OpenLayers_Container")){
var no = $i("openlayers_OpenLayers_Container");
var divs1 = no.getElementsByTagName("div");
var n1 = divs1.length;
for(a=0;a<n1;a++){
var divs2 = divs1[a].getElementsByTagName("div");
var n2 = divs2.length;
for(b=0;b<n2;b++){
var imgs = divs2[b].getElementsByTagName("img");
var nimg = imgs.length;
for(c=0;c<nimg;c++){
imgs[c].src += "&x";
}
}
}
}
i3GEO.janela.fechaAguarde();
},
cria: function(w,h){
var i = $i(i3GEO.interface.IDCORPO);
if(i){
var f = $i("openlayers");
if(!f){
var ins = '<div id=openlayers style="width:0px;height:0px;text-align:left;background-image:url('+i3GEO.configura.locaplic+'/imagens/i3geo1bw.jpg)"></div>';
i.innerHTML = ins;
}
var f = $i("openlayers");
f.style.width = w;
f.style.height = h;
}
i3GEO.interface.IDMAPA = "openlayers";
},
inicia: function(){
var montaMapa = function(){
var url = window.location.protocol+"//"+window.location.host+i3GEO.parametros.cgi+"?";
url += "map="+i3GEO.parametros.mapfile+"&mode=map&SRS=epsg:4326&";
i3geoOL = new OpenLayers.Map('openlayers', { controls: [] });
i3geoOLlayer = new OpenLayers.Layer.MapServer( "Temas I3Geo", url,{layers:'estadosl'},{'buffer':1},{isBaseLayer:true, opacity: 1});
i3geoOLlayer.setVisibility(true);
i3geoOL.addLayer(i3geoOLlayer);
i3geoOL.events.register("mousemove", i3geoOL, function(e){
//pega as coordenadas do cursor
if (navm)
{var p = new OpenLayers.Pixel(e.x,e.y);}
else
{var p = e.xy;}
//altera o indicador de localizacao
var lonlat = i3geoOL.getLonLatFromViewPortPx(p);
var d = i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);
try{
objposicaomouse.x = p.x;
objposicaomouse.y = p.y;
objposicaocursor.ddx = lonlat.lon;
objposicaocursor.ddy = lonlat.lat;
objposicaocursor.telax = p.x;
objposicaocursor.telay = p.y;
var dc = $i("i3geo");
if ($i("openlayers_OpenLayers_Container")){var dc = $i("openlayers_OpenLayers_Container");}
while (dc.offsetParent){
dc = dc.offsetParent;
objposicaocursor.telax = objposicaocursor.telax + dc.offsetLeft;
objposicaocursor.telay = objposicaocursor.telay + dc.offsetTop;
}
//movecursor();
}
catch(e){}
});
var pz = new OpenLayers.Control.PanZoomBar({numZoomLevels: 5});
i3geoOL.addControl(pz);
pz.div.style.zIndex = 5000;
/*
$i("OpenLayers_Control_PanZoom_pandown").style.top=parseInt($i("OpenLayers_Control_PanZoom_pandown").style.top)+5;
$i("OpenLayers_Control_PanZoom_panup").style.top=parseInt($i("OpenLayers_Control_PanZoom_panup").style.top)+5;
$i("OpenLayers_Control_PanZoom_panleft").style.top=parseInt($i("OpenLayers_Control_PanZoom_panleft").style.top)+5;
$i("OpenLayers_Control_PanZoom_panright").style.top=parseInt($i("OpenLayers_Control_PanZoom_panright").style.top)+5;
*/
var navc = new OpenLayers.Control.NavToolbar();
i3geoOL.addControl(navc);
navc.div.style.left="8px";
navc.div.style.top="-20px";
navc.div.onclick = function(){
i3GEO.util.mudaCursor(i3GEO.configura.cursores,"pan","img",i3GEO.configura.locaplic);
g_operacao="navega";
};
zb = new OpenLayers.Control.ZoomToMaxExtent();
var botoesadic = new OpenLayers.Control.Panel();
/*
botoesadic.addControls([
new OpenLayers.Control.ZoomToMaxExtent()
]);
i3geoOL.addControl(botoesadic);
botoesadic.div.style.left="10px";
botoesadic.div.style.top=parseInt($i("OpenLayers_Control_PanZoom_zoomout").style.top)+77;
*/
i3geoOL.addControl(new OpenLayers.Control.LayerSwitcher());
var m = i3GEO.parametros.mapexten.split(" ");
var b = new OpenLayers.Bounds(m[0],m[1],m[2],m[3]);
i3geoOL.zoomToExtent(b);
i3geoOL.addControl(new OpenLayers.Control.Scale("escalanumerica"));
i3geoOL.addControl(new OpenLayers.Control.KeyboardDefaults());
//var ol_overview = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://labs.metacarta.com/wms/vmap0",{layers: 'basic'});
//var options = {layers: [ol_overview],minRatio: 8,maxRatio: 128};
//var overview = new OpenLayers.Control.OverviewMap(options);
//i3geoOL.addControl(overview);
i3GEO.eventos.ativa($i("openlayers"));
var pos = i3GEO.util.pegaPosicaoObjeto($i("openlayers"));
if ($i("aguarde")){
$top("aguarde",pos[1]);
$left("aguarde",pos[0]);
}
};
i3GEO.php.openlayers(montaMapa);
},
ativaBotoes: function(){
}
},
/*
Function: googlemaps
Interface baseada no software googlemaps
O objeto criado com a API do google maps pode ser acessado na variável i3GeoMap
*/
googlemaps:{
/*
Property: OPACIDADE
Valor da opacidade da camada i3geo do mapa
Varia de 0 a 1
Default:
0.8
Type:
{Numeric}
*/
OPACIDADE: 0.8,
redesenha: function(){
if(i3GeoMap != ""){
posfixo = posfixo + "&";
if(tile == false){
i3GeoMap.removeOverlay(wmsmap);
wmsmap = new GGroundOverlay(i3GEO.interface.googlemaps.criaWMS()+posfixo, i3GeoMap.getBounds());
i3GeoMap.addOverlay(wmsmap);
}
else{
i3GeoMap.removeOverlay(i3GEOTileO);
var i3GEOTile = new GTileLayer(null,0,18,{
tileUrlTemplate:i3GEO.interface.googlemaps.criaTile()+posfixo,
isPng:true,
opacity:i3GEO.interface.googlemaps.OPACIDADE });
i3GEOTileO = new GTileLayerOverlay(i3GEOTile);
i3GeoMap.addOverlay(i3GEOTileO);
}
}
},
cria: function(w,h){
posfixo = "&";
var i = $i(i3GEO.interface.IDCORPO);
if(i){
var f = $i("googlemapsdiv");
if(!f){
var ins = '<div id=googlemapsdiv style="width:0px;height:0px;text-align:left;background-image:url('+i3GEO.configura.locaplic+'/imagens/i3geo1bw.jpg)"></div>';
i.innerHTML = ins;
}
var f = $i("googlemapsdiv");
f.style.width = w;
f.style.height = h;
}
i3GeoMap = "";
i3GEO.interface.IDMAPA = "googlemapsdiv";
},
inicia: function(){
tile = false;
var ver = i3GEO.parametros.versaomscompleta.split(".");
if(parseInt(i3GEO.parametros.versaoms) >= 5 && parseInt(ver[1]) > 1)
{tile = true;}
var pol = i3GEO.parametros.mapexten;
var ret = pol.split(" ");
var pt1 = (( (ret[0] * -1) - (ret[2] * -1) ) / 2) + ret[0] *1;
var pt2 = (((ret[1] - ret[3]) / 2)* -1) + ret[1] *1;
i3GeoMap = new GMap2($i(i3GEO.interface.IDMAPA));
i3GeoMap.setMapType(G_SATELLITE_MAP);
i3GeoMap.addControl(new GLargeMapControl());
i3GeoMap.addControl(new GMapTypeControl());
var bottomLeft = new GControlPosition(G_ANCHOR_BOTTOM_LEFT,new GSize(0,40));
i3GeoMap.addControl(new GScaleControl(),bottomLeft);
var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT);
i3GeoMap.addControl(new GOverviewMapControl(),bottomRight);
i3GeoMap.setCenter(new GLatLng(pt2,pt1), 4);
if(tile == false){
wmsmap = new GGroundOverlay(i3GEO.interface.googlemaps.criaWMS(), i3GeoMap.getBounds());
i3GeoMap.addOverlay(wmsmap);
GEvent.addListener(i3GeoMap, "zoomend", function() {
i3GeoMap.removeOverlay(wmsmap);
wmsmap = new GGroundOverlay(i3GEO.interface.googlemaps.criaWMS(), i3GeoMap.getBounds());
i3GeoMap.addOverlay(wmsmap);
i3GEO.interface.googlemaps.recalcPar();
g_operacao = "";
g_tipoacao = "";
});
GEvent.addListener(i3GeoMap, "dragend", function() {
i3GeoMap.removeOverlay(wmsmap);
wmsmap = new GGroundOverlay(i3GEO.interface.googlemaps.criaWMS(), i3GeoMap.getBounds());
i3GeoMap.addOverlay(wmsmap);
i3GEO.interface.googlemaps.recalcPar();
});
GEvent.addListener(i3GeoMap, "dragstart", function() {
g_operacao = "";
g_tipoacao = "";
});
}
else{
//i3GEO.janela.slider("i3GEO.interface.googlemaps.mudaOpacidade","150");
var i3GEOTile = new GTileLayer(null,0,18,{
tileUrlTemplate:i3GEO.interface.googlemaps.criaTile(),
isPng:true,
opacity:i3GEO.interface.googlemaps.OPACIDADE });
i3GEOTileO = new GTileLayerOverlay(i3GEOTile);
i3GeoMap.addOverlay(i3GEOTileO);
var myMapType = new GMapType([i3GEOTile], new GMercatorProjection(18), 'i3Geo');
i3GeoMap.addMapType(myMapType);
GEvent.addListener(i3GeoMap, "dragstart", function() {
g_operacao = "";
g_tipoacao = "";
});
GEvent.addListener(i3GeoMap, "dragend", function() {
i3GEO.interface.googlemaps.recalcPar();
});
GEvent.addListener(i3GeoMap, "zoomend", function() {
i3GEO.interface.googlemaps.recalcPar();
g_operacao = "";
g_tipoacao = "";
});
}
i3GEO.interface.googlemaps.ativaBotoes();
i3GEO.eventos.ativa($i(i3GEO.interface.IDMAPA));
i3GEO.gadgets.mostraCoordenadasGEO();
i3GEO.gadgets.mostraMenuSuspenso();
var pos = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.interface.IDMAPA));
GEvent.addListener(i3GeoMap, "mousemove", function(ponto) {
var teladms = i3GEO.calculo.dd2dms(ponto.lng(),ponto.lat());
var tela = i3GeoMap.fromLatLngToContainerPixel(ponto);
objposicaocursor = {
ddx: ponto.lng(),
ddy: ponto.lat(),
dmsx: teladms[0],
dmsy: teladms[1],
imgx:tela.x,
imgy:tela.y,
telax: tela.x + pos[0],
telay: tela.y + pos[1]
};
});
g_operacao = "";
g_tipoacao = "";
},
bbox: function(){
var bd = i3GeoMap.getBounds();
var so = bd.getSouthWest();
var ne = bd.getNorthEast();
var bbox = so.lng()+" "+so.lat()+" "+ne.lng()+" "+ne.lat();
return (bbox);
},
criaWMS: function(){
var cgi = i3GEO.configura.locaplic+"/classesphp/parse_cgi.php?g_sid="+i3GEO.configura.sid;
var parametros = "&map_size="+parseInt($i(i3GEO.interface.IDMAPA).style.width);
parametros += ","+parseInt($i(i3GEO.interface.IDMAPA).style.height);
parametros += "&mapext="+i3GEO.interface.googlemaps.bbox();
parametros += "&map_imagecolor=-1 -1 -1&map_transparent=on";
return(cgi+parametros);
},
criaTile: function(){
var cgi = i3GEO.util.protocolo()+"://"+window.location.host+i3GEO.parametros.cgi+"?";
var parametros = "map="+i3GEO.parametros.mapfile;
parametros += '&mode=tile';
parametros += '&tilemode=gmap';
parametros += '&tile={X}+{Y}+{Z}';
//alert(cgi+parametros)
return(cgi+parametros);
},
ativaBotoes: function(){
var imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.interface.IDCORPO));
if ($i("barraDeBotoes2")){
var x2 = imagemxy[0]+80;
var y2 = imagemxy[1]+10;
}
if ($i("barraDeBotoes2"))
i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes2","i3geo_barra2",false,x2,y2);
//ativa as funções dos botões
i3GEO.barraDeBotoes.ativaBotoes();
},
mudaOpacidade: function(valor){
//$i("xg").value = valor / 200;
i3GEO.interface.googlemaps.OPACIDADE = valor / 200;
i3GEO.interface.googlemaps.redesenha();
},
recalcPar: function(){
g_operacao = "";
g_tipoacao = "";
var bounds = i3GeoMap.getBounds();
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();
i3GEO.parametros.mapexten = sw.lng()+" "+sw.lat()+" "+ne.lng()+" "+ne.lat();
}
},
/*
Function: googleearth
Interface baseada no software googlemaps
O objeto criado com a API do google maps pode ser acessado na variável i3GeoMap
*/
googleearth:{
redesenha: function(){
try{
linki3geo.setHref(linki3geo.getHref()+"&");
//nl.setLink(linki3geo);
}
catch(e){};
},
cria: function(w,h){
/*
var i = $i(i3GEO.interface.IDCORPO);
if(i){
i3GeoMap = document.createElement("iframe");
i3GeoMap.style.width = w;
i3GeoMap.style.height = h;
i.appendChild(i3GeoMap);
}
*/
var i = $i(i3GEO.interface.IDCORPO);
if(i){
var i3GeoMap3d = document.createElement("div");
i3GeoMap3d.style.width = w;
i3GeoMap3d.style.height = h + 45;
i.style.height = h + 45;
i3GeoMap3d.id = "i3GeoMap3d";
i.appendChild(i3GeoMap3d);
}
i3GEO.interface.IDMAPA = "i3GeoMap3d";
google.load("earth", "1");
var i3GeoMap = null;
},
inicia: function(){
google.earth.createInstance("i3GeoMap3d", i3GEO.interface.googleearth.iniciaGE, i3GEO.interface.googleearth.falha);
},
iniciaGE: function(object){
/*
var src = "http://www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/114026893455619160549/embedkmlgadget.xml&up_kml_url=";
var i = i3GEO.configura.locaplic+"/pacotes/kmlmapserver/kmlservice.php?map="+i3GEO.parametros.mapfile+"&typename=estadosl&request=kml&mode=map&";
alert(i)
src += escape(i);
src += "&up_view_mode=earth&up_earth_2d_fallback=0&up_earth_fly_from_space=1&up_earth_show_buildings=0&synd=open&w=320&h=400&title=Embedded+KML+Viewer&border=%23ffffff%7C3px%2C1px+solid+%23999999&source=http%3A%2F%2Fwww.gmodules.com%2Fig%2Fcreator%3Fsynd%3Dopen%26url%3Dhttp%3A%2F%2Fhosting.gmodules.com%2Fig%2Fgadgets%2Ffile%2F114026893455619160549%2Fembedkmlgadget.xml";
i3GeoMap.src = src;
*/
i3GeoMap = object;
i3GeoMap.getWindow().setVisibility(true);
kmlUrl = i3GEO.configura.locaplic+"/pacotes/kmlmapserver/kmlservice.php?map="+i3GEO.parametros.mapfile+"&typename=estadosl&request=kml&mode=map&"
linki3geo = i3GeoMap.createLink('');
linki3geo.setHref(kmlUrl);
nl = i3GeoMap.createNetworkLink('');
nl.setLink(linki3geo);
nl.setFlyToView(true);
i3GeoMap.getFeatures().appendChild(nl);
var options = i3GeoMap.getOptions();
options.setMouseNavigationEnabled(true);
options.setStatusBarVisibility(true);
//options.setGridVisibility(true);
options.setOverviewMapVisibility(true);
options.setScaleLegendVisibility(true);
//options.setAtmosphereVisibility(true);
i3GeoMap.getNavigationControl().setVisibility(i3GeoMap.VISIBILITY_SHOW);
},
falha: function(){alert("Falhou. Vc precisa do plugin instalado");},
ativaBotoes: function(){}
}
};
//YAHOO.log("carregou classe interface", "Classes i3geo");