Search in sources :

Example 1 with SimpleMarkerSymbol

use of com.esri.core.symbol.SimpleMarkerSymbol in project android-gps-test-tool by Esri.

the class GPSTesterActivityController method addGraphicLatLon.

/**
	 * Helper method that uses latitude/longitude points to programmatically 
	 * draw a <code>SimpleMarkerSymbol</code> and adds the <code>Graphic</code> to map.
	 * @param latitude
	 * @param longitude
	 * @param attributes
	 * @param style You defined the style via the Enum <code>SimpleMarkerSymbol.STYLE</code>
	 */
public static void addGraphicLatLon(double latitude, double longitude, Map<String, Object> attributes, SimpleMarkerSymbol.STYLE style, int color, int size, GraphicsLayer graphicsLayer, MapView map) {
    Point latlon = new Point(longitude, latitude);
    //Convert latlon Point to mercator map point.
    Point point = (Point) GeometryEngine.project(latlon, SpatialReference.create(4326), map.getSpatialReference());
    //Set market's color, size and style. You can customize these as you see fit
    SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(color, size, style);
    Graphic graphic = new Graphic(point, symbol, attributes);
    graphicsLayer.addGraphic(graphic);
}
Also used : SimpleMarkerSymbol(com.esri.core.symbol.SimpleMarkerSymbol) Graphic(com.esri.core.map.Graphic) Point(com.esri.core.geometry.Point)

Aggregations

Point (com.esri.core.geometry.Point)1 Graphic (com.esri.core.map.Graphic)1 SimpleMarkerSymbol (com.esri.core.symbol.SimpleMarkerSymbol)1