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.

INTERFACES AND MEMBERS<br />

Set statement linking it to the existing Editor object.<br />

Public Sub SetEvents()<br />

Dim pID as New UID<br />

pID = "esriEditor.Editor"<br />

Set m_pEditor = Application.FindExtensionByCLSID(pID)<br />

Set EditEvents = m_pEditor<br />

Secondary outbound interfaces (nondefault)<br />

IActiveViewEvents<br />

IAttributeTransfer-<br />

Type<br />

IEditEvents<br />

(EditEvents2)<br />

IEditEvents2<br />

(EditEvents3)<br />

IEditEvents3<br />

IEdit Layers<br />

Editor class contains several outbound interfaces<br />

Interface key<br />

Property Get<br />

Property Put<br />

Property Get/Put<br />

Property Put by Reference<br />

Function<br />

Event function<br />

Editor<br />

Properties and their symbols<br />

When a class implements more than one outbound event, the secondary interface<br />

name is preceded by a classname, (EditEvents2)IEditEvents2 for example, where<br />

the classname indicates the name of a Helper class. The Helper class is an artificial<br />

coclass that solves the Visual Basic problem with multiple outbound interfaces<br />

on an object. When working with a nondefault outbound interface for<br />

EditEvents2 in Visual Basic 6, declare the variable as follows:<br />

Private WithEvents pEditEvents2 as EditEvents2<br />

INTERFACE MEMBERS<br />

The members of an interface include its properties, which specify the state of an<br />

object, and its methods, which perform some action.<br />

Properties are designated as read-only (get), write-only (put), or read–write (get/<br />

put). Additionally, the value of a property may be a simple data type, a long for<br />

the x-value of a point object, or another class, such as a coordinate system class<br />

(GeographicCoordinateSystem, for example) for the SpatialReference property.<br />

Each property on the diagram is listed with the data type required or returned.<br />

The symbolization and syntax of properties that can be set with an object will<br />

vary based on whether the property is put by value (put) or put by reference. If<br />

ObjectG is assigned to a property by value on ObjectM, then ObjectG is contained<br />

within ObjectM. When an object is passed by reference, an association is<br />

formed between the two objects. This is advantageous because an object can be<br />

reused in many associations, using less memory space.<br />

Dim psphere As ISphere<br />

Set psphere = New Sphere<br />

Dim ppoint As IPoint<br />

Set ppoint = New point<br />

psphere.Center = ppoint<br />

Dim pspatref As ISpatialReference<br />

Set pspatref = New GeographicCoordinateSystem<br />

'This won't compile<br />

'psphere.SpatialReference = pspatref<br />

Set psphere.SpatialReference = pspatref<br />

448 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!