+ All Categories
Home > Documents > Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an...

Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an...

Date post: 07-Aug-2020
Category:
Upload: others
View: 11 times
Download: 0 times
Share this document with a friend
67
ESRI Developer Summit 2008 ESRI Developer Summit 2008 1 1 Mike Rudden Mike Rudden Innes Mackenzie Innes Mackenzie Introduction to ArcGIS Desktop and ArcGIS Engine Introduction to ArcGIS Desktop and ArcGIS Engine Development Development
Transcript
Page 1: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 11

Mike RuddenMike RuddenInnes MackenzieInnes Mackenzie

Introduction to ArcGIS Desktop and ArcGIS Engine Introduction to ArcGIS Desktop and ArcGIS Engine DevelopmentDevelopment

Page 2: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Schedule

• 4 hour session– 1 official break

• Please ask questions at any time

• Please complete the session survey – we take your feedback seriously

ESRI Developer Summit 2008ESRI Developer Summit 2008 22

Page 3: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Session Objectives Session Objectives

•• Gain an understanding of ArcObjects and how they Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or to build can be used to customize ArcGIS Desktop or to build an ArcGIS Engine applicationan ArcGIS Engine application

•• Some specific aims:Some specific aims:–– Write ArcObjects code to access a file geodatabase feature Write ArcObjects code to access a file geodatabase feature

class and add it to a map as a layerclass and add it to a map as a layer–– Build a simple ArcGIS Engine MapControl applicationBuild a simple ArcGIS Engine MapControl application–– Create a custom command that will work in both ArcGIS Create a custom command that will work in both ArcGIS

Desktop and ArcGIS EngineDesktop and ArcGIS Engine

ESRI Developer Summit 2008ESRI Developer Summit 2008 33

Page 4: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 44

ProductOverview

UnderstandingArcObjects

DevelopmentEnvironments

DeveloperResources

ObjectModel

Diagrams

DesktopCustomization

UsingVBA

CustomComponents

EngineControls

Apps

Page 5: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

55

ArcGIS Desktop: for GIS users ArcGIS Desktop: for GIS users

•• ArcMap, ArcCatalog, ArcScene, ArcGlobeArcMap, ArcCatalog, ArcScene, ArcGlobe

•• License LevelsLicense Levels–– ArcViewArcView–– ArcEditorArcEditor–– ArcInfoArcInfo

WindowsWindows

ESRI Developer Summit 2008ESRI Developer Summit 2008

Page 6: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ArcGIS Desktop: for developersArcGIS Desktop: for developers

•• ArcGIS Desktop is built using ArcObjectsArcGIS Desktop is built using ArcObjects

•• All ArcGIS Desktop applications can be customized All ArcGIS Desktop applications can be customized using ArcObjectsusing ArcObjects

•• Embedded Visual Basic for Applications (VBA)Embedded Visual Basic for Applications (VBA)

•• ArcGIS Desktop Developer kit ArcGIS Desktop Developer kit –– Developer help system Developer help system

and samplesand samples–– APIAPI’’s for COM & .NETs for COM & .NET–– Developer ToolsDeveloper Tools–– VB6 AddinsVB6 Addins–– IDE integration IDE integration

into Visual Studio .NETinto Visual Studio .NETESRI Developer Summit 2008ESRI Developer Summit 2008 66

Page 7: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 77

ArcGIS Engine: for developersArcGIS Engine: for developers

•• Deployment: ArcGIS Engine RuntimeDeployment: ArcGIS Engine Runtime–– 2 levels of product licensing available:2 levels of product licensing available:

–– Standard Runtime = ArcViewStandard Runtime = ArcView–– Geodatabase Update = ArcEditorGeodatabase Update = ArcEditor–– + extensions + extensions -- 3D Analyst, Network Analyst3D Analyst, Network Analyst……

• Development: ArcGIS Engine Developer kit –– ArcGIS Engine RuntimeArcGIS Engine Runtime–– Developer help system Developer help system

and samplesand samples– API’s for COM , .NET, Java, C++–– Visual development componentsVisual development components–– IDE integration into Visual Studio .NETIDE integration into Visual Studio .NET

Windows, Solaris, Linux (Intel)Windows, Solaris, Linux (Intel)

Page 8: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Develper Summit 2008Develper Summit 2008 88

What you can do with ArcGIS EngineWhat you can do with ArcGIS Engine……

StandaloneStandalone

