|
||||
File indexing completed on 2025-01-18 10:04:40
0001 // Copyright (c) 1995-1999 Matra Datavision 0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0003 // 0004 // This file is part of Open CASCADE Technology software library. 0005 // 0006 // This library is free software; you can redistribute it and/or modify it under 0007 // the terms of the GNU Lesser General Public License version 2.1 as published 0008 // by the Free Software Foundation, with special exception defined in the file 0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0010 // distribution for complete text of the license and disclaimer of any warranty. 0011 // 0012 // Alternatively, this file may be used under the terms of Open CASCADE 0013 // commercial license or contractual agreement. 0014 0015 #ifndef _PrsDim_DiameterDimension_HeaderFile 0016 #define _PrsDim_DiameterDimension_HeaderFile 0017 0018 #include <PrsDim_Dimension.hxx> 0019 #include <gp_Pnt.hxx> 0020 #include <gp_Circ.hxx> 0021 #include <Standard.hxx> 0022 #include <Standard_Macro.hxx> 0023 #include <Standard_Type.hxx> 0024 0025 DEFINE_STANDARD_HANDLE(PrsDim_DiameterDimension, PrsDim_Dimension) 0026 0027 //! Diameter dimension. Can be constructed: 0028 //! - On generic circle. 0029 //! - On generic circle with user-defined anchor point on that circle 0030 //! (dimension plane is oriented to follow the anchor point). 0031 //! - On generic circle in the specified plane. 0032 //! - On generic shape containing geometry that can be measured 0033 //! by diameter dimension: circle wire, circular face, etc. 0034 //! The anchor point is the location of the left attachement point of 0035 //! dimension on the circle. 0036 //! The anchor point computation is processed after dimension plane setting 0037 //! so that positive flyout direction stands with normal of the circle and 0038 //! the normal of the plane. 0039 //! If the plane is user-defined the anchor point was computed as intersection 0040 //! of the plane and the basis circle. Among two intersection points 0041 //! the one is selected so that positive flyout direction vector and 0042 //! the circle normal on the one side form the circle plane. 0043 //! (corner between positive flyout directio nand the circle normal is acute.) 0044 //! If the plane is computed automatically (by default it is the circle plane), 0045 //! the anchor point is the zero parameter point of the circle. 0046 //! 0047 //! The dimension is considered as invalid if the user-defined plane 0048 //! does not include th enachor point and th ecircle center, 0049 //! if the diameter of the circle is less than Precision::Confusion(). 0050 //! In case if the dimension is built on the arbitrary shape, it can be considered 0051 //! as invalid if the shape does not contain circle geometry. 0052 class PrsDim_DiameterDimension : public PrsDim_Dimension 0053 { 0054 DEFINE_STANDARD_RTTIEXT(PrsDim_DiameterDimension, PrsDim_Dimension) 0055 public: 0056 0057 //! Construct diameter dimension for the circle. 0058 //! @param theCircle [in] the circle to measure. 0059 Standard_EXPORT PrsDim_DiameterDimension (const gp_Circ& theCircle); 0060 0061 //! Construct diameter dimension for the circle and orient it correspondingly 0062 //! to the passed plane. 0063 //! @param theCircle [in] the circle to measure. 0064 //! @param thePlane [in] the plane defining preferred orientation 0065 //! for dimension. 0066 Standard_EXPORT PrsDim_DiameterDimension (const gp_Circ& theCircle, 0067 const gp_Pln& thePlane); 0068 0069 //! Construct diameter on the passed shape, if applicable. 0070 //! @param theShape [in] the shape to measure. 0071 Standard_EXPORT PrsDim_DiameterDimension (const TopoDS_Shape& theShape); 0072 0073 //! Construct diameter on the passed shape, if applicable - and 0074 //! define the preferred plane to orient the dimension. 0075 //! @param theShape [in] the shape to measure. 0076 //! @param thePlane [in] the plane defining preferred orientation 0077 //! for dimension. 0078 Standard_EXPORT PrsDim_DiameterDimension (const TopoDS_Shape& theShape, 0079 const gp_Pln& thePlane); 0080 0081 public: 0082 0083 //! @return measured geometry circle. 0084 const gp_Circ& Circle() const { return myCircle; } 0085 0086 //! @return anchor point on circle for diameter dimension. 0087 Standard_EXPORT gp_Pnt AnchorPoint(); 0088 0089 //! @return the measured shape. 0090 const TopoDS_Shape& Shape() const { return myShape; } 0091 0092 public: 0093 0094 //! Measure diameter of the circle. 0095 //! The actual dimension plane is used for determining anchor points 0096 //! on the circle to attach the dimension lines to. 0097 //! The dimension will become invalid if the diameter of the circle 0098 //! is less than Precision::Confusion(). 0099 //! @param theCircle [in] the circle to measure. 0100 Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle); 0101 0102 //! Measure diameter on the passed shape, if applicable. 0103 //! The dimension will become invalid if the passed shape is not 0104 //! measurable or if measured diameter value is less than Precision::Confusion(). 0105 //! @param theShape [in] the shape to measure. 0106 Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Shape& theShape); 0107 0108 //! @return the display units string. 0109 Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits() const Standard_OVERRIDE; 0110 0111 //! @return the model units string. 0112 Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits() const Standard_OVERRIDE; 0113 0114 Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits) Standard_OVERRIDE; 0115 0116 Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits) Standard_OVERRIDE; 0117 0118 Standard_EXPORT virtual void SetTextPosition (const gp_Pnt& theTextPos) Standard_OVERRIDE; 0119 0120 Standard_EXPORT virtual gp_Pnt GetTextPosition() const Standard_OVERRIDE; 0121 0122 protected: 0123 0124 //! Override this method to change logic of anchor point computation. 0125 //! Computes anchor point. Its computation is based on the current 0126 //! dimension plane. Therfore, anchor point is an intersection of plane 0127 //! and circle. 0128 //! ATTENTION! 0129 //! 1) The plane should be set or computed before. 0130 //! 2) The plane should inclide th ecircle center to be valid. 0131 Standard_EXPORT virtual void ComputeAnchorPoint(); 0132 0133 Standard_EXPORT virtual void ComputePlane(); 0134 0135 //! Checks if the center of the circle is on the plane. 0136 Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const Standard_OVERRIDE; 0137 0138 Standard_EXPORT virtual Standard_Real ComputeValue() const Standard_OVERRIDE; 0139 0140 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, 0141 const Handle(Prs3d_Presentation)& thePresentation, 0142 const Standard_Integer theMode) Standard_OVERRIDE; 0143 0144 Standard_EXPORT virtual void ComputeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection, 0145 const Handle(SelectMgr_EntityOwner)& theEntityOwner) Standard_OVERRIDE; 0146 0147 protected: 0148 0149 //! Compute points on the circle sides for the dimension plane. 0150 //! Program error exception is raised if the dimension plane "x" direction 0151 //! is orthogonal to plane (the "impossible" case). The passed dimension plane 0152 //! is the one specially computed to locate dimension presentation in circle. 0153 //! @param theCircle [in] the circle. 0154 //! @param theFirstPnt [out] the first point. 0155 //! @param theSecondPnt [out] the second point. 0156 Standard_EXPORT void ComputeSidePoints (const gp_Circ& theCircle, 0157 gp_Pnt& theFirstPnt, 0158 gp_Pnt& theSecondPnt); 0159 0160 Standard_EXPORT Standard_Boolean IsValidCircle (const gp_Circ& theCircle) const; 0161 0162 Standard_EXPORT Standard_Boolean IsValidAnchor (const gp_Circ& theCircle, 0163 const gp_Pnt& thePnt) const; 0164 0165 private: 0166 0167 gp_Circ myCircle; 0168 gp_Pnt myAnchorPoint; 0169 TopoDS_Shape myShape; 0170 }; 0171 0172 #endif // _PrsDim_DiameterDimension_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |