This document is archived and information here might be outdated. Recommended version. |
Indicates whether this extension applies to the current edit environment.
[Visual Basic .NET] Public Function Applies ( _ ByVal Editor As IEditor _ ) As Boolean
[C#] public bool Applies ( IEditor Editor );
The ::Applies() method is called by the controller when attempting to determine if the extension applies or not.
If more than one class is found implementing IEditSketchExtension the current tool or task will utilize the first extension which ::Applies() returns VARIANT_TRUE.
if (task is ICreateFeatureTask)
{
//Creating new features
IEditLayers editLayers = Editor as IEditLayers;
if (editLayers.CurrentLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
return true;
else
return false;
}
else if (task is IModifyTask)
//Modifying existing feature
return true;
else
return false;
If TypeOf task Is ICreateFeatureTask Then
'Creating new features
Dim editLayers As IEditLayers = TryCast(Editor, IEditLayers)
If editLayers.CurrentLayer.FeatureClass.ShapeType = esriGeomeTryType.esriGeomeTryPolygon Then
Return True
Else
Return False
End If
Else If TypeOf task Is IModifyTask Then
'Modifying existing feature
Return True
Else
Return False
End If
IEditSketchExtension Interface | IDatasetEdit Interface | IDatasetEditInfo Interface | IEditSketch Interface | IEditTask.Activate Method | IEditor Interface | IEditTask.Deactivate Method | ISnapEnvironment Interface | IEditEvents2 Interface | IEditLayers Interface | IEditEvents Interface | IEditTask.Name Property | Editor Class | Editor Library | IEditTask.OnFinishSketch Method | IEditAttributeProperties Interface | IEditTask.OnDeleteSketch Method | IEditProperties Interface | IExtension Interface | IEditSketchExtension2 Interface