use of com.google.maps.android.data.kml.KmlStyle in project android-maps-utils by googlemaps.
the class Renderer method addFeature.
/**
* Adds a new Feature to the map if its geometry property is not null.
*
* @param feature feature to add to the map
*/
public void addFeature(Feature feature) {
Object mapObject = FEATURE_NOT_ON_MAP;
if (feature instanceof GeoJsonFeature) {
setFeatureDefaultStyles((GeoJsonFeature) feature);
}
if (mLayerOnMap) {
if (mFeatures.containsKey(feature)) {
// Remove current map objects before adding new ones
removeFromMap(mFeatures.get(feature));
}
if (feature.hasGeometry()) {
// Create new map object
if (feature instanceof KmlPlacemark) {
boolean isPlacemarkVisible = getPlacemarkVisibility(feature);
String placemarkId = feature.getId();
Geometry geometry = feature.getGeometry();
KmlStyle style = getPlacemarkStyle(placemarkId);
KmlStyle inlineStyle = ((KmlPlacemark) feature).getInlineStyle();
mapObject = addKmlPlacemarkToMap((KmlPlacemark) feature, geometry, style, inlineStyle, isPlacemarkVisible);
} else {
mapObject = addGeoJsonFeatureToMap(feature, feature.getGeometry());
}
}
}
mFeatures.put(feature, mapObject);
}
Aggregations