Thursday, October 04, 2007
Posted on Thursday, October 04, 2007 6:02:35 PM (Mountain Daylight Time, UTC-06:00)  Comments [0] | 
Categories: .NET | ArcGIS Devt | Productivity

Ok, just had to share this because I think it's so darn cool. I've posted about our internal tool "ArcDAL" in the past (follow that link for details), but the quick review is that we have created a set of code-generated data access classes which wrap the geodatabase API. These classes fully support data binding, and because they are code generated, we can change the geodatabase model with limited impact to our code base.

Anyhow - while I was involved with the design and initial template generation, this is my first time actually using it in a project (This is the second major project using ArcDAL). It's just so fun to see this all come together, I thought I'd share...

So - here's how we make Object Inspectors (little UI's that "snap" into ArcMap's Attribute Editor)...

1) Create an inherited user control in the project. We created a base control to ensure consistent look and feel, so that simplifies things. Here's the new control...

io-control

2) Create an object data source from the ArcDAL List related to the feature class of interest - in this case ForestDistrictList

add-objdatasource

3) In the data source window, Set the display style for the ForestDistrictList data source to "Details"

display-style

4) Set the Display Style of fields we do not want visible to "None"

field-none

5) Drag the List data source onto the user control... and watch it layout the controls for you

layout

Once the controls are on the form, you're almost done. For all the fields that are automatically populated, set the control to Read-Only. While this example does not have domains, those are handled and will automatically be dropped in as dropdown lists. Once the form is all laid out, we just have a minor bit of coding (~20 lines) to convert the inbound IObject into an ArcDAL object, and add it to the binding list, and handle some eventing so that changes are automagically saved.

I may have to create a little screen cast because it's just too cool to have it lay things out for you.

From a productivity stand point, this is amazing. And since it's data bound and code generated, even substantial changes to the geodatabase schema are relatively painless propogate up through the application.

Comments are closed.