Home > Working with SGWorld > Creator (ICreator6) > CreateDynamicObject

CreateDynamicObject

The CreateDynamicObject creates a dynamic object with waypoints.

 

JavaScript

 

CreateDynamicObject(

      Waypoints ,

      MotionStyle ,

      ObjectType ,

      FileNameOrText ,

      ScaleFactor ,

      AltitudeType ,

      GroupID ,

      Description )

 

C#

 

ITerrainDynamicObject6 CreateDynamicObject(

   object    Waypoints = 0,

   DynamicMotionStyle    MotionStyle = DynamicMotionStyle.MOTION_AIRPLANE,

   DynamicObjectType     ObjectType = DynamicObjectType.DYNAMIC_VIRTUAL,

   string    FileNameOrText = "",

   double    ScaleFactor = 1,

   AltitudeTypeCode      AltitudeType = AltitudeTypeCode.ATC_TERRAIN_RELATIVE,

   int GroupID = 0,

   string    Description = "")

 

C++

 

HRESULT CreateDynamicObject(

       VARIANT Waypoints

       DynamicMotionStyle MotionStyle,

       DynamicObjectType ObjectType,

       BSTR FileNameOrText,

       double ScaleFactor,

       AltitudeTypeCode AltitudeType,

       LONG_PTR GroupID,

       BSTR Description,

       ITerrainDynamicObject6 ** pITerrainDynamicObject6) 

Parameters

Waypoints

An array that contains triplets of doubles representing each waypoint. Each triplet is composed of an x-coordinate, a height, and a y-coordinate.

MotionStyle

An enum that determines the style of motion of the dynamic object. The following are the possible DynamicMotionStyle values:

§  MOTION_GROUND_VEHICLE = 0
The object is a ground vehicle.

§  MOTION_AIRPLANE = 1
The object sets the pitch angles during the flight according to altitude differences between the waypoints. It also rolls while turning between the waypoints.

§  MOTION_HELICOPTER = 2
The object leans forward with a fixed pitch angle of –15 degrees. It also rolls while turning between the waypoints.

§  MOTION_HOVER = 3
The object always keeps the pitch and roll angels set to zero.

ObjectType

An enum that determines the type of object to be used for the dynamic object. The following are the possible DynamicObjectType values:

§  DYNAMIC_3D_MODEL = 0
A 3D model is used.

§  DYNAMIC_TEXT_LABEL = 1
A text label is used.

§  DYNAMIC_IMAGE_LABEL = 2
An image label is used.

§  DYNAMIC_VIRTUAL = 3
A virtual type is used. You can attach any object to the virtual dynamic object.

FileNameOrText

If the ObjectType value is set to DYNAMIC_TEXT_LABEL, this parameter is the image label text. If ObjectType is set to DYNAMIC_3D_MODEL or DYNAMIC_IMAGE_LABEL, this is the 3D model file, or image label image file, respectively, to be used.

ScaleFactor

If the ObjectType value is set to DYNAMIC_3D_MODEL, this parameter is the scale value of the 3D model. If ObjectType value is set to DYNAMIC_TEXT_LABEL, or DYNAMIC_IMAGE_LABEL, this is the scale of the label.

AltitudeType

An enum that determines the altitude type to be used by the shape. The following are the possible AltitudeType values:

·         ATC_TERRAIN_RELATIVE = 0

·         ATC_TERRAIN_ABSOLUTE = 3

Relative to Terrain - Places the shape’s pivot point at a specified altitude above the ground.

Absolute - Places the shape’s pivot point at a specified altitude above the terrain database vertical datum base ellipsoid.

GroupID

The Project Tree group in which the dynamic object is created. If it is set to zero, the object is created under the root. You can obtain the GroupID by one of the following methods:

§   Create the group using IProjectTree6.CreateGroup.

§  Find the group, if you know the name, using IProjectTree6.FindItem.

§  Traverse the Tree using IProjectTree6 methods such as GetNextItem(), until you come to the desired GroupID.

Description

The name of the dynamic object as it appears in the Project Tree. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.

Return Value

pITerrainDynamicObject6

An ITerrainDynamicObject6, representing the newly created dynamic object.

Exceptions

See: HRESULT Return Values for a list of possible values returned by the HRESULT.