X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSVTK%2FSVTK_SelectorDef.h;h=9093b3b3dc2d32c4f1890230dd78884239e12f0c;hb=c4b058d18583af7f94042eb55d4b933dd222d2e6;hp=ec7ae91aa6beaa6446731d8a595c22c210356320;hpb=591583f233aa5b5323fb531415247f2bdce8a966;p=modules%2Fgui.git diff --git a/src/SVTK/SVTK_SelectorDef.h b/src/SVTK/SVTK_SelectorDef.h index ec7ae91aa..9093b3b3d 100644 --- a/src/SVTK/SVTK_SelectorDef.h +++ b/src/SVTK/SVTK_SelectorDef.h @@ -1,37 +1,40 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// SALOME SALOMEGUI : implementation of desktop and GUI kernel // File : SALOME_Selection.h // Author : Nicolas REJNERI -// Module : SALOME -// $Header$ #ifndef SVTK_SELECTORDEF_H #define SVTK_SELECTORDEF_H -#include -#include +#include +#include + +#include #include +#include + +#include "SALOME_InteractiveObject.hxx" #include "SVTK_Selector.h" @@ -39,6 +42,8 @@ class SALOME_Actor; class SVTK_Viewer; class SVTK_ViewWindow; +class vtkPicker; +class vtkCellPicker; class SVTK_SelectorDef: public SVTK_Selector { @@ -48,7 +53,7 @@ public: virtual void - SetSelectionMode( Selection_Mode theMode ); + SetSelectionMode(Selection_Mode theMode); virtual Selection_Mode @@ -101,43 +106,148 @@ public: virtual void GetIndex( const Handle(SALOME_InteractiveObject)& theIO, - TColStd_IndexedMapOfInteger& theIndex ); - + TColStd_IndexedMapOfInteger& theIndex ); + virtual bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_IndexedMapOfInteger& theIndices, - bool theIsModeShift); + const TColStd_IndexedMapOfInteger& theIndices, + bool theIsModeShift); virtual bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_MapOfInteger& theIndices, - bool theIsModeShift); + const TColStd_MapOfInteger& theIndices, + bool theIsModeShift); virtual bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - int theIndex, - bool theIsModeShift); + int theIndex, + bool theIsModeShift); virtual void RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - int theIndex); + int theIndex); virtual bool IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, - int theIndex) const; + int theIndex) const; virtual void ClearIndex(); + //---------------------------------------------------------------------------- + virtual + void + SetFilter(const Handle(VTKViewer_Filter)& theFilter); + + virtual + Handle(VTKViewer_Filter) + GetFilter(const TFilterID theId) const; + + virtual + bool + IsFilterPresent(const TFilterID theId) const; + + virtual + void + RemoveFilter(const int theId); + + virtual + bool + IsValid(SALOME_Actor* theActor, + const TFilterID theId, + const bool theIsNode = false) const; + + //---------------------------------------------------------------------------- + virtual + void + StartPickCallback(); + + virtual + void + EndPickCallback(); + + //---------------------------------------------------------------------------- + virtual + vtkActorCollection* + Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const; + + virtual + void + SetTolerance(const double& theTolerance); + + virtual + void + SetDynamicPreSelection( bool theIsDynPreselect ); + + virtual + bool + GetDynamicPreSelection() const; + + virtual + void + SetPreSelectionEnabled( bool theEnabled ); + + virtual + bool + IsPreSelectionEnabled() const; + + virtual + void + SetSelectionEnabled( bool theEnabled ); + + virtual + bool + IsSelectionEnabled() const; + private: - typedef NCollection_DataMap > TIO2Actors; + int mySelectionMode; + + bool myDynamicPreselection; + bool myPreselectionEnabled; + bool mySelectionEnabled; + + struct TIOLessThan + { + bool + operator()(const Handle(SALOME_InteractiveObject)& theRightIO, + const Handle(SALOME_InteractiveObject)& theLeftIO) const + { + return strcmp(theRightIO->getEntry(),theLeftIO->getEntry()) < 0; + } + }; + + struct TIndexedMapOfInteger + { + TColStd_IndexedMapOfInteger myMap; + TIndexedMapOfInteger() + {} + TIndexedMapOfInteger(const TIndexedMapOfInteger& theIndexedMapOfInteger) + { + myMap = theIndexedMapOfInteger.myMap; + } + }; + + mutable SALOME_ListIO myIObjectList; + typedef std::set TIObjects; + TIObjects myIObjects; + + typedef std::map, + TIOLessThan> TIO2Actors; TIO2Actors myIO2Actors; - Selection_Mode mySelectionMode; - SALOME_ListIO myIObjects; - SALOME_DataMapOfIOMapOfInteger myMapIOSubIndex; -}; + typedef std::map TMapIOSubIndex; + TMapIOSubIndex myMapIOSubIndex; + + typedef std::map TFilters; + TFilters myFilters; + + vtkSmartPointer myPicker; + vtkSmartPointer myCellPicker; +}; #endif