问题描述
我正在为iOS和Android编写导航应用程序。要求之一是能够使用备用矢量数据(客户端的许可问题)。在iOS版本中,我可以通过一次调用和内置的昼/夜设置自定义的白天和黑夜风格URI(这些样式包含替代映射数据的源条目以及其实际样式)。切换逻辑只是“做正确的事”。这是基本的iOS Swift代码:
let navigationService = MapBoxNavigationService(route: route,simulating: simulate ? .always : .never)
let navigationoptions: Navigationoptions?
if !(dayStyle ?? "").isEmpty || !(nightStyle ?? "").isEmpty {
var dayUrl = dayStyle ?? ""
var nightUrl = nightStyle ?? ""
if(dayUrl.isEmpty) { dayUrl = nightUrl }
if(nightUrl.isEmpty) { nightUrl = dayUrl }
let ds = CustomDayStyle()
ds.setUrl(url: dayUrl)
let ns = CustomNightStyle()
ns.setUrl(url: nightUrl)
//****************************
// in the next line,the styles accepts an array of style instances. The style instances
// each have a "styleType" parameter that gets set to either .day or .night
//****************************
navigationoptions = Navigationoptions(styles: [ds,ns],navigationService: navigationService)
} else {
navigationoptions = Navigationoptions(navigationService: navigationService)
}
let navigationViewController = NavigationViewController(for: route,options: navigationoptions)
但是,在MapBox Android SDK中,我仅在地图对象上看到“ SetStyle”。
private void setMapStyles() {
String dayMapStyle = permitState.getDayStyleUrl();
String nightMapStyle = permitState.getNightStyleUrl();
if(dayMapStyle.length() > 0 || nightMapStyle.length() > 0) {
NavigationMapBoxMap navMap = navigationView.retrieveNavigationMapBoxMap();
MapBoxMap map = navMap.retrieveMap();
//****************************
// would like to set both styles into the map,here
//****************************
map.setStyle(new Style.Builder().fromUri(dayMapStyle));
}
}
是否可以同时设置两种样式?如果没有,我是否可以捕捉到一个事件/替代来手动设置正确的样式?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)