Skip to content

Latest commit

 

History

History
207 lines (168 loc) · 6.54 KB

AnnotationPlugin.md

File metadata and controls

207 lines (168 loc) · 6.54 KB

Mappls Annotation Plugin

The Mappls Annotation Plugin simplifies the way to set and adjust the visual properties of annotations on a Mappls map.

This Plugin is uses to plot Symbol (marker), Line, Fill(Polygon) and circle on a Map.

Add the dependency

Add below dependency in your app-level build.gradle

implementation 'com.mappls.sdk:annotation-plugin:1.0.1'

Add your API keys to the SDK

Add your API keys to the SDK (in your application's onCreate() or before using map)

Java
MapplsAccountManager.getInstance().setRestAPIKey(getRestAPIKey());  	
MapplsAccountManager.getInstance().setMapSDKKey(getMapSDKKey());  		
MapplsAccountManager.getInstance().setAtlasClientId(getAtlasClientId());  	
MapplsAccountManager.getInstance().setAtlasClientSecret(getAtlasClientSecret());  	
Kotlin
MapplsAccountManager.getInstance().restAPIKey = getRestAPIKey()  	
MapplsAccountManager.getInstance().mapSDKKey = getMapSDKKey()  		
MapplsAccountManager.getInstance().atlasClientId = getAtlasClientId()  	
MapplsAccountManager.getInstance().atlasClientSecret = getAtlasClientSecret()	

Initialize the Annotation plugin

To initialise the plugin there are Four Manager classes:

  1. SymbolManager
  2. LineManager
  3. FillManager
  4. CircleManager

Initialize SymbolManager (Marker)

Java
 symbolManager = new SymbolManager(mapView, mapplsMap, style); //For Marker
Kotlin
 symbolManager = SymbolManager(mapView, mapplsMap, style); //For Marker

Initialize Linemanager (Polyline)

Java
lineManager = new LineManager(mapView, mapplsMap, style); // For Polyline
Kotlin
 lineManager = LineManager(mapView, mapplsMap, style); // For Polyline

Initialise FillManager (Polygon)

Java
 fillManager = new FillManager(mapView, mapplsMap, style); // For Polygon
Kotlin
 fillManager = FillManager(mapView, mapplsMap, style); // For Polygon

Initialize CircleManager (Circle)

Java
 circleManager = new CircleManager(mapView, mapplsMap, style); //For Cirle
Kotlin
 circleManager = CircleManager(mapView, mapplsMap, style); //For Cirle

Add Annotations

Add a Marker (Symbol)

Use SymbolOptions to add the marker:

Java
//Add Custom Image
style.addImage("map-marker-image", bitmap);
 
 // Create a symbol at the specified location.
SymbolOptions symbolOptions = new SymbolOptions()
	.position(latLng)
	.icon("map-marker-image")
 
// Use the manager to draw the symbol.
symbol = symbolManager.create(symbolOptions);
Kotlin
//Add Custom Image
style.addImage("map-marker-image", bitmap);
 
// Create a symbol at the specified location.
val symbolOptions = SymbolOptions()
	.position(latLng)
	.icon("map-marker-image")
 
// Use the manager to draw the symbol.
symbol = symbolManager?.create(symbolOptions)

Add a Polyline (Line)

Use LineOptions to add the Polyline

Java
// Use options to color it red.
LineOptions lineOptions = new LineOptions()
    .points(polyline)
    .lineColor("#D81B60")
    .lineWidth(1.0f);
 
// Use the manager to draw the annotation.
lineManager.create(lineOptions);
Kotlin
// Use options to color it red.
val lineOptions = LineOptions()
                .points(polyline)
                .lineColor("#D81B60")
                .lineWidth(1.0f)
                
// Use the manager to draw the annotation.
lineManager?.create(lineOptions)

Add a Polygon (Fill)

Use FillOptions to add the Polygon

Java
// Use options to color it red.
FillOptions fillOptions = new FillOptions()
    .points(polygon)
    .fillColor("#D81B60");
 
// Use the manager to draw the annotation.
fillManager.create(fillOptions);
Kotlin
// Use options to color it red.
val fillOptions = FillOptions()
                .points(polygon)
                .fillColor("#D81B60")

fillManager?.create(fillOptions)

Add a Circle

Use CircleOptions to add the Circle

Java
// Use options to color it red.
CirlceOptions circleOptions = new CircleOptions()
    .position(centerPoint)
    .radius(5.0f)
    .circleColor("#D81B60");
 
// Use the manager to draw the annotation.
cirlceManager.create(circleOptions);
Kotlin
// Use options to color it red.
val circleOptions = CircleOptions()
    .position(centerPoint)
    .radius(5.0f)
    .circleColor("#D81B60")

cirlceManager?.create(circleOptions)




For any queries and support, please contact:

Email us at apisupport@mappls.com

Support Need support? contact us!





@ Copyright 2024 CE Info Systems Ltd. All Rights Reserved.