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.

BUILDING APPLICATIONS WITH C++ AND CONTROL WIDGETS<br />

They also use the <strong>Engine</strong> <strong>Developer</strong> Kit libraries:<br />

• libarcsdk.so<br />

• libmotifctl.so<br />

• libaoctl.so<br />

In addition, for Motif you must link against:<br />

• libpthread.so (Linux only)<br />

• libXm.so<br />

• libX11.so<br />

To implement a custom tool, you must include the following file:<br />

• Ao/AoToolBase.h<br />

IMPLEMENTATION<br />

The implementation below provides you with all the code you will need to<br />

successfully complete the scenario. It does not provide step-by-step instructions<br />

for developing C++ applications with Motif, as it assumes that you have a working<br />

knowledge of the development environment already.<br />

During this scenario, the steps assume that you are programming on Solaris.<br />

However, to follow this same scenario on Linux all you will need to do is to use<br />

the Linux makefile, Makefile.LinuxMotif, instead of the Solaris makefile,<br />

Makefile.SolarisMotif.<br />

Makefiles greatly simplify the build process for<br />

large applications. ESRI's Makefile samples don’t<br />

always use all of the functionality available in the<br />

make utility (for example, SUFFIXES and<br />

pattern rules) because they are designed to<br />

work across many different versions of make.<br />

However, the makefiles do use various predefined<br />

variables that are available for most<br />

versions of make. These predefined variables<br />

include both commands (for example, CXX and<br />

RM) and command arguments (for example,<br />

CXXFLAGS and LDFLAGS). Consult the documentation<br />

for the make utility for more<br />

information about its advanced features.<br />

Creating the makefile<br />

To easily compile the application you make use of a makefile. This scenario is not<br />

designed to teach you the basics of project management with the make utility, so<br />

if you are unfamiliar with them, please see the Oram and Talbott reference at the<br />

end of this scenario.<br />

1. To create the makefile for this scenario, copy either the<br />

Makefile.SolarisMotif.Template (for Solaris programming) or<br />

Makefile.LinuxMotif.Template (for Linux programming). Those files are<br />

located with the code in the Motif_Cpp folder. Remove the “.Template” from<br />

the end of the filename, and replace all instances of “motif_sample” with<br />

“MapViewer.” The Makefile.SolarisMotif.Final and<br />

Makefile.LinuxMotif.Final, in the same directory, show what your makefile<br />

should look like at the end of this scenario.<br />

Creating the Motif Application form by placing the <strong>ArcGIS</strong> <strong>Engine</strong><br />

controls on a Motif Application form<br />

To use the controls, you must create them as Motif widgets and place them into a<br />

Motif application form.<br />

1. Open MapViewer.h, a new file, in your text editor. Place the following lines<br />

to ensure that the class is only declared once. The remainder of code for this<br />

file will fall between #define and #endif.<br />

#ifndef __ENGINE_CONTROL_MOTIF_EXAMPLE__<br />

#define __ENGINE_CONTROL_MOTIF_EXAMPLE__<br />

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