glc_selectionset.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  *****************************************************************************/
00023 
00024 #ifndef GLC_SELECTIONSET_H_
00025 #define GLC_SELECTIONSET_H_
00026 
00027 #include <QHash>
00028 #include <QList>
00029 #include <QSet>
00030 
00031 #include "glc_structoccurence.h"
00032 #include "../glc_global.h"
00033 
00034 #include "../glc_config.h"
00035 
00036 class GLC_WorldHandle;
00037 
00040 
00041 
00042 class GLC_LIB_EXPORT GLC_SelectionSet
00043 {
00045 
00047 
00048 
00049 public:
00051         GLC_SelectionSet(GLC_WorldHandle* pWorld);
00052         virtual ~GLC_SelectionSet();
00053 
00055 
00057 
00059 
00060 public:
00061 
00063         bool isEmpty() const;
00064 
00066         inline int size() const
00067         {return count();}
00068 
00070         int count() const;
00071 
00073         QList<GLC_StructOccurence*> occurencesList() const;
00074 
00076         QList<GLC_StructOccurence*> occurencesListWithSelectedPrimitive() const;
00077 
00079         QSet<GLC_uint> selectedPrimitivesId(GLC_uint instanceId) const;
00080 
00082         bool hasPrimitiveSelected(GLC_uint instanceId) const;
00083 
00085         bool contains(const GLC_StructOccurence* pOccurence) const
00086         {return contains(pOccurence->id());}
00087 
00089         bool contains(GLC_uint occurenceId) const
00090         {return m_OccurenceHash.contains(occurenceId);}
00091 
00093 
00094 
00096 
00097 public:
00099 
00100         bool insert(GLC_StructOccurence* pOccurence);
00101 
00103 
00104         bool insert(GLC_uint occurenceId);
00105 
00107 
00108         bool remove(GLC_StructOccurence* pOccurence);
00109 
00111 
00112         bool remove(GLC_uint occurenceId);
00113 
00115         void clear();
00116 
00118 
00119         bool insertPrimitiveId(GLC_StructOccurence* pOccurence, GLC_uint primitiveId);
00120 
00122 
00123         bool insertPrimitiveId(GLC_uint occurenceId, GLC_uint primitiveId);
00124 
00126 
00127         void insertSetOfPrimitivesId(GLC_StructOccurence* pOccurence, const QSet<GLC_uint>& setOfPrimitivesId);
00128 
00130 
00131         void insertSetOfPrimitivesId(GLC_uint occurenceId, const QSet<GLC_uint>& setOfPrimitivesId);
00132 
00134 
00138         bool removePrimitiveId(GLC_StructOccurence* pOccurence, GLC_uint primitiveId);
00139 
00141 
00145         bool removePrimitiveId(GLC_uint occurenceId, GLC_uint primitiveId);
00146 
00147 
00149 
00151 // Private members
00153 private:
00155         GLC_WorldHandle* m_pWorldHandle;
00156 
00158         QHash<GLC_uint, GLC_StructOccurence*> m_OccurenceHash;
00159 
00161         QHash<GLC_uint, QSet<GLC_uint> > m_InstanceToPrimitiveId;
00162 
00163 };
00164 
00165 #endif /* GLC_SELECTIONSET_H_ */

SourceForge.net Logo

©2005-2011 Laurent Ribon