WebControl

The main class for the GermaniumWeb plugin.

You should get familiar with the following concepts to make best use of GermaniumWeb :

  • the 3D scene (or simply “the scene”)
  • the Eye
  • event handling model

The Scene

The scene is what you see when you embed GermaniumWeb plugin on your webpage.  This means any object you add to the scene can be seen on the plugin area.

WebControl class acts as the overall manager of the scene.  With WebControl, you can :

  • add objects to the scene,
  • access objects that have been added to the scene, and
  • remove objects from the scene.

The two objects you are likely to add to the scene are Buildings and Placemarks.

The Eye

The Eye represents the eye through which you see the scene.  You access the Eye by calling GetEye.  Then, you can manipulate the Eye using functions provided by the Eye class.

Event Handling Model

Finally, GermaniumWeb adopts the following event handling model :

Since

Version 0.0.1

Summary
WebControlThe main class for the GermaniumWeb plugin.
Plugin version property
GetPluginVersionReturns the version of GermaniumWeb plugin installed on the user’s computer.
Focus property
SetFocusSets the focus of the HTML page to the GermaniumWeb plugin object.
Eye & Options properties
GetEyeGets the Eye through which we view the 3D scene.
GetOptionsGets the Options object that controls the behaviour of GermaniumWeb plugin, such as using a sky box and showing the navigation buttons.
Width & height properties
SetSizeSets the width and height of the plugin area on web page (unit is pixels).
GetWidthReturns the width of the plugin area on the web page.
GetHeightReturns the height of the plugin area on the web page.
Document base property
SetDocumentBaseSets the document base URL to resolve relative paths.
GetDocumentBaseGets the document base URL used to resolve relative paths.
Loading files
LoadLoads the specified building file and adds Buildings to the scene.
UnloadAllUnloads all objects currently in scene.
Using handle, index, & BBL IDThis section explains how you can get BBL objects using handle, index, & BBL ID.
Building, Block, Level (BBL) functions
ShowAllBuildingsShows all Buildings currently loaded.
HideAllBuildingsHides all Buildings currently loaded.
GetNumberOfBuildingsReturns the number of Buildings in the scene.
GetBuildingByHandleGets the Building in the scene with the specified handle.
GetBlockByHandleGets the Block in the scene with the specified handle.
GetLevelByHandleGets the Level in the scene with the specified handle.
GetBuildingByBBLIdGets the Building in the scene with the specified BBL ID.
GetBlockByBBLIdGets the respective Block with the matching building and block BBL IDs.
GetLevelByBBLIdGets the respective Level with the matching building, block and level BBL IDs.
GetBuildingByIndexGets the Building in the scene with the specified index.
GetBuildingByNameGets the Building in the scene with the specified name.
GetPrimaryBuildingConvenience function to get the first Building in the scene.
GetPrimaryBlockConvenience function to get the index-th Block in the scene.
GetPrimaryLevelConvenience function to get the index-th Level in the scene.
GetLevelCursorGets the LevelCursor that allows us to explore the BBL structure of the scene.
Creating objects
CreatePlacemarkCreates a Placemark.
CreatePointGeometryCreates a PointGeometry (contains location of a Placemark).
CreateLineStringGeometryCreates a LineStringGeometry.
CreatePolygonGeometryCreates a PolygonGeometry.
CreateModelGeometryCreates a ModelGeometry.
CreateStyleSetCreates a StyleSet (contains style of a Placemark by default).
CreateArrowStyleCreates an ArrowStyle (controls visual appearance of a Placemark).
CreateDiamondStyleCreates a DiamondStyle (controls visual appearance of a Placemark).
CreateIconStyleCreates an IconStyle (controls visual appearance of a Placemark).
CreateLineStyleCreates a LineStyle (controls visual appearance of a Placemark).
CreateModelStyleCreates an ModelStyle (controls visual appearance of a Placemark).
CreatePolygonStyleCreates a PolygonStyle (controls visual appearance of a Placemark).
CreateLabelStyleCreates a LabelStyle (controls visual appearance of a Placemark’s text label).
CreateBalloonStyleCreates a BalloonStyle (controls visual appearance of a Placemark’s callout balloon).
CreateColorCreates a Color.
CreateRandomColorCreates a random Color.
CreateCoordinatesCreates a Coordinates (unit is meters).
CreateEulerAngleCreates an EulerAngle (unit is radians).
CreateEulerAngleByLookingAtCreates an EulerAngle by specifying (pointFrom, pointTo) pair.
CreateEyeParamsCreates an EyeParams.
CreateEyeParamsToFitObjectsReturns the EyeParams that best fits the input Coordinates, VisualObjects, and BBLObjects.
CreateEyeParamsToFitObjectsByHandleReturns the EyeParams that best fits the input Coordinates, VisualObjects, and BBLObjects specified by their handles.
CreateImageCreates an Image.
CreateVector2Creates a Vector2.
CreateVector3Creates a Vector3.
CreateVersionCreates a Version.
CreateHTMLBoxCreates a HTMLBox and adds it to the WebControl.
Placemark functions
AddPlacemarkAdds the specified Placemark to the scene.
GetNumberOfPlacemarksReturns the number of Placemarks in the scene.
GetPlacemarkByIndexGets the Placemark in the scene with the specified index.
GetPlacemarkByHandleGets the Placemark in the scene with the specified handle.
HasPlacemarkReturns true if the specified Placemark has been added to the scene.
RemovePlacemarkRemoves the specified Placemark from the scene.
RemovePlacemarkByIndexRemoves a Placemark from the scene by specifying its index.
RemovePlacemarkByHandleRemoves a Placemark from the scene by specifying its handle.
RemoveAllPlacemarksRemoves all Placemarks from the scene.
GetActivePlacemarkGets the Placemark that is currently active.
SetActivePlacemarkMakes the specified Placemark to be the active placemark.
UnsetActivePlacemarkDeactivates the active placemark.
OpenActivePlacemarkCalloutOpens the active placemark’s callout.
IsCalloutOpenReturns true if a callout is currently open.
CloseCalloutCloses any callout currently open without deactivating the active placemark.
Clip Plane functions
GetClipPlaneGets the ClipPlane with the specified index.
EnableAllClipPlanesConvenience function to make all 6 ClipPlanes operational.
DisableAllClipPlanesConvenience function to stop all 6 ClipPlanes from being operational.
HideAllClipPlanesConvenience function to make all 6 ClipPlanes invisible.
ShowAllClipPlanesConvenience function to make all 6 ClipPlanes visible.
MoveAllClipPlanesConvenience function to move all 6 ClipPlanes.
Handling Events
AddEventHandlerAdds a custom event handler to the specified Event.
RemoveEventHandlerRemoves a custom event handler from the specified Event.
RemoveAllEventHandlersRemoves all custom event handlers from the specified Event.
Navigation Mode
SetNavigationModeSets the navigation mode.
GetNavigationModeGets the navigation mode currently enabled.
IsInNavigationModeQueries if the specified navigation mode is currently enabled.
Utility functions
DegreeToRadianDeprecated; use Germanium.DegreeToRadian instead.
RadianToDegreeDeprecated; use Germanium.RadianToDegree instead.
IsPointGeometryTests if input Geometry is a PointGeometry.
IsLineStringGeometryTests if input Geometry is a LineStringGeometry.
IsPolygonGeometryTests if input Geometry is a PolygonGeometry.
IsModelGeometryTests if input Geometry is a ModelGeometry.
IsArrowStyleTests if input GeometryStyle is an ArrowStyle.
IsDiamondStyleTests if input GeometryStyle is a DiamondStyle.
IsIconStyleTests if input GeometryStyle is an IconStyle.
IsLineStyleTests if input GeometryStyle is a LineStyle.
IsPolygonStyleTests if input GeometryStyle is a PolygonStyle.
IsModelStyleTests if input GeometryStyle is an ModelStyle.
HTMLBox functions
GetNumberOfHTMLBoxesReturns the number of HTMLBoxes on the WebControl.
GetHTMLBoxByIndexGets the HTMLBox with the specified index.
GetHTMLBoxByHandleGets the HTMLBox with the specified handle.
RemoveHTMLBoxRemoves the specified HTMLBox.
RemoveHTMLBoxByIndexRemoves a HTMLBox by specifying its index.
RemoveHTMLBoxByHandleRemoves a HTMLBox by specifying its handle.
ShowAllHTMLBoxesShows all HTMLBoxes.
HideAllHTMLBoxesHides all HTMLBoxes.
RemoveAllHTMLBoxesRemoves all HTMLBoxes.

Plugin version property

GetPluginVersion

this.GetPluginVersion = function ()

Returns the version of GermaniumWeb plugin installed on the user’s computer.

Returns

Version

Throws

”uninitialized_plugin_object” Exception

See also

Since

Version 0.0.12.0

Focus property

SetFocus

this.SetFocus = function ()

Sets the focus of the HTML page to the GermaniumWeb plugin object.

Returns

void

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.5.7.1

Eye & Options properties

GetEye

this.GetEye = function ()

Gets the Eye through which we view the 3D scene.

Returns

Eye

Throws

”uninitialized_plugin_object” Exception

Since

Version 0.0.10

GetOptions

this.GetOptions = function ()

Gets the Options object that controls the behaviour of GermaniumWeb plugin, such as using a sky box and showing the navigation buttons.

