SGPosition Constructor

Initializes a new instance of the SGPosition class.

SGPosition(x, y, [height], [yaw], [pitch], [distance], [heightType]);

SGPosition(coord);

SGPosition(arr);

SGPosition(strStream);

 

Parameter

Description

x

x coordinate, usually longitude

y

y coordinate, usually latitude

height

Optional, default: undefined

Height of the coordinate

yaw

Optional, default: undefined

The direction in which the camera/object should be looking

pitch

Optional, default: undefined

The tilt angle in which the camera/object should be looking

distance

Optional, default: undefined

If the SGPosition describes a point of interest, this property determines the distance between the camera and the POI (x,y,height)

heightType

Optional, default: sgHeightRelative

Can be one of the following:

sgHeightRelative – the height of the coordinate above the ground
sgHeightOnTerrain
– the height parameter is ignored and the coordinate is on the terrain

sgHeightAbsolute – the absolute height (above sea level)

coord

Constructs an SGPosition object from another coordinate Can be  SGCoord2D, SGCoord3D or SGPosition

arr

An array of coordinate objects or SGNode objects

strStream

Construct SGPosition object from a string. The string can have one of the following formats:

  1. “SGPosition(x,y,height,yaw,pitch,distance,heightType,roll)”
    e.g., “SGPosition(100.0,30.0,10.0,0,0,500,sgHeightOnTerrain,0)”

  2. <SGPosition >
        <x>x</x>
        <y>y</y>
        <height>height</height>
        <yaw>yaw</yaw>
        <pitch>pitch</pitch>
        <roll>roll</roll>
        <distance>distance</distance>
        <heightType>heightType</heightType>
     </SGPosition>”
    e.g., “<SGPosition >
               <x>100.0</x>
               <y>30.0</y>
               <height>10.0</height>
               <yaw>0.0</yaw>
               <pitch>0.0</pitch>
               <roll>0.0</roll>         
               <distance>500.0</height>
               <heightType>sgHeightOnTerrain<heightType>
            </SGPosition>”