Salome HOME
refs #1463: errors in text labels on 2 bathymetries
[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
26 class HYDROData_Bathymetry;
27 class AIS_ColorScale;
28 class HYDROGUI_OCCDisplayer;
29 class OCCViewer_ViewWindow;
30
31 class HYDROGUI_ShapeBathymetry : public HYDROGUI_Shape
32 {
33 public:
34   HYDROGUI_ShapeBathymetry( HYDROGUI_OCCDisplayer* theDisplayer,
35                             const Handle(AIS_InteractiveContext)& theContext,
36                             const Handle(HYDROData_Bathymetry)&    theBathymetry,
37                             const int                             theZLayer = -1 );
38   virtual ~HYDROGUI_ShapeBathymetry();
39
40   void GetRange( double& theMin, double& theMax ) const;
41   void UpdateWithColorScale( const Handle(AIS_ColorScale)& );
42
43   // Re-scale by visible points
44   void RescaleByVisible( OCCViewer_ViewWindow* );
45   // Re-scale by selected points
46   void RescaleBySelection();
47   // Custom (user) re-scale 
48   void Rescale( double theMin, double theMax );
49   // Default re-scale (by all points)
50   void RescaleDefault();
51
52   void TextLabels( bool isOn, bool isUpdateCurrentViewer=true );
53
54   virtual void display( const bool theIsUpdateViewer = true );
55   virtual void erase( const bool theIsUpdateViewer = true );
56
57   virtual void               update( bool isUpdateViewer,
58                                      bool isDeactivateSelection );
59
60   virtual void               setVisible( const bool theState,
61                                          const bool theIsUpdateViewer = true );
62
63   void Build();
64
65 protected:
66   virtual QList<Handle(AIS_InteractiveObject)> createShape() const;
67   virtual void displayShape( const bool theIsUpdateViewer );
68
69   void setToUpdateColorScale( bool isChanged );
70   void Rescale( const QVector<int>& theIndices, bool isForcedAll );
71
72   QVector<int> selected() const;
73
74 private:
75   HYDROGUI_OCCDisplayer* myDisplayer;
76   Handle(TColgp_HArray1OfPnt)     myCoords;
77   Handle(Quantity_HArray1OfColor) myColors;
78
79   double myMin;
80   double myMax;
81   bool myRangeInitialized;
82 };
83
84 #endif