AGI STK Esri Display 11 Send comments on this topic.
CreateObject Method (IAgEsri3dRendererContext)
See Also 
ProgID
The program ID of the object to create.





Description

Creates an instance of a component in the GIS thread.

Syntax

[Visual Basic .NET]
Public Function CreateObject( _
   ByVal ProgID As String _
) As Object

[C#]
public Object CreateObject(
string ProgID
);

[Managed C++]
public: IUnknown^ CreateObject(
String __gc ^ ProgID
);

[Java]
public Object createObject(
String ProgID
);

[Unmanaged C++]
public: HRESULT CreateObject(
BSTR ProgID,
IUnknown ** ReturnValue
);

Parameters

ProgID
The program ID of the object to create.

Return Type

Returns the new object allocated in the GIS thread for this context.

Remarks

Use this method when you need to create an object in the GIS thread.

CreateObject will return a proxy to the object that is in the GIS context. Your application can make use of the proxy as if the object was created locally within its current thread. If you call a method on the proxy that hands back another object, that object will actually be in the GIS context and your application will be handed back a proxy to that object. For instance, if you get a point from the point collection using IPointCollection::Point(), the point returned will be in the same context as the point collection.

If you add a point to the point collection using IPointCollection::AddPoint(), the point should be in the same context as the point collection.

This is conceptually similar to the CreateObject of the IServerContext interface in the ESRI.ArcGIS.Server library. The same rules and guidelines apply.

Example

[C#] 

Consider the following examples. In each example, assume that objects with [InGISThread] in their names are objects living in a GIS context as in:

IPoint pointInGISThread = rendererContext.CreateObject("esriGeometry.Point") as IPoint;

while objects with [InCurrentThread] in their names are objects created locally as in:

IEnvelope envelopeInCurrentThread = new EnvelopeClass();

Do not set a local object, or a property of a local object, to be an object obtained from a GIS context:

// this is incorrect
envelopeInCurrentThread.LowerLeft = pointInGISThread ;

When calling a method on an object in the GIS thread, do not pass in local objects as parameters:

// this is incorrect
envelopeInGISThread.CenterAt(pointInLocalThread);

You can get simple data types (double, long, string, etc) that are passed by value from a remote object and use them as properties of a local object as in:

// this is OK
localPoint.X = gisPoint.X;
localPoint.Y = gisPoint.Y;

See Also

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1