Nokia Maps API Reference

Contents

Class nokia.maps.geo.Shape

Class Summary

This class represents an observable geographic shape (derived from nokia.maps.geo.Strip) with a geometry contained in a geographic quadtree and allows testing for containment, square-based clipping and near-by analysis.

new nokia.maps.geo.Shape ([closed, [depth]])
Method Summary
add (coord, [idx]) This method adds a single element to the given Strip object.
addAll (coords, [idx, [mode]]) This method adds a collection of coordinates to the given Strip instance.
addAllAsync (coords, [idx, [mode, [callback]]]) This method adds a collection of coordinates to the given Strip instance asynchronously.
addObserver (callback, [context]) This mehtod register a new observer.
asArray () : Array[Number] This method retrieves all elements of the given strip object as an array of latitude, longitude, altitude.
destroy () This method clean up itself and stopping all asynchronous code.
static fromLatLngArray (arr, closed, [callback, [ctx]]) : nokia.maps.geo.Shape This method creates a shape from an array containing latitude and longitude (in decimal degrees) for all the points that are to define the shape.
get (idx) : nokia.maps.geo.Coordinate This method retrieves an strip element at the specified index.
getLatLng (idx, [count]) : Number[] This method retrieves latitudes and longitudes from strip elements, starting at the caller-specified index.
getLength () : Number This method retrieves the number of elements held in the given strip object.
remove (idx) This method removes a single element at a specified index in the strip.
removeObserver (callback, context) : nokia.maps.util.OObject This mehtod unregisters an observer.
set (idx, coord) This method sets a single object containing geo coordinates of a location at the specified index in the given strip object.
splice (idx, remove, [coords, [mode]]) This method splices a collection of coordinates into the given Strip instance.
Constructor Detail

This method initializes a new instance of Shape.

new nokia.maps.geo.Shape([closed, [depth]])
Parameters:
{Boolean} [closed]: false Indicates if the shape is a polygon (true) or a polyline (false).
{Number} [depth]: 10 Specifies the depth of the underlying quad tree.
Method Detail
destroy ()
This method clean up itself and stopping all asynchronous code. It is allways better to call this method when instance is not needed instead of throwing away instance reference only.
static fromLatLngArray (arr, closed, [callback, [ctx]]) : nokia.maps.geo.Shape
This method creates a shape from an array containing latitude and longitude (in decimal degrees) for all the points that are to define the shape. The method executes synchronously or asynchronously, depending on whether the caller provides a callback function as one of the arguments.
Parameters:
{Number[]} arr An array with latitude/longitude coordinates in decimal degrees
{Boolean} closed A flag indicating if the shape is closed (true) or not (false)
{Function} [callback]: A caller-defined callback function; if provided, the method runs asynchronously and calls the callback as soon as it is finished; this is done for large coordinate arrays; The callback receives the generated shape instance and the supplied context as parameters
{Object} [ctx]: The context in which the callback function is to be called; if not provided, the callback is called in the context of the window
Returns:
{nokia.maps.geo.Shape} If the method is called synchronously (without a callback function) it returns the generated shape, otherwise it will returns null
Documentation generated on Wed Jun 27 2012 16:54:08 GMT+0200 (CEST).