Version: 9.15.0
SPV3D_ViewModel.h
Go to the documentation of this file.
1 // Copyright (C) 2023-2025 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 #pragma once
21 
22 #include "SPV3D.h"
23 #include "PV3DViewer_ViewModel.h"
24 
25 #include <SALOME_Prs.h>
27 #include <SALOME_ListIO.hxx>
28 
29 #include "SPV3D_Prs.h"
30 
31 
32 class QMouseEvent;
33 class pqPipelineSource;
34 class pqView;
35 
38 {
39  Q_OBJECT
40 public:
41  void setView(pqView *view) { _view = view; }
42  pqView *getView() const;
43  void render() const;
44 public:
46  static QString Type() { return "ParaView3D"; }
47 
49  virtual ~SPV3D_ViewModel();
50 
51  virtual void initialize();
52 
55 
57  virtual void setViewManager(SUIT_ViewManager* theViewManager);
58 
60  virtual void contextMenuPopup( QMenu* );
61 
63  virtual QString getType() const { return Type(); }
64 
65 public:
66  void enableSelection(bool isEnabled);
67  bool isSelectionEnabled() const { return mySelectionEnabled; }
68  void updatePVPrsPipeline( const SPV3D_Prs* aPrs);
69  /* Reimplemented from SALOME_View */
70 
72  void Display( const SALOME_PV3DPrs* );
73 
75  void Erase( const SALOME_PV3DPrs*, const bool = false );
76 
78  void EraseAll( SALOME_Displayer*, const bool = false );
79 
81  virtual void GetVisible( SALOME_ListIO& );
82 
84  SALOME_Prs* CreatePrs( const char* entry = 0 );
85 
87  virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
88 
90  virtual void Repaint();
91 
92 protected slots:
93  void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
94  void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
95  void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
96 
97  void onViewCreated( SUIT_ViewWindow* );
98 
99  void onSourceCreated(pqPipelineSource* source);
100  void showSelectedMode();
101 
102 protected:
103  pqPipelineSource* GeometrySource = nullptr;
104  pqPipelineSource* MeshSource = nullptr;
105 
106 private:
108  pqView *_view = nullptr;
109 };
Handle(TDocStd_Application) CAF_Application
Get OCAF application.
Definition: CAF_Application.cxx:97
#define SPV3D_EXPORT
Definition: SPV3D.h:33
Definition: PV3DViewer_ViewModel.h:32
virtual SUIT_ViewWindow * createView(SUIT_Desktop *)
Definition: PV3DViewer_ViewModel.cxx:35
static QString Type()
Definition: PV3DViewer_ViewModel.h:41
Definition: SALOME_Prs.h:366
Definition: SALOME_ListIO.hxx:29
Definition: SALOME_Prs.h:204
Definition: SALOME_Prs.h:53
Definition: SALOME_Prs.h:292
virtual bool isVisible(const Handle(SALOME_InteractiveObject)&)
Definition: SALOME_Prs.h:356
virtual SALOME_Prs * CreatePrs(const char *=0)
Creates empty presentation of corresponding type.
Definition: SALOME_Prs.h:344
virtual void GetVisible(SALOME_ListIO &)
Definition: SALOME_Prs.h:358
void Erase(SALOME_Displayer *, const SALOME_Prs *, const bool=false)
This Erase() method should be called to erase given presentation created anywhere by anybody.
Definition: SALOME_Prs.cxx:340
void Display(SALOME_Displayer *, const SALOME_Prs *)
This Display() method should be called to display given presentation created anywhere by anybody.
Definition: SALOME_Prs.cxx:331
virtual void Repaint()
Null body here.
Definition: SALOME_Prs.h:357
virtual void EraseAll(SALOME_Displayer *, const bool=false)
This EraseAll() method should be called to erase all presentations created anywhere by anybody.
Definition: SALOME_Prs.cxx:431
Definition: SPV3D_Prs.h:71
Extends two interfaces #SPV3D_ViewModelBase and SALOME_View.
Definition: SPV3D_ViewModel.h:38
bool mySelectionEnabled
Definition: SPV3D_ViewModel.h:107
virtual QString getType() const
See SUIT_ViewModel::getType.
Definition: SPV3D_ViewModel.h:63
static QString Type()
Define string representation of the viewer type.
Definition: SPV3D_ViewModel.h:46
bool isSelectionEnabled() const
Definition: SPV3D_ViewModel.h:67
void setView(pqView *view)
Definition: SPV3D_ViewModel.h:41
Definition: SUIT_Desktop.h:47
Definition: SUIT_ViewManager.h:50
virtual void contextMenuPopup(QMenu *)
Definition: SUIT_ViewModel.h:69
virtual void setViewManager(SUIT_ViewManager *theViewManager)
Definition: SUIT_ViewModel.cxx:85
Definition: SUIT_ViewWindow.h:42