AutoCAD Map 3D 2009 Geospatial Platform Reference

AutoCAD Map 3D Geospatial Platform API

MgInsertFeatures::MgInsertFeatures ( CREFSTRING  className,
MgBatchPropertyCollection propertyValueCollection 
)

Constructs an insert command containing many features.

Remarks:
Do not clear or close the MgBatchPropertyCollection object until after you have called MgFeatureService::UpdateFeatures. The constructor does not do a deep copy of the collection object.
.NET Syntax
MgInsertFeatures(string className, MgBatchPropertyCollection propertyValueCollection);
Java Syntax
MgInsertFeatures(String className, MgBatchPropertyCollection propertyValueCollection);
PHP Syntax
MgInsertFeatures(string className, MgBatchPropertyCollection propertyValueCollection);

Parameters:
className (String/string) The name of the class in the schema definition in the feature source used to create the feature instances to be inserted.
propertyValueCollection (MgBatchPropertyCollection) The collection of property collections to be inserted into the feature source. Each collection contains the property values for one feature.
Example (PHP)
 <?php
 $batchPropertyCollection = new MgBatchPropertyCollection();
 $featCmdCollection = new MgFeatureCommandCollection();
 for($i = 0; $i < 2; $i++)
 {
    $col = new MgPropertyCollection();
    $featIdProp = new MgInt32Property($i);
    $col->Add($featIdProp);
    $batchPropertyCollection->Add($col);
 }
 $insertFeatures = new MgInsertFeatures("featClass", $batchPropertyCollection);
 $featCmdCollection->Add($insertFeatures);
 $useTransaction = false;
 $featureService->UpdateFeatures($featureSrcResourceId, $featCmdCollection, $useTransaction);
 ?>