Programming for Geographical Information Analysis: Advanced Skills Lecture 2: ArcObjects Framework Dr Andy Evans.

Slides:



Advertisements
Similar presentations
Geo GIS Practicuum Introduction to ArcGIS 8 Exercise 5 - ESRI Virtual Campus Chapters 1-2, ArcGIS Methods …
Advertisements

11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Raymond R. Balise Health Research and Policy
© by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Installing SAS 9.3 Raymond R. Balise Health Research and Policy.
1 Mobile Computing Mobile First (formerly Worklight) Copyright 2015 by Janson Industries.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Java Integrated Development Environments: ECLIPSE Part1 Installation.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap.
Paint Shop Tutorial. Essential Overview New Corel Paint Shop Pro Photo X2 is the ideal choice for any aspiring photographer's digital darkroom. It's filled.
ArcView / Avenue / ArcGIS Customization. Basic Customization in ArcView 3.x Sources for scripts and extensions Installing an extension Adding and running.
Eclipse Introduction Dwight Deugo Nesa Matic
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Introduction to ESRI Add-Ins
Esri International User Conference | San Diego, CA Technical Workshops | Migrating Custom Desktop Solutions from 9.3 to 10 John Hauck and Ralf Gottschalk.
Lesley Bross, August 25, 2010 ArcGIS 10 Add-In Components and Controls.
Introduction to ArcGIS Add-Ins Exercises GIS/LIS Conference, 2014 Rochester, MN.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Arc: Programming Options Dr Andy Evans. Programming ArcGIS ArcGIS: Most popular commercial GIS. Out of the box functionality good, but occasionally: You.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
NHD Flow Check. NHDFlowcheck is a utility for geometric network creation and validation of an NHD Flowline feature class that exists in a NHD dataset.
1.Sign onto VPN 2.Right-click My Computer & select Explore from pop-up menu 3.Go to the View dropdown menu and select Details 4.Go to the Tools dropdown.
Introduction to InVEST ArcGIS Tool Nasser Olwero GMP, Bangkok April
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Creating.NET Add-ins.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
IE 411/511: Visual Programming for Industrial Applications
Arc: AddIns Dr Andy Evans. Java Direct access to ArcObjects Framework inside and outside Arc. Ability to add components to the GUI. Ability to communicate.
DUE Hello World on the Android Platform.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Welcome to DEP’s GIS Workshop Series Workshop 3 Introduction to ArcGIS Desktop 1.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Workbench Overview Dwight Deugo Nesa Matic
Introduction to Canvas K-5
Lecture Set 1 Part C: Understanding Visual Studio and.NET – Applications, Solutions, Projects (no longer used – embedded in Lecture Set 2A)
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
Programming for Geographical Information Analysis: Advanced Skills Lecture 1: Introduction Programming Arc Dr Andy Evans.
Teacher’s Assessment Assistant Worksheet Builder Starting the Program
Introduction of Geoprocessing Topic 7a 4/10/2007.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
LTER Information Management Training Materials LTER Information Managers Committee Documenting Spatial Data Theresa Valentine Andrews LTER.
Arc: Accessing the Framework Dr Andy Evans. Code The code that goes in the addIn is then code to work with the ArcObjects framework. Ask App for Document.
ATN GIS Support ArcGIS: ArcCatalog.
ArcGIS: ArcCatalog. Agenda The ArcCatalog Interface General ArcCatalog ▫Navigating directories ▫Preview data ▫View metadata Advanced ArcCatalog ▫Modifying.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
Programming for Geographical Information Analysis: Advanced Skills Lecture 3: Arc Data Framework Dr Andy Evans.
Introduction of Geoprocessing Lecture 9 3/24/2008.
Intoduction to Andriod studio Environment With a hello world program.
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Introduction to InVEST ArcGIS Tool
Weebly Elements, Continued
Microsoft Word 2010.
Introduction to ArcGIS Add-Ins
Programming for Geographical Information Analysis: Advanced Skills
Assistant lecturer Nisreen A. Jabr
Chapter 2 – Introduction to the Visual Studio .NET IDE
Addins Dr Andy Evans Welcome to the course. You’ll find extra information in these note sections below each slide.
Addins Dr Andy Evans Welcome to the course. You’ll find extra information in these note sections below each slide.
Programming for Geographical Information Analysis: Advanced Skills
Arc: Getting Layers Dr Andy Evans.
Building Add-ins for ArcGIS Desktop in .NET
Programming Arc.
Presentation transcript:

Programming for Geographical Information Analysis: Advanced Skills Lecture 2: ArcObjects Framework Dr Andy Evans

AddIn Architecture ArcObjects Framework

Java Direct access to ArcObjects Framework inside and outside Arc. Ability to add components to the GUI. Ability to communicate with external applications.

AddIns Button : Icon on toolbar. Tool : Changes mouse operations. Combo box : Dropdown list and editable box. Toolbar : For grouping AddIns. Menu : Dropdown and right-click. Tool palette : Floating container for other AddIns. Dockable window : Floating window that can be locked into the GUI. Application extension : Additional functionality within, e.g. Arc extensions.

Form jar zip file, with a.esriaddin extension Contains: config.xml : metadata describing the addin Java class files Other resources needed : e.g. data, images

Installing File is just dropped into %USERPROFILE%\ My Documents\ArcGIS\AddIns\Desktop10.2 or %USERPROFILE%\ Documents\ArcGIS\AddIns\Desktop10.2 There are easy install options for users (double clicking on the addin will bring up a wizard to walk through installing it)

Installing a sent AddIn AddIn Manger

Choose “Add from file” and navigate to the file. Should then see it under the commands list in whatever Category you’ve created for it in the XML file. Drag and drop from here, onto the interface. Installing a sent AddIn

