MyDynamicLayer.h
// Copyright 2010 ESRI // // All rights reserved under the copyright laws of the United States // and applicable international laws, treaties, and conventions. // // You may freely redistribute and use this sample code, with or // without modification, provided you include the original copyright // notice and use restrictions. // // See the use restrictions. // #ifndef __DYNAMICDISPLAY__MYDYNAMICLAYER_H__ #define __DYNAMICDISPLAY__MYDYNAMICLAYER_H__ #include <ArcSDK.h> #include "CustomLayerBase.h" #define NUM_OF_ITEMS 100 #define ANIMATION_CYCLE_TIME_MS 33 #define MAP_CYCLE_TIME_MS 33 #define ESRI_PI 3.14159265358979323846 class MyDynamicLayer: public CustomLayerBase { public: MyDynamicLayer(IMap* pMap); ~MyDynamicLayer(); void put_Animate(bool bAnimate); // IDynamicLayer HRESULT STDMETHODCALLTYPE get_DynamicLayerDirty(enum esriDynamicDrawPhase DynamicDrawPhase, VARIANT_BOOL* Dirty); HRESULT STDMETHODCALLTYPE put_DynamicLayerDirty(enum esriDynamicDrawPhase DynamicDrawPhase, VARIANT_BOOL Dirty); HRESULT STDMETHODCALLTYPE get_DynamicRecompileRate(long *dynamicRecompileRateTimeMS); HRESULT STDMETHODCALLTYPE DrawDynamicLayer(enum esriDynamicDrawPhase DynamicDrawPhase, struct IDisplay* Display, struct IDynamicDisplay *DynamicDisplay); struct SNavigationData { double x, y, azimuth, stepX, stepY; int type; }; private: HRESULT CreateDynamicSymbols(IDynamicDisplay* pDynamicDisplay); HRESULT GenerateNavigationData(IDisplay* pDisplay); void UpdateItems(IDisplay* pDisplay); void DrawItems(IDisplay* pDisplay, IDynamicDisplay* pDynamicDisplay); inline double GetRandomDouble(); IMapPtr m_ipMap; SNavigationData m_navData[NUM_OF_ITEMS]; IDynamicGlyphPtr m_ipMarkerGlphys[3]; IDynamicGlyphPtr m_ipTextGlyph; bool m_bDynamicGlyphsCreated; char m_sIndex[128]; char m_sHeading[128]; char m_sX[128]; char m_sY[128]; CComBSTR m_bstrEmptyString; bool m_bAnimate; VARIANT_BOOL m_bIsDirty[2]; }; #endif /* __DYNAMICDISPLAY__MYDYNAMICLAYER_H__ */