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.

C++ APPLICATION PROGRAMMING INTERFACE<br />

}<br />

std::cerr OpenRaster<br />

Dataset(CComBSTR(sFile), ppRasterDataset);<br />

IFieldEditPtr ipFieldEdit(ipField); // ipFieldEdit not<br />

yet declared<br />

OR<br />

ipFieldEdit = ipField; // ipFieldEdit previously<br />

declared<br />

ipFieldEdit->put_Name (CComBSTR(shape<br />

FieldName));<br />

ipFieldEdit->putref_GeometryDef(ipGeomDef);<br />

ipFields->get_FieldCount(&lFieldCount);<br />

Notes<br />

Coding practice depends<br />

on when the instance<br />

is created.<br />

C++ requires an explicit<br />

cast to CComBSTR, and<br />

ipWs must be created<br />

previously and passed in<br />

(even if still NULL).<br />

Inline query interfacem to<br />

IRasterWorkspace from<br />

IWorkspace.<br />

Coding practice depends<br />

on where the instance is<br />

given its value.<br />

Use "put_" for<br />

assignments.<br />

If VB uses "Set" in the<br />

assignment, you will use<br />

"putref_" in C++.<br />

Use "get_" to retrieve<br />

information. Notice you<br />

will need to pass in<br />

a reference.<br />

if (TypeOf m_ipDisplay_<br />

Feedback Is INewMulti_<br />

PointFeedback) Then<br />

INewMultiPointFeedbackPtr ipNewMultiPoint<br />

Feedback (m_ipDisplayFeedback);<br />

if (ipNewMultiPointFeedback != 0)<br />

• “p” prefix—variable is a pointer.<br />

• “pp” prefix—variable is a pointer to a pointer.<br />

• “ip” prefix—variable is a smart pointer.<br />

TROUBLESHOOTING<br />

Problems finding or opening the include file “ArcSDK.h”<br />

If your sample is not compiling because it cannot open ArcSDK.h, make sure<br />

that you have the correct argument for the include directory. If you installed to<br />

the default directory, it should be either \Program Files\<strong>ArcGIS</strong>\include\CPPAPI<br />

(for Windows) or /arcgis/include (for Linux and Solaris). If it is correct and it is<br />

still not working, make sure the file is in that directory.<br />

232 • <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!