0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / AIS / AIS_LengthDimension.hxx
index a9f7669..90a8720 100755 (executable)
@@ -2,8 +2,8 @@
 //
 // This file is part of Open CASCADE Technology software library.
 //
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
 // by the Free Software Foundation, with special exception defined in the file
 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
 // distribution for complete text of the license and disclaimer of any warranty.
 
 #include <AIS.hxx>
 #include <AIS_Dimension.hxx>
-#include <AIS_Drawer.hxx>
 #include <AIS_KindOfDimension.hxx>
 #include <Geom_Plane.hxx>
-#include <Geom_Transformation.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Dir.hxx>
 #include <Prs3d_DimensionAspect.hxx>
-#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Drawer.hxx>
 #include <Prs3d_Projector.hxx>
-#include <PrsMgr_PresentationManager3d.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_DefineHandle.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Vertex.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-class TopoDS_Face;
-class TCollection_ExtendedString;
-class gp_Pnt;
-class TopoDS_Edge;
-class TopoDS_Shape;
-class Geom_Plane;
-class PrsMgr_PresentationManager3d;
-class Prs3d_Presentation;
-class Prs3d_Projector;
-class Geom_Transformation;
-class SelectMgr_Selection;
-class AIS_Drawer;
-class Bnd_Box;
-class gp_Dir;
-class TopoDS_Vertex;
-class Standard_Transient;
-class Handle(Standard_Type);
-class Handle(AIS_Relation);
-class AIS_LengthDimension;
 
 DEFINE_STANDARD_HANDLE (AIS_LengthDimension, AIS_Dimension)
 
@@ -69,7 +41,7 @@ DEFINE_STANDARD_HANDLE (AIS_LengthDimension, AIS_Dimension)
 //! In case of face-edge, edge-vertex or face-face lengthes the automatic plane
 //! computing is allowed. For this plane the third point is found on the
 //! edge or on the face.
-//! 
+//!
 //! Please note that if the inappropriate geometry is defined
 //! or the distance between measured points is less than
 //! Precision::Confusion(), the dimension is invalid and its
@@ -85,8 +57,6 @@ public:
   Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFace,
                                        const TopoDS_Edge& theEdge);
 
-public:
-
   //! Construct length dimension between two faces.
   //! @param theFirstFace [in] the first face (first shape).
   //! @param theSecondFace [in] the second face (second shape).
@@ -187,38 +157,58 @@ public:
                                           const TopoDS_Shape& theSecondShape);
 
   //! @return the display units string.
-  Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits() const;
+  Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits() const Standard_OVERRIDE;
 
   //! @return the model units string.
-  Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits() const;
+  Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits() const Standard_OVERRIDE;
+
+  Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits) Standard_OVERRIDE;
 
-  Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits);
+  Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits) Standard_OVERRIDE;
 
-  Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits);
+  Standard_EXPORT virtual void SetTextPosition (const gp_Pnt& theTextPos) Standard_OVERRIDE;
 
-  Standard_EXPORT virtual void SetTextPosition (const gp_Pnt& theTextPos);
+  Standard_EXPORT virtual const gp_Pnt GetTextPosition() const Standard_OVERRIDE;
 
-  Standard_EXPORT virtual const gp_Pnt GetTextPosition() const;
+  //! Set custom direction for dimension. If it is not set, the direction is obtained
+  //! from the measured geometry (e.g. line between points of dimension)
+  //! The direction does not change flyout direction of dimension.
+  //! @param theDirection [in] the dimension direction.
+  //! @param theUseDirection [in] boolean value if custom direction should be used.
+  Standard_EXPORT void SetDirection (const gp_Dir& theDirection, const Standard_Boolean theUseDirection = Standard_True);
 
 public:
 
-  DEFINE_STANDARD_RTTI(AIS_LengthDimension)
+  DEFINE_STANDARD_RTTIEXT(AIS_LengthDimension,AIS_Dimension)
 
 protected:
 
   //! Checks if the plane includes first and second points to build dimension.
-  Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const;
+  Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const Standard_OVERRIDE;
 
   Standard_EXPORT virtual gp_Pln ComputePlane(const gp_Dir& theAttachDir) const;
 
-  Standard_EXPORT Standard_Real ComputeValue() const;
+  //! Computes distance between dimension points. If custom direction is defined, the distance
+  //! is a projection value of the distance between points to this direction
+  //! @return dimension value
+  Standard_EXPORT Standard_Real ComputeValue() const Standard_OVERRIDE;
 
   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
                                         const Handle(Prs3d_Presentation)& thePresentation,
-                                        const Standard_Integer theMode = 0);
+                                        const Standard_Integer theMode = 0) Standard_OVERRIDE;
+
+  //! Computes points bounded the flyout line for linear dimension.
+  //! Direction of flyout line equal to the custom direction of dimension if defined or
+  //! parallel to the main direction line
+  //! @param theFirstPoint [in] the first attach point of linear dimension.
+  //! @param theSecondPoint [in] the second attach point of linear dimension.
+  //! @param theLineBegPoint [out] the first attach point of linear dimension.
+  //! @param theLineEndPoint [out] the second attach point of linear dimension.
+  Standard_EXPORT virtual void ComputeFlyoutLinePoints (const gp_Pnt& theFirstPoint, const gp_Pnt& theSecondPoint,
+                                                        gp_Pnt& theLineBegPoint, gp_Pnt& theLineEndPoint) Standard_OVERRIDE;
 
   Standard_EXPORT virtual void ComputeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
-                                                       const Handle(SelectMgr_EntityOwner)& theEntityOwner);
+                                                       const Handle(SelectMgr_EntityOwner)& theEntityOwner) Standard_OVERRIDE;
 
 protected:
 
@@ -269,6 +259,8 @@ private:
   gp_Pnt mySecondPoint;
   TopoDS_Shape myFirstShape;
   TopoDS_Shape mySecondShape;
+  gp_Dir myDirection;
+  Standard_Boolean myHasCustomDirection;
 };
 
 #endif // _AIS_LengthDimension_HeaderFile