Getting to Know ArcObjects · Getting to Know ArcObjects Rob Burke ESRI-Redlands Educational Services Developer Summit 2007Developer Summit 2007 1 1 • Started as an intern 1990
Post on 22-Mar-2020
5 Views
Preview:
Transcript
Getting to Know ArcObjectsGetting to Know ArcObjects
Rob BurkeRob BurkeESRIESRI--RedlandsRedlands
Educational ServicesEducational Services
Developer Summit 2007Developer Summit 2007 11
•• Started as an intern 1990 Tenth User Conference, PSStarted as an intern 1990 Tenth User Conference, PS•• Teach ESRI classesTeach ESRI classes•• Teach ESRI classesTeach ESRI classes
–– Desktop, Geodatabase, ArcObjects, raster, ServerDesktop, Geodatabase, ArcObjects, raster, Server
•• Write training materialsWrite training materialsWrite training materialsWrite training materials•• Write booksWrite books•• Review booksReview booksReview booksReview books
Developer Summit 2007Developer Summit 2007 22
SurveysSurveys
•• Please fill out a surveyPlease fill out a survey
Developer Summit 2007Developer Summit 2007 33
Intended audienceIntended audience
•• Anyone wanting to learn about ArcObjectsAnyone wanting to learn about ArcObjects•• ArcObjects basicsArcObjects basics•• ArcObjects basicsArcObjects basics•• For programmers and nonFor programmers and non--programmersprogrammers•• Maybe you knowMaybe you know•• Maybe you knowMaybe you know
–– Some ArcGISSome ArcGIS–– Some programmingSome programming
•• Not language specificNot language specific
Developer Summit 2007Developer Summit 2007 44
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 55
GeodatabaseQuestions Server
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
MapP i t
Layer
Point
PolygonPolygon
Developer Summit 2007Developer Summit 2007 66
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
U d i i h h bjU d i i h h bj•• 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
MapMap
LayerPoint
Layer
Polygon
Developer Summit 2007Developer Summit 2007 77
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–– 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 Table
Line RowLayer
Developer Summit 2007Developer Summit 2007 88
Polygon Field
Map class vs map objectMap class vs map 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 object’s properties and A class is code behind an object’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 99
How do you get ArcObjectsHow do you get ArcObjects
•• ArcObjects is not a product, by itselfArcObjects is not a product, by itself
•• You can’t buy just ArcObjectsYou can’t 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 1010
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)•• 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
U f l d IDEU f l d IDE•• Use a free open source language and IDEUse a free open source language and IDE–– PythonPython
Developer Summit 2007Developer Summit 2007 1111
–– My trail: BASIC, Fortran, SML, AML, Avenue, VB, VBA, My trail: BASIC, Fortran, SML, AML, Avenue, VB, VBA, PythonPython, C#, C#
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•• 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 objectsp g jp g j•• Applications can mix and match from different librariesApplications can mix and match from different libraries
DatabaseRecordSet
Database
Field
Developer Summit 2007Developer Summit 2007 1212
Class librariesClass libraries
•• 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
ArcObjects
•• Language independentLanguage independent
W dWord
MyClasses
Developer Summit 2007Developer Summit 2007 1313
My Application
Shapefile to word docShapefile to word doc
WordDoc
FeatureClass
Developer Summit 2007Developer Summit 2007 1414
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, ArcGlobe…ArcMap, ArcCatalog, ArcScene, ArcGlobe…
Developer Summit 2007Developer Summit 2007 1515
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
U A Obj iU A Obj i GISGIS i li ii li i•• Use ArcObjects in nonUse ArcObjects in non--GISGIS--centric applicationscentric applications
Developer Summit 2007Developer Summit 2007 1616
ArcObjects are building blocks: ServerArcObjects are building blocks: Server
•• ArcGIS Server Web mapping applications are created withArcGIS Server Web mapping applications are created with•• 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, p ,, p ,–– 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 1717
ArcGIS: a complete GISArcGIS: a complete GIS
ArcGIS Desktop
ArcGIS Explorer
WebMapping
Application
ArcGIS Engine
ArcGISMobile
Applications
DesktopDeveloper Kit
EngineDeveloper Kit API SDKAPI
ArcGIS Server
.NET COM .NET COMC++ Java
.NET Java.NET .NET
ArcObjects ArcGIS OnlineServer
ArcSDE
ServicesServerDeveloper Kit
.NET COM
JavaArcWeb Services
REST J2MEAPI
JavaScript
ArcGIS Online
ArcSDEtechnology
Data
OpenLS
REST J2ME
SOAP
Arc
JavaScript
Personal
Desktop
Developer Summit 2007Developer Summit 2007 1818
Data(Geodatabase) FileFile Personal Workgroup Enterprise
cSDE
Personalfor MSAccess
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 1919
GeodatabaseQuestions Server
Object Model DiagramsObject Model Diagrams
R d t th A Obj t lR d t th A Obj t l•• Road maps to the ArcObjects classesRoad maps to the ArcObjects classes•• Help you write codeHelp you write code
B d UMLB d UML U ifi d M d li LU ifi d M d li L•• 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 2020
Where do you get the diagrams?Where do you get the diagrams?•• Install the ArcObjects developer kitInstall the ArcObjects developer kitInstall the ArcObjects developer kitInstall the ArcObjects developer kit
–– C:C:\\Program FilesProgram Files\\ArcGISArcGIS\\DeveloperKitDeveloperKit\\DiagramsDiagrams\\*PDF*PDF•• HelpHelp
–– Per libraryPer library•• OnlineOnline
EDN W b itEDN W b it–– EDN Web siteEDN Web site–– Per libraryPer library
Developer Summit 2007Developer Summit 2007 2121
The twelve UML SymbolsThe twelve UML Symbols
•• RelationshipsRelationships
*
•• ClassesClasses
•• Properties and methodsProperties and methods
Developer Summit 2007Developer Summit 2007 2222
UML symbolsUML symbols
•• AssociationAssociation
NestChicken
Developer Summit 2007Developer Summit 2007 2323
UML symbolsUML symbols
•• MultiplicityMultiplicity•• AssociationAssociation
*
Farm
NestChicken *
Developer Summit 2007Developer Summit 2007 2424
UML symbolsUML symbols
•• MultiplicityMultiplicity•• AssociationAssociation
*
Farm
NestChicken *
2
Developer Summit 2007Developer Summit 2007 2525
Wings
UML symbolsUML symbols
•• Creates aCreates aCreates aCreates a•• MultiplicityMultiplicity•• AssociationAssociation
*
Farm
Egg NestChicken *gg
2
Developer Summit 2007Developer Summit 2007 2626
Wings
UML symbolsUML symbols
•• Is composed ofIs composed of•• Creates aCreates aCreates aCreates a•• MultiplicityMultiplicity•• AssociationAssociation
*
Farm
Egg NestChicken *gg
2
Developer Summit 2007Developer Summit 2007 2727
Wings
UML symbolsUML symbols
•• Is a type ofIs a type of•• Is composed ofIs composed of•• Creates aCreates aCreates aCreates a•• MultiplicityMultiplicity•• AssociationAssociation
*
BirdFarm
Egg NestChicken *gg
2
Developer Summit 2007Developer Summit 2007 2828
Wings
UML class symbols: Abstract classUML class symbols: Abstract class
•• 2D and not shaded2D and not shaded•• Objects can not be created from itObjects can not be created from itjj
BirdAbstract
Developer Summit 2007Developer Summit 2007 2929
UML class symbols: Abstract classUML class symbols: Abstract class
•• 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
BirdAbstract
Chicken
Developer Summit 2007Developer Summit 2007 3030
UML class symbols: CoClassUML class symbols: CoClass
•• 3D and shaded3D and shaded•• You create objects out of themYou create objects out of them
D l i blD l i bl–– Declare a variableDeclare a variable–– Instantiate an object using the New keywordInstantiate an object using the New keyword
BirdAbstract
FarmCoClass
NestC Cl
Chicken *CoClassCoClass
Developer Summit 2007Developer Summit 2007 3131
UML class symbols: ClassUML class symbols: Class
•• Other classes create or return these objectsOther classes create or return these objects•• 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 can’t create an egg without a chickenYou can’t create an egg without a chicken–– You can t create an egg without a chickenYou can t create an egg without a chicken–– You can’t get a wing without an chickenYou can’t get a wing without an chicken
BirdFarmAbstract CoClass
Egg NestChicken *C Cl
gg
2
CoClassCoClass
Developer Summit 2007Developer Summit 2007 3232
Wings
R d d it tR d d it t
UML property symbolsUML property symbols
•• 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
Chicken
You can either get or set these propertiesYou can either get or set these properties
ChickenAgeColorName
Developer Summit 2007Developer Summit 2007 3333
R d l tR d l t
UML property symbolsUML property symbols
•• Read only propertyRead only property–– Left half barbell symbolLeft half barbell symbol–– You can get this property’s valueYou can get this property’s value
Chicken
You can get this property s valueYou can get this property s value–– But you can’t change itBut you can’t change it
ChickenAgeColorNameWing(side)
Developer Summit 2007Developer Summit 2007 3434
W it l tW it l t
UML property symbolsUML property symbols
•• 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
Chicken
Usually an edit property or like a passwordUsually an edit property or like a password–– You can change the value, but you can’t get itYou can change the value, but you can’t get it
ChickenAgeColorNameWing(side)Password
Developer Summit 2007Developer Summit 2007 3535
E h t h ld lE h t h ld l
Property valuesProperty values
•• 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 objectBoolean objectBoolean, 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 typep y , , ypp y , , yp–– 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
ChickenAge: Integerg gColor: StringName: StringWing(side): WingPassword: String
Developer Summit 2007Developer Summit 2007 3636
Password: String
M th dM th d
UML method symbolUML method symbol
•• MethodMethod–– Arrow symbolArrow symbol–– Methods are actions the object can performMethods are actions the object can performMethods are actions the object can performMethods are actions the object can perform–– Sometimes called behaviorsSometimes called behaviors
Chicken
LayEggFly
Developer Summit 2007Developer Summit 2007 3737
Y it d t th dY it d t th d
Methods return valuesMethods return values
•• You write code to run a methodYou write code to run a method•• Some methods return a value, some don’tSome methods return a value, some don’t
The value’s type appears to the right of the methodThe value’s type appears to the right of the method•• The value’s type appears to the right of the methodThe value’s type appears to the right of the method–– Method, colon, and type of its return valueMethod, colon, and type of its return value–– LayEgg: EggLayEgg: Egg -- the LayEgg method returns an egg objectthe LayEgg method returns an egg objecty gg ggy gg gg y gg gg jy gg gg j–– The Fly method returns nothingThe Fly method returns nothing
Chicken
LayEgg: EggFly
Developer Summit 2007Developer Summit 2007 3838
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
pLayer = pMap.Layer(0)pLayer = pMap.Layer(0)0
Map (data frame)
0
1
2Map (data frame)Layer (index): ILayer
AddLayer (ILayer)
Layer
*2
3
AddLayer (ILayer)FeatureClass
Developer Summit 2007Developer Summit 2007 3939
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 4040
GeodatabaseQuestions Server
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 applicationsCOM 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++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 4141
COM classes have interfacesCOM classes have interfaces
Obj t t lObj t t l•• Objects are rectanglesObjects are rectangles•• Interfaces (lollypops) group properties and methodsInterfaces (lollypops) group properties and methods
G t i hb i t d bj tG t i hb i t d bj t•• Get neighboring or connected objectsGet neighboring or connected objectspLayer = pMap.Layer(0)pLayer = pMap.Layer(0)
•• Multiple interfacesMultiple interfaces•• Multiple interfacesMultiple interfaces
*Map
Layer (index): ILayerIMap Layer
AddLayer (ILayer)FeatureClassOther: SomethingIMore
Developer Summit 2007Developer Summit 2007 4242
Understanding data typesUnderstanding data types
•• Intrinsic data typesIntrinsic data typesN b t i d tN b t i d t Integer–– Numbers, strings, datesNumbers, strings, dates Integer
•• Simple objects (VB, Excel, MapObjects)Simple objects (VB, Excel, MapObjects)–– One default interfaceOne default interface Button
–– HiddenHidden _Button
•• ArcObjects ArcObjects –– Multiple interfacesMultiple interfaces
IPoint
IGeometryPoint
Developer Summit 2007Developer Summit 2007 4343
Intrinsic data types and simple objectsIntrinsic data types and simple objects
'Intrinsic data IntegerDim x As Integer 'Declarex = 4 'SetMsgBox x * 10 'Use
+ (add)- (subtract)* (multiply)g/ (divide)
'Simple ObjectDim b as CommandButton 'DeclareSet b = frmClock cmdTime 'Set
CommandbuttonColorSet b frmClock.cmdTime Set
b.Caption = “Time” 'UseEnabledFontCaptionToolTipC dB tt
Developer Summit 2007Developer Summit 2007 4444
ToolTip_CommandButton
On a VBA form
Multiple interfacesMultiple interfaces
'ArcObjectsDim p as IPoint 'DeclareSet p = New Point 'Set
'Or Di IG t 'D l
pp.z = 5280 'Use
Dim p as IGeometry 'DeclareSet p = New Point 'Setp.Projection = Albers 'Use
PointXIPoint XYZ
IPoint
Developer Summit 2007Developer Summit 2007 4545
IGeometry 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
k h th i l t d thk h th i l t d thknow how they are implemented on the serverknow how they are implemented on the server
Client code Server class
PointXIPoint
Client code Server class
Dim p as IPoint XYZ
IGeometry
o t
P j ti
Dim p as IPoint
Set p = New PointIGeometry Projection
Request DLLO
Third-party d l d
p.z = 5280
Developer Summit 2007Developer Summit 2007 4646
Request services
OLBEXE
developer code(e.g., VBA)
Dog COM class codeDog COM class code
•• Interface moduleInterface module–– Define methodsDefine methods
Interface
–– No codeNo code
Cl d lCl d lServer
•• Class moduleClass module–– Implement methodsImplement methods
Client
ESRI’s ArcObjects code
Your code
•• Developer moduleDeveloper module–– Instantiate classInstantiate class
C ll it th dC ll it th d
Developer Summit 2007Developer Summit 2007 4747
–– Call its methodsCall its methods
What COM interfaces provideWhat COM interfaces provide
•• Programming language independenceProgramming language independence•• The ability for functionality in applications toThe ability for functionality in applications to evolveevolve•• 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 codegg–– 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 4848
Implement ESRI interfacesImplement ESRI interfaces
•• Interface moduleInterface module Interface
Your
ESRI’s ArcObjects code
Your code
•• Class moduleClass module–– Implement methodsImplement methods
Server
MsgBox “Grr, Roof!”Implement methodsImplement methods
–– Write your own codeWrite your own codeClient
•• Developer moduleDeveloper module–– Instantiate classInstantiate class
C ll it th dC ll it th d
Developer Summit 2007Developer Summit 2007 4949
–– Call its methodsCall its methods
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 5050
GeodatabaseQuestions Server
Creating a custom commandCreating a custom command
•• SingleSingle--click buttons click buttons •• Execute any ArcObjects codeExecute any ArcObjects code
ESRI Add Data command
•• Execute any ArcObjects codeExecute any ArcObjects code•• ExamplesExamples
–– Custom add dataCustom add dataCustom add dataCustom add data–– Custom mapping operationsCustom mapping operations–– Show a custom dialog or windowShow a custom dialog or window
My custom command
Developer Summit 2007Developer Summit 2007 5151
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 implementspp
–– Look in the HelpLook in the Help
•• Buttons implement ICommandButtons implement ICommand
esriControlCommands
ArcMapICommand
FindButton
ArcMap Find command
Developer Summit 2007Developer Summit 2007 5252
Commands: Implement the ICommand interfaceCommands: Implement the ICommand interface
•• 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!
ICommand
Developer Summit 2007Developer Summit 2007 5353
MySmileCmd
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:pp
1.1.Create a COM/.NET project Create a COM/.NET project IUnknown
esriControlCommands
ICommandFindButton
robsLibrary
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:pp
1.1.Create a COM/.NET projectCreate a COM/.NET project2.2.Create a COM classCreate a COM class
IUnknownesriControlCommands
ICommandFindButton
IUnknownrobsLibrary
DrawChopper
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:pp
1.1.Create a COM/.NET project Create a COM/.NET project 2.2.Create a COM classCreate a COM class
IUnknownesriControlCommands
3.3.Reference the ArcGIS libraries Reference the ArcGIS libraries 4.4.Implement ArcObjects Implement ArcObjects interfacesinterfaces
ICommandFindButton
IUnknownrobsLibrary
ICommandDrawChopper
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:pp
1.1.Create a COM/.NET project Create a COM/.NET project 2.2.Create a COM classCreate a COM class
IUnknownesriControlCommands
3.3.Reference the ArcGIS libraries Reference the ArcGIS libraries 4.4.Implement ArcObjects interfacesImplement ArcObjects interfaces5.5.CompileCompile
ICommandFindButton
5.5.CompileCompile6.6.Register in an ArcGIS component category Register in an ArcGIS component category (Next Slide)(Next Slide)
IUnknownrobsLibrary
ICommandDrawChopper
Developer Summit 2007Developer Summit 2007 5757
How does ArcMap know to use my class?How does ArcMap know to use my class?•• ArcMap application start up cycle startsArcMap application start up cycle starts
1.1.Accesses the appropriate component categoryAccesses the appropriate component category
Application Starts1.
ESRIComponentCategories
ESRI M C d
Developer Summit 2007Developer Summit 2007 5858
ESRI Mx CommandsESRI Mx CommandBars
Application start up cycleApplication start up cycle•• ArcMap startsArcMap starts
1.1.Accesses the appropriate component categoryAccesses the appropriate component category22 Creates an internal objects that implements ICommandCreates an internal objects that implements ICommand2.2.Creates an internal objects that implements ICommandCreates an internal objects that implements ICommand
Command Created
2.Application Starts1.
Cmd
ICommandItemESRI
ComponentCategories
ESRI M C d
Developer Summit 2007Developer Summit 2007 5959
ESRI Mx CommandsESRI Mx CommandBars
Application start up cycleApplication start up cycle•• ArcMap startsArcMap starts
1.1.Accesses the appropriate component categoryAccesses the appropriate component category22 Creates an internal objects that implements ICommandCreates an internal objects that implements ICommand2.2.Creates an internal objects that implements ICommandCreates an internal objects that implements ICommand3.3.Creates your UI component (command, tool, toolbar, or menu) Creates your UI component (command, tool, toolbar, or menu)
Creates UIComponents
Command Created
2. 3.Application Starts1.
Cmd
ICommandItem
Cmd
Tool
Menu
ESRIComponentCategories
ESRI M C d
Developer Summit 2007Developer Summit 2007 6060
ESRI Mx CommandsESRI Mx CommandBars
Application start up cycleApplication start up cycle•• ArcMap startsArcMap starts
1.1.Accesses the appropriate component categoryAccesses the appropriate component category22 Creates an internal objects that implements ICommandCreates an internal objects that implements ICommand2.2.Creates an internal objects that implements ICommandCreates an internal objects that implements ICommand3.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
Creates UIComponents ICommandItem
Cmd
Command Created
2. 3. 4.Application Starts1.
Cmd
ICommandItem
ICommandItem
ICommandItemTool
Cmd
Tool
Menu
ESRIComponentCategories
ESRI M C d
Developer Summit 2007Developer Summit 2007 6161
ICommandItemMenu
ESRI Mx CommandsESRI Mx CommandBars
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 6262
GeodatabaseQuestions Server
Custom tools also implement IToolCustom tools also implement ITool
•• 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 Custom Default
–– Map interaction: TrackingMap interaction: Tracking–– Analysis: Select featuresAnalysis: Select features–– Editing toolsEditing tools
sketch tool in palette
Sketch palette
Editing toolsEditing tools
Developer Summit 2007Developer Summit 2007 6363
Custom toolbarsCustom toolbars
•• Container to show commands, tools, and menusContainer to show commands, tools, and menus•• Implement IToolbarDefImplement IToolbarDef•• You code the interface’s properties and methodsYou code the interface’s 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 6464
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 ESRI’s extensionsLooks like ESRI’s extensions
•• Description appears at the bottomDescription appears at the bottom•• Description appears at the bottomDescription appears at the bottom–– Extension name and versionExtension name and version–– Copyright and company nameCopyright and company name
Developer Summit 2007Developer Summit 2007 6565
–– Extension purposeExtension purpose
Extension interfacesExtension interfaces•• IExtensionConfig is requiredIExtensionConfig is required
–– Can be like a silent, invisible extension, and won’t appear in listCan be like a silent, invisible extension, and won’t appear in list–– Load dataLoad data
CC–– Check statusCheck status•• IExtension is optionalIExtension is optional
–– Adds extension to the Extension Manager window’s listAdds extension to the Extension Manager window’s listAdds extension to the Extension Manager window s listAdds extension to the Extension Manager window s list–– Could load your toolbar and commandsCould load your toolbar and commands
Developer Summit 2007Developer Summit 2007 6666
Add table of contents tabsAdd table of contents tabs•• Implement IContentsViewImplement IContentsView
Developer Summit 2007Developer Summit 2007 6767
Add ArcCatalog tabsAdd ArcCatalog tabs•• Implement IGxViewImplement IGxView
Developer Summit 2007Developer Summit 2007 6868
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
Developer Summit 2007Developer Summit 2007 6969
FeatureClass
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
Developer Summit 2007Developer Summit 2007 7070
FeatureClass
Some Geodatabase API objectsSome Geodatabase API objects
•• ObjectClass is a regular tableObjectClass is a regular table•• FeatureClass is a table with shape fieldFeatureClass is a table with shape field
WorkspaceFactory DatasetWorkspace
Access ArcInfo GeoDataset Table
SDE ShapefileRasterDataset ObjectClass
And others…
RasterDataset ObjectClass
F t ClFeatureDataset
Developer Summit 2007Developer Summit 2007 7171
FeatureClassFeatureDataset
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 7272
GeodatabaseQuestions Server
Levels of customizationLevels of customization
Customf t Cfeatures C++>
Class & workspaceextensions VB & C# >extensions VB & C# >
Editor VBA>
Connectivity& topo rules
Subtypes
Domains& validation
Developer Summit 2007Developer Summit 2007 7373
Subtypes& defaults
Levels of GeoDatabase customizationLevels of GeoDatabase customization
ArcMap A C t lCustom
• ClientsArcMap ArcCatalogArcMap ArcCatalog ApplicationArcMap, ArcCatalog
Custom Application
Geodatabase (API)
Cad Files
Coverages
Shapefiles MyFormatmdb ArcSDE • Geodatabase
Class Extensions
Developer Summit 2007Developer Summit 2007 7474
Level of customizationLevel of customization
•• Application levelApplication levelpppp–– 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•• 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 7575
Extendable objectsExtendable objects
WorkspaceExtensionp
DatasetWorkspace0..*
Dataseto space
0 1GeoDataset ObjectClass ClassExtension
0..1
FeatureClassFeatureDataset FeatureClassExtension
Developer Summit 2007Developer Summit 2007 7676
Class extension factsClass extension facts
•• They are They are notnot software extensions that you loadsoftware extensions that you loadLike Spatial AnalystLike Spatial Analyst–– 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 behaviory p, y gy p, y g•• Behavior Behavior liveslives in the databasein the database•• One class extension per classOne class extension per class
Developer Summit 2007Developer Summit 2007 7777
Class extension usesClass extension uses
•• Schema generation Schema generation gg•• 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 7878
Class extension exampleClass extension example
•• ESRI’s Attribute inspector ESRI’s Attribute inspector •• From the Editor toolbarFrom the Editor toolbar
Developer Summit 2007Developer Summit 2007 7979
Custom inspectorCustom inspector
•• Extend behavior of an entire feature classExtend behavior of an entire feature class•• Your window appears instead of ESRI’sYour window appears instead of ESRI’s•• Behavior stored with the data, not in an mxd fileBehavior stored with the data, not in an mxd file
Developer Summit 2007Developer Summit 2007 8080
Make your own custom feature classesMake your own custom feature classes
•• IFeatureClassDraw IFeatureClassDraw –– Override a feature class’s drawing for any clientOverride a feature class’s 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 creationU t f t lU t f t l–– User can create your feature classUser can create your feature class
Developer Summit 2007Developer Summit 2007 8181
Your description here(In ArcCatalog)
Behavior interfaces: Listen and ReactBehavior interfaces: Listen and React
•• IObjectClassValidationIObjectClassValidation
V lid ti tValidation event:Building height must be 10 times the number of storiesthe number of stories
Developer Summit 2007Developer Summit 2007 8282
Behavior interfaces: Listen and ReactBehavior interfaces: Listen and React
•• IObjectClassValidationIObjectClassValidation•• IRelatedObjectClassEventsIRelatedObjectClassEvents•• IRelatedObjectClassEventsIRelatedObjectClassEvents•• IConfimSendRelatedObjectEventsIConfimSendRelatedObjectEvents
V lid ti tValidation event:Building height must be 10 times the number of storiesthe number of stories
A b ildi i dd d tif l t d
Developer Summit 2007Developer Summit 2007 8383
As a building is added, notify related parcel to update its structure count
Behavior interfaces: Listen and ReactBehavior interfaces: Listen and React
•• IObjectClassValidationIObjectClassValidation•• IRelatedObjectClassEventsIRelatedObjectClassEvents•• IRelatedObjectClassEventsIRelatedObjectClassEvents•• IConfimSendRelatedObjectEventsIConfimSendRelatedObjectEvents•• IObjectClassEventsIObjectClassEvents (OnCreate OnDelete OnChange)(OnCreate OnDelete OnChange)•• IObjectClassEvents IObjectClassEvents (OnCreate, OnDelete, OnChange)(OnCreate, OnDelete, OnChange)
V lid ti t O M difValidation event:Building height must be 10 times the number of stories
OnModify:Record current time and user name in the tablethe number of stories name in the table
A b ildi i dd d tif l t d
Developer Summit 2007Developer Summit 2007 8484
As a building is added, notify related parcel to update its structure count
Registering class extensions with the geodatabaseRegistering class extensions with the geodatabase
•• Limit of one class extension per classLimit of one class extension per class•• Limit of one class extension per classLimit of one class extension per class•• Class extension’s GUID must be registered on all client Class extension’s GUID must be registered on all client
machines accessing datamachines accessing datamachines accessing datamachines accessing data•• Methods to register extension:Methods to register extension:
–– During creation: During creation: IFeatureWorkspace CreateFeatureClassIFeatureWorkspace CreateFeatureClass–– After creation: After creation: IClassSchemaEdit AlterClassExtensionCLSIDIClassSchemaEdit AlterClassExtensionCLSID–– When modeling and designing in VisioWhen modeling and designing in Visio
The object classes table within a geodatabase
MyParcelClassExtension
NameID1 Parcels
CLSID{3070721…
EXTCLSID{0368CF51…
2 Buildings {3070721…
within a geodatabase
Developer Summit 2007Developer Summit 2007 8585
2 Buildings {
3 Owners {3070721… {044782D…
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 8686
GeodatabaseQuestions Server
CASE ProcessCASE Process
•• UML UML Repository Repository GDB schema or C++ code GDB schema or C++ code
SchemaCreation
ArcCatalog
Building FClass
Visio CASE Tool
Creation
Repository
UML Obj tLandBase.DLL
Visual Studio
UML Object Model Design Code
GenerationBuilding
Developer Summit 2007Developer Summit 2007 8787
Visio applicationVisio applicationDrawing pageStencils
Developer Summit 2007Developer Summit 2007 8888
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•• AttributesAttributes become fields in the tablebecome fields in the table
Feature+Shape : esriFieldTypeGeometry
Feature
MyBuildingMyParcel-Stories : esriFieldTypeInteger-Height : esriFieldTypeInteger-BuildingValue : esriFieldTypeInteger-ParcelID : esriFieldTypeInteger
MyBuilding-ParcelValue : esriFieldTypeInteger-CombinedBuildingValue : esriFieldTypeInteger
MyParcel
Developer Summit 2007Developer Summit 2007 8989
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
Ch iCh i
Visio
•• Choose a repositoryChoose a repository
RepositoryRepository
C t hCreate schema
Developer Summit 2007Developer Summit 2007 9090
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 9191
GeodatabaseQuestions Server
ArcGIS EngineArcGIS Engine
StandaloneStandalone NonNon--visualvisual
E b dd dE b dd dEmbedded Embedded applicationsapplications
Developer Summit 2007Developer Summit 2007 9292
ArcGIS EngineArcGIS Engine
Two ProductsTwo ProductsE i D l Kit i th t lkit f b ildi tE i D l Kit i th t lkit f b ildi t•• 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 applicationsrun custom Engine applicationsrun custom Engine applications
Developer Summit 2007Developer Summit 2007 9393
Developer ControlsDeveloper Controls
•• MapControlMapControl•• PageLayoutControlPageLayoutControl•• ToolbarControlToolbarControl•• TOCControlTOCControl•• ReaderControlReaderControl•• SceneControlSceneControl•• GlobeControlGlobeControl
Developer Summit 2007Developer Summit 2007 9494
The Map ControlThe Map Control
P t th t l i W dP t th t l i W d•• 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 9595
Tools and CommandsTools and Commands
More than 100 tools and commands includedMore than 100 tools and commands included
Developer Summit 2007Developer Summit 2007 9696
ArcGIS Engine FunctionalityArcGIS Engine Functionality
•• Read all supported ESRI data formats including the Read all supported ESRI data formats including the geodatabasegeodatabasegeodatabasegeodatabase
•• Map authoring (create and edit MXD)Map authoring (create and edit MXD)•• ArcGIS level cartographyArcGIS level cartographyArcGIS level cartographyArcGIS level cartography•• Query and analysisQuery and analysis•• GeocodingGeocodingGeocodingGeocoding•• Simple editing (shp and pGDB)Simple editing (shp and pGDB)
“ArcView without the applications”
Developer Summit 2007Developer Summit 2007 9797
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 9898
GeodatabaseQuestions Server
Learning ArcGIS ServerLearning ArcGIS Server
•• Training classesTraining classesIntroIntro Two day classTwo day class–– Intro Intro –– Two day classTwo day class
–– Developing Developing –– Three day classThree day class
•• EDN with walkEDN with walk--throughsthroughsgg•• Forum discussionsForum discussions•• Blog with examplesBlog with examples
Developer Summit 2007Developer Summit 2007 9999
Lecture PathLecture Path
UnderThe
Interfaces& COMWhat are
ArcObjectsDiagrams Implement
ESRII t fThe
HoodInterfaces
Extendthe
ApplicationsApplicationsTechTalk
CASEtools
Extendthe
GeodatabaseQuestions
Wrap-up Engine
Server
Area
Developer Summit 2007Developer Summit 2007 100100
GeodatabaseQuestions Server
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:•• 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 101101
SurveysSurveys
•• Please fill out a surveyPlease fill out a survey
Developer Summit 2007Developer Summit 2007 102102
Further questions?Further questions?
•• Our TECHOur TECH--TALK AREATALK AREAWhere:Where: TECHTECH--TALK area 5TALK area 5–– 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
Developer Summit 2007Developer Summit 2007 103103
top related