extending arcgis explorer using the arcgis explorer sdk€¦ · • a graphic consists of a...

29
Extending ArcGIS Explorer using the ArcGIS Explorer SDK Jo Fraley [email protected]

Upload: others

Post on 18-Aug-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Extending ArcGIS Explorer using the ArcGIS Explorer SDK

Jo [email protected]

Page 2: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Topics

• The Explorer SDK- The Visual Studio Tools, samples and help

• Add-ins- The Explorer extension points

• Application configurations- The mechanism for deploying all types of Explorer customization

• The Explorer API - The classes that allow you to actually “do stuff”

Page 3: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

ArcGIS Explorer SDK

Page 4: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

ArcGIS Explorer SDK

• Separate install to ArcGIS Explorer- http://resources.arcgis.com/explorer/

• All Visual Studio editions (including Express)• .NET C# and VB.NET languages

• 1500 Build targeted at:- .NET 3.5 SP1 minimum- Visual Studio 2008 & 2010

Demo

Page 5: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Add-in overview

• Extend Explorer by creating add-ins- Button - Extension - Gallery - DockWindow - ComboBox* - Checkbox*

* New for 1500

• An add-in is a class that inherits from one of the add-in base classes:

- E.g. ESRI.ArcGISExplorer.Application.Button

• You override methods/properties:

Page 6: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Add-ins: The Add-ins File

• One or more add-ins are packaged in an add-ins file (.eaz)

• An add-in file contains- One or more .NET assemblies- An XML file describing the add-ins- Other supporting files (images, etc.)

• The XML file contains the information necessary to display the add-in in the user interface

Page 7: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Add-ins: The Add-ins File

Page 8: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Add-ins: Conditions• Pre-defined application states you can reference to enable/disable

your add-in

• Avoids redundant logic for checking application state across multiple add-ins. E.g.

- A note is selected- A feature layer is

selected- Presentation tools

are available

• Condition is referenced as part of add-in declaration in the addins.xml

Page 9: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Add-ins: Building & Testing

• Steps: 1. The normal Visual Studio compilation process happens. 2. An add-in file (.eaz) is created. 3. The add-in file contents are verified. 4. The add-in file is deployed ready for testing on the development

machine.

• During development the Addins tab is used by default- Intended for testing and debugging

• Addins tab also used by GIS expert- Add-ins added manually appear

in this tab

Demo

Page 10: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Add-ins: Deploying

• The primary way add-ins will be deployed is via an application configuration

• The end-user sees these as core functions of the application in the Ribbon alongside built-in controls

Page 11: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Application Configurations

• Why?- Some functionally not relevant for your target users- Apply branding, permissions, reference data- Your users may require the use of custom functionality

• What?- A single file (.ncfg) that defines the functionality available in Explorer

and how its organized

• How?- Create using Application Configuration Manager- No programming required

Page 12: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Application Configurations• Tailor Explorer for different user groups in your organization

USDA Explorer

Crime Explorer

FEMA Explorer

Centrally ManagedCentrally ManagedApplication ConfigurationsApplication Configurations

Demo

Page 13: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Explorer API: Overview

• Explorer includes an API for implementing add-ins

• Intuitive- promotes learning by exploration, with intellisense

• Simple, concise- Focused on ease of use- low barrier of entry, rapid learning curve- < 100 classes- Only 1 interface!

• Pure .NET API- follows .NET design guidelines

Page 14: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Explorer API: OverviewApplication

Map Display

Map

DocWindow

Button

Classes match Explorer functions

Page 15: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Explorer API: .Net Patterns

• Overloads- Methods and constructors

• Static methods

• Collections

• Generics

Class name Property or method directly on class

Page 16: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Explorer API: Namespaces

• Organized into 6 namespaces:

- ESRI.ArcGISExplorer

- ESRI.ArcGISExplorer.Application

- ESRI.ArcGISExplorer.Mapping

- ESRI.ArcGISExplorer.Data

- ESRI.ArcGISExplorer.Geometry

- ESRI.ArcGISExplorer.Threading

• SDK References:- Namespace overviews- Overview class diagram

Application

Table

FeatureLayer

Map

MapDisplay

PolygonPolygon

Application.ActiveMap Display

MapDisplay.Map

Map.ChildItems[0]

FeatureLayer.Table

Table.GetRow(0).Geometry

Page 17: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Application namespace

• Extension points for the application- Button, DockWindow, Gallery, Extension, Checkbox, &

ComboBox

• ‘Hook’ in to the application and current map

• Application events- DocumentOpened, DocumentClosed, Exit,

MapItemChanged, MapItemSelectionChanged- “Hook up” once for the lifetime of the application

MapDisplay display = Application.ActiveMapDisplay;

Map map = display.Map;

MapDisplay display = Application.ActiveMapDisplay;

Map map = display.Map;

Page 18: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Application Namespace

• SelectedItemsCollection class- Contains all the map items currently

selected in the contents window.- Manage selections

• ProgressHelper class- Display a progress dialog to indicate busy state while your add-in does

work- Same dialog displayed

for core functionality

Page 19: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Mapping Namespace

• MapDisplay class handles 2D and 3D- Navigation, tracking, position- Coding against 2D and 3D is the same- Access the Map and GraphicsCollection

• Map class manages content

• Explorer map content called MapItems- Notes, Views, Folders, Links- Layers: Kml, Feature, Raster, Service, Package, GeoRss

• Changing map content automatically updates the map display

Page 20: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Mapping Namespace

FeatureLayer mountains = FeatureLayer.OpenFileGeodatabaseTable(@"C:\data\scotland.gdb",

"mountains");

