From 90513dff831c21ac3847936f0fd3cf8584d9f73f Mon Sep 17 00:00:00 2001 From: andreas Date: Sun, 5 Jan 2025 18:50:17 +0100 Subject: [PATCH] #393: make ais center mode a property --- viewer/components/MapPage.jsx | 2 - viewer/nav/aisdata.js | 667 +++++++++++++++++----------------- viewer/nav/navdata.js | 27 +- viewer/nav/navobjects.js | 18 - viewer/util/keys.jsx | 1 + 5 files changed, 340 insertions(+), 375 deletions(-) diff --git a/viewer/components/MapPage.jsx b/viewer/components/MapPage.jsx index 765009f86..f68cf319f 100644 --- a/viewer/components/MapPage.jsx +++ b/viewer/components/MapPage.jsx @@ -112,7 +112,6 @@ class MapPage extends React.Component{ return this.props.mapEventCallback(evdata); } componentWillUnmount(){ - NavHandler.setAisCenterMode(navobjects.AisCenterMode.GPS); MapHolder.renderTo(); if (this.subscribeToken !== undefined){ MapHolder.unsubscribe(this.subscribeToken); @@ -137,7 +136,6 @@ class MapPage extends React.Component{ } componentDidMount(){ let self=this; - NavHandler.setAisCenterMode(navobjects.AisCenterMode.MAP); this.subscribeToken=MapHolder.subscribe(this.mapEvent); let chartEntry=MapHolder.getCurrentChartEntry()||{}; let showMap=()=>{ diff --git a/viewer/nav/aisdata.js b/viewer/nav/aisdata.js index 4094f31e6..4b2f7a442 100644 --- a/viewer/nav/aisdata.js +++ b/viewer/nav/aisdata.js @@ -18,389 +18,386 @@ const AisTarget=navobjects.Ais; * query the server... * @constructor */ -let AisData=function(navdata){ +class AisData { + constructor(navdata) { - this.navdata=navdata; + this.navdata = navdata; - /** @private - * @type {Array.} - * */ - this.currentAis=[]; + /** @private + * @type {Array.} + * */ + this.currentAis = []; - /** - * the last successfull query - * @type {number} - */ - this.lastAisQuery=new Date().getTime(); - /** - * @private - * @type {null} - */ - this.timer=null; - /** - * @private - * @type {number} - */ - this.aisErrors=0; - /** - * the mmsi of the tracked target - * @type {number} - */ - this.trackedAIStarget=null; + /** + * @private + * @type {null} + */ + this.timer = null; + /** + * @private + * @type {number} + */ + this.aisErrors = 0; + /** + * the mmsi of the tracked target + * @type {number} + */ + this.trackedAIStarget = null; - /** - * the mmsi of the computed nearest target - * @type {null} - */ - this.computedNearestMmsi=null; - /** - * the mmsi we have computed for a warning - * @type {null} - */ - this.computedWarningMmsi=null; + /** + * the mmsi of the computed nearest target + * @type {null} + */ + this.computedNearestMmsi = null; + /** + * the mmsi we have computed for a warning + * @type {null} + */ + this.computedWarningMmsi = null; - /** - * the nearest target - being returned when values are queried - * - * @type {AisTarget} - */ - this.nearestAisTarget={}; + /** + * the nearest target - being returned when values are queried + * + * @type {AisTarget} + */ + this.nearestAisTarget = {}; - globalStore.register(this,[keys.nav.gps,keys.nav.routeHandler.useRhumbLine]); + globalStore.register(this, [keys.nav.gps, keys.nav.routeHandler.useRhumbLine]); + + /** + * @private + * @type {Formatter} + */ + this.formatter = Formatter; + /** + * @private + * a map mmsi->hideTime for hidden ais targets + * @type {{}} + */ + this.hiddenTargets = {}; + + /** + * @private + * remember the last AIS center we ever used + * this will be used if there is no current GPS available + * @type {undefined} + */ + this.lastAisCenter = undefined; + } /** + * + * @param boatPos boat pos, course, speed + * @param ais the ais target, will be modified * @private - * @type {Formatter} - */ - this.formatter=Formatter; - /** - * @private - * a map mmsi->hideTime for hidden ais targets - * @type {{}} */ - this.hiddenTargets={} + _computeAisTarget(boatPos, ais) { + let useRhumbLine = globalStore.getData(keys.nav.routeHandler.useRhumbLine); + ais.warning = false; + ais.tracking = false; + ais.nearest = false; + let computeProperties = globalStore.getMultiple({ + minAISspeed: keys.properties.minAISspeed + }); + let dst = NavCompute.computeDistance(boatPos, new navobjects.Point(parseFloat(ais.lon || 0), parseFloat(ais.lat || 0)), useRhumbLine); + let cpadata = NavCompute.computeCpa({ + lon: boatPos.lon, + lat: boatPos.lat, + course: boatPos.course || 0, + speed: boatPos.speed || 0 + }, + { + lon: parseFloat(ais.lon || 0), + lat: parseFloat(ais.lat || 0), + course: parseFloat(ais.course || 0), + speed: parseFloat(ais.speed || 0) + }, + computeProperties, + useRhumbLine + ); + ais.distance = dst.dts; + ais.headingTo = dst.course; + if (cpadata.tcpa !== undefined && cpadata.cpa !== undefined) { + ais.cpa = cpadata.cpa; + ais.tcpa = cpadata.tcpa; + } else { + ais.cpa = 0; + ais.tcpa = 0; + } + ais.passFront = cpadata.front; + if (!ais.shipname) ais.shipname = "unknown"; + if (!ais.callsign) ais.callsign = "????"; + } /** + * compute all the cpa data... * @private - * remember the last AIS center we ever used - * this will be used if there is no current GPS available - * @type {undefined} */ - this.lastAisCenter=undefined; -}; -/** - * - * @param boatPos boat pos, course, speed - * @param ais the ais target, will be modified - * @private - */ -AisData.prototype._computeAisTarget=function(boatPos,ais){ - let useRhumbLine= globalStore.getData(keys.nav.routeHandler.useRhumbLine); - ais.warning=false; - ais.tracking=false; - ais.nearest=false; - let computeProperties=globalStore.getMultiple({ - minAISspeed: keys.properties.minAISspeed - }); - let dst = NavCompute.computeDistance(boatPos, new navobjects.Point(parseFloat(ais.lon||0), parseFloat(ais.lat||0)),useRhumbLine); - let cpadata = NavCompute.computeCpa({ - lon: boatPos.lon, - lat: boatPos.lat, - course: boatPos.course || 0, - speed: boatPos.speed || 0 - }, - { - lon: parseFloat(ais.lon || 0), - lat: parseFloat(ais.lat || 0), - course: parseFloat(ais.course || 0), - speed: parseFloat(ais.speed || 0) - }, - computeProperties, - useRhumbLine - ); - ais.distance = dst.dts; - ais.headingTo = dst.course; - if (cpadata.tcpa !== undefined && cpadata.cpa !== undefined) { - ais.cpa = cpadata.cpa; - ais.tcpa = cpadata.tcpa; - } - else { - ais.cpa = 0; - ais.tcpa = 0; - } - ais.passFront = cpadata.front; - if (!ais.shipname) ais.shipname = "unknown"; - if (!ais.callsign) ais.callsign = "????"; -}; -/** - * compute all the cpa data... - * @private - */ -AisData.prototype.handleAisData=function() { - let boatPos = globalStore.getMultiple(keys.nav.gps); - let trackedTarget=null; //ref to tracked target - let aisWarningAis = null; - let aisTargets=[]; - let onlyMoving=globalStore.getData(keys.properties.aisOnlyShowMoving,false); - let showA=globalStore.getData(keys.properties.aisShowA,true); - let showB=globalStore.getData(keys.properties.aisShowB,true); - let showOther=globalStore.getData(keys.properties.aisShowOther,false); - let aisMinSpeed = parseFloat(globalStore.getData(keys.properties.aisMinDisplaySpeed, 0)); - let hideTime=parseFloat(globalStore.getData(keys.properties.aisHideTime,30))*1000; - let foundTrackedTarget = false; - let now=(new Date()).getTime(); - for (let aisidx in this.currentAis) { - let ais =this.currentAis[aisidx]; - ais.receiveTime=now; - let shouldHandle = !onlyMoving || (parseFloat(ais.speed) >= aisMinSpeed); - if (shouldHandle ){ - let clazz=aisformatter.format('clazz',ais); - if (clazz === "A"){ - shouldHandle=showA; + handleAisData() { + let boatPos = globalStore.getMultiple(keys.nav.gps); + let trackedTarget = null; //ref to tracked target + let aisWarningAis = null; + let aisTargets = []; + let onlyMoving = globalStore.getData(keys.properties.aisOnlyShowMoving, false); + let showA = globalStore.getData(keys.properties.aisShowA, true); + let showB = globalStore.getData(keys.properties.aisShowB, true); + let showOther = globalStore.getData(keys.properties.aisShowOther, false); + let aisMinSpeed = parseFloat(globalStore.getData(keys.properties.aisMinDisplaySpeed, 0)); + let hideTime = parseFloat(globalStore.getData(keys.properties.aisHideTime, 30)) * 1000; + let foundTrackedTarget = false; + let now = (new Date()).getTime(); + for (let aisidx in this.currentAis) { + let ais = this.currentAis[aisidx]; + ais.receiveTime = now; + let shouldHandle = !onlyMoving || (parseFloat(ais.speed) >= aisMinSpeed); + if (shouldHandle) { + let clazz = aisformatter.format('clazz', ais); + if (clazz === "A") { + shouldHandle = showA; + } else if (clazz === "B") { + shouldHandle = showB; + } else { + shouldHandle = showOther; + } } - else if (clazz === "B"){ - shouldHandle=showB; + if (!shouldHandle) continue; + if (ais.heading !== undefined) { + if (parseInt(ais.heading) === 511) { + ais.heading = undefined; + } } - else{ - shouldHandle=showOther; + let hidden = this.hiddenTargets[ais.mmsi]; + if (hidden !== undefined) { + if (hidden > now || (hidden + hideTime) < now) { + delete this.hiddenTargets[ais.mmsi]; + hidden = undefined; + } } - } - if (!shouldHandle) continue; - if (ais.heading !== undefined){ - if (parseInt(ais.heading) === 511) { - ais.heading=undefined; + if (hidden !== undefined) ais.hidden = true; + aisTargets.push(ais); + if (boatPos.valid) { + this._computeAisTarget(boatPos, ais); + let warningCpa = globalStore.getData(keys.properties.aisWarningCpa); + if (ais.cpa && ais.cpa < warningCpa && ais.tcpa && Math.abs(ais.tcpa) < globalStore.getData(keys.properties.aisWarningTpa)) { + if (aisWarningAis) { + if (ais.tcpa >= 0) { + if (aisWarningAis.tcpa > ais.tcpa || aisWarningAis.tcpa < 0) aisWarningAis = ais; + } else { + if (aisWarningAis.tcpa < 0 && aisWarningAis.tcpa < ais.tcpa) aisWarningAis = ais; + } + } else aisWarningAis = ais; + } } - } - let hidden=this.hiddenTargets[ais.mmsi]; - if (hidden !== undefined){ - if (hidden > now || (hidden + hideTime) < now){ - delete this.hiddenTargets[ais.mmsi]; - hidden=undefined; + if (ais.mmsi == this.trackedAIStarget) { + foundTrackedTarget = true; + ais.tracking = true; + trackedTarget = ais; } } - if (hidden !== undefined) ais.hidden=true; - aisTargets.push(ais); - if (boatPos.valid) { - this._computeAisTarget(boatPos, ais); - let warningCpa = globalStore.getData(keys.properties.aisWarningCpa); - if (ais.cpa && ais.cpa < warningCpa && ais.tcpa && Math.abs(ais.tcpa) < globalStore.getData(keys.properties.aisWarningTpa)) { - if (aisWarningAis) { - if (ais.tcpa >= 0) { - if (aisWarningAis.tcpa > ais.tcpa || aisWarningAis.tcpa < 0) aisWarningAis = ais; - } else { - if (aisWarningAis.tcpa < 0 && aisWarningAis.tcpa < ais.tcpa) aisWarningAis = ais; - } - } else aisWarningAis = ais; + if (!foundTrackedTarget) this.trackedAIStarget = null; + if (aisTargets) { + aisTargets.sort(this.aisSort); + if (aisTargets.length) { + aisTargets[0].nearest = true; + this.computedNearestMmsi = aisTargets[0].mmsi; } } - if (ais.mmsi == this.trackedAIStarget) { - foundTrackedTarget = true; - ais.tracking = true; - trackedTarget = ais; + if (aisWarningAis) { + aisWarningAis.warning = true; + this.computedWarningMmsi = aisWarningAis.mmsi; + } else { + this.computedWarningMmsi = null; } - } - if (!foundTrackedTarget) this.trackedAIStarget = null; - if (aisTargets) { - aisTargets.sort(this.aisSort); + //handling of the nearest target + //warning active - this one + //no tracked target set - nearest + //tracked set - this one if (aisTargets.length) { - aisTargets[0].nearest = true; - this.computedNearestMmsi=aisTargets[0].mmsi; + if (aisWarningAis) this.nearestAisTarget = aisWarningAis; + else { + if (trackedTarget) this.nearestAisTarget = trackedTarget; + else this.nearestAisTarget = aisTargets[0]; + } + } else { + this.nearestAisTarget = {}; + this.computedWarningMmsi = null; + this.computedNearestMmsi = null; } + let storeKeys = { + nearestAisTarget: keys.nav.ais.nearest, + currentAis: keys.nav.ais.list, + updateCount: keys.nav.ais.updateCount + }; + globalStore.storeMultiple({ + nearestAisTarget: this.nearestAisTarget, + currentAis: aisTargets, + updateCount: globalStore.getData(keys.nav.ais.updateCount, 0) + 1 + }, storeKeys); + } - if (aisWarningAis) { - aisWarningAis.warning = true; - this.computedWarningMmsi=aisWarningAis.mmsi; - } - else{ - this.computedWarningMmsi=null; + + dataChanged() { + this.handleAisData(); } - //handling of the nearest target - //warning active - this one - //no tracked target set - nearest - //tracked set - this one - if (aisTargets.length) { - if (aisWarningAis) this.nearestAisTarget = aisWarningAis; - else { - if (trackedTarget) this.nearestAisTarget = trackedTarget; - else this.nearestAisTarget = aisTargets[0]; + + /** + * sorter for the AIS data - sort by distance + * @param a + * @param b + * @returns {number} + */ + aisSort(a, b) { + try { + if (a.distance == b.distance) return 0; + if (a.distance < b.distance) return -1; + return 1; + } catch (err) { + return 0; } - } else { - this.nearestAisTarget = {}; - this.computedWarningMmsi=null; - this.computedNearestMmsi=null; } - let storeKeys = { - nearestAisTarget: keys.nav.ais.nearest, - currentAis: keys.nav.ais.list, - updateCount: keys.nav.ais.updateCount - }; - globalStore.storeMultiple({ - nearestAisTarget: this.nearestAisTarget, - currentAis: aisTargets, - updateCount: globalStore.getData(keys.nav.ais.updateCount, 0) + 1 - }, storeKeys); -}; - -AisData.prototype.dataChanged=function(){ - this.handleAisData(); -}; -/** - * sorter for the AIS data - sort by distance - * @param a - * @param b - * @returns {number} - */ -AisData.prototype.aisSort=function(a,b) { - try { - if (a.distance == b.distance) return 0; - if (a.distance < b.distance) return -1; - return 1; - } catch (err) { - return 0; + /** + * + */ + startQuery() { + let center = this.navdata.getAisCenter(); + let timeout = parseInt(globalStore.getData(keys.properties.aisQueryTimeout)); + if (!center) { + center = this.lastAisCenter; + } else { + this.lastAisCenter = center; + } + if (!center) { + window.clearTimeout(this.timer); + this.timer = window.setTimeout(() => { + this.startQuery(); + }, timeout); + return; + } + let param = { + request: 'ais', + distance: this.formatter.formatDecimal(globalStore.getData(keys.properties.aisDistance) || 10, 4, 1) + }; + for (let idx = 0; idx < center.length; idx++) { + if (!center[idx]) continue; + let sfx = idx !== 0 ? idx + "" : ""; + param['lat' + sfx] = this.formatter.formatDecimal(center[idx].lat, 3, 5, false, true); + param['lon' + sfx] = this.formatter.formatDecimal(center[idx].lon, 3, 5, false, true); + } + Requests.getJson(param, {checkOk: false, timeout: timeout}).then( + (data) => { + this.aisErrors = 0; + let aisList = []; + if (data['class'] && data['class'] == "error") aisList = []; + else aisList = data; + this.currentAis = aisList; + try { + this.handleAisData(); + } catch (e) { + let x = e; + } + window.clearTimeout(this.timer); + this.timer = window.setTimeout( ()=> { + this.startQuery(); + }, timeout); + } + ).catch( + (error) => { + base.log("query ais error"); + this.aisErrors += 1; + if (this.aisErrors >= globalStore.getData(keys.properties.maxAisErrors)) { + this.currentAis = []; + this.handleAisData(); + } + window.clearTimeout(this.timer); + this.timer = window.setTimeout(()=> { + this.startQuery(); + }, timeout); + } + ); } -}; -/** - * - */ -AisData.prototype.startQuery=function() { - let url = "?request=ais"; - let center=this.navdata.getAisCenter(); - let self=this; - let timeout=parseInt(globalStore.getData(keys.properties.aisQueryTimeout)); - if (! center){ - center=this.lastAisCenter; - } - else{ - this.lastAisCenter=center; - } - if (! center){ - window.clearTimeout(this.timer); - this.timer=window.setTimeout(function(){ - self.startQuery(); - },timeout); - return; - } - let param={ - request: 'ais', - distance: this.formatter.formatDecimal(globalStore.getData(keys.properties.aisDistance)||10,4,1) - }; - for (let idx=0;idx{ - self.aisErrors=0; - self.lastAisQuery=new Date().getTime(); - let aisList=[]; - if (data['class'] && data['class'] == "error") aisList=[]; - else aisList=data; - self.currentAis=aisList; - try { - self.handleAisData(); - }catch (e){ - let x=e; - } - window.clearTimeout(self.timer); - self.timer=window.setTimeout(function(){self.startQuery();},timeout); + /** + * get an ais target by mmsi, return undefined if not found + * @param mmsi + * @returns {*} + */ + getAisByMmsi(mmsi) { + let rt = undefined; + if (mmsi == 0 || mmsi == null) { + rt = assign({}, this.nearestAisTarget); } - ).catch( - (error)=>{ - base.log("query ais error"); - self.aisErrors+=1; - if (self.aisErrors >= globalStore.getData(keys.properties.maxAisErrors)){ - self.currentAis=[]; - self.handleAisData(); + if (!rt) { + for (let i in this.currentAis) { + if (this.currentAis[i].mmsi === mmsi) { + rt = assign({}, this.currentAis[i]); + } } - window.clearTimeout(self.timer); - self.timer=window.setTimeout(function(){self.startQuery();},timeout); } - ); -}; + if (rt) { + if (this.computedNearestMmsi === rt.mmsi) rt.nearest = true; + if (this.computedWarningMmsi === rt.mmsi) rt.warning = true; + return rt; + } + return undefined; + } + /** + * get the position of an AIS target + * @param mmsi + * @returns {*} + */ + getAisPositionByMmsi(mmsi) { + let ais = this.getAisByMmsi(mmsi); + if (!ais) return undefined; + return new navobjects.Point(parseFloat(ais.lon || 0), parseFloat(ais.lat || 0)); + } + /** + * return the mmsi of the tracked target or 0 + * @returns {number} + */ + getTrackedTarget() { + return this.trackedAIStarget; + } -/** - * get an ais target by mmsi, return undefined if not found - * @param mmsi - * @returns {*} - */ -AisData.prototype.getAisByMmsi=function(mmsi){ - let rt=undefined; - if (mmsi == 0 || mmsi == null){ - rt=assign({},this.nearestAisTarget); + setHidden(mmsi) { + let now = (new Date()).getTime(); + this.hiddenTargets[mmsi] = now; + this.handleAisData(); } - if (! rt) { - for (let i in this.currentAis) { - if (this.currentAis[i].mmsi === mmsi) { - rt = assign({}, this.currentAis[i]); - } + + unsetHidden(mmsi) { + if (this.hiddenTargets[mmsi] !== undefined) { + delete this.hiddenTargets[mmsi]; + this.handleAisData(); } } - if (rt){ - if (this.computedNearestMmsi === rt.mmsi) rt.nearest = true; - if (this.computedWarningMmsi === rt.mmsi) rt.warning = true; - return rt; - } - return undefined; -}; -/** - * get the position of an AIS target - * @param mmsi - * @returns {*} - */ -AisData.prototype.getAisPositionByMmsi=function(mmsi){ - let ais=this.getAisByMmsi(mmsi); - if (! ais) return undefined; - return new navobjects.Point(parseFloat(ais.lon||0),parseFloat(ais.lat||0)); -}; - + isHidden(mmsi) { + let now = (new Date()).getTime(); + let hidden = this.hiddenTargets[mmsi]; + if (hidden === undefined) return false; + if (hidden > now || (hidden + globalStore.getData(keys.properties.aisHideTime, 30) * 1000) < now) { + delete this.hiddenTargets[mmsi]; + return false; + } + return true; -/** - * return the mmsi of the tracked target or 0 - * @returns {number} - */ -AisData.prototype.getTrackedTarget=function(){ - return this.trackedAIStarget; -}; + } -AisData.prototype.setHidden=function(mmsi){ - let now=(new Date()).getTime(); - this.hiddenTargets[mmsi]=now; - this.handleAisData(); -} -AisData.prototype.unsetHidden=function(mmsi){ - if (this.hiddenTargets[mmsi] !== undefined) { - delete this.hiddenTargets[mmsi]; + /** + * set the target to be tracked, 0 to use nearest + * @param {number} mmsi + */ + setTrackedTarget(mmsi) { + if (this.trackedAIStarget == mmsi) return; + this.trackedAIStarget = mmsi; + globalStore.storeData(keys.nav.ais.trackedMmsi, mmsi); this.handleAisData(); } } -AisData.prototype.isHidden=function(mmsi){ - let now=(new Date()).getTime(); - let hidden=this.hiddenTargets[mmsi]; - if (hidden === undefined) return false; - if (hidden > now || (hidden + globalStore.getData(keys.properties.aisHideTime,30)*1000) < now){ - delete this.hiddenTargets[mmsi]; - return false; - } - return true; -} -/** - * set the target to be tracked, 0 to use nearest - * @param {number} mmsi - */ -AisData.prototype.setTrackedTarget=function(mmsi){ - if (this.trackedAIStarget == mmsi) return; - this.trackedAIStarget=mmsi; - globalStore.storeData(keys.nav.ais.trackedMmsi,mmsi); - this.handleAisData(); -}; export default AisData; \ No newline at end of file diff --git a/viewer/nav/navdata.js b/viewer/nav/navdata.js index b724ef3dc..a7664c91d 100644 --- a/viewer/nav/navdata.js +++ b/viewer/nav/navdata.js @@ -53,9 +53,6 @@ const NavData=function(){ */ this.routeHandler=new RouteData(); - - this.aisMode=navobjects.AisCenterMode.GPS; - this.speedAverage=new Average(10); //for steady detection this.mapAverageCog=new CourseAverage(globalStore.getData(keys.properties.courseAverageLength)); //for map rotation this.mapAverageHdt=new CourseAverage(globalStore.getData(keys.properties.courseAverageLength)); //for map rotation @@ -240,33 +237,23 @@ NavData.prototype.computeValues=function() { /** * get the center for AIS queries - * @returns {navobjects.Point} + * @returns {[navobjects.Point]} */ NavData.prototype.getAisCenter=function(){ - if (this.aisMode == navobjects.AisCenterMode.NONE) return undefined; - if (this.aisMode == navobjects.AisCenterMode.GPS) { + const mode=globalStore.getData(keys.properties.aisCenterMode); + if (mode === 'boat') { if (globalStore.getData(keys.nav.gps.valid)) return [globalStore.getData(keys.nav.gps.position)]; return undefined; } - else{ - if (globalStore.getData(keys.nav.gps.valid)){ + else if (mode === 'map') { + return [globalStore.getData(keys.map.centerPosition)]; + } + if (globalStore.getData(keys.nav.gps.valid)){ return [globalStore.getData(keys.map.centerPosition),globalStore.getData(keys.nav.gps.position)] - } } return [globalStore.getData(keys.map.centerPosition)]; }; -/** - * set the mode for the AIS query - * @param {navobjects.AisCenterMode} mode - */ -NavData.prototype.setAisCenterMode=function(mode){ - this.aisMode=mode; -}; - - - - /** * get the routing handler * @returns {RouteData|*} diff --git a/viewer/nav/navobjects.js b/viewer/nav/navobjects.js index e5e99b731..0a2378e67 100644 --- a/viewer/nav/navobjects.js +++ b/viewer/nav/navobjects.js @@ -5,24 +5,6 @@ import base from '../base.js'; import assign from 'object-assign'; let navobjects={}; - - -/** - * the center mode for ais - * @type {{NONE: number, GPS: number, MAP: number}} - */ -navobjects.AisCenterMode={ - NONE:0, - GPS:1, - MAP:2 -}; - - - - - - - /** * a point lon,lat * @param lon diff --git a/viewer/util/keys.jsx b/viewer/util/keys.jsx index 694285bf9..5aa5a60d5 100644 --- a/viewer/util/keys.jsx +++ b/viewer/util/keys.jsx @@ -361,6 +361,7 @@ let keys={ aisReducedList: new Property(false,"reduce details in list",PropertyType.CHECKBOX), aisHideTime: new Property(15,"hide time(s)",PropertyType.RANGE,[1,3600]), aisLostTime: new Property(600,"lost time (s)",PropertyType.RANGE, [1,3600]), + aisCenterMode: new Property('both',"center for AIS range",PropertyType.LIST,['both','boat','map']), aisListLock: new Property(false,"lock ais list",PropertyType.CHECKBOX), clickTolerance: new Property(60, "Click Tolerance", PropertyType.RANGE, [10, 120]), maxAisErrors: new Property(3), //after that many errors AIS display will be switched off