Namespace GEarthExtensions#util
Defined in: extensions.js.
Constructor Attributes | Constructor Name and Description |
---|---|
This class/namespace hybrid contains miscellaneous
utility functions and shortcuts for the Earth API.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
GEarthExtensions#util.batchExecute(batchFn, context)
Executes the given function quickly using a Google Earth API callback
hack.
|
<static> |
GEarthExtensions#util.blendColors(color1, color2, fraction)
Calculates a simple composite of the two given colors.
|
<static> |
GEarthExtensions#util.clearAllJsData(object)
Clears all JS-side data for the given KmlObject.
|
<static> |
GEarthExtensions#util.clearJsDataValue(object, key)
Clears the JS-side data for the given KmlObject associated with the given
key.
|
<static> |
GEarthExtensions#util.decodeArray(str)
Decodes a string representing an array of signed numbers encoded with
GEarthExtensions#util.encodeArray.
|
<static> |
GEarthExtensions#util.displayKml(url, options)
Loads and shows the given KML URL in the Google Earth Plugin instance.
|
<static> |
GEarthExtensions#util.displayKmlString(str, options)
Loads and shows the given KML string in the Google Earth Plugin instance.
|
<static> |
GEarthExtensions#util.encodeArray(arr)
Encodes an array of signed numbers into a string.
|
<static> |
GEarthExtensions#util.flyToObject(obj, options)
Flies to an object; if the object is a feature and has an explicitly defined
abstract view, that view is used.
|
<static> |
GEarthExtensions#util.getCamera(altitudeMode)
Gets the current view as a KmlCamera.
|
<static> |
GEarthExtensions#util.getJsDataValue(object, key)
Gets the JS-side data for the given KmlObject associated with the given
key.
|
<static> |
GEarthExtensions#util.getLookAt(altitudeMode)
Gets the current view as a KmlLookAt.
|
<static> |
GEarthExtensions#util.hasJsData(object)
Returns whether or not the KmlObject has any JS-side data.
|
<static> |
GEarthExtensions#util.lookAt()
Creates a KmlLookAt and sets it as the Earth plugin's view.
|
<static> |
GEarthExtensions#util.parseColor(color, opacity)
Converts between various color formats, i.e.
|
<static> |
GEarthExtensions#util.setJsDataValue(object, key, value)
Sets the JS-side data for the given KmlObject associated with the given
key to the passed in value.
|
<static> |
GEarthExtensions#util.takeOverCamera(enable)
Enables or disables full camera ownership mode, which sets fly to speed
to teleport, disables user mouse interaction, and hides the navigation
controls.
|
Namespace Detail
GEarthExtensions#util
This class/namespace hybrid contains miscellaneous
utility functions and shortcuts for the Earth API.
Method Detail
<static>
GEarthExtensions#util.batchExecute(batchFn, context)
Executes the given function quickly using a Google Earth API callback
hack. Future versions of this method may use other methods for batch
execution.
- Parameters:
- {Function} batchFn
- The function containing batch code to execute.
- {Object} context Optional
- Optional context parameter to pass to the function.
<static>
{String}
GEarthExtensions#util.blendColors(color1, color2, fraction)
Calculates a simple composite of the two given colors.
- Parameters:
- {String|Number[]} color1
- The first ('source') color. Anthing that can be parsed with GEarthExtensions#util.parseColor.
- {String|Number[]} color2
- The second ('destination') color. Anything that can be parsed with GEarthExtensions#util.parseColor.
- {Number} fraction Optional, Default: 0.5
- The amount of color2 to composite onto/blend with color1, as a fraction from 0.0 to 1.0.
<static>
GEarthExtensions#util.clearAllJsData(object)
Clears all JS-side data for the given KmlObject.
- Parameters:
- {KmlObject} object
- The plugin object to clear data on.
<static>
GEarthExtensions#util.clearJsDataValue(object, key)
Clears the JS-side data for the given KmlObject associated with the given
key.
- Parameters:
- {KmlObject} object
- The plugin object to clear data on.
- {String} key
- The JS data key whose value should be cleared.
<static>
{Number[]}
GEarthExtensions#util.decodeArray(str)
Decodes a string representing an array of signed numbers encoded with
GEarthExtensions#util.encodeArray.
- Parameters:
- {String} str
- The encoded string.
<static>
GEarthExtensions#util.displayKml(url, options)
Loads and shows the given KML URL in the Google Earth Plugin instance.
- Parameters:
- {String} url
- The URL of the KML content to show.
- {Object} options Optional
- KML display options.
- {Boolean} options.cacheBuster Optional, Default: false
- Enforce freshly downloading the KML by introducing a cache-busting query parameter.
- {Boolean} options.flyToView Optional, Default: false
- Fly to the document-level abstract view in the loaded KML after loading it. If no explicit view is available, a default bounds view will be calculated and used unless options.flyToBoundsFallback is false. See GEarthExtensions#util.flyToObject for more information.
- {Boolean} options.flyToBoundsFallback Optional, Default: true
- If options.flyToView is true and no document-level abstract view is explicitly defined, calculate and fly to a bounds view.
<static>
GEarthExtensions#util.displayKmlString(str, options)
Loads and shows the given KML string in the Google Earth Plugin instance.
- Parameters:
- {String} str
- The KML string to show.
- {Object} options Optional
- KML display options.
- {Boolean} options.flyToView Optional, Default: false
- Fly to the document-level abstract view in the parsed KML. If no explicit view is available, a default bounds view will be calculated and used unless options.flyToBoundsFallback is false. See GEarthExtensions#util.flyToObject for more information.
- {Boolean} options.flyToBoundsFallback Optional, Default: true
- If options.flyToView is true and no document-level abstract view is explicitly defined, calculate and fly to a bounds view.
- Returns:
- Returns the parsed object on success, or null if there was an error.
<static>
{String}
GEarthExtensions#util.encodeArray(arr)
Encodes an array of signed numbers into a string.
- Parameters:
- {Number[]} arr
- An array of signed numbers.
- Returns:
- An encoded string representing the array of numbers.
<static>
GEarthExtensions#util.flyToObject(obj, options)
Flies to an object; if the object is a feature and has an explicitly defined
abstract view, that view is used. Otherwise, attempts to calculate a bounds
view of the object and flies to that (assuming options.boundsFallback is
true).
- Parameters:
- {KmlObject} obj
- The object to fly to.
- {Object} options Optional
- Flyto options.
- {Boolean} options.boundsFallback Optional, Default: true
- Whether or not to attempt to calculate a bounding box view of the object if it doesn't have an abstract view.
- {Number} options.aspectRatio Optional, Default: 1.0
- When calculating a bounding box view, this should be the current aspect ratio of the plugin window.
<static>
{KmlCamera}
GEarthExtensions#util.getCamera(altitudeMode)
Gets the current view as a KmlCamera.
- Parameters:
- {Number} altitudeMode Optional, Default: ALTITUDE_ABSOLUTE
- The altitude mode that the resulting camera should be in.
- Returns:
- Returns the current view as a KmlCamera.
<static>
GEarthExtensions#util.getJsDataValue(object, key)
Gets the JS-side data for the given KmlObject associated with the given
key.
- Parameters:
- {KmlObject} object
- The plugin object to get data for.
- {String} key
- The JS data key to request.
<static>
{KmlLookAt}
GEarthExtensions#util.getLookAt(altitudeMode)
Gets the current view as a KmlLookAt.
- Parameters:
- {Number} altitudeMode Optional, Default: ALTITUDE_ABSOLUTE
- The altitude mode that the resulting LookAt should be in.
- Returns:
- Returns the current view as a KmlLookAt.
<static>
GEarthExtensions#util.hasJsData(object)
Returns whether or not the KmlObject has any JS-side data.
- Parameters:
- {KmlObject} object
- The plugin object to inquire about.
<static>
GEarthExtensions#util.lookAt()
Creates a KmlLookAt and sets it as the Earth plugin's view. This function
takes the same parameters as GEarthExtensions#dom.buildLookAt.
<static>
{String}
GEarthExtensions#util.parseColor(color, opacity)
Converts between various color formats, i.e. `#rrggbb`, to the KML color
format (`aabbggrr`)
- Parameters:
- {String|Number[]} color
- The source color value.
- {Number} opacity Optional
- An optional opacity to go along with CSS/HTML style colors, from 0.0 to 1.0.
- Returns:
- {String} A string in KML color format (`aabbggrr`), or null if the color could not be parsed.
<static>
GEarthExtensions#util.setJsDataValue(object, key, value)
Sets the JS-side data for the given KmlObject associated with the given
key to the passed in value.
- Parameters:
- {KmlObject} object
- The object to get data for.
- {String} key
- The JS data key to set.
- {*} value
- The value to store for this key.
<static>
GEarthExtensions#util.takeOverCamera(enable)
Enables or disables full camera ownership mode, which sets fly to speed
to teleport, disables user mouse interaction, and hides the navigation
controls.
- Parameters:
- {Boolean} enable
- Whether to enable or disable full camera ownership.