Salome HOME
updated copyright message
[modules/geom.git] / src / OBJECT / GEOM_Actor.h
index 3ecdce2b6ce227d1528d457f482d03f033822c60..0daf5306870066eda387cdcb9100550db82660bd 100644 (file)
@@ -1,43 +1,43 @@
-//  GEOM OBJECT : interactive object for Geometry entities visualization
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  GEOM OBJECT : interactive object for Geometry entities visualization
 //  File   : GEOM_Actor.h
 //  Author : Christophe ATTANASIO
 //  Module : GEOM
-//  $Header$
-
+//
 #ifndef GEOM_ACTOR_H
 #define GEOM_ACTOR_H
 
 #include "GEOM_OBJECT_defs.hxx"
+#include "GEOM_SmartPtr.h"
 
-#include "SALOME_Actor.h"
+#include <SALOME_Actor.h>
 
 #include <TopoDS_Shape.hxx>
-
-#include "GEOM_SmartPtr.h"
 #include <vtkSmartPointer.h>
 
+class vtkCamera;
+
 class GEOM_VertexSource;
 typedef GEOM_SmartPtr<GEOM_VertexSource> PVertexSource;
 
@@ -50,8 +50,8 @@ typedef GEOM_SmartPtr<GEOM_WireframeFace> PWFaceSource;
 class GEOM_ShadingFace;
 typedef GEOM_SmartPtr<GEOM_ShadingFace> PSFaceSource;
 
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 class vtkRenderer;
+class vtkTextActor;
 
 class vtkAppendPolyData;
 typedef GEOM_SmartPtr<vtkAppendPolyData> PAppendFilter;
@@ -59,22 +59,20 @@ typedef GEOM_SmartPtr<vtkAppendPolyData> PAppendFilter;
 class GEOM_OBJECT_EXPORT GEOM_Actor: public SALOME_Actor
 {
 public:
-  vtkTypeMacro(GEOM_Actor,SALOME_Actor);
+  vtkTypeMacro(GEOM_Actor,SALOME_Actor)
   static GEOM_Actor* New();
 
   void SetShape(const TopoDS_Shape& theShape,
-                float theDeflection,
-                bool theIsRelative,
+                double theDeflection,
                 bool theIsVector = false);
 
-  void SetDeflection(float theDeflection, bool theIsRelative);
-  float GetDeflection() const{ return myDeflection;}
-  bool GetIsRelative() const{ return myIsRelative;}
+  void SetDeflection(double theDeflection);
+  double GetDeflection() const{ return myDeflection;}
 
   void AddToRender(vtkRenderer* theRenderer);
   void RemoveFromRender(vtkRenderer* theRenderer);
 
-  enum EDisplayMode{ eWireframe, eShading};
+  enum EDisplayMode{ eWireframe, eShading, eShadingWithEdges = eShading + 2 };
 
 /*   void SetDisplayMode(EDisplayMode theMode);  */
 /*   EDisplayMode GetDisplayMode() const { return myDisplayMode;}  */
@@ -88,7 +86,14 @@ public:
   void SetWireframeProperty(vtkProperty* Prop);
   void SetShadingProperty(vtkProperty* Prop);
 
-  void setDeflection(double adef);
+  vtkProperty* GetWireframeProperty();
+  vtkProperty* GetShadingProperty();
+  vtkProperty* GetIsolatedEdgeProperty();
+  vtkProperty* GetVertexProperty();
+  vtkProperty* GetStandaloneVertexProperty();
+  vtkProperty* GetSharedEdgeProperty();
+  vtkProperty* GetFaceEdgeProperty();
+
   virtual void setDisplayMode(int thenewmode);
 
   // Description:
@@ -102,8 +107,7 @@ public:
   void ReleaseGraphicsResources(vtkWindow *);
   const TopoDS_Shape& getTopo();
   void setInputShape(const TopoDS_Shape& ashape, double adef1,
-                    int imode, bool isVector = false);
-  double getDeflection();
+                     int imode, bool isVector = false);
   double isVector();
 
   // SubShape
@@ -117,14 +121,33 @@ public:
   void ShallowCopy(vtkProp *prop);
 
   // Opacity
