• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

src/GridObject.hh

00001 /*
00002  * Copyright Staffan Gimåker 2007-2010.
00003  *
00004  * ---
00005  *
00006  * This file is part of peekabot.
00007  *
00008  * peekabot is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 3 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * peekabot is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 #ifndef PEEKABOT_GRID_OBJECT_HH_INCLUDED
00023 #define PEEKABOT_GRID_OBJECT_HH_INCLUDED
00024 
00025 
00026 #include "SceneObject.hh"
00027 #include "ScalableObject.hh"
00028 #include "LineBased.hh"
00029 #include "XMLHandler.hh"
00030 #include "HandlerInformer.hh"
00031 
00032 
00033 namespace peekabot
00034 {
00035     class ScopedHandler;
00036 
00044     class GridObject : public SceneObject,
00045                        public ScalableObject,
00046                        public LineBased
00047     {
00048     public:
00049         GridObject() throw();
00050 
00051         GridObject(ScopedHandler *handler) throw();
00052 
00053         virtual void accept(ObjectVisitor* visitor) throw();
00054 
00055         virtual ObjectType get_object_type() const;
00056 
00057         GridType get_grid_type() const throw();
00058 
00059         void set_grid_type(GridType grid_type) throw();
00060 
00061         boost::uint32_t get_segment_count() const throw();
00062 
00063         void set_segment_count(boost::uint32_t segment_count) throw();
00064 
00065         float get_central_angle() const throw();
00066 
00067         void set_central_angle(float central_angle) throw();
00068 
00071 
00072         typedef boost::signals2::signal<void ()> SegmentCountSetSignal;
00073 
00074         typedef boost::signals2::signal<void ()> GridTypeSetSignal;
00075 
00076         typedef boost::signals2::signal<void ()> CentralAngleSetSignal;
00077 
00078         inline SegmentCountSetSignal &segment_count_set_signal()
00079         {
00080             return m_segment_count_set_signal;
00081         }
00082 
00083         inline GridTypeSetSignal &grid_type_set_signal()
00084         {
00085             return m_grid_type_set_signal;
00086         }
00087 
00088         inline CentralAngleSetSignal &central_angle_set_signal()
00089         {
00090             return m_central_angle_set_signal;
00091         }
00092 
00094 
00095     protected:
00096         virtual PropMap &get_prop_adapters();
00097 
00098     private:
00099         static void create_prop_adapters(PropMap &adapters);
00100 
00104         static void start_handler(
00105             const std::string &name,
00106             XMLHandler::AttributeMap &attributes,
00107             ScopedHandler *handler) throw();
00108 
00109         void type_start_handler(
00110             const std::string &name,
00111             XMLHandler::AttributeMap &attributes,
00112             ScopedHandler *handler) throw();
00113 
00114         void type_cdata_handler(
00115             const std::string &cdata,
00116             ScopedHandler *handler) throw();
00117 
00118         void segments_start_handler(
00119             const std::string &name,
00120             XMLHandler::AttributeMap &attributes,
00121             ScopedHandler *handler) throw();
00122 
00123         void segments_cdata_handler(
00124             const std::string &cdata,
00125             ScopedHandler *handler) throw();
00126 
00127         void central_angle_start_handler(
00128             const std::string &name,
00129             XMLHandler::AttributeMap &attributes,
00130             ScopedHandler *handler) throw();
00131 
00132         void radians_start_handler(
00133             const std::string &name,
00134             XMLHandler::AttributeMap &attributes,
00135             ScopedHandler *handler) throw();
00136 
00137         void degrees_start_handler(
00138             const std::string &name,
00139             XMLHandler::AttributeMap &attributes,
00140             ScopedHandler *handler) throw();
00141 
00142         void central_angle_cdata_handler(
00143             const std::string &cdata,
00144             ScopedHandler *handler,
00145             bool value_in_degrees) throw();
00146 
00147     private:
00148         static HandlerInformer ms_handler_informer;
00149 
00150         GridType m_grid_type;
00151 
00152         boost::uint32_t m_segment_count;
00153 
00154         float m_central_angle;
00155 
00156         SegmentCountSetSignal m_segment_count_set_signal;
00157         GridTypeSetSignal m_grid_type_set_signal;
00158         CentralAngleSetSignal m_central_angle_set_signal;
00159     };
00160 }
00161 
00162 #endif // PEEKABOT_GRID_OBJECT_HH_INCLUDED

Generated on Sun Jan 30 2011 for peekabot by  doxygen 1.7.1