GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_worldhandle.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
22 
23 #ifndef GLC_WORLDHANDLE_H_
24 #define GLC_WORLDHANDLE_H_
25 
26 #include "glc_3dviewcollection.h"
27 #include "glc_structoccurence.h"
28 #include "glc_selectionset.h"
29 
30 #include <QHash>
31 
32 #include "../glc_config.h"
33 
36 
37 
39 {
41 
43 
44 public:
47 
49  ~GLC_WorldHandle();
51 
53 
55 
56 public:
58  inline GLC_3DViewCollection* collection()
59  {return &m_Collection;}
60 
62  inline int numberOfWorld() const
63  {return m_NumberOfWorld;}
64 
66  inline bool isOrphan() const
67  {return m_NumberOfWorld == 0;}
68 
70  inline bool containsOccurence(GLC_uint id) const
71  {return m_OccurenceHash.contains(id);}
72 
74 
75  inline GLC_StructOccurence* getOccurence(GLC_uint id) const
76  {
77  Q_ASSERT(m_OccurenceHash.contains(id));
78  return m_OccurenceHash.value(id);
79  }
80 
82  inline QList<GLC_StructOccurence*> occurences() const
83  {return m_OccurenceHash.values();}
84 
86  inline int numberOfOccurence() const
87  {return m_OccurenceHash.size();}
88 
90  QList<GLC_StructInstance*> instances() const;
91 
93  QList<GLC_StructReference*> references() const;
94 
96  int numberOfBody() const;
97 
99  int representationCount() const;
100 
102  inline GLC_Vector3d upVector() const
103  {return m_UpVector;}
104 
106  inline GLC_SelectionSet* selectionSetHandle()
107  {return &m_SelectionSet;}
108 
110 
112 
114 
115 public:
117  inline void increment()
118  {++m_NumberOfWorld;}
119 
121  inline void decrement()
122  {--m_NumberOfWorld;}
123 
125  void addOccurence(GLC_StructOccurence* pOccurence, bool isSelected= false, GLuint shaderId= 0);
126 
128  void removeOccurence(GLC_StructOccurence* pOccurence);
129 
131  inline void removeAllOccurences()
132  {m_OccurenceHash.clear();}
133 
135  inline void setUpVector(const GLC_Vector3d& vect)
136  {m_UpVector= vect;}
137 
139  inline void setAttachedViewport(GLC_Viewport* pViewport)
140  {m_Collection.setAttachedViewport(pViewport);}
141 
143 
144  void select(GLC_uint occurenceId);
145 
147 
148  void unselect(GLC_uint occurenceId, bool propagate= true);
149 
151  void selectAllWith3DViewInstance(bool allShowState);
152 
154  void unselectAll();
155 
157  void showHideSelected3DViewInstance();
158 
160  void setSelected3DViewInstanceVisibility(bool isVisible);
161 
163 
165 // private members
167 private:
170 
173 
175  QHash<GLC_uint, GLC_StructOccurence*> m_OccurenceHash;
176 
179 
182 
183 private:
184  Q_DISABLE_COPY(GLC_WorldHandle)
185 };
186 
187 #endif /* GLC_WORLDHANDLE_H_ */

©2005-2013 Laurent Ribon