use of com.google.maps.android.data.Feature in project android-maps-utils by googlemaps.
the class KmlRenderer method addIconToMarkers.
/**
* Adds the marker icon stored in mMarkerIconCache, to the {@link com.google.android.gms.maps.model.Marker}
*
* @param iconUrl icon url of icon to add to markers
* @param placemarks
*/
private void addIconToMarkers(String iconUrl, HashMap<KmlPlacemark, Object> placemarks) {
for (Feature placemark : placemarks.keySet()) {
KmlStyle urlStyle = getStylesRenderer().get(placemark.getId());
KmlStyle inlineStyle = ((KmlPlacemark) placemark).getInlineStyle();
if ("Point".equals(placemark.getGeometry().getGeometryType())) {
boolean isInlineStyleIcon = inlineStyle != null && iconUrl.equals(inlineStyle.getIconUrl());
boolean isPlacemarkStyleIcon = urlStyle != null && iconUrl.equals(urlStyle.getIconUrl());
if (isInlineStyleIcon) {
scaleBitmap(inlineStyle, placemarks, (KmlPlacemark) placemark);
} else if (isPlacemarkStyleIcon) {
scaleBitmap(urlStyle, placemarks, (KmlPlacemark) placemark);
}
}
}
}
use of com.google.maps.android.data.Feature in project android-maps-utils by googlemaps.
the class GeoJsonLayerTest method testRemoveFeature.
public void testRemoveFeature() throws Exception {
int featureCount = 0;
for (Feature ignored : mLayer.getFeatures()) {
featureCount++;
}
assertEquals(3, featureCount);
}
use of com.google.maps.android.data.Feature in project android-maps-utils by googlemaps.
the class GeoJsonRenderer method removeLayerFromMap.
/**
* Removes all GeoJsonFeature objects stored in the mFeatures hashmap from the map
*/
public void removeLayerFromMap() {
if (isLayerOnMap()) {
for (Feature feature : super.getFeatures()) {
removeFromMap(super.getAllFeatures().get(feature));
feature.deleteObserver(this);
}
setLayerVisibility(false);
}
}
use of com.google.maps.android.data.Feature in project android-maps-utils by googlemaps.
the class KmlRenderer method addContainerObjectToMap.
/**
* Goes through the every placemark, style and properties object within a <Folder> tag
*
* @param kmlContainer Folder to obtain placemark and styles from
*/
private void addContainerObjectToMap(KmlContainer kmlContainer, boolean isContainerVisible) {
for (Feature placemark : kmlContainer.getPlacemarks()) {
boolean isPlacemarkVisible = getPlacemarkVisibility(placemark);
boolean isObjectVisible = isContainerVisible && isPlacemarkVisible;
if (placemark.getGeometry() != null) {
String placemarkId = placemark.getId();
Geometry geometry = placemark.getGeometry();
KmlStyle style = getPlacemarkStyle(placemarkId);
KmlStyle inlineStyle = ((KmlPlacemark) placemark).getInlineStyle();
Object mapObject = addKmlPlacemarkToMap((KmlPlacemark) placemark, geometry, style, inlineStyle, isObjectVisible);
kmlContainer.setPlacemark((KmlPlacemark) placemark, mapObject);
putContainerFeature(mapObject, placemark);
}
}
}
use of com.google.maps.android.data.Feature in project android-maps-utils by googlemaps.
the class GeoJsonLayerTest method testAddFeature.
public void testAddFeature() throws Exception {
int featureCount = 0;
mLayer.addFeature(new GeoJsonFeature(null, null, null, null));
for (Feature ignored : mLayer.getFeatures()) {
featureCount++;
}
assertEquals(4, featureCount);
}