use of com.google.android.gms.maps.model.Marker in project Pokemap by omkarmoghe.
the class MapWrapperFragment method drawMarker.
private void drawMarker(LatLng position) {
if (mGoogleMap != null) {
Marker userSelectedPositionMarker = mGoogleMap.addMarker(new MarkerOptions().position(position).title(getString(R.string.position_picked)).icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.ic_my_location_white_24dp))).zIndex(MapHelper.LAYER_MY_SEARCH).anchor(0.5f, 0.5f));
userSelectedPositionMarkers.add(userSelectedPositionMarker);
} else {
showMapNotInitializedError();
}
}
use of com.google.android.gms.maps.model.Marker in project iosched by google.
the class MapFragment method setFloorElementsVisible.
/**
* Change the visibility of all Markers and TileOverlays for a floor.
*/
private void setFloorElementsVisible(int floor, boolean visible) {
// Overlays
final TileOverlay overlay = mTileOverlays.get(floor);
if (overlay != null) {
overlay.setVisible(visible);
}
// Markers
final ArrayList<Marker> markers = mMarkersFloor.get(floor);
if (markers != null) {
for (Marker m : markers) {
m.setVisible(visible);
}
}
}
use of com.google.android.gms.maps.model.Marker in project android-maps-utils by googlemaps.
the class KmlRenderer method scaleBitmap.
/**
* Enlarges or shrinks a bitmap image based on the scale provided
* @param style Style to retrieve iconUrl and scale from
* @param placemarks
* @param placemark Placemark object to set the image to
*/
private void scaleBitmap(KmlStyle style, HashMap<KmlPlacemark, Object> placemarks, KmlPlacemark placemark) {
double bitmapScale = style.getIconScale();
String bitmapUrl = style.getIconUrl();
Bitmap bitmapImage = getImagesCache().get(bitmapUrl);
BitmapDescriptor scaledBitmap = scaleIcon(bitmapImage, bitmapScale);
((Marker) placemarks.get(placemark)).setIcon(scaledBitmap);
}
use of com.google.android.gms.maps.model.Marker in project iosched by google.
the class MapFragment method onMarkersLoaded.
private void onMarkersLoaded(List<MarkerLoadingTask.MarkerEntry> list) {
if (list != null) {
for (MarkerLoadingTask.MarkerEntry entry : list) {
// Skip incomplete entries
if (entry.options == null || entry.model == null) {
break;
}
// Add marker to the map
Marker m = mMap.addMarker(entry.options);
MarkerModel model = entry.model;
model.marker = m;
// Store the marker and its model
ArrayList<Marker> markerList = mMarkersFloor.get(model.floor);
if (markerList == null) {
// Initialise the list of Markers for this floor
markerList = new ArrayList<>();
mMarkersFloor.put(model.floor, markerList);
}
markerList.add(m);
mMarkers.put(model.id, model);
}
}
enableMapElements();
}
use of com.google.android.gms.maps.model.Marker in project android-maps-utils by googlemaps.
the class Layer method setOnFeatureClickListener.
/**
* Sets a single click listener for the entire GoogleMap object, that will be called
* with the corresponding Feature object when an object on the map (Polygon,
* Marker, Polyline) is clicked.
*
* If getFeature() returns null this means that either the object is inside a KMLContainer,
* or the object is a MultiPolygon, MultiLineString or MultiPoint and must
* be handled differently.
*
* @param listener Listener providing the onFeatureClick method to call.
*/
public void setOnFeatureClickListener(final OnFeatureClickListener listener) {
GoogleMap map = getMap();
map.setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() {
@Override
public void onPolygonClick(Polygon polygon) {
if (getFeature(polygon) != null) {
listener.onFeatureClick(getFeature(polygon));
} else if (getContainerFeature(polygon) != null) {
listener.onFeatureClick(getContainerFeature(polygon));
} else {
listener.onFeatureClick(getFeature(multiObjectHandler(polygon)));
}
}
});
map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker) {
if (getFeature(marker) != null) {
listener.onFeatureClick(getFeature(marker));
} else if (getContainerFeature(marker) != null) {
listener.onFeatureClick(getContainerFeature(marker));
} else {
listener.onFeatureClick(getFeature(multiObjectHandler(marker)));
}
return false;
}
});
map.setOnPolylineClickListener(new GoogleMap.OnPolylineClickListener() {
@Override
public void onPolylineClick(Polyline polyline) {
if (getFeature(polyline) != null) {
listener.onFeatureClick(getFeature(polyline));
} else if (getContainerFeature(polyline) != null) {
listener.onFeatureClick(getContainerFeature(polyline));
} else {
listener.onFeatureClick(getFeature(multiObjectHandler(polyline)));
}
}
});
}
Aggregations