Archived:Ovi Maps API - Getting the ID of Components attached to a map
m (Jasfox - Add Note.) |
hamishwillee
(Talk | contribs) m (Hamishwillee - Fix categories) |
||
| Line 1: | Line 1: | ||
| − | [[Category: | + | [[Category:Nokia Maps]][[Category:JavaScript]] |
| − | {{Note| | + | {{Note|'''Ovi Maps API has been superceded by the Nokia Maps API''' |
The Nokia Maps API v2 is the successor of the Ovi Maps API. The latest version of the API can be found [http://api.maps.nokia.com/ here].}} | The Nokia Maps API v2 is the successor of the Ovi Maps API. The latest version of the API can be found [http://api.maps.nokia.com/ here].}} | ||
{{ArticleMetaData | {{ArticleMetaData | ||
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] --> | |sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] --> | ||
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | |installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | ||
| − | |devices= | + | |devices= Google Chrome 11.0x, Mozilla Firefox 5.0 |
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) --> | |sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) --> | ||
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later --> | |platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later --> | ||
| Line 13: | Line 13: | ||
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. --> | |capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. --> | ||
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase --> | |keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase --> | ||
| − | |||
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese --> | |language= <!-- Language category code for non-English topics - e.g. Lang-Chinese --> | ||
|translated-by= <!-- [[User:XXXX]] --> | |translated-by= <!-- [[User:XXXX]] --> | ||
| Line 25: | Line 24: | ||
|author=[[User:Maveric]] | |author=[[User:Maveric]] | ||
}} | }} | ||
| − | |||
==Introduction== | ==Introduction== | ||
| Line 48: | Line 46: | ||
The API reference states: | The API reference states: | ||
| − | <code | + | <code javascript> |
| − | getId () : String | + | getId () : String // Returns a unique identifier of the Component. It is not allowed to add two Components with the same id to a map. |
| − | + | ||
| − | Returns a unique identifier of the Component. It is not allowed to add two Components with the same id to a map. | + | |
</code> | </code> | ||
| − | So, If previously created a component variable type of Copyright, the getId would return: | + | So, If previously created a component variable type of Copyright, the {{Icode|getId}} would return: |
| − | <code | + | <code javascript> |
result = component.getId() | result = component.getId() | ||
</code> | </code> | ||
| Line 66: | Line 62: | ||
The API reference states: | The API reference states: | ||
| − | <code | + | <code javascript> |
getVersion () : String | getVersion () : String | ||
</code> | </code> | ||
Revision as of 02:08, 13 August 2012
Article Metadata
Tested with
Article
Contents |
Introduction
Within the code, it maybe useful to find out what are the Components that currently are attached to a map display instance.
Prerequisites
Ovi Maps API supported web browser (basically any modern web browser)
The example assumes you have already added the Ovi Maps to your web page as explained in the previous article "Ovi Maps - add the map to any web page"
Important about Maps credentials
With Ovi Maps API you can start without having any credentials given, but you might face a performance gap. In order to get the full potential out of the offering, you must get the credentials that authenticate your application against the Services. Please read through the Location API.
For more information on how to obtain the credentials, please start with the Ovi Maps API Developers Guide section "Acquiring API credentials"
Implementation
The API reference states:
getId () : String // Returns a unique identifier of the Component. It is not allowed to add two Components with the same id to a map.
So, If previously created a component variable type of Copyright, the getId would return:
result = component.getId()
The result would have the value of string "Copyright".
It is also possible to query the component's version.
The API reference states:
getVersion () : String
Returns the version of the component. The version of the component in the format "major.minor.update.revision" where the values may be omitted from right to left. This scheme should be used to make version numbers comparable.
result = component.getVersion
For more on Ovi Maps API
Please check out the Ovi Maps API full documentation and API reference here:
Tested with
Google Chrome 11.0x Mozilla Firefox 5.0

