Salome HOME
refs #568: Land Cover: a draft of data model and implementation of dialog box and...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Shape.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_H
20 #define HYDROGUI_SHAPE_H
21
22 #include <HYDROData_Entity.h>
23
24 #include <AIS_InteractiveContext.hxx>
25 #include <TopoDS_Shape.hxx>
26
27 #include <QColor>
28
29 class TopoDS_Compound;
30 class TopoDS_Face;
31 class TopoDS_Wire;
32
33 class HYDROGUI_Shape
34 {
35 public:
36   HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
37                   const Handle(HYDROData_Entity)&       theObject,
38                   const int                             theZLayer = -1 );
39   virtual ~HYDROGUI_Shape();
40
41 public:
42   virtual void               display( const bool theIsUpdateViewer = true );
43   virtual void               erase( const bool theIsUpdateViewer = true );
44
45   virtual void               highlight( bool theIsHighlight, bool isUpdateViewer );
46   virtual bool               isHighlighted() const;
47
48   Handle(AIS_InteractiveContext) getContext() const;
49   Handle(HYDROData_Entity)   getObject() const;
50   TopoDS_Shape               getTopoShape() const;
51
52   virtual void               update( bool isUpdateViewer,
53                                      bool isDeactivateSelection );
54
55   virtual bool               getIsToUpdate() const;
56   virtual void               setIsToUpdate( bool theState );
57
58   virtual bool               isVisible() const;
59   virtual void               setVisible( const bool theState,
60                                          const bool theIsUpdateViewer = true );
61
62   virtual void               setWire( const TopoDS_Wire& theWire,
63                                       const bool         theToDisplay = true,
64                                       const bool         theIsUpdateViewer = true );
65
66   virtual void               setFaces( const TopoDS_Compound& theWires,
67                                        const bool             theToDisplay = true,
68                                        const bool             theIsUpdateViewer = true );
69
70   virtual void               setFace( const TopoDS_Wire& theWire,
71                                       const bool         theToDisplay,
72                                       const bool         theIsUpdateViewer,
73                                       const QString&     theTextureFileName );
74
75   virtual void               setFace( const TopoDS_Face& theFace,
76                                       const bool         theToDisplay,
77                                       const bool         theIsUpdateViewer,
78                                       const QString&     theTextureFileName );
79
80   virtual void               setShape( const TopoDS_Shape& theShape,
81                                        const bool          theToDisplay = true,
82                                        const bool          theIsUpdateViewer = true );
83
84   virtual void               setFillingColor( const QColor& theColor,
85                                               const bool    theToDisplay = true,
86                                               const bool    theIsUpdateViewer = true );
87   virtual QColor             getFillingColor() const;
88
89   virtual void               setBorderColor( const QColor& theColor,
90                                              const bool    theToDisplay = true,
91                                              const bool    theIsUpdateViewer = true );
92   virtual QColor             getBorderColor() const;
93
94   virtual void               setHighlightColor( const QColor& theColor );
95   virtual QColor             getHighlightColor() const;
96
97   virtual Handle(AIS_InteractiveObject)  getAISObject() const;
98
99   void                       setZLayer( const int theZLayer );
100
101 protected:
102   virtual void               buildShape();
103   virtual void               updateShape( const bool theToDisplay      = true,
104                                           const bool theIsUpdateViewer = true );
105   virtual void               displayShape( const bool theIsUpdateViewer );
106
107   virtual QColor             getActiveColor() const;
108   virtual Handle_AIS_InteractiveObject createShape() const;
109
110   void setDisplayMode( int theDisplayMode );
111
112 private:
113   static double              getQuantityColorVal( const int theColorVal );
114   void                       colorShapeBorder( const QColor& theColor );
115
116 private:
117   Handle(AIS_InteractiveContext) myContext;
118   Handle(HYDROData_Entity)       myObject;
119   Handle(AIS_InteractiveObject)  myShape;
120
121   int                            myZLayer;
122
123   bool                           myIsToUpdate;
124   bool                           myIsVisible;
125
126   bool                           myIsHighlight;
127   TopoDS_Shape                   myTopoShape;
128   int                            myDisplayMode;
129   
130   QColor                         myFillingColor;
131   QColor                         myBorderColor;
132   QColor                         myHighlightColor;
133 };
134
135 #endif
136