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 />

set the envelope to the new visible bounds of the map. By refreshing the<br />

MapControl you force it to redraw the shape on its display.<br />

#include "TransformEvents.h"<br />

HRESULT TransformEvents::BoundsUpdated(IDisplayTransformation* sender)<br />

{<br />

return E_NOTIMPL;<br />

}<br />

HRESULT TransformEvents::DeviceFrameUpdated(IDisplayTransformation* sender,<br />

VARIANT_BOOL sizeChanged)<br />

{<br />

return E_NOTIMPL;<br />

}<br />

HRESULT TransformEvents::ResolutionUpdated(IDisplayTransformation* sender)<br />

{<br />

return E_NOTIMPL;<br />

}<br />

HRESULT TransformEvents::RotationUpdated(IDisplayTransformation* sender)<br />

{<br />

return E_NOTIMPL;<br />

}<br />

HRESULT TransformEvents::UnitsUpdated(IDisplayTransformation* sender)<br />

{<br />

return E_NOTIMPL;<br />

}<br />

HRESULT TransformEvents::VisibleBoundsUpdated(IDisplayTransformation* sender,<br />

VARIANT_BOOL sizeChanged)<br />

{<br />

// Set the extent to the new visible extent<br />

sender->get_VisibleBounds(&g_ipCurrentExtent);<br />

// Refresh the MapControl's foreground phase<br />

HRESULT hr = g_ipMapControl->Refresh(esriViewForeground);<br />

return hr;<br />

}<br />

8. Although the TransformEvents class has been implemented, those events are not<br />

yet listened for.<br />

a. First, include the new TransformEvents.h header file in MapViewer.h:<br />

#include "TOCControlEvents.h"<br />

#include "TransformEvents.h"<br />

b. Next start up these events in MapViewer.cpp’s main, but you will not advise<br />

them there. Remember to place the variable declarations at the top of<br />

MapViewer.cpp.<br />

TOCControlEvents* g_tocEvents;<br />

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