public class

Circle

extends Overlay
java.lang.Object
   ↳ com.neomades.maps.overlay.BaseOverlay
     ↳ com.neomades.maps.overlay.Overlay
       ↳ com.neomades.maps.overlay.Circle

Class Overview

A circle on the earth's surface (spherical cap).

A circle has the following properties.

Center

The center of the Circle is specified as a Location.

Radius

The radius of the circle, specified in meters. It should be zero or greater.

Stroke Width

The width of the circle's outline in screen pixels. The width is constant and independent of the camera's zoom level. The default value is 10.

Stroke Color

The color of the circle outline in ARGB format, the same format used by Color. The default value is black (0xff000000).

Fill Color

The color of the circle fill in ARGB format, the same format used by Color. The default value is transparent (0x00000000).

Z-Index

The order in which this tile overlay is drawn with respect to other overlays. An overlay with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays with the same z-index is arbitrary. The default z-index is 0.

Visibility

Indicates if the circle is visible or invisible, i.e., whether it is drawn on the map. An invisible circle is not drawn, but retains all of its other properties. The default is true, i.e., visible.

Methods that modify a Circle must be called on the main thread. If not, an IllegalStateException will be thrown at runtime.

Example
 Map map;
 // ... get a map.
 // Add a circle in Sydney
 Circle circle = new Circle()
      .setCenter(new Location(-33.87365, 151.20689))
      .setRadius(10000)
      .setStrokeColor(Color.RED)
      .setFillColor(Color.BLUE));
 map.add(circle);
 
Note that the current map renderer is unable to draw the circle fill if the circle encompasses either the North or South pole. However, the outline will still be drawn correctly.

Summary

Public Constructors
Circle()
Creates a new Circle.
Public Methods
Location getCenter()
Returns the center as a Location.
Color getFillColor()
Returns the fill color.
double getRadius()
Returns the circle's radius, in meters.
Color getStrokeColor()
Returns the stroke color.
int getStrokeWidth()
Returns the stroke width.
int getZIndex()
Returns the z-index.
boolean isVisible()
Checks whether the circle is visible.
Circle setCenter(Location center)
Sets the center using a Location.
Circle setFillColor(Color color)
Sets the fill color.
Circle setRadius(double radius)
Sets the radius in meters.
Circle setStrokeColor(Color color)
Sets the stroke color.
Circle setStrokeWidth(int width)
Sets the stroke width.
Circle setVisible(boolean visible)
Sets the visibility.
Circle setZIndex(int zIndex)
Sets the z-index.
[Expand]
Inherited Methods
From class com.neomades.maps.overlay.Overlay
From class com.neomades.maps.overlay.BaseOverlay
From class java.lang.Object

Public Constructors

public Circle ()

Creates a new Circle.

Public Methods

public Location getCenter ()

Returns the center as a Location.

Returns
  • The geographic center as a Location.

public Color getFillColor ()

Returns the fill color.

Returns
  • The Fill color.

public double getRadius ()

Returns the circle's radius, in meters.

Returns
  • The radius in meters.

public Color getStrokeColor ()

Returns the stroke color.

Returns
  • The stroke color.

public int getStrokeWidth ()

Returns the stroke width.

Returns
  • The width in screen DP.

public int getZIndex ()

Returns the z-index.

Returns
  • The z-index value.

public boolean isVisible ()

Checks whether the circle is visible.

Returns
  • True if the circle is visible; false if it is invisible.

public Circle setCenter (Location center)

Sets the center using a Location.

The center must not be null. This method is mandatory because there is no default center.

Parameters
center The geographic center as a Location.
Returns
  • this current circle instance

public Circle setFillColor (Color color)

Sets the fill color.

The fill color is the color inside the circle, in the integer format specified by Color. If TRANSPARENT is used then no fill is drawn. By default the fill color is transparent (0x00000000).

Parameters
color Fill color
Returns
  • this current circle instance

public Circle setRadius (double radius)

Sets the radius in meters.

The radius must be zero or greater. The default radius is zero.

Parameters
radius radius in meters
Returns
  • this current circle instance

public Circle setStrokeColor (Color color)

Sets the stroke color.

The stroke color is the color of this circle's outline, in the integer format specified by Color. If TRANSPARENT is used then no outline is drawn. By default the stroke color is black (0xff000000).

Parameters
color stroke color
Returns
  • this current circle instance

public Circle setStrokeWidth (int width)

Sets the stroke width.

The stroke width is the width (in screen DP) of the circle's outline. It must be zero or greater. If it is zero then no outline is drawn. The default width is 10dp.

Returns
  • this current circle instance

public Circle setVisible (boolean visible)

Sets the visibility.

If this circle is not visible then it is not drawn, but all other state is preserved.

Parameters
visible false to make this circle invisible
Returns
  • this current circle instance

public Circle setZIndex (int zIndex)

Sets the z-index.

Overlays (such as circles) with higher z-indices are drawn above those with lower indices. By default the z-index is 0.

Parameters
zIndex z-index value
Returns
  • this current circle instance