TEveSelection.h

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveSelection.h 32464 2010-03-04 15:45:13Z matevz $
00002 // Author: Matevz Tadel 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TEveSelection
00013 #define ROOT_TEveSelection
00014 
00015 #include "TEveElement.h"
00016 
00017 #include "TQObject.h"
00018 
00019 #include <map>
00020 
00021 class TEveSelection : public TEveElementList,
00022                       public TQObject
00023 {
00024 public:
00025    enum EPickToSelect  // How to convert picking events to top selected element:
00026    {
00027       kPS_Ignore,        // ignore picking
00028       kPS_Element,       // select element (default for selection)
00029       kPS_Projectable,   // select projectable
00030       kPS_Compound,      // select compound
00031       kPS_PableCompound, // select projectable and compound
00032       kPS_Master         // select master element (top-level compound)
00033    };
00034 
00035 private:
00036    TEveSelection(const TEveSelection&);            // Not implemented
00037    TEveSelection& operator=(const TEveSelection&); // Not implemented
00038 
00039 protected:
00040    typedef std::map<TEveElement*, Set_t>           SelMap_t;
00041    typedef std::map<TEveElement*, Set_t>::iterator SelMap_i;
00042 
00043    Int_t            fPickToSelect;
00044    Bool_t           fActive;
00045    Bool_t           fIsMaster;
00046 
00047    SelMap_t         fImpliedSelected;
00048 
00049    Select_foo       fSelElement;
00050    ImplySelect_foo  fIncImpSelElement;
00051    ImplySelect_foo  fDecImpSelElement;
00052 
00053    void DoElementSelect  (SelMap_i entry);
00054    void DoElementUnselect(SelMap_i entry);
00055 
00056    void RecheckImpliedSet(SelMap_i smi);
00057 
00058 public:
00059    TEveSelection(const char* n="TEveSelection", const char* t="");
00060    virtual ~TEveSelection() {}
00061 
00062    void SetHighlightMode();
00063 
00064    Int_t  GetPickToSelect()   const { return fPickToSelect; }
00065    void   SetPickToSelect(Int_t ps) { fPickToSelect = ps; }
00066 
00067    Bool_t GetIsMaster()       const { return fIsMaster; }
00068    void   SetIsMaster(Bool_t m)     { fIsMaster = m; }
00069 
00070    virtual Bool_t AcceptElement(TEveElement* el);
00071 
00072    virtual void AddElement(TEveElement* el);
00073    virtual void RemoveElement(TEveElement* el);
00074    virtual void RemoveElementLocal(TEveElement* el);
00075    virtual void RemoveElements();
00076    virtual void RemoveElementsLocal();
00077 
00078    virtual void RemoveImpliedSelected(TEveElement* el);
00079 
00080    void RecheckImpliedSetForElement(TEveElement* el);
00081 
00082    void SelectionAdded(TEveElement* el);    // *SIGNAL*
00083    void SelectionRemoved(TEveElement* el);  // *SIGNAL*
00084    void SelectionCleared();                 // *SIGNAL*
00085    void SelectionRepeated(TEveElement* el); // *SIGNAL*
00086 
00087    // ----------------------------------------------------------------
00088    // Interface to make selection active/non-active.
00089 
00090    virtual void ActivateSelection();
00091    virtual void DeactivateSelection();
00092 
00093    // ----------------------------------------------------------------
00094    // User input processing.
00095 
00096    TEveElement* MapPickedToSelected(TEveElement* el);
00097 
00098    virtual void UserPickedElement(TEveElement* el, Bool_t multi=kFALSE);
00099    virtual void UserRePickedElement(TEveElement* el);
00100    virtual void UserUnPickedElement(TEveElement* el);
00101 
00102    // ----------------------------------------------------------------
00103 
00104    ClassDef(TEveSelection, 0); // Container for selected and highlighted elements.
00105 };
00106 
00107 #endif

Generated on Tue Jul 5 14:15:00 2011 for ROOT_528-00b_version by  doxygen 1.5.1