1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROGUI_SHAPE_H
24 #define HYDROGUI_SHAPE_H
26 #include <AIS_InteractiveContext.hxx>
27 #include <AIS_InteractiveObject.hxx>
28 #include <Aspect_ColorScale.hxx>
29 #include <TColgp_HArray1OfPnt.hxx>
30 #include <Quantity_HArray1OfColor.hxx>
32 #include <HYDROData_Entity.h>
37 #include <TopoDS_Face.hxx>
38 #include <TopoDS_Wire.hxx>
39 #include <TopoDS_Compound.hxx>
44 HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
45 const Handle(HYDROData_Entity)& theObject,
46 const int theZLayer = -1 );
50 virtual void display( const bool theIsUpdateViewer = true );
51 virtual void erase( const bool theIsUpdateViewer = true );
53 virtual void highlight( bool theIsHighlight, bool isUpdateViewer );
54 virtual bool isHighlighted() const;
56 Handle(HYDROData_Entity) getObject() const { return myObject; }
58 virtual void update( const bool theIsUpdateViewer = true );
60 virtual bool getIsToUpdate() const { return myIsToUpdate; }
61 virtual void setIsToUpdate( bool theState ) { myIsToUpdate = theState; }
63 virtual bool isVisible() const { return myIsVisible; }
64 virtual void setVisible( const bool theState,
65 const bool theIsUpdateViewer = true );
67 virtual void setWire( const TopoDS_Wire& theWire,
68 const bool theToDisplay = true,
69 const bool theIsUpdateViewer = true );
71 virtual void setFaces( const TopoDS_Compound& theWires,
72 const bool theToDisplay = true,
73 const bool theIsUpdateViewer = true );
75 virtual void setFace( const TopoDS_Wire& theWire,
76 const bool theToDisplay = true,
77 const bool theIsUpdateViewer = true );
79 virtual void setFace( const TopoDS_Face& theFace,
80 const bool theToDisplay = true,
81 const bool theIsUpdateViewer = true );
83 virtual void setShape( const TopoDS_Shape& theShape,
84 const bool theToDisplay = true,
85 const bool theIsUpdateViewer = true );
87 virtual void setFillingColor( const QColor& theColor,
88 const bool theToDisplay = true,
89 const bool theIsUpdateViewer = true );
90 virtual QColor getFillingColor() const;
92 virtual void setBorderColor( const QColor& theColor,
93 const bool theToDisplay = true,
94 const bool theIsUpdateViewer = true );
95 virtual QColor getBorderColor() const;
97 virtual void setHighlightColor( const QColor& theColor );
98 virtual QColor getHighlightColor() const;
100 virtual void setTextureFileName( const QString& theFileName,
101 const bool theToDisplay = true,
102 const bool theIsUpdateViewer = true );
103 virtual QString getTextureFileName() const;
105 virtual Handle(AIS_InteractiveObject) getAISObject() const { return myShape; }
107 void setZLayer( const int theZLayer );
109 void GetRange( double& theMin, double& theMax ) const;
110 void UpdateWithColorScale( const Handle(Aspect_ColorScale)& );
113 virtual void buildShape();
114 virtual void updateShape( const bool theToDisplay = true,
115 const bool theIsUpdateViewer = true );
116 void displayShape( const bool theIsUpdateViewer );
118 virtual QColor getActiveColor() const;
121 static double getQuantityColorVal( const int theColorVal );
122 void colorShapeBorder( const QColor& theColor );
124 static QString generateTextureFileName( const Handle(HYDROData_Entity)& theImageObj );
125 void removeTextureFile() const;
127 static QImage reduceTexture( const QImage& theImage, const int theSizeLimit );
130 Handle(AIS_InteractiveContext) myContext;
131 Handle(HYDROData_Entity) myObject;
132 Handle(AIS_InteractiveObject) myShape;
140 TopoDS_Shape myTopoShape;
143 QColor myFillingColor;
144 QColor myBorderColor;
145 QColor myHighlightColor;
147 QString myTextureFileName;
149 Handle_TColgp_HArray1OfPnt myCoords;
150 Handle_Quantity_HArray1OfColor myColors;