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  http://glc-lib.sourceforge.net
00006 
00007  GLC-lib is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU Lesser General Public License as published by
00009  the Free Software Foundation; either version 3 of the License, or
00010  (at your option) any later version.
00011 
00012  GLC-lib is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU Lesser General Public License for more details.
00016 
00017  You should have received a copy of the GNU Lesser General Public License
00018  along with GLC-lib; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021  *****************************************************************************/
00022 
00023 #ifndef GLC_WORLDHANDLE_H_
00024 #define GLC_WORLDHANDLE_H_
00025 
00026 #include "glc_3dviewcollection.h"
00027 #include "glc_structoccurence.h"
00028 #include "glc_selectionset.h"
00029 
00030 #include <QHash>
00031 
00032 #include "../glc_config.h"
00033 
00036 
00037 
00038 class GLC_LIB_EXPORT GLC_WorldHandle
00039 {
00041 
00043 
00044 public:
00046         GLC_WorldHandle();
00047 
00049         ~GLC_WorldHandle();
00051 
00053 
00055 
00056 public:
00058         inline GLC_3DViewCollection* collection()
00059         {return &m_Collection;}
00060 
00062         inline int numberOfWorld() const
00063         {return m_NumberOfWorld;}
00064 
00066         inline bool isOrphan() const
00067         {return m_NumberOfWorld == 0;}
00068 
00070         inline bool containsOccurence(GLC_uint id) const
00071         {return m_OccurenceHash.contains(id);}
00072 
00074 
00075         inline GLC_StructOccurence* getOccurence(GLC_uint id) const
00076         {
00077                 Q_ASSERT(m_OccurenceHash.contains(id));
00078                 return m_OccurenceHash.value(id);
00079         }
00080 
00082         inline QList<GLC_StructOccurence*> occurences() const
00083         {return m_OccurenceHash.values();}
00084 
00086         inline int numberOfOccurence() const
00087         {return m_OccurenceHash.size();}
00088 
00090         QList<GLC_StructInstance*> instances() const;
00091 
00093         QList<GLC_StructReference*> references() const;
00094 
00096         int numberOfBody() const;
00097 
00099         int representationCount() const;
00100 
00102         inline GLC_Vector3d upVector() const
00103         {return m_UpVector;}
00104 
00106         inline GLC_SelectionSet* selectionSetHandle()
00107         {return &m_SelectionSet;}
00108 
00110 
00112 
00114 
00115 public:
00117         inline void increment()
00118         {++m_NumberOfWorld;}
00119 
00121         inline void decrement()
00122         {--m_NumberOfWorld;}
00123 
00125         void addOccurence(GLC_StructOccurence* pOccurence, bool isSelected= false, GLuint shaderId= 0);
00126 
00128         void removeOccurence(GLC_StructOccurence* pOccurence);
00129 
00131         inline void removeAllOccurences()
00132         {
00133                 m_OccurenceHash.clear();
00134         }
00135 
00137         inline void setUpVector(const GLC_Vector3d& vect)
00138         {m_UpVector= vect;}
00139 
00141         inline void setAttachedViewport(GLC_Viewport* pViewport)
00142         {m_Collection.setAttachedViewport(pViewport);}
00143 
00145 
00146         void select(GLC_uint occurenceId);
00147 
00149 
00150         void unselect(GLC_uint occurenceId, bool propagate= true);
00151 
00153         void selectAllWith3DViewInstance(bool allShowState);
00154 
00156         void unselectAll();
00157 
00159         void showHideSelected3DViewInstance();
00160 
00162         void setSelected3DViewInstanceVisibility(bool isVisible);
00163 
00164 
00166 
00168 // private members
00170 private:
00172         GLC_3DViewCollection m_Collection;
00173 
00175         int m_NumberOfWorld;
00176 
00178         QHash<GLC_uint, GLC_StructOccurence*> m_OccurenceHash;
00179 
00181         GLC_Vector3d m_UpVector;
00182 
00184         GLC_SelectionSet m_SelectionSet;
00185 };
00186 
00187 #endif /* GLC_WORLDHANDLE_H_ */

SourceForge.net Logo

©2005-2011 Laurent Ribon