JavaScript Interface

Public Methods



addGroup(strParentGroupName, oParameters, (nIndex))


Adds a new group.
Use "undefined" or "_root" for strParentGroupName to add the group to the top level group.
The optional "index" parameter defines the position to insert the new element at. Default ist appending the new element.
Example: addGroup("someExistingGroup", {"name":"my new Group"});



addLayer(strParentGroupName, oParameters, (nIndex))


Adds a new layer.
Use "undefined" or "_root" for strParentGroupName to add the group to the top level group.
The optional "index" parameter defines the position to insert the new element at. Default ist appending the new element.
Example: addLayer("_root", {"name":"myLayer", "src":"images/foo.tif", "left":"30%"});


bEnabled

debugEnabled()


Returns if the debug mode is enabled.

mixed

debugError();


Returns the corresponding viewer error messages in the console.


mixed

debugLog(mixed);


Output the corresponding viewer log messages in the console.


mixed

debugWarn(mixed);


Output the corresponding viewer warning message in the console.


bSuccess

remove(layerName, layerName, ...);


Removes specific layers.


bSuccess

removeSelected();


Removes selected layers.



deselect(layerName, layerName, ...);


Deselects selected layers.


void

destroy();


Destroys the FSI Layers instance leaving the empty container <div> only.


void

dumpLayers();


Dumps the layer tree to the browser console.


void

dumpListeners();


Dumps all listeners to the browser console.


bSuccess

duplicate(layerName, newLayerName, withChildren);


Duplicates a certain layer or layer group.


nameOrFalse

getChildNameAt(groupName, index);


Returns the child name of the group at the mentioned index or a false if the index does not exist.


HTMLCode

getHTML();


Returns the HTML code of all current groups and layers.


nInstanceID

getInstanceID();


Returns the id of the viewer object.


strVersion

getVersion();


Returns a string containing the FSI Layers software version.


strBuild

getBuild();


Returns a string containing the FSI Layers software build number.


mixed

getConfigValue(strName)


Returns the set config value for the given parameters.


bInitDone

getInitDone();


Returns if the initialization process is done.


arSelectedLayerNames

getSelectedLayerNames();


Returns the names of the currently selected layers.


properties

getProperties();


Returns the properties of a specific layer.


arLayerNames

getLayerNames();


Returns an information object for each layer and group.


typeOrFalse

getTypeOf(layerName);


Returns the type of a layer ("layer" or "group") or false if it doesn't exist.


strInstanceName

getInstanceName();


Returns the name of the viewer object.


oParameters

getParameters();


Returns the parameters of the viewer object.



hide(layerName, layerName, ..);


Hides the specified layers.



hideSelected();


Hides the selected layers.



show(layerName, layerName, ..);


Shows the specified layers.



showSelected();


Shows the selected layers.


void

init(elementID, oParameters, bDebug);


Initializes the chosen FSI Layers element.


success

move(layerName, targetGroup, (targetIndex));


Moves the specified layer to the specified target group.
If you ommit "targetIndex" the layer will be appended to the target group.


void

printAPI();


Shows all API methods in the console in alphabetical order.


void

traceConfigValue(strName);


Traces a config value and enables you to see where (in config files, the _default.xml, etc.) a specific value is set.


void

testAPIListenersStart();


Starts the API test and shows all called listeners and the parameters which they return.

void

testAPIListenersStop();


Stops the API test.


bSuccess

 removeListener(strListenerName, fn);


Removes a specific listener.



 render();


Render the current state of FSI Layers.
Must be called after changing properties or adding/removing layers.



 reset();


Resets FSI Layers emptying the root group.


void

start();


Starts FSI Layers.



selectAll();


Selects all layers and groups.



select(layerName, layerName, ...);


Selects specified layers and/or groups.



selectNone();


Deselects all layers.



setHTML(HTMLCode);


Resets FSI layers and renders the <fsi-layers> and <fsi-layer-group>tags as given in the HTMLCode argument.


bSuccess

setProperties(arLayerNames, oProperties);


Sets the properties of the specified layer.
Use a property value of "null" to remove a property.
Example:
setProperties(["layer1", "layer2"], {"left":"20%", "hidden":false});


bSuccess

setPropertiesOfSelected(oProperties);


Sets the given properties of all selected layers.
setPropertiesOfSelected({"left":"20%", "hidden":false});




toggleInfo();


Toggles the info (name, dimensions, clipping state) and direction arrows of all layers and groups.


Callback functions


The optional JavaScript callback functions enables developers to react on events fired by FSI Layers.


The following callback functions can be used:


onConfigsReady(oConfigValues );


Called as soon as the configuration is loaded.


onReady();


Called as soon as the instance is ready.
Afterwards you can add/remove layers and change properties using the API.


onRenderLayer(iLayer);


Called as soon as the layer is rendered.


onRenderLayerDone(iLayer);


Called as soon as the layer rendering is done.


onRenderStart();


Called as soon as rendering of all layers starts.


onRenderFinished();


Called as soon as rendering of all layers is done.


onReset();


Called as soon as the instance is reset.


onResize(nWidth, nHeight, bResizeDone, bFullscreen);


Called as soon as the instance is resized.