Reputation: 1
hi i wanna draw a circle in map view ( my map is Neshan ) but i can't understand the documantion of https://platform.neshan.org/android-sdk/reference/1.0.0/doc/org/neshan/mapsdk/model/Circle.html if anyone draw circle with carto and linestyle can share this piece of code?
public void Draw_Circle() {
Color color=new Color(0x000000);
Circle circleOptions = new Circle(lastSectedLoc,radius,color,getLineStyle());
map.addCircle(circleOptions);
}
private LineStyle getLineStyle(){
LineStyleBuilder lineStCr = new LineStyleBuilder();
lineStCr.setColor(new Color((short) 2, (short) 119, (short) 189, (short)190));
lineStCr.setWidth(12f);
lineStCr.setStretchFactor(0f);
return lineStCr.buildStyle();
}
this is my code i tried to draw circle and it crash
Upvotes: 0
Views: 251
Reputation: 29
add this line in your app build.gradle
implementation group: 'com.vividsolutions', name: 'jts', version: '1.13'
Upvotes: 0
Reputation: 373
For drawing circle in android map view you can try this:
private void drawCircle(LatLng point) {
// Instantiating CircleOptions to draw a circle around the marker
CircleOptions circleOptions = new CircleOptions();
// Specifying the center of the circle
circleOptions.center(point);
// Radius of the circle
circleOptions.radius(100);
// Border color of the circle
circleOptions.strokeColor(Color.BLACK);
// Fill color of the circle
circleOptions.fillColor(0x30ff0000);
// Border width of the circle
circleOptions.strokeWidth(2);
// Adding the circle to the GoogleMap
mMap.addCircle(circleOptions);
}
For reference please refer : circle in maps
Upvotes: 1