Salome HOME
trying to highlight selected points on bathymetry
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ShapeBathymetry.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROGUI_SHAPE_BATHYMETRY_H
20 #define HYDROGUI_SHAPE_BATHYMETRY_H
21
22 #include <HYDROGUI_Shape.h>
23 #include <TColgp_HArray1OfPnt.hxx>
24 #include <Quantity_HArray1OfColor.hxx>
25 #include <QVector>
26
27 class HYDROData_Bathymetry;
28 class AIS_ColorScale;
29 class HYDROGUI_OCCDisplayer;
30 class OCCViewer_ViewWindow;
31
32 class HYDROGUI_ShapeBathymetry : public HYDROGUI_Shape
33 {
34 public:
35   HYDROGUI_ShapeBathymetry( HYDROGUI_OCCDisplayer* theDisplayer,
36                             const Handle(AIS_InteractiveContext)& theContext,
37                             const Handle(HYDROData_Bathymetry)&    theBathymetry,
38                             const int                             theZLayer = -1 );
39   virtual ~HYDROGUI_ShapeBathymetry();
40
41   void GetRange( double& theMin, double& theMax ) const;
42   void UpdateWithColorScale( const Handle(AIS_ColorScale)& );
43
44   // Re-scale by visible points
45   void RescaleByVisible( OCCViewer_ViewWindow* );
46   // Re-scale by selected points
47   void RescaleBySelection();
48   // Custom (user) re-scale 
49   void Rescale( double theMin, double theMax );
50   // Default re-scale (by all points)
51   void RescaleDefault();
52
53   void TextLabels( bool isOn, bool isUpdateCurrentViewer=true );
54
55   virtual void display( const bool theIsUpdateViewer = true );
56   virtual void erase( const bool theIsUpdateViewer = true );
57
58   virtual void               update( bool isUpdateViewer,
59                                      bool isDeactivateSelection );
60
61   virtual void               setVisible( const bool theState,
62                                          const bool theIsUpdateViewer = true );
63
64   void Build();
65
66 protected:
67   virtual QList<Handle(AIS_InteractiveObject)> createShape() const;
68   virtual void displayShape( const bool theIsUpdateViewer );
69
70   void setToUpdateColorScale( bool isChanged );
71   void Rescale( const QVector<int>& theIndices, bool isForcedAll );
72
73   QVector<int> selected() const;
74
75 private:
76   HYDROGUI_OCCDisplayer* myDisplayer;
77   Handle(TColgp_HArray1OfPnt)     myCoords;
78   Handle(Quantity_HArray1OfColor) myColors;
79
80   double myMin;
81   double myMax;
82   bool myRangeInitialized;
83   QVector<int> mySelectedPoints;
84 };
85
86 #endif