00001 #ifndef _FACETS_CONTAINER_HPP_
00002 #define _FACETS_CONTAINER_HPP_
00003
00004 #include "kernel/jafarMacro.hpp"
00005
00006 #include "facetsmap/displayFacetsMap.hpp"
00007 #include "facetsmap/types.hpp"
00008
00009 namespace jafar {
00010 namespace facetsmap {
00014 class FacetsContainer {
00015 public:
00016 FacetsContainer() : m_nexid(0) {}
00017 public:
00021 inline id2Facet_cit begin() const { return m_facets.begin(); };
00025 inline id2Facet_cit end() const { return m_facets.end(); };
00030 vFacets closestTo(Facet* f);
00031 public:
00035 inline Facet* operator[] (uint i) { return get(i); };
00039 inline Facet* get(unsigned int id) {
00040 if( m_facets.find(id) == m_facets.end() )
00041 { return 0; }
00042 return m_facets[id];
00043 };
00047 inline unsigned int nbfacets() const { return m_facets.size(); };
00051 inline bool isMember(uint id) { return m_facets.find(id) != m_facets.end(); };
00055 lUints keysList();
00056 protected:
00060 inline uint nextId() { return m_nexid++; };
00068 void insertFacet(uint id, Facet* f, bool lookneigh = false);
00069 public:
00070 #ifdef HAVE_OPENGL
00071 void initTextures();
00072 void displayFacetsContainer(bool displayNormal = true, int time = -1 );
00073 #endif
00074 public:
00076 friend std::ostream& operator<< (std::ostream& , const FacetsContainer&);
00077 inline void dump() { JFR_DEBUG(*this); };
00078 protected:
00079 uint m_nexid;
00080 id2Facet m_facets;
00081 #ifdef HAVE_OPENGL
00082 std::vector<TexInfo*> m_texes;
00083 #endif
00084 };
00085
00086 };
00087 };
00088
00089 #endif