我正在使用SKPOITrackerManager
在导航模式下跟踪自定义的可跟踪POI。 SKTrackablePOI
对象的arraylist具有许多放置在我的路线附近的元素。但是onReceivedPOIs()
只能跟踪其中的一个。此方法仅返回一个元素列表。但是,对于一个POI,它被称为5到10倍。抱歉,由于项目协议,我无法在此处发布完整的代码。但是在这里,我可以在SKPOITrackerListener
接口的实现中向您展示我的设置:
public void startPOITracking() {
poiTrackerManager = new SKPOITrackerManager(this);
SKTrackablePOIRule skTrackablePOIRule = new SKTrackablePOIRule();
skTrackablePOIRule.setAerialDistance(15000);
skTrackablePOIRule.setRouteDistance(15000);
skTrackablePOIRule.setNumberOfTurns(15000);
skTrackablePOIRule.setMaxGPSAccuracy(15000);
skTrackablePOIRule.setEliminateIfUTurn(false);
skTrackablePOIRule.setMinSpeedIgnoreDistanceAfterTurn(12000);
skTrackablePOIRule.setMaxDistanceAfterTurn(150000);
poiTrackerManager.startPOITrackerWithRadius(100, 0.5);
poiTrackerManager.setRuleForPOIType(SKTrackablePOIType.INVALID, skTrackablePOIRule);
poiTrackerManager.addWarningRulesforPoiType(SKTrackablePOIType.INVALID);
}
我已将限制设置为在
SKTrackablePOIRule
中很高的值,并且仍然只能获得一个POI。我什至可以用poiTrackerManager.setRuleForPOIType(SKTrackablePOIType.INVALID, skTrackablePOIRule);
注释掉该行,但我仍然只收到一个POI。也许有人可以帮助您了解我的问题。 最佳答案
这是我过去使用的东西:
poiTrackingManager = new SKPOITrackerManager(this);
SKTrackablePOIRule rule = new SKTrackablePOIRule();
rule.setAerialDistance(5000); // this would be our main constraint, stating that all the POIs with 5000m, aerial distance should be detected
rule.setNumberOfTurns(100); // this has to be increased – otherwise some points will be disconsidered
rule.setRouteDistance(10000);//this has to be increased as the real road route will be longer than the aerial distance
rule.setMinSpeedIgnoreDistanceAfterTurn(20); //decrease this to evaluate all candidates
rule.setMaxDistanceAfterTurn(10000); //increase this to make sure we don't exclude any candidates
rule.setEliminateIfUTurn(false); // setting this to true (default) excludes points that require us to make an U-turn to get to them
rule.setPlayAudioWarning(false);
注意:我不确定这些参数的最大值/最小值是多少,因为当它们过高时我已经看到了一些问题(它们确实会影响路由算法,更确切地说是如何探索路线图,因此这可以解释为什么如果值较高,则可能会发生故障)-我想说的是,您应该从保守值开始,然后逐渐增加它们
对于startPOITrackerWithRadius,我将使用不同的值,就像将半径设置为100(米)一样,这将大大减少SDK能够分析的POI数量(即使规则很好,也可能不会分析POI,因为它们没有不会落在当前位置周围的“半径”(空中距离)中:
poiTrackingManager.startPOITrackerWithRadius(1500, 0.5);
另请参阅http://sdkblog.skobbler.com/detecting-tracking-pois-in-your-way/,以获取有关POITraker如何工作的更多见解