Creates a new point of interest in the Skyline Globe world.
createLocation([location], [name]);
Parameter |
Description |
location |
Optional, if a location is not specified, a location that represents the current camera position is created An SGPosition object The x,y and height properties of the object represent the location of the point of interest. The distance property represents the distance between the viewer and the POI. The yaw and pitch properties represent the yaw and pitch of the viewer. |
name |
Optional The node name |
Return Value
An SGNode object. If the method fails, the return value is null. SGWorld.lastError will contain the failure reason.
Remarks
To modify other properties of the location, access the node innerObj. See SGNode.innerObj property and ITerrainLocation5 interface for more details.
Locations are always viewed from a pre-determined direction. Flying to a location object (e.g., using the SGWorld.navigate.FlyTo method) will always result ending up at the same position. Unlike SGPosition object, location objects that are a specific type of SGNode, can be saved and have additional properties such as name.
Example
In Skyline Globe, a location is defined as a point of interest (x, y, height). The camera is given a direction and distance from which this point of interest is viewed. If the White House is chosen as the point of interest, its x and y coordinates need to be found. SGPosition object will be created from those coordinates and passed to the createLocation method. In addition, a label can also be placed above the location identifying it as the White House.
function createLocation()
{
var WhiteHouseLocation = globe.creator.createLocation(
new SGPosition(-77.03657, 38.89761, 0, 90, -30, 400),
"The White House"
);
globe.root.appendChild(WhiteHouseLocation);
globe.navigate.flyTo(WhiteHouseLocation);
}