Salome HOME
INT PAL 0052660: Plot2D Viewer: Plot2d_Curve can't be selected
[modules/gui.git] / src / OCCViewer / OCCViewer_ClipPlane.h
index 8b5906f03a0986979d47d0a56c09b66b8835f657..fa9ed9a29356bd0bb3b0b47b9881bee72a2de310 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // 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.
+// 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
 #include <Graphic3d_ClipPlane.hxx>
 #include <vector>
 
-enum ClipPlaneMode { Absolute, Relative };
-
 /*!
-  \class OrientedPlane
-  \brief Parameters of clipping plane in relative mode
+  \class OCCViewer_ClipPlane
+         Definition of OCC viewer clipping plane.
 */
-class OCCVIEWER_EXPORT OrientedPlane {
+class OCCVIEWER_EXPORT OCCViewer_ClipPlane
+{
+public:
 
- public:
-  OrientedPlane();
-  OrientedPlane& operator =(const OrientedPlane& other);
+  enum PlaneMode
+  {
+    Absolute,
+    Relative
+  };
 
- public:
-  Standard_Integer Orientation;
-  Standard_Real Distance;
-  Standard_Real Rotation1;
-  Standard_Real Rotation2;  
-};
+  enum AbsoluteOrientationType
+  {
+    AbsoluteCustom,
+    AbsoluteXY,
+    AbsoluteYZ,
+    AbsoluteZX
+  };
+
+  enum RelativeOrientationType
+  {
+    RelativeXY,
+    RelativeYZ,
+    RelativeZX
+  };
+
+public:
 
-class OCCVIEWER_EXPORT OCCViewer_ClipPlane
-{
-  
- public:
   OCCViewer_ClipPlane();
-  OCCViewer_ClipPlane& operator =(const OCCViewer_ClipPlane& other);
-  
- public:
-  OrientedPlane RelativeMode;
-  Standard_Real X;
-  Standard_Real Y;
-  Standard_Real Z;
-  Standard_Real Dx;
-  Standard_Real Dy;
-  Standard_Real Dz;
-  Standard_Integer Orientation;
-  bool IsInvert;
+  OCCViewer_ClipPlane& operator =( const OCCViewer_ClipPlane& theOther );
+
+// Parameters
+public:
+
+  // Plane definition mode
+  PlaneMode Mode;
+
+  // Is active
   bool IsOn;
-  ClipPlaneMode PlaneMode;
 
+  // Plane position
+  double X;
+  double Y;
+  double Z;
+
+  // Orientation type
+  int OrientationType;
+
+  // Plane orientation (depends on mode)
+  union
+  {
+    struct
+    {
+      bool   IsInvert;
+      double Dx;
+      double Dy;
+      double Dz;
+    } AbsoluteOrientation;
+
+    struct
+    {
+      double Rotation1;
+      double Rotation2;
+    } RelativeOrientation;
+  };
+
+// Tools
+public:
+
+  // Converts defined orientation to direction.
+  void OrientationToXYZ( double& theDx, double& theDy, double& theDz ) const;
+
+  // Converts absoulte orientation to relative equivalent.
+  static void DXYZToRelative( const double theDx,
+                              const double theDy,
+                              const double theDz,
+                              const int theRelativeType,
+                              double& theRotation1,
+                              double& theRotation2 );
+
+  // Converts relative orientation to absolute equivalent.
+  static void RelativeToDXYZ( const int theRelativeType,
+                              const double theRotation1,
+                              const double theRotation2,
+                              double& theDx,
+                              double& theDy,
+                              double& theDz );
 };
 
 typedef std::vector<OCCViewer_ClipPlane> ClipPlanesList;