public interface

Map

com.neomades.maps.Map

Class Overview

The main class of the Maps API and the entry point for all methods related to the map. You cannot instantiate a Map object directly, rather, you must obtain one from the getMap() method on a MapView that you have added to your application.

Note: Similar to a View object, a Map can only be read and modified from the main thread. Calling Map methods from another thread will result in an exception.

Summary

Public Methods
abstract Map add(Overlay overlay)
Adds an overlay to this map.
abstract Map add(Marker marker)
Adds a marker to this map.
abstract void clear()
Removes all markers, polylines, polygons, overlays, etc from the map.
abstract Point convertLocationToPoint(Location location)
Returns a screen location that corresponds to a geographical coordinate (Location).
abstract Location convertPointToLocation(Point point)
Returns the geographic location that corresponds to a screen location.
abstract MapCamera getCamera()
abstract MapSettings getMapSettings()
abstract Location getMyLocation()
Returns the currently displayed user location, or null if there is no location data available.
abstract void setInfoWindowClickListener(InfoWindowClickListener listener)
Sets a callback that is invoked when the info window of a marker is clicked.
abstract void setMapListener(MapListener listener)
Sets a callback that is invoked when this map has finished rendering.
abstract void setMarkerClickListener(MarkerClickListener listener)
Sets a callback that is invoked when a marker is clicked.
abstract void setMarkerDragListener(MarkerDragListener listener)
Sets a callback that is invoked when a marker is dragged.
abstract void setMyLocationChangeListener(MyLocationClickListener listener)
Sets a callback that is invoked when the my location button is clicked.
abstract void setOnMapClickListener(OnMapClickListener listener)
Sets a callback that is invoked when the map is clicked.

Public Methods

public abstract Map add (Overlay overlay)

Adds an overlay to this map.

Parameters
overlay An overlay (circle, polyline, polygone, etc) that defines how to render the overlay.
Returns
  • this current map

public abstract Map add (Marker marker)

Adds a marker to this map.

The marker's icon is rendered on the map at the location Marker.position. Clicking the marker centers the camera on the marker. If Marker.title is defined, the map shows an info box with the marker's title and snippet. If the marker is draggable, long-clicking and then dragging the marker moves it.

Cross Platform Considerations

In Android, two overlays with the default z-index are drawn in an arbitrary order (the add() order is not the z-index). The z-index specifies the stack order of each overlay, relative to other overlays.

Parameters
marker A marker object that defines how to render the marker.
Returns
  • this current map

public abstract void clear ()

Removes all markers, polylines, polygons, overlays, etc from the map.

public abstract Point convertLocationToPoint (Location location)

Returns a screen location that corresponds to a geographical coordinate (Location).

Parameters
location A Location on the map to convert to a screen location.
Returns
  • a screen location that corresponds to a geographical coordinate (Location)

public abstract Location convertPointToLocation (Point point)

Returns the geographic location that corresponds to a screen location. The screen location is specified in screen pixels (not display pixels) relative to the top left of the map (not the top left of the whole screen).

Parameters
point A Point on the screen in screen pixels.
Returns
  • the geographic location that corresponds to a screen location.

public abstract MapCamera getCamera ()

Returns
  • the camera controller

public abstract MapSettings getMapSettings ()

Returns
  • maps settings

public abstract Location getMyLocation ()

Returns the currently displayed user location, or null if there is no location data available.

Returns
  • The currently displayed user location.

public abstract void setInfoWindowClickListener (InfoWindowClickListener listener)

Sets a callback that is invoked when the info window of a marker is clicked.

Parameters
listener The callback that is invoked. To unset the callback, use null.

public abstract void setMapListener (MapListener listener)

Sets a callback that is invoked when this map has finished rendering.

The callback will only be invoked once. If this method is called when the map is fully rendered, the callback will be invoked immediately. This event will not fire if the map never loads due to connectivity issues, or if the map is continuously changing and never completes loading due to the user constantly interacting with the map.

Parameters
listener The callback that is invoked. To unset the callback, use null.

public abstract void setMarkerClickListener (MarkerClickListener listener)

Sets a callback that is invoked when a marker is clicked. This callback is not called if the info window of the marker is shown.

Parameters
listener The callback that is invoked. To unset the callback, use null.

public abstract void setMarkerDragListener (MarkerDragListener listener)

Sets a callback that is invoked when a marker is dragged.

Parameters
listener The callback that is invoked. To unset the callback, use null.

public abstract void setMyLocationChangeListener (MyLocationClickListener listener)

Sets a callback that is invoked when the my location button is clicked.

Parameters
listener The callback that is invoked. To unset the callback, use null.

public abstract void setOnMapClickListener (OnMapClickListener listener)

Sets a callback that is invoked when the map is clicked.

Parameters
listener The callback that is invoked. To unset the callback, use null.