Provides access to members that control the behavior of the field mapping tools.
Product Availability
Members
Description | ||
---|---|---|
DeleteFieldMap | Delete an individual field map (source or destination). | |
FieldMap | Enum of field maps. | |
GetSourceField | The source field for the provided target field. | |
GetTargetField | The target field for the provided source field. | |
IsEmpty | Indicates if any field mappings have been set. | |
SetFieldMap | Establishes a field mapping between the source and target fields. | |
SourceClass | Source class (required) for field mapping. | |
TargetClass | Target class (required) for field mapping. |
CoClasses that implement IFieldMap
CoClasses and Classes | Description |
---|---|
FieldMap (esriEditorExt) | The Field map object defines how attributes will get transfered. |
Remarks
A FieldMap contains a number source and target fields for use in attribute transfer.
To create a new FieldMap, instantiate a new FieldMap object then set its source and target feature class via the SourceClass and TargetClass properties. Next set each source and target pair via the SetFieldMap method.
Source/Target field pairs can be can be queried via the FieldMap property, which returns an IEnumFieldMap object containing the field pairs.
A source/target field pair can be removed from a FieldMap by using the DeleteFieldMap method. Only the source field is specified.
private void setUpFieldMap(IFeatureLayer sourceFeatureLayer, IFeatureLayer targetFeatureLayer)
{
//get editor extension
UID editorUID = new UIDClass();
editorUID.Value = "esriEditor.Editor";
IEditor editor = m_application.FindExtensionByCLSID(editorUID) as IEditor;
IAttributeTransferType attributeTransferType = editor as IAttributeTransferType;
IAttributeTransfer attributeTransfer = attributeTransferType.AttributeTransfer;
IFieldMap fieldMap = new FieldMapClass();
fieldMap.SourceClass = sourceFeatureLayer.FeatureClass;
fieldMap.TargetClass = targetFeatureLayer.FeatureClass;
int souceFieldID = sourceFeatureLayer.FeatureClass.Fields.FindField("test");
int tagetFieldID = targetFeatureLayer.FeatureClass.Fields.FindField("test");
IField sourceField = sourceFeatureLayer.FeatureClass.Fields.get_Field(souceFieldID);
IField targetField = targetFeatureLayer.FeatureClass.Fields.get_Field(tagetFieldID);
fieldMap.SetFieldMap(sourceField, targetField);
attributeTransfer.FieldMap = fieldMap;
}