Returns

Options

Throws

Since

Version 0.0.10

Width & height properties

SetSize

this.SetSize = function (width,
height)

Sets the width and height of the plugin area on web page (unit is pixels).

Parameters

{int} widthNew width of the plugin area.
{int} heightNew height of the plugin area.

Throws

Since

Version 0.0.1

GetWidth

this.GetWidth = function ()

Returns the width of the plugin area on the web page.

Returns

int

Throws

”uninitialized_plugin_object” Exception

Since

Version 0.1.0.2

GetHeight

this.GetHeight = function ()

Returns the height of the plugin area on the web page.

Returns

int

Throws

”uninitialized_plugin_object” Exception

Since

Version 0.1.0.2

Document base property

SetDocumentBase

this.SetDocumentBase = function (inString)

Sets the document base URL to resolve relative paths.

On initialization, GermaniumWeb gets the document base from the global variable window.location.  You can replace the document base by calling this function.

Parameter

{string} inStringPath string to be set as the document base.  Trailing “/” is significant :

Returns

void

Throws

”invalid_argument” Exception

Examples

SetDocumentBase(“http://www.a.com/dir/somefile”)Sets the remote path “http://www.a.com/dir/” as the document base URL.
SetDocumentBase(“file:///C:/somepath/”)Sets the local directory “C:\somepath\” as the document base URL.
SetDocumentBase(“file://server/somepath/somefile”)Sets the windows UNC path “\\server\somepath\” as the document base URL.

See also

Load ModelGeometry.SetSourceUrl

Since

Version 1.2.2.0

GetDocumentBase

this.GetDocumentBase = function ()

Gets the document base URL used to resolve relative paths.

Returns

string

See also

Load

Since

Version 1.2.2.0

Loading files

Load

this.Load = function (filePath,
options,
successCallback,
failureCallback)

Loads the specified building file and adds Buildings to the scene.  This function is asynchronous, so it returns immediately after it is called while processing continues in the background.  After the loading process finishes, the API will call a callback function that you can specify (see usage below).

If the loading is successful, the LevelCursor will attempt to set itself to the bottom Level of the first Block which has levels in the first Building.  If no such Level exists, the LevelCursor will remain null.  You can get the LevelCursor by calling the function GetLevelCursor.

File Formats

GermaniumWeb can load .xlcl building files.  Our Germanium Building Composer tool allows you to compose COLLADA files into .xlcl building files.

GermaniumWeb can also generate buildings from specially prepared .kml files.  Please see the KML Building importer articles for more details.

Security

In early versions, GermaniumWeb does not allow loading of local files for security reasons.  If a local file is specified, the load will fail with a LocalFilesBlocked error code.  See LoadEventErrorCodes for a complete list of file loading error codes.

However, this restriction makes it difficult for modelers to test building files and for developers to test applications (because they need to upload the files they work on to a webserver).  Starting from plugin version 1.27, GermaniumWeb allows loading of local files when the plugin is embedded in a local HTML file.

For example, MyWebapp.html uses GermaniumWeb to load Building.kml.  When hosted locally, i.e. on the paths
C:\MyWebapp.html
C:\Building.kml
GermaniumWeb will allow the file C:\Building.kml to be loaded.

However, if MyWebapp.html is hosted on a webserver, e.g. at
http://example.com/MyWebapp.html
GermaniumWeb will not load C:\Building.kml.

For GermaniumWeb to load Building.kml, it has to be hosted on a webserver as well, e.g. at
http://example.com/Building.kml

Parameters

{string} filePathPath to the building file.  GermaniumWeb supports absolute and relative paths.  For relative paths, GermaniumWeb uses window.location as the document base URL to resolve relative paths.  You can change it by calling SetDocumentBase.
{assocArray} options(optional) Options to control loading behaviour.  Currently unused.
{function} successCallback(optional) Function that will be called on successful loading.  See example under Usage heading below.
{function} failureCallback(optional) Function that will be called on loading failure.  The API will pass an error message and an error code to this function (error codes and their meaning are listed in LoadEventErrorCodes).  See example under Usage heading below.

Returns

booltrue loading process successfully starts; false otherwise

Events

  • OnLoadEnds
  • OnBuildingAdd, OnBuildingAdded
  • OnBlockAdd, OnBlockAdded
  • OnLevelAdd, OnLevelAdded

Usage

Load(filePath)Loads the file specified by filePath with default behavior and no callback.
Load(filePath, null, successCallback)Loads a file with default behavior and a callback function for successful loading.
Load(filePath, null, successCallback, failureCallback)Loads a file with default behavior and callback functions for both successful and unsuccessful loading.

Example

<script>
var germ;   // GermaniumWeb plugin object
...
function LoadBuilding(filepath) {
    germ.Load(filepath, null, OnLoadOk, OnLoadFailed);
    // Control returns immediately, while loading continues in background.
}

// Later, the API will call this function when the loading process finishes successfully.
function OnLoadOk() {
    alert("Successfully loaded building.");
}

// Later, the API will call this function when the loading process fails.
function OnLoadFailed(message, errorCode) {
    switch (errorCode) {
        case Germanium.LoadEventErrorCodes.Terminated:
            alert("You cancelled the download.");
            break;
        case Germanium.LoadEventErrorCodes.RetrievalFailure:
            alert("Could not download building, please try again later.");
            break;
        default:
            // show an error message
            alert("Failed loading building file. Error message: " + message);
            break;
    }
}
...
</script>

See also

Related classes

Since

Version 0.1.0.20

UnloadAll

this.UnloadAll = function ()

Unloads all objects currently in scene.

Notes :

  • Calling UnloadAll cancels pending loads.
  • UnloadAll also removes and deletes Placemarks.
  • UnloadAll sets the LevelCursor to null.

Returns

void

Events

  • OnBuildingRemove, OnBuildingRemoved
  • OnBlockRemove, OnBlockRemoved
  • OnLevelRemove, OnLevelRemoved

Throws

”uninitialized_plugin_object” Exception

Since

Version 0.1.0.20

Using handle, index, & BBL ID

This section explains how you can get BBL objects using handle, index, & BBL ID.  A BBL object can be a Building, a Block, or a Level.

GermaniumWeb provides 4 ways to programmatically get BBL objects :

  • by index
  • by BBL ID
  • by name
  • by handle

1.  Index

Index is the simplest to use.  Use it when you want to retrieve all BBL objects in the scene one by one in a for loop.

Use index with caution because any further data loading or unloading may change the index ordering.

Relevant functions :

2.  BBL ID

The BBL ID allows you to consistently retrieve BBL objects if you know in advance which building you are going to load.

Relevant functions :

3.  Name

The first building found with a matching name will be returned.

Relevant functions :

4.  Handle

A handle is a system-generated runtime id.  Use it as a fast, lightweight alternative to passing around a building object that you have previously retrieved.

Unlike the index, a handle is guaranteed to be persistent for the rest of the plugin’s lifespan.

Relevant functions :

Building, Block, Level (BBL) functions

ShowAllBuildings

this.ShowAllBuildings = function (bUpdateChildren)

Shows all Buildings currently loaded.

Parameter

{bool} bUpdateChildren(optional) Specifies if all Blocks & Levels should also be hidden.  Setting this to true causes only programmatic difference but no visual difference.  See example below for illustration.

Returns

void

Events

  • OnBuildingShown
  • OnBlockShown, OnLevelShown if bUpdateChildren is set true

Throws

”uninitialized_plugin_object” Exception

Example

Let us assume that GermaniumWeb plugin object is stored the variable germ.

germ.ShowAllBuildings(true);

is programmatically equivalent to

germ.ShowAllBuildings();
for (i=0; i<germ.GetNumberOfBuildings(); i++) {
    var bldg = germ.GetBuildingByIndex(i);
    for (j=0; j<bldg.GetNumberOfBlocks(); j++) {
        var blk = bldg.GetBlockByIndex(j);
        blk.Show();
        for (k=0; k<blk.GetNumberOfLevels(); k++) {
            blk.GetLevelByIndex(k).Show();
        }
    }
}

Since

Version 1.3.5.2

HideAllBuildings

this.HideAllBuildings = function (bUpdateChildren)

Hides all Buildings currently loaded.

Parameter

{bool} bUpdateChildren(optional) Specifies if all Blocks & Levels should also be hidden.  Setting this to true causes only programmatic difference but no visual difference.  See example below for illustration.

Returns

void

Events

  • OnBuildingHidden
  • OnBlockHidden, OnLevelHidden if bUpdateChildren is set true

Throws

”uninitialized_plugin_object” Exception

Example

Let us assume that GermaniumWeb plugin object is stored the variable germ.

germ.HideAllBuildings(true);

is programmatically equivalent to

germ.HideAllBuildings();
for (i=0; i<germ.GetNumberOfBuildings(); i++) {
    var bldg = germ.GetBuildingByIndex(i);
    for (j=0; j<bldg.GetNumberOfBlocks(); j++) {
        var blk = bldg.GetBlockByIndex(j);
        blk.Hide();
        for (k=0; k<blk.GetNumberOfLevels(); k++) {
            blk.GetLevelByIndex(k).Hide();
        }
    }
}

Since

Version 1.3.5.2

GetNumberOfBuildings

this.GetNumberOfBuildings = function ()

Returns the number of Buildings in the scene.

Returns

int

Throws

”uninitialized_plugin_object” Exception

See also

Since

Version 0.0.3

GetBuildingByHandle

this.GetBuildingByHandle = function (strHandle)

Gets the Building in the scene with the specified handle.  Returns null if no such Building exists.

Parameter

{string} strHandleHandle of building to be retrieved.  Handles are system-generated and non persistent.  See Using handle, index, & BBL ID.

Returns

Building

Throws

More information

  • You can add buildings to the scene by loading a building file.  See Load
  • GermaniumWeb provides you 4 ways to access a building:
    1. by index,
    2. by BBL ID,
    3. by name, and
    4. by handle.
    See their comparison in the section Using handle, index, & BBL ID

See also

Since

Version 0.3.6.1

GetBlockByHandle

this.GetBlockByHandle = function (strHandle)

Gets the Block in the scene with the specified handle.  Returns null if no such Block exists.

Parameter

{string} strHandleHandle of the Block to be retrieved.  Handle are system-generated and non persistent.  See Using handle, index, & BBL ID.

Returns

Block

Throws

More information

  • You can add blocks to the scene by loading a building file.  See Load
  • GermaniumWeb provides you 4 ways to access a block:
    1. by index,
    2. by BBL ID,
    3. by name, and
    4. by handle.
    See their comparison in the section Using handle, index, & BBL ID

See also

Related class

Since

Version 0.3.6.1

GetLevelByHandle

this.GetLevelByHandle = function (strHandle)

Gets the Level in the scene with the specified handle.  Returns null if no such Level exists.

Parameter

{string} handleHandle of the Level to be retrieved.  Handles are system-generated and non persistent.  See Using handle, index, & BBL ID.

Returns

Level

Throws

More information

  • You can add levels to the scene by loading a building file.  See Load
  • GermaniumWeb provides you 4 ways to access a level:
    1. by index,
    2. by BBL ID,
    3. by name, and
    4. by handle.
    See their comparison in the section Using handle, index, & BBL ID

See also

Related classes

Since

Version 0.3.6.1

GetBuildingByBBLId

this.GetBuildingByBBLId = function (strBBLId)

Gets the Building in the scene with the specified BBL ID.  Returns null if no such Building exists.

Parameter

{string} strBBLIdBBL ID of building to be retrieved.  BBL IDs are defined in building file and therefore persistent.  See Using handle, index, & BBL ID.

Returns

Building

Throws

More information

  • You can add buildings to the scene by loading a building file.  See Load
  • GermaniumWeb provides you 4 ways to access a building:
    1. by index,
    2. by BBL ID,
    3. by name, and
    4. by handle.
    See their comparison in the section Using handle, index, & BBL ID

See also

Since

Version 1.0.1.0

GetBlockByBBLId

this.GetBlockByBBLId = function (strBldgBBLId,
strBlkBBLId)

Gets the respective Block with the matching building and block BBL IDs.  Returns null if no such Block or Building exists.

BBL IDs are defined in building file and therefore persistent.  See Using handle, index, & BBL ID.

Parameter

{string} strBldgBBLIdBBL ID of building in which the block is located
{string} strBlkBBLIdBBL ID of block to be retrieved

Returns

Block

Throws

More information

  • You can add blocks to the scene by loading a building file.  See Load
  • GermaniumWeb provides you 4 ways to access a block:
    1. by index,
    2. by BBL ID,
    3. by name, and
    4. by handle.
    See their comparison in the section Using handle, index, & BBL ID

See also

Related class

Since

Version 1.0.1.0

GetLevelByBBLId

this.GetLevelByBBLId = function (strBldgBBLId,
strBlkBBLId,
strLvlBBLId)

Gets the respective Level with the matching building, block and level BBL IDs.

This function accepts the BBL IDs separately, or in concatenated form as a fully qualified BBLId of the format “[BuildingBBLId]::[BlockBBLId]::[LevelBBLId]”

Returns null if no such Level, Block or Building exists.

BBL IDs are defined in building file and therefore persistent.  See Using handle, index, & BBL ID.

Parameter

{string} strBldgBBLIdBBL ID of building in which the block is located, or the fully qualified BBL ID of the level to be retrieved.
{string} strBlkBBLId(optional) BBL ID of block in which the level is located
{string} strLvlBBLId(optional) BBL ID of level to be retrieved

Returns

Level

Throws

More information

  • You can add levels to the scene by loading a building file.  See Load
  • GermaniumWeb provides you 4 ways to access a level:
    1. by index,
    2. by BBL ID,
    3. by name, and
    4. by handle.
    See their comparison in the section Using handle, index, & BBL ID

See also

Related class

Since

Version 1.0.1.0

GetBuildingByIndex

this.GetBuildingByIndex = function (index)

Gets the Building in the scene with the specified index.

Parameter

{int} indexIndex of building to be retrieved.  See Using handle, index, & BBL ID.

Returns

Building

Throws

More information

  • You can add buildings to the scene by loading a building file.  See Load
  • GermaniumWeb provides you 4 ways to access a building:
    1. by index,
    2. by BBL ID,
    3. by name, and
    4. by handle.
    See their comparison in the section Using handle, index, & BBL ID

See also

Since

Version 0.0.4

GetBuildingByName

this.GetBuildingByName = function (name)

Gets the Building in the scene with the specified name.  Returns null if no such Building exists.

Parameter

{string} nameName of Building to be retrieved.  See Using handle, index, & BBL ID.

Returns

Building

Throws

More information

  • You can add buildings to the scene by loading a building file.  See Load
  • GermaniumWeb provides you 4 ways to access a building:
    1. by index,
    2. by BBL ID,
    3. by name, and
    4. by handle.
    See their comparison in the section Using handle, index, & BBL ID

See also

Since

Version 0.1.0.23

GetPrimaryBuilding

this.GetPrimaryBuilding = function ()

Convenience function to get the first Building in the scene.

Returns

Building

Throws

”uninitialized_plugin_object” Exception

Since

Version

GetPrimaryBlock

this.GetPrimaryBlock = function (index)

Convenience function to get the index-th Block in the scene.  If there is more than one Building in the scene, returns the index-th Block in the first Building.

Parameter

{int} indexIndex of the Block to be retrieved.  See Using handle, index, & BBL ID.

Returns

Block

Throws

Since

Version 0.1.0.6

GetPrimaryLevel

this.GetPrimaryLevel = function (index)

Convenience function to get the index-th Level in the scene.  If there is more than one Building and one Block in the scene, returns the index-th Level in the first Block of the first Building.  Returns null if no such Level exists.

Parameter

{int} indexIndex of the Level to be retrieved.  See Using handle, index, & BBL ID.

Returns

Level

Throws

Since

Version 0.1.0.6

GetLevelCursor

this.GetLevelCursor = function ()

Gets the LevelCursor that allows us to explore the BBL structure of the scene.

Returns

LevelCursor

Since

Version 1.3.7.0

Creating objects

CreatePlacemark

this.CreatePlacemark = function (name,
content,
geom,
styleSet,
infoUrl,
interactive)

Creates a Placemark.

After creation, a placemark cannot be seen in the 3D scene yet.  Add the placemark to the scene by calling the function AddPlacemark.

Parameters

{string} name(optional) name of the Placemark to be created.
{string} content(optional) description of Placemark.
{mixed} geom(optional) geometry of Placemark; determines location in 3D scene.
Can be any object that inherits Geometry.
{StyleSet} styleSet(optional) StyleSet of Placemark; controls visual appearance.  If not specified, an empty StyleSet will be assigned.
{string} infoUrl(optional) URL link to a page providing more info about this Placemark
{bool} interactive(optional) whether or not the end-user can interact with this Placemark using the mouse

Default parameter values

name”Placemark n”, where n is a running count
contentempty string
geomPointGeometry with the location (0, 0, 0)
styleSetStyleSet with white diamond as GeometryStyle; LabelStyle is null
infoUrlempty string
interactivetrue

Returns

Placemark

Throws

Usage

If you want to create a Placemark with only a Geometry parameter, you can write:

CreatePlacemark(null, null, Geometry);

See also

Since

Version 0.1.0.10

CreatePointGeometry

this.CreatePointGeometry = function (X,
y,
z)

Creates a PointGeometry (contains location of a Placemark).

Parameters

{mixed} X(optional) a Coordinates, a Vector3, or a float
{float} y(optional)
{float} z(optional)

Default parameter values

X0
y0
z0

Returns

PointGeometry

Throws

Usage

CreatePointGeometry()Creates an empty PointGeometry object.
CreatePointGeometry(X)Creates a PointGeometry with a position as Coordinates.
CreatePointGeometry(X, y, z)Creates a PointGeometry with a position as (X, y, z) triplet.

Since

Version 0.1.0.12

CreateLineStringGeometry

this.CreateLineStringGeometry = function ()

Creates a LineStringGeometry.

Returns

LineStringGeometry

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.3.15.0

CreatePolygonGeometry

this.CreatePolygonGeometry = function (X,
y,
z)

Creates a PolygonGeometry.

Parameters

{mixed} X(optional) a Coordinates, a Vector3, or a float
{float} y(optional)
{float} z(optional)

Default parameter values

X0
y0
z0

Returns

PolygonGeometry

Throws

Usage

CreatePolygonGeometry()Creates an empty PolygonGeometry object.
CreatePolygonGeometry(X)Creates a PolygonGeometry with a position as Coordinates.
CreatePolygonGeometry(X, y, z)Creates a PolygonGeometry with a position as (X, y, z) triplet.

Since

Version 1.3.13.0

CreateModelGeometry

this.CreateModelGeometry = function (url,
pos,
ort,
scale)

Creates a ModelGeometry.

Parameters

{string} url(optional) - URL from which the model file will be fetched.  GermaniumWeb supports absolute and relative paths.  For relative paths, GermaniumWeb uses window.location as the document base URL to resolve relative paths.  You can change it by calling WebControl.SetDocumentBase.
{Coordinates} pos(optional) a position as Coordinates
{EulerAngle} ort(optional) rotation about the X, Y and Z axes as an EulerAngle
{Vector3} scale(optional) scaling in the X, Y and Z axes as a Vector3

Default parameter values

urlnull
posnull
ortnull
scalenull

Returns

ModelGeometry

Events

  • OnModelLoadEnds

Throws

Since

Version 1.5.3.1

CreateStyleSet

this.CreateStyleSet = function (inGeomStyle,
inLabelStyle,
inBalloonStyle)

Creates a StyleSet (contains style of a Placemark by default).

Parameters

{mixed} inGeomStyle(optional) n ArrowStyle, a DiamondStyle, an IconStyle, a LineStyle, or a PolygonStyle
{LabelStyle} inLabelStyle(optional) a LabelStyle object
{BalloonStyle} inBalloonStyle(optional) a BalloonStyle object

Default Parameters

inGeomStylenull
inLabelStylenull
inBalloonStylenull

Returns

StyleSet

Throws

”uninitialized_plugin_object” Exception “InvalidArgument” Exception

Since

Version 0.1.0.12

CreateArrowStyle

this.CreateArrowStyle = function (color,
thickness,
width,
headLength,
tailLength,
headStyle,
tailStyle)

Creates an ArrowStyle (controls visual appearance of a Placemark).

Parameters

{mixed} color(optional) Color of the ArrowStyle.
Can be a Color object / a web color RGB hex triplet (a string) / a web color RGBA hex quartet (a string).
{float} thickness(optional) arrow thickness in meters.
{float} width(optional) arrow width in meters.
{float} headLength(optional) length of arrow head in meters.
{float} tailLength(optional) length of arrow tail in meters.
{int} headStyle(optional) one of the values defined in ArrowStyle.Constants.
{int} tailStyle(optional) one of the values defined in ArrowStyle.Constants.

Default parameter values

colorwhite (255, 255, 255, 255)
thickness0.05
width0.4
headLength0.4
tailLength0.3
headStyleGermanium.ArrowStyle.HeadSimple
tailStyleGermanium.ArrowStyle.TailSimple

Returns

ArrowStyle

Throws

Sample usage

If you want to create an ArrowStyle with custom width and head length, you can write:

CreateArrowStyle(null, null, 1.0, 2.5);

Since

Version 1.1.1.0

CreateDiamondStyle

this.CreateDiamondStyle = function (color,
width,
upperHeight,
lowerHeight)

Creates a DiamondStyle (controls visual appearance of a Placemark).

Parameters

{mixed} color(optional) Color of the DiamondStyle to be created.
Can be a Color object / a web color RGB hex triplet (a string) / a web color RGBA hex quartet (a string).
{float} width(optional) width of DiamondStyle in meters.
{float} upperHeight(optional) height of upper portion of DiamondStyle in meters.
{float} lowerHeight(optional) height of lower portion of DiamondStyle in meters.

Default parameter values

colorthe RGBA value (255, 255, 255, 255)
width0.2
upperHeight0.2
lowerHeight0.5

Returns

DiamondStyle

Throws

Sample usage

If you want to create a DiamondStyle with custom height and default color & width, you can write:

CreateDiamondStyle(null, null, 4.5, 7.5);

Since

Version 0.1.0.12

CreateIconStyle

this.CreateIconStyle = function (image,
hotspotX,
hotspotY)

Creates an IconStyle (controls visual appearance of a Placemark).

Parameters

{mixed} image(optional) Image to be used with this IconStyle.
Can be an Image object / an image URL (a string).
{string} hotspotX(optional) X-component of the hotspot location
{string} hotspotY(optional) Y-component of the hotspot location

You can specify the hotspot in pixels (e.g.  “28px”) or percentage (e.g.  “80%”).

Default parameter values

imagenull
hotspotXnull
hotspotYnull

Notes

  • When the plugin attempts to show an icon placemark with a null image, the plugin uses a default image with a properly set hotspot.
  • When the plugin attempts to show an icon placemark with a non-null image but null hotspot location, the plugin uses the default value of (“50%”, “50%”), i.e. the center of the icon image.

Returns

IconStyle

Throws

Since

Version 1.1.5.1

CreateLineStyle

this.CreateLineStyle = function (color,
pattern,
patternScale,
width,
animationMode)

Creates a LineStyle (controls visual appearance of a Placemark).

Parameters

{mixed} color(optional) line Color of the LineStyle to be created.
Can be a Color object / a web color RGB hex triplet (a string) / a web color RGBA hex quartet (a string).
{int} pattern(optional) line pattern; see GeometryStyle.Line Pattern.
{int} patternScale(optional) controls the length of line pattern.
{float} width(optional) line width in pixels.
{int} animationMode(optional) controls how line pattern is animated; see LineStyle.Animation mode.

Default parameter values

colorthe RGBA value (127, 127, 127, 255)
patternGermanium.GeometryStyle.Solid
patternScale1
width1
animationModeGermanium.LineStyle.Animation.None

Returns

LineStyle

Throws

Usage

CreateLineStyle()Create a default LineStyle.
CreateLineStyle(null, null, null, 4.0, null)Create a LineStyle with line width 4.0 pixels.
CreateLineStyle(ColObj,
    Germanium.GeometryStyle.Dashed2,
    1,
    2.0,
    Germanium.LineStyle.Animation.Forward)
Create a LineStyle with line color ColObj, line pattern Dashed2, pattern scale 1, line width 2.0, and Forward animation mode.

See also

WebControl.CreateColor

Since

Version 1.3.15.0

CreateModelStyle

this.CreateModelStyle = function (useLoadingIcon)

Creates an ModelStyle (controls visual appearance of a Placemark).

Parameters

{bool} useLoadingIcon(optional) Whether a loading icon is displayed while the 3D model is being downloaded and loaded to memory.

Default parameter values

useLoadingIcontrue

Returns

ModelStyle

Throws

Since

Version 1.5.5.5

CreatePolygonStyle

this.CreatePolygonStyle = function (fillColor,
fillMode,
outlineColor,
outlineWidth)

Creates a PolygonStyle (controls visual appearance of a Placemark).

Parameters

{mixed} fillColor(optional) fill color of the PolygonStyle.
Can be a Color object / a web color RGB hex triplet (a string) / a web color RGBA hex quartet (a string).
{int} fillMode(optional) fill mode; see PolygonStyle.Polygon Fill Mode.
{mixed} outlineColor(optional) outline color.
Can be a Color object / a web color RGB hex triplet (a string) / a web color RGBA hex quartet (a string).
{float} outlineWidth(optional) outline width in pixels.

Default parameter values

fillColorthe RGBA value (127, 127, 127, 255)
fillModeGermanium.PolygonStyle.Fill
outlineColorthe RGBA value (255, 255, 255, 255)
outlineWidth1

Returns

PolygonStyle

Throws

Usage

CreatePolygonStyle()Create a default PolygonStyle.
CreatePolygonStyle(colA,
    Germanium.PolygonStyle.FillAndOutline,
    colB,
    2)
Create a PolygonStyle with fill color colA, fill mode FillAndOutline, outline color colB, and 2 pixel-wide outline.

See also

WebControl.CreateColor

Since

Version 1.3.14.0

CreateLabelStyle

this.CreateLabelStyle = function (color)

Creates a LabelStyle (controls visual appearance of a Placemark’s text label).

Parameters

{mixed} color(optional) Color of label text.
Can be a Color object / a web color RGB hex triplet (a string) / a web color RGBA hex quartet (a string).

Default parameter values

colorthe RGBA value (255, 255, 255, 255)

Returns

LabelStyle

Throws

  • ”invalid_argument” Exception
  • ”uninitialized_plugin_object” Exception

Usage

CreateLabelStyle()Create a default LabelStyle.
CreateLabelStyle(Col)Create a LabelStyle with Color object Col as text color.

See also

WebControl.CreateColor

Since

Version 0.3.1.0

CreateBalloonStyle

this.CreateBalloonStyle = function (bShowCloseButton,
bgColor,
outlineColor)

Creates a BalloonStyle (controls visual appearance of a Placemark’s callout balloon).

Parameters

{bool} bShowCloseButton(optional) whether or not close button is shown.
{mixed} bgColor(optional) background color of the BalloonStyle.
Can be a Color object / a web color RGB hex triplet (a string) / a web color RGBA hex quartet (a string).
{mixed} outlineColor(optional) outline color of the BalloonStyle.
Can be a Color object / a web color RGB hex triplet (a string) / a web color RGBA hex quartet (a string).

Default parameter values

bShowCloseButtontrue
bgColorwhite (255, 255, 255, 255)
outlineColorgray (102, 102, 102, 127)

Returns

BalloonStyle

Throws

Since

Version 1.4.6.0

CreateColor

this.CreateColor = function (R,
g,
b,
a)

Creates a Color.  A color consists of red, green, and blue color components (RGB), plus an optional alpha component (RGBA).  Each component can hold an integer in the range [0, 255].

Parameters

{mixed} R(optional) red color component (an int) / web color RGB hex triplet (a string) / web color RGBA hex quartet (a string) / a Color object
{int} g(optional) green component
{int} b(optional) blue component
{int} a(optional) alpha component

Default parameter values

R0
g0
b0
a255

Returns

Color

Throws

Usage

CreateColor()Creates an empty Color object.
CreateColor( R )Creates a Color object from R, a web color RGB hex triplet or a web color RGBA hex quartet or a Color object.
CreateColor(R, g, b)Creates a Color object with RGB color components.
CreateColor(R, g, b, a)Creates a Color object with RGBA color components.

Since

Version 0.1.0.12

CreateRandomColor

this.CreateRandomColor = function (maskR,
maskG,
maskB,
A)

Creates a random Color.  The user can optionally specify limits to individually randomize each of the red, green, and blue color components (RGB), plus an additional optional alpha component that will not be randomized (RGBA).  Each component can hold an integer in the range [0, 255].

Parameters

{int} maskR(optional) red color component which will be limited to the range of [0..maskR].
{int} maskG(optional) green component which will be limited to the range of [0..maskG].
{int} maskB(optional) blue component which will be limited to the range of [0..maskB].
{int} a(optional) alpha component

Default parameter values

maskR255
maskG255
maskB255
a255

Returns

Color

Throws

Usage

CreateRandomColor()Creates a Color object with random color.
CreateRandomColor(maskR, maskG, maskB)Creates a Color object with individually randomized RGB color components.
CreateRandomColor(maskR, maskG, maskB, A)Creates a Color object with individually randomized RGB, and an A color components.

Since

Version 1.4.17.1

CreateCoordinates

this.CreateCoordinates = function (x,
y,
z)

Creates a Coordinates (unit is meters).

Parameters

{float} xX-axis component
{float} yY-axis component
{float} zZ-axis component

Returns

Coordinates

Throws

Since

Version 0.0.10

CreateEulerAngle

this.CreateEulerAngle = function (tilt,
heading,
z)

Creates an EulerAngle (unit is radians).  There are 2 versions, one which takes in euler angles directly, and a convenience version which converts a tilt and heading into euler angles.

Parameters

{float} tiltrotation around X-axis in radians
{float} headingrotation around Y-axis in radians
{float} z(optional) rotation around Z-axis in radians

Returns

EulerAngle

Throws

Usage

CreateEulerAngle(tilt, heading)Creates an EulerAngle object using tilt and heading.
CreateEulerAngle(p, q, r)Creates an EulerAngle object using X ,Y, Z rotation angles.

See also

Since

Version 0.0.10

CreateEulerAngleByLookingAt

this.CreateEulerAngleByLookingAt = function (pointFrom,
pointTo)

Creates an EulerAngle by specifying (pointFrom, pointTo) pair.  The resulting EulerAngle is the orientation to look at pointTo from pointFrom.

Following GermaniumWeb convention, the resulting EulerAngle will have rotation angle around Z axis to be 0 radian.

Parameters

{Coordinates} pointFromstarting point of orientation, a Coordinates object
{Coordinates} pointToend point of orientation, a Coordinates object

Returns

EulerAngle

Throws

Since

Version 1.2.0.0

CreateEyeParams

this.CreateEyeParams = function (x,
y,
z,
p,
q,
r,
t)

Creates an EyeParams.

Parameters

{float} x(Optional) Position X-coordinate, in meters
{float} y(Optional) Position Y-coordinate, in meters
{float} z(Optional) Position Z-coordinate, in meters
{float} p(Optional) Orientation around X-axis, in radians
{float} q(Optional) Orientation around Y-axis, in radians
{float} r(Optional) Orientation around Z-axis, in radians
{float} t(Optional) Target distance, in meters

Returns

EyeParams

Throws

Usage

CreateEyeParams()Creates an empty EyeParams object (where position and orientation are null, and target distance is 0).
CreateEyeParams(x, y, z)Creates an EyeParams object with position parameter.
CreateEyeParams(x, y, z, p, q, r)Creates an EyeParams object with position and orientation parameters.
CreateEyeParams(x, y, z, p, q, r, t)Creates an EyeParams object with position, orientation, and target distance parameters.

Since

Version 0.0.10

CreateEyeParamsToFitObjects

this.CreateEyeParamsToFitObjects = function (args)

Returns the EyeParams that best fits the input Coordinates, VisualObjects, and BBLObjects.  In addition, you can specify the amount of padding around the input objects.

See CreateEyeParamsToFitObjectsByHandle if you prefer to use object handles.

Parameter

{assocArray} argsspecifies the input objects to fit

args should contain at least one of the following keys :

coordinatesarray of Coordinates objects.
visualObjectsarray of VisualObjects.
bblObjectsarray of BBLObjects.
paddinga float, the amount of padding around the input objects as a ratio of plugin width and height.  For example, setting the value 0.1 will add a padding of 5% on the left and right of the input objects (5% + 5% = 10% or 0.1).
Clamped to the range [0, 0.999].
orientationan EulerAngle object, to specify the desired orientation of the computed EyeParams.  If not specified, the current orientation of the Eye will be used.

Returns

EyeParams

@Examples

Throws

Since

Version 1.4.9.0

CreateEyeParamsToFitObjectsByHandle

this.CreateEyeParamsToFitObjectsByHandle = function (args)

Returns the EyeParams that best fits the input Coordinates, VisualObjects, and BBLObjects specified by their handles.  In addition, you can specify the amount of padding around the input objects.

This function is equivalent to CreateEyeParamsToFitObjects.  The only difference is that you specify the input objects using their handles.

Parameter

{assocArray} argsspecifies the input objects to fit

args can contain the following keys :

coordinatesarray of Coordinates objects.
visualHandlesarray of VisualObject handles.
bblHandlesarray of BBLObject handles.
paddinga float, the amount of padding around the input objects as a ratio of plugin width and height.  For example, setting the value 0.1 will add a padding of 5% on the left and right of the input objects (5% + 5% = 10% or 0.1).
Clamped to the range [0, 0.999].
orientationan EulerAngle object, to specify the desired orientation of the computed EyeParams.  If not specified, the current orientation of the Eye will be used.

Returns

EyeParams

@Examples

Throws

Since

Version 1.4.9.0

CreateImage

this.CreateImage = function (url)

Creates an Image.

Parameter

{string} url(optional) source URL of the Image to be created.  GermaniumWeb supports absolute and relative paths.  For relative paths, GermaniumWeb uses window.location as the document base URL to resolve relative paths.  You can change it by calling SetDocumentBase.

Returns

Image

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.1.5.1

CreateVector2

this.CreateVector2 = function (x,
y)

Creates a Vector2.

Parameters

{float} x(optional) the x-component of the Vector2 object to be created
{float} y(optional) the y-component

Default parameter values

x0
y0

Returns

Vector2 if successful; returns null otherwise.

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.3.13.0

CreateVector3

this.CreateVector3 = function (x,
y,
z)

Creates a Vector3.

Parameters

{float} x(optional) the x-component of the Vector3 object to be created
{float} y(optional) the y-component
{float} z(optional) the z-component

Default parameter values

x0
y0
z0

Returns

Vector3 if successful; returns null otherwise.

Since

Version 1.3.2.1

CreateVersion

this.CreateVersion = function (major,
minor,
build,
revision)

Creates a Version.  You can use a Version to check GermaniumWeb plugin version or API version.  A Version consists of 4 components: major, minor, build, and revision.

Parameters

{mixed} majoran int major component or a version string
{int} minor(optional) minor component
{int} build(optional) build component
{int} revision(optional) revision component

Returns

Version

Throws

Usage

CreateVersion(1, 0, 2, 4)Creates the Version “1.0.2.4” using component ints.
CreateVersion(“1.0.2.4”)Creates the Version “1.0.2.4” using version string.

See also

Since

Version 1.2.0.0

CreateHTMLBox

this.CreateHTMLBox = function()

Creates a HTMLBox and adds it to the WebControl.  After creation, the HTMLBox remains hidden until it is shown using HTMLBox.Show or HTMLBox.SetVisibility

Returns

HTMLBox

See also

Since

Version 1.5.0.5

Placemark functions

AddPlacemark

this.AddPlacemark = function (placemark)

Adds the specified Placemark to the scene.

Parameter

{Placemark} placemarkThe Placemark to be added to the scene

Returns

bool

Throws

Since

Version 0.1.0.11

See also

GetNumberOfPlacemarks

this.GetNumberOfPlacemarks = function ()

Returns the number of Placemarks in the scene.

For example, suppose you create 5 placemarks but do not add them to the scene.  This function will return 0.  If you add 3 placemarks to the scene, then this function will return 3.

Returns

int

Throws

”uninitialized_plugin_object” Exception

More information

You can create a placemark by calling CreatePlacemark and add a placemark to the scene by calling AddPlacemark.

See also

Since

Version 0.1.0.11

GetPlacemarkByIndex

this.GetPlacemarkByIndex = function (index)

Gets the Placemark in the scene with the specified index.

Parameter

{int} indexIndex of placemark to be retrieved

Returns

Placemark

Throws

More information

You can create a placemark by calling CreatePlacemark and add a placemark to the scene by calling AddPlacemark.

GermaniumWeb provides you 2 ways to access a placemark: (1) by index and (2) by handle.  See their comparison in Placemark class documentation.

Since

Version 0.1.0.11

GetPlacemarkByHandle

this.GetPlacemarkByHandle = function (handle)

Gets the Placemark in the scene with the specified handle.  Returns null if no such Placemark exists.

Parameter

{string} handleHandle of the Placemark to be retrieved.  Handles are system-generated and non persistent.

Returns

Placemark

Throws

More information

You can create a placemark by calling CreatePlacemark and add a placemark to the scene by calling AddPlacemark.

GermaniumWeb provides you 2 ways to access a placemark: (1) by index and (2) by handle.  See their comparison in Placemark class documentation.

Since

Version 1.0.0.1

HasPlacemark

this.HasPlacemark = function (placemark)

Returns true if the specified Placemark has been added to the scene.

Parameter

{Placemark} placemarkThe Placemark to be checked

Returns

bool

Throws

  • ”invalid_argument” Exception
  • ”uninitialized_plugin_object” Exception

Since

Version 1.0.0.1

See also

RemovePlacemark

this.RemovePlacemark = function (placemark)

Removes the specified Placemark from the scene.

Parameter

{Placemark} placemarkThe Placemark to be removed from the scene

Returns

bool

Throws

Since

Version 0.1.0.11

See also

RemovePlacemarkByIndex

this.RemovePlacemarkByIndex = function (index)

Removes a Placemark from the scene by specifying its index.

Parameter

{int} indexIndex of the Placemark to be removed from the scene.

Returns

bool

Throws

Since

Version 0.1.0.11

See also

RemovePlacemarkByHandle

this.RemovePlacemarkByHandle = function (handle)

Removes a Placemark from the scene by specifying its handle.

Parameter

{string} handleHandle of the Placemark to be removed.  Handles are system-generated and non persistent.

Returns

bool

Throws

Since

Version 1.0.0.1

See also

RemoveAllPlacemarks

this.RemoveAllPlacemarks = function ()

Removes all Placemarks from the scene.

Returns

void

Throws

”uninitialized_plugin_object” Exception

Since

Version 0.1.0.11

GetActivePlacemark

this.GetActivePlacemark = function ()

Gets the Placemark that is currently active.  Returns null if currently there is no active Placemark.

Returns

Placemark

Throws

See also

Since

Version 0.1.0.19

SetActivePlacemark

this.SetActivePlacemark = function (placemark,
bOpenCallout)

Makes the specified Placemark to be the active placemark.  The active placemark’s callout will be opened.  A callout is the balloon that appears when you click on a Placemark or set a placemark as active.

If the specified Placemark is already the active placemark, OnPlacemarkActivated Event is not raised.

The active placemark is the placemark that the user is focusing on.  There is at most one active placemark at any time.  If the active placemark is removed from the scene, it is deactivated first.

Parameter

{Placemark} placemarkthe Placemark to be made active.  If it is not in the scene, this function call is ignored.
{bool} bOpenCallout(optional) specify whether to open the placemark’s callout balloon.

Returns

void

Events

  • OnPlacemarkActivated if placemark is not null
  • OnPlacemarkDeactivate if placemark is null

Throws

See also

Since

Version 0.1.0.19

UnsetActivePlacemark

this.UnsetActivePlacemark = function ()

Deactivates the active placemark.

Returns

void

Event

OnPlacemarkDeactivate

Throws

See also

Since

Version 0.2.0.36

OpenActivePlacemarkCallout

this.OpenActivePlacemarkCallout = function ()

Opens the active placemark’s callout.  Has no effect if there is no active placemark.

Returns

void

Since

Version 1.5.5.0

IsCalloutOpen

this.IsCalloutOpen = function ()

Returns true if a callout is currently open.  A callout is the balloon that appears when you click on a Placemark or set a placemark as active.

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 0.3.2.0

CloseCallout

this.CloseCallout = function ()

Closes any callout currently open without deactivating the active placemark.  A callout is the balloon that appears when you click on a Placemark or set a placemark as active.

Returns

void

Throws

”uninitialized_plugin_object” Exception

Since

Version 0.3.2.0

Clip Plane functions

GetClipPlane

this.GetClipPlane = function (index)

Gets the ClipPlane with the specified index.

Parameter

{int} indexIndex of clip plane to be retrieved

Returns

ClipPlane

Throws

Since

Version 1.3.10.0

EnableAllClipPlanes

this.EnableAllClipPlanes = function ()

Convenience function to make all 6 ClipPlanes operational.

Returns

void

Event

OnClipPlaneEnabled

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.3.10.0

DisableAllClipPlanes

this.DisableAllClipPlanes = function ()

Convenience function to stop all 6 ClipPlanes from being operational.

Returns

void

Event

OnClipPlaneDisabled

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.3.10.0

HideAllClipPlanes

this.HideAllClipPlanes = function ()

Convenience function to make all 6 ClipPlanes invisible.

Returns

void

Event

OnClipPlaneHidden

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.3.10.0

ShowAllClipPlanes

this.ShowAllClipPlanes = function ()

Convenience function to make all 6 ClipPlanes visible.

Returns

void

Event

OnClipPlaneShown

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.3.10.0

MoveAllClipPlanes

this.MoveAllClipPlanes = function (V)

Convenience function to move all 6 ClipPlanes.

  • If the input parameter V is a float, then it is treated as distance; this ClipPlane moves V meters along the direction of its normal vector.
  • If the input parameter V is a Vector3 object, then it is treated as displacement vector; this ClipPlane moves according to displacement vector V.

Parameter

{mixed} Va Vector3 or a float

Returns

void

Event

OnClipPlaneTransformed

Throws

Since

Version 1.3.10.0

Handling Events

AddEventHandler

this.AddEventHandler = function (eventName,
fnHandler)

Adds a custom event handler to the specified Event.

Remember to remove your event handler when cleaning up.  You can do so by calling the function RemoveEventHandler.

Parameters

{string} eventNameName of Event to listen to.
{function} fnHandlerName of custom event handler (the JavaScript function to call when the Event fires).

Sample usage

Here is how you can add an anonymous function as an event handler (assuming that we store WebControl object in the variable germ).

germ.AddEventHandler(Germanium.Event.OnMouseClick,
    function (event) {
        alert("Event triggered: name = " + event.name);
    });

Note that using a named function as an event handler allows you to remove it later using RemoveEventHandler.  Here is how you can add a named function as an event handler.

function mouseEventHandler(event)
{
    alert("Event triggered: name = " + event.name);
}
germ.AddEventHandler(Germanium.Event.OnMouseClick, mouseEventHandler);

Returns

void

Throws

See also

Since

Version 0.0.10

RemoveEventHandler

this.RemoveEventHandler = function (eventName,
fnHandler)

Removes a custom event handler from the specified Event.  Event names are listed in Event.Event names.

Parameters

{string} eventNameName of event.
{function} fnHandlerName of custom event handler (a JavaScript function) to remove.

Returns

void

Throws

See also

Event.Event names

Since

Version 0.0.10

RemoveAllEventHandlers

this.RemoveAllEventHandlers = function (eventName)

Removes all custom event handlers from the specified Event.  Event names are listed in Event.Event names.  If no Event is specified, will remove all custom event handlers for all events.

Parameters

{string} eventName(optional) Name of event.

Returns

void

Throws

See also

Event.Event names

Since

Version 0.2.5.0

Navigation Mode

SetNavigationMode

this.SetNavigationMode = function (mode)

Sets the navigation mode.  The navigation mode controls how GermaniumWeb navigates the 3D scene.

Parameter

{int} modeSee Navigation for possible values.

Returns

booltrue if navigation mode change succeeds; false otherwise.

Throws

Since

Version 1.4.6.3

GetNavigationMode

this.GetNavigationMode = function ()

Gets the navigation mode currently enabled.  The navigation mode controls how GermaniumWeb navigates the 3D scene.

Returns

intSee Navigation for possible values

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.4.6.3

IsInNavigationMode

this.IsInNavigationMode = function (inMode)

Queries if the specified navigation mode is currently enabled.  The navigation mode controls how GermaniumWeb navigates the 3D scene.

Parameter

{int} inModeSee Navigation for possible values

Returns

booltrue if inMode is currently enabled; false otherwise

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.4.6.3

Utility functions

DegreeToRadian

this.DegreeToRadian = function (inDeg)

Deprecated; use Germanium.DegreeToRadian instead.  Converts input angle from degrees to radians.

Parameter

{float} inDegthe angle to be converted, in degrees

Returns

float

Throws

”invalid_argument” Exception

Since

Version 1.1.2.0

Deprecated in

Version 1.2.3.0

RadianToDegree

this.RadianToDegree = function (inRad)

Deprecated; use Germanium.RadianToDegree instead.  Converts input angle from radians to degrees.

Parameter

{float} inRadthe angle to be converted, in radians

Returns

float

Throws

”invalid_argument” Exception

Since

Version 1.1.2.0

Deprecated in

Version 1.2.3.0

IsPointGeometry

this.IsPointGeometry = function (geometry)

Tests if input Geometry is a PointGeometry.

Parameter

{Geometry} geometryGeometry object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 0.1.0.15

IsLineStringGeometry

this.IsLineStringGeometry = function (geometry)

Tests if input Geometry is a LineStringGeometry.

Parameter

{Geometry} geometryGeometry object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.5.5.5

IsPolygonGeometry

this.IsPolygonGeometry = function (geometry)

Tests if input Geometry is a PolygonGeometry.

Parameter

{Geometry} geometryGeometry object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.5.5.5

IsModelGeometry

this.IsModelGeometry = function (geometry)

Tests if input Geometry is a ModelGeometry.

Parameter

{Geometry} geometryGeometry object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.5.5.5

IsArrowStyle

this.IsArrowStyle = function (style)

Tests if input GeometryStyle is an ArrowStyle.

Parameter

{GeometryStyle} styleGeometryStyle object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.1.7.0

IsDiamondStyle

this.IsDiamondStyle = function (style)

Tests if input GeometryStyle is a DiamondStyle.

Parameter

{GeometryStyle} styleGeometryStyle object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 0.1.0.15

IsIconStyle

this.IsIconStyle = function (style)

Tests if input GeometryStyle is an IconStyle.

Parameter

{GeometryStyle} styleGeometryStyle object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.1.7.0

IsLineStyle

this.IsLineStyle = function (style)

Tests if input GeometryStyle is a LineStyle.

Parameter

{GeometryStyle} styleGeometryStyle object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.5.5.5

IsPolygonStyle

this.IsPolygonStyle = function (style)

Tests if input GeometryStyle is a PolygonStyle.

Parameter

{GeometryStyle} styleGeometryStyle object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.5.5.5

IsModelStyle

this.IsModelStyle = function (style)

Tests if input GeometryStyle is an ModelStyle.

Parameter

{GeometryStyle} styleGeometryStyle object to test

Returns

bool

Throws

”uninitialized_plugin_object” Exception

Since

Version 1.5.5.5

HTMLBox functions

GetNumberOfHTMLBoxes

this.GetNumberOfHTMLBoxes = function ()

Returns the number of HTMLBoxes on the WebControl.  This includes any HTMLBoxes that are currently hidden.

Returns

int

See also

CreateHTMLBox, RemoveHTMLBox

Since

Version 1.5.0.5

GetHTMLBoxByIndex

this.GetHTMLBoxByIndex = function (index)

Gets the HTMLBox with the specified index.

Parameter

{int} indexIndex of the HTMLBox to be retrieved.

Returns

HTMLBox

Throws

See also

GetHTMLBoxByHandle

Since

Version 1.5.0.5

GetHTMLBoxByHandle

this.GetHTMLBoxByHandle = function (strHandle)

Gets the HTMLBox with the specified handle.  Returns null if no such HTMLBox exists.

Parameter

{string} handleHandle of the HTMLBox to be retrieved.  Handles are system-generated and non persistent.

Returns

HTMLBox

Throws

”invalid_argument” Exception

See also

GetHTMLBoxByIndex

Since

Version 1.5.0.5

RemoveHTMLBox

this.RemoveHTMLBox = function (box)

Removes the specified HTMLBox.

Parameter

{HTMLBox} boxThe HTMLBox to be removed.

Returns

void

Throws

”invalid_argument” Exception

See also

RemoveHTMLBoxByIndex, RemoveHTMLBoxByHandle

Since

Version 1.5.0.5

RemoveHTMLBoxByIndex

this.RemoveHTMLBoxByIndex = function (index)

Removes a HTMLBox by specifying its index.

Parameter

{int} indexIndex of the HTMLBox to be removed.

Returns

void

Throws

See also

RemoveHTMLBox, RemoveHTMLBoxByHandle

Since

Version 1.5.0.5

RemoveHTMLBoxByHandle

this.RemoveHTMLBoxByHandle = function (strHandle)

Removes a HTMLBox by specifying its handle.

Parameter

{string} handleHandle of the HTMLBox to be retrieved.  Handles are system-generated and non persistent.

Returns

void

Throws

”invalid_argument” Exception

See also

RemoveHTMLBox, RemoveHTMLBoxByIndex

Since

Version 1.5.0.5

ShowAllHTMLBoxes

this.ShowAllHTMLBoxes = function ()

Shows all HTMLBoxes.

Returns

void

See also

HTMLBox.Show, HTMLBox.SetVisibility

Since

Version 1.5.0.5

HideAllHTMLBoxes

this.HideAllHTMLBoxes = function ()

Hides all HTMLBoxes.

Returns

void

See also

HTMLBox.Hide, HTMLBox.SetVisibility

Since

Version 1.5.0.5

RemoveAllHTMLBoxes

this.RemoveAllHTMLBoxes = function ()

Removes all HTMLBoxes.

Returns

void

See also

RemoveHTMLBox

Since

Version 1.5.0.5

this.GetPluginVersion = function ()
Returns the version of GermaniumWeb plugin installed on the user’s computer.
this.SetFocus = function ()
Sets the focus of the HTML page to the GermaniumWeb plugin object.
this.GetEye = function ()
Gets the Eye through which we view the 3D scene.
Represents the eye through which we see the scene.
this.GetOptions = function ()
Gets the Options object that controls the behaviour of GermaniumWeb plugin, such as using a sky box and showing the navigation buttons.
Stores states that determine GermaniumWeb behaviour, such as the background color.
this.SetSize = function (width,
height)
Sets the width and height of the plugin area on web page (unit is pixels).
this.GetWidth = function ()
Returns the width of the plugin area on the web page.
this.GetHeight = function ()
Returns the height of the plugin area on the web page.
this.SetDocumentBase = function (inString)
Sets the document base URL to resolve relative paths.
this.GetDocumentBase = function ()
Gets the document base URL used to resolve relative paths.
this.Load = function (filePath,
options,
successCallback,
failureCallback)
Loads the specified building file and adds Buildings to the scene.
Represents a building (for example “Suntec City”).
this.UnloadAll = function ()
Unloads all objects currently in scene.
this.ShowAllBuildings = function (bUpdateChildren)
Shows all Buildings currently loaded.
this.HideAllBuildings = function (bUpdateChildren)
Hides all Buildings currently loaded.
this.GetNumberOfBuildings = function ()
Returns the number of Buildings in the scene.
this.GetBuildingByHandle = function (strHandle)
Gets the Building in the scene with the specified handle.
this.GetBlockByHandle = function (strHandle)
Gets the Block in the scene with the specified handle.
Represents a block or a wing (for example “Tower 1” in Suntec City).
this.GetLevelByHandle = function (strHandle)
Gets the Level in the scene with the specified handle.
Represents a level (for example “basement level” of Tower 1 in Suntec City).
this.GetBuildingByBBLId = function (strBBLId)
Gets the Building in the scene with the specified BBL ID.
this.GetBlockByBBLId = function (strBldgBBLId,
strBlkBBLId)
Gets the respective Block with the matching building and block BBL IDs.
this.GetLevelByBBLId = function (strBldgBBLId,
strBlkBBLId,
strLvlBBLId)
Gets the respective Level with the matching building, block and level BBL IDs.
this.GetBuildingByIndex = function (index)
Gets the Building in the scene with the specified index.
this.GetBuildingByName = function (name)
Gets the Building in the scene with the specified name.
this.GetPrimaryBuilding = function ()
Convenience function to get the first Building in the scene.
this.GetPrimaryBlock = function (index)
Convenience function to get the index-th Block in the scene.
this.GetPrimaryLevel = function (index)
Convenience function to get the index-th Level in the scene.
this.GetLevelCursor = function ()
Gets the LevelCursor that allows us to explore the BBL structure of the scene.
Warning: Experimental feature.
this.CreatePlacemark = function (name,
content,
geom,
styleSet,
infoUrl,
interactive)
Creates a Placemark.
Represents a position marker.
this.CreatePointGeometry = function (X,
y,
z)
Creates a PointGeometry (contains location of a Placemark).
Represents a point in the 3D scene.
this.CreateLineStringGeometry = function ()
Creates a LineStringGeometry.
Represents a connected group of line segments in the 3D scene.
this.CreatePolygonGeometry = function (X,
y,
z)
Creates a PolygonGeometry.
Represents a polygon in the 3D scene.
this.CreateModelGeometry = function (url,
pos,
ort,
scale)
Creates a ModelGeometry.
Represents a model in a 3D scene.
this.CreateStyleSet = function (inGeomStyle,
inLabelStyle,
inBalloonStyle)
Creates a StyleSet (contains style of a Placemark by default).
Stores Style objects that control the visual appearance of a VisualObject.
this.CreateArrowStyle = function (color,
thickness,
width,
headLength,
tailLength,
headStyle,
tailStyle)
Creates an ArrowStyle (controls visual appearance of a Placemark).
Gives a Placemark the appearance of a 3D arrow.
this.CreateDiamondStyle = function (color,
width,
upperHeight,
lowerHeight)
Creates a DiamondStyle (controls visual appearance of a Placemark).
Gives a Placemark the appearance of a 3D diamond.
this.CreateIconStyle = function (image,
hotspotX,
hotspotY)
Creates an IconStyle (controls visual appearance of a Placemark).
Gives a Placemark the appearance of a 2D image icon.
this.CreateLineStyle = function (color,
pattern,
patternScale,
width,
animationMode)
Creates a LineStyle (controls visual appearance of a Placemark).
Controls the appearance of a Placemark that has a LineStringGeometry object as its geometry property.
this.CreateModelStyle = function (useLoadingIcon)
Creates an ModelStyle (controls visual appearance of a Placemark).
Controls the appearance of a Placemark that has a ModelGeometry object as its geometry property.
this.CreatePolygonStyle = function (fillColor,
fillMode,
outlineColor,
outlineWidth)
Creates a PolygonStyle (controls visual appearance of a Placemark).
Controls the appearance of a Placemark that has a PolygonGeometry object as its geometry property.
this.CreateLabelStyle = function (color)
Creates a LabelStyle (controls visual appearance of a Placemark’s text label).
Controls the appearance of label text of a VisualObject.
this.CreateBalloonStyle = function (bShowCloseButton,
bgColor,
outlineColor)
Creates a BalloonStyle (controls visual appearance of a Placemark’s callout balloon).
Controls callout appearance of a Placemark.
this.CreateColor = function (R,
g,
b,
a)
Creates a Color.
Represents a color.
this.CreateRandomColor = function (maskR,
maskG,
maskB,
A)
Creates a random Color.
this.CreateCoordinates = function (x,
y,
z)
Creates a Coordinates (unit is meters).
Represents a point in 3D Cartesian space.
this.CreateEulerAngle = function (tilt,
heading,
z)
Creates an EulerAngle (unit is radians).
Represents an orientation in 3D space in the form of Euler angles.
this.CreateEulerAngleByLookingAt = function (pointFrom,
pointTo)
Creates an EulerAngle by specifying (pointFrom, pointTo) pair.
this.CreateEyeParams = function (x,
y,
z,
p,
q,
r,
t)
Creates an EyeParams.
A container to store parameters of the Eye object.
this.CreateEyeParamsToFitObjects = function (args)
Returns the EyeParams that best fits the input Coordinates, VisualObjects, and BBLObjects.
An abstract class; base class for Placemark class.
An abstract class; base class for Building, Block, and Level classes.
this.CreateEyeParamsToFitObjectsByHandle = function (args)
Returns the EyeParams that best fits the input Coordinates, VisualObjects, and BBLObjects specified by their handles.
this.CreateImage = function (url)
Creates an Image.
Represets a 2D image.
this.CreateVector2 = function (x,
y)
Creates a Vector2.
Represents a vector with 2 components.
this.CreateVector3 = function (x,
y,
z)
Creates a Vector3.
Represents a vector with 3 components.
this.CreateVersion = function (major,
minor,
build,
revision)
Creates a Version.
Represents a version number.
this.CreateHTMLBox = function()
Creates a HTMLBox and adds it to the WebControl.
Represents a 2D box that may contain HTML content.
this.AddPlacemark = function (placemark)
Adds the specified Placemark to the scene.
this.GetNumberOfPlacemarks = function ()
Returns the number of Placemarks in the scene.
this.GetPlacemarkByIndex = function (index)
Gets the Placemark in the scene with the specified index.
this.GetPlacemarkByHandle = function (handle)
Gets the Placemark in the scene with the specified handle.
this.HasPlacemark = function (placemark)
Returns true if the specified Placemark has been added to the scene.
this.RemovePlacemark = function (placemark)
Removes the specified Placemark from the scene.
this.RemovePlacemarkByIndex = function (index)
Removes a Placemark from the scene by specifying its index.
this.RemovePlacemarkByHandle = function (handle)
Removes a Placemark from the scene by specifying its handle.
this.RemoveAllPlacemarks = function ()
Removes all Placemarks from the scene.
this.GetActivePlacemark = function ()
Gets the Placemark that is currently active.
this.SetActivePlacemark = function (placemark,
bOpenCallout)
Makes the specified Placemark to be the active placemark.
this.UnsetActivePlacemark = function ()
Deactivates the active placemark.
this.OpenActivePlacemarkCallout = function ()
Opens the active placemark’s callout.
this.IsCalloutOpen = function ()
Returns true if a callout is currently open.
this.CloseCallout = function ()
Closes any callout currently open without deactivating the active placemark.
this.GetClipPlane = function (index)
Gets the ClipPlane with the specified index.
Represents a special plane that allows us to temporarily cut through the scene and see the cross section of the scene.
this.EnableAllClipPlanes = function ()
Convenience function to make all 6 ClipPlanes operational.
this.DisableAllClipPlanes = function ()
Convenience function to stop all 6 ClipPlanes from being operational.
this.HideAllClipPlanes = function ()
Convenience function to make all 6 ClipPlanes invisible.
this.ShowAllClipPlanes = function ()
Convenience function to make all 6 ClipPlanes visible.
this.MoveAllClipPlanes = function (V)
Convenience function to move all 6 ClipPlanes.
this.AddEventHandler = function (eventName,
fnHandler)
Adds a custom event handler to the specified Event.
Contains the name and properties of an event that has occurred.
this.RemoveEventHandler = function (eventName,
fnHandler)
Removes a custom event handler from the specified Event.
this.RemoveAllEventHandlers = function (eventName)
Removes all custom event handlers from the specified Event.
this.SetNavigationMode = function (mode)
Sets the navigation mode.
this.GetNavigationMode = function ()
Gets the navigation mode currently enabled.
this.IsInNavigationMode = function (inMode)
Queries if the specified navigation mode is currently enabled.
this.DegreeToRadian = function (inDeg)
Deprecated; use Germanium.DegreeToRadian instead.
Germanium.DegreeToRadian = function (inDeg)
Converts input angle from degrees to radians.
this.RadianToDegree = function (inRad)
Deprecated; use Germanium.RadianToDegree instead.
Germanium.RadianToDegree = function (inRad)
Converts input angle from radians to degrees.
this.IsPointGeometry = function (geometry)
Tests if input Geometry is a PointGeometry.
An abstract class; base class for concrete geometry classes.
this.IsLineStringGeometry = function (geometry)
Tests if input Geometry is a LineStringGeometry.
this.IsPolygonGeometry = function (geometry)
Tests if input Geometry is a PolygonGeometry.
this.IsModelGeometry = function (geometry)
Tests if input Geometry is a ModelGeometry.
this.IsArrowStyle = function (style)
Tests if input GeometryStyle is an ArrowStyle.
An abstract class; base class for concrete geometry style classes.
this.IsDiamondStyle = function (style)
Tests if input GeometryStyle is a DiamondStyle.
this.IsIconStyle = function (style)
Tests if input GeometryStyle is an IconStyle.
this.IsLineStyle = function (style)
Tests if input GeometryStyle is a LineStyle.
this.IsPolygonStyle = function (style)
Tests if input GeometryStyle is a PolygonStyle.
this.IsModelStyle = function (style)
Tests if input GeometryStyle is an ModelStyle.
this.GetNumberOfHTMLBoxes = function ()
Returns the number of HTMLBoxes on the WebControl.
this.GetHTMLBoxByIndex = function (index)
Gets the HTMLBox with the specified index.
this.GetHTMLBoxByHandle = function (strHandle)
Gets the HTMLBox with the specified handle.
this.RemoveHTMLBox = function (box)
Removes the specified HTMLBox.
this.RemoveHTMLBoxByIndex = function (index)
Removes a HTMLBox by specifying its index.
this.RemoveHTMLBoxByHandle = function (strHandle)
Removes a HTMLBox by specifying its handle.
this.ShowAllHTMLBoxes = function ()
Shows all HTMLBoxes.
this.HideAllHTMLBoxes = function ()
Hides all HTMLBoxes.
this.RemoveAllHTMLBoxes = function ()
Removes all HTMLBoxes.
Contains information describing the cause of an error.
Germanium.GetAPIVersion = function ()
Returns the version of GermaniumWeb API used on a web page.
SetSourceUrl : function (url)
Sets the source URL of this ModelGeometry.
Status enumeration for loading building files.
This section documents classes you can use to work with a building.
GetBlockByIndex : function (idx)
Returns the Block in this Building with the specified index.
GetLevelByIndex : function (idx)
Returns the Level in this Block with the specified index.
GetBlockByBBLId : function (strBBLId)
Returns the Block in this Building with the specified BBL ID.
GetLevelByBBLId : function (strBBLId)
Returns the Level in this Block with the specified BBL ID.
GetBlockByName : function (name)
Returns the Block in this Building with the specified name.
GetLevelByName : function (name)
Returns the Level in this Block with the specified name.
GetBlockByHandle : function (strHandle)
Returns the Block in this Building with the specified Handle.
GetLevelByHandle : function (strHandle)
Returns the Level in this Block with the specified Handle.
This section explains how you can get BBL objects using handle, index, & BBL ID.
SetContent : function (content)
Sets the content property of this Placemark.
Controls line pattern of a LineStyle or a PolygonStyle.
Controls how line pattern is animated.
Controls how a PolygonStyle is shown in the scene.
Show : function ()
Makes this HTMLBox visible.
SetVisibility : function (bVal)
Sets the visibility state of this HTMLBox
Enumeration of navigation modes in GermaniumWeb.
Hide : function ()
Hides this HTMLBox.