MoleSymbolsWindow.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 __MOLE_SYMBOLS_WINDOW__H__ #define __MOLE_SYMBOLS_WINDOW__H__ #include <ArcSDK.h> #include <Ao/AoControls.h> #include <AxCtl/qt4axctl.h> #include <olb/esridefensesolutions.h> #include <QtGui/QtGui> #include "MoleSymbols.h" // the application's main window class MoleSymbolsWindow : public QWidget, public IMapControlEvents2Helper { Q_OBJECT // selected UI objects we will need to reference again after the constructor exits QToolButton *m_btnAddMoleSymbol; QToolButton *m_btnSelect; IMapControl4Ptr m_ipMapControl; IEventListenerHelperPtr m_ipMapControlEventsHelper; IToolbarControl2Ptr m_ipToolbarControl; QLineEdit *m_txtSIC; QLineEdit *m_txtSize; // other private state variables bool m_firstTime; IPointPtr m_ipCurrentMouseLocation; IPointPtr m_ipLastMouseClick; IDisplayFeedbackPtr m_ipMoveFeedback; IEnvelopePtr m_ipSelectedBounds; unsigned int m_unitCount; // utility functions void addTool (const char *name); IPointPtr createPoint (double x, double y); double dRandom (double low, double high); void drawSymbol (IPointPtr ipLocation, const char *sic, bool suppressRefresh); IPropertySetPtr getLabels (); IColorPtr getRandomColor (); void moveGraphics (double deltaX, double deltaY); bool selectElements (IPointPtr ipPoint, IActiveViewPtr ipActiveView, IEnvelopePtr ipSelectedBounds); void updateTitle (); public slots: // event handlers for the Qt buttons void add200 (); void addArea (); void addLine (); void addMoleSymbol (bool checked); void moveUnits (); void select (bool checked); public: // this object will live longer than any COM object it contains - macro defined in SDK_Unix.h HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj) { return S_OK; } ULONG __stdcall AddRef() { return 0; } ULONG __stdcall Release() { return 0; } #if defined(ESRI_UNIX) // unused events from IMapControlEvents2 - you can paste these prototypes from mapcontrol_events.tlh virtual void OnAfterDraw (VARIANT, long) {} virtual void OnAfterScreenDraw (long) {} virtual void OnBeforeScreenDraw (long) {} virtual void OnDoubleClick (long, long, long, long, double, double) {} virtual void OnExtentUpdated (VARIANT, VARIANT_BOOL, VARIANT) {} virtual void OnFullExtentUpdated (VARIANT, VARIANT) {} virtual void OnKeyDown (long, long) {} virtual void OnKeyUp (long, long) {} virtual void OnOleDrop (esriControlsDropAction, VARIANT, long*, long, long, long, long) {} virtual void OnSelectionChanged () {} virtual void OnViewRefreshed (VARIANT, long, VARIANT, VARIANT) {} // implemented events from IMapControlEvents2 virtual void OnMapReplaced (VARIANT newMap); virtual void OnMouseDown (long button, long shift, long x, long y, double mapX, double mapY); virtual void OnMouseMove (long button, long shift, long x, long y, double mapX, double mapY); virtual void OnMouseUp (long button, long shift, long x, long y, double mapX, double mapY); #elif defined(ESRI_WINDOWS) // unused events from IMapControlEvents2 - you can paste these prototypes from mapcontrol_events.tlh virtual void __stdcall OnAfterDraw (VARIANT, long) {} virtual void __stdcall OnAfterScreenDraw (long) {} virtual void __stdcall OnBeforeScreenDraw (long) {} virtual void __stdcall OnDoubleClick (long, long, long, long, double, double) {} virtual void __stdcall OnExtentUpdated (VARIANT, VARIANT_BOOL, VARIANT) {} virtual void __stdcall OnFullExtentUpdated (VARIANT, VARIANT) {} virtual void __stdcall OnKeyDown (long, long) {} virtual void __stdcall OnKeyUp (long, long) {} virtual void __stdcall OnOleDrop (esriControlsDropAction, VARIANT, long*, long, long, long, long) {} virtual void __stdcall OnSelectionChanged () {} virtual void __stdcall OnViewRefreshed (VARIANT, long, VARIANT, VARIANT) {} // implemented events from IMapControlEvents2 virtual void __stdcall OnMapReplaced (VARIANT newMap); virtual void __stdcall OnMouseDown (long button, long shift, long x, long y, double mapX, double mapY); virtual void __stdcall OnMouseMove (long button, long shift, long x, long y, double mapX, double mapY); virtual void __stdcall OnMouseUp (long button, long shift, long x, long y, double mapX, double mapY); #endif // constructor and destructor to set up the GUI and dereference objects MoleSymbolsWindow(); virtual ~MoleSymbolsWindow(); }; #endif // __MOLE_SYMBOLS_WINDOW__H__