Commit 98b612755b7e6b4b465447ca245a497990a5b93b
1 parent
240cf9db
Exists in
master
and in
7 other branches
Atualização da API do Google Maps na ferramenta "googlemaps"
Showing
5 changed files
with
624 additions
and
6 deletions
Show diff stats
@@ -0,0 +1,63 @@ | @@ -0,0 +1,63 @@ | ||
1 | +//+$trad(1,i3GEOF.googlemaps.dicionario)+ | ||
2 | +i3GEOF.googlemaps.dicionario = { | ||
3 | +1: [{ | ||
4 | +pt:"", | ||
5 | +en:"", | ||
6 | +es:"", | ||
7 | +it:"" | ||
8 | +}], | ||
9 | +2: [{ | ||
10 | +pt:"", | ||
11 | +en:"", | ||
12 | +es:"", | ||
13 | +it:"" | ||
14 | +}], | ||
15 | +3: [{ | ||
16 | +pt:"", | ||
17 | +en:"", | ||
18 | +es:"", | ||
19 | +it:"" | ||
20 | +}], | ||
21 | +4: [{ | ||
22 | +pt:"", | ||
23 | +en:"", | ||
24 | +es:"", | ||
25 | +it:"" | ||
26 | +}], | ||
27 | +5: [{ | ||
28 | +pt:"", | ||
29 | +en:"", | ||
30 | +es:"", | ||
31 | +it:"" | ||
32 | +}], | ||
33 | +6: [{ | ||
34 | +pt:"", | ||
35 | +en:"", | ||
36 | +es:"", | ||
37 | +it:"" | ||
38 | +}], | ||
39 | +7: [{ | ||
40 | +pt:"", | ||
41 | +en:"", | ||
42 | +es:"", | ||
43 | +it:"" | ||
44 | +}], | ||
45 | +8: [{ | ||
46 | +pt:"", | ||
47 | +en:"", | ||
48 | +es:"", | ||
49 | +it:"" | ||
50 | +}], | ||
51 | +9: [{ | ||
52 | +pt:"", | ||
53 | +en:"", | ||
54 | +es:"", | ||
55 | +it:"" | ||
56 | +}], | ||
57 | +10: [{ | ||
58 | +pt:"", | ||
59 | +en:"", | ||
60 | +es:"", | ||
61 | +it:"" | ||
62 | +}] | ||
63 | +}; | ||
0 | \ No newline at end of file | 64 | \ No newline at end of file |
@@ -0,0 +1,42 @@ | @@ -0,0 +1,42 @@ | ||
1 | +<?php | ||
2 | +include("../../ms_configura.php"); | ||
3 | +include_once("../../classesphp/pega_variaveis.php"); | ||
4 | +?> | ||
5 | +<html> | ||
6 | +<head> | ||
7 | +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | ||
8 | +<link rel="stylesheet" type="text/css" href="../../css/i3geo_ferramentas45.css"> | ||
9 | + | ||
10 | +<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $googleApiKey; ?>"></script> | ||
11 | +<script type="text/javascript"> | ||
12 | +function inicializa() | ||
13 | +{ | ||
14 | + var p2 = <?php echo $x;?>; | ||
15 | + var p1 = <?php echo $y;?>; | ||
16 | + ponto = new GLatLng(p1,p2) | ||
17 | + geocoder = new GClientGeocoder(); | ||
18 | + var pt1 = function(response) | ||
19 | + { | ||
20 | + if (!response || response.Status.code != 200) { | ||
21 | + var ins = "Não foi possível encontrar o endereço. Status Code:" + response.Status.code; | ||
22 | + } else { | ||
23 | + place = response.Placemark[0]; | ||
24 | + var ins = '<b>orig latlng:</b>' + response.name + '<br/>' | ||
25 | + ins += '<b>latlng:</b>' + place.Point.coordinates[0] + "," + place.Point.coordinates[1] + '<br>' | ||
26 | + ins += '<b>Status Code:</b>' + response.Status.code + '<br>' | ||
27 | + ins += '<b>Status Request:</b>' + response.Status.request + '<br>' | ||
28 | + ins += '<b>Address:</b>' + place.address + '<br>' | ||
29 | + ins += '<b>Accuracy:</b>' + place.AddressDetails.Accuracy + '<br>' | ||
30 | + ins += '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode; | ||
31 | + ins += '<br><br>O endereço obtido é aproximado. Mais detalhes em <a href="http://nicogoeminne.googlepages.com/documentation.html" >Google</a>' | ||
32 | + } | ||
33 | + document.getElementById("mapa").innerHTML = ins | ||
34 | + } | ||
35 | + geocoder.getLocations(ponto, pt1); | ||
36 | +} | ||
37 | +</script> | ||
38 | + </head> | ||
39 | + <body onload="inicializa()"> | ||
40 | + <div id="mapa"></div> | ||
41 | + </body> | ||
42 | +</html> | ||
0 | \ No newline at end of file | 43 | \ No newline at end of file |
@@ -0,0 +1,498 @@ | @@ -0,0 +1,498 @@ | ||
1 | +/* | ||
2 | +Title: Google Maps | ||
3 | + | ||
4 | +Abre um mapa, baseado na API do Google Maps, que permite navegar de forma integrada com o mapa principal do i3Geo. | ||
5 | + | ||
6 | +O código da API do Google Maps é armazenada em i3geo/ms_configura.php | ||
7 | + | ||
8 | +Veja: | ||
9 | + | ||
10 | +<i3GEO.navega.google> | ||
11 | + | ||
12 | +Arquivo: | ||
13 | + | ||
14 | +i3geo/ferramentas/googlemaps/index.php | ||
15 | + | ||
16 | +Licenca: | ||
17 | + | ||
18 | +GPL2 | ||
19 | + | ||
20 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
21 | + | ||
22 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
23 | +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
24 | + | ||
25 | +Este programa é software livre; você pode redistribuí-lo | ||
26 | +e/ou modificá-lo sob os termos da Licença Pública Geral | ||
27 | +GNU conforme publicada pela Free Software Foundation; | ||
28 | + | ||
29 | +Este programa é distribuído na expectativa de que seja útil, | ||
30 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
31 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
32 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
33 | +Você deve ter recebido uma cópia da Licença Pública Geral do | ||
34 | +GNU junto com este programa; se não, escreva para a | ||
35 | +Free Software Foundation, Inc., no endereço | ||
36 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
37 | +*/ | ||
38 | +/* | ||
39 | +Function: inicializa | ||
40 | + | ||
41 | +Cria o mapa do Google Maps e adiciona os botões especiais do i3Geo. Define os eventos que disparam modificações no mapa | ||
42 | +principal do i3Geo quando é feita a navegação. | ||
43 | +*/ | ||
44 | +i3GEO = window.parent.i3GEO; | ||
45 | +$i = function(id){ | ||
46 | + return window.parent.document.getElementById(id); | ||
47 | +}; | ||
48 | +box = window.parent.$i("boxpingoogle"); | ||
49 | +if(i3GEO){ | ||
50 | + i3GEO.util.criaBox("boxg"); | ||
51 | + $i("boxg").style.display = "none"; | ||
52 | +}; | ||
53 | +function inicializa(){ | ||
54 | + counterClick = 0; | ||
55 | + var m = document.getElementById("mapa"); | ||
56 | + if(i3GEO){ | ||
57 | + i3GEO.util.criaPin("boxpingoogle",i3GEO.configura.locaplic+'/imagens/dot1red.gif',"5px","5px"); | ||
58 | + box = $i("boxpingoogle"); | ||
59 | + m.style.width = (i3GEO.parametros.w / 2.5) - 20 + "px"; | ||
60 | + m.style.height = (i3GEO.parametros.h / 2.5) -20 + "px"; | ||
61 | + i3geoOverlay = false; | ||
62 | + if($i("boxg")){ | ||
63 | + $i("boxg").style.zIndex = 0; | ||
64 | + } | ||
65 | + navm = false; // IE | ||
66 | + navn = false; // netscape | ||
67 | + var app = navigator.appName.substring(0,1); | ||
68 | + if (app=='N') navn=true; else navm=true; | ||
69 | + var pol = i3GEO.parametros.mapexten; | ||
70 | + var ret = pol.split(" "); | ||
71 | + var pt1 = (( (ret[0] * -1) - (ret[2] * -1) ) / 2) + ret[0] *1; | ||
72 | + var pt2 = (((ret[1] - ret[3]) / 2)* -1) + ret[1] *1; | ||
73 | + var pt = pt1+","+pt2; | ||
74 | + try{ | ||
75 | + var coordenadas = i3GEO.navega.dialogo.google.coordenadas; | ||
76 | + } | ||
77 | + catch(e){} | ||
78 | + } | ||
79 | + else{ | ||
80 | + var pt1 = -54; | ||
81 | + var pt2 = -12; | ||
82 | + } | ||
83 | + var centro = new google.maps.LatLng(pt2,pt1); | ||
84 | + var nz = 8; | ||
85 | + if(i3GEO && i3GEO.Interface.ATUAL === "openlayers"){ | ||
86 | + nz = window.parent.i3geoOL.getZoom() + 2; | ||
87 | + } | ||
88 | + map = new google.maps.Map(m,{zoom:nz,center:centro,scaleControl:true,mapTypeControl:true,streetViewControl:true,zoomControl:true,mapTypeId:google.maps.MapTypeId.SATELLITE}); | ||
89 | + if(coordenadas){ | ||
90 | + adicionaMarcasMapa(coordenadas); | ||
91 | + } | ||
92 | + | ||
93 | + google.maps.event.addListener(map, "moveend", function() { | ||
94 | + ondegoogle(map); | ||
95 | + }); | ||
96 | + google.maps.event.addListener(map, "bounds_changed", function() { | ||
97 | + if(i3GEO){ | ||
98 | + ondegoogle(); | ||
99 | + } | ||
100 | + }); | ||
101 | + google.maps.event.addListener(map, "mousemove", function(ponto) { | ||
102 | + var teladms,tela,temp, | ||
103 | + mapexten = i3GEO.parametros.mapexten; | ||
104 | + teladms = i3GEO.calculo.dd2dms(ponto.x,ponto.y); | ||
105 | + window.parent.objposicaocursor = { | ||
106 | + ddx: ponto.x, | ||
107 | + ddy: ponto.y, | ||
108 | + dmsx: teladms[0], | ||
109 | + dmsy: teladms[1], | ||
110 | + imgx:0, | ||
111 | + imgy:0, | ||
112 | + telax: 0, | ||
113 | + telay: 0 | ||
114 | + }; | ||
115 | + i3GEO.eventos.mousemoveMapa(); | ||
116 | + if(i3GEO.Interface.ATUAL === "googleearth") | ||
117 | + {return;} | ||
118 | + temp = mapexten.split(" "); | ||
119 | + if(ponto.x < temp[2] && ponto.y < temp[3]){ | ||
120 | + xy = i3GEO.calculo.dd2tela(ponto.x,ponto.y,$i(i3GEO.Interface.IDMAPA),mapexten,i3GEO.parametros.pixelsize); | ||
121 | + box.style.display = "block"; | ||
122 | + box.style.width = "5px"; | ||
123 | + box.style.height = "5px"; | ||
124 | + box.style.top = (parseInt(xy[1],10) + 2.5) +"px"; | ||
125 | + box.style.left = (parseInt(xy[0],10) - 2.5) +"px"; | ||
126 | + } | ||
127 | + }); | ||
128 | + | ||
129 | + /* | ||
130 | + function botaoI3geo() {}; | ||
131 | + botaoI3geo.prototype = new GControl(); | ||
132 | + botaoI3geo.prototype.initialize = function(map) { | ||
133 | + var container = document.createElement("div"); | ||
134 | + var i3geo = document.createElement("div"); | ||
135 | + this.setButtonStyle_(i3geo); | ||
136 | + container.appendChild(i3geo); | ||
137 | + i3geo.appendChild(document.createTextNode("i3Geo")); | ||
138 | + google.maps.event.addDomListener(i3geo, "click", function() { | ||
139 | + try | ||
140 | + {map.removeOverlay(wmsmap);wmsmap = null;} | ||
141 | + catch(x){ | ||
142 | + wmsmap = new google.maps.GroundOverlay(criaWMS(), map.getBounds()); | ||
143 | + map.addOverlay(wmsmap); | ||
144 | + if(typeof(console) !== 'undefined'){console.error(x);} | ||
145 | + } | ||
146 | + }); | ||
147 | + var rota = document.createElement("div"); | ||
148 | + this.setButtonStyle_(rota); | ||
149 | + container.appendChild(rota); | ||
150 | + rota.appendChild(document.createTextNode("Rota")); | ||
151 | + GEvent.addDomListener(rota, "click", function() { | ||
152 | + ativaI3geoRota(); | ||
153 | + }); | ||
154 | + map.getContainer().appendChild(container); | ||
155 | + return container; | ||
156 | + }; | ||
157 | + botaoI3geo.prototype.getDefaultPosition = function() { | ||
158 | + return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50, 50)); | ||
159 | + }; | ||
160 | + botaoI3geo.prototype.setButtonStyle_ = function(button) { | ||
161 | + button.style.textDecoration = "none"; | ||
162 | + button.style.color = "black"; | ||
163 | + button.style.backgroundColor = "white"; | ||
164 | + button.style.font = "small Arial"; | ||
165 | + button.style.border = "1px solid black"; | ||
166 | + button.style.padding = "1px"; | ||
167 | + button.style.marginBottom = "3px"; | ||
168 | + button.style.textAlign = "center"; | ||
169 | + button.style.width = "3em"; | ||
170 | + button.style.cursor = "pointer"; | ||
171 | + }; | ||
172 | + */ | ||
173 | + if(i3GEO){ | ||
174 | + if(i3GEO.parametros.mapfile){ | ||
175 | + botaoI3geo(); | ||
176 | + } | ||
177 | + ondegoogle(map); | ||
178 | + } | ||
179 | + botaoRota(); | ||
180 | + if(coordenadas) | ||
181 | + {adicionaMarcasMapa(coordenadas);} | ||
182 | +} | ||
183 | +function botaoI3geo(){ | ||
184 | + var controlDiv = document.createElement('div'); | ||
185 | + controlDiv.index = 1; | ||
186 | + controlDiv.style.padding = '5px'; | ||
187 | + // Set CSS for the control border | ||
188 | + var controlUI = document.createElement('div'); | ||
189 | + controlUI.style.backgroundColor = 'white'; | ||
190 | + controlUI.style.borderStyle = 'solid'; | ||
191 | + controlUI.style.borderWidth = '2px'; | ||
192 | + controlUI.style.cursor = 'pointer'; | ||
193 | + controlUI.style.textAlign = 'center'; | ||
194 | + controlUI.title = 'Adiciona o mapa ao Google'; | ||
195 | + controlDiv.appendChild(controlUI); | ||
196 | + var controlText = document.createElement('div'); | ||
197 | + controlText.style.fontFamily = 'Arial,sans-serif'; | ||
198 | + controlText.style.fontSize = '12px'; | ||
199 | + controlText.style.paddingLeft = '4px'; | ||
200 | + controlText.style.paddingRight = '4px'; | ||
201 | + controlText.innerHTML = '<b>i3Geo</b>'; | ||
202 | + controlUI.appendChild(controlText); | ||
203 | + google.maps.event.addDomListener(controlUI, 'click', function() { | ||
204 | + wmsmap = new google.maps.GroundOverlay(criaWMS(), map.getBounds(),{map: map}); | ||
205 | + }); | ||
206 | + map.controls[google.maps.ControlPosition.TOP_RIGHT].push(controlDiv); | ||
207 | +} | ||
208 | +function botaoRota(){ | ||
209 | + var controlDiv = document.createElement('div'); | ||
210 | + controlDiv.index = 1; | ||
211 | + controlDiv.style.padding = '5px'; | ||
212 | + // Set CSS for the control border | ||
213 | + var controlUI = document.createElement('div'); | ||
214 | + controlUI.style.backgroundColor = 'white'; | ||
215 | + controlUI.style.borderStyle = 'solid'; | ||
216 | + controlUI.style.borderWidth = '2px'; | ||
217 | + controlUI.style.cursor = 'pointer'; | ||
218 | + controlUI.style.textAlign = 'center'; | ||
219 | + controlUI.title = ''; | ||
220 | + controlDiv.appendChild(controlUI); | ||
221 | + var controlText = document.createElement('div'); | ||
222 | + controlText.style.fontFamily = 'Arial,sans-serif'; | ||
223 | + controlText.style.fontSize = '12px'; | ||
224 | + controlText.style.paddingLeft = '4px'; | ||
225 | + controlText.style.paddingRight = '4px'; | ||
226 | + controlText.innerHTML = '<b>Rota</b>'; | ||
227 | + controlUI.appendChild(controlText); | ||
228 | + google.maps.event.addDomListener(controlUI, 'click', function() { | ||
229 | + ativaI3geoRota(); | ||
230 | + }); | ||
231 | + map.controls[google.maps.ControlPosition.TOP_RIGHT].push(controlDiv); | ||
232 | +} | ||
233 | +/* | ||
234 | +Function: ondegoogle | ||
235 | + | ||
236 | +Mostra, no mapa principal, um retângulo indicando a extensão geográfica do mapa mostrado na janela do GM | ||
237 | +*/ | ||
238 | +function ondegoogle(){ | ||
239 | + if(!i3GEO || !map.getBounds()){return;} | ||
240 | + var bd = map.getBounds(), | ||
241 | + so = bd.getSouthWest(), | ||
242 | + ne = bd.getNorthEast(), | ||
243 | + xyMin = i3GEO.calculo.dd2tela(so.lng(),so.lat(),$i(i3GEO.Interface.IDMAPA),i3GEO.parametros.mapexten,i3GEO.parametros.pixelsize), | ||
244 | + xyMax = i3GEO.calculo.dd2tela(ne.lng(),ne.lat(),$i(i3GEO.Interface.IDMAPA),i3GEO.parametros.mapexten,i3GEO.parametros.pixelsize), | ||
245 | + box = $i("boxg"), | ||
246 | + w = xyMax[0]-xyMin[0], | ||
247 | + h = xyMin[1]-xyMax[1]; | ||
248 | + if(box){ | ||
249 | + box.style.display = "none"; | ||
250 | + if(w < i3GEO.parametros.w || h < i3GEO.parametros.h){ | ||
251 | + box.style.width = w + "px"; | ||
252 | + box.style.height = h+3 + "px"; | ||
253 | + box.style.top = xyMax[1]+"px"; | ||
254 | + box.style.left = xyMin[0]+"px"; | ||
255 | + box.style.display="block"; | ||
256 | + } | ||
257 | + } | ||
258 | +} | ||
259 | +function moveMapa(bd){ | ||
260 | + if(!i3GEO){return;} | ||
261 | + nex = bd.minX+" "+bd.minY+" "+bd.maxX+" "+bd.maxY; | ||
262 | + var p = i3GEO.locaplic+"/classesphp/mapa_controle.php?funcao=mudaext&ext="+nex; | ||
263 | + var cp = new cpaint(); | ||
264 | + //cp.set_debug(2) | ||
265 | + cp.set_response_type("JSON"); | ||
266 | + cp.call(p,"mudaExtensao",i3GEO.atualiza); | ||
267 | +} | ||
268 | +/* | ||
269 | +Function: panTogoogle | ||
270 | + | ||
271 | +Desloca o mapa principal conforme a extensão geográfica do mapa do GM | ||
272 | +*/ | ||
273 | +function panTogoogle(){ | ||
274 | + if(!i3GEO){return;} | ||
275 | + var b = $i("boxg"); | ||
276 | + b.style.display="block"; | ||
277 | + var pol = i3GEO.parametros.mapexten; | ||
278 | + var ret = pol.split(" "); | ||
279 | + var pt1 = (( (ret[0] * -1) - (ret[2] * -1) ) / 2) + ret[0] *1; | ||
280 | + var pt2 = (((ret[1] - ret[3]) / 2)* -1) + ret[1] *1; | ||
281 | + map.panTo(new google.maps.LatLng(pt2,pt1)) | ||
282 | +} | ||
283 | +/* | ||
284 | +Function: bbox | ||
285 | + | ||
286 | +Obtém os valores de extensão geográfica do GM e converte para uma string no formato aceito pelo i3Geo | ||
287 | + | ||
288 | +Return: | ||
289 | + | ||
290 | +{String} - xmin ymin xmax ymax | ||
291 | +*/ | ||
292 | +function bbox(){ | ||
293 | + var bd = map.getBounds(); | ||
294 | + var so = bd.getSouthWest(); | ||
295 | + var ne = bd.getNorthEast(); | ||
296 | + var bbox = so.lng()+" "+so.lat()+" "+ne.lng()+" "+ne.lat(); | ||
297 | + return (bbox); | ||
298 | +} | ||
299 | +/* | ||
300 | +Function: criaWMS | ||
301 | + | ||
302 | +Formata uma URL que transforma o mapa atual do i3Geo em um WMS, possibilitando sua inclusão como uma camada na janela GM. | ||
303 | + | ||
304 | +Return: | ||
305 | + | ||
306 | +[String} - URL WMS | ||
307 | +*/ | ||
308 | +function criaWMS(){ | ||
309 | + var cgi = i3GEO.configura.locaplic+"/classesphp/parse_cgi.php?g_sid="+i3GEO.configura.sid; | ||
310 | + var parametros = "&map_size="+parseInt(document.getElementById("mapa").style.width); | ||
311 | + parametros += ","+parseInt(document.getElementById("mapa").style.height); | ||
312 | + parametros += "&mapext="+bbox(); | ||
313 | + parametros += "&map_imagecolor=0 0 0&map_transparent=on"; | ||
314 | + return(cgi+parametros); | ||
315 | +} | ||
316 | +function criaTile(){ | ||
317 | + var cgi = window.parent.i3GEO.util.protocolo()+"://"+window.location.host+window.parent.i3GEO.parametros.cgi+"?"; | ||
318 | + var parametros = "map="+window.parent.i3GEO.parametros.mapfile; | ||
319 | + parametros += "&map.scalebar=status+off&map_imagecolor=-1 -1 -1&map_transparent=on"; | ||
320 | + parametros += '&mode=tile'; | ||
321 | + parametros += '&tilemode=gmap'; | ||
322 | + parametros += '&tile={X}+{Y}+{Z}'; | ||
323 | + return(cgi+parametros); | ||
324 | +} | ||
325 | +function ativaI3geo() | ||
326 | +{ | ||
327 | + var i3GEOTile = new GTileLayer(null,0,18,{ | ||
328 | + tileUrlTemplate:criaTile(), | ||
329 | + isPng:true, | ||
330 | + opacity:1 }); | ||
331 | + i3GEOTileO = new GTileLayerOverlay(i3GEOTile); | ||
332 | + map.addOverlay(i3GEOTileO); | ||
333 | +} | ||
334 | +/* | ||
335 | +Function: ativaI3geoRota | ||
336 | + | ||
337 | +Inicia a função de criação de rotas, solicitando a indicação do primeiro ponto | ||
338 | +*/ | ||
339 | +function ativaI3geoRota(){ | ||
340 | + rotaEvento = google.maps.event.addListener(map, "click", parametrosRota); | ||
341 | + i3GEO.janela.tempoMsg("Clique o ponto de origem da rota"); | ||
342 | + counterClick++; | ||
343 | +} | ||
344 | +/* | ||
345 | +Function: parametrosRota | ||
346 | + | ||
347 | +Obtém os parâmetros para criação da rota, inclusive o ponto de destino | ||
348 | +*/ | ||
349 | +function parametrosRota(overlay){ | ||
350 | + if(counterClick == 1){ | ||
351 | + counterClick++; | ||
352 | + i3GEO.janela.tempoMsg("Clique o ponto de destino da rota"); | ||
353 | + pontoRota1 = overlay.latLng; | ||
354 | + return; | ||
355 | + } | ||
356 | + if(counterClick == 2){ | ||
357 | + pontoRota2 = overlay.latLng; | ||
358 | + counterClick = 0; | ||
359 | + google.maps.event.removeListener(rotaEvento); | ||
360 | + constroiRota(); | ||
361 | + //montaRota(); | ||
362 | + } | ||
363 | +} | ||
364 | +/* | ||
365 | +Function: constroiRota | ||
366 | + | ||
367 | +Cria a rota do ponto de origem ao ponto de destino | ||
368 | +*/ | ||
369 | +function constroiRota() | ||
370 | +{ | ||
371 | + var pt2 = function(response,status){ | ||
372 | + if (status == google.maps.GeocoderStatus.OK) { | ||
373 | + var place = response[0]; | ||
374 | + var point = place.geometry.location; | ||
375 | + //marker = new google.maps.Marker({point:point}); | ||
376 | + endereco2 = place.formatted_address; | ||
377 | + /* | ||
378 | + var infowindow = new google.maps.InfoWindow({ | ||
379 | + map: map, | ||
380 | + position: point, | ||
381 | + content: '<span style=font-size:9px ><b>latlng:</b>' + point.lat() + "," + point.lng() + '<br><b>Address:</b>' + endereco2 + '<br>' | ||
382 | + }); | ||
383 | + */ | ||
384 | + endereco2 = window.prompt("Endereco do final",endereco2) | ||
385 | + if (endereco2!=null && endereco2!=""){ | ||
386 | + //marker.setMap(map); | ||
387 | + montaRota(); | ||
388 | + } | ||
389 | + } | ||
390 | + else{ | ||
391 | + i3GEO.janela.tempoMsg("Ocorreu um erro"); | ||
392 | + } | ||
393 | + }; | ||
394 | + var pt1 = function(response,status){ | ||
395 | + //map.clearOverlays(); | ||
396 | + if (status == google.maps.GeocoderStatus.OK) { | ||
397 | + var place = response[0]; | ||
398 | + var point = place.geometry.location; | ||
399 | + endereco1 = place.formatted_address; | ||
400 | + /* | ||
401 | + var infowindow = new google.maps.InfoWindow({ | ||
402 | + map: map, | ||
403 | + position: point, | ||
404 | + content: '<span style=font-size:9px ><b>latlng:</b>' + point.lat() + "," + point.lng() + '<br><b>Address:</b>' + endereco1 + '<br>' | ||
405 | + }); | ||
406 | + */ | ||
407 | + endereco1 = window.prompt("Endereco do inicio",endereco1) | ||
408 | + if (endereco1 != null && endereco1 != ""){ | ||
409 | + //marker.setMap(map); | ||
410 | + geocoder.geocode( | ||
411 | + {'location':pontoRota2}, | ||
412 | + pt2 | ||
413 | + ); | ||
414 | + } | ||
415 | + } | ||
416 | + else{ | ||
417 | + i3GEO.janela.tempoMsg("Ocorreu um erro"); | ||
418 | + } | ||
419 | + }; | ||
420 | + var geocoder = new google.maps.Geocoder(); | ||
421 | + geocoder.geocode( | ||
422 | + {'location':pontoRota1}, | ||
423 | + pt1 | ||
424 | + ); | ||
425 | +} | ||
426 | +/* | ||
427 | +Function: montaRota | ||
428 | + | ||
429 | +Inclui o traçado da rota como uma nova camada no mapa principal | ||
430 | +*/ | ||
431 | +function montaRota(){ | ||
432 | + if(!document.getElementById("descrota")){ | ||
433 | + var descrota = document.createElement("div"); | ||
434 | + descrota.id = "descrota"; | ||
435 | + document.body.appendChild(descrota); | ||
436 | + } | ||
437 | + else{ | ||
438 | + descrota = document.getElementById("descrota"); | ||
439 | + descrota.innerHTML = ""; | ||
440 | + } | ||
441 | + var directions = new google.maps.DirectionsService(); | ||
442 | + directions.route( | ||
443 | + {origin: pontoRota1,destination: pontoRota2,'travelMode':google.maps.TravelMode.DRIVING}, | ||
444 | + function(retorno, status) { | ||
445 | + if (status == google.maps.GeocoderStatus.OK){ | ||
446 | + var directionsDisplay = new google.maps.DirectionsRenderer(); | ||
447 | + directionsDisplay.setPanel(descrota); | ||
448 | + directionsDisplay.setMap(map); | ||
449 | + directionsDisplay.setDirections(retorno); | ||
450 | + | ||
451 | + var p = retorno.routes[0].overview_path; | ||
452 | + var nvertices = p.length; | ||
453 | + pontos = []; | ||
454 | + for(i=0;i<nvertices;i++){ | ||
455 | + var vertice = p[i]; | ||
456 | + pontos.push(vertice.lng()+" "+vertice.lat()); | ||
457 | + } | ||
458 | + function ativanovotema(retorno){ | ||
459 | + var temaNovo = retorno.data; | ||
460 | + var converteParaLinha = function(){ | ||
461 | + var cp = new cpaint(); | ||
462 | + cp.set_response_type("JSON"); | ||
463 | + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=sphPT2shp¶=linha&tema="+temaNovo; | ||
464 | + cp.call(p,"sphPT2shp",i3GEO.atualiza); | ||
465 | + } | ||
466 | + var p = window.parent.i3GEO.configura.locaplic+"/ferramentas/inserexy2/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=insereSHP&tema="+retorno.data; | ||
467 | + var cp = new cpaint(); | ||
468 | + cp.set_response_type("JSON"); | ||
469 | + cp.set_transfer_mode('POST'); | ||
470 | + cp.call(p,"insereSHP",converteParaLinha,"&xy="+pontos.join(" ")); | ||
471 | + } | ||
472 | + var cp = new cpaint(); | ||
473 | + cp.set_response_type("JSON"); | ||
474 | + cp.set_transfer_mode("POST"); | ||
475 | + var p = window.parent.i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid; | ||
476 | + cp.call(p,"criaSHPvazio",ativanovotema,"&funcao=criashpvazio"); | ||
477 | + } | ||
478 | + } | ||
479 | + ); | ||
480 | +} | ||
481 | +/* | ||
482 | +Function: adicionaMarcasMapa | ||
483 | + | ||
484 | +Adiciona marcas no mapa conforme um array de coordenadas | ||
485 | + | ||
486 | +Parametro: | ||
487 | + | ||
488 | +coordenadas {array} - array de pares separados por ' ' contendo x e y | ||
489 | +*/ | ||
490 | +function adicionaMarcasMapa(coordenadas){ | ||
491 | + var n = coordenadas.length,i,pt,point,marker; | ||
492 | + for(i=0;i<n;i++){ | ||
493 | + pt = coordenadas[i].split(" "); | ||
494 | + point = new google.maps.LatLng(pt[1],pt[0]); | ||
495 | + marker = new GMarker(point); | ||
496 | + map.addOverlay(marker); | ||
497 | + } | ||
498 | +} | ||
0 | \ No newline at end of file | 499 | \ No newline at end of file |
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +<html> | ||
2 | +<head> | ||
3 | +<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | ||
4 | +<script src="../../pacotes/cpaint/cpaint2.inc.compressed.js" type="text/javascript"></script> | ||
5 | +<script src="index.js" type="text/javascript"></script> | ||
6 | + | ||
7 | +</head> | ||
8 | +<body onload="inicializa();"> | ||
9 | + <div id="mapa" style="width: 440px; height: 340px"></div> | ||
10 | +</body> | ||
11 | +</html> |
leiame.txt
@@ -13,18 +13,22 @@ Se vc está fazendo um upgrade do i3geo, faça cópia dos diretórios temas, aplicma | @@ -13,18 +13,22 @@ Se vc está fazendo um upgrade do i3geo, faça cópia dos diretórios temas, aplicma | ||
13 | e dos arquivos ms_configura.php. Consulte o documento i3geo/guia_de_migracao.txt para verificar | 13 | e dos arquivos ms_configura.php. Consulte o documento i3geo/guia_de_migracao.txt para verificar |
14 | quais cuidados vc deve tomar nos upgrades | 14 | quais cuidados vc deve tomar nos upgrades |
15 | 15 | ||
16 | -Altere a senha da variável $i3geomaster existente em ms_configura.php para desbloquear o i3geo. | 16 | +--------- |
17 | + | ||
18 | +Mantenha-se sempre atualizado utilizando o SVN | ||
19 | + | ||
20 | +Isso permite que eventuais bugs sejam rapidamente corrigidos | ||
21 | + | ||
22 | +Veja como usar o SVN em: http://svn.softwarepublico.gov.br/trac/i3geo | ||
17 | 23 | ||
18 | --------- | 24 | --------- |
19 | 25 | ||
20 | -Se vc está instalando pela primeira vez, veja no site da comunidade i3geo no www.softwarepublico.gov.br | ||
21 | -as instruções que ficam no item "documentacao". Para ter acesso ao portal, vc terá de fazer o cadastramento. | 26 | +Altere a senha da variável $i3geomaster existente em ms_configura.php para desbloquear o i3geo. |
22 | 27 | ||
23 | --------- | 28 | --------- |
24 | 29 | ||
25 | -A partir da versão 3.9 do i3geo foi incluida uma página principal com endereços para | ||
26 | -os aplicativos que vêm com o i3geo (não esqueça de dar uma olhada): | ||
27 | -http://localhost/i3geo/principal.htm | 30 | +Se vc está instalando pela primeira vez, veja no site da comunidade i3geo no www.softwarepublico.gov.br |
31 | +as instruções que ficam no item "documentacao". Para ter acesso ao portal, vc terá de fazer o cadastramento. | ||
28 | 32 | ||
29 | --------- | 33 | --------- |
30 | 34 |