mountains.Renderer.SetSymbol(Symbol.Marker.Recreation.Mountain);

Application.ActiveMapDisplay.Map.ChildItems.Add(mountains);

Application.ActiveMapDisplay.ZoomTo(mountains.Extent);

FeatureLayer mountains = FeatureLayer.OpenFileGeodatabaseTable(@"C:\data\scotland.gdb",

"mountains");

mountains.Renderer.SetSymbol(Symbol.Marker.Recreation.Mountain);

Application.ActiveMapDisplay.Map.ChildItems.Add(mountains);

Application.ActiveMapDisplay.ZoomTo(mountains.Extent);

Page 21: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Mapping Namespace: Graphics, Popups & Notes• A Graphic consists of a Geometry and a Symbol

- Add to the GraphicCollection to display in Map- Cannot be saved in the map

• A Note = a Graphic and a Popup- The popup window has a title,

content, and an icon - Is a type of MapItem so can be

added to the contents window- Can be saved in the map

• A temporary Popup = Point + a popup window- Call Activate method to show - Cannot be saved in the map

Demo

Page 22: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Data Namespace• Read access to shapefiles and raster files• Read access to File and ArcSDE Geodatabase tables, feature

classes and rasters

• Flexible spatial and SQL-based searching

• Simple to bind a Table to .NET DataGrid

Geodatabase fileGeoDB = new Geodatabase(@"C:\Data\Scotland.gdb");

Table mountains = fileGeoDB.OpenTable(“mountains");

Geodatabase fileGeoDB = new Geodatabase(@"C:\Data\Scotland.gdb");

Table mountains = fileGeoDB.OpenTable(“mountains");

Row nevis = mountains.Search(new Filter("Name=‘Ben Nevis'")).GetFirst();Row nevis = mountains.Search(new Filter("Name=‘Ben Nevis'")).GetFirst();

TableBindingAdapter bindingAdapter = new TableBindingAdapter(mountains);

bindingAdapter.Fill();

datagridView1.DataSource = bindingAdapter;

TableBindingAdapter bindingAdapter = new TableBindingAdapter(mountains);

bindingAdapter.Fill();

datagridView1.DataSource = bindingAdapter;

Page 23: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Data Namespace

• Represents the geodatabase in a simple form:

• Easy to work with Raster values:Row hydrant = hydrants.Search(new Filter("HydrantID = 1234")).GetFirst();

Raster pictureValue = hydrant.Values["picture"] as Raster;

System.Drawing.Image image = pictureValue.GetBitmap();

Row hydrant = hydrants.Search(new Filter("HydrantID = 1234")).GetFirst();

Raster pictureValue = hydrant.Values["picture"] as Raster;

System.Drawing.Image image = pictureValue.GetBitmap();

Geodatabase Entity API ExampleDomains RowValueCollection.GetCodedNameRelationships RowCollection.GetRelatedRows

Row.GetRelatedRowsSubtypes ColumnCollection.Subtypes

Column.GetDomain

Page 24: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Geometry

• Creation and modification of basic geometry types- Point, Multipoint, Polyline, Polygon, Envelope- Points get-set by value in Polygon, Polyline, Multipoint

• Multipart geometry support

• GeometryOperations class- Perform ‘by-value’ operations on a geometry- Move, Scale, Rotate, Union, Project, Simplify, DistanceBetween

Point point = new Point(48.867, 2.333);

Point movedPoint = GeometryOperations.Move(point, 1, 1, Unit.Angular.Degrees);

Point point = new Point(48.867, 2.333);

Point movedPoint = GeometryOperations.Move(point, 1, 1, Unit.Angular.Degrees);

Page 25: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Geometry

• Coordinate Systems- Support for predefined CoordinateSystems- New geometries default to WGS84- Layers and Graphics auto-projected on-the-fly- Project individual geometries- Support for geographic transformations

• SoapConverter class - Convert to/from Explorer geometry type and ArcGIS Server proxy

geometry types

Point prjPoint = (Point)GeometryOperations.Project(point, CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.BritishNation alGrid);

Point prjPoint = (Point)GeometryOperations.Project(point, CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.BritishNation alGrid);

Page 26: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Threading

• Classes to facilitate the use of worker threads with the Explorer API

• Rules- Explorer objects can only be called on the threads they are created on- Explorer objects must live on a thread created by Explorer

• ESRI.ArcGISExplorer.Threading.BackgroundWorker class- Similar to .NET framework Background worker- Send result of worker thread back to UI thread, report progress on UI

thread

Page 27: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Threading

• Facilities to copy objects between threads by value- Geometry, Graphic, Mapitem, Symbol, Viewpoint etc.

• ArcGIS Explorer objects are thread bound- Exceptions are thrown to detect incorrect usage

// serialize

string selectedItemXml = Application.SelectedItems[0].ToXmlString;

// deserialize

MapItem newItem = MapItem.CreateFromXmlString(selectedItemXml);

// serialize

string selectedItemXml = Application.SelectedItems[0].ToXmlString;

// deserialize

MapItem newItem = MapItem.CreateFromXmlString(selectedItemXml);

Demo

Page 28: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved

Summary

•• You can extend Explorer by creating addYou can extend Explorer by creating add--ins, and ins, and deploy those adddeploy those add--ins using application ins using application configurationsconfigurations

•• Explorer includes a pure .NETExplorer includes a pure .NET--API and excellent SDK API and excellent SDK for building addfor building add--insins

Page 29: Extending ArcGIS Explorer using the ArcGIS Explorer SDK€¦ · • A Graphic consists of a Geometry and a Symbol - Add to the GraphicCollection to display in Map - Cannot be saved