Salome HOME
32cfa6571a8baa79c4a5c7b316edff7480995ddd
[modules/hexablock.git] / src / HEXABLOCKGUI / HEXABLOCKGUI_OccGraphicView.hxx
1 // Copyright (C) 2009-2023  CEA, EDF
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
21
22 #ifndef _HEXABLOCKGUI_OCCGRAPHICVIEW_HXX_
23 #define _HEXABLOCKGUI_OCCGRAPHICVIEW_HXX_
24
25 #include "HEXABLOCKGUI_Export.hxx"
26
27 #include <OCCViewer_ViewWindow.h>
28 #include "HEXABLOCKGUI_SalomeTools.hxx"
29
30 #include <AIS_Shape.hxx>
31 #include <SelectMgr_IndexedMapOfOwner.hxx>
32 #include <SOCC_Prs.h>
33
34 #include <QModelIndex>
35 #include <QModelIndexList>
36
37 namespace HEXABLOCK
38 {
39
40     namespace GUI
41     {
42
43         /********************************************************************************
44          *                          OccGraphicView
45          ********************************************************************************/
46
47         class HEXABLOCK_EXPORT OccGraphicView
48         {
49
50          public:
51             OccGraphicView(OCCViewer_ViewWindow* view, QWidget* parent=NULL);
52             virtual ~OccGraphicView(){};
53
54             void highlight( const QModelIndex & index, bool only=true );
55             void highlight( const QModelIndexList & indexList, bool only=true );
56
57             // * 'only' parameter precise if we want to clear the current highlighted shapes/subshapes first
58             void highlightSubShapes(const Handle(AIS_Shape)& anObj,
59                                     const TColStd_IndexedMapOfInteger& aIndexMap, bool only=true);
60             void highlight( const QMultiMap<QString, int>&  entrySubIDs, bool only=true );
61
62             void setViewWindow(OCCViewer_ViewWindow* view) { viewWindow = view; }
63             OCCViewer_ViewWindow* getViewWindow() const { return viewWindow; }
64
65             void setSelectionMode(TopAbs_ShapeEnum mode);
66             void setSelectionMode(const QModelIndex& eltIndex);
67             TopAbs_ShapeEnum getSelectionMode() const { return selectionMode; }
68             void getSelected(SALOME_ListIO& selectedObjects);
69             void clearSelection();
70             void localSelection(const int theMode);
71             void globalSelection(const bool update = false );
72
73             void addShape(QString& entry, const Handle(AIS_Shape)& ais_shape);
74             Handle(AIS_Shape) getShape(const QString& entry);
75             Handle(AIS_InteractiveContext) getContext();
76             SOCC_Prs* getPrs() const { return prs; }
77             void setPrs(SOCC_Prs* occPrs) { prs = occPrs; }
78             void addVertexToCloud(TopoDS_Vertex& vertex);
79             void displayPreview(TopoDS_Shape& shape);
80             Handle(AIS_Shape) getPreviewShape();
81
82
83          private:
84             OCCViewer_ViewWindow*  viewWindow;
85             SOCC_Prs* prs;
86             Handle(AIS_Shape) previewShape;
87             TopAbs_ShapeEnum selectionMode;
88             QMap<QString, Handle(AIS_Shape)> shapes;
89         };
90     }
91 }
92
93
94 #endif