Salome HOME
Updated copyright comment
[modules/gui.git] / src / SPV3D / SPV3D_ViewWindow.h
1 // Copyright (C) 2023-2024  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 #ifdef WIN32
23 #pragma warning( disable:4251 )
24 #endif
25
26 #include "SPV3D.h"
27 #include "Qtx.h"
28 #include "PV3DViewer_ViewWindow.h"
29 #include "SPV3D_Prs.h"
30
31 #include "SALOME_InteractiveObject.hxx"
32 #include "SALOME_ListIO.hxx"
33
34 #include <list>
35 #include <memory>
36
37 class SPV3D_ViewModel;
38 class SPV3D_CADSelection;
39
40 //! Define a container for SALOME PV3D view window
41 class SPV3D_EXPORT SPV3D_ViewWindow : public PV3DViewer_ViewWindow 
42 {
43   Q_OBJECT
44
45  public:
46   //! To construct #SPV3D_ViewWindow instance
47   SPV3D_ViewWindow(SUIT_Desktop* theDesktop, SPV3D_ViewModel* theModel);
48
49   SPV3D_Prs *findOrCreatePrs( const char* entry );
50
51   SPV3D_EXPORTSPV3DData *isEntryAlreadyExist( const char* entry ) const;
52
53   void init();
54
55   virtual ~SPV3D_ViewWindow();
56   
57   bool isVisible(const Handle(SALOME_InteractiveObject)& theIObject);
58
59   /* display */         
60   //----------------------------------------------------------------------------
61   //! Redirect the request to #SPV3D_View::Display (to support old code)
62   virtual void Display(const Handle(SALOME_InteractiveObject)& theIObject,
63                        bool theImmediatly = true);
64
65   //! Redirect the request to #SPV3D_View::DisplayOnly (to support old code)
66   virtual void DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject);
67
68   //! Redirect the request to #SPV3D_View::Erase (to support old code)
69   virtual void Erase(const Handle(SALOME_InteractiveObject)& theIObject,
70                      bool theImmediatly = true);
71
72   //! Redirect the request to #SPV3D_View::DisplayAll (to support old code)
73   virtual void DisplayAll();
74
75   //! Redirect the request to #SPV3D_View::EraseAll (to support old code)
76   virtual void EraseAll();
77
78   //! To repaint the viewer
79   virtual void Repaint(bool theUpdateTrihedron = true);
80
81   //! Enable/disable selection
82   virtual void SetSelectionEnabled( bool );
83
84  signals:
85   void Show( QShowEvent * );
86   void Hide( QHideEvent * );
87
88 public slots:
89   virtual void showEvent( QShowEvent * );
90   virtual void hideEvent( QHideEvent * );
91   void showCenterAxes(bool);
92   void pickCenterOfRotation(int posx, int posy);
93   void goSelect(bool val);
94
95 protected slots:
96   void onKeyPressed(QKeyEvent* event);
97   void onKeyReleased(QKeyEvent* event);
98   void onMousePressed(QMouseEvent* event);
99   void onMouseDoubleClicked(QMouseEvent* event);
100   void onMouseReleased(QMouseEvent* event);
101   void onMouseMoving(QMouseEvent* event);
102
103 protected:
104   SPV3D_CADSelection *mySelection = nullptr;
105   int myToolBar = -1;
106   SPV3D_ViewModel* myModel;
107   std::list< std::pair<std::string, std::unique_ptr<SPV3D_EXPORTSPV3DData> > > myPrs;
108 };
109
110 #ifdef WIN32
111 #pragma warning( default:4251 )
112 #endif