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

src/TriMesh.hh

00001 /*
00002  * Copyright Staffan Gimåker 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_TRI_MESH_HH_INCLUDED
00023 #define PEEKABOT_TRI_MESH_HH_INCLUDED
00024 
00025 
00026 #include "SceneObject.hh"
00027 #include "ScalableObject.hh"
00028 #include "VertexObject.hh"
00029 #include "HandlerInformer.hh"
00030 
00031 #include <string>
00032 #include <vector>
00033 #include <boost/cstdint.hpp>
00034 #include <boost/signals2.hpp>
00035 #include <Eigen/Core>
00036 
00037 
00038 namespace peekabot
00039 {
00040     class ScopedHandler;
00041     class ObjectVisitor;
00042 
00046     class TriMesh : public SceneObject,
00047                     public ScalableObject,
00048                     public VertexObject
00049     {
00050     public:
00051         typedef std::vector<boost::uint32_t> Indices;
00052 
00056         TriMesh();
00057 
00061         TriMesh(ScopedHandler *handler);
00062 
00063         virtual void accept(ObjectVisitor *visitor) throw();
00064 
00065         virtual ObjectType get_object_type() const;
00066 
00067         const Indices &get_indices() const;
00068 
00069         void set_indices(const Indices &indices);
00070 
00071         void add_indices(const Indices &indices);
00072 
00075 
00076         typedef boost::signals2::signal<void ()> IndicesSetSignal;
00077 
00078         typedef boost::signals2::signal<void (
00079             const Indices &new_indices)> IndicesAddedSignal;
00080 
00081         inline IndicesSetSignal &indices_set_signal() const
00082         {
00083             return m_indices_set_signal;
00084         }
00085 
00086         inline IndicesAddedSignal &indices_added_signal() const
00087         {
00088             return m_indices_added_signal;
00089         }
00090 
00092 
00093     protected:
00094         virtual PropMap &get_prop_adapters();
00095 
00096     private:
00097         static void create_prop_adapters(PropMap &adapters);
00098 
00101 
00105         static void start_handler(
00106             const std::string &name,
00107             XMLHandler::AttributeMap &attributes,
00108             ScopedHandler *handler) throw();
00109 
00110         void triangles_start_handler(
00111             const std::string &tag_name,
00112             XMLHandler::AttributeMap &attributes,
00113             ScopedHandler *handler);
00114 
00115         void triangles_end_handler(
00116             const std::string &name,
00117             ScopedHandler *handler);
00118 
00119         static void triangle_start_handler(
00120             const std::string &tag_name,
00121             XMLHandler::AttributeMap &attributes,
00122             ScopedHandler *handler);
00123 
00124         static void triangle_cdata_handler(
00125             const std::string &cdata,
00126             ScopedHandler *handler);
00127 
00129 
00130     private:
00131         Indices m_indices;
00132 
00133         static HandlerInformer ms_handler_informer;
00134 
00135         mutable IndicesSetSignal m_indices_set_signal;
00136         mutable IndicesAddedSignal m_indices_added_signal;
00137     };
00138 }
00139 
00140 
00141 #endif // PEEKABOT_TRI_MESH_HH_INCLUDED

Generated on Sun Jan 30 2011 for peekabot by  doxygen 1.7.1