developing .net applications for arcgis...
TRANSCRIPT
ESRI Developer Summit 2008ESRI Developer Summit 2008 11
Mike Rudden Mike Rudden Mary HarveyMary Harvey
Developing .NET Applications for ArcGIS EngineDeveloping .NET Applications for ArcGIS Engine
Schedule
• 75 minute session– 60 - 65 minute lecture– 10 - 15 minutes Q & A
• Cell phones and pagers
• Please complete the session survey – we take your feedback very seriously!
WhatWhat’’s new in ArcGIS Engine 9.3s new in ArcGIS Engine 9.3……
•• Dynamic Display ImprovementsDynamic Display Improvements–– + Much enhanced SDK documents and samples+ Much enhanced SDK documents and samples
•• Significantly enhanced Editing APISignificantly enhanced Editing API–– + Comprehensive SDK documents and samples+ Comprehensive SDK documents and samples
•• Also:Also:–– Network Analyst Extension improvementsNetwork Analyst Extension improvements–– Error Reporting Error Reporting -- New Crash Dump AnalysisNew Crash Dump Analysis–– SQL Server Express DVD includedSQL Server Express DVD included–– Visual Studio 2008 supportedVisual Studio 2008 supported
ESRI Developer Summit 2008ESRI Developer Summit 2008 33
Session ObjectivesSession Objectives
•• Raise awareness forRaise awareness for the new improved visualization the new improved visualization capabilities of capabilities of dynamic display dynamic display and provide guidance and provide guidance on best practices when building applicationson best practices when building applications
•• Raise awareness of the new programmatic Raise awareness of the new programmatic editingeditingcapabilities for creating business focussed applicationscapabilities for creating business focussed applications
ESRI Developer Summit 2008ESRI Developer Summit 2008 44
ESRI Developer Summit 2008ESRI Developer Summit 2008 55
ArcGIS Engine Dynamic displayArcGIS Engine Dynamic display
Topics
•• OverviewOverview–– What is it What is it –– When to use itWhen to use it
•• Static ContentStatic Content–– CachingCaching–– Cache ManagementCache Management
•• Dynamic ContentDynamic Content–– Dynamic LayersDynamic Layers–– Dynamic EventsDynamic Events–– Dynamic DrawingDynamic Drawing
What is Dynamic Display?What is Dynamic Display?
•• It is an alternative display mechanism specifically It is an alternative display mechanism specifically designed for dynamic GIS display environments.designed for dynamic GIS display environments.
•• It moves intensive graphics rendering from the CPU to It moves intensive graphics rendering from the CPU to the graphics hardware:the graphics hardware:
–– Active DisplayActive Display–– Uses OpenGL for renderingUses OpenGL for rendering–– SubSub--second refresh ratesecond refresh rate
•• ArcGIS Engine developer technologyArcGIS Engine developer technology
ESRI Developer Summit 2008ESRI Developer Summit 2008 77
Dynamic Display CapabilitiesDynamic Display Capabilities
ESRI Developer Summit 2008ESRI Developer Summit 2008 88
Update manymoving objects
withSmooth navigation
GIS data query
Update manymoving objects
withSmooth navigation
GIS data query PerformanceImprovementsMulti-threaded
Caching
PerformanceImprovementsMulti-threaded
CachingFurther performance
ImprovementsCache management
Text & SymbolImprovements
Selection
9.2 > 9.2 sp3 9.3
+
+
When to use itWhen to use it
•• When to use it:When to use it:–– Smooth navigationSmooth navigation–– Displaying moving objectsDisplaying moving objects–– Displaying real time or other feedsDisplaying real time or other feeds–– Playback of recorded feedsPlayback of recorded feeds
•• When not to use it: When not to use it: –– Creating high quality mapsCreating high quality maps–– PrintingPrinting–– EditingEditing
Contolled Environments
Enable Dynamic Display
• Good video card– OpenGL 1.1 (or higher) compliant– 64MB VRAM
•• Continuous draw cycleContinuous draw cycle–– IDynamicMap.DynamicDrawRate IDynamicMap.DynamicDrawRate (30 msec default)(30 msec default)
//enable dynamic displayIMap map = ...;IDynamicMap dynamicMap = (IDynamicMap)map;dynamicMap.DynamicMapEnabled = true;
Static ContentStatic Content
•• Handled on a background threadHandled on a background thread•• Rendered as tilesRendered as tiles•• (File & SDE) Geodatabase rasters and MapServer layers(File & SDE) Geodatabase rasters and MapServer layers
–– direct read without cachingdirect read without caching
•• Other static content:Other static content:–– Local cache createdLocal cache created–– Persist the cache manually:Persist the cache manually:
•• Ensure map is in dynamic modeEnsure map is in dynamic mode•• Save layers Save layers -- layer files (.lyr) or map document (mxd)layer files (.lyr) or map document (mxd)•• Reuse the cash in subsequent sessions Reuse the cash in subsequent sessions
–– Or programmatically Or programmatically -- IDynamicCacheLayerManager IDynamicCacheLayerManager
ESRI Developer Summit 2008ESRI Developer Summit 2008 1111
Demo
Cache ManagementCache Management••IDynamicCacheLayerManagerIDynamicCacheLayerManager interfaceinterface
–– PrePre--generate, connect to, update, invalidate cachegenerate, connect to, update, invalidate cache–– Cache format (PNG, JPEG)Cache format (PNG, JPEG)–– Progressive drawing, fetching levelsProgressive drawing, fetching levels–– Consolidate group layer tilesConsolidate group layer tiles
ESRI Developer Summit 2008ESRI Developer Summit 2008 1212
Creating, deleting or updating the cacheCreating, deleting or updating the cache
ESRI Developer Summit 2008ESRI Developer Summit 2008 1313
//create, update or delete cachestring sCacheFolderPath = @"C:\myCache";IDynamicCacheLayerManager dcm = new
DynamicCacheLayerManagerClass();
IMap map = axMapControl1.Map;ILayer layer = map.get_Layer(0);if (layer is IDynamicLayer)
return;
dcm.Init(map, layer);dcm.Update(null, sCacheFolderPath, map.MapScale,
esriMapCacheUpdateMode.esriMapCacheUpdateRecreateAll);
Connecting to a cacheConnecting to a cache
ESRI Developer Summit 2008ESRI Developer Summit 2008 1414
//connect to the cacheIDynamicCacheLayerManager dcm = new
DynamicCacheLayerManagerClass();
string newFolderPath = @"C:\ReConnect";string newFolderName = @"C:\MyLayer_GUID";;
IMap map = axMapControl1.Map;ILayer layer = map.get_Layer(0);if (layer is IDynamicLayer)
return ;
dcm.Init(map, layer);dcm.Connect(newFolderPath, newFolderName);
Dynamic Content Dynamic Content -- Dynamic LayersDynamic Layers
ESRI Developer Summit 2008ESRI Developer Summit 2008 1515
•• Custom layer implements Custom layer implements IDynamicLayerIDynamicLayer
• Will be visible in the map's layers list and TOC
••DrawDynamicLayerDrawDynamicLayer methodmethod–– Contains the drawing commandsContains the drawing commands–– Immediate phaseImmediate phase : : Directly drawn to displayDirectly drawn to display
–– Compiled phaseCompiled phase : : Stored in a display listStored in a display list
••DynamicLayerDirtyDynamicLayerDirty–– Indicates if layer wants to redrawIndicates if layer wants to redraw
••DynamicRecompileRateDynamicRecompileRate–– Indicates when layer wants to recompile its display listIndicates when layer wants to recompile its display list–– Only for Only for CompiledCompiled phasephase
Dynamic Display Draw Cycle
For each dynamic layer -• Is DynamicLayerDirty for Immediate phase?
– Yes : invoke DrawDynamicLayer of all dynamic layers in Immediate phase
– No : continue• Is DynamicLayerDirty for Compiled phase && DynamicRecompileRate elapsed?– Yes : invoke DrawDynamicLayer of current layer only in
Compiled phase and of all dynamic layers in Immediate phase– No : continue
Creating A Dynamic Layer
•• Create a custom layerCreate a custom layer–– ImplementImplement ILayer,IGeodatasetILayer,IGeodataset
–– ImplementImplement IDynamicLayerIDynamicLayer
Or Or
•• Create a custom layerCreate a custom layer–– Inherit from the Inherit from the BaseDynamicLayerBaseDynamicLayer classclass–– Override Override DrawDynamicLayerDrawDynamicLayer methodmethod
Dynamic Content Dynamic Content –– Dynamic Map DrawingDynamic Map Drawing
•• Listen to the Listen to the IDynamicMapEventsIDynamicMapEvents–– BeforeDynamicDrawBeforeDynamicDraw
–– AfterDynamicDrawAfterDynamicDraw
•• Will not be visible in the map's layers list and TOC. Will not be visible in the map's layers list and TOC.
ESRI Developer Summit 2008ESRI Developer Summit 2008 1818
Dynamic Display Drawing APIDynamic Display Drawing API
ESRI Developer Summit 2008ESRI Developer Summit 2008 1919
•• OpenGL APIOpenGL API•• Dynamic Display Drawing APIDynamic Display Drawing API
1.1.Create a glyph Create a glyph (marker, line, fill, text)(marker, line, fill, text)
•• Using Using IDynamicGlyphFactoryIDynamicGlyphFactory
2.2.Apply properties to the glyph Apply properties to the glyph (color, scale, rotation,(color, scale, rotation,……))
•• Using Using IDynamicSymbolProperties2 *IDynamicSymbolProperties2 *
3.3.Draw the glyphDraw the glyph•• UsingUsing IDynamicDisplayIDynamicDisplay, , IDynamicDrawScreenIDynamicDrawScreen, or , or
IDynamicCompoundMarker2 *IDynamicCompoundMarker2 *
* * new interfaces at 9.3new interfaces at 9.3
Demo
TipsTips
ESRI Developer Summit 2008ESRI Developer Summit 2008 2020
•• Use Snippets and SDKUse Snippets and SDK•• Static ContentStatic Content
–– Use Geodatabase Raster & Map Server layersUse Geodatabase Raster & Map Server layers–– Rasters with pyramidsRasters with pyramids–– Pregenerate local cachePregenerate local cache–– Remove unused layers & set scale thresholdsRemove unused layers & set scale thresholds–– Use annotation in preference to labelsUse annotation in preference to labels–– Use consolodated group layersUse consolodated group layers
•• Dynamic ContentDynamic Content–– Use Compiled phase for content which does not change Use Compiled phase for content which does not change
frequentlyfrequently–– Create DynamicGlyph once, then reuseCreate DynamicGlyph once, then reuse–– Delete DynamicGlyph when doneDelete DynamicGlyph when done
ESRI Developer Summit 2008ESRI Developer Summit 2008 2121
Crash Dump AnalysisCrash Dump Analysis
Error ReportingError Reporting
Crash Dumps: user viewCrash Dumps: user view
•• ““Send Error ReportSend Error Report””::automatically sendautomatically sendto ESRIto ESRI
•• ““DonDon’’t Sendt Send””: : –– .dmp files saved into user profile: .dmp files saved into user profile: \\Application DataApplication Data\\ESRIESRI\\Error Error
ReportsReports–– Can be emailed to Can be emailed to [email protected]@esri.com
ESRI Developer Summit 2008ESRI Developer Summit 2008 2222
ESRI Developer Summit 2008ESRI Developer Summit 2008 2323
Crash Dumps: for developersCrash Dumps: for developers
•• Point Visual Studio 2005 at the new ArcGIS Symbol Point Visual Studio 2005 at the new ArcGIS Symbol ServersServers
•• Open Crash Dump file in VS and go to the function Open Crash Dump file in VS and go to the function call (F5) where the error occurred (or hang occurs)call (F5) where the error occurred (or hang occurs)
VisualStudio 2005
ArcGISSymbolServer Crash /
Hang
.DMP
ESRI Developer Summit 2008ESRI Developer Summit 2008 2424
ArcGIS Engine EditingArcGIS Engine Editing
TopicsTopics
•• Editing capabilitiesEditing capabilities•• ArchitectureArchitecture•• Core programmatic editingCore programmatic editing
–– new interfacesnew interfaces
•• Imposing business logicImposing business logic•• Extending the editing frameworkExtending the editing framework
ESRI Developer Summit 2008ESRI Developer Summit 2008 2525
ArcGIS Engine Editing CapabilitiesArcGIS Engine Editing Capabilities
ESRI Developer Summit 2008ESRI Developer Summit 2008 2626
Editing support
provided at Geodatabase
level
Editing support
provided at Geodatabase
level Rich set of UI Editing components
Rich set of UI Editing components Comprehensive
programmaticediting
capabilities
9.1 9.2 9.3
+
+
Editing ArchitectureEditing Architecture
•• Provided in the Controls Provided in the Controls librarylibrary
•• No access to Editor No access to Editor library (ArcMap)library (ArcMap)
•• Primary object is Primary object is EngineEditor singletonEngineEditor singleton
ESRI Developer Summit 2008ESRI Developer Summit 2008 2727
IEngineEditor engineEditor = new EngineEditorClass();
Editing at 9.3: UI ComponentsEditing at 9.3: UI Components
ESRI Developer Summit 2008ESRI Developer Summit 2008 2828
•• 43 Out43 Out--OfOf--TheThe--BoxBox•• Editor menuEditor menu•• Sketch & edit toolsSketch & edit tools•• Snapping, attribute, sketch properties dialogsSnapping, attribute, sketch properties dialogs•• Target layer, edit task controlsTarget layer, edit task controls•• Sketch, Sketch, edit vertexedit vertex context menuscontext menus
Editing at 9.3: Programmatic AccessEditing at 9.3: Programmatic Access
ESRI Developer Summit 2008ESRI Developer Summit 2008 2929
ImposeBusiness
Logic
ExtensibleFramework
ControlEditingProcess
Comprehensive programmatic
editingcapabilities
Core Editing: InterfacesCore Editing: Interfaces
• EngineEditor– Manage edit session & edit tasks
• IEngineEditor
– Manage target layer• IEngineEditLayers
– Manage sketch geometry • IEngineEditSketch
– Manage snap agents and snapping settings• IEngineSnapEnvironment
– Manage properties of an edit session• IEngineEditProperties, IEngineEditProperties2
ESRI Developer Summit 2008ESRI Developer Summit 2008 3030
ControlEditingProcess
Core Editing: Common StepsCore Editing: Common Steps
1.1. Get instance of EngineEditorGet instance of EngineEditor2.2. Set up the operation stack to allow undo/redoSet up the operation stack to allow undo/redo3.3. Start editingStart editing4.4. Set target layerSet target layer5.5. Get instance of desired edit taskGet instance of desired edit task6.6. Set the current edit taskSet the current edit task7.7. Set the current tool (e.g. sketch tool)Set the current tool (e.g. sketch tool)8.8. ………….Perform edits (within Edit & Sketch Operations).Perform edits (within Edit & Sketch Operations)9.9. Stop EditingStop Editing
ESRI Developer Summit 2008ESRI Developer Summit 2008 3131
Demo
ArcGIS Engine Editor EventsArcGIS Engine Editor Events
•• Validate EditsValidate Edits–– Should edits be allowedShould edits be allowed
•• Monitor & RespondMonitor & Respond–– Set enabled state of Set enabled state of
custom toolscustom tools–– Show certain tools when Show certain tools when
editing startsediting starts
ESRI Developer Summit 2008ESRI Developer Summit 2008 3232
ImposeBusiness
Logic
Demo
• EngineEditor- Respond to edit events
•IEngineEditEvents
ArcGIS Engine Custom CommandsArcGIS Engine Custom Commands
•• Many outMany out--ofof--box commandsbox commands
•• You can create your own:You can create your own:–– Implement ICommand (and ITool for a custom tool)Implement ICommand (and ITool for a custom tool)–– Register class in Register class in ‘‘ESRI Controls commandsESRI Controls commands’’ component categorycomponent category
•• Enclose edits within edit and sketch operationsEnclose edits within edit and sketch operations–– Provides undo/redo cabability for editsProvides undo/redo cabability for edits–– Take care setting up OperationStackTake care setting up OperationStack
ESRI Developer Summit 2008ESRI Developer Summit 2008 3333
ExtensibleFramework
Demo
ArcGIS Engine Edit TasksArcGIS Engine Edit Tasks
•• Two outTwo out--ofof--thethe--box tasks provided:box tasks provided:–– Create New FeatureCreate New Feature–– Modify FeatureModify Feature
•• You can create your own:You can create your own:–– Implement IEngineEditTaskImplement IEngineEditTask–– Register class in Register class in ‘‘ESRI Engine Edit TasksESRI Engine Edit Tasks’’ component categorycomponent category
•• Use them to incorporateUse them to incorporatebusiness logicbusiness logic
ESRI Developer Summit 2008ESRI Developer Summit 2008 3434
ExtensibleFramework
Demo
Create custom groups
Customized Attribute Editing Customized Attribute Editing
•• Extend outExtend out--ofof--thethe--box attribute editorbox attribute editor–– Implement IEngineFeatureInspector interfaceImplement IEngineFeatureInspector interface
•• Bind a Geodatabase table to .NET ControlBind a Geodatabase table to .NET Control–– SDK SampleSDK Sample
ESRI Developer Summit 2008ESRI Developer Summit 2008 3535
ExtensibleFramework
Demo
ESRI Developer Summit 2008ESRI Developer Summit 2008 3636
SQL Server Express with Engine RuntimeSQL Server Express with Engine Runtime
•• Free, lightweight version of SQL Server 2005Free, lightweight version of SQL Server 2005•• Will be included with ArcGIS Engine 9.3Will be included with ArcGIS Engine 9.3
–– Was already included with ArcGIS Desktop at 9.2Was already included with ArcGIS Desktop at 9.2
•• Easy to Easy to ‘‘SDESDE enableenable’’ using Post installation wizardusing Post installation wizard
•• Facilitate development of field based editing Facilitate development of field based editing solutions which use:solutions which use:–– Engine Runtime + Geodatabase Update ExtensionEngine Runtime + Geodatabase Update Extension–– New Editing FrameworkNew Editing Framework–– Replication CapabilitiesReplication Capabilities–– ArcGIS Server ServicesArcGIS Server Services
•• Slides and code will be available on EDNSlides and code will be available on EDN
•• Please fill out session surveys!Please fill out session surveys!
•• Still have questions?Still have questions?1.1.Tech talk, Demo Theatres, Meet the TeamTech talk, Demo Theatres, Meet the Team2.2.““Ask a DeveloperAsk a Developer”” link on web pagelink on web page
ESRI Developer Summit 2008ESRI Developer Summit 2008 3737
QuestionsQuestions……