Namespace TimeMap.util
- Defined in:
- timemap.js
Namespace for TimeMap utility functions.
Static Fields
| Field | |
|---|---|
|
TimeMap.util.nsMap
Empty container for mapping XML namespaces to URLs
|
Static Methods
| Method | |
|---|---|
|
TimeMap.util.formatDate(d, precision)
Format a date as an ISO 8601 string
|
|
|
TimeMap.util.getNodeList(n, tag, ns)
Cross-browser implementation of getElementsByTagNameNS.
|
|
|
TimeMap.util.getPlacemarkType(pm)
Identify the placemark type.
|
|
|
TimeMap.util.getTagValue(n, tag, ns)
Get XML tag value as a string
|
|
|
TimeMap.util.isArray(o)
Convenience array tester
|
|
|
TimeMap.util.lookup(key, map)
Attempt look up a key in an object, returning either the value,
undefined if the key is a string but not found, or the key if not a string
|
|
|
TimeMap.util.makePoint(coords, reversed)
Make TimeMap.init()-style points from a GLatLng, array, or string
|
|
|
TimeMap.util.makePoly(coords, reversed)
Make TimeMap.init()-style polyline/polygons from a whitespace-delimited
string of coordinates (such as those in GeoRSS and KML).
|
|
|
TimeMap.util.merge(obj1, objN)
Merge two or more objects, giving precendence to those
first in the list (i.e.
|
|
|
TimeMap.util.revHash(map, val)
Util function: get the key from the map if the value is found
|
|
|
TimeMap.util.TimelineVersion()
Determine the SIMILE Timeline version.
|
|
|
TimeMap.util.trim(str)
Convenience trim function
|
Static Field Details
TimeMap.util.nsMap
Empty container for mapping XML namespaces to URLs
TimeMap.util.nsMap['georss'] = 'http://www.georss.org/georss'; // find georss:point TimeMap.util.getNodeList(node, 'point', 'georss')
Static Method Details
TimeMap.util.formatDate(d, precision)
:{String}
Format a date as an ISO 8601 string
| Parameters (optional) | ||
|---|---|---|
| d | {Date} | Date to format |
| precision | {Number} |
Precision indicator:
3 (default): Show full date and time
2: Show full date and time, omitting seconds
1: Show date only
|
- Returns:
- {String} Formatted string
TimeMap.util.getNodeList(n, tag, ns)
:{XML Node List}
Cross-browser implementation of getElementsByTagNameNS.
Note: Expects any applicable namespaces to be mapped in
TimeMap.util.nsMap.
| Parameters (optional) | ||
|---|---|---|
| n | {XML Node} | Node in which to look for tag |
| tag | {String} | Name of tag to look for |
| ns | {String} | XML namespace to look in |
- Returns:
- {XML Node List} List of nodes with the specified tag name
TimeMap.util.getPlacemarkType(pm)
:{String}
Identify the placemark type.
XXX: Not 100% happy with this implementation, which relies heavily on duck-typing.
| Parameters (optional) | ||
|---|---|---|
| pm | {Object} | Placemark to identify |
- Returns:
- {String} Type of placemark, or false if none found
TimeMap.util.getTagValue(n, tag, ns)
:{String}
Get XML tag value as a string
| Parameters (optional) | ||
|---|---|---|
| n | {XML Node} | Node in which to look for tag |
| tag | {String} | Name of tag to look for |
| ns | {String} | XML namespace to look in |
- Returns:
- {String} Tag value as string
TimeMap.util.isArray(o)
:{Boolean}
Convenience array tester
| Parameters (optional) | ||
|---|---|---|
| o | {Object} | Object to test |
- Returns:
- {Boolean} Whether the object is an array
TimeMap.util.lookup(key, map)
:{Object}
Attempt look up a key in an object, returning either the value,
undefined if the key is a string but not found, or the key if not a string
| Parameters (optional) | ||
|---|---|---|
| key | {String|Object} | Key to look up |
| map | {Object} | Object in which to look |
- Returns:
- {Object} Value, undefined, or key
TimeMap.util.makePoint(coords, reversed)
:{Object}
Make TimeMap.init()-style points from a GLatLng, array, or string
| Parameters (optional) | ||
|---|---|---|
| coords | {Object} | GLatLng, array, or string to convert |
| reversed | {Boolean} | Whether the points are KML-style lon/lat, rather than lat/lon |
- Returns:
- {Object} TimeMap.init()-style point
TimeMap.util.makePoly(coords, reversed)
:{Object}
Make TimeMap.init()-style polyline/polygons from a whitespace-delimited
string of coordinates (such as those in GeoRSS and KML).
| Parameters (optional) | ||
|---|---|---|
| coords | {Object} | String to convert |
| reversed | {Boolean} | Whether the points are KML-style lon/lat, rather than lat/lon |
- Returns:
- {Object} Formated coordinate array
TimeMap.util.merge(obj1, objN)
:{Object}
Merge two or more objects, giving precendence to those
first in the list (i.e. don't overwrite existing keys).
Original objects will not be modified.
| Parameters (optional) | ||
|---|---|---|
| obj1 | {Object} | Base object |
| objN | {Object} | Objects to merge into base |
- Returns:
- {Object} Merged object
TimeMap.util.revHash(map, val)
:{String}
Util function: get the key from the map if the value is found
| Parameters (optional) | ||
|---|---|---|
| map | {Object} | Object to search |
| val | {?} | Value to look for |
- Returns:
- {String} Key if found, null if not
- Defined in:
- export.js
TimeMap.util.TimelineVersion()
:{String}
Determine the SIMILE Timeline version.
- Returns:
- {String} At the moment, only "1.2", "2.2.0", or what Timeline provides
TimeMap.util.trim(str)
:{String}
Convenience trim function
| Parameters (optional) | ||
|---|---|---|
| str | {String} | String to trim |
- Returns:
- {String} Trimmed string
©2010 Nick Rabinowitz
Documentation generated by JsDoc Toolkit 2.3.2 on Thu Jun 24 2010 13:58:03 GMT-0700 (PDT)
Documentation generated by JsDoc Toolkit 2.3.2 on Thu Jun 24 2010 13:58:03 GMT-0700 (PDT)