implement icon rotation
This commit is contained in:
parent
15c28b130d
commit
ecbae5af2d
@ -14,6 +14,16 @@ AprsMarker.prototype.draw = function() {
|
|||||||
div.style['background-position-y'] = -Math.floor(this.symbol.index / 16) * 24 + 'px';
|
div.style['background-position-y'] = -Math.floor(this.symbol.index / 16) * 24 + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.course) {
|
||||||
|
if (this.course > 180) {
|
||||||
|
div.style.transform = 'scalex(-1) rotate(' + (270 - this.course) + 'deg)'
|
||||||
|
} else {
|
||||||
|
div.style.transform = 'rotate(' + (this.course - 90) + 'deg)';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
div.style.transform = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.symbol.table != '/' && this.symbol.table != '\\') {
|
if (this.symbol.table != '/' && this.symbol.table != '\\') {
|
||||||
overlay.style.display = 'block';
|
overlay.style.display = 'block';
|
||||||
overlay.style['background-position-x'] = -(this.symbol.tableindex % 16) * 24 + 'px';
|
overlay.style['background-position-x'] = -(this.symbol.tableindex % 16) * 24 + 'px';
|
||||||
@ -33,8 +43,6 @@ AprsMarker.prototype.draw = function() {
|
|||||||
AprsMarker.prototype.onAdd = function() {
|
AprsMarker.prototype.onAdd = function() {
|
||||||
var div = this.div = document.createElement('div');
|
var div = this.div = document.createElement('div');
|
||||||
|
|
||||||
div.className = 'marker';
|
|
||||||
|
|
||||||
div.style.position = 'absolute';
|
div.style.position = 'absolute';
|
||||||
div.style.cursor = 'pointer';
|
div.style.cursor = 'pointer';
|
||||||
div.style.width = '24px';
|
div.style.width = '24px';
|
||||||
|
@ -99,10 +99,12 @@
|
|||||||
var pos = new google.maps.LatLng(update.location.lat, update.location.lon);
|
var pos = new google.maps.LatLng(update.location.lat, update.location.lon);
|
||||||
var marker;
|
var marker;
|
||||||
var markerClass = google.maps.Marker;
|
var markerClass = google.maps.Marker;
|
||||||
var iconOptions = {}
|
var aprsOptions = {}
|
||||||
if (update.location.symbol) {
|
if (update.location.symbol) {
|
||||||
markerClass = AprsMarker;
|
markerClass = AprsMarker;
|
||||||
iconOptions.symbol = update.location.symbol;
|
aprsOptions.symbol = update.location.symbol;
|
||||||
|
aprsOptions.course = update.location.course;
|
||||||
|
aprsOptions.speed = update.location.speed;
|
||||||
}
|
}
|
||||||
if (markers[update.callsign]) {
|
if (markers[update.callsign]) {
|
||||||
marker = markers[update.callsign];
|
marker = markers[update.callsign];
|
||||||
@ -117,7 +119,7 @@
|
|||||||
position: pos,
|
position: pos,
|
||||||
map: map,
|
map: map,
|
||||||
title: update.callsign
|
title: update.callsign
|
||||||
}, iconOptions, getMarkerOpacityOptions(update.lastseen) ));
|
}, aprsOptions, getMarkerOpacityOptions(update.lastseen) ));
|
||||||
marker.lastseen = update.lastseen;
|
marker.lastseen = update.lastseen;
|
||||||
marker.mode = update.mode;
|
marker.mode = update.mode;
|
||||||
marker.band = update.band;
|
marker.band = update.band;
|
||||||
|
10
owrx/aprs.py
10
owrx/aprs.py
@ -143,15 +143,13 @@ class WeatherParser(object):
|
|||||||
class AprsLocation(LatLngLocation):
|
class AprsLocation(LatLngLocation):
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
super().__init__(data["lat"], data["lon"])
|
super().__init__(data["lat"], data["lon"])
|
||||||
self.comment = data["comment"] if "comment" in data else None
|
self.data = data
|
||||||
self.symbol = data["symbol"] if "symbol" in data else None
|
|
||||||
|
|
||||||
def __dict__(self):
|
def __dict__(self):
|
||||||
res = super(AprsLocation, self).__dict__()
|
res = super(AprsLocation, self).__dict__()
|
||||||
if self.comment is not None:
|
for key in ["comment", "symbol", "course", "speed"]:
|
||||||
res["comment"] = self.comment
|
if key in self.data:
|
||||||
if self.symbol is not None:
|
res[key] = self.data[key]
|
||||||
res["symbol"] = self.symbol
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user