Salome HOME
Merge branch 'V9_9_BR'
[modules/smesh.git] / src / OBJECT / SMESH_PreviewActorsCollection.h
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  SMESH OBJECT : interactive object for SMESH visualization
21 //  File   : SMESH_PreviewActorsCollection.h
22 //  Module : SMESH
23 //
24 #ifndef SMESH_PREVIEW_ACTOR_COLLECTION_H
25 #define SMESH_PREVIEW_ACTOR_COLLECTION_H
26
27 #include "SMESH_Object.h"
28
29 #include <TopoDS_Shape.hxx>
30 #include <TopAbs_ShapeEnum.hxx>
31 #include <TopTools_IndexedMapOfShape.hxx>
32 #include <QList>
33 #include <QMap>
34 #include <QString>
35
36 class vtkRenderer;
37 class GEOM_Actor;
38 class SVTK_Selector;
39
40 class SMESHOBJECT_EXPORT SMESH_PreviewActorsCollection
41 {
42 public:
43   SMESH_PreviewActorsCollection();
44   virtual ~SMESH_PreviewActorsCollection();
45
46   virtual void    AddToRender     (vtkRenderer* theRenderer);
47   virtual void    RemoveFromRender(vtkRenderer* theRenderer);
48
49   bool            Init( const TopoDS_Shape& theShape,
50                         const TopoDS_Shape& theMainShape,
51                         TopAbs_ShapeEnum    subShapeType = TopAbs_EDGE,
52                         const QString& = QString("") );
53
54   void            SetSelector( SVTK_Selector* );
55
56   void            HighlightAll( bool );
57   void            HighlightID( int );
58
59   GEOM_Actor*     GetActorByIndex( int );
60   bool            IsValidIndex( int );
61
62   int             GetIndexByShape( const TopoDS_Shape& );
63   TopoDS_Shape    GetShapeByIndex( int i );
64   int             NbShapesOfType( TopAbs_ShapeEnum type );
65
66   void            SetIndices( const QList<int>& indices);
67   const QList<int>& GetIndices() const { return myIndices; }
68
69   void            SetShown( bool );
70
71   int             count() const;
72   int             chunkSize() const;
73   int             currentChunk() const;
74   bool            hasPrevious() const;
75   bool            hasNext() const;
76   void            previous();
77   void            next();
78   
79 protected:
80   GEOM_Actor*    createActor( const TopoDS_Shape& );
81   void           showCurrentChunk();
82   void           clearActors();
83    
84 protected:
85   TopAbs_ShapeEnum             myType;
86   QString                      myEntry;
87   TopoDS_Shape                 myMainShape;
88   SVTK_Selector*               mySelector;
89   vtkRenderer*                 myRenderer;
90   TopTools_IndexedMapOfShape   myMapOfShapes;
91   QMap<int, GEOM_Actor*>       myMapOfActors;
92   QList<int>                   myIndices;
93   int                          myCurrentChunk;
94   int                          myChunkSize;
95   bool                         myIsShown;
96 };
97
98
99 #endif //SMESH_DEVICE_ACTOR_COLLECTION_H