1 / 41

Attaching Behavior to Objects and Programming in the Geodatabase

Attaching Behavior to Objects and Programming in the Geodatabase. Tom Wesp, AICP Henry Hagemeier ESRI San Antonio. Parcels and Buildings. Two separate layers Each with its own attributes and independent of each other. Wouldn’t It Be Nice….

caitlyn
Download Presentation

Attaching Behavior to Objects and Programming in the Geodatabase

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Attaching Behavior to Objects and Programming in the Geodatabase Tom Wesp, AICP Henry Hagemeier ESRI San Antonio

  2. Parcels and Buildings Two separate layers Each with its own attributes and independent of each other.

  3. Wouldn’t It Be Nice… What if we could change the properties of one layer and the properties of the other would be automatically updated?

  4. Our Example • Parcels and Buildings • Parcel has a field that “keeps track” of combined cost of buildings on it.

  5. Programming Custom Objects • Custom objects requires programming in COM-compliant language • only VC++ or Delphi (don’t ask about VB) • custom object classes can use VB or VJ++ • CASE tools make it easier

  6. Custom Objects • Developers create custom objects and intricate data schemas • No difference between ESRI supplied and developer-supplied custom objects • merely support required interfaces • augments with new interfaces

  7. Custom Objects • What you will need • UML and MS Repository aware CASE tool • Visio Professional or Enterprise • Visual C++ or Delphi • GeoDatabase data model diagram • ArcCatalog • OO programming skills and knowledge of COM

  8. Creation Process • Create the object model • 3rd party CASE tool • Export to the Microsoft Repository • 3rd party CASE tool UML export wizard • Generate stub-code • ESRI supplied wizard (VC++ only) • Implement custom behavior • you program into the stubs • Create the GeoDatabase schema

  9. Creation Process • Base it on a GeoDatabase object • give it custom behavior, properties You do this... ESRI provides this...

  10. Custom Object Example Feature COM Implementation Object Model

  11. Custom Object Example Feature Tree Height Kind Age() COM Implementation Object Model

  12. Custom Object Example Interface F1 Feature Feature Interface F2 Tree Height Kind Age() COM Implementation Object Model

  13. Custom Object Example Interface F1 Feature Feature Interface F2 Tree Interface T Tree Height Kind Height Kind Interface F1 Interface F2 Age() COM Implementation Object Model

  14. Custom Object Example Interface F1 Feature Feature Interface F2 Tree Interface T Tree Height Kind Height Kind Interface F1 Feature Interface F2 Age() COM Implementation Object Model

  15. Visual - Almost Real - Hands on Demonstration • Tools we will use… • Visio for UML (Unified Modeling Language) • Visual C++ for code creation • ArcMap to implement and view the new behavior

  16. Our Custom Object • ArcInfo provides tools for creating buildings and land parcels as polygons. • ArcInfo allows us to store attribute data about those buildings and parcels. • We want to create a custom object which will do the following… • Parcels store land value along with value of all building on that parcel • Buildings store the floors, height, and value

  17. But Wait! There’s more! • We want the features to maintain their relationship automatically… • For Example: • If a new building is created the parcel attributes will automatically be updated with the building’s value

  18. Adding ESRI Geodata access COM classes with Visio UML Tools ESRI Classes::Object Click and drag ESRI Classes::Feature

  19. Adding a Custom Class with Visio’s UML Tool Name Object and add attributes from dialog box. Double clicking on the object opens the dialog box.

  20. Drag and drop a Generalization to connect the new Parcel class to Feature

  21. Add a COM Interface to the Parcel Object Give interface a name and set its Stereotype to Interface

  22. Interface for the Parcel object will allow us to read and write parcel value and read values of all buildings on that parcel Drag and drop a Refinement to connect interface IParcel to Parcel Class

  23. Add operations to the Interface IParcel Adding an operation called get_CombinedBuildingValue

  24. Same previous steps to create interface for Custom Building Behavior

  25. Create a RelationshipClass to associate parcels to buildings The composite association tool in Visio creates the needed relationship between the buildings and parcels.

  26. Finally create a ClassExtension for implementing behavior A Class Extension is a COM class that implements behavior for a whole set of custom features in a feature class.

  27. Finished UML Model Export the UML model to the Microsoft Repository (in this case an Access database).

  28. Now what? We have our object model in a Repository. What’s next? • We need to generate code… • We will use Microsoft Visual C++ with a little help from an ESRI wizard

  29. Start Microsoft Visual C++ Go to the “Tools” menu and choose “customize”. Click on the Add-ins tab and browse to the ArcInfo directory that contains the file “CodeGenWiz.dll” and load the dll.

  30. Visual C++ with ESRI CodeGenWizard Browse to your Access database that contains your object model.

  31. Select your object model…

  32. Defining custom feature properties with the wizard

  33. Continue with the wizard to define Inherited Interfaces Aggregation: Inner feature is called directly. (A little like OO inheritance) Containment: Calls are “forwarded” to the inner feature. IParcel Parcel IRow Feature IRowEvents IRelated ObjectEvents

  34. Define a Developer Studio Project and compile a dll Feels good to finally have some code.

  35. All that is left now is to add some C++ code. • Define Object Behavior • Define Object Functions

  36. Well… there is a little more • Use ArcCatalog Case Tool Wizard to create a database schema from your UML model. • Connect to the Repository • Select the object model • Define schema properties for each feature • Create the schema

  37. Adding Case Tool in ArcCatalog Click and drag Case tool from Customize dialog box.

  38. Schema Wizard in ArcCatalog Navigate to the Repository containing your UML model.

  39. Schema Wizard Shows Custom Features, Relationship Classes and Domains.

  40. ArcMap

  41. Thank You

More Related