NonNon--visualvisual

Embedded Embedded applicationsapplications

Page 9: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 99

Why Customize?Why Customize?

•• ArcGIS Desktop: Specialize the applicationsArcGIS Desktop: Specialize the applications

•• ArcGIS Engine: Add GIS functionality to an applicationArcGIS Engine: Add GIS functionality to an application

•• Add functionality toAdd functionality to–– Manage dataManage data–– EditingEditing–– AnalysisAnalysis–– SymbolizationSymbolization–– Layout and outputLayout and output ……

•• Streamline work flowStreamline work flow

Demo

Page 10: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 1010

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

The ArcGIS SystemThe ArcGIS System

Page 11: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 1111

ProductOverview

UnderstandingArcObjects

DevelopmentEnvironments

DeveloperResources

ObjectModel

Diagrams

DesktopCustomization

UsingVBA

CustomComponents

EngineControls

Apps

Page 12: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ArcGIS & ArcObjectsArcGIS & ArcObjects

ESRI Developer Summit 2008ESRI Developer Summit 2008 1212

•• ArcObjects are ArcObjects are software componentssoftware components

•• ArcObjects is not a ArcObjects is not a product, by itselfproduct, by itself

•• ArcGIS is built using ArcGIS is built using ArcObjectsArcObjects

•• Developers use Developers use ArcObjects to ArcObjects to customize or build customize or build applicationsapplications

Page 13: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

How ESRI Builds ArcObjectsHow ESRI Builds ArcObjects

ESRI Developer Summit 2008ESRI Developer Summit 2008 1313

C++ source codeC++ source codeClass LibrariesClass Libraries

Binary DLLsBinary DLLsArcGISArcGIS\\bin directorybin directory

.NET API

Build Process

JAVA API C++ API

C++ type informationC++ type informationType LibrariesType Libraries

OLB filesOLB filesArcGISArcGIS\\com directorycom directory

COM API

Page 14: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ArcGIS Products share ArcObjectsArcGIS Products share ArcObjects

ESRI Developer Summit 2008ESRI Developer Summit 2008 1414

ArcGIS Desktop ArcGIS Engine

Page 15: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 1515

ArcObjects libraries ArcObjects libraries

•• Logical groupings of functionalityLogical groupings of functionality•• Product, extensions and license determine availabilityProduct, extensions and license determine availability

More …

Geometry, Display, System

Geodatabase, DataSourcesFile

Geodatabase, Carto

Carto

Controls

Demo

Page 16: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Geometry

Carto

ArcObjects ClassesArcObjects Classes

ESRI Developer Summit 2008ESRI Developer Summit 2008 1616

Map

LayerPoint

Polygon

•• Grouped into over 70 librariesGrouped into over 70 libraries• Over 3,400 ArcObjects classes•• Over 21,00 properties and methodsOver 21,00 properties and methods

Page 17: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 1717

ArcObjects ClassesArcObjects Classes

•• All ArcObjects are COM classesAll ArcObjects are COM classes–– Program using interfacesProgram using interfaces–– Properties and methods never changeProperties and methods never change–– New interfaces may be addedNew interfaces may be added–– Use any COMUse any COM--compliant languagecompliant language

Map

AddLayerDeleteLayer

Name

RefreshExtentIActiveView

IMap

Page 18: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

•• Reference appropriate libraries:Reference appropriate libraries:–– COM COM -- type libraries OLBtype libraries OLB’’ss–– .NET .NET -- assemblies (PIAassemblies (PIA’’s)s)–– Java Java -- jar filesjar files–– C++ C++ -- header files (.h)header files (.h)

•• Using ArcObjects types in .NET:Using ArcObjects types in .NET:

Working with ArcObjects COM classesWorking with ArcObjects COM classes

'Visual Basic .NET keyword > ImportsImports ESRI.ArcGIS.CartoDim activeView As IActiveView

//Visual C# .NET keyword > using using ESRI.ArcGIS.Carto;

'Without importing the namespaceDim activeView As ESRI.ArcGIS.Carto.IActiveView

ESRI Developer Summit 2008ESRI Developer Summit 2008 1818

Page 19: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 1919

Working with ArcObjects COM classesWorking with ArcObjects COM classes

•• Instantiate COM classes with an interfaceInstantiate COM classes with an interface–– Dim Dim <variable><variable> As As <interface><interface>

