developing .net applications for arcgis engine · geoprocessinggeoprocessing in console application...

Post on 13-Oct-2020

3 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Developing .NET Applications for Developing .NET Applications for ArcGISArcGIS EngineEngine

Kylie Donia and Mary HarveyKylie Donia and Mary Harvey

Schedule

•• 75 minute session75 minute session––6060 -- 65 minute lecture65 minute lecture60 60 65 minute lecture65 minute lecture––10 10 -- 15 minutes Q & A15 minutes Q & A

•• Tech TalkTech Talk––Outside this room after this sessionOutside this room after this session

•• Meet the TeamMeet the Team–– Wednesday 11:30am in Oasis 1 Wednesday 11:30am in Oasis 1 yy

Please complete thePlease complete the session surveysession surveyPlease complete the Please complete the session surveysession surveywe take your feedback very seriously!we take your feedback very seriously!

Session ObjectivesSession Objectives

•• Raise awareness of the Engine Raise awareness of the Engine .Net.Net Software Software ggDeveloper Kit and the Resources available to all Developer Kit and the Resources available to all developers.developers.

•• Provide Best Practice guidance for buildingProvide Best Practice guidance for building ArcGISArcGIS•• Provide Best Practice guidance for building Provide Best Practice guidance for building ArcGISArcGISEngine applications, WPF design and Error Handling.Engine applications, WPF design and Error Handling.

Developing .NET applications for Developing .NET applications for ArcGISArcGIS EngineEngine

SDKSDKSDKSDK

ApplicationsApplications

Vi t l E thVi t l E thVirtual EarthVirtual Earth

WPFWPF

Handling ErrorsHandling Errors

WPFWPF

Handling ErrorsHandling Errors

FutureFuture

What do you need on your machine?What do you need on your machine?

1.1. Install Visual StudioInstall Visual Studio–– 2005 or 2008, all editions2005 or 2008, all editions–– .NET Framework 2.0 or 3.5 .NET Framework 2.0 or 3.5 –– http://msdn.microsoft.com/vstudio/express/http://msdn.microsoft.com/vstudio/express/

2.2. Install ArcGIS Engine Runtime and Developer Kit for Install ArcGIS Engine Runtime and Developer Kit for .NET.NET

S b ib t EDNS b ib t EDN htt // d i /htt // d i /–– Subscribe to EDN Subscribe to EDN -- http://edn.esri.com/http://edn.esri.com/–– Includes Includes ArcGISArcGIS Engine developer copy of runtime and Engine developer copy of runtime and

SDKsSDKsAuthorize system for developmentAuthorize system for development–– Authorize system for developmentAuthorize system for development

What is included in the What is included in the ArcGISArcGIS Engine .NET SDK? Engine .NET SDK?

1.1. The installed help systemThe installed help system2.2. Access to web help system through the Resource Access to web help system through the Resource p y gp y g

center: center: http://resources.esri.com/arcgisenginehttp://resources.esri.com/arcgisengine3.3. Executable samplesExecutable samples4.4. Visual Studio IDE IntegrationVisual Studio IDE Integration4.4. Visual Studio IDE IntegrationVisual Studio IDE Integration5.5. SnippetsSnippets6.6. 8 8 ArcGISArcGIS Engine ControlsEngine Controls77 O 200 d t l t lb dO 200 d t l t lb d7.7. Over 200 commands, tools, toolbars, and menusOver 200 commands, tools, toolbars, and menus

ArcGIS Engine Controls at Design Time ArcGIS Engine Controls at Design Time

Windows FormWindows Form

77

Developing .NET applications for Developing .NET applications for ArcGISArcGIS EngineEngine

SDKSDK

ApplicationsApplications

Vi t l E thVi t l E thVirtual EarthVirtual Earth

WPFWPF

Handling ErrorsHandling Errors

WPFWPF

Handling ErrorsHandling Errors

FutureFuture

ArcGISArcGIS Engine ApplicationsEngine Applications

Network Network GeoGeo--

GPSGPS

processingprocessingTrackingTracking

3D3D

SchematicsSchematicsInkInkDynamicDynamic

DisplayDisplay

EditingEditingSpatialSpatial

R li tiR li ti EditingEditingReplicationReplicationGlobeGlobe

Network Extension to Network Extension to ArcGISArcGIS EngineEngine

•• Best PracticeBest Practice

–– Network Analyst ExtensionNetwork Analyst Extension

–– Network Analyst ToolsetNetwork Analyst Toolset

Li th t iLi th t i–– License the extensionLicense the extension

–– Incorporate your business logic into Incorporate your business logic into a focused applicationa focused application

GeoprocessingGeoprocessing in Console Applicationin Console Application

•• Best PracticeBest Practice

