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 0.9.9, packaged on May, 2008. 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 00026 00027 #ifndef GLC_COLLECTION_H_ 00028 #define GLC_COLLECTION_H_ 00029 00030 00031 #include <QHash> 00032 #include "glc_instance.h" 00033 #include "glc_enum.h" 00034 00035 class GLC_Material; 00036 00038 typedef QHash< GLC_uint, GLC_Instance> CNodeMap; 00039 typedef QHash< GLC_uint, GLC_Instance*> SelectedNodeHash; 00040 00043 00048 00049 00050 class GLC_Collection 00051 { 00052 00054 00056 00057 public: 00059 GLC_Collection(); 00060 00062 00063 virtual ~GLC_Collection(); 00064 00066 00068 00070 00071 public: 00072 00074 bool isEmpty() const {return m_NodeMap.size() == 0;} 00075 00077 int getNumber(void) const{return m_NodeMap.size();} 00078 00080 00081 GLC_Instance* getInstanceHandle(GLC_uint Key); 00082 00084 GLC_BoundingBox getBoundingBox(void); 00085 00087 int getNumberOfSelectedNode(void) const {return m_SelectedNodes.size();} 00088 00090 SelectedNodeHash* getSelections() {return &m_SelectedNodes;} 00091 00093 bool isInCollection(GLC_uint key) const {return m_NodeMap.contains(key);} 00094 00096 bool isSelected(GLC_uint key) const {return m_SelectedNodes.contains(key);} 00097 00099 00101 00103 00104 public: 00105 00107 00108 bool add(GLC_Instance& node); 00109 00111 00118 bool remove(GLC_uint Key); 00119 00121 void clear(void); 00122 00124 bool select(GLC_uint); 00125 00127 bool unselect(GLC_uint); 00128 00130 void unselectAll(); 00131 00133 void setPolygonModeForAll(GLenum, GLenum); 00134 00136 void setVisibility(const GLC_uint, const bool); 00137 00139 void showAll(); 00140 00141 00143 00145 00147 00148 public: 00150 void glExecute(void); 00151 00153 void createMemberLists(void); 00154 00155 00157 00159 00161 00162 00163 private: 00165 void glDraw(void); 00166 00168 00170 // private services functions 00172 private: 00173 00175 bool createList(void); 00176 00178 // Private members 00180 00181 private: 00183 CNodeMap m_NodeMap; 00184 00186 GLuint m_ListID; 00187 00189 bool m_ListIsValid; 00190 00192 GLC_BoundingBox* m_pBoundingBox; 00193 00195 SelectedNodeHash m_SelectedNodes; 00196 00197 }; 00198 #endif //GLC_COLLECTION_H_
1.4.5