Sei sulla pagina 1di 12

CREATING A CUSTOM GEOMEDIA

GRID COMMAND:
A TUTORIAL

Version 14.00.00

October 2013

Copyright
1996-2013 Intergraph Corporation and/or its affiliates. Hexagon Geospatial is a part of Intergraph. All Rights Reserved.
Warning: This computer program, including software, icons, graphical symbols, file formats, and audio-visual displays; may be
used only as permitted under the applicable software license agreement; contains confidential and proprietary information of
Intergraph and/or third parties which is protected by patent, trademark, copyright and/or trade secret law and may not be
provided or otherwise made available without proper authorization.

Restricted Rights Legend


Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) (1) (ii) of the Rights in
Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of Commercial
Computer Software -- Restricted Rights at 48 CFR 52.227-19, as applicable.
Unpublished - rights reserved under the copyright laws of the United States.
Intergraph Corporation P.O. Box 240000 Huntsville, AL 35813

Terms of Use
Use of this software product is subject to the End User License Agreement ("EULA") delivered with this software product unless
the licensee has a valid signed license for this software product with Intergraph Corporation. If the licensee has a valid signed
license for this software product with Intergraph Corporation, the valid signed license shall take precedence and govern the use
of this software product. Subject to the terms contained within the applicable license agreement, Intergraph Corporation gives
licensee permission to print a reasonable number of copies of the documentation as defined in the applicable license agreement
and delivered with the software product for licensee's internal, non-commercial use. The documentation may not be printed for
resale or redistribution.

Warranties and Disclaimers


All warranties given by Intergraph Corporation about software are set forth in the EULA provided with the software or with the
applicable license for the software product signed by Intergraph Corporation, and nothing stated in, or implied by, this document
or its contents shall be considered or deemed a modification or amendment of such warranties. Intergraph and its suppliers
believe the information in this publication is accurate as of its publication date.
The information and the software discussed in this document are subject to change without notice and are subject to applicable
technical product descriptions. Intergraph Corporation and its suppliers are not responsible for any error that may appear in this
document.

Trademarks
Intergraph, the Intergraph logo, GeoMedia, and ImageStation are registered trademarks of Intergraph Corporation. Hexagon
and the Hexagon logo are registered trademarks of Hexagon AB or its subsidiaries. Microsoft and Windows are registered
trademarks of Microsoft Corporation. Bing is a trademark of Microsoft Corporation. Google Maps is a trademark of Google
Incorporated. Pictometry Intelligent Images is a registered trademark of Pictometry International Corporation. ERDAS, ERDAS
IMAGINE, Stereo Analyst, IMAGINE Essentials, IMAGINE Advantage, IMAGINE Professional, IMAGINE VirtualGIS,
Mapcomposer, Viewfinder, and Imagizer are registered trademarks of Intergraph Corporation.
Other brands and product names are trademarks of their respective owners.

