glc_worldhandle.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  Version 2.0.0 Beta 1, packaged on April 2010.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023  *****************************************************************************/
00024 
00025 #ifndef GLC_WORLDHANDLE_H_
00026 #define GLC_WORLDHANDLE_H_
00027 
00028 #include "glc_3dviewcollection.h"
00029 #include "glc_structoccurence.h"
00030 
00031 #include <QHash>
00032 
00033 #include "../glc_config.h"
00034 
00037 
00038 
00039 class GLC_LIB_EXPORT GLC_WorldHandle
00040 {
00042 
00044 
00045 public:
00047         GLC_WorldHandle();
00048 
00050         ~GLC_WorldHandle();
00052 
00054 
00056 
00057 public:
00059         inline GLC_3DViewCollection* collection()
00060         {return &m_Collection;}
00061 
00063         inline int numberOfWorld() const
00064         {return m_NumberOfWorld;}
00065 
00067         inline bool isOrphan() const
00068         {return m_NumberOfWorld == 0;}
00069 
00071         inline bool contains(GLC_uint id) const
00072         {return m_OccurenceHash.contains(id);}
00073 
00075 
00076         inline GLC_StructOccurence* getOccurence(GLC_uint id) const
00077         {
00078                 Q_ASSERT(m_OccurenceHash.contains(id));
00079                 return m_OccurenceHash.value(id);
00080         }
00081 
00083         inline QList<GLC_StructOccurence*> occurences() const
00084         {return m_OccurenceHash.values();}
00085 
00087         inline int numberOfOccurence() const
00088         {return m_OccurenceHash.size();}
00089 
00091         QList<GLC_StructInstance*> instances() const;
00092 
00094         QList<GLC_StructReference*> references() const;
00095 
00097         int numberOfBody() const;
00098 
00100         inline GLC_Vector3d upVector() const
00101         {return m_UpVector;}
00102 
00104 
00106 
00108 
00109 public:
00111         inline void increment()
00112         {++m_NumberOfWorld;}
00113 
00115         inline void decrement()
00116         {--m_NumberOfWorld;}
00117 
00119         void addOccurence(GLC_StructOccurence* pOccurence, bool isSelected= false, GLuint shaderId= 0);
00120 
00122         void removeOccurence(GLC_StructOccurence* pOccurence);
00123 
00125         inline void removeAllOccurences()
00126         {
00127                 m_OccurenceHash.clear();
00128         }
00129 
00131         inline void setUpVector(const GLC_Vector3d& vect)
00132         {m_UpVector= vect;}
00133 
00134 
00136 
00138 // private members
00140 private:
00142         GLC_3DViewCollection m_Collection;
00143 
00145         int m_NumberOfWorld;
00146 
00148         QHash<GLC_uint, GLC_StructOccurence*> m_OccurenceHash;
00149 
00151         GLC_Vector3d m_UpVector;
00152 };
00153 
00154 #endif /* GLC_WORLDHANDLE_H_ */

SourceForge.net Logo

©2005 Laurent Ribon