@wemap/positioning 14.8.0-beta.0 → 14.8.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@wemap/providers"),require("@wemap/core"),require("@wemap/geo")):typeof define==`function`&&define.amd?define([`exports`,`@wemap/providers`,`@wemap/core`,`@wemap/geo`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.Wemap=e.Wemap||{},e.Wemap.Positioning={}),e.Wemap.Providers,e.Wemap.Core,e.Wemap.Geo))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=30,a=30*Math.PI/180,o=class{currentPose={};updateCallbacks=new Set;errorCallbacks=new Set;isStarted=!1;_locationState=`no_positioning`;locationStateCallbacks=new Set;async dispose(){await this.stop(),this.updateCallbacks.clear(),this.errorCallbacks.clear(),this.locationStateCallbacks.clear()}onUpdate(e){if(this.updateCallbacks.add(e),Object.keys(this.currentPose).length>0)try{e({...this.currentPose})}catch(e){console.error(`Error in ${this.constructor.name} initial callback:`,e)}}offUpdate(e){this.updateCallbacks.delete(e)}onError(e){this.errorCallbacks.add(e)}offError(e){this.errorCallbacks.delete(e)}configureMapMatching(e,r=`indoor`){let o=n.CoreConfig.getConfig()?.arNavigationData?.[r]?.mapmatching,s=typeof o?.maxAngleBearing==`number`?o.maxAngleBearing*Math.PI/180:void 0;t.MapMatchingHandler.maxDistance=e?.maxDistance??o?.maxDistance??i,t.MapMatchingHandler.maxAngleBearing=e?.maxAngleBearing??s??a,t.MapMatchingHandler.useOrientationMatching=e?.useOrientationMatching??o?.useOrientationMatching??!1,t.MapMatchingHandler.useStrict=e?.useStrict??o?.useStrict??!1}mergeAndEmitUpdate(e){e.position!==void 0&&(this.currentPose.position=e.position),e.attitude!==void 0&&(this.currentPose.attitude=e.attitude),e.inclination!==void 0&&(this.currentPose.inclination=e.inclination),e.time!==void 0&&(this.currentPose.time=e.time),e.accuracy!==void 0&&(this.currentPose.accuracy=e.accuracy),this.emitUpdate({...this.currentPose})}emitUpdate(e){this.updateCallbacks.forEach(t=>{try{t(e)}catch(e){console.error(`Error in ${this.constructor.name} callback:`,e)}})}emitError(e){this.errorCallbacks.forEach(t=>{try{t(e)}catch(e){console.error(`Error in ${this.constructor.name} error callback:`,e)}})}get locationState(){return this._locationState}onLocationStateChange(e){this.locationStateCallbacks.add(e)}offLocationStateChange(e){this.locationStateCallbacks.delete(e)}setLocationState(e){this._locationState!==e&&(this._locationState=e,this.locationStateCallbacks.forEach(t=>{t(e)}))}},s=3e4,c=30*6e4,l=!0,u=50,d=100,f=class extends o{absolutePositionProviderId=null;absoluteAttitudeProviderId=null;vpsProviderListenerId=null;positionSmoother;_scanStatus=`stopped`;scanPromise=null;scanResolve=null;firstScan=!1;lastPosition=null;lastScanPosition=null;distanceSinceLastScan=0;backgroundScanEnabled;_backgroundScanStatus;scanStatusCallbacks=new Set;backgroundScanStatusCallbacks=new Set;backgroundScanner=null;backgroundScanStatusUnsubscribe=null;lastBackgroundCandidatePosition=null;ACCURACY_BACKGROUND_SCAN_THRESHOLD=15;degradedLocationStateThreshold;noPositioningLocationStateThreshold;constructor(e={}){super(),this.backgroundScanEnabled=e.vps?.backgroundScan??l,this.degradedLocationStateThreshold=e.vps?.degradedLocationStateThreshold??u,this.noPositioningLocationStateThreshold=e.vps?.noPositioningLocationStateThreshold??d,this.configureVpsProvider(e.vps),this.configureMapMatching(e,`indoor`),e.usePositionSmoother!==!1&&(this.positionSmoother=new t.PositionSmoother(e=>{this.mergeAndEmitUpdate({position:e,time:`time`in e?e.time:Date.now(),accuracy:`accuracy`in e?e.accuracy:void 0})})),t.ProvidersOptions.ignoreProviders=[`GnssWifi`];let n=e.vps?.backgroundScanIntervalMs??s,r=e.vps?.backgroundScanMaxDurationMs??c;this.backgroundScanner=new t.VpsBackgroundScanner({enabled:this.backgroundScanEnabled,intervalMs:n,maxDurationMs:r},e=>this.handleBackgroundVpsEvent(e),e=>{this.emitError(e)}),this._backgroundScanStatus=this.backgroundScanEnabled?`idle`:`disabled`,this.backgroundScanner&&(this.backgroundScanStatusUnsubscribe=this.backgroundScanner.onStatusChange(e=>{this.setBackgroundScanStatus(e)}))}get scanStatus(){return this._scanStatus}get backgroundScanStatus(){return this._backgroundScanStatus}onScanStatusChange(e){return this.scanStatusCallbacks.add(e),()=>{this.offScanStatusChange(e)}}offScanStatusChange(e){this.scanStatusCallbacks.delete(e)}onBackgroundScanStatusChange(e){return this.backgroundScanStatusCallbacks.add(e),()=>{this.offBackgroundScanStatusChange(e)}}offBackgroundScanStatusChange(e){this.backgroundScanStatusCallbacks.delete(e)}setScanStatus(e){this._scanStatus!==e&&(this._scanStatus=e,this.scanStatusCallbacks.forEach(t=>{try{t(e)}catch(e){console.error(`[VPSLocationSource] Error in scanStatus listener`,e)}}))}setBackgroundScanStatus(e){this._backgroundScanStatus!==e&&(this._backgroundScanStatus=e,this.backgroundScanStatusCallbacks.forEach(t=>{try{t(e)}catch(e){console.error(`[VPSLocationSource] Error in backgroundScanStatus listener`,e)}}))}configureVpsProvider(e){let r=n.CoreConfig.getConfig()?.arNavigationData?.providers?.vps,i=e?.endpoint??r?.endpoint;if(!i)throw Error(`VPSLocationSource requires an endpoint URL. Provide it in config or ensure CoreConfig is initialized with arNavigationData.providers.vps.endpoint`);let a=new URL(i);a.href+=`geopose`,t.VpsProvider.endpoint=a.toString();let o=e?.minInclinationForRequest??(r?.minInclinationForRequest?r.minInclinationForRequest*Math.PI/180:void 0);o!==void 0&&(t.VpsProvider.minInclinationForRequest=o);let s=e?.waitTimeMinInclinationForRequest??r?.waitTimeMinInclinationForRequest;s!==void 0&&(t.VpsProvider.waitTimeMinInclinationForRequest=s);let c=e?.useCoarsePose??r?.useCoarsePose;c!==void 0&&(t.VpsProvider.useCoarsePose=c),e?.maxScanDurationMs!==void 0&&(t.VpsProvider.maxScanDuration=e.maxScanDurationMs),e?.requestCaller!==void 0&&(t.VpsProvider.requestCaller=e.requestCaller)}async start(){this.isStarted||(this.setupListeners(),this.isStarted=!0,this.backgroundScanEnabled?this.backgroundScanner?.schedule():this.setBackgroundScanStatus(`disabled`))}async stop(){this.isStarted&&(this.vpsProviderListenerId!==null&&(t.VpsProvider.removeEventListener(this.vpsProviderListenerId),this.vpsProviderListenerId=null,t.VpsProvider.stop()),this.absolutePositionProviderId!==null&&(t.AbsolutePositionProvider.removeEventListener(this.absolutePositionProviderId),this.absolutePositionProviderId=null),this.absoluteAttitudeProviderId!==null&&(t.AbsoluteAttitudeProvider.removeEventListener(this.absoluteAttitudeProviderId),this.absoluteAttitudeProviderId=null),this.backgroundScanner?.clear(),this.setBackgroundScanStatus(this.backgroundScanEnabled?`idle`:`disabled`),this.isStarted=!1,this.setLocationState(`no_positioning`))}async dispose(){await super.dispose(),this.backgroundScanStatusUnsubscribe?.(),this.backgroundScanStatusUnsubscribe=null,this.backgroundScanner?.clear(),this.scanStatusCallbacks.clear(),this.backgroundScanStatusCallbacks.clear()}async startScan(){return this.backgroundScanner?.resetBudget(),await this.backgroundScanner?.cancelRunningScan(),this.startScanInternal()}async startScanInternal(){if(this.firstScan=!0,this.isStarted||await this.start(),await this.setupListeners(),this.vpsProviderListenerId!==null)return this.scanPromise??Promise.resolve(!1);let e=await t.VpsProvider.getAvailability();if(e instanceof Error)throw e;return this.setScanStatus(`scanning`),this.scanPromise=new Promise(e=>{this.scanResolve=e,this.vpsProviderListenerId=t.VpsProvider.addEventListener(t=>{this.scanResolve=null,this.stopScan(),this.handleVpsEvent(t),this.backgroundScanner?.schedule(),e(!0)},t=>{this.scanResolve=null,this.stopScan(),this.emitError(t),this.backgroundScanner?.schedule(),e(!1)})}),this.scanPromise}async stopScan(e=!1){e&&this.scanResolve&&(this.scanResolve(!1),this.scanResolve=null),this.vpsProviderListenerId!==null&&(t.VpsProvider.removeEventListener(this.vpsProviderListenerId),this.vpsProviderListenerId=null,t.VpsProvider.stop(),this.setScanStatus(`stopped`))}async setupListeners(){if(!this.absolutePositionProviderId&&this.firstScan&&(await t.AbsolutePositionProvider.getAvailability()instanceof Error||(this.absolutePositionProviderId=t.AbsolutePositionProvider.addEventListener(e=>{this.scanStatus!==`scanning`&&this.handleAbsolutePosition(e)},e=>{this.emitError(e)}))),!this.absoluteAttitudeProviderId&&this.firstScan){let e=await t.AbsoluteAttitudeProvider.getAvailability();e instanceof Error?console.warn(`AbsoluteAttitudeProvider not available:`,e):this.absoluteAttitudeProviderId=t.AbsoluteAttitudeProvider.addEventListener(e=>{this.mergeAndEmitUpdate({attitude:e,time:`time`in e?e.time:Date.now()})},e=>{this.emitError(e)})}}handleAbsolutePosition(e){this.updateDistanceAndLocationState(e),this.positionSmoother?this.positionSmoother.feed(e):this.mergeAndEmitUpdate({position:e,time:`time`in e?e.time:Date.now(),accuracy:`accuracy`in e?e.accuracy:void 0})}handleVpsEvent(e){let t={};if(e.absolutePosition){this.registerScanSuccess(e.absolutePosition),t.position=e.absolutePosition;let n=`time`in e.absolutePosition?e.absolutePosition.time:Date.now(),r=`accuracy`in e.absolutePosition?e.absolutePosition.accuracy:void 0;t.time=n,r!==void 0&&(t.accuracy=r)}e.absoluteAttitude&&(t.attitude=e.absoluteAttitude),this.mergeAndEmitUpdate(t)}getCurrentAbsolutePosition(){let e=this.currentPose.position;return!e||!(`latitude`in e)||!(`longitude`in e)?null:e}handleBackgroundVpsEvent(e){let t=e.absolutePosition;if(!t){this.backgroundScanner?.schedule();return}let n=this.getCurrentAbsolutePosition();if(!this.lastBackgroundCandidatePosition){if(n&&t.distanceTo(n)<this.ACCURACY_BACKGROUND_SCAN_THRESHOLD){this.handleVpsEvent(e),this.backgroundScanner?.schedule();return}this.lastBackgroundCandidatePosition=t,this.backgroundScanner?.runNow();return}let r=this.lastBackgroundCandidatePosition;this.lastBackgroundCandidatePosition=null;let i=!1;n&&t.distanceTo(n)<this.ACCURACY_BACKGROUND_SCAN_THRESHOLD&&(i=!0),!i&&r&&t.distanceTo(r)<this.ACCURACY_BACKGROUND_SCAN_THRESHOLD&&(i=!0),i&&this.handleVpsEvent(e),this.backgroundScanner?.schedule()}registerScanSuccess(e){this.lastScanPosition=e,this.lastPosition=e,this.distanceSinceLastScan=0,this.setLocationState(`accurate`)}updateDistanceAndLocationState(e){if(this.scanStatus===`scanning`)return;if(!this.lastPosition){this.lastPosition=e;return}let t=this.lastPosition.distanceTo(e);this.lastPosition=e,this.lastScanPosition&&(this.distanceSinceLastScan+=t,this.distanceSinceLastScan>=this.noPositioningLocationStateThreshold?this.setLocationState(`no_positioning`):this.distanceSinceLastScan>=this.degradedLocationStateThreshold?this.setLocationState(`degraded`):this.setLocationState(`accurate`))}},p=class extends o{absolutePositionProviderId=null;absoluteAttitudeProviderId=null;gnssWifiErrorListenerId=null;positionSmoother;config;constructor(e={}){super(),this.config=e,this.configureGnssWifi(e.gnssWifi),this.configureMapMatching(e,`outdoor`),e.usePositionSmoother!==!1&&(this.positionSmoother=new t.PositionSmoother(e=>{this.mergeAndEmitUpdate({position:e,time:`time`in e?e.time:Date.now(),accuracy:`accuracy`in e?e.accuracy:void 0})})),this.gnssWifiErrorListenerId=t.GnssWifiProvider.addEventListener(()=>{},e=>{this.emitError(e)},!1)}configureGnssWifi(e){let r=n.CoreConfig.getConfig()?.arNavigationData?.providers,i=e??r?.gnssWifi;i&&(i.discardPositionsAbove!==void 0&&(t.GnssWifiProvider.discardPositionsAbove=i.discardPositionsAbove),i.enableHighAccuracy!==void 0&&(t.GnssWifiProvider.enableHighAccuracy=i.enableHighAccuracy))}async start(){if(!this.isStarted)try{let e=await t.AbsolutePositionProvider.getAvailability();if(e instanceof Error)throw e;if(this.absolutePositionProviderId=t.AbsolutePositionProvider.addEventListener(e=>{this.setLocationState(`accurate`),this.positionSmoother?this.positionSmoother.feed(e):this.mergeAndEmitUpdate({position:e,time:`time`in e?e.time:Date.now(),accuracy:`accuracy`in e?e.accuracy:void 0})},e=>{this.emitError(e)}),this.config.enableAttitude!==!1)try{this.startAttitude()}catch(e){console.warn(`Failed to start AbsoluteAttitudeProvider:`,e)}this.isStarted=!0}catch(e){throw this.emitError(e instanceof Error?e:Error(String(e))),e}}async startAttitude(){let e=await t.AbsoluteAttitudeProvider.getAvailability();e instanceof Error?console.warn(`AbsoluteAttitudeProvider not available:`,e):this.absoluteAttitudeProviderId=t.AbsoluteAttitudeProvider.addEventListener(e=>{this.mergeAndEmitUpdate({attitude:e,time:`time`in e?e.time:Date.now()})},e=>{this.emitError(e)})}async stopAttitude(){this.absoluteAttitudeProviderId!==null&&(t.AbsoluteAttitudeProvider.removeEventListener(this.absoluteAttitudeProviderId),this.absoluteAttitudeProviderId=null)}async stop(){this.isStarted&&(this.absolutePositionProviderId!==null&&(t.AbsolutePositionProvider.removeEventListener(this.absolutePositionProviderId),this.absolutePositionProviderId=null),this.absoluteAttitudeProviderId!==null&&(t.AbsoluteAttitudeProvider.removeEventListener(this.absoluteAttitudeProviderId),this.absoluteAttitudeProviderId=null),this.isStarted=!1,this.setLocationState(`no_positioning`))}async dispose(){this.gnssWifiErrorListenerId!==null&&(t.GnssWifiProvider.removeEventListener(this.gnssWifiErrorListenerId),this.gnssWifiErrorListenerId=null),await super.dispose()}},m=class{static itinerary=null;static setItinerary(e){this.itinerary=e,t.MapMatchingHandler.itinerary=e}static getItinerary(){return this.itinerary??null}static clearItinerary(){this.itinerary=null,t.MapMatchingHandler.itinerary=null}};async function h(){if(typeof DeviceMotionEvent<`u`&&`requestPermission`in DeviceMotionEvent&&typeof DeviceMotionEvent.requestPermission==`function`)try{if(await DeviceMotionEvent.requestPermission()!==`granted`)return!1}catch{return!1}return!0}async function g(){return new Promise(e=>{t.GnssWifiProvider.addEventListener(()=>{e(!0)},()=>{e(!1)})})}Object.defineProperty(e,"Coordinates",{enumerable:!0,get:function(){return r.Coordinates}}),e.GnssWifiLocationSource=p,e.LocationSource=o,e.MapMatching=m,Object.defineProperty(e,"UserPosition",{enumerable:!0,get:function(){return r.UserPosition}}),e.VPSLocationSource=f,e.requestLocationPermissions=g,e.requestSensorPermissions=h});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@wemap/providers"),require("@wemap/core"),require("@wemap/geo")):typeof define==`function`&&define.amd?define([`exports`,`@wemap/providers`,`@wemap/core`,`@wemap/geo`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.Wemap=e.Wemap||{},e.Wemap.Positioning={}),e.Wemap.Providers,e.Wemap.Core,e.Wemap.Geo))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=30,a=30*Math.PI/180,o=class{currentPose={};updateCallbacks=new Set;errorCallbacks=new Set;isStarted=!1;_locationState=`no_positioning`;locationStateCallbacks=new Set;async dispose(){await this.stop(),this.updateCallbacks.clear(),this.errorCallbacks.clear(),this.locationStateCallbacks.clear()}onUpdate(e){if(this.updateCallbacks.add(e),Object.keys(this.currentPose).length>0)try{e({...this.currentPose})}catch(e){console.error(`Error in ${this.constructor.name} initial callback:`,e)}}offUpdate(e){this.updateCallbacks.delete(e)}onError(e){this.errorCallbacks.add(e)}offError(e){this.errorCallbacks.delete(e)}configureMapMatching(e,r=`indoor`){let o=n.CoreConfig.getConfig()?.arNavigationData?.[r]?.mapmatching,s=typeof o?.maxAngleBearing==`number`?o.maxAngleBearing*Math.PI/180:void 0;t.MapMatchingHandler.maxDistance=e?.maxDistance??o?.maxDistance??i,t.MapMatchingHandler.maxAngleBearing=e?.maxAngleBearing??s??a,t.MapMatchingHandler.useOrientationMatching=e?.useOrientationMatching??o?.useOrientationMatching??!1,t.MapMatchingHandler.useStrict=e?.useStrict??o?.useStrict??!1}mergeAndEmitUpdate(e){e.position!==void 0&&(this.currentPose.position=e.position),e.attitude!==void 0&&(this.currentPose.attitude=e.attitude),e.inclination!==void 0&&(this.currentPose.inclination=e.inclination),e.time!==void 0&&(this.currentPose.time=e.time),e.accuracy!==void 0&&(this.currentPose.accuracy=e.accuracy),this.emitUpdate({...this.currentPose})}emitUpdate(e){this.updateCallbacks.forEach(t=>{try{t(e)}catch(e){console.error(`Error in ${this.constructor.name} callback:`,e)}})}emitError(e){this.errorCallbacks.forEach(t=>{try{t(e)}catch(e){console.error(`Error in ${this.constructor.name} error callback:`,e)}})}get locationState(){return this._locationState}onLocationStateChange(e){this.locationStateCallbacks.add(e)}offLocationStateChange(e){this.locationStateCallbacks.delete(e)}setLocationState(e){this._locationState!==e&&(this._locationState=e,this.locationStateCallbacks.forEach(t=>{t(e)}))}},s=3e4,c=30*6e4,l=!0,u=50,d=100,f=class extends o{absolutePositionProviderId=null;absoluteAttitudeProviderId=null;vpsProviderListenerId=null;positionSmoother;_scanStatus=`stopped`;scanPromise=null;scanResolve=null;firstScan=!1;lastPosition=null;lastScanPosition=null;distanceSinceLastScan=0;backgroundScanEnabled;_backgroundScanStatus;scanStatusCallbacks=new Set;backgroundScanStatusCallbacks=new Set;backgroundScanner=null;backgroundScanStatusUnsubscribe=null;lastBackgroundCandidatePosition=null;ACCURACY_BACKGROUND_SCAN_THRESHOLD=15;degradedLocationStateThreshold;noPositioningLocationStateThreshold;wallCrossingEnabled;walls;wallCrossingImpact;wallsRequested=!1;wallCrossed=!1;constructor(e={}){super(),this.backgroundScanEnabled=e.vps?.backgroundScan??l,this.degradedLocationStateThreshold=e.vps?.degradedLocationStateThreshold??u,this.noPositioningLocationStateThreshold=e.vps?.noPositioningLocationStateThreshold??d;let r=n.CoreConfig.getConfig()?.arNavigationData?.wallCrossing;this.wallCrossingEnabled=e.wallCrossing?.enabled??r?.enabled??!1,this.walls=e.wallCrossing?.walls??new Map,this.wallCrossingImpact=e.wallCrossing?.locationImpact??(r?.locationImpact===`lost`?`no_positioning`:`degraded`),this.configureVpsProvider(e.vps),this.configureMapMatching(e,`indoor`),e.usePositionSmoother!==!1&&(this.positionSmoother=new t.PositionSmoother(e=>{this.mergeAndEmitUpdate({position:e,time:`time`in e?e.time:Date.now(),accuracy:`accuracy`in e?e.accuracy:void 0})})),t.ProvidersOptions.ignoreProviders=[`GnssWifi`];let i=e.vps?.backgroundScanIntervalMs??s,a=e.vps?.backgroundScanMaxDurationMs??c;this.backgroundScanner=new t.VpsBackgroundScanner({enabled:this.backgroundScanEnabled,intervalMs:i,maxDurationMs:a},e=>this.handleBackgroundVpsEvent(e),e=>{this.emitError(e)}),this._backgroundScanStatus=this.backgroundScanEnabled?`idle`:`disabled`,this.backgroundScanner&&(this.backgroundScanStatusUnsubscribe=this.backgroundScanner.onStatusChange(e=>{this.setBackgroundScanStatus(e)}))}get scanStatus(){return this._scanStatus}get backgroundScanStatus(){return this._backgroundScanStatus}onScanStatusChange(e){return this.scanStatusCallbacks.add(e),()=>{this.offScanStatusChange(e)}}offScanStatusChange(e){this.scanStatusCallbacks.delete(e)}onBackgroundScanStatusChange(e){return this.backgroundScanStatusCallbacks.add(e),()=>{this.offBackgroundScanStatusChange(e)}}offBackgroundScanStatusChange(e){this.backgroundScanStatusCallbacks.delete(e)}setScanStatus(e){this._scanStatus!==e&&(this._scanStatus=e,this.scanStatusCallbacks.forEach(t=>{try{t(e)}catch(e){console.error(`[VPSLocationSource] Error in scanStatus listener`,e)}}))}setBackgroundScanStatus(e){this._backgroundScanStatus!==e&&(this._backgroundScanStatus=e,this.backgroundScanStatusCallbacks.forEach(t=>{try{t(e)}catch(e){console.error(`[VPSLocationSource] Error in backgroundScanStatus listener`,e)}}))}configureVpsProvider(e){let r=n.CoreConfig.getConfig()?.arNavigationData?.providers?.vps,i=e?.endpoint??r?.endpoint;if(!i)throw Error(`VPSLocationSource requires an endpoint URL. Provide it in config or ensure CoreConfig is initialized with arNavigationData.providers.vps.endpoint`);let a=new URL(i);a.href+=`geopose`,t.VpsProvider.endpoint=a.toString();let o=e?.minInclinationForRequest??(r?.minInclinationForRequest?r.minInclinationForRequest*Math.PI/180:void 0);o!==void 0&&(t.VpsProvider.minInclinationForRequest=o);let s=e?.waitTimeMinInclinationForRequest??r?.waitTimeMinInclinationForRequest;s!==void 0&&(t.VpsProvider.waitTimeMinInclinationForRequest=s);let c=e?.useCoarsePose??r?.useCoarsePose;c!==void 0&&(t.VpsProvider.useCoarsePose=c),e?.maxScanDurationMs!==void 0&&(t.VpsProvider.maxScanDuration=e.maxScanDurationMs),e?.requestCaller!==void 0&&(t.VpsProvider.requestCaller=e.requestCaller)}async start(){this.isStarted||(this.setupListeners(),this.isStarted=!0,this.backgroundScanEnabled?this.backgroundScanner?.schedule():this.setBackgroundScanStatus(`disabled`))}async stop(){this.isStarted&&(this.vpsProviderListenerId!==null&&(t.VpsProvider.removeEventListener(this.vpsProviderListenerId),this.vpsProviderListenerId=null,t.VpsProvider.stop()),this.absolutePositionProviderId!==null&&(t.AbsolutePositionProvider.removeEventListener(this.absolutePositionProviderId),this.absolutePositionProviderId=null),this.absoluteAttitudeProviderId!==null&&(t.AbsoluteAttitudeProvider.removeEventListener(this.absoluteAttitudeProviderId),this.absoluteAttitudeProviderId=null),this.backgroundScanner?.clear(),this.setBackgroundScanStatus(this.backgroundScanEnabled?`idle`:`disabled`),this.isStarted=!1,this.setLocationState(`no_positioning`))}async dispose(){await super.dispose(),this.backgroundScanStatusUnsubscribe?.(),this.backgroundScanStatusUnsubscribe=null,this.backgroundScanner?.clear(),this.scanStatusCallbacks.clear(),this.backgroundScanStatusCallbacks.clear()}async startScan(){return this.backgroundScanner?.resetBudget(),await this.backgroundScanner?.cancelRunningScan(),this.startScanInternal()}async startScanInternal(){if(this.firstScan=!0,this.isStarted||await this.start(),await this.setupListeners(),this.vpsProviderListenerId!==null)return this.scanPromise??Promise.resolve(!1);let e=await t.VpsProvider.getAvailability();if(e instanceof Error)throw e;return this.setScanStatus(`scanning`),this.scanPromise=new Promise(e=>{this.scanResolve=e,this.vpsProviderListenerId=t.VpsProvider.addEventListener(t=>{this.scanResolve=null,this.stopScan(),this.handleVpsEvent(t),this.backgroundScanner?.schedule(),e(!0)},t=>{this.scanResolve=null,this.stopScan(),this.emitError(t),this.backgroundScanner?.schedule(),e(!1)})}),this.scanPromise}async stopScan(e=!1){e&&this.scanResolve&&(this.scanResolve(!1),this.scanResolve=null),this.vpsProviderListenerId!==null&&(t.VpsProvider.removeEventListener(this.vpsProviderListenerId),this.vpsProviderListenerId=null,t.VpsProvider.stop(),this.setScanStatus(`stopped`))}async setupListeners(){if(!this.absolutePositionProviderId&&this.firstScan&&(await t.AbsolutePositionProvider.getAvailability()instanceof Error||(this.absolutePositionProviderId=t.AbsolutePositionProvider.addEventListener(e=>{this.scanStatus!==`scanning`&&this.handleAbsolutePosition(e)},e=>{this.emitError(e)}))),!this.absoluteAttitudeProviderId&&this.firstScan){let e=await t.AbsoluteAttitudeProvider.getAvailability();e instanceof Error?console.warn(`AbsoluteAttitudeProvider not available:`,e):this.absoluteAttitudeProviderId=t.AbsoluteAttitudeProvider.addEventListener(e=>{this.mergeAndEmitUpdate({attitude:e,time:`time`in e?e.time:Date.now()})},e=>{this.emitError(e)})}}handleAbsolutePosition(e){this.updateDistanceAndLocationState(e),this.positionSmoother?this.positionSmoother.feed(e):this.mergeAndEmitUpdate({position:e,time:`time`in e?e.time:Date.now(),accuracy:`accuracy`in e?e.accuracy:void 0})}handleVpsEvent(e){let t={};if(e.absolutePosition){this.registerScanSuccess(e.absolutePosition),t.position=e.absolutePosition;let n=`time`in e.absolutePosition?e.absolutePosition.time:Date.now(),r=`accuracy`in e.absolutePosition?e.absolutePosition.accuracy:void 0;t.time=n,r!==void 0&&(t.accuracy=r)}e.absoluteAttitude&&(t.attitude=e.absoluteAttitude),this.mergeAndEmitUpdate(t)}getCurrentAbsolutePosition(){let e=this.currentPose.position;return!e||!(`latitude`in e)||!(`longitude`in e)?null:e}handleBackgroundVpsEvent(e){let t=e.absolutePosition;if(!t){this.backgroundScanner?.schedule();return}let n=this.getCurrentAbsolutePosition();if(!this.lastBackgroundCandidatePosition){if(n&&t.distanceTo(n)<this.ACCURACY_BACKGROUND_SCAN_THRESHOLD){this.handleVpsEvent(e),this.backgroundScanner?.schedule();return}this.lastBackgroundCandidatePosition=t,this.backgroundScanner?.runNow();return}let r=this.lastBackgroundCandidatePosition;this.lastBackgroundCandidatePosition=null;let i=!1;n&&t.distanceTo(n)<this.ACCURACY_BACKGROUND_SCAN_THRESHOLD&&(i=!0),!i&&r&&t.distanceTo(r)<this.ACCURACY_BACKGROUND_SCAN_THRESHOLD&&(i=!0),i&&this.handleVpsEvent(e),this.backgroundScanner?.schedule()}registerScanSuccess(e){this.wallCrossingEnabled&&!this.walls.size&&!this.wallsRequested&&(this.wallsRequested=!0,this.loadWalls(e).catch(e=>this.emitError(e))),this.lastScanPosition=e,this.lastPosition=e,this.distanceSinceLastScan=0,this.wallCrossed=!1,this.setLocationState(`accurate`)}updateDistanceAndLocationState(e){if(this.scanStatus===`scanning`)return;if(!this.lastPosition){this.lastPosition=e;return}let t=this.lastPosition,n=t.distanceTo(e);this.lastPosition=e,this.lastScanPosition&&(this.distanceSinceLastScan+=n,!this.wallCrossed&&this.crossedWall(t,e)&&(this.wallCrossed=!0),this.distanceSinceLastScan>=this.noPositioningLocationStateThreshold?this.setLocationState(`no_positioning`):this.wallCrossed?this.setLocationState(this.wallCrossingImpact):this.distanceSinceLastScan>=this.degradedLocationStateThreshold?this.setLocationState(`degraded`):this.setLocationState(`accurate`))}crossedWall(e,t){return!this.wallCrossingEnabled||!this.walls.size?!1:(0,r.findWallCrossing)(e,t,r.Level.equals(e.level,t.level)?this.wallsOf(t.level):[...this.wallsOf(e.level),...this.wallsOf(t.level)])!==null}wallsOf(e){return typeof e==`number`?this.walls.get(e)??[]:[]}async loadWalls(e){let t=(await n.core.createBuildingService().getBuildingsFromBbox(new r.BoundingBox(e,e))).find(e=>e.venue!==null)?.venue;if(t!=null)for(let e of await n.core.createWallService().searchWalls(t)){let t=this.walls.get(e.level)??[];t.push(...(0,r.wallSegments)(e.geometry)),this.walls.set(e.level,t)}}},p=class extends o{absolutePositionProviderId=null;absoluteAttitudeProviderId=null;gnssWifiErrorListenerId=null;positionSmoother;config;constructor(e={}){super(),this.config=e,this.configureGnssWifi(e.gnssWifi),this.configureMapMatching(e,`outdoor`),e.usePositionSmoother!==!1&&(this.positionSmoother=new t.PositionSmoother(e=>{this.mergeAndEmitUpdate({position:e,time:`time`in e?e.time:Date.now(),accuracy:`accuracy`in e?e.accuracy:void 0})})),this.gnssWifiErrorListenerId=t.GnssWifiProvider.addEventListener(()=>{},e=>{this.emitError(e)},!1)}configureGnssWifi(e){let r=n.CoreConfig.getConfig()?.arNavigationData?.providers,i=e??r?.gnssWifi;i&&(i.discardPositionsAbove!==void 0&&(t.GnssWifiProvider.discardPositionsAbove=i.discardPositionsAbove),i.enableHighAccuracy!==void 0&&(t.GnssWifiProvider.enableHighAccuracy=i.enableHighAccuracy))}async start(){if(!this.isStarted)try{let e=await t.AbsolutePositionProvider.getAvailability();if(e instanceof Error)throw e;if(this.absolutePositionProviderId=t.AbsolutePositionProvider.addEventListener(e=>{this.setLocationState(`accurate`),this.positionSmoother?this.positionSmoother.feed(e):this.mergeAndEmitUpdate({position:e,time:`time`in e?e.time:Date.now(),accuracy:`accuracy`in e?e.accuracy:void 0})},e=>{this.emitError(e)}),this.config.enableAttitude!==!1)try{this.startAttitude()}catch(e){console.warn(`Failed to start AbsoluteAttitudeProvider:`,e)}this.isStarted=!0}catch(e){throw this.emitError(e instanceof Error?e:Error(String(e))),e}}async startAttitude(){let e=await t.AbsoluteAttitudeProvider.getAvailability();e instanceof Error?console.warn(`AbsoluteAttitudeProvider not available:`,e):this.absoluteAttitudeProviderId=t.AbsoluteAttitudeProvider.addEventListener(e=>{this.mergeAndEmitUpdate({attitude:e,time:`time`in e?e.time:Date.now()})},e=>{this.emitError(e)})}async stopAttitude(){this.absoluteAttitudeProviderId!==null&&(t.AbsoluteAttitudeProvider.removeEventListener(this.absoluteAttitudeProviderId),this.absoluteAttitudeProviderId=null)}async stop(){this.isStarted&&(this.absolutePositionProviderId!==null&&(t.AbsolutePositionProvider.removeEventListener(this.absolutePositionProviderId),this.absolutePositionProviderId=null),this.absoluteAttitudeProviderId!==null&&(t.AbsoluteAttitudeProvider.removeEventListener(this.absoluteAttitudeProviderId),this.absoluteAttitudeProviderId=null),this.isStarted=!1,this.setLocationState(`no_positioning`))}async dispose(){this.gnssWifiErrorListenerId!==null&&(t.GnssWifiProvider.removeEventListener(this.gnssWifiErrorListenerId),this.gnssWifiErrorListenerId=null),await super.dispose()}},m=class{static itinerary=null;static setItinerary(e){this.itinerary=e,t.MapMatchingHandler.itinerary=e}static getItinerary(){return this.itinerary??null}static clearItinerary(){this.itinerary=null,t.MapMatchingHandler.itinerary=null}};async function h(){if(typeof DeviceMotionEvent<`u`&&`requestPermission`in DeviceMotionEvent&&typeof DeviceMotionEvent.requestPermission==`function`)try{if(await DeviceMotionEvent.requestPermission()!==`granted`)return!1}catch{return!1}return!0}async function g(){return new Promise(e=>{t.GnssWifiProvider.addEventListener(()=>{e(!0)},()=>{e(!1)})})}Object.defineProperty(e,"Coordinates",{enumerable:!0,get:function(){return r.Coordinates}}),e.GnssWifiLocationSource=p,e.LocationSource=o,e.MapMatching=m,Object.defineProperty(e,"UserPosition",{enumerable:!0,get:function(){return r.UserPosition}}),e.VPSLocationSource=f,e.requestLocationPermissions=g,e.requestSensorPermissions=h});
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AbsoluteAttitudeProvider as e, AbsolutePositionProvider as t, GnssWifiProvider as n, MapMatchingHandler as r, PositionSmoother as i, ProvidersOptions as a, VpsBackgroundScanner as o, VpsProvider as s } from "@wemap/providers";
|
|
2
|
-
import { CoreConfig as c } from "@wemap/core";
|
|
3
|
-
import { Coordinates as
|
|
2
|
+
import { CoreConfig as c, core as l } from "@wemap/core";
|
|
3
|
+
import { BoundingBox as u, Coordinates as d, Level as f, UserPosition as p, findWallCrossing as m, wallSegments as h } from "@wemap/geo";
|
|
4
4
|
//#region src/location-sources/LocationSource.ts
|
|
5
|
-
var
|
|
5
|
+
var g = 30, _ = 30 * Math.PI / 180, v = class {
|
|
6
6
|
currentPose = {};
|
|
7
7
|
updateCallbacks = /* @__PURE__ */ new Set();
|
|
8
8
|
errorCallbacks = /* @__PURE__ */ new Set();
|
|
@@ -30,7 +30,7 @@ var d = 30, f = 30 * Math.PI / 180, p = class {
|
|
|
30
30
|
}
|
|
31
31
|
configureMapMatching(e, t = "indoor") {
|
|
32
32
|
let n = c.getConfig()?.arNavigationData?.[t]?.mapmatching, i = typeof n?.maxAngleBearing == "number" ? n.maxAngleBearing * Math.PI / 180 : void 0;
|
|
33
|
-
r.maxDistance = e?.maxDistance ?? n?.maxDistance ??
|
|
33
|
+
r.maxDistance = e?.maxDistance ?? n?.maxDistance ?? g, r.maxAngleBearing = e?.maxAngleBearing ?? i ?? _, r.useOrientationMatching = e?.useOrientationMatching ?? n?.useOrientationMatching ?? !1, r.useStrict = e?.useStrict ?? n?.useStrict ?? !1;
|
|
34
34
|
}
|
|
35
35
|
mergeAndEmitUpdate(e) {
|
|
36
36
|
e.position !== void 0 && (this.currentPose.position = e.position), e.attitude !== void 0 && (this.currentPose.attitude = e.attitude), e.inclination !== void 0 && (this.currentPose.inclination = e.inclination), e.time !== void 0 && (this.currentPose.time = e.time), e.accuracy !== void 0 && (this.currentPose.accuracy = e.accuracy), this.emitUpdate({ ...this.currentPose });
|
|
@@ -67,7 +67,7 @@ var d = 30, f = 30 * Math.PI / 180, p = class {
|
|
|
67
67
|
t(e);
|
|
68
68
|
}));
|
|
69
69
|
}
|
|
70
|
-
},
|
|
70
|
+
}, y = 3e4, b = 30 * 6e4, x = !0, S = 50, C = 100, w = class extends v {
|
|
71
71
|
absolutePositionProviderId = null;
|
|
72
72
|
absoluteAttitudeProviderId = null;
|
|
73
73
|
vpsProviderListenerId = null;
|
|
@@ -89,19 +89,26 @@ var d = 30, f = 30 * Math.PI / 180, p = class {
|
|
|
89
89
|
ACCURACY_BACKGROUND_SCAN_THRESHOLD = 15;
|
|
90
90
|
degradedLocationStateThreshold;
|
|
91
91
|
noPositioningLocationStateThreshold;
|
|
92
|
+
wallCrossingEnabled;
|
|
93
|
+
walls;
|
|
94
|
+
wallCrossingImpact;
|
|
95
|
+
wallsRequested = !1;
|
|
96
|
+
wallCrossed = !1;
|
|
92
97
|
constructor(e = {}) {
|
|
93
|
-
super(), this.backgroundScanEnabled = e.vps?.backgroundScan ??
|
|
98
|
+
super(), this.backgroundScanEnabled = e.vps?.backgroundScan ?? x, this.degradedLocationStateThreshold = e.vps?.degradedLocationStateThreshold ?? S, this.noPositioningLocationStateThreshold = e.vps?.noPositioningLocationStateThreshold ?? C;
|
|
99
|
+
let t = c.getConfig()?.arNavigationData?.wallCrossing;
|
|
100
|
+
this.wallCrossingEnabled = e.wallCrossing?.enabled ?? t?.enabled ?? !1, this.walls = e.wallCrossing?.walls ?? /* @__PURE__ */ new Map(), this.wallCrossingImpact = e.wallCrossing?.locationImpact ?? (t?.locationImpact === "lost" ? "no_positioning" : "degraded"), this.configureVpsProvider(e.vps), this.configureMapMatching(e, "indoor"), e.usePositionSmoother !== !1 && (this.positionSmoother = new i((e) => {
|
|
94
101
|
this.mergeAndEmitUpdate({
|
|
95
102
|
position: e,
|
|
96
103
|
time: "time" in e ? e.time : Date.now(),
|
|
97
104
|
accuracy: "accuracy" in e ? e.accuracy : void 0
|
|
98
105
|
});
|
|
99
106
|
})), a.ignoreProviders = ["GnssWifi"];
|
|
100
|
-
let
|
|
107
|
+
let n = e.vps?.backgroundScanIntervalMs ?? y, r = e.vps?.backgroundScanMaxDurationMs ?? b;
|
|
101
108
|
this.backgroundScanner = new o({
|
|
102
109
|
enabled: this.backgroundScanEnabled,
|
|
103
|
-
intervalMs:
|
|
104
|
-
maxDurationMs:
|
|
110
|
+
intervalMs: n,
|
|
111
|
+
maxDurationMs: r
|
|
105
112
|
}, (e) => this.handleBackgroundVpsEvent(e), (e) => {
|
|
106
113
|
this.emitError(e);
|
|
107
114
|
}), this._backgroundScanStatus = this.backgroundScanEnabled ? "idle" : "disabled", this.backgroundScanner && (this.backgroundScanStatusUnsubscribe = this.backgroundScanner.onStatusChange((e) => {
|
|
@@ -245,7 +252,7 @@ var d = 30, f = 30 * Math.PI / 180, p = class {
|
|
|
245
252
|
n && t.distanceTo(n) < this.ACCURACY_BACKGROUND_SCAN_THRESHOLD && (i = !0), !i && r && t.distanceTo(r) < this.ACCURACY_BACKGROUND_SCAN_THRESHOLD && (i = !0), i && this.handleVpsEvent(e), this.backgroundScanner?.schedule();
|
|
246
253
|
}
|
|
247
254
|
registerScanSuccess(e) {
|
|
248
|
-
this.lastScanPosition = e, this.lastPosition = e, this.distanceSinceLastScan = 0, this.setLocationState("accurate");
|
|
255
|
+
this.wallCrossingEnabled && !this.walls.size && !this.wallsRequested && (this.wallsRequested = !0, this.loadWalls(e).catch((e) => this.emitError(e))), this.lastScanPosition = e, this.lastPosition = e, this.distanceSinceLastScan = 0, this.wallCrossed = !1, this.setLocationState("accurate");
|
|
249
256
|
}
|
|
250
257
|
updateDistanceAndLocationState(e) {
|
|
251
258
|
if (this.scanStatus === "scanning") return;
|
|
@@ -253,10 +260,23 @@ var d = 30, f = 30 * Math.PI / 180, p = class {
|
|
|
253
260
|
this.lastPosition = e;
|
|
254
261
|
return;
|
|
255
262
|
}
|
|
256
|
-
let t = this.lastPosition.distanceTo(e);
|
|
257
|
-
this.lastPosition = e, this.lastScanPosition && (this.distanceSinceLastScan += t, this.distanceSinceLastScan >= this.noPositioningLocationStateThreshold ? this.setLocationState("no_positioning") : this.distanceSinceLastScan >= this.degradedLocationStateThreshold ? this.setLocationState("degraded") : this.setLocationState("accurate"));
|
|
263
|
+
let t = this.lastPosition, n = t.distanceTo(e);
|
|
264
|
+
this.lastPosition = e, this.lastScanPosition && (this.distanceSinceLastScan += n, !this.wallCrossed && this.crossedWall(t, e) && (this.wallCrossed = !0), this.distanceSinceLastScan >= this.noPositioningLocationStateThreshold ? this.setLocationState("no_positioning") : this.wallCrossed ? this.setLocationState(this.wallCrossingImpact) : this.distanceSinceLastScan >= this.degradedLocationStateThreshold ? this.setLocationState("degraded") : this.setLocationState("accurate"));
|
|
258
265
|
}
|
|
259
|
-
|
|
266
|
+
crossedWall(e, t) {
|
|
267
|
+
return !this.wallCrossingEnabled || !this.walls.size ? !1 : m(e, t, f.equals(e.level, t.level) ? this.wallsOf(t.level) : [...this.wallsOf(e.level), ...this.wallsOf(t.level)]) !== null;
|
|
268
|
+
}
|
|
269
|
+
wallsOf(e) {
|
|
270
|
+
return typeof e == "number" ? this.walls.get(e) ?? [] : [];
|
|
271
|
+
}
|
|
272
|
+
async loadWalls(e) {
|
|
273
|
+
let t = (await l.createBuildingService().getBuildingsFromBbox(new u(e, e))).find((e) => e.venue !== null)?.venue;
|
|
274
|
+
if (t != null) for (let e of await l.createWallService().searchWalls(t)) {
|
|
275
|
+
let t = this.walls.get(e.level) ?? [];
|
|
276
|
+
t.push(...h(e.geometry)), this.walls.set(e.level, t);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}, T = class extends v {
|
|
260
280
|
absolutePositionProviderId = null;
|
|
261
281
|
absoluteAttitudeProviderId = null;
|
|
262
282
|
gnssWifiErrorListenerId = null;
|
|
@@ -319,7 +339,7 @@ var d = 30, f = 30 * Math.PI / 180, p = class {
|
|
|
319
339
|
async dispose() {
|
|
320
340
|
this.gnssWifiErrorListenerId !== null && (n.removeEventListener(this.gnssWifiErrorListenerId), this.gnssWifiErrorListenerId = null), await super.dispose();
|
|
321
341
|
}
|
|
322
|
-
},
|
|
342
|
+
}, E = class {
|
|
323
343
|
static itinerary = null;
|
|
324
344
|
static setItinerary(e) {
|
|
325
345
|
this.itinerary = e, r.itinerary = e;
|
|
@@ -333,7 +353,7 @@ var d = 30, f = 30 * Math.PI / 180, p = class {
|
|
|
333
353
|
};
|
|
334
354
|
//#endregion
|
|
335
355
|
//#region src/utils/permissions.ts
|
|
336
|
-
async function
|
|
356
|
+
async function D() {
|
|
337
357
|
if (typeof DeviceMotionEvent < "u" && "requestPermission" in DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission == "function") try {
|
|
338
358
|
if (await DeviceMotionEvent.requestPermission() !== "granted") return !1;
|
|
339
359
|
} catch {
|
|
@@ -341,7 +361,7 @@ async function S() {
|
|
|
341
361
|
}
|
|
342
362
|
return !0;
|
|
343
363
|
}
|
|
344
|
-
async function
|
|
364
|
+
async function O() {
|
|
345
365
|
return new Promise((e) => {
|
|
346
366
|
n.addEventListener(() => {
|
|
347
367
|
e(!0);
|
|
@@ -351,4 +371,4 @@ async function C() {
|
|
|
351
371
|
});
|
|
352
372
|
}
|
|
353
373
|
//#endregion
|
|
354
|
-
export {
|
|
374
|
+
export { d as Coordinates, T as GnssWifiLocationSource, v as LocationSource, E as MapMatching, p as UserPosition, w as VPSLocationSource, O as requestLocationPermissions, D as requestSensorPermissions };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VpsBackgroundScanStatus } from '@wemap/providers';
|
|
2
|
-
import {
|
|
2
|
+
import { WallSegment } from '@wemap/geo';
|
|
3
|
+
import { LocationSourceOptions, LocationState } from '../types';
|
|
3
4
|
import { LocationSource } from './LocationSource';
|
|
4
5
|
/**
|
|
5
6
|
* Configuration options for VPSLocationSource
|
|
@@ -44,6 +45,24 @@ export interface VPSLocationSourceConfig extends LocationSourceOptions {
|
|
|
44
45
|
/** Threshold for no positioning location state (default: 100m) */
|
|
45
46
|
noPositioningLocationStateThreshold?: number;
|
|
46
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* How walking through a wall affects the location state. Left out, walls are never
|
|
50
|
+
* tested and none are fetched.
|
|
51
|
+
*/
|
|
52
|
+
wallCrossing?: {
|
|
53
|
+
/** Whether to test walks against walls (if not provided, will use CoreConfig). */
|
|
54
|
+
enabled?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Walls to test the walk against, per level. Left empty, the walls of the venue the
|
|
57
|
+
* first fix lands in are fetched from the API instead.
|
|
58
|
+
*/
|
|
59
|
+
walls?: Map<number, WallSegment[]>;
|
|
60
|
+
/**
|
|
61
|
+
* State a crossing settles on until the next successful scan (if not provided, will
|
|
62
|
+
* use CoreConfig, which defaults to `degraded`).
|
|
63
|
+
*/
|
|
64
|
+
locationImpact?: Extract<LocationState, 'degraded' | 'no_positioning'>;
|
|
65
|
+
};
|
|
47
66
|
}
|
|
48
67
|
export type ScanStatus = 'scanning' | 'stopped';
|
|
49
68
|
export type BackgroundScanStatus = VpsBackgroundScanStatus;
|
|
@@ -69,6 +88,11 @@ export declare class VPSLocationSource extends LocationSource {
|
|
|
69
88
|
private readonly ACCURACY_BACKGROUND_SCAN_THRESHOLD;
|
|
70
89
|
private degradedLocationStateThreshold;
|
|
71
90
|
private noPositioningLocationStateThreshold;
|
|
91
|
+
private readonly wallCrossingEnabled;
|
|
92
|
+
private readonly walls;
|
|
93
|
+
private readonly wallCrossingImpact;
|
|
94
|
+
private wallsRequested;
|
|
95
|
+
private wallCrossed;
|
|
72
96
|
constructor(config?: VPSLocationSourceConfig);
|
|
73
97
|
/**
|
|
74
98
|
* Current scan status (manual or background).
|
|
@@ -155,5 +179,12 @@ export declare class VPSLocationSource extends LocationSource {
|
|
|
155
179
|
private handleBackgroundVpsEvent;
|
|
156
180
|
private registerScanSuccess;
|
|
157
181
|
private updateDistanceAndLocationState;
|
|
182
|
+
private crossedWall;
|
|
183
|
+
private wallsOf;
|
|
184
|
+
/**
|
|
185
|
+
* Fill {@link walls} with those of the venue the first fix landed in. Called once, off
|
|
186
|
+
* the position path: until it resolves, crossings simply are not detected.
|
|
187
|
+
*/
|
|
188
|
+
private loadWalls;
|
|
158
189
|
}
|
|
159
190
|
//# sourceMappingURL=VPSLocationSource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VPSLocationSource.d.ts","sourceRoot":"","sources":["../../../src/location-sources/VPSLocationSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAe,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"VPSLocationSource.d.ts","sourceRoot":"","sources":["../../../src/location-sources/VPSLocationSource.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wemap/positioning",
|
|
3
|
-
"version": "14.8.0-beta.
|
|
3
|
+
"version": "14.8.0-beta.1",
|
|
4
4
|
"description": "Indoor/outdoor positioning for the Wemap SDK.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Wemap SAS",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@wemap/core": "14.8.0-beta.
|
|
41
|
-
"@wemap/geo": "14.8.0-beta.
|
|
42
|
-
"@wemap/providers": "14.8.0-beta.
|
|
43
|
-
"@wemap/routers": "14.8.0-beta.
|
|
44
|
-
"@wemap/utils": "14.8.0-beta.
|
|
40
|
+
"@wemap/core": "14.8.0-beta.1",
|
|
41
|
+
"@wemap/geo": "14.8.0-beta.1",
|
|
42
|
+
"@wemap/providers": "14.8.0-beta.1",
|
|
43
|
+
"@wemap/routers": "14.8.0-beta.1",
|
|
44
|
+
"@wemap/utils": "14.8.0-beta.1"
|
|
45
45
|
}
|
|
46
46
|
}
|