–– Build business specific ModelBuild business specific Model

–– Model Model -- Automate tasks, Document, ShareAutomate tasks, Document, Share

Ri h t f t l il bl tRi h t f t l il bl t A GISA GIS E i d lE i d l–– Rich set of tools available to Rich set of tools available to ArcGISArcGIS Engine developersEngine developers

–– Build your own toolsBuild your own tools

–– Build Console ApplicationBuild Console Application

Editing in Editing in ArcGISArcGIS EngineEngine

•• Best PracticeBest Practice

–– New engine editing interfaces 9.3New engine editing interfaces 9.3

–– IWorkspaceEditIWorkspaceEdit or or IEngineEditorIEngineEditor

–– Utilize out of the box CommandsUtilize out of the box Commands

–– Customize to incorporate business logicCustomize to incorporate business logicp gp g

Dynamic DisplayDynamic Display

•• Best PracticeBest Practice

–– Carefully design the data for the business applicationCarefully design the data for the business application

–– Data caching significantly improved performanceData caching significantly improved performanceg g y p pg g y p p

–– ““Leverage Dynamic Display in Leverage Dynamic Display in ArcGISArcGIS Engine Engine ApplicationsApplications”” -- Demo Theatre WorkshopDemo Theatre Workshop –– 4pm4pmApplicationsApplications Demo Theatre Workshop Demo Theatre Workshop 4pm 4pm WednesdayWednesday

Developing .NET applications for Developing .NET applications for ArcGISArcGIS EngineEngine

SDKSDK

ApplicationsApplications

Vi t l E thVi t l E thVirtual EarthVirtual Earth

WPFWPF

Handling ErrorsHandling Errors

WPFWPF

Handling ErrorsHandling Errors

FutureFuture

Microsoft Virtual Earth Content in EngineMicrosoft Virtual Earth Content in Engine

•• High quality base mapsHigh quality base maps

Microsoft®Microsoft® Virtual Virtual EartEarth™ h™ Content in EngineContent in Engine

•• How?How?

VE maps available with Engine Runtime licenseVE maps available with Engine Runtime license––VE maps available with Engine Runtime licenseVE maps available with Engine Runtime license––Available as an Available as an ArcGISArcGIS Online premium service Online premium service ––Access VE maps through Access VE maps through mxdmxd, , lyrlyr or 3dd filesor 3dd files––Requires an internet connectionRequires an internet connection

•• Why?Why?•• Why?Why?

––Content is fast, reliable, easy to use, and upContent is fast, reliable, easy to use, and up--toto--datedate, , y , p, , y , p––Good International contentGood International content––Removes the extra hurdle of bundling data with the applicationRemoves the extra hurdle of bundling data with the application

Developing .NET applications for Developing .NET applications for ArcGISArcGIS EngineEngine

SDKSDK

ApplicationsApplications

Vi t l E thVi t l E thVirtual EarthVirtual Earth

Handling ErrorsHandling Errors

WPFWPF

Handling ErrorsHandling Errors

FutureFuture

Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF)

•• What is WPF?What is WPF?

–– Presentation Presentation technologytechnology

–– Visually stunning user Visually stunning user experiencesexperiences

–– User focusedUser focused

–– Design philosophy Design philosophy “Separate content from “Separate content from presentation”presentation”

Why Use WPF?Why Use WPF?

•• Spatially enable WPF app.Spatially enable WPF app.WPF APP

•• Place a WPF Place a WPF UserControlUserControli t E ii t E i

WPF

into Engine app.into Engine app.

•• Place Engine Control intoPlace Engine Control into•• Place Engine Control into Place Engine Control into WPF app.WPF app.

WPF APP

WPF WPF –– Checklist to embed Checklist to embed ArcGISArcGIS Engine Controls ?Engine Controls ?

1.1. Create a WPF Application in Create a WPF Application in VS2008VS2008

2.2. Set up ReferencesSet up References

33 Host Control inHost Control in3.3. Host Control in Host Control in WindowsFormsHostWindowsFormsHost

44 I iti li LiI iti li Li4.4. Initialize LicenseInitialize License

5.5. Wire WPF commands to Wire WPF commands to Engine commandsEngine commands

6.6. Garbage collectionGarbage collectiongg

WPF WPF –– Best PracticeBest Practice

1.1. Initialize Initialize ArcGISArcGIS Engine license programmaticallyEngine license programmatically

2.2. Creating Controls within the Window Loaded event Creating Controls within the Window Loaded event (not in Windows constructor)(not in Windows constructor)

3.3. Control Properties and Events managed Control Properties and Events managed programmaticallyprogrammaticallyprogrammaticallyprogrammatically

