Shape class
A helper class that wraps a Geometry or Feature and makes it easy to update and maintain.
- Extends
Constructors
Shape(atlas. |
Constructs a Shape object and initializes it with the specified Geometry, ID, and properties. |
Shape(Feature<atlas. |
Constructs a Shape object and initializes it with the specified Feature. |
Methods
add |
Adds or updates an existing property value in the shape. |
get |
Gets the bounding box of the shape |
get |
If the shape is a circle, this gets its coordinates. Otherwise returns null. |
get |
Gets the coordinates of the shape. |
get |
Gets the id of the shape. |
get |
Gets the properties of the shape. |
get |
Returns a string indicating the type of geometry this shape contains. |
is |
Indicates if the contained shape is a Circle, defined by the extended GeoJSON specification supported by Azure Maps. Extended Spec |
is |
Indicates if the contained shape is a Rectangle, defined by the extended GeoJSON specification supported by Azure Maps. Extended Spec |
set |
Updates the coordinates of the shape |
set |
Sets the properties on the shape. Overwrites all existing properties. |
to |
Returns a GeoJSON feature that represents the shape. |
Constructor Details
Shape(atlas.data.Geometry, string | number, any)
Constructs a Shape object and initializes it with the specified Geometry, ID, and properties.
new Shape(data: atlas.data.Geometry, id?: string | number, properties?: any)
Parameters
- data
- Geometry
a Geometry object
- id
-
string | number
a unique id that the user assigns to the shape. If not provided, a unique id value will be assigned to it.
- properties
-
any
User defined properties for the shape.
Shape(Feature<atlas.data.Geometry, any>)
Constructs a Shape object and initializes it with the specified Feature.
new Shape(data: Feature<atlas.data.Geometry, any>)
Parameters
Method Details
addProperty(string, any)
Adds or updates an existing property value in the shape.
function addProperty(key: string, value: any)
Parameters
- key
-
string
- value
-
any
getBounds()
getCircleCoordinates()
If the shape is a circle, this gets its coordinates. Otherwise returns null.
function getCircleCoordinates(): Position[]
Returns
Position[]
getCoordinates()
Gets the coordinates of the shape.
function getCoordinates(): Position | Position[] | Position[][] | Position[][][]
Returns
getId()
Gets the id of the shape.
function getId(): string | number
Returns
string | number
getProperties()
Gets the properties of the shape.
function getProperties(): any
Returns
any
getType()
Returns a string indicating the type of geometry this shape contains.
function getType(): string
Returns
string
isCircle()
Indicates if the contained shape is a Circle, defined by the extended GeoJSON specification supported by Azure Maps. Extended Spec
function isCircle(): boolean
Returns
boolean
isRectangle()
Indicates if the contained shape is a Rectangle, defined by the extended GeoJSON specification supported by Azure Maps. Extended Spec
function isRectangle(): boolean
Returns
boolean
setCoordinates(Position | Position[] | Position[][] | Position[][][])
Updates the coordinates of the shape
function setCoordinates(coords: Position | Position[] | Position[][] | Position[][][])
Parameters
setProperties(any)
Sets the properties on the shape. Overwrites all existing properties.
function setProperties(properties: any)
Parameters
- properties
-
any