-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
82 lines (61 loc) · 1.96 KB
/
Copy pathmain.js
File metadata and controls
82 lines (61 loc) · 1.96 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
var app = angular.module('App', ['uiGmapgoogle-maps']);
var map;
function initializeMap() {
"use strict";
var mapCanvas, mapOptions, latlng;
latlng = new google.maps.LatLng(21, -103);
mapOptions = {
zoom: 15,
center: latlng
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
function createMarker(origin, Title) {
var marker, infoWnd;
infoWnd = new google.maps.InfoWindow();
marker = new google.maps.Marker({
title: Title,
position: origin,
map: map,
animation: google.maps.Animation.DROP
});
google.maps.event.addListener(marker, "click", function () {
infoWnd.setContent("<strong>" + Title + "</strong><br>");
infoWnd.open(map, marker);
});
return marker;
}
google.maps.event.addDomListener(window, "load", initializeMap);
/*
app.controller("controller", function ($scope) {
angular.extend($scope, {
map: {
center: {
latitude: 45,
longitude: -73
},
zoom: 8,
markers: [
{
latitude: 41.169444444444444,
longitude: -75.87777777777778,
}
]
}
});
});*/
app.controller("SensorController", function ($scope) {
$scope.Temperatura = 11.56;
$scope.Altitud = 1550;
$scope.Humedad = 54;
$scope.Presion = 811.3;
$scope.Position = "20°39′58″N 103°21′07″O";
navigator.geolocation.watchPosition(function (pos) {
$scope.$apply(function () {
$scope.Position = pos.coords.latitude + "," + pos.coords.longitude;
var currentLatlng = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
createMarker(currentLatlng, "Posición actual");
map.setCenter(currentLatlng);
});
});
});