Now using dashed lines, fixed some JS.

This commit is contained in:
Marat Fayzullin 2024-09-07 18:07:11 -04:00
parent 1eefe6dfad
commit eb2d36cc17
7 changed files with 40 additions and 30 deletions

View File

@ -135,7 +135,7 @@ function GLocator() {
GLocator.prototype = new Locator();
GLocator.prototype.setMap = function(map) {
GLocator.prototype.setMap = function(map = null) {
this.rect.setMap(map);
};
@ -166,17 +166,25 @@ GLocator.prototype.setOpacity = function(opacity) {
//
function GCall() {
const dash = {
path : 'M 0,-1 0,1',
scale : 2,
strokeWeight : 1,
strokeOpacity : 0.5
};
this.line = new google.maps.Polyline({
geodesic : true,
strokeColor : "#000000",
strokeOpacity : 0.2,
strokeWeight : 1
strokeColor : '#000000',
strokeOpacity : 0,
strokeWeight : 0,
icons : [{ icon: dash, offset: 0, repeat: '8px' }]
});
}
GCall.prototype = new Call();
GCall.prototype.setMap = function(map) {
GCall.prototype.setMap = function(map = null) {
this.line.setMap(map);
};
@ -187,9 +195,13 @@ GCall.prototype.setEnds = function(lat1, lon1, lat2, lon2) {
};
GCall.prototype.setColor = function(color) {
this.line.setOptions({ strokeColor: color });
this.line.icons[0].icon.strokeColor = color;
this.line.setOptions({ icons: this.line.icons });
// this.line.setOptions({ strokeColor: color });
};
GCall.prototype.setOpacity = function(opacity) {
this.line.setOptions({ strokeOpacity : opacity });
this.line.icons[0].icon.strokeOpacity = opacity;
this.line.setOptions({ icons: this.line.icons });
// this.line.setOptions({ strokeOpacity : opacity });
};

View File

@ -24,9 +24,8 @@ LMarker.prototype.setMarkerOptions = function(options) {
}
};
LMarker.prototype.setMap = function (map) {
if (map) this._marker.addTo(map);
else this._marker.remove();
LMarker.prototype.setMap = function (map = null) {
if (map) this._marker.addTo(map); else this._marker.remove();
};
LMarker.prototype.addListener = function (e, f) {
@ -85,9 +84,8 @@ function LLocator() {
LLocator.prototype = new Locator();
LLocator.prototype.setMap = function(map) {
if (map) this._rect.addTo(map);
else this._rect.remove();
LLocator.prototype.setMap = function(map = null) {
if (map) this._rect.addTo(map); else this._rect.remove();
};
LLocator.prototype.setCenter = function(lat, lon) {
@ -116,17 +114,18 @@ LLocator.prototype.addListener = function (e, f) {
function LCall() {
this._line = L.polyline([[0, 0], [0, 0]], {
color : "#000000",
opacity : 0.2,
weight : 1
dashArray : [4, 4],
dashOffset : 0,
color : '#000000',
opacity : 0.5,
weight : 1
});
}
LCall.prototype = new Call();
LCall.prototype.setMap = function(map) {
if (map) this._line.addTo(map);
else this._line.remove();
LCall.prototype.setMap = function(map = null) {
if (map) this._line.addTo(map); else this._line.remove();
};
LCall.prototype.setEnds = function(lat1, lon1, lat2, lon2) {

View File

@ -2,8 +2,7 @@
// Map Calls Management
//
CallManager.strokeOpacity = 0.8;
CallManager.fillOpacity = 0.35;
CallManager.strokeOpacity = 0.5;
function CallManager() {
// Current calls
@ -89,11 +88,11 @@ Call.prototype.create = function(data, map) {
Call.prototype.reColor = function(colorMode, filterBy = null) {
this.setOpacity(
colorMode==='off'? 0.0
: filterBy==null? 0.2
: colorMode==='band' && this.band==filterBy? 0.2
: colorMode==='mode' && this.mode==filterBy? 0.2
: 0.0
colorMode==='off'? 0
: filterBy==null? CallManager.strokeOpacity
: colorMode==='band' && this.band==filterBy? CallManager.strokeOpacity
: colorMode==='mode' && this.mode==filterBy? CallManager.strokeOpacity
: 0
);
};

View File

@ -78,7 +78,7 @@ MarkerManager.prototype.toggle = function(map, type, onoff) {
// Show or hide features on the map
$.each(this.markers, function(_, x) {
if (x.mode === type) x.setMap(onoff ? map : undefined);
if (x.mode === type) x.setMap(onoff ? map : null);
});
};

View File

@ -195,7 +195,7 @@ MapManager.prototype.processUpdates = function(updates) {
marker.update(update);
// Assign marker to map
marker.setMap(self.mman.isEnabled(update.mode)? map : undefined);
marker.setMap(self.mman.isEnabled(update.mode)? map : null);
// Apply marker options
if (marker instanceof GFeatureMarker) {

View File

@ -485,7 +485,7 @@ MapManager.prototype.processUpdates = function(updates) {
marker.update(update);
// Assign marker to map
marker.setMap(self.mman.isEnabled(update.mode)? map : undefined);
marker.setMap(self.mman.isEnabled(update.mode)? map : null);
// Apply marker options
if (marker instanceof LFeatureMarker) {

View File

@ -125,7 +125,7 @@ class Map(object):
"src": src,
"dst": dst
}
logger.debug("{0} call from {1} ({2}) to {3} ({4})".format(mode, key, src, callee, dst))
logger.debug("{0} call from {1} to {2}".format(mode, key, callee))
# remove excessive calls
while len(self.calls) > 0 and len(self.calls) >= max_calls:
self.calls.pop(0)