Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How can I find the Editor extension in an ArcGIS Engine application (i.e. no access to the IApplication object)?

There is an example method at http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000004nn000000 ...

private void GetEditorExtension(IApplication application)
{
    //Find extension by CLSID or ProgId.
    UID extensionID = new UIDClass();
    extensionID.Value = "esriEditor.Editor"; 
        //{F8842F20-BB23-11D0-802B-0000F8037368}.
    IExtension editExtension = application.FindExtensionByCLSID(extensionID);
}

However, IApplication is only available for code that runs directly in ArcMap, not stand-alone apps.

If it helps, I'm writing this inside a custom tool, so I also have acces to the HookHelperClass.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

The editor class is an arcmap extension, and is not available with standalone (arcengine) applications.

For ArcEngine try using the EngineEditor singleton class. According to this sample, you can use "new" to get a reference to it. Note that in other situations Esri advises to use activator for instantiation of singletons, but I guess that doesn't apply in this case(?).

It is unfortunate that EngineEditor doesn't implement IExtensionManager. The Editor coclass implements this to support Editor Extensions. Maybe you could write EngineEditor extensions by leveraging the ExtensionManager singleton, which is available in ArcEngine.

If you don't want to hardwire your EngineEditor Extensions you might consider using ICategoryFactory to scan through a category for UID's of registered EngineExtensions, or better yet, store the extensions' assemblies in the geodatabase. After instantiating each extension, call IExtension.Startup and pass a reference to the IEngineEditor. This gives the extension an opportunity to subscribe to IEngineEditEvents, and intercept CRUD operations before they complete so you can enforce business rules.

share|improve this answer
    
I'm a little confused, if it is not available in arcengine applications, what does all of the IExtensionManager & ICategoryFactory stuff do? P.S. The main point of this question was to get closer to replicating feature templates (gis.stackexchange.com/questions/13371). –  Keith G Aug 11 '11 at 15:41
    
Feature templates are managed via the IEditor3 on the Editor coclass. The EngineEditor class does not implement it. Since you don't have access to the source code you would not be able to change the EngineEditor so that it implements some interface that exposes templates. Instead, I suggest you could do this by extending the EngineEditor. Since there is no out of the box extension mechanism for EngineEditor you would need to roll your own, perhaps by leveraging the ExtensionManager singleton. You'd still need to roll your own architecture. –  Kirk Kuykendall Aug 11 '11 at 16:47
    
Also, I'd be surprised if IEditTemplate.Tool could be set to a tool in ArcEngine. I suspect you'll need to roll your own implementation of IEditTemplate, even though the EditTemplate coclass is said to be available in arcengine. –  Kirk Kuykendall Aug 11 '11 at 16:49
    
OK. Thanks. That's more work than I want to do. I was hoping to leverage the built-in feature editing mechanism (place, drag, delete) so I didn't have to roll my own. Rolling my own tool sounds easier than what you've described. –  Keith G Aug 11 '11 at 16:57

There is no Editor Extension in ArcGIS Engine.

Take a look at ArcGIS Engine Editing in the Resource Center for some details about how to edit in Engine. I found it to be a great starting point. That, plus all the subtopics, got me from knowing almost nothing about editing via Engine to realizing how much is done for us in ArcMap and how much we have to write ourselves (topology editing, specific tools, etc.) if we need to use Engine.

share|improve this answer
    
Thanks for the link! –  Keith G Aug 11 '11 at 17:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.