我试图理解 Mapbox 中一些使用 CarmenFeature 的示例代码,但我不明白它是什么或它的用途。
我所指的方法在上下文中显示如下,尽管我不是在寻找方法本身的解释。
谢谢!
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE_AUTOCOMPLETE) {
// Retrieve selected location's CarmenFeature
CarmenFeature selectedCarmenFeature = PlaceAutocomplete.getPlace(data);
// Create a new FeatureCollection and add a new Feature to it using selectedCarmenFeature above.
// Then retrieve and update the source designated for showing a selected location's symbol layer icon
if (mapboxMap != null) {
Style style = mapboxMap.getStyle();
if (style != null) {
GeoJsonSource source = style.getSourceAs(geojsonSourceLayerId);
if (source != null) {
source.setGeoJson(FeatureCollection.fromFeatures(
new Feature[] {Feature.fromJson(selectedCarmenFeature.toJson())}));
}
// Move map camera to the selected location
mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(
new CameraPosition.Builder()
.target(new LatLng(((Point) selectedCarmenFeature.geometry()).latitude(),
((Point) selectedCarmenFeature.geometry()).longitude()))
.zoom(14)
.build()), 4000);
}
}
}
}
最佳答案
CarmenFeature
是保存来自 a Mapbox Geocoding API response 的信息的类的名称.
Here's the CarmenFeature
class, which comes from the Mapbox Java SDK .
您会在 the Java SDK's GeocodingResponse
class 中看到多次提到 CarmenFeature
.
关于android - Mapbox Android SDK 使用的 CarmenFeature 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57718695/