Salome HOME
Merge branch V7_3_1_BR
[modules/smesh.git] / src / OBJECT / SMESH_PreviewActorsCollection.h
1 // Copyright (C) 2007-2014  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 //  Author : OCN
23 //  Module : SMESH
24 //  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/OBJECT/SMESH_PreviewActorsCollection.h,v 1
25 //
26 #ifndef SMESH_PREVIEW_ACTOR_COLLECTION_H
27 #define SMESH_PREVIEW_ACTOR_COLLECTION_H
28
29 #include "SMESH_Object.h"
30
31 #include <TopoDS_Shape.hxx>
32 #include <TopAbs_ShapeEnum.hxx>
33 #include <TopTools_IndexedMapOfShape.hxx>
34 #include <QList>
35 #include <QMap>
36 #include <QString>
37
38 class vtkRenderer;
39 class GEOM_Actor;
40 class SVTK_Selector;
41
42 class SMESHOBJECT_EXPORT SMESH_PreviewActorsCollection
43 {
44 public:
45   SMESH_PreviewActorsCollection();
46   ~SMESH_PreviewActorsCollection();
47
48   virtual void    AddToRender(vtkRenderer* theRenderer);
49   virtual void    RemoveFromRender(vtkRenderer* theRenderer);
50
51   bool            Init( const TopoDS_Shape& theShape, TopAbs_ShapeEnum subShapeType = TopAbs_EDGE, const QString& = QString("") );
52
53   void            SetSelector( SVTK_Selector* );
54
55   void            HighlightAll( bool );
56   void            HighlightID( int );
57
58   GEOM_Actor*     GetActorByIndex( int );
59
60   int             GetIndexByShape( const TopoDS_Shape& );
61
62   void            SetShown( bool );
63
64   int             count() const;
65   int             chunkSize() const;
66   int             currentChunk() const;
67   bool            hasPrevious() const;
68   bool            hasNext() const;
69   void            previous();
70   void            next();
71   
72 protected:
73   GEOM_Actor*    createActor( const TopoDS_Shape& );
74   void           showCurrentChunk();
75   void           clearActors();
76    
77 protected:
78   TopAbs_ShapeEnum             myType;
79   QString                      myEntry;
80   TopoDS_Shape                 myMainShape;
81   SVTK_Selector*               mySelector;
82   vtkRenderer*                 myRenderer;
83   TopTools_IndexedMapOfShape   myMapOfShapes;
84   QMap<int, GEOM_Actor*>       myMapOfActors;
85   QList<int>                   myIndices;
86   int                          myCurrentChunk;
87   int                          myChunkSize;
88   bool                         myIsShown;
89 };
90
91
92 #endif //SMESH_DEVICE_ACTOR_COLLECTION_H