AutoCAD Map 3D 2009 Geospatial Platform Reference

AutoCAD Map 3D Geospatial Platform API

MgInsertFeatures Class Reference
[MgInsertFeatures]

Inherits MgFeatureCommand.

List of all members.


Detailed Description

Creates an insert feature data command. You must add this command to an MgFeatureCommandCollection object and pass the latter in a call to MgFeatureService::UpdateFeatures.

Remarks:
If you inserting one feature, you can create the command using the MgInsertFeatures::MgInsertFeatures Constructor (CREFSTRING, MgPropertyCollection*) . If you are inserting many features, you can create the command using the MgInsertFeatures::MgInsertFeatures Constructor (CREFSTRING, MgBatchPropertyCollection*) .
Procedure
  1. Get the property definitions for the class. See MgClassDefinition::GetProperties Method . As a minimum, you must create property values for each of the properties defined as mandatory. See MgDataPropertyDefinition::GetNullable Method and MgRasterPropertyDefinition::GetNullable Method .
  2. Create a property object for each property value appropriate to the type of the value; for example, use the MgGeometryProperty class to create an object containing a geometry value and use the MgBooleanProperty class to create an object containing a boolean value; the property class constructor is passed the name of the property and its value. See Feature Properties .
  3. Add each property object to an MgPropertyCollection object
  4. Create the insert command
    1. Pass the class name and the property collection to the MgInsertFeatures::MgInsertFeatures Constructor (CREFSTRING, MgPropertyCollection*) and go on to step 5, or
    2. Add the MgPropertyCollection object to an MgBatchPropertyCollection object, and
    3. Create and add MgPropertyCollection objects to the batch property collection for all of the features that you want to add, and
    4. Pass the class name and batch property collection to the MgInsertFeatures::MgInsertFeatures Constructor (CREFSTRING, MgBatchPropertyCollection*) and go on to step 5
  5. Add the MgInsertFeatures object to an MgFeatureCommandCollection object.
  6. Execute the MgFeatureServices::UpdateFeatures() method; the arguments are a resource identifier for the feature source and the MgFeatureCommandCollection object.
  7. Check the result. The result is an MgPropertyCollection object. 1. For each insert command constructed with an MgPropertyCollection object argument, there will be one property of type MgPropertyType::Feature in the collection. This property is an MgFeatureReader object containing the properties that were inserted.

The following illustration shows the relationships among the classes used in creating the arguments for a call to MgFeatureService::UpdateFeatures(), which contains one insertion command:
InsertFeatures.png

Public Member Functions

INT32 GetCommandType () const
 Gets the type of the command, that is, MgFeatureCommandType::InsertFeatures.
STRING GetFeatureClassName () const
 
MgPropertyCollectionGetPropertyValues () const
 
 MgInsertFeatures (CREFSTRING className, MgBatchPropertyCollection *propertyValueCollection)
 Constructs an insert command containing many features.
 MgInsertFeatures (CREFSTRING className, MgPropertyCollection *propertyValues)
 Constructs an insert command containing one feature.