1 //*******************************************************************
2 //
3 // License:  See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts
6 // Description: A brief description of the contents of the file.
7 //
8 //
9 //*************************************************************************
10 // $Id: ossimRefreshEvent.h 19819 2011-07-14 17:28:48Z gpotts $
11 #ifndef ossimRefreshEvent_HEADER
12 #define ossimRefreshEvent_HEADER
13 #include <ossim/base/ossimEvent.h>
14 #include <ossim/base/ossimDpt.h>
15 
16 class OSSIMDLLEXPORT ossimRefreshEvent : public ossimEvent
17 {
18 public:
19    enum RefreshType
20    {
21       REFRESH_NONE      = 0,
22       REFRESH_POSITION  = 1,
23       REFRESH_PIXELS    = 2,
24       REFRESH_GEOMETRY  = 4,
25       REFRESH_ALL       = (REFRESH_POSITION|REFRESH_PIXELS|REFRESH_GEOMETRY)
26    };
27    enum PositionAnchor
28    {
29       ANCHOR_UPPER_LEFT = 1,
30       ANCHOR_CENTER     = 2
31    };
32    ossimRefreshEvent(ossimObject* object=0)  // the object associated with the event if any
ossimEvent(object,OSSIM_EVENT_REFRESH_ID)33    :ossimEvent(object, OSSIM_EVENT_REFRESH_ID),
34     m_refreshType(static_cast<RefreshType>(REFRESH_PIXELS|REFRESH_GEOMETRY)),
35     m_anchor(ANCHOR_CENTER)
36    {m_position.makeNan();}
37    ossimRefreshEvent(RefreshType refreshType, ossimObject* object=0)
ossimEvent(object,OSSIM_EVENT_REFRESH_ID)38    :ossimEvent(object, OSSIM_EVENT_REFRESH_ID),
39     m_refreshType(refreshType),
40     m_anchor(ANCHOR_CENTER)
41 
42    {
43       m_position.makeNan();
44    }
ossimRefreshEvent(const ossimRefreshEvent & src)45    ossimRefreshEvent(const ossimRefreshEvent& src)
46    :ossimEvent(src),
47     m_refreshType(src.m_refreshType),
48     m_position(src.m_position),
49     m_anchor(src.m_anchor)
50    {
51    }
dup()52    virtual ossimObject* dup()const
53    {
54       return new ossimRefreshEvent(*this);
55    }
56 
57    void setRefreshType(int refreshType, bool on=true);
getRefreshType()58    RefreshType getRefreshType()const{return m_refreshType;}
59 
setPosition(const ossimDpt & position)60    void setPosition(const ossimDpt& position)
61    {
62       m_position = position;
63       if(!m_position.hasNans())setRefreshType(REFRESH_POSITION);
64    }
65 
getPosition()66    const ossimDpt& getPosition()const{return m_position;}
67 
68 
69 protected:
70    RefreshType m_refreshType;
71    ossimDpt    m_position;
72    PositionAnchor m_anchor;
73    TYPE_DATA
74 };
75 
76 #endif
77