•• Must create Must create New New or instantiateor instantiate

' VB.NET' Creating a new mapDim map As IMap = New Map

' Using the map from a map documentDim map As IMapmap = axMapControl1.ActiveView.FocusMap

' Use properties/methods on IMap map.Name = “My map”

Page 20: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 2020

•• Move between interfaces Move between interfaces –– Use Query Interface in COMUse Query Interface in COM–– Use casting in .NETUse casting in .NET

Working with ArcObjects COM classesWorking with ArcObjects COM classes

' VB 6Dim map As IMapSet map = axMapControl1.ActiveView.FocusMapDim av As IActiveViewSet av = map 'QIav.Refresh

Map

RefreshExtentIActiveView

Name

Clear SelectionAdd Layer

IMap

'QI

IActiveView av = map as IActiveView; // C#

Dim av As IActiveView = CType(map, IActiveView) 'VB .NET

Demo

Page 21: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ReviewReview

•• What are interfaces?What are interfaces?–– Logical groups of properties and methodsLogical groups of properties and methods

•• What does QI stand for?What does QI stand for?–– QueryInterfaceQueryInterface

•• Why would you use QI?Why would you use QI?–– To access the properties and methods of another interface on To access the properties and methods of another interface on

the same objectthe same object

•• Complete the following:Complete the following:

ESRI Developer Summit 2008ESRI Developer Summit 2008 2121

'VB .NETDim map As IMap = New Mapmap.Name = “My map”

? ?

Page 22: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 2222

ProductOverview

UnderstandingArcObjects

DevelopmentEnvironments

DeveloperResources

ObjectModel

Diagrams

DesktopCustomization

UsingVBA

CustomComponents

EngineControls

Apps

Page 23: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Understanding Object Model DiagramsUnderstanding Object Model Diagrams

•• Conceptually only 1 diagramConceptually only 1 diagram–– Spread over many for viewing and printing purposesSpread over many for viewing and printing purposes

•• Represents the contents of type librariesRepresents the contents of type libraries

ESRI Developer Summit 2008ESRI Developer Summit 2008 2323

Page 24: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

--

•• Interfaces contain properties, methods and eventsInterfaces contain properties, methods and events•• Properties:Properties:

–– Read/Write Read/Write –– Read OnlyRead Only–– Write OnlyWrite Only–– Write (by ref)Write (by ref)

•• Methods:Methods:–– MethodsMethods

•• Events: Events: –– EventsEvents

Properties, Methods and EventsProperties, Methods and Events

ESRI Developer Summit 2008ESRI Developer Summit 2008 2424

Page 25: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

CoclassesCoclasses

•• Creatable: use the Creatable: use the NewNew keywordkeyword

•• Instantiable: obtain from other objectsInstantiable: obtain from other objects

Dim map As IMap = New Map

Dim map As IMapmap = mapDoc.ActiveView.FocusMap

OMD symbol: 3D shaded rectangle

OMD symbol: 3D shaded rectangle

ESRI Developer Summit 2008ESRI Developer Summit 2008 2525

Page 26: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Classes Classes •• Instantiable classInstantiable class

–– Cannot create with Cannot create with NewNew keywordkeyword

•• Obtain instances from other objectsObtain instances from other objects‘ VB.NETDim newRow As IRownewRow = aTable.CreateRow()

OMD symbol: 3D unshaded

rectangle

OMD symbol: 3D unshaded

rectangle

ESRI Developer Summit 2008ESRI Developer Summit 2008 2626

Page 27: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Abstract classesAbstract classes

•• Not creatable or instantiableNot creatable or instantiable–– Can never have instances of an Can never have instances of an

abstract classabstract class

•• Define general interfaces for Define general interfaces for subclassessubclasses–– Subclasses inherit interfacesSubclasses inherit interfaces

OMD symbol: 2D unshaded rectangle

OMD symbol: 2D unshaded rectangle

ESRI Developer Summit 2008ESRI Developer Summit 2008 2727

Page 28: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

•• UML notation:UML notation:

OMD relationship symbolsOMD relationship symbols

Is a type of

Is composed of

Creates a

Multiplicity

Association

Wormhole (not UML)

In Conjunction with

*_____

ESRI Developer Summit 2008ESRI Developer Summit 2008 2828

Page 29: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

OMD Relationships: MapDocument objects OMD Relationships: MapDocument objects

Map

Layer

*

*

FeatureLayer

