--- trunk/src/selection/SelectionManager.hpp 2005/02/01 06:55:00 277 +++ trunk/src/selection/SelectionManager.hpp 2005/02/04 22:39:26 288 @@ -42,6 +42,8 @@ #ifndef SELECTION_SELECTIONMANAGER_HPP #define SELECTION_SELECTIONMANAGER_HPP +#include "utils/BitSet.hpp" +#include "primitives/StuntDouble.hpp" namespace oopse { /** @@ -49,7 +51,65 @@ class SelectionManager { * @brief */ class SelectionManager { + public: + SelectionManager(int size) {bsSelection_.resize(size);} + void addSelection(StuntDouble* sd) { + bsSelection_.setBitOn(sd->getGlobalIndex()); + } + + void addSelectionSet(const BitSet& bs) { + bsSelection_ |= bs; + } + + void setSelection(StuntDouble* sd) { + bsSelection_.clearAll(); + bsSelection_.setBitOn(sd->getGlobalIndex()); + } + + void setSelectionSet(const BitSet& bs) { + bsSelection_ = bs; + } + + void toggleSelection(StuntDouble* sd) { + bsSelection_.flip(sd->getGlobalIndex()); + } + + void toggleSelection() { + bsSelection_.flip(); + } + + void selectAll() { + bsSelection_.setAll(); + } + + void clearSelection() { + bsSelection_.clearAll(); + } + + void clearSelection(StuntDouble* sd) { + bsSelection_.setBitOff(sd->getGlobalIndex()); + } + + bool isSelected(StuntDouble* sd) { + return bsSelection_[sd->getGlobalIndex()]; + } + + bool isEmpty() { + return bsSelection_.none(); + } + + int getSelectionCount() { + return bsSelection_.countBits(); + } + + BitSet getSelectionSet() { + return bsSelection_; + } + + private: + + BitSet bsSelection_; }; }