-  void SetOpacity(vtkFloatingPointType opa);
-  vtkFloatingPointType GetOpacity();
-
-  // Color
-  void SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
-  void GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
-
-  virtual bool IsInfinite();
+  void SetOpacity(double opa);
+  double GetOpacity();
+
+  // Color (same to all sub-actors/display modes)
+  void SetColor(double r,  double g,  double b);
+  void GetColor(double& r, double& g, double& b);
+  // Color of points
+  void SetPointColor(double r, double g, double b);
+  // Color of standalone edges, wires, vectors
+  void SetIsolatedEdgeColor(double r, double g, double b);
+  // Color of shared edges
+  void SetSharedEdgeColor(double r, double g, double b);
+  // Color of free edges
+  void SetFreeEdgeColor(double r, double g, double b);
+  // Color of edges in shading+edges display mode
+  void SetEdgesInShadingColor(double r, double g, double b);
+  // Color of iso-lines
+  void SetIsosColor(double r, double g, double b);
+  // Color of labels
+  void SetLabelColor(double r, double g, double b);
+
+
+  // Material
+  void SetMaterial(std::vector<vtkProperty*> theProps);
+  vtkProperty* GetFrontMaterial();
+  vtkProperty* GetBackMaterial();
+  virtual bool IsInfinitive();
 
   // overloaded functions
   //! To map current selection to VTK representation
@@ -137,15 +160,15 @@ public:
   virtual
   bool
   PreHighlight(vtkInteractorStyle* theInteractorStyle,
-              SVTK_SelectionEvent* theSelectionEvent,
-              bool theIsHighlight);
+               SVTK_SelectionEvent* theSelectionEvent,
+               bool theIsHighlight);
 
   //! To process highlight (called from #SVTK_InteractorStyle)
   virtual
   bool
   Highlight(vtkInteractorStyle* theInteractorStyle,
-           SVTK_SelectionEvent* theSelectionEvent,
-           bool theIsHighlight);
+            SVTK_SelectionEvent* theSelectionEvent,
+            bool theIsHighlight);
 
   //! Visibility management
   virtual
@@ -162,33 +185,76 @@ public:
   virtual
   void
   GetNbIsos(int &theNbU,int &theNbV);
+  
+  virtual 
+  void SetIsosWidth(const int width);
 
-protected:
-  void SetShape(const TopoDS_Shape& theShape,
-                const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
-                bool theIsVector = false);
+  int GetIsosWidth() const;
+
+  virtual void SetWidth(const int width);
+
+  int GetWidth() const;
+  
+  //! Vector mode management
+  virtual
+  void
+  SetVectorMode(const bool theMode);
 
+  virtual
+  bool
+  GetVectorMode();
+
+  //! Vertices mode management
+  virtual
+  void
+  SetVerticesMode(const bool theMode);
+
+  virtual
+  bool
+  GetVerticesMode();
+
+  //! Name mode management
+  virtual
+  void
+  SetNameMode(const bool theMode);
+
+  virtual
+  bool
+  GetNameMode();
+
+  virtual 
+  void 
+  SetTransform(VTKViewer_Transform* theTransform);
+
+
+protected:
   void SetModified();
 
   void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
+  void SetShapeName();
 
   GEOM_Actor();
   ~GEOM_Actor();
 
 private:
   TopoDS_Shape myShape;
-  int myNbIsos[2];
+  bool isOnlyVertex;
 
-  float myDeflection;
-  bool myIsRelative;
+  double myDeflection;
   bool myIsForced;
 
   //  EDisplayMode myDisplayMode;
   bool myIsSelected;
+  bool myVectorMode;
+  bool myVerticesMode;
+  bool myNameMode;
 
   PDeviceActor myVertexActor;
   PVertexSource myVertexSource;
 
+  PDeviceActor myStandaloneVertexActor;
+  PVertexSource myStandaloneVertexSource;
+
   PDeviceActor myIsolatedEdgeActor;
   PEdgeSource myIsolatedEdgeSource;
 
@@ -205,17 +271,29 @@ private:
   PSFaceSource myShadingFaceSource;
 
   PDeviceActor myHighlightActor;
+
+  vtkTextActor* myTextActor;
+
   vtkSmartPointer<vtkProperty>  myHighlightProp;
   vtkSmartPointer<vtkProperty>  myPreHighlightProp;
   vtkSmartPointer<vtkProperty>  myShadingFaceProp;
+  vtkSmartPointer<vtkProperty>  myShadingBackFaceProp;
 
   PAppendFilter myAppendFilter;
-  PPolyDataMapper myPolyDataMapper;
+  PPolyGeomPainterDataMapper myPolyDataMapper;
 
   virtual void SetMapper(vtkMapper*);
 
   GEOM_Actor(const GEOM_Actor&);
   void operator=(const GEOM_Actor&);
+
+  double myEdgesInWireframeColor[3];
+  double myEdgesInShadingColor[3];
+  double myIsolatedEdgeColor[3];
+  double mySharedEdgeColor[3];
+  double myOneFaceEdgeColor[3];
 };
 
 #endif //GEOM_ACTOR_H
+
+