MapDocument

RasterLayer

ArcMapArcMap

ArcGIS EngineArcGIS Engine

ESRI Developer Summit 2008ESRI Developer Summit 2008 2929

Page 30: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

OMD Relationships: Geodatabase objects OMD Relationships: Geodatabase objects

ESRI Developer Summit 2008ESRI Developer Summit 2008 3030

Demo

Page 31: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Implementation (Implementation (““Type ofType of”” ) Inheritance) Inheritance

•• Occurs when abstract classes are presentOccurs when abstract classes are present•• Similar to accessing other interfaces on an objectSimilar to accessing other interfaces on an object•• Access additional interfaces using a QIAccess additional interfaces using a QI

Dim topoLayer As ITopologyLayertopoLayer = New TopologyLayer'Assign topology layer propertiestopoLayer.Renderer = topoRenderer

'Assign some general propertiesDim aLayer As ILayeraLayer = CType(topoLayer, Ilayer)aLayer.Name = "Cadastral Topology"aLayer.ShowTips = False

ESRI Developer Summit 2008ESRI Developer Summit 2008 3131

Page 32: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

•• Access additional interfaces without a QIAccess additional interfaces without a QI•• Check right side of interfaceCheck right side of interface

–– If another interface is listed:If another interface is listed:•• Can access its members on one variableCan access its members on one variable•• Do not need to QIDo not need to QI

Interface InheritanceInterface Inheritance

Dim rasterLayer As IRasterLayerrasterLayer = New RasterLayer'Assign raster propertyrasterLayer.Raster = raster

'Assign some general propertiesrasterLayer.Name = "My layer"rasterLayer.Visible = False

ESRI Developer Summit 2008ESRI Developer Summit 2008 3232

Demo

Page 33: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Exercise: Add a layer to MapControlExercise: Add a layer to MapControl

•• Using the handout provided write out the ArcObjects Using the handout provided write out the ArcObjects code to add a file geodatabase featureclass to a code to add a file geodatabase featureclass to a MapControl as a layerMapControl as a layer

ESRI Developer Summit 2008ESRI Developer Summit 2008 3333

Demo

Page 34: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 3434

Access the ActiveView from the MapControl

Access the FocusMap on the ActiveView

Make a new FileGDBWorkspaceFactory object

Get a Workspace from the FileGDBWorkspaceFactory

Get the FeatureClass from the Workspace

Make a new FeatureLayer object

Set the FeatureClass for the FeatureLayer

Assign the Name and ShowTips properties

Add the FeatureLayer to the FocusMap

Pseudo Code: Add layer to the MapControl

Page 35: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Dim activeView As IActiveViewactiveView = axMapControl1.ActiveView

Dim focusMap As IMapfocusMap =

Dim fileGDBWSF As IWorkspaceFactory = New FileGDBWorkspaceFactory

Dim workspace As IWorkspaceworkspace = fileGDBWSF. ("C…TemplateData.gdb",0)

Dim fws As IFeatureWorkspacefws = CType( , IFeatureWorkspace)

