This is the top-level namespace of the Fusion library
Fusion | This is the top-level namespace of the Fusion library |
Constants | |
UNKNOWN | An unknown unit |
INCHES | Inch unit |
FEET | Feet unit |
YARDS | Yard unit |
MILES | Mile unit |
NAUTICALMILES | Nautical Mile unit |
MILLIMETERS | Millimeter unit |
CENTIMETERS | Centimeter unit |
METERS | Meter unit |
KILOMETERS | Kilometer unit |
DEGREES | Degree unit |
DECIMALDEGREES | Decimal Degree unit |
DMS | DMS unit |
PIXELS | Pixel unit |
Functions and Properties | |
initialize | Initialize the Fusion application. |
initializeLocale | Initialize the Strings hash with the requested locale. |
setLoadState | set the current initialization state of the application. |
loadQueuedScripts | load any scripts that have been queued for loading. |
queueScript | Insert a new script into the loading queue. |
scriptFailed | Called when a script fails to load for some reason. |
scriptLoaded | a script has loaded. |
checkLoadingScripts | check if scripts have loaded. |
loadConfig | asynchronously load the application definition. |
getConfigCB | the server has returned the application configuration file that contains enough information to bootstrap the application. |
serverSet | the server has returned the application configuration file that contains enough information to bootstrap the application. |
serverFailed | the application failed to load the application configuration file. |
ajaxRequest | convenience function to issue an {XmlHttpRequest} to the server relative to the Fusion installation. |
ajaxException | trap exceptions produced in handling an ajax response. |
getXmlAsJson | Convert XML to JSON using a server-side script for requests that aren’t available in JSON. |
parseJSON | Parses the given JSON string to a javascript object. |
trim | Utility function to trim a given string of any trailing whitespace |
xml2json | Callback method to convert the XHR response into an actual json object and triggers the call to the callback method |
getMapByName | return a map widget with the given name |
getMapById | return a map widget that is associated with the given DOM element by id. |
getMapByIndice | return the map widget at the given index if there are more than one map elements specified in the AppDef |
getWidgetById | return a reference to a widget by the id of the DOM Element that it was created in. |
getApplicationURL | returns the applicaiton’s absolute URL minus the filename.html part |
getFusionURL | returns the application’s absolute URL minus the filename.html part |
getConfigurationItem | returns individual elements out of the Fusion config.json file |
getScriptLanguage | Accessor to return the server-side script language |
getRedirectScript | Accessor to return the URL of the redirect script |
getBroker | Accessor to return the broker object (for MapGuide only). |
require | Marks a JavaScript file as required which puts it into the queue for loading during Fusion initialization. |
reportError | Triggers the <Fusion.Event.FUSION_ERROR> and passes along the error object to the callback functions registered for this event. |
unitFromName | returns index into the units array for the given unit name or abbreviation |
unitSystem | imperial, metric, degrees or device units |
unitName | Given a unit, this method returns the units name |
unitAbbr | Given a unit, this method returns the units abbreviation |
toMeter | Converts a length value from native units into meters. |
fromMeter | Converts a length value from meters into native units. |
convert | Converts a length value from one unit system into another. |
initUnits | initializes the meters per unit values when a new map is loaded. |
getClosestUnits | find the OpenLayers units identifier given the Fusion metersPerUnit value |
addWidgetStyleSheet | Dynamically load a CSS stylesheet. |
parseQueryString | An initialization time function to parse the application URL parameters and stores them in an array. |
getQueryParam | Returns the query parameter value for a given parameter name |
_scriptName | {String} Relative path of this script. |
_getScriptLocation | Return the path to this script for bootstrapping Fusion. |
createSessionId | Pre-create a session to avoid the 401 Unauthorized dialog |
initialize: function( options )
Initialize the Fusion application. This method must be called from the template’s onload method once all script files have been loaded. Applications can register for the event {<Fusion.Event.FUSION_INITIALIZED>} to carry out further application initialization when all the Fusion objects have been created and are available.
{String} applicationDefinitionURL: a URL or resource ID for an ApplicationDefinition file
{String} sessionId: a session id to start the application with. Normally, applications are started without a session id and create one. However, sometimes it is desirable to use an existing session.
options | {Object} Optional parameters |
initializeLocale: function( locale )
Initialize the Strings hash with the requested locale. This method simply extends the OpenLayers strings hash with strings specific to Fusion. Add strings to the files in fusion/text/[locale].json. This method can be called before Fusion.initialize if localized strings are required in the template initialization.
locale | {String} the locale value e.g. ‘en-CA’ or simply ‘en’ for English |
loadQueuedScripts: function()
load any scripts that have been queued for loading. As the scripts load, they are removed. When all queued scripts have been loaded, the load state is advanced. If any of the loaded scripts require other scripts (for inheritance), they will be queued and loaded before the load state is advanced.
queueScript: function( url )
Insert a new script into the loading queue. The URL should be relative to the Fusion base url. The script will not actually be loaded until Fusion.loadQueuedScripts is called.
url | {String} The url of the script. |
scriptLoaded: function( url )
a script has loaded. It is removed from the various tracking arrays. When all requested scripts have been loaded, we check to see if any scripts where required by the ones just loaded. If yes, then we Fusion.loadQueuedScripts again, otherwise we advance the load state.
url | {String} the url of the script that was loaded. |
ajaxRequest: function( scriptURL, options )
convenience function to issue an {XmlHttpRequest} to the server relative to the Fusion installation.
scriptURL | {String} the URL (relative to Fusion) to request |
options | {Object} optional parameters to send with the request, passed directly to the <OpenLayers Ajax.Request> function |
getXmlAsJson: function( url, callback )
Convert XML to JSON using a server-side script for requests that aren’t available in JSON.
url | {String} the URL of the XML object to be converted; this can be any URL and is not prepended with the Fusion URL |
callback | {Function} a callback function to be called if the request is successful |
boolean indicator if the content is JSON or not.
xml2json: function( callback, r, json )
Callback method to convert the XHR response into an actual json object and triggers the call to the callback method
callback | {Function} callback method to be executed on success and will be passed a parsed json object |
r | {XmlHttpRequest} the XmlHttpRequest object |
json | {Boolean} boolean indicator if the content is JSON or not (set by OpenLayers) |
getMapByName: function( name )
return a map widget with the given name
name | {String} The map name to return |
{Fusion.Widget.Map} a map object or null if not found.
getMapById: function( id )
return a map widget that is associated with the given DOM element by id.
id | {String} The map id to return |
{Fusion.Widget.Map} a map object or null if not found.
getMapByIndice: function( indice )
return the map widget at the given index if there are more than one map elements specified in the AppDef
indice | {String} The map indice to return |
{Fusion.Widget.Map} a map object or null if not found.
getWidgetById: function( id )
return a reference to a widget by the id of the DOM Element that it was created in.
id | {String} the DOM id to get the widget for |
{Fusion.Widget} the widget or null
getBroker: function()
Accessor to return the broker object (for MapGuide only). The broker is used to prepare various queries to the MapGuide server.
{Fusion.Lib.MGBroker} the broker object
reportError: function( o )
Triggers the <Fusion.Event.FUSION_ERROR> and passes along the error object to the callback functions registered for this event. Widgets call MFusion.reportError> to inform the system of errors. Applications will typically register an event listener for the error event and do something to report the error to the user. By default, errors are not reported since there is no listener
o | {Object} the error object which is typically a string |
initUnits: function( metersPerUnit )
initializes the meters per unit values when a new map is loaded. Some systems make different assumptions for the conversion of degrees to meters so this makes sure both Fusion and OpenLayers are using the same value.
metersPerUnit | {Float} the value returned by LoadMap.php for meters per unit |
parseQueryString: function()
An initialization time function to parse the application URL parameters and stores them in an array. They can be retrieved using {Fusion.getQueryParam}
{Array} an array of the query params from when the page was loaded
Initialize the Fusion application.
initialize: function( options )
Initialize the Strings hash with the requested locale.
initializeLocale: function( locale )
set the current initialization state of the application.
setLoadState: function( state )
load any scripts that have been queued for loading.
loadQueuedScripts: function()
Insert a new script into the loading queue.
queueScript: function( url )
Called when a script fails to load for some reason.
scriptFailed: function( url )
a script has loaded.
scriptLoaded: function( url )
check if scripts have loaded.
checkLoadingScripts: function()
asynchronously load the application definition.
loadConfig: function()
the server has returned the application configuration file that contains enough information to bootstrap the application.
getConfigCB: function( r )
the server has returned the application configuration file that contains enough information to bootstrap the application.
serverSet: function()
the application failed to load the application configuration file.
serverFailed: function( r )
convenience function to issue an {XmlHttpRequest} to the server relative to the Fusion installation.
ajaxRequest: function( scriptURL, options )
trap exceptions produced in handling an ajax response.
ajaxException: function( r, e )
Convert XML to JSON using a server-side script for requests that aren’t available in JSON.
getXmlAsJson: function( url, callback )
Parses the given JSON string to a javascript object.
parseJSON: function( str )
Utility function to trim a given string of any trailing whitespace
trim: function( str )
Callback method to convert the XHR response into an actual json object and triggers the call to the callback method
xml2json: function( callback, r, json )
return a map widget with the given name
getMapByName: function( name )
return a map widget that is associated with the given DOM element by id.
getMapById: function( id )
return the map widget at the given index if there are more than one map elements specified in the AppDef
getMapByIndice: function( indice )
return a reference to a widget by the id of the DOM Element that it was created in.
getWidgetById: function( id )
returns the applicaiton’s absolute URL minus the filename.html part
getApplicationURL: function()
returns the application’s absolute URL minus the filename.html part
getFusionURL: function()
returns individual elements out of the Fusion config.json file
getConfigurationItem: function( arch, key )
Accessor to return the server-side script language
getScriptLanguage: function()
Accessor to return the URL of the redirect script
getRedirectScript: function()
Accessor to return the broker object (for MapGuide only).
getBroker: function()
Marks a JavaScript file as required which puts it into the queue for loading during Fusion initialization.
require: function( url )
Triggers the Fusion.Event.FUSION_ERROR and passes along the error object to the callback functions registered for this event.
reportError: function( o )
returns index into the units array for the given unit name or abbreviation
unitFromName: function( unit )
imperial, metric, degrees or device units
unitSystem: function( unit )
Given a unit, this method returns the units name
unitName: function( unit )
Given a unit, this method returns the units abbreviation
unitAbbr: function( unit )
Converts a length value from native units into meters.
toMeter: function( unit, value )
Converts a length value from meters into native units.
fromMeter: function( unit, value )
Converts a length value from one unit system into another.
convert: function( unitsIn, unitsOut, value )
initializes the meters per unit values when a new map is loaded.
initUnits: function( metersPerUnit )
find the OpenLayers units identifier given the Fusion metersPerUnit value
getClosestUnits: function( metersPerUnit )
Dynamically load a CSS stylesheet.
addWidgetStyleSheet: function( url )
An initialization time function to parse the application URL parameters and stores them in an array.
parseQueryString: function()
Returns the query parameter value for a given parameter name
getQueryParam: function( p )
Return the path to this script for bootstrapping Fusion.
_getScriptLocation: function ()
Pre-create a session to avoid the 401 Unauthorized dialog
var createSessionId = function( user, pass )