4.4. Call Garbage CollectorCall Garbage Collector4.4. Call Garbage CollectorCall Garbage Collector

5.5. SP1 for .NET Framework 3.5SP1 for .NET Framework 3.5

Developing .NET applications for Developing .NET applications for ArcGISArcGIS EngineEngine

SDKSDK

ApplicationsApplications

Vi t l E thVi t l E thVirtual EarthVirtual Earth

WPFWPF

Handling ErrorsHandling Errors

WPFWPF

Handling ErrorsHandling Errors

FutureFuture

Error Handling for Error Handling for .Net.Net ArcGIS Engine ApplicationsArcGIS Engine Applications

MicrosoftMicrosoft .Net.Net ArcObjectsArcObjectsMicrosoft Microsoft .Net.NetFramework errorsFramework errors

ArcObjectsArcObjectserrorserrors

•• Structured Exception Structured Exception Handling Handling

•• try try –– catch catch –– finally finally

•• COM errors (HRESULT)COM errors (HRESULT)0x8004005 (hex) -2147467269 (dec)yy yy

statementsstatements2147467269 (dec)

•• Use Use COMExceptionCOMException filter filter in NETin NET

Avoid a crash!Avoid a crash!

in .NETin .NET•• ErrorCodeErrorCode propertyproperty

Avoid a crash!Avoid a crash!

VB.NET: Try VB.NET: Try –– Catch Catch –– Finally Finally

TryDim env As IEnvelope = New EnvelopeClass() env.PutCoords(0D, 0D, 10D, 10D) ( , , , )

Dim trans As ITransform2D = CType(env, ITransform2D) trans.Rotate(env.LowerLeft, 1D)

Catch COMex As COMExceptionIf (COMex.ErrorCode = -2147220984) ThenMessageBox.Show("You cannot rotate an Envelope")

ElseMessageBox.Show(COMex.ErrorCode.ToString() + ": " + COMex.Message)

End If

Catch ex As System.ExceptionM B Sh ("E " M )MessageBox.Show("Error: " + ex.Message)

Finally' Steps taken whether or not an error is caught

End TryEnd Try

C#: try C#: try –– catch catch –– finally finally

try{ IEnvelope env = new EnvelopeClass(); env.PutCoords(0D, 0D, 10D, 10D);

ITransform2D trans = (ITransform2D)env;ITransform2D trans (ITransform2D)env; trans.Rotate(env.LowerLeft, 1D);

}

