250 likes | 740 Views
July 26, 2012. Building Add-ins for ArcGIS Desktop in .NET. Russell Louks and Steve Van Esch. ArcGIS Desktop Add-Ins. A better way to customize and extend ArcGIS Desktop applications. Easier to build Easy to share More secure C#, VB.NET, Java, and Python.
E N D
July 26, 2012 Building Add-ins for ArcGIS Desktop in .NET Russell Louks and Steve Van Esch
ArcGIS Desktop Add-Ins A better way to customize and extend ArcGIS Desktop applications. • Easier to build • Easy to share • More secure • C#, VB.NET, Java, and Python
Add-In Types supported at ArcGIS 10.1 • Buttons • Tools • Combo Boxes • Multi-Items • Menus • Context Menus • Toolbars • Tool Palettes • Dockable Windows • Application Extensions • Editor Extensions • Editor Construction Tools • SOE (Server)
Supported Development Environments • Visual Studio 2010 • Visual Basic 2010 Express Edition • Visual C# 2010 Express Edition • Eclipse IDE for Java Developers • .NET 3.5, .NET 4.0
New at ArcGIS 10.1 • IDE and Authoring Improvements • Extended Help Capabilities • CHM, WEB help, PDF, etc. • New Types • Editor Construction Tools • Sever Object Extensions (SOEs) • Python Add-Ins
Add-In File Anatomy XML Metadata Resources Assemblies/JARs/PYDs AddIn File (zipped folder) .*.esriAddIn
Anatomy - Declarative Aspects <ESRI.Configurationxmlns=http://schemas.esri.com/Desktop/AddIns xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Name>CASE Tools</Name> <AddInID>{f390c49d-a7a9-4b9f-a627-20f1ee3d5ca6}</AddInID> <Description>Case Tools</Description> <Version>1.0</Version> <Image>Images\CaseTools.png</Image> <Author>ESRI</Author> <Company>ESRI</Company> <Date>04/23/2010</Date> <Targets> <Targetname="Desktop"version="10.0" /> </Targets> <AddInlanguage="CLR" library="ESRI.ArcGIS.SchemaGenerationWizard.dll" namespace="CaseUI.SchemaGenerationWizard"> <ArcCatalog> <Commands> <Buttonid="SchemaGenerationWizard_SchemaGenerationWizard" class="SchemaGenerationWizard" tip="Use the Schema Generation Wizard..." message="Schema Generation Wizard" caption="Schema Generation Wizard" category="CASE Tools" image="Images\SchemaGenerationWizard.png" /> </Commands> </ArcCatalog> </AddIn> <DockableWindows> <DockableWindowid="ESRI_Example_DockableWindow" class="ExampleDockableWindowClass" caption="Example Dockable Window"> <InitialPlacement height="300" width="300" state="pinned"position="right" neighbor="esriArcMapUI.TOCDockableWindow"/> </DockableWindow> </DockableWindows> </DockableWindows> • ID • Target • Author • Version • Company • Website • Descriptions • Captions • Images • Category • Toolbars content • Menu content • Docking state • Docking position • Tooltips • Help
Anatomy - Programmatic Aspect • Add-In Behavior coded using • Visual Studio / Eclipse wizards and templates • Base classes for each Add-In type • Full ArcObjects API + programming environment (.NET/Java) publicclassSimpleButton: Button { protectedoverridevoidOnClick() { MessageBox.Show("Hello World"); } }
Add-In File Discovery & Sharing • Add-In files are automatically discovered in well known local folders and incorporated into the Desktop applications at runtime. • Folders are per user and per ArcGIS version Under Windows Vista & Windows 7: C:\Users\<username>\Documents\ArcGIS\AddIns\Desktop10.1 Under Windows XP: C:\Documents and Settings\<username>\My Documents\ArcGIS\AddIns\Desktop10.1 Internet
Add-In File Discovery & Sharing • Administered network shares • Simplifies Updates Intranet
Managing Add-Ins - Installation Utility • Double-click “Install” • Customize - Add From File • XCOPY
Add-In Versioning Policy Backward compatibility within a major version • ArcGIS 10.1 can consume 10.0 Add-Ins • ArcGIS 10.0 cannot consume 10.1 Add-Ins
Managing Add-Ins – Add-In Manager Dialog • Shows detailed information on all installed Add-Ins • Mine vs. Shared • Deleting Add-Ins
Managing Add-Ins – Sharing & Security • Custom search folders • Security Settings
Managing Add-Ins - Additional Security Settings • Admin Controls • Esri Only • Load from administrator folders only • Admin security level lock
Digitally Signing Add-Ins • IETF/WC3 XML-DSig standard (within OPC archive) • Trust • Source Traceability • Tampering • ESRISignAddin Utility
Moving to Add-Ins internalstaticSampleExt_me; publicSampleExt() { _me = this; } internalstaticSampleExtMe { get { UIDid = ThisAddIn.IDs.SampleExt.ToUID(); ArcMap.Application.FindExtensionByCLSID(id); return_me; } } publicvoidFoo() { } // Finding the extension... Add-In style. protectedoverridevoidOnClick() { // Call custom method.. SampleExt.Me.Foo(); } // Finding the extension... COM style. protectedoverridevoidOnClick() { // Find the custom COM interface.. IApplicationapp = this.HookasIApplication; ICustExtext = app.FindExtensionByName("ACME.SampleExt") asICustExt; // Call custom method.. ext.Foo(); } • Porting guidelines • http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/How_to_migrate_from_COM_components_to_add_ins/0001000003z6000000 • Do not rely on: • COM Components requiring registration • Assemblies requiring registration in the GAC • Pre-existing dependencies • Public API exposure • IDispatch for external access • Most business logic should not need to be changed
External Links • ArcGIS Desktop Add-Ins • http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Building_add_ins_for_ArcGIS_Desktop/0001000000w2000000 • WC3 XML Digital Signatures • http://www.w3.org/Signature/ • ISO/IEC 29500-2:2008 Open Packaging Conventions • http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=51459 • ITU X.509 Certificates • http://www.itu.int/rec/T-REC-X.509/en • ISO Language Codes • http://www.loc.gov/standards/iso639-2/php/code_list.php