Nokia Maps API Reference

Contents

Class nokia.maps.kml.ObservableNode

Class Summary

This class is used as a mixin in nokia.maps.kml.Feature and nokia.maps.kml.Geometry, and for asynchronous parsing of the XML document containing KML data. Sometimes KML nodes can be very large (for example, a folder node may contain 2000 placemarks). Synchronous parsing of such nodes can cause the "Script running slow..." alert to appear. Thus, nodes that by their nature and according to the KML OGC specification cannot contain too many child nodes are parsed synchronously (those nodes are called "leaf" nodes, for example <Point> in KML). All other intermediate nodes starting from the <kml> tag in an XML document are parsed asynchronously.

During parsing, for each KML node supported by the Maps API, its equivalent is created. For example, each Folder tag is found in a document, results in an instance of the nokia.maps.kml.Folder class, which is derived from this class, thus it has the ability to parse and create its child tags asynchronously. The parsing procedure starts by calling the load() method. Each instance of this class has state, whose value at instantiation is set to initial. When load() is called for a "leaf" node, its state is set to ready. The state of the parent node is set to ready when all its child nodes are ready. Thus, when the nokia.maps.kml.Document class instance representing the <kml> tag from XML has the state "ready", the entire XML document parsing has been completed.

The constructor initializes a new instance of the class using the arguments provided by the caller.

Method Summary
addObserver (key, callback, [context]) : nokia.maps.util.OObject This method registers an observer for the property named by the caller.
get (key) : Variant This method retrieves the value of the property with the name provided by the caller.
load (onReadyCallback, parentNode) This method recursively parses a node and all its child nodes.
remove (key) : nokia.maps.util.OObject This method removes the property with the name provided by the caller.
removeObserver (key, callback, context) : nokia.maps.util.OObject This method removes the observer for the property named by the caller.
set (nameOrObject, [value, [force]]) : nokia.maps.util.OObject This method sets property values, using the property names and values supplied by the caller.
Direct Inheritance
Constructor Detail

This class is used as a mixin in nokia.maps.kml.Feature and nokia.maps.kml.Geometry, and for asynchronous parsing of the XML document containing KML data. Sometimes KML nodes can be very large (for example, a folder node may contain 2000 placemarks). Synchronous parsing of such nodes can cause the "Script running slow..." alert to appear. Thus, nodes that by their nature and according to the KML OGC specification cannot contain too many child nodes are parsed synchronously (those nodes are called "leaf" nodes, for example <Point> in KML). All other intermediate nodes starting from the <kml> tag in an XML document are parsed asynchronously.

During parsing, for each KML node supported by the Maps API, its equivalent is created. For example, each Folder tag is found in a document, results in an instance of the nokia.maps.kml.Folder class, which is derived from this class, thus it has the ability to parse and create its child tags asynchronously. The parsing procedure starts by calling the load() method. Each instance of this class has state, whose value at instantiation is set to initial. When load() is called for a "leaf" node, its state is set to ready. The state of the parent node is set to ready when all its child nodes are ready. Thus, when the nokia.maps.kml.Document class instance representing the <kml> tag from XML has the state "ready", the entire XML document parsing has been completed.

The constructor initializes a new instance of the class using the arguments provided by the caller.

new nokia.maps.kml.ObservableNode(node)
Parameters:
{Node} node An XML node from the KML document to parse
Method Detail
load (onReadyCallback, parentNode)
This method recursively parses a node and all its child nodes. Parsing uses nokia.maps.util.Coroutine.
Parameters:
{Function} onReadyCallback A callback function which is called as soon as the node state is "ready"
{Node} parentNode Reference to the parent node
Documentation generated on Thu Feb 09 2012 12:59:03 GMT+0100 (CET).