About Us
Hexagon Geospatial helps you make sense of the dynamically changing world. Hexagon
Geospatial provides the software products and platforms to a large variety of customers through
direct sales, channel partners, and Hexagon businesses, including the underlying geospatial
technology to drive Intergraph Security, Government & Infrastructure (SG&I) industry solutions.
Hexagon Geospatial is a division of Intergraph Corporation.
CUSTOMERS. Globally, a wide variety of organizations rely on our products daily including
local, state and national mapping agencies, transportation departments, defense organizations,
engineering and utility companies and businesses serving agriculture and natural resource
needs. Our portfolio enables these organizations to holistically understand change and use
information to make mission and business-critical decisions.
TECHNOLOGY. Our priority is to deliver products and solutions that make our customers
successful. Hexagon Geospatial is focused on developing leading-edge technology that is easily
configurable. Through extensible, scalable and collaborative products, we enable you to
transform multi-source content into dynamic and actionable information. We are constantly
re-conceptualizing and improving our products.
PARTNERS. As an organization, we are partner-focused, working alongside our channel to
ensure we succeed together. We provide the right tools, products and support to our business
partners so that they may successfully deliver sophisticated solutions for their customers. We
recognize that we greatly extend our reach and influence by cultivating channel partner
relationships both inside and outside of Hexagon.
TEAM. As an employer, we recognize that the success of our business is the result of our highly
motivated and collaborative staff. At Hexagon Geospatial, we celebrate a diverse set of people
and talents; and we respect people for who they are and the wealth of knowledge they bring to
the table. We retain talent by fostering individual development and ensuring frequent
opportunities to learn and grow.
HEXAGON. Hexagon Geospatial plays a key role in Hexagons multi-industry focus, leveraging
the entire portfolio for a wide variety of geospatial needs. Hexagon is a leading global provider of
design, measurement and visualization technologies. Synergistic thinking is encouraged
across all levels and functions at Hexagon companies, so that we all respond better and faster
to our shared customers needs.
For more information, visit www.hexagongeospatial.com (http://www.hexagongeospatial.com)
and www.hexagon.com (http://www.hexagon.com).

About Us

Contents
About Us ....................................................................................................................................................... 3
Tutorial: Creating a Custom Grid Analysis Command ............................................................................ 7
Creating a Custom Grid Analysis Command .......................................................................................... 7
Introduction ....................................................................................................................................... 7
Tutorial Files and Data ..................................................................................................................... 7
Text Conventions .............................................................................................................................. 7
How This Tutorial Should Be Used .................................................................................................. 7
The GeoMedia Grid Sample Command Project ..................................................................................... 8
Sample C# Command ...................................................................................................................... 8
Rebranding the Command ............................................................................................................... 8
Installing the Custom Command .................................................................................................... 10
Using the Command in GeoMedia Desktop ......................................................................................... 11
Verifying the Command in GeoMedia Desktop .............................................................................. 11
Testing the Custom Command ....................................................................................................... 12

Contents

Tutorial: Creating a Custom Grid Analysis Command


Creating a Custom Grid Analysis Command
Introduction
This tutorial provides an example of the steps involved in creating a custom Grid Analysis
command. Using the Visual Studio 2010 IDE and the GeoMedia InstallAppCmd utility, a
command can be created and added to GeoMedia Desktop. Topics covered in this tutorial
include:

Rebranding the template C# command

Registering a C# command for use within GeoMedia Desktop

Adding a C# command to GeoMedia Desktop

Testing a C# command in the context of GeoMedia Desktop

Tutorial Files and Data


The tutorial includes a C# project that can be used as a template to create custom GeoMedia
Grid commands.

Text Conventions
There are several conventions used throughout this tutorial:

Ribbon bar items are shown as: On the Aaa tab, in the Bbb panel, click Ccc > Ddd.

Dialog box names, field names, and button names are depicted using bolded text.

Information to be entered, either by selecting from a list or by typing, is depicted using


italicized text.

How This Tutorial Should Be Used


This tutorial is intended for those who want to create custom Grid Analysis commands.
Users of this tutorial should have familiarity with C# .NET programming practices, should have a
good working knowledge of GeoMedia Desktop, and should ideally have worked through the
Learning Grid Analysis Tutorial.

Tutorial: Creating a Custom Grid Analysis Command

The GeoMedia Grid Sample Command Project


Sample C# Command
A sample C# project is delivered with Grid Analysis. This project is installed automatically and
can be found in the \Grid Analysis Tutorials\Creating a Custom Command
Tutorial\CSharpSample folder.
The name of the project file is SampleCommand.csproj. If you want to use this project as a
template for other C# development, it is recommended that you make a copy of this command
and use the copied project as the starting point for your new command. You will modify this
generic code with code specific to your custom command.
It is highly recommended that users utilize a base class called GeoMediaCommand,
which is also delivered with Grid Analysis, when writing their custom command. This base
class, which is contained in the ApplicationCommandBase assembly, will define the
necessary structure required for the command to operate properly with GeoMedia Desktop.
For further information related to the creation of your own GeoMedia Grid commands,
also refer to the A Natural Heritage Study Tutorial. This tutorial contains two fully featured
custom commands that provide practical examples for utilizing Grid Analysis functionality.

Rebranding the Command


Once the command is loaded inside the Visual Studio 2010 IDE, there are a few places that
need to be updated to make the command unique to your project. These places include the
GUID inside the assemblyinfo.cs file, the "ProgId" attribute inside the GridSample.cs file, and the
GeoMedia command XML file.
1. Open the project file using Visual Studio 2010 IDE.
2. Inside the AssemblyInfo.cs file, you will notice a line:
[assembly: Guid("6d960207-868e-4aa3-b71f-9fd6c6bcc38f")].
Change the GUID in this line to a custom GUID for your command using Steps 3-6.
3. To create a custom GUID, on the Tools menu, select Create GUID. A screen will appear
that will facilitate creating a unique GUID.

Tutorial: Creating a Custom Grid Analysis Command

4. Click the Registry Format radio button.

5. Click Copy to copy the new GUID into the clipboard.


6. Paste the contents of the clipboard into the line noted in Step 2 above, and format the
resulting string to match the GUID already in the assembly info file.
7. Inside the GridSample.cs file, you will notice the following named attribute on the GridTest
class definition:
[System.Runtime.InteropServices.ProgId("TestCommand.GridTest")].
Modify the ProgId (that is, TestCommand.GridTest) and give it a unique name (for example,
MyTestCommand.MyGridTest).
8. Inside the project folder there will be a BIN directory. Inside that directory will be a file called
GridTest.xml. Open this file in a text-editing application.
9. Change the ProgId to match the ProgId used in the step above.

Tutorial: Creating a Custom Grid Analysis Command

10. If you want to rename the output DLL name, make that change in the project properties
pane of Visual Studio as well as in the GridTest.xml file. The image below will be similar to
what you will see after opening the XML file.

Installing the Custom Command


All commands must be installed before they can be used within GeoMedia Desktop. GeoMedia
Desktop provides a command line utility, InstallAppCmd, for installing one or more application
commands. For ease of use, simple batch scripts have been provided that run the
InstallAppCmd utility for the sample command delivered with this tutorial. A full description of
the syntax and use of the InstallAppCmd utility can be found in the Install Application
Command Tool section of the GeoMedia Command Wizard Help document.
1. Exit GeoMedia Desktop.
2. Save any changes.
3. Browse to \Grid Analysis Tutorials\Creating a Custom Command Tutorial\
CSharpSample\bin.
Double click on the InstallCommand.bat file.
If the command installs correctly, you should see a message box letting you know
that the command successfully loaded.
If you want to un-install this command, simply double click on the
UninstallCommand.bat file.

10

Tutorial: Creating a Custom Grid Analysis Command

4. Once the custom command has been installed, it will be automatically added to the My
Workflow tab on the GeoMedia Desktop ribbon bar.
5. You are now ready to start modifying the contents of the project. It is recommended that you
compile the project and test it to ensure that it will run within the GeoMedia environment.
The command should display a dialog box similar to the one shown below.

6. This command is a sample only. It illustrates how to select a Grid Analysis layer from a
drop-down list, populate an Attribute drop-down list, populate a Grid Analysis map view
control with a selected Grid Analysis layer, create a new Grid Analysis layer, add this new
layer to the current Study Area, and place it into the GeoMedia Map active window.
7. For additional information on automating Grid Analysis, refer to the Grid Analysis Object
Reference. This document can be found in the GeoMedia Object Reference by selecting
Start > All Programs > Intergraph GeoMedia Desktop 2015 > Developer
Documentation > GeoMedia.

Using the Command in GeoMedia Desktop


Verifying the Command in GeoMedia Desktop
To invoke and test your custom command, please use the following steps:
1. Start GeoMedia Desktop.
2. When prompted, choose Open an Existing GeoWorkspace.
3. Double click on the More Files option, navigate to \Grid Analysis Tutorials\Creating a
Custom Command Tutorial and select Introduction.gws.
4. Click Open.

11

Tutorial: Creating a Custom Grid Analysis Command

5. Verify that <your command name> exists in the My Workflow tab.

Testing the Custom Command


The custom command is now ready for testing within GeoMedia Desktop.
1. A Study Area must be created before the command can be used. On the Grid tab, in the
Study Area panel, choose Define New.
2. Click and drag to define a rectangle in the Map window that encompasses most of the
downtown street data.
3. Choose City of Huntsville as the connection in the Define New Study Area dialog box.
4. Accept the default Cell Resolution of 30.
5. Set the Cell Resolution units to Meters; then click OK.
6. The Streets feature class must be rasterized to produce a grid layer to use with the custom
command.
7. In the GeoMedia Legend window, select the Streets feature class; then on the Grid tab, in
the Layer panel, choose Rasterize Legend Entries.
The progress bar at the bottom of the window will indicate the progress of the rasterization
operation. A new grid layer, with the name Streets, will be created.
The layer will not be displayed in the Map window. To view it in the Map window, on
the Grid tab, in the Layer panel, choose Display.
8. To use the custom command, choose My Workflow > <your command name>.
9. The layer name Streets should be entered in the Source Layer field.
10. Accept the default Result layer name, and leave the Place results in map window option
selected.
11. Click OK to execute the command.
The result will simply be a copy of the source layer.
12. To exit the tutorial, exit GeoMedia Desktop without saving changes.

12

Potrebbero piacerti anche