Managing AddIns Admin Registry Keys (regedit.exe) HKEY_LOCAL_MACHINE\SOFTWARE\ESRI\Desktop10.2 \ Settings BlockAddIns 0 - Load all. 1 - Load signed only. 2 - Load ESRI only. 3 - Load from administrator folders only. 4 - Do not Load any Add-Ins. AddInFolders AdminAddInLock - stop tampering with these.

Digital signing See: ualhelp/engine/index.html#/Digitally_signed_add_ins/ zq000000/

Making an AddIn Rather than writing the config.xml ourselves, and zipping it up manually with the java files, there’s an Eclipse IDE plugin. This does all the basic class generation for us, and prepares the file. Details for installing the IDE and plugin on the website.

Eclipse

Project area Editor area, currently showing config.xml, but shown as a form, not text. Show xml text source

Config.xml

Eclipse Should check code as you write. Will compile when you save the file. Errors reported in problems panel: Note that the javadoc panel displays the javadocs of known classes.

Eclipse Will autocomplete as you type. Will also suggest potential quick fixes if you click on hover over an issue.

Debugging No System.out.println(); Best bet is: JOptionPane.showMessageDialog(null, String); E.g. JOptionPane.showMessageDialog(null, "Hello World"); Or for exception checking… catch (Exception e){ JOptionPane.showMessageDialog(null, e.getStackTrace()); }

Help coding Course Code Cookbook There’s no point in you struggling to find key bits of code on ESRI’s site. So, there are many useful code examples, stripped down to be a simple as possible, on the course website. The quid pro quo: Send us useful code you get working. Read and try and understand the code, don’t just cut- and-paste it. Ask questions!

Help coding Intro to Eclipse: Help -> Welcome -> Overview / Tutorials Arc Programming pages: java/concepts/engine/ Java ArcObjects Developer Guide -> Developing extensions -> ArcGIS Desktop customizations using add-ins

Help coding API: java/api/arcobjects/index.html Note that the API docs are a re-write of the VB pages, and still contain some VB code: If it says “This parameter is optional”, it usually isn’t. If it says “If you don’t want this parameter, just pass in zero” or “ Nothing ”, then pass in null. If it gives Variant as a return type, it returns java.lang.Object.

Select the AddIn

If you are developing, you need to reboot Arc to get changes to appear, but you don’t need to re-add the addIn.

Extensions Classes that extend Arc functionality Custom feature renderers Custom geoprocessing tools : can be added to ArcToolbox and ModelBuilder Class extensions : Change form of data Plug-in data sources Utility objects : Combine other tools

Installing Jar file placed in /java/lib/ext

Programming ArcGIS AddIn Architecture ArcObjects Framework

Code The code that goes in the addIn is then code to work with the ArcObjects framework. Ask App for Document Ask Document for Maps Ask Maps for a Map Ask Map for Layers Ask Layers for Layer etc. The running version of Arc is accessed via gatekeeper objects. You then request objects from these, and subsequent objects from the objects you get back.

init(IApplication app) Most addIns come with a init method that can be overridden. This is sent the application as an entry point for the running framework. import com.esri.arcgis.framework.*; private IApplication public void init(IApplication app){ this.app = app; }

Document You can use this to get hold of the current document. This is the current data and GUI. import com.esri.arcgis.arcmapui.*; IMxDocument mxDoc = (IMxDocument)app.getDocument();

API It is then just a matter of finding how to do stuff in the API docs: java/api/arcobjects/index.html

N.B. The code utilises Java Used as a marker for software intending to process the

N.B.II Arc returns objects that implement multiple interfaces. You generally cast the object to a specific interface when using it. IMxDocument mxDoc = (IMxDocument)app.getDocument(); There is nothing to stop you recasting it to another interface to use different methods in it: IDocument iDoc = (IDocument) mxDoc; Infact, it is very common.

The COM In Microsoft languages, this reassignment of interface labels is key. It allows chunks of code to use other chunks of code without knowing anything other than the interface names. It is used to hold together a great deal of the Component Object Model (COM) at the heart of Microsoft software. ArcGIS is built around the COM, so this is a common thing to see.

Interfaces This requires some care. You might think that redefining everything as the right object would be sensible: public void init(IApplication app){ Application a = (Application)app; You could then use all the methods. However, while objects Arc gives you will match the interfaces, they may not do anything sensible.

Interfaces For example, this works in ArcMap: public void init(IApplication app){ Application a = (Application)app; IGxSelection selec = a.getSelection(); JOptionPane.showMessageDialog (null, selec.toString()); } But doesn’t give you anything sensible, as IGxSelection is an ArcCatalog class, and here the Application object is the ArcMap Application object, not the ArcCatalog one.

Interfaces In general, better to get the interface right and keep the object defined by its interfaces. As well as explicitly casting, just attaching the right label works if you are going to a less specific class: IMxDocument mxDoc = app.getDocument(); But generally in the examples you’ll see an explicit cast because it saves looking up the relationship. In the API Docs, in general go for the interface list at the top of the class. Interfaces generally start “I” Then “Mx” for ArcMap, “Gx” for ArcCatalog.

ArcMap IApplication methods newDocument(boolean userPickTemplate?, String path) openDocument(String optionalPath) refreshWindow() saveDocument(String optionalPath) If the paths are null, the usual “new”, “open”, and “save” processes occur.

ArcMap IMXDocument methods Used for getting data: getActiveView() i.e. layout view or data view data. getFocusMap() i.e. currently selected/shown map. getMaps() i.e. all maps. getSelectedItem() i.e. that the user has picked. getSelectedLayer() i.e. that the user has picked. Documents also implement IDocument, the main use of which is programmatically controlling toolbars.

Next Lecture Getting, sorting, and searching data. Practical Hello World! Utilising tools in Arc Addins.