18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

BUILDING A COMMAND-LINE C++ APPLICATION<br />

Rather than walk through this scenario, you can<br />

get the completed application from the samples<br />

installation location. The sample is installed as<br />

part of the <strong>ArcGIS</strong> developer samples.<br />

The <strong>ArcGIS</strong> developer samples are not included<br />

in the typical installation of the <strong>ArcGIS</strong> <strong>Engine</strong><br />

<strong>Developer</strong> Kit. If you do not have them installed,<br />

rerun the <strong>Developer</strong> Kit Install wizard, click<br />

Custom or Modify, and click the samples feature<br />

under Software <strong>Developer</strong> Kit.<br />

Although this scenario steps you through C++<br />

development, solution code is also available in<br />

other programming languages, including C#, Java,<br />

Visual Basic 6, Visual Basic .NET, and Visual<br />

C++.<br />

For a more in-depth explanation of slope, see<br />

the Burrough and McDonnell reference listed in<br />

the 'Additional resources' section at the end of<br />

this scenario.<br />

This scenario is designed to introduce the <strong>ArcGIS</strong> <strong>Engine</strong> C++ API for crossplatform<br />

applications. To get the most out of this scenario, you should understand<br />

basic C/C++ programming concepts such as the preprocessor, functions,<br />

and memory management. Some familiarity with ArcObjects will also be helpful,<br />

although not required. Although this scenario does require conceptual knowledge<br />

of the C++ language, it does not require a lot of programming experience. The<br />

code used in this example provides an easy entry point to learn about the C++<br />

API to <strong>ArcGIS</strong> <strong>Engine</strong> on a small and simple scale.<br />

The purpose of this scenario is not to teach how to set up a C++ environment or<br />

how to compile on each supported operating system. Throughout this scenario it<br />

is assumed that you have a functional C++ environment and know how to<br />

compile a C++ program in that environment. What this scenario does provide is<br />

the steps to take and the code to write to create a command-line application that<br />

computes the slope of a given digital elevation model.<br />

You can find this sample in:<br />

\<strong>Developer</strong>Kit\samples\<strong>Developer</strong>_<strong>Guide</strong>_Scenarios\<br />

Computing_the_Slope_of_a_Raster_DatasetCpp.zip<br />

PROJECT DESCRIPTION<br />

This scenario covers some aspects of the <strong>ArcGIS</strong> <strong>Engine</strong> C++ API. The goal of<br />

the RasterSlope scenario is to create a standalone command-line application with<br />

the <strong>ArcGIS</strong> C++ API. The application will take as input a digital elevation model<br />

(DEM) and will build and persist the slope map raster dataset. Once you have<br />

completed this scenario, you will understand the techniques required to work<br />

with the <strong>ArcGIS</strong> <strong>Engine</strong> C++ API, including using the Spatial extension. In<br />

particular, the scenario covers the following techniques:<br />

• Programming with the <strong>ArcGIS</strong> <strong>Engine</strong> C++ developer kit in a standard text<br />

editor.<br />

• Parsing command-line arguments.<br />

• Enabling extensions—in particular, the Spatial extension.<br />

• Performing the calculation of slope on a raster dataset.<br />

• Persisting the resultant raster dataset.<br />

• Deploying the application on all platforms supported by the <strong>ArcGIS</strong> <strong>Engine</strong><br />

C++ API.<br />

CONCEPTS<br />

Slope datasets are often used as inputs in physical process models. Slope is commonly<br />

expressed in degrees or as a percentage. In the slope calculation a parameter<br />

(zFactor) can specify the number of ground x,y units in one z unit. This<br />

allows you to create a slope dataset with different z units from the input surface.<br />

To build the slope dataset, you will use the RasterSurfaceOp class and the<br />

ISurfaceOp interface it implements. You will also use the Raster class and the<br />

IRasterBandCollection interface it implements to persist the resulting raster dataset.<br />

The role of the software is to calculate the slope of a given raster dataset. The<br />

Chapter 6 • <strong>Developer</strong> scenarios • 427

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!