Mercator
Effector.h
00001 // This file may be redistributed and modified only under the terms of
00002 // the GNU General Public License (See COPYING for details).
00003 // Copyright (C) 2010 Alistair Riddoch
00004 
00005 #ifndef MERCATOR_EFFECTOR_H
00006 #define MERCATOR_EFFECTOR_H
00007 
00008 #include <wfmath/axisbox.h>
00009 #include <wfmath/polygon.h>
00010 
00011 #include <string>
00012 
00013 namespace Mercator
00014 {
00015 
00016 class Segment;
00017 class Shader;
00018 
00025 class Effector
00026 {
00027   public:
00028     class Context {
00029       public:
00030         Context();
00031 
00032         virtual ~Context();
00033 
00034         const std::string & id() { return m_id; }
00035 
00036         void setId(const std::string &);
00037       protected:
00038         std::string m_id;
00039     };
00040 
00041     Context * context() const { return m_context; }
00042 
00043     void setContext(Context *);
00044 
00046     const WFMath::AxisBox<2> & bbox() const
00047     {
00048         return m_box;
00049     }
00050 
00051     virtual ~Effector() = 0;
00052 
00053     virtual bool checkIntersects(const Segment& s) const = 0;
00054 
00055     virtual int addToSegment(Segment &) const = 0;
00056     virtual void updateToSegment(Segment &) const = 0;
00057     virtual void removeFromSegment(Segment &) const = 0;
00058     
00059   protected:
00061     Effector();
00062 
00064     Effector(const Effector &);
00065 
00067     Effector & operator=(const Effector &);
00068 
00070     WFMath::AxisBox<2> m_box;
00071     
00073     Context * m_context;
00074 };
00075 
00076 }
00077 
00078 #endif // of MERCATOR_EFFECTOR_H