18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DEVELOPING WITH A RCOBJECTS<br />

Object browsers<br />

In addition to the class diagram PDF files, the type library information can be<br />

viewed using a number of object browsers, depending on your development<br />

platform.<br />

Visual Basic and .NET have built-in object browsers; OLEView (a free utility<br />

from Microsoft) also displays type library information. The best object viewer to<br />

use in this environment is the ESRI object viewer. This object viewer can be used<br />

to view type information for any type library that you reference within it. Information<br />

on the classes and interfaces can be displayed in Visual Basic, Visual C++,<br />

or object diagram format. The object browsers can view coclasses and classes but<br />

cannot be used to view abstract classes. Abstract classes are only viewable on the<br />

object diagrams, where their use is solely to simplify the models.<br />

Java and C++ developers should refer to the ArcObjects—Javadoc or <strong>ArcGIS</strong><br />

<strong>Developer</strong> Help.<br />

Component help<br />

All interfaces and coclasses are documented in the component help file. Ultimately,<br />

this will be the help most commonly accessed when you get to know the<br />

object models better.<br />

For Visual Basic and .NET developers, this is a compiled HTML file that can be<br />

viewed by itself or when using an IDE. If the cursor is over an ESRI type when<br />

the F1 key is pressed, the appropriate page in the ArcObjects Class Help in the<br />

<strong>ArcGIS</strong> <strong>Developer</strong> Help system is displayed in the compiled HTML viewer.<br />

For Java and C++ developers, refer to ArcObjects—Javadoc or the <strong>ArcGIS</strong><br />

<strong>Developer</strong> Help system.<br />

Code wizards<br />

There are a number of code generation wizards available to help with the creation<br />

of boilerplate code in Visual Basic, Visual C++, and .NET. Although these<br />

wizards are useful in removing the tediousness in common tasks, they do not<br />

excuse you as the developer from understanding the underlying principles of the<br />

generated code. The main objective should be to read the accompanying documentation<br />

and understand the limitations of these tools.<br />

This graph shows the performance benefits of<br />

accessing a collection using an enumerator as<br />

opposed to the elements index. As expected, the<br />

graph shows a classic power trend line (y=cx b ).<br />

Indexing of collections<br />

All collection-like objects in ArcObjects are zero based for their indexing. This is<br />

not the case with all development environments; Visual Basic has both zero- and<br />

one-based collections. As a general rule, if the collection base is not known,<br />

assume that the collection base is zero. This ensures that a runtime error will be<br />

raised when the collection is first accessed (assuming the access of the collection<br />

does not start at zero). Assuming a base of one means the first element of a zerobased<br />

collection would be missed and an error would only be raised if the end of<br />

the collection were reached when the code is executed.<br />

Chapter 4 • <strong>Developer</strong> environments • 71

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

Saved successfully!

Ooh no, something went wrong!