Salome HOME
bug #243: GUI for groups
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Shape.h
index 3adfec17df49b01a888de7a93587132c78d68461..a1af4dbb7390e8041fe874daa7c01864d6f95ff4 100644 (file)
 #include <AIS_InteractiveContext.hxx>
 #include <AIS_Shape.hxx>
 
+#include <HYDROData_Entity.h>
+
 #include <QColor>
-#include <QPainterPath>
+#include <QImage>
 
-class BRepBuilderAPI_MakeFace;
-class BRepBuilderAPI_MakeWire;
-class gp_Pnt;
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopoDS_Compound.hxx>
 
 class HYDROGUI_Shape
 {
 public:
-  HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext );
+  HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
+                  const Handle(HYDROData_Entity)&       theObject );
   ~HYDROGUI_Shape();
 
 public:
-  virtual void               display();
-  virtual void               erase();
+  virtual void               display( const bool theIsUpdateViewer = true );
+  virtual void               erase( const bool theIsUpdateViewer = true );
 
-  virtual void               highlight( bool theIsHighlight );
+  virtual void               highlight( bool theIsHighlight, bool isUpdateViewer );
   virtual bool               isHighlighted() const;
 
-  virtual void               setPath( const QPainterPath& thePath,
-                                      const bool          theToDisplay = true );
-  virtual QPainterPath       getPath() const;
+  Handle(HYDROData_Entity)   getObject() const { return myObject; }
+
+  virtual void               update( const bool theIsUpdateViewer = true );
+
+  virtual bool               getIsToUpdate() const { return myIsToUpdate; }
+  virtual void               setIsToUpdate( bool theState ) { myIsToUpdate = theState; }
+
+  virtual bool               isVisible() const { return myIsVisible; }
+  virtual void               setVisible( const bool theState,
+                                         const bool theIsUpdateViewer = true );
+
+  virtual void               setWire( const TopoDS_Wire& theWire,
+                                      const bool         theToDisplay = true,
+                                      const bool         theIsUpdateViewer = true );
+
+  virtual void               setFaces( const TopoDS_Compound& theWires,
+                                       const bool             theToDisplay = true,
+                                       const bool             theIsUpdateViewer = true );
 
-  virtual void               setZIndex( const double theZIndex,
-                                        const bool   theToDisplay = true );
-  virtual double             getZIndex() const;
+  virtual void               setFace( const TopoDS_Wire& theWire,
+                                      const bool         theToDisplay = true,
+                                      const bool         theIsUpdateViewer = true );
+
+  virtual void               setFace( const TopoDS_Face& theFace,
+                                      const bool         theToDisplay = true,
+                                      const bool         theIsUpdateViewer = true );
+
+  virtual void               setShape( const TopoDS_Shape& theShape,
+                                       const bool          theToDisplay = true,
+                                       const bool          theIsUpdateViewer = true );
 
   virtual void               setFillingColor( const QColor& theColor,
-                                              const bool    theToDisplay = true );
+                                              const bool    theToDisplay = true,
+                                              const bool    theIsUpdateViewer = true );
   virtual QColor             getFillingColor() const;
 
   virtual void               setBorderColor( const QColor& theColor,
-                                             const bool    theToDisplay = true );
+                                             const bool    theToDisplay = true,
+                                             const bool    theIsUpdateViewer = true );
   virtual QColor             getBorderColor() const;
 
   virtual void               setHighlightColor( const QColor& theColor );
   virtual QColor             getHighlightColor() const;
 
+  virtual void               setTextureFileName( const QString& theFileName,
+                                                 const bool     theToDisplay = true,
+                                                 const bool     theIsUpdateViewer = true );
+  virtual QString            getTextureFileName() const;
+
 protected:
   virtual void               buildShape();
-  virtual void               updateShape( const bool theIsForce = true );
+  virtual void               updateShape( const bool theToDisplay      = true,
+                                          const bool theIsUpdateViewer = true );
   virtual QColor             getActiveColor() const;
 
 private:
   static double              getQuantityColorVal( const int theColorVal );
   void                       colorShapeBorder( const QColor& theColor );
 
-  void                       makeEdge( BRepBuilderAPI_MakeWire& theWireBuilder,
-                                       gp_Pnt&                  theFirstPoint,
-                                       gp_Pnt&                  theLastPoint ) const;
+  static QString             generateTextureFileName( const Handle(HYDROData_Entity)& theImageObj );
+  void                       removeTextureFile() const;
 
-  void                       makeWire( BRepBuilderAPI_MakeFace& theFaceBuilder,
-                                       BRepBuilderAPI_MakeWire& theWireBuilder,
-                                       bool&                    theIsComposed ) const;
+  static QImage              reduceTexture( const QImage& theImage, const int theSizeLimit );
 
 private:
   Handle(AIS_InteractiveContext) myContext;
+  Handle(HYDROData_Entity)       myObject;
   Handle(AIS_Shape)              myShape;
 
+  bool                           myIsToUpdate;
+  bool                           myIsVisible;
+
   bool                           myIsHighlight;
-  QPainterPath                   myPath;
+  TopoDS_Shape                   myTopoShape;
+  int                            myDisplayMode;
   
-  double                         myZIndex;
   QColor                         myFillingColor;
   QColor                         myBorderColor;
   QColor                         myHighlightColor;
+
+  QString                        myTextureFileName;
 };
 
 #endif