Class: CircleTool

OM.tool. CircleTool


new CircleTool(map)

This is a subclass of OM.tool.Tool that allows the user to draw a circle
on the map.

Parameters:
Name Type Description
map OM.Map

A map object

Returns:

An instance of OM.tool.CircleTool

Type
OM.tool.CircleTool

Extends

Methods


clear()

Clears the tool's generated shapes and restores its state to that at initialization.

Returns:
Type
void

getCenter()

Get the center point of the circle geometry created by this tool.

Returns:

The center point.

Type
OM.geometry.Point

getGeometry()

Get the generated geometry. This should typically be called from
inside an event listener that is registered to the tool's life cycle
event such as OM.event.ToolEvent.TOOL_END.

Inherited From:
Returns:

the geometry created by the tool

Type
OM.geometry.Geometry

getRadius(unit, callBack)

This method returns the proximate radius of the circle in the specified unit.

Parameters:
Name Type Description
unit

a string that specifies the name of the distance unit. It is required. It could be meter or kilometer.

callBack

a callback function that deals with the radius if the client cannot deal with the computation.
callBack is a function look like :
function callBack(finalResult) ;
client support local getlength for srid: 3857,8307, 8265, 4326, 4269)

Returns:

Radius of the circle

Type
float

getStatus()

Get the tool's status. Can be one of OM.tool.Tool.STARTED, OM.tool.Tool.STOPPED, or OM.tool.Tool.FINISHED

Inherited From:
Returns:

tool status

Type
int

on()

A shorthand name for the member function addListener.

Inherited From:
Mixes In:

setDrawingStyle(style)

Set the line drawing style

Parameters:
Name Type Description
style OM.style.Line

A line style used to
display the shape boundary as the user is drawing it.

Inherited From:
Returns:

The tool instance

Type
OM.tool.Tool

setStyle(style)

Set rendering style for the completed feature

Parameters:
Name Type Description
style OM.Style

The style to be used for the completed shape

Inherited From:
Returns:

The tool instance

Type
OM.tool.Tool

setZeroSizeAllowed(flag)

Sets whether this tool allows creation of zero-sized rectangles.
Default is disabled with a warning in console log.
Note: currently, it applies only to RectangleTool and CircleTool

Parameters:
Name Type Description
flag boolean

if true then zero-sized rectangles are allowed;
false otherwise.

Inherited From:

start()

The start method activates this tool. Once a tool is started, the user
can hold down and drag the mouse to create a shape, in this case a circle.

Returns:

The tool itself

Type
OM.tool.CircleTool