Commit e1cea9b489697321c262677d210be04b59d9ead3
1 parent
0622d570
Exists in
master
and in
7 other branches
inclui ferramenta de localização do usuário na interface googlemaps
Showing
1 changed file
with
44 additions
and
1 deletions
Show diff stats
ferramentas/geolocal/index.js
| @@ -243,6 +243,7 @@ i3GEOF.geolocal = { | @@ -243,6 +243,7 @@ i3GEOF.geolocal = { | ||
| 243 | }, | 243 | }, |
| 244 | limpa: function(){ | 244 | limpa: function(){ |
| 245 | i3GEOF.geolocal.posicoes = []; | 245 | i3GEOF.geolocal.posicoes = []; |
| 246 | + i3GEOF.geolocal[i3GEO.Interface.ATUAL].removeLayer(); | ||
| 246 | i3GEOF.geolocal.listaCoord(); | 247 | i3GEOF.geolocal.listaCoord(); |
| 247 | }, | 248 | }, |
| 248 | excluiLinha: function(i){ | 249 | excluiLinha: function(i){ |
| @@ -317,7 +318,8 @@ i3GEOF.geolocal = { | @@ -317,7 +318,8 @@ i3GEOF.geolocal = { | ||
| 317 | i3GEOF.geolocal.wgs2google(point); | 318 | i3GEOF.geolocal.wgs2google(point); |
| 318 | pointList.push(point); | 319 | pointList.push(point); |
| 319 | pointFeature.push(new OpenLayers.Feature.Vector(point,null,style_blue)); | 320 | pointFeature.push(new OpenLayers.Feature.Vector(point,null,style_blue)); |
| 320 | - } | 321 | + } |
| 322 | + i3GEOF.geolocal.panLinha(n-1); | ||
| 321 | var lineFeature = new OpenLayers.Feature.Vector( | 323 | var lineFeature = new OpenLayers.Feature.Vector( |
| 322 | new OpenLayers.Geometry.LineString(pointList),null,style_blue); | 324 | new OpenLayers.Geometry.LineString(pointList),null,style_blue); |
| 323 | 325 | ||
| @@ -330,6 +332,47 @@ i3GEOF.geolocal = { | @@ -330,6 +332,47 @@ i3GEOF.geolocal = { | ||
| 330 | } | 332 | } |
| 331 | }, | 333 | }, |
| 332 | googlemaps: { | 334 | googlemaps: { |
| 335 | + linhas: null, | ||
| 336 | + marca: null, | ||
| 337 | + desenha: function(){ | ||
| 338 | + var ps = i3GEOF.geolocal.posicoes, | ||
| 339 | + n = ps.length, | ||
| 340 | + i, | ||
| 341 | + l, | ||
| 342 | + pointFeature = []; | ||
| 343 | + for(i=0;i<n;i++){ | ||
| 344 | + l = new google.maps.LatLng(ps[i].coords.latitude,ps[i].coords.longitude); | ||
| 345 | + pointFeature.push( | ||
| 346 | + l | ||
| 347 | + ); | ||
| 348 | + } | ||
| 349 | + i3GEOF.geolocal.googlemaps.removeLayer(); | ||
| 350 | + i3GEOF.geolocal.googlemaps.marca = new google.maps.Marker({ | ||
| 351 | + position: new google.maps.LatLng(ps[0].coords.latitude,ps[0].coords.longitude), | ||
| 352 | + map: i3GeoMap | ||
| 353 | + }); | ||
| 354 | + i3GEOF.geolocal.googlemaps.linhas = new google.maps.Polyline({ | ||
| 355 | + path: pointFeature, | ||
| 356 | + geodesic: true, | ||
| 357 | + strokeColor: 'blue', | ||
| 358 | + strokeOpacity: 1.0, | ||
| 359 | + strokeWeight: 2, | ||
| 360 | + name: "Coordenadas" | ||
| 361 | + }); | ||
| 362 | + i3GEOF.geolocal.googlemaps.linhas.setMap(i3GeoMap); | ||
| 363 | + i3GEOF.geolocal.panLinha(n-1); | ||
| 364 | + }, | ||
| 365 | + removeLayer: function(){ | ||
| 366 | + if(i3GEOF.geolocal.googlemaps.linhas){ | ||
| 367 | + i3GEOF.geolocal.googlemaps.linhas.setMap(null); | ||
| 368 | + } | ||
| 369 | + if(i3GEOF.geolocal.googlemaps.marca){ | ||
| 370 | + i3GEOF.geolocal.googlemaps.marca.setMap(null); | ||
| 371 | + } | ||
| 372 | + } | ||
| 373 | + }, | ||
| 374 | + //@TODO implementar desenho dos pontos e linhas | ||
| 375 | + googleearth: { | ||
| 333 | desenha: function(){ | 376 | desenha: function(){ |
| 334 | }, | 377 | }, |
| 335 | removeLayer: function(){ | 378 | removeLayer: function(){ |