Dim featClass As IFeatureClassfeatClass = fws.OpenFeatureClass(“States")

Dim featLayer As IFeatureLayer = New FeatureLayerfeatLayer.FeatureClass = featLayer.Name = “USA States"featLayer.ShowTips = True

focusMap.AddLayer(featLayer)

activeView.FocusMap

OpenFromFile

workspace

featClass

?

?

?

?

ESRI Developer Summit 2008ESRI Developer Summit 2008 3535

Page 36: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

•• What is the difference between a class and a coclass?What is the difference between a class and a coclass?–– Coclass: create with New keyword or obtain from another objectCoclass: create with New keyword or obtain from another object–– Class: obtain instances from another objectClass: obtain instances from another object

•• Describe interface inheritance?Describe interface inheritance?–– No QI required, members of inherited interfaces available No QI required, members of inherited interfaces available

directlydirectly

•• Describe Implementation Describe Implementation ““type oftype of”” inheritanceinheritance–– When abstract class is presentWhen abstract class is present–– QI required: similar to accessing other interfaces on an object QI required: similar to accessing other interfaces on an object

ReviewReview

ESRI Developer Summit 2008ESRI Developer Summit 2008 3636

Page 37: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 3737

ProductOverview

UnderstandingArcObjects

DevelopmentEnvironments

DeveloperResources

ObjectModel

Diagrams

DesktopCustomization

UsingVBA

CustomComponents

EngineControls

Apps

Page 38: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Network (EDN)ESRI Developer Network (EDN)

•• Software Library:Software Library:–– ArcGIS Engine (Developer Kit & 1 Runtime)ArcGIS Engine (Developer Kit & 1 Runtime)–– ArcGIS Dektop: ArcView or ArcEditor (optional extra)ArcGIS Dektop: ArcView or ArcEditor (optional extra)–– ArcGIS ServerArcGIS Server–– …… many other productsmany other products

•• EDN websiteEDN website–– http://edn.esri.comhttp://edn.esri.com

•• Technical Support & TrainingTechnical Support & Training

For Development and Testing OnlyFor Development and Testing OnlyESRI Developer Summit 2008ESRI Developer Summit 2008 3838

Demo

Page 39: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 3939

Key ResourcesKey Resources

•• ArcGIS Desktop & ArcGIS Engine Developer HelpArcGIS Desktop & ArcGIS Engine Developer Help–– How to DocumentsHow to Documents–– SamplesSamples–– Snippets (.NET)Snippets (.NET)

•• ESRI Training courseESRI Training course–– Virtual campus or classroom courseVirtual campus or classroom course–– http://campus.esri.comhttp://campus.esri.com

•• ESRI PressESRI Press–– ArcGIS Engine DeveloperArcGIS Engine Developer’’s Guide: ArcGIS 9s Guide: ArcGIS 9–– ArcGIS Desktop DeveloperArcGIS Desktop Developer’’s Guide: ArcGIS 9 s Guide: ArcGIS 9 –– Getting to know ArcObjects by Rob Burke (ArcGIS 9.x)Getting to know ArcObjects by Rob Burke (ArcGIS 9.x)

Demo

Page 40: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 4040

ProductOverview

UnderstandingArcObjects

DevelopmentEnvironments

DeveloperResources

ObjectModel

Diagrams

DesktopCustomization

UsingVBA

CustomComponents

EngineControls

Apps

Page 41: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Supported ArcGIS Product APIsSupported ArcGIS Product APIs

•• Desktop APIs (COM and .NET)Desktop APIs (COM and .NET)–– VBA VBA –– customize documents (MXD and MXT)customize documents (MXD and MXT)–– Custom components (dllCustom components (dll’’s) s) –– commands, tools, windows, commands, tools, windows,

extensionsextensions

•• Engine APIs (COM, .NET, Java and C++)Engine APIs (COM, .NET, Java and C++)–– Build custom standBuild custom stand--alone applications (exealone applications (exe’’s)s)–– Embed into existing applicationsEmbed into existing applications–– Custom components (dllCustom components (dll’’s) s) –– commands, tools, windows, commands, tools, windows,

extensionsextensions

ESRI Developer Summit 2008ESRI Developer Summit 2008 4141

Page 42: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Platforms Platforms –– 9.2 Release9.2 Release

•• ArcGIS DesktopArcGIS Desktop–– Windows 2000Windows 2000–– Windows 2003 Server (& Terminal Server)Windows 2003 Server (& Terminal Server)–– Windows XPWindows XP–– Vista (support added at 9.2 sp2)Vista (support added at 9.2 sp2)

•• ArcGIS EngineArcGIS Engine–– All windows operating systems listed aboveAll windows operating systems listed above–– Linux Linux -- Intel Red Hat Intel Red Hat –– 3 & 43 & 4–– Linux Linux -- Intel SUSE Intel SUSE -- 99–– SUN Solaris 10SUN Solaris 10–– SUN Solaris 9SUN Solaris 9

ESRI Developer Summit 2008ESRI Developer Summit 2008 4242

Page 43: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

APIs and Development EnvironmentsAPIs and Development Environments

•• COM COM –– Visual Studio 6.0 (VB, VC++)Visual Studio 6.0 (VB, VC++)–– Visual Studio .NET (VC++)Visual Studio .NET (VC++)

•• .NET.NET–– Visual Studio .NET (VB.NET, C#, VC++)Visual Studio .NET (VB.NET, C#, VC++)–– 9.1 PIA9.1 PIA’’s compiled against .NET 1.0s compiled against .NET 1.0–– 9.2 PIA9.2 PIA’’s compiled against .NET 2.0s compiled against .NET 2.0–– Visual Studio 2008 will be supported at 9.3Visual Studio 2008 will be supported at 9.3

•• C++C++–– Linux/Solaris Linux/Solaris -- Any as long as use a supported compiler.Any as long as use a supported compiler.–– Windows Windows –– Visual Studio 2005Visual Studio 2005

•• JavaJava–– JBuilder, Eclipse (has templates), JDKJBuilder, Eclipse (has templates), JDK

ESRI Developer Summit 2008ESRI Developer Summit 2008 4343

Page 44: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Choosing an API and Development EnvironmentChoosing an API and Development Environment

•• Type of applicationType of application•• Programming skillProgramming skill•• PerformancePerformance•• PlatformPlatform•• Deployment and distributionDeployment and distribution

ESRI Developer Summit 2008ESRI Developer Summit 2008 4444

Page 45: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 4545

ProductOverview

UnderstandingArcObjects

DevelopmentEnvironments

DeveloperResources

ObjectModel

Diagrams

DesktopCustomization

UsingVBA

CustomComponents

EngineControls

Apps

Page 46: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Customizing ArcGIS Desktop with VBACustomizing ArcGIS Desktop with VBA

•• Use VBA to extend ArcMap/ArcCatalogUse VBA to extend ArcMap/ArcCatalog•• Create custom Create custom

user forms, user forms, buttons and buttons and toolstools

•• Automate Automate workflowsworkflows

ESRI Developer Summit 2008ESRI Developer Summit 2008 4646

Page 47: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ArcObjects starting points in VBAArcObjects starting points in VBA

•• These two objects are always available in VBA:These two objects are always available in VBA:–– ApplicationApplication–– MxDocument (ArcMap)MxDocument (ArcMap)

Application Application -- -- -- -- -- -- -- >>

ThisDocument ThisDocument -- -- -- -- -- >>

ESRI Developer Summit 2008ESRI Developer Summit 2008 4747

Demo

Page 48: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

•• AdvantagesAdvantages–– Free! Free! –– Easy to write macros and Easy to write macros and

scriptsscripts–– Easy to debugEasy to debug–– Easy to distributeEasy to distribute–– Use all ArcObjects availableUse all ArcObjects available

•• DisadvantagesDisadvantages–– Can not write COM Can not write COM

componentscomponents–– Can not create extensions or Can not create extensions or

advanced customization advanced customization –– Code is not a binaryCode is not a binary

Customizing the Desktop with VBACustomizing the Desktop with VBA

ESRI Developer Summit 2008ESRI Developer Summit 2008 4848

Page 49: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 4949

ProductOverview

UnderstandingArcObjects

DevelopmentEnvironments

DeveloperResources

ObjectModel

Diagrams

DesktopCustomization

UsingVBA

CustomComponents

EngineControls

Apps

Page 50: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ArcGIS Engine ControlsArcGIS Engine ControlsDesign timeDesign time

Run timeRun timeTOCControlTOCControl

MapControlMapControl

ToolbarControlsToolbarControls

LicenseControlLicenseControl

PageLayoutControlPageLayoutControl

Other Controls:

SymbologyControlGlobeControlSceneControl

Other Controls:

SymbologyControlGlobeControlSceneControl

ESRI Developer Summit 2008ESRI Developer Summit 2008 5050

Page 51: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ArcGIS Engine Control CommandsArcGIS Engine Control Commands

•• Individual userIndividual user--interface componentsinterface components–– Open and save map documents (.mxd, .mxt, .lyr)Open and save map documents (.mxd, .mxt, .lyr)–– Add Data Add Data (SDE data support with 9.2 sp2)(SDE data support with 9.2 sp2)–– Map Navigation (2D & 3D)Map Navigation (2D & 3D)–– Online ServicesOnline Services–– EditingEditing–– Page LayoutPage Layout–– InkInk…… many moremany more

ESRI Developer Summit 2008ESRI Developer Summit 2008 5151

Page 52: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Building ArcGIS Engine applicationsBuilding ArcGIS Engine applications

1.1. Start a new projectStart a new project•• Add Engine controls manuallyAdd Engine controls manually•• Use IDE integration tools (.NET, Java)Use IDE integration tools (.NET, Java)

2.2. License the applicationLicense the application

3.3. Add controls, commands and toolsAdd controls, commands and tools

DEMODEMOESRI Developer Summit 2008ESRI Developer Summit 2008 5252

Page 53: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

GeoprocessingGeoprocessing

•• New Geoprocessing coarse grained framework and New Geoprocessing coarse grained framework and toolstools

•• New API for .NET developersNew API for .NET developers•• Run existing tools, scripts and modelsRun existing tools, scripts and models•• Author new toolsAuthor new tools•• Be aware of licensing levelBe aware of licensing level

ESRI Developer Summit 2008ESRI Developer Summit 2008 5353

Page 54: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 5454

ProductOverview

UnderstandingArcObjects

DevelopmentEnvironments

DeveloperResources

ObjectModel

Diagrams

DesktopCustomization

UsingVBA

CustomComponents

EngineControls

Apps

Page 55: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Custom ComponentsCustom Components

•• Powerful mechanism for extending functionalityPowerful mechanism for extending functionality•• Use stand alone programming languageUse stand alone programming language

ToolbarToolbar CommandCommand

MenubarMenubar

ExtensionExtension

ESRI Developer Summit 2008ESRI Developer Summit 2008 5555

Page 56: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Customization OptionsCustomization Options

Commands Tools Menus Palettes Toolbars Editor

Dockable windows Propertypages Views

Document persistence

Extensions

Custom features and workspaces

Custom layers Renderers

Geodatabase class extensions

N.B. ArcGIS Engine Only, ArcGIS Desktop Only

ESRI Developer Summit 2008ESRI Developer Summit 2008 5656

Page 57: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Custom ComponentsCustom Components

•• Create a COM class and implement one or more Create a COM class and implement one or more interfacesinterfaces

IUnknown

ICommand

IUnknown

ICommand

ZoomInTool

yourCommand

esriControls

yourLibrary

ESRI Developer Summit 2008ESRI Developer Summit 2008 5757

Page 58: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

General Steps for Writing Custom ComponentsGeneral Steps for Writing Custom Components

•• The steps are the same regardless of the The steps are the same regardless of the development environmentdevelopment environment

1.1. Create a project (class library > dll)Create a project (class library > dll)2.2. Create a classCreate a class3.3. Reference the ArcGIS libraries Reference the ArcGIS libraries 4.4. Implement an interfaceImplement an interface5.5. Compile and registerCompile and register

Optional: Optional: 6.6. Register in a component category (Register in a component category (N.B windows onlyN.B windows only))

ESRI Developer Summit 2008ESRI Developer Summit 2008 5858

Page 59: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Component CategoriesESRI Component Categories

•• Folders in the registryFolders in the registry•• Organizes all ArcGIS components that are loaded at Organizes all ArcGIS components that are loaded at

runrun--timetime•• Browsing toolsBrowsing tools

–– RegEdit.exeRegEdit.exe–– Categories.exe (ESRI Categories.exe (ESRI –– ArcGIS Desktop only, ..ArcGIS Desktop only, ..\\ArcGISArcGIS\\bin)bin)

•• Examples:Examples:–– ArcGIS Engine Command ArcGIS Engine Command -- -- > ESRI Controls Commands> ESRI Controls Commands–– ArcMap CommandArcMap Command -- -- > ESRI Mx Commands > ESRI Mx Commands –– ArcCatalog CommandArcCatalog Command -- -- > ESRI Gx Commands> ESRI Gx Commands

DemoESRI Developer Summit 2008ESRI Developer Summit 2008 5959

Page 60: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Commands: Implement the ICommand interfaceCommands: Implement the ICommand interface

•• Commands perform an action on a button clickCommands perform an action on a button click•• OnCreate called during startup passing in a OnCreate called during startup passing in a ‘‘hookhook’’

–– In ArcMap the is the ArcMap applicationIn ArcMap the is the ArcMap application–– In ArcGIS Engine it may be the ToolbarControlIn ArcGIS Engine it may be the ToolbarControl

ICommandMySmileCmd

DemoESRI Developer Summit 2008ESRI Developer Summit 2008 6060

Page 61: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

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

–– Map interaction: TrackingMap interaction: Tracking–– Analysis: Select featuresAnalysis: Select features–– Editing toolsEditing tools

Custom sketch tool in palette

Default Sketch palette

ESRI Developer Summit 2008ESRI Developer Summit 2008 6161

Page 62: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Custom toolbarsCustom toolbars

•• Container to show commands, tools, and menusContainer to show commands, tools, and menus•• Implement IToolbarDefImplement IToolbarDef•• ExampleExample

–– Show or hide a custom set of tools Show or hide a custom set of tools

IToolbarDefMyToolbar

ESRI Developer Summit 2008ESRI Developer Summit 2008 6262

Page 63: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Implementing COM extensions Implementing COM extensions

•• Extensions can be used to share Extensions can be used to share data between software componentsdata between software components

•• Interfaces: IExtension, IExtensionConfigInterfaces: IExtension, IExtensionConfig

•• Type Library: esriSystemType Library: esriSystem

•• State of commands is State of commands is controlled by state of controlled by state of extensionextension Public Class ZoomExtension

Implements IExtensionImplements IExtensionConfig

Public Class ZoomExtensionImplements IExtensionImplements IExtensionConfig

ESRI Developer Summit 2008ESRI Developer Summit 2008 6363

Page 64: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

•• ArcMap and ArcGIS Engine custom commands may be ArcMap and ArcGIS Engine custom commands may be registered in which component categories?registered in which component categories?–– ArcMap ArcMap ESRI Mx CommandsESRI Mx Commands–– ArcGIS EngineArcGIS Engine ESRI Controls CommandsESRI Controls Commands

•• Which interfaces must be implemented to create a Which interfaces must be implemented to create a custom tool ?custom tool ?–– ICommand and IToolICommand and ITool

•• What sort of project would you create for custom What sort of project would you create for custom components?components?–– Class library which will be compiled into a dllClass library which will be compiled into a dll

ReviewReview

ESRI Developer Summit 2008ESRI Developer Summit 2008 6464

Page 65: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

ESRI Developer Summit 2008ESRI Developer Summit 2008 6565

ProductOverview

UnderstandingArcObjects

DevelopmentEnvironments

DeveloperResources

ObjectModel

Diagrams

DesktopCustomization

UsingVBA

CustomComponents

EngineControls

Apps

Page 66: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Session Objectives Session Objectives

•• Gain an understanding of ArcObjects and how they Gain an understanding of ArcObjects and how they can be used to customize ArcGIS desktop or to build can be used to customize ArcGIS desktop or to build an ArcGIS engine applicationan ArcGIS engine application

•• Some specific aims:Some specific aims:–– Write ArcObjects code to access a file geodatabase feature Write ArcObjects code to access a file geodatabase feature

class and add it to a map as a layerclass and add it to a map as a layer–– Build a simple ArcGIS Engine MapControl applicationBuild a simple ArcGIS Engine MapControl application–– Create a custom command that will work in both ArcGIS Create a custom command that will work in both ArcGIS

Desktop and ArcGIS EngineDesktop and ArcGIS Engine

ESRI Developer Summit 2008ESRI Developer Summit 2008 6666

Page 67: Introduction to ArcGIS Desktop and ArcGIS Engine Development · Session Objectives • Gain an understanding of ArcObjects and how they can be used to customize ArcGIS Desktop or

Developers Road Map to ArcGIS Desktop and ArcGIS EngineDevelopers Road Map to ArcGIS Desktop and ArcGIS Engine–– Tuesday, March 18, 1:00pmTuesday, March 18, 1:00pm--2:15pm2:15pm

Migrating VBA/VB6 ArcObjects Applications to .NETMigrating VBA/VB6 ArcObjects Applications to .NET–– Tuesday, March 18, 1:00pmTuesday, March 18, 1:00pm--2:15pm2:15pm

Developing .NET Applications for ArcGIS EngineDeveloping .NET Applications for ArcGIS Engine–– Tuesday, March 18, 2:45pmTuesday, March 18, 2:45pm--4:30pm4:30pm

Developing Desktop Applications with Geoprocessing FrameworkDeveloping Desktop Applications with Geoprocessing Framework–– Wednesday, March 19, 10:30amWednesday, March 19, 10:30am--11:45am11:45am

Extending the ArcGIS Desktop ApplicationsExtending the ArcGIS Desktop Applications–– Wednesday, March 19, 10:30amWednesday, March 19, 10:30am--11:45am11:45am–– Wednesday, March 19, 2:45pmWednesday, March 19, 2:45pm--4:00pm4:00pm

Deploying Desktop ApplicationsDeploying Desktop Applications–– Wednesday, March 19, 1:00pmWednesday, March 19, 1:00pm--2:15pm2:15pm

ESRI Developer Summit 2008ESRI Developer Summit 2008 6767

Session SurveysEDN Website


Recommended