Getting to Know ArcObjects - WordPress.com · Developer Summit 2007 11 Use COM compatible languages...
Transcript of Getting to Know ArcObjects - WordPress.com · Developer Summit 2007 11 Use COM compatible languages...
Developer Summit 2007Developer Summit 2007 11
Rob BurkeRob BurkeESRIESRI--RedlandsRedlands
Educational ServicesEducational Services
Getting to Know ArcObjectsGetting to Know ArcObjects
Developer Summit 2007Developer Summit 2007 22
•• Started as an intern 1990 Tenth User Conference, PSStarted as an intern 1990 Tenth User Conference, PS•• Teach ESRI classesTeach ESRI classes
–– Desktop, Geodatabase, ArcObjects, raster, ServerDesktop, Geodatabase, ArcObjects, raster, Server
•• Write training materialsWrite training materials•• Write booksWrite books•• Review booksReview books
Developer Summit 2007Developer Summit 2007 33
SurveysSurveys
•• Please fill out a surveyPlease fill out a survey
Developer Summit 2007Developer Summit 2007 44
Intended audienceIntended audience
•• Anyone wanting to learn about ArcObjectsAnyone wanting to learn about ArcObjects•• ArcObjects basicsArcObjects basics•• For programmers and nonFor programmers and non--programmersprogrammers•• Maybe you knowMaybe you know
–– Some ArcGISSome ArcGIS–– Some programmingSome programming
•• Not language specificNot language specific
Developer Summit 2007Developer Summit 2007 55
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 66
Parts store for GISParts store for GIS
•• Building blocks for ArcGIS software products and yoursBuilding blocks for ArcGIS software products and yours•• The most basic GIS parts are programmable objectsThe most basic GIS parts are programmable objects
Map
Layer
Point
Polygon
Developer Summit 2007Developer Summit 2007 77
Parts store for GISParts store for GIS
•• ArcMap and ArcCatalog are built with ArcObjectsArcMap and ArcCatalog are built with ArcObjects•• Their most basicTheir most basic parts are programmable GIS objectsparts are programmable GIS objects•• Users and programmers interact with the same objectsUsers and programmers interact with the same objects•• Everyone uses the same parts, ESRI developers and youEveryone uses the same parts, ESRI developers and you
Map
LayerPoint
Polygon
Developer Summit 2007Developer Summit 2007 88
Pieces to create GIS applications or embedPieces to create GIS applications or embed
•• Technically they are called classes (or components)Technically they are called classes (or components)–– Over 3,400 ArcObjects classesOver 3,400 ArcObjects classes–– Over 21,000 properties and methodsOver 21,000 properties and methods–– Grouped into over 70 logical librariesGrouped into over 70 logical libraries–– (not including ArcGIS Server)(not including ArcGIS Server)
•• Each class corresponds to a basic GIS partEach class corresponds to a basic GIS part
Map Point
Line
Polygon
Table
Row
Field
Layer
Developer Summit 2007Developer Summit 2007 99
Map class Map class vsvs map objectmap object•• There is only one Map classThere is only one Map class•• You make many map objects: World and USYou make many map objects: World and US•• A class is code behind an objectA class is code behind an object’’s properties and s properties and
methods methods •• Objects live in memory and take on your settingsObjects live in memory and take on your settings
Map
Developer Summit 2007Developer Summit 2007 1010
How do you get ArcObjectsHow do you get ArcObjects
•• ArcObjects is not a product, by itselfArcObjects is not a product, by itself
•• You canYou can’’t buy just ArcObjectst buy just ArcObjects–– You buy an ArcGIS Desktop productYou buy an ArcGIS Desktop product–– You buy ArcGIS EngineYou buy ArcGIS Engine–– You buy ArcGIS ServerYou buy ArcGIS Server
•• ArcObjectsArcObjects--related files are installed when you install one related files are installed when you install one of the three productsof the three products
Developer Summit 2007Developer Summit 2007 1111
Use COM compatible languagesUse COM compatible languages
•• VBA is built into the ArcGIS desktop applicationsVBA is built into the ArcGIS desktop applications–– Visual Basic for ApplicationsVisual Basic for Applications–– VBA code is stored in map document files (mxd files)VBA code is stored in map document files (mxd files)
•• Buy a language and IDE (Development environment)Buy a language and IDE (Development environment)–– Visual Basic or C# (Visual Studio 2005)Visual Basic or C# (Visual Studio 2005)–– C++C++–– JavaJava
•• Use a free open source language and IDEUse a free open source language and IDE–– PythonPython
–– My trail: BASIC, Fortran, SML, AML, Avenue, VB, VBA, My trail: BASIC, Fortran, SML, AML, Avenue, VB, VBA, PythonPython, C#, C#
Developer Summit 2007Developer Summit 2007 1212
Compare to Microsoft Access data objectsCompare to Microsoft Access data objects
•• Access built from a about a hundred objectsAccess built from a about a hundred objects–– Called DAO or data access objectsCalled DAO or data access objects
•• Users and programmers use same objectsUsers and programmers use same objects•• Applications can mix and match from different librariesApplications can mix and match from different libraries
RecordSet
Field
Database
Developer Summit 2007Developer Summit 2007 1313
Class librariesClass libraries
ArcObjects
Word
MyClasses
My Application
•• COM classes can be mixed and matchedCOM classes can be mixed and matched•• Make your own library of COM classesMake your own library of COM classes•• Language independentLanguage independent
Developer Summit 2007Developer Summit 2007 1414
Shapefile to word docShapefile to word doc
FeatureClass
WordDoc
Developer Summit 2007Developer Summit 2007 1515
ArcObjects are building blocks: DesktopArcObjects are building blocks: Desktop
•• ArcGIS Desktop applications are created with ArcObjectsArcGIS Desktop applications are created with ArcObjects•• ArcMap, ArcCatalog, ArcScene, ArcGlobeArcMap, ArcCatalog, ArcScene, ArcGlobe……
Developer Summit 2007Developer Summit 2007 1616
ArcObjects are building blocks: EngineArcObjects are building blocks: Engine
•• ArcGIS Engine applications are created with ArcObjectsArcGIS Engine applications are created with ArcObjects•• You create stand alone GIS applicationsYou create stand alone GIS applications•• Use ArcObjects in nonUse ArcObjects in non--GISGIS--centric applicationscentric applications
Developer Summit 2007Developer Summit 2007 1717
ArcObjects are building blocks: ServerArcObjects are building blocks: Server
•• ArcGIS Server Web mapping applications are created with ArcGIS Server Web mapping applications are created with ArcObjects and special Web ADF GIS objectsArcObjects and special Web ADF GIS objects
•• Author, publish, or consumeAuthor, publish, or consume–– GIS data, functionality, and geoprocessingGIS data, functionality, and geoprocessing–– Query, edit, address match, make custom, and moreQuery, edit, address match, make custom, and more
Developer Summit 2007Developer Summit 2007 1818
ArcGISServer
ArcGIS Desktop
ArcGIS Explorer
WebMapping
Application
ArcGIS Engine
ArcGISMobile
DesktopDeveloper Kit
EngineDeveloper Kit API SDK
ArcSDEtechnology
Applications
Services
Data(Geodatabase)
ServerDeveloper Kit
.NET COM .NET COMC++ Java
.NET COM
.NET Java.NET .NETAPI
ArcObjects
JavaArcWeb Services
OpenLS
REST J2ME
SOAP
FileFile Personal Workgroup Enterprise
ArcSD
E
APIJavaScript
ArcGIS Online
Personalfor MSAccess
Desktop
ArcGIS: a ArcGIS: a complete GIScomplete GIS
Developer Summit 2007Developer Summit 2007 1919
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 2020
Object Model DiagramsObject Model Diagrams
•• Road maps to the ArcObjects classesRoad maps to the ArcObjects classes•• Help you write codeHelp you write code•• Based on UML Based on UML –– Unified Modeling Language Unified Modeling Language
–– Symbols show relationships, connections, properties, and Symbols show relationships, connections, properties, and methodsmethods
•• > 70 libraries> 70 libraries•• > 110 posters> 110 posters
Developer Summit 2007Developer Summit 2007 2121
Where do you get the diagrams?Where do you get the diagrams?
•• Install the ArcObjects developer kitInstall the ArcObjects developer kit–– C:C:\\Program FilesProgram Files\\ArcGISArcGIS\\DeveloperKitDeveloperKit\\DiagramsDiagrams\\*PDF*PDF
•• HelpHelp–– Per libraryPer library
•• OnlineOnline–– EEDN Web siteDN Web site–– Per libraryPer library
Developer Summit 2007Developer Summit 2007 2222
•• RelationshipsRelationships
•• ClassesClasses
•• Properties and methodsProperties and methods
*
The twelve UML SymbolsThe twelve UML Symbols
Developer Summit 2007Developer Summit 2007 2323
UML symbolsUML symbols
•• AssociationAssociation
NestChicken
Developer Summit 2007Developer Summit 2007 2424
UML symbolsUML symbols
•• MultiplicityMultiplicity•• AssociationAssociation
NestChicken
Farm
*
*
Developer Summit 2007Developer Summit 2007 2525
UML symbolsUML symbols
•• MultiplicityMultiplicity•• AssociationAssociation
NestChicken
Farm
*
Wings2
*
Developer Summit 2007Developer Summit 2007 2626
UML symbolsUML symbols
•• Creates aCreates a•• MultiplicityMultiplicity•• AssociationAssociation
Egg NestChicken
Farm
*
Wings2
*
Developer Summit 2007Developer Summit 2007 2727
UML symbolsUML symbols
•• Is composed ofIs composed of•• Creates aCreates a•• MultiplicityMultiplicity•• AssociationAssociation
Egg
Wings
NestChicken
Farm
*
2
*
Developer Summit 2007Developer Summit 2007 2828
UML symbolsUML symbols
•• Is a type ofIs a type of•• Is composed ofIs composed of•• Creates aCreates a•• MultiplicityMultiplicity•• AssociationAssociation
Egg
Bird
Wings
NestChicken
Farm
*
2
*
Developer Summit 2007Developer Summit 2007 2929
UML class symbols: Abstract classUML class symbols: Abstract class
BirdAbstract
•• 2D and not shaded2D and not shaded•• Objects can not be created from itObjects can not be created from it
Developer Summit 2007Developer Summit 2007 3030
BirdAbstract
•• 2D and not shaded2D and not shaded•• Objects can not be created from it Objects can not be created from it •• Holds properties and methods that subclasses inheritHolds properties and methods that subclasses inherit
Chicken
UML class symbols: Abstract classUML class symbols: Abstract class
Developer Summit 2007Developer Summit 2007 3131
UML class symbols: CoClassUML class symbols: CoClass
Bird
Nest
Abstract
CoClassChicken
CoClass
FarmCoClass
*
•• 3D and shaded3D and shaded•• You create objects out of themYou create objects out of them
–– Declare a variableDeclare a variable–– Instantiate an object using the New keywordInstantiate an object using the New keyword
Developer Summit 2007Developer Summit 2007 3232
UML class symbols: ClassUML class symbols: Class
•• Other classes create or return these objectsOther classes create or return these objects•• You write code with another object to create or getYou write code with another object to create or get
–– You canYou can’’t create an egg without a chickent create an egg without a chicken–– You canYou can’’t get a wing without an chickent get a wing without an chicken
Egg
Bird
Wings
NestChicken
Farm
*
2
Abstract
CoClassCoClass
CoClass
Developer Summit 2007Developer Summit 2007 3333
ChickenAgeColorName
•• Read and write propertyRead and write property–– These are attributes stored about the objectThese are attributes stored about the object–– You can either get or set these propertiesYou can either get or set these properties
UML property symbolsUML property symbols
Developer Summit 2007Developer Summit 2007 3434
ChickenAgeColorNameWing(side)
•• Read only propertyRead only property–– Left half barbell symbolLeft half barbell symbol–– You can get this propertyYou can get this property’’s values value–– But you canBut you can’’t change itt change it
UML property symbolsUML property symbols
Developer Summit 2007Developer Summit 2007 3535
ChickenAgeColorNameWing(side)Password
•• Write only propertyWrite only property–– Right half barbell symbolRight half barbell symbol–– Usually an edit property or like a passwordUsually an edit property or like a password–– You can change the value, but you canYou can change the value, but you can’’t get itt get it
UML property symbolsUML property symbols
Developer Summit 2007Developer Summit 2007 3636
ChickenAge: IntegerColor: StringName: StringWing(side): WingPassword: String
•• Each property holds a valueEach property holds a value•• The values are of a certain type: Number, string, date, The values are of a certain type: Number, string, date,
Boolean, object Boolean, object ……•• The type appears to the right of the property nameThe type appears to the right of the property name
–– Property name, a colon, and typeProperty name, a colon, and type–– Name: StringName: String -- means that the Name property holds a text stringmeans that the Name property holds a text string–– The Wing property holds Wing objectsThe Wing property holds Wing objects
Property valuesProperty values
Developer Summit 2007Developer Summit 2007 3737
•• MethodMethod–– Arrow symbolArrow symbol–– Methods are actions the object can performMethods are actions the object can perform–– Sometimes called behaviorsSometimes called behaviors
UML method symbolUML method symbol
Chicken
LayEggFly
Developer Summit 2007Developer Summit 2007 3838
•• You write code to run a methodYou write code to run a method•• Some methods return a value, some donSome methods return a value, some don’’tt•• The valueThe value’’s type appears to the right of the methods type appears to the right of the method
–– Method, colon, and type of its return valueMethod, colon, and type of its return value–– LayEggLayEgg: Egg: Egg -- the the LayEggLayEgg method returns an egg objectmethod returns an egg object–– The Fly method returns nothingThe Fly method returns nothing
Methods return valuesMethods return values
Chicken
LayEgg: EggFly
Developer Summit 2007Developer Summit 2007 3939
Reading diagramsReading diagrams
•• Classes are rectanglesClasses are rectangles•• Classes have properties and methodsClasses have properties and methods•• Get neighboring or connected objectsGet neighboring or connected objects
pLayerpLayer = pMap.Layer(0)= pMap.Layer(0)
Map (data frame)Layer (index): ILayer
AddLayer (ILayer)
Layer
*FeatureClass
0
1
2
3
Developer Summit 2007Developer Summit 2007 4040
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 4141
ArcObjects classes are COMArcObjects classes are COM
•• COM compliantCOM compliant–– Component object modelComponent object model–– Industry standard for creating classesIndustry standard for creating classes–– Programming language independentProgramming language independent–– COM classes can be reused between applicationsCOM classes can be reused between applications
•• COM classes have programmer interfacesCOM classes have programmer interfaces–– Classes created in one language can communicate with other Classes created in one language can communicate with other
languageslanguages–– ArcObjects classes are created in C++ArcObjects classes are created in C++–– Use them in C++, VB.NET, C#.NET, VBA, Python, etc.Use them in C++, VB.NET, C#.NET, VBA, Python, etc.
Developer Summit 2007Developer Summit 2007 4242
*
COM classes have interfacesCOM classes have interfaces
•• Objects are rectanglesObjects are rectangles•• Interfaces (lollypops) group properties and methodsInterfaces (lollypops) group properties and methods•• Get neighboring or connected objectsGet neighboring or connected objects
pLayerpLayer = pMap.Layer(0)= pMap.Layer(0)
•• Multiple interfacesMultiple interfaces
MapLayer (index): ILayer
AddLayer (ILayer)
IMap Layer
FeatureClassOther: SomethingIMore
Developer Summit 2007Developer Summit 2007 4343
•• Intrinsic data typesIntrinsic data types–– Numbers, strings, datesNumbers, strings, dates
•• Simple objects (VB, Excel, MapObjects)Simple objects (VB, Excel, MapObjects)–– One default interfaceOne default interface–– HiddenHidden
•• ArcObjects ArcObjects –– Multiple interfacesMultiple interfaces
Understanding data typesUnderstanding data types
Integer
_Button
IPoint
IGeometry
Button
Point
Developer Summit 2007Developer Summit 2007 4444
Intrinsic data types and simple objectsIntrinsic data types and simple objects
'Intrinsic dataDim x As Integer 'Declarex = 4 'SetMsgBox x * 10 'Use
Integer+ (add)- (subtract)* (multiply)/ (divide)
'Simple ObjectDim b as CommandButton 'DeclareSet b = frmClock.cmdTime 'Setb.Caption = “Time” 'Use
CommandbuttonColorEnabledFontCaptionToolTip_CommandButton
On a VBA form
Developer Summit 2007Developer Summit 2007 4545
Multiple interfacesMultiple interfaces
'Or Dim p as IGeometry 'DeclareSet p = New Point 'Setp.Projection = Albers 'Use
PointXYZ
IGeometry
IPoint
Projection
'ArcObjectsDim p as IPoint 'DeclareSet p = New Point 'Setp.z = 5280 'Use
Developer Summit 2007Developer Summit 2007 4646
PointXYZ
IGeometry
IPoint
Projection
Client and server environmentClient and server environment
•• Client code instantiates a classClient code instantiates a class•• Client only knows the methods exist but does not Client only knows the methods exist but does not
know how they are implemented on the serverknow how they are implemented on the server
Request services
DLLOLBEXE
Third-party developer code(e.g., VBA)
Client code Server class
Dim p as IPoint
Set p = New Point
p.z = 5280
Developer Summit 2007Developer Summit 2007 4747
Dog COM class codeDog COM class code
•• Interface moduleInterface module–– Define methodsDefine methods–– No codeNo code
•• Class moduleClass module–– Implement methodsImplement methods
•• Developer moduleDeveloper module–– Instantiate classInstantiate class–– Call its methodsCall its methods
Client
Server
Interface
ESRI’s ArcObjects code
Your code
Developer Summit 2007Developer Summit 2007 4848
What COM interfaces provideWhat COM interfaces provide
•• Programming language independenceProgramming language independence•• The ability for functionality in applications to The ability for functionality in applications to evolve evolve
over timeover time–– Add new interfaces without affecting client codeAdd new interfaces without affecting client code–– IDog, IDog2, IDog3, IDog4, IDog5IDog, IDog2, IDog3, IDog4, IDog5–– Dim d as IDog works foreverDim d as IDog works forever
•• Interface reuseInterface reuse•• Your classes can implement ESRI interfaces!Your classes can implement ESRI interfaces!
Developer Summit 2007Developer Summit 2007 4949
Implement ESRI interfacesImplement ESRI interfaces
•• Interface moduleInterface module
•• Class moduleClass module–– Implement methodsImplement methods–– Write your own codeWrite your own code
•• Developer moduleDeveloper module–– Instantiate classInstantiate class–– Call its methodsCall its methods
Client
YourServer
Interface
MsgBox “Grr, Roof!”
ESRI’s ArcObjects code
Your code
Developer Summit 2007Developer Summit 2007 5050
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 5151
Creating a custom commandCreating a custom command
•• SingleSingle--click buttons click buttons •• Execute any ArcObjects codeExecute any ArcObjects code•• ExamplesExamples
–– Custom add dataCustom add data–– Custom mapping operationsCustom mapping operations–– Show a custom dialog or windowShow a custom dialog or window
ESRI Add Data command
My custom command
Developer Summit 2007Developer Summit 2007 5252
Developing custom COM componentsDeveloping custom COM components
•• Find a similar ArcGIS componentFind a similar ArcGIS component•• Find out what interfaces it implementsFind out what interfaces it implements
–– Look in the HelpLook in the Help
•• Buttons implement Buttons implement ICommandICommand
ICommandFindButton
esriControlCommands
ArcMap Find command
Developer Summit 2007Developer Summit 2007 5353
Commands: Implement the Commands: Implement the ICommandICommand interfaceinterface
•• Model after the Button classModel after the Button class•• You get to code each property and methodYou get to code each property and method•• ESRI developers follow this patternESRI developers follow this pattern•• You can too!You can too!
ICommandMySmileCmd
Developer Summit 2007Developer Summit 2007 5454
Developing custom COM componentsDeveloping custom COM components
•• Create a COM object and plug it into an applicationCreate a COM object and plug it into an application•• Steps:Steps:
1.1.Create a COM/.NET project Create a COM/.NET project IUnknown
ICommandFindButton
esriControlCommands
robsLibrary
Developer Summit 2007Developer Summit 2007 5555
Developing custom COM componentsDeveloping custom COM components
•• Create a COM object and plug it into an applicationCreate a COM object and plug it into an application•• Steps:Steps:
1.1.Create a COM/.NET projectCreate a COM/.NET project2.2.Create a COM classCreate a COM class
IUnknown
ICommand
IUnknown
FindButton
DrawChopper
esriControlCommands
robsLibrary
Developer Summit 2007Developer Summit 2007 5656
Developing custom COM componentsDeveloping custom COM components
•• Create a COM object and plug it into an applicationCreate a COM object and plug it into an application•• Steps:Steps:
1.1.Create a COM/.NET project Create a COM/.NET project 2.2.Create a COM classCreate a COM class3.3.Reference the ArcGIS libraries Reference the ArcGIS libraries 4.4. Implement ArcObjects Implement ArcObjects interfacesinterfaces
IUnknown
ICommand
IUnknown
ICommand
FindButton
DrawChopper
esriControlCommands
robsLibrary
Developer Summit 2007Developer Summit 2007 5757
Developing custom COM componentsDeveloping custom COM components
•• Create a COM object and plug it into an applicationCreate a COM object and plug it into an application•• Steps:Steps:
1.1.Create a COM/.NET project Create a COM/.NET project 2.2.Create a COM classCreate a COM class3.3.Reference the ArcGIS libraries Reference the ArcGIS libraries 4.4. Implement ArcObjects interfacesImplement ArcObjects interfaces5.5.CompileCompile6.6.Register in an ArcGIS component category Register in an ArcGIS component category (Next Slide)(Next Slide)
IUnknown
ICommand
IUnknown
ICommand
FindButton
DrawChopper
esriControlCommands
robsLibrary
Developer Summit 2007Developer Summit 2007 5858
•• ArcMap application start up cycle startsArcMap application start up cycle starts1.1.Accesses the appropriate component categoryAccesses the appropriate component category
How does ArcMap know to use my class?How does ArcMap know to use my class?
Application Starts
ESRIComponentCategories
ESRI Mx CommandsESRI Mx CommandBars
1.
Developer Summit 2007Developer Summit 2007 5959
•• ArcMap startsArcMap starts1.1.Accesses the appropriate component categoryAccesses the appropriate component category2.2.Creates an internal objects that implements Creates an internal objects that implements ICommandICommand
Application start up cycleApplication start up cycle
Cmd
ICommandItem
Command Created
2.Application Starts
ESRIComponentCategories
ESRI Mx CommandsESRI Mx CommandBars
1.
Developer Summit 2007Developer Summit 2007 6060
•• ArcMap startsArcMap starts1.1.Accesses the appropriate component categoryAccesses the appropriate component category2.2.Creates an internal objects that implements Creates an internal objects that implements ICommandICommand3.3.Creates your UI component (command, tool, toolbar, or menu) Creates your UI component (command, tool, toolbar, or menu)
Application start up cycleApplication start up cycle
Creates UIComponents
Cmd
ICommandItem
Command Created
2. 3.
Cmd
Tool
Menu
Application Starts
ESRIComponentCategories
ESRI Mx CommandsESRI Mx CommandBars
1.
Developer Summit 2007Developer Summit 2007 6161
•• ArcMap startsArcMap starts1.1.Accesses the appropriate component categoryAccesses the appropriate component category2.2.Creates an internal objects that implements Creates an internal objects that implements ICommandICommand3.3.Creates your UI component (command, tool, toolbar, or menu) Creates your UI component (command, tool, toolbar, or menu) 4.4.Adds the CommandItem to the CommandItem listAdds the CommandItem to the CommandItem list
Application start up cycleApplication start up cycle
Creates UIComponents
Cmd
ICommandItem
ICommandItemCmd
Command Created
2. 3.
ICommandItemMenu
ICommandItemTool
4.
Cmd
Tool
Menu
Application Starts
ESRIComponentCategories
ESRI Mx CommandsESRI Mx CommandBars
1.
Developer Summit 2007Developer Summit 2007 6262
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 6363
Custom tools also implement Custom tools also implement IToolITool
•• Commands that listen for Commands that listen for mouse and key eventsmouse and key events
•• Allows users to interact with mapsAllows users to interact with maps•• ExamplesExamples
–– Map interaction: TrackingMap interaction: Tracking–– Analysis: Select featuresAnalysis: Select features–– Editing toolsEditing tools
Custom sketch tool in palette
Default Sketch palette
Developer Summit 2007Developer Summit 2007 6464
Custom toolbarsCustom toolbars
•• Container to show commands, tools, and menusContainer to show commands, tools, and menus•• Implement Implement IToolbarDefIToolbarDef•• You code the interfaceYou code the interface’’s properties and methodss properties and methods•• ExamplesExamples
–– Show or hide a custom set of tools Show or hide a custom set of tools –– Associate tools with extensionsAssociate tools with extensions
IToolbarDefMyToolbar
Developer Summit 2007Developer Summit 2007 6565
ArcGIS extensionsArcGIS extensions
•• Mechanism to plug objects into Mechanism to plug objects into the applicationthe application
•• Visible in the Extension ManagerVisible in the Extension Manager•• Supported by all applicationsSupported by all applications•• Name appears in the listName appears in the list•• Looks like ESRILooks like ESRI’’s extensionss extensions
•• Description appears at the bottomDescription appears at the bottom–– Extension name and versionExtension name and version–– Copyright and company nameCopyright and company name–– Extension purposeExtension purpose
Developer Summit 2007Developer Summit 2007 6666
Extension interfacesExtension interfaces•• IExtensionConfig is requiredIExtensionConfig is required
–– Can be like a silent, invisible extension, and wonCan be like a silent, invisible extension, and won’’t appear in listt appear in list–– Load dataLoad data–– Check statusCheck status
•• IExtension is optionalIExtension is optional–– Adds extension to the Extension Manager windowAdds extension to the Extension Manager window’’s lists list–– Could load your toolbar and commandsCould load your toolbar and commands
Developer Summit 2007Developer Summit 2007 6767
Add table of contents tabsAdd table of contents tabs
•• Implement Implement IContentsViewIContentsView
Developer Summit 2007Developer Summit 2007 6868
Add ArcCatalog tabsAdd ArcCatalog tabs
•• Implement IGxViewImplement IGxView
Developer Summit 2007Developer Summit 2007 6969
API objects match your experience as a userAPI objects match your experience as a user
•• Programmers start the same place users start Programmers start the same place users start
WorkspaceFeatureDataset
FeatureClass
FeatureClass
Developer Summit 2007Developer Summit 2007 7070
API objects match your experience as a userAPI objects match your experience as a user
•• Programmers start the same place users start Programmers start the same place users start •• Geodatabase API uses the same (user) termsGeodatabase API uses the same (user) terms•• Includes any data, not just geodatabase formatsIncludes any data, not just geodatabase formats
WorkspaceFeatureDataset
FeatureClass
FeatureClass
Developer Summit 2007Developer Summit 2007 7171
Some Geodatabase API objectsSome Geodatabase API objects
WorkspaceFactory
Access
SDE
And others…
ArcInfo
Shapefile
•• ObjectClassObjectClass is a regular tableis a regular table•• FeatureClassFeatureClass is a table with shape fieldis a table with shape field
DatasetWorkspace
GeoDataset Table
RasterDataset ObjectClass
FeatureClassFeatureDataset
Developer Summit 2007Developer Summit 2007 7272
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 7373
Levels of customizationLevels of customization
Customfeatures C++>
Subtypes& defaults
Domains& validation
Connectivity& topo rules
Class & workspaceextensions VB & C# >
Built-in
Functionality
Custom
Applications
Editor VBA>
Programming
starts here
Developer Summit 2007Developer Summit 2007 7474
Levels of GeoDatabase customizationLevels of GeoDatabase customization
Cad Files
Geodatabase (API)
ArcMap ArcCatalogCustom Application
Coverages
Shapefiles MyFormatmdb ArcSDE
• ClientsArcMap, ArcCatalog
Custom Application
• GeodatabaseClass Extensions
Developer Summit 2007Developer Summit 2007 7575
Level of customizationLevel of customization
•• Application levelApplication level–– Business Logic is stored within applicationBusiness Logic is stored within application–– Example, a new button, a new edit taskExample, a new button, a new edit task–– Problem Problem -- duplication in many applicationsduplication in many applications
•• Database levelDatabase level–– Business Logic is stored with dataBusiness Logic is stored with data–– Always available, regardless of applicationAlways available, regardless of application–– Problems, messages are firing, row/class behavior, and code Problems, messages are firing, row/class behavior, and code
failure renders data uselessfailure renders data useless
Developer Summit 2007Developer Summit 2007 7676
Extendable objectsExtendable objects
WorkspaceExtension
DatasetWorkspace
GeoDataset ObjectClass
FeatureClassFeatureDataset
ClassExtension0..1
0..*
FeatureClassExtension
Developer Summit 2007Developer Summit 2007 7777
Class extension factsClass extension facts
•• They are They are notnot software extensions that you loadsoftware extensions that you load–– Like Spatial AnalystLike Spatial Analyst
•• You add a layer to a map, you get the behaviorYou add a layer to a map, you get the behavior•• Behavior Behavior liveslives in the databasein the database•• One class extension per classOne class extension per class
Developer Summit 2007Developer Summit 2007 7878
Class extension usesClass extension uses
•• Schema generation Schema generation •• Custom drawingCustom drawing•• Custom property inspection (next) Custom property inspection (next) •• ValidationValidation•• Custom split policiesCustom split policies•• Related object creation notificationRelated object creation notification
Developer Summit 2007Developer Summit 2007 7979
Class extension exampleClass extension example
•• ESRIESRI’’s Attribute inspector s Attribute inspector •• From the Editor toolbarFrom the Editor toolbar
Developer Summit 2007Developer Summit 2007 8080
Custom inspectorCustom inspector
•• Extend behavior of an entire feature classExtend behavior of an entire feature class•• Your window appears instead of ESRIYour window appears instead of ESRI’’ss•• Behavior stored with the data, not in an mxd fileBehavior stored with the data, not in an mxd file
Developer Summit 2007Developer Summit 2007 8181
Make your own custom feature classesMake your own custom feature classes
•• IFeatureClassDrawIFeatureClassDraw–– Override a feature classOverride a feature class’’s drawing for any clients drawing for any client–– You can make a custom renderer and property page for itYou can make a custom renderer and property page for it
•• Control new class creationControl new class creation–– User can create your feature classUser can create your feature class
Your description here(In ArcCatalog)
Developer Summit 2007Developer Summit 2007 8282
Behavior interfaces: Listen and ReactBehavior interfaces: Listen and React
•• IObjectClassValidationIObjectClassValidation
Validation event:Building height must be 10 times the number of stories
Developer Summit 2007Developer Summit 2007 8383
Behavior interfaces: Listen and ReactBehavior interfaces: Listen and React
•• IObjectClassValidationIObjectClassValidation•• IRelatedObjectClassEventsIRelatedObjectClassEvents•• IConfimSendRelatedObjectEventsIConfimSendRelatedObjectEvents
Validation event:Building height must be 10 times the number of stories
As a building is added, notify related parcel to update its structure count
Developer Summit 2007Developer Summit 2007 8484
Behavior interfaces: Listen and ReactBehavior interfaces: Listen and React
•• IObjectClassValidationIObjectClassValidation•• IRelatedObjectClassEventsIRelatedObjectClassEvents•• IConfimSendRelatedObjectEventsIConfimSendRelatedObjectEvents•• IObjectClassEventsIObjectClassEvents (OnCreate, (OnCreate, OnDeleteOnDelete, , OnChangeOnChange))
Validation event:Building height must be 10 times the number of stories
OnModify:Record current time and user name in the table
As a building is added, notify related parcel to update its structure count
Developer Summit 2007Developer Summit 2007 8585
NameID1 Parcels
CLSID{3070721…
EXTCLSID{0368CF51…
2 Buildings {3070721…
3 Owners {3070721… {044782D…
Registering class extensions with the geodatabaseRegistering class extensions with the geodatabase
•• Limit of one class extension per classLimit of one class extension per class•• Class extensionClass extension’’s GUID must be registered on all client s GUID must be registered on all client
machines accessing datamachines accessing data•• Methods to register extension:Methods to register extension:
–– During creation: During creation: IFeatureWorkspaceIFeatureWorkspace CreateFeatureClassCreateFeatureClass–– After creation: After creation: IClassSchemaEditIClassSchemaEdit AlterClassExtensionCLSIDAlterClassExtensionCLSID–– When modeling and designing in VisioWhen modeling and designing in Visio
The object classes table within a geodatabase
MyParcelClassExtension
Developer Summit 2007Developer Summit 2007 8686
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 8787
CASE ProcessCASE Process
•• UML UML Repository Repository GDB schema or C++ code GDB schema or C++ code
Repository
Visio CASE Tool
UML Object Model Design
Code Generation
Building
LandBase.DLL
SchemaCreation
ArcCatalog
Building FClass
Visual Studio
Developer Summit 2007Developer Summit 2007 8888
Visio applicationVisio applicationDrawing pageStencils
Developer Summit 2007Developer Summit 2007 8989
Extending ESRI classesExtending ESRI classes
•• Subclasses of Subclasses of FeatureFeature•• Add attributes, relationships, or subtypesAdd attributes, relationships, or subtypes•• AttributesAttributes become fields in the tablebecome fields in the table
-Stories : esriFieldTypeInteger-Height : esriFieldTypeInteger-BuildingValue : esriFieldTypeInteger-ParcelID : esriFieldTypeInteger
MyBuilding-ParcelValue : esriFieldTypeInteger-CombinedBuildingValue : esriFieldTypeInteger
MyParcel
+Shape : esriFieldTypeGeometry
Feature
Developer Summit 2007Developer Summit 2007 9090
Using the ArcCatalog Schema WizardUsing the ArcCatalog Schema Wizard
•• Select a geodatabase in ArcCatalogSelect a geodatabase in ArcCatalog•• Click the Schema Wizard buttonClick the Schema Wizard button•• Choose a repositoryChoose a repository
Repository
Create schema
Visio
Developer Summit 2007Developer Summit 2007 9191
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 9292
ArcGIS EngineArcGIS Engine
StandaloneStandalone NonNon--visualvisual
Embedded Embedded applicationsapplications
Developer Summit 2007Developer Summit 2007 9393
ArcGIS EngineArcGIS Engine
Two ProductsTwo Products•• Engine Developer Kit is the toolkit for building custom Engine Developer Kit is the toolkit for building custom
GIS and mapping applicationsGIS and mapping applications
•• Engine Runtime is deployable ArcObjects required to Engine Runtime is deployable ArcObjects required to run custom Engine applicationsrun custom Engine applications
Developer Summit 2007Developer Summit 2007 9494
Developer ControlsDeveloper Controls
•• MapControlMapControl•• PageLayoutControlPageLayoutControl•• ToolbarControlToolbarControl•• TOCControlTOCControl•• ReaderControlReaderControl•• SceneControlSceneControl•• GlobeControlGlobeControl
Developer Summit 2007Developer Summit 2007 9595
The Map ControlThe Map Control
•• Put the map control in a Word Put the map control in a Word document or your applicationdocument or your application
Developer Summit 2007Developer Summit 2007 9696
More than 100 tools and commands includedMore than 100 tools and commands included
Tools and CommandsTools and Commands
Developer Summit 2007Developer Summit 2007 9797
ArcGIS Engine FunctionalityArcGIS Engine Functionality
•• Read all supported ESRI data formats including the Read all supported ESRI data formats including the geodatabasegeodatabase
•• Map authoring (create and edit MXD)Map authoring (create and edit MXD)•• ArcGIS level cartographyArcGIS level cartography•• Query and analysisQuery and analysis•• GeocodingGeocoding•• Simple editing (shp and pGDB)Simple editing (shp and pGDB)
“ArcView without the applications”
Developer Summit 2007Developer Summit 2007 9898
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 9999
Learning ArcGIS ServerLearning ArcGIS Server
•• Training classesTraining classes–– Intro Intro –– Two day classTwo day class–– Developing Developing –– Three day classThree day class
•• EDN with walkEDN with walk--throughsthroughs•• Forum discussionsForum discussions•• BlogBlog with exampleswith examples
Developer Summit 2007Developer Summit 2007 100100
Lecture PathLecture Path
UnderThe
Hood
Interfaces& COMWhat are
ArcObjectsDiagrams
Extendthe
GeodatabaseQuestions
Wrap-up
Implement ESRI
Interfaces
Extendthe
Applications
Engine
Server
TechTalkArea
CASEtools
Developer Summit 2007Developer Summit 2007 101101
Book sales at the Spatial OutletBook sales at the Spatial Outlet
•• The Spatial Outlet is in Mesquite rooms G & HThe Spatial Outlet is in Mesquite rooms G & H•• The hours are:The hours are:
–– Tues: 9Tues: 9--66–– Wed: 9Wed: 9--66
•• All books: %50 off list priceAll books: %50 off list price
Developer Summit 2007Developer Summit 2007 102102
SurveysSurveys
•• Please fill out a surveyPlease fill out a survey
Developer Summit 2007Developer Summit 2007 103103
Further questions?Further questions?
•• Our TECHOur TECH--TALK AREATALK AREA–– Where:Where: TECHTECH--TALK area 5TALK area 5–– When:When: during the next 30 minutesduring the next 30 minutes–– What:What: Opportunity to discuss questions and concerns Opportunity to discuss questions and concerns