catch (COMException COMex) {{ if (COMex.ErrorCode == - 2147220984) MessageBox.Show("You cannot rotate an Envelope");

elseMessageBox.Show(COMex.ErrorCode.ToString() + ": " + COMex.Message); g ( g() g )

}

catch (System.Exception ex) { MessageBox Show("Error: " + ex Message);MessageBox.Show("Error: " + ex.Message);

}

finally{// steps taken whether or not an error is caught

}

Error Handling Error Handling –– Best PracticesBest Practices

•• Use exception handling when the event is trulyUse exception handling when the event is trulyexceptional and is an errorexceptional and is an error

Running out of memoryRunning out of memory––Running out of memoryRunning out of memory––File/Directory locksFile/Directory locks

•• First use First use If/ThenIf/Then or other conditional programmingor other conditional programming––For example, to check file exists before readingFor example, to check file exists before reading

•• Next use Next use Try/Catch/FinallyTry/Catch/Finally statements in applicationsstatements in applications––Use specific exception types not just Use specific exception types not just System.ExceptionSystem.Exceptiony jy j yy––Catch specific exceptions before generic exceptionsCatch specific exceptions before generic exceptions

•• ArcObjectsArcObjects errors are listed by Assemblyerrors are listed by Assembly•• ArcObjectsArcObjects errors are listed by Assemblyerrors are listed by Assembly

Error Handling Error Handling –– Additional information in the SDK Additional information in the SDK

•• How to implement error handlingHow to implement error handlinghttp://resources esri com/help/9 3/arcgisengine/arcobjectshttp://resources esri com/help/9 3/arcgisengine/arcobjectshttp://resources.esri.com/help/9.3/arcgisengine/arcobjectshttp://resources.esri.com/help/9.3/arcgisengine/arcobjects

/ao_start.htm#3bb024fa/ao_start.htm#3bb024fa--ed32ed32--47734773--b2ddb2dd--f5d49c563f41.htmf5d49c563f41.htm

•• ArcObjectsArcObjects error codeserror codeshtt // i /h l /9 3/A GISE i /d t t/htt // i /h l /9 3/A GISE i /d t t/http://resources.esri.com/help/9.3/ArcGISEngine/dotnet/cohttp://resources.esri.com/help/9.3/ArcGISEngine/dotnet/co

ncepts_start.htm#a3bd05c8ncepts_start.htm#a3bd05c8--64a664a6--4dd44dd4--acb3acb3--0d10b021f2f8.htm0d10b021f2f8.htm

Developing .NET applications for Developing .NET applications for ArcGISArcGIS EngineEngine

SDKSDK

ApplicationsApplications

Vi t l E thVi t l E thVirtual EarthVirtual Earth

WPFWPF

Handling ErrorsHandling Errors

WPFWPF

Handling ErrorsHandling Errors

FutureFuture

Future: Migrating from Future: Migrating from ArcWebServicesArcWebServices to to ArcGISArcGIS OnlineOnline

•• Timescale = end of June 2009Timescale = end of June 2009

•• Migrate from Migrate from ArcWebServicesArcWebServices to to ArcGISArcGIS OnlineOnline

•• What is the migration path….. ?What is the migration path….. ?

Future: 9.3.1Future: 9.3.1

•• Timescale = Start shipping June 2009Timescale = Start shipping June 2009

•• Focus on creating maps for the webFocus on creating maps for the web

•• Optimized Map Document Optimized Map Document –– faster engine faster engine

•• Quality improvementsQuality improvements

•• Migration from Migration from ArcWebServicesArcWebServices to to ArcGISArcGISOnline ServicesOnline Services

Future: 9.4Future: 9.4

•• Timescale = Beta around the User ConferenceTimescale = Beta around the User Conference

•• Concurrent use Engine RuntimeConcurrent use Engine Runtime

•• AsynchronousAsynchronous GeoProcessingGeoProcessing•• Asynchronous Asynchronous GeoProcessingGeoProcessing

•• Deploy Engine Runtimes Side by SideDeploy Engine Runtimes Side by SideDeploy Engine Runtimes Side by SideDeploy Engine Runtimes Side by Side

•• No VB6 Software Developer KitNo VB6 Software Developer Kitpp

•• Visual Studio 2008 supportedVisual Studio 2008 supported–– VS2005 VS2005 –– not supportednot supported–– VS10 VS10 –– under investigationunder investigation

Developing .NET applications for Developing .NET applications for ArcGISArcGIS EngineEngine

SDKSDK

ApplicationsApplications

Vi t l E thVi t l E thVirtual EarthVirtual Earth

WPFWPF

Handling ErrorsHandling Errors

WPFWPF

Handling ErrorsHandling Errors

FutureFuture

Questions, answers and information?Questions, answers and information?

•• Tech TalkTech Talk––Now Now -- Outside this room after this sessionOutside this room after this session

•• Meet the TeamMeet the TeamWednesday 11:30 in Oasis 1Wednesday 11:30 in Oasis 1–– Wednesday 11:30 in Oasis 1 Wednesday 11:30 in Oasis 1

•• Showcase Showcase –– Tuesday and Wednesday Desktop Tuesday and Wednesday Desktop

Where now?Where now?

Technical SessionsTuesday 2:45 Enhancing Your Applications with Enhancing Your Applications with ArcGISArcGIS OnlineOnlineT d 4 30 E t di thE t di th A GISA GIS D kt A li tiD kt A li tiTuesday 4:30 Extending the Extending the ArcGISArcGIS Desktop ApplicationsDesktop ApplicationsWednesday 2:45 Distributed Distributed GeodatabaseGeodatabase DevelopmentDevelopmentThursday 8:30 ESRI Product LicensingESRI Product LicensingThursday 10:15 ArcGISArcGIS 9.4: The Road Ahead for Developers9.4: The Road Ahead for Developers

D Th tDemo TheatresTuesday 3:00 Tracking Analyst and Tracking Analyst and TrackingServerTrackingServerWednesday 12:00 Geometric NetworksGeometric NetworksWednesday 1:00 Performing Network Analysis with Performing Network Analysis with GeoprocessingGeoprocessingWednesday 4:00 Leverage Dynamic DisplayLeverage Dynamic Display

ResourcesResources

•• Using premium Microsoft Virtual Earth Maps with Using premium Microsoft Virtual Earth Maps with ArcGISArcGIS 9.39.3–– http://resources.esri.com/help/9.3/arcgisonline/about/start.htm#prehttp://resources.esri.com/help/9.3/arcgisonline/about/start.htm#prep p g pp p g p

mium_virtual_earth.htm#mium_virtual_earth.htm#–– http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=

Using_Microsoft_Virtual_Earth_in_ArcGIS_DesktopUsing_Microsoft_Virtual_Earth_in_ArcGIS_Desktop

•• WPF Training VideosWPF Training Videos–– http://windowsclient.net/learn/videos_wpf.aspxhttp://windowsclient.net/learn/videos_wpf.aspx

top related