3

This is a new question but a continuation of this post: How can I programmatically display the "Create Features" dockable window in ArcMap 10?

I like the new template system in ArcGIS 10 but for quick editing it is a somewhat cumbersome several-click process. I have a tool that starts editing a layer that is currently selected in the TOC. It also pops the "Create Feature" dockable window.

I would like to add the currently selected layer as a template to the dockable window using it's default symbology. (VB.Net)

1 Answer 1

2

This involves a two-step approach.

  1. You create the edit template for your layer via IEditTemplateFactory.Create method.
  2. Add the template to the Editor by calling IEditor3.AddTemplates.

EDIT: If you do not want to duplicate the templates on every edit session start, I suggest you read the conceptual documentation for layer templates. It provides a good overview and also shows how to persist the layer templates by accessing the layer's template extension IEditTemplateManager, which may be useful in your case. The document also implies that any advanced template creation (e.g. based on the more advanced renderers) has to be done on your own, this functionality used ArcMap is not exposed as an API to be reused by developers.

5
  • For some reason this duplicates templates. start and stop editing just keeps adding more templates.. Commented Nov 29, 2010 at 18:34
  • Actually, this does not work. Commented Nov 29, 2010 at 18:39
  • Ok, "does not work" doesn't really help here :-) What exactly does not work, could you be more specific please? Also, see my edits, it could provide some additional information.
    – Petr Krebs
    Commented Nov 29, 2010 at 18:48
  • sorry. I did not have time to elaborate. I will look at the documentation. Thanks. I was locking at the code and duplication seems to be the only issue i need to resolve. Commented Nov 29, 2010 at 21:36
  • You can simplify things by giving the template a unique name (i.e. decide on some kind of naming scheme) and add the template only if it's not already present (based on the name). A bit prone to bugs, but might work just well in your scenario.
    – Petr Krebs
    Commented Nov 29, 2010 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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