|
||||
File indexing completed on 2025-01-18 10:04:41
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_RadiusDimension_HeaderFile 0016 #define _PrsDim_RadiusDimension_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 0024 DEFINE_STANDARD_HANDLE(PrsDim_RadiusDimension, PrsDim_Dimension) 0025 0026 //! Radius dimension. Can be constructed: 0027 //! - On generic circle. 0028 //! - On generic circle with user-defined anchor point on that circle. 0029 //! - On generic shape containing geometry that can be measured 0030 //! by diameter dimension: circle wire, arc, circular face, etc. 0031 //! The anchor point is the location of left attachement point of 0032 //! dimension on the circle. It can be user-specified, or computed as 0033 //! middle point on the arc. The radius dimension always lies in the 0034 //! plane of the measured circle. The dimension is considered as 0035 //! invalid if the user-specified anchor point is not lying on the circle, 0036 //! if the radius of the circle is less than Precision::Confusion(). 0037 //! In case if the dimension is built on the arbitrary shape, 0038 //! it can be considered as invalid if the shape does not contain 0039 //! circle geometry. 0040 class PrsDim_RadiusDimension : public PrsDim_Dimension 0041 { 0042 DEFINE_STANDARD_RTTIEXT(PrsDim_RadiusDimension, PrsDim_Dimension) 0043 public: 0044 0045 //! Create radius dimension for the circle geometry. 0046 //! @param theCircle [in] the circle to measure. 0047 Standard_EXPORT PrsDim_RadiusDimension (const gp_Circ& theCircle); 0048 0049 //! Create radius dimension for the circle geometry and define its 0050 //! orientation by location of the first point on that circle. 0051 //! @param theCircle [in] the circle to measure. 0052 //! @param theAnchorPoint [in] the point to define the position 0053 //! of the dimension attachment on the circle. 0054 Standard_EXPORT PrsDim_RadiusDimension (const gp_Circ& theCircle, 0055 const gp_Pnt& theAnchorPoint); 0056 0057 //! Create radius dimension for the arbitrary shape (if possible). 0058 //! @param theShape [in] the shape to measure. 0059 Standard_EXPORT PrsDim_RadiusDimension (const TopoDS_Shape& theShape); 0060 0061 public: 0062 0063 //! @return measured geometry circle. 0064 const gp_Circ& Circle() const { return myCircle; } 0065 0066 //! @return anchor point on circle for radius dimension. 0067 const gp_Pnt& AnchorPoint() const { return myAnchorPoint; } 0068 0069 //! @return the measured shape. 0070 const TopoDS_Shape& Shape() const { return myShape; } 0071 0072 public: 0073 0074 //! Measure radius of the circle. 0075 //! The dimension will become invalid if the radius of the circle 0076 //! is less than Precision::Confusion(). 0077 //! @param theCircle [in] the circle to measure. 0078 void SetMeasuredGeometry (const gp_Circ& theCircle) { SetMeasuredGeometry (theCircle, gp_Pnt(), Standard_False); } 0079 0080 //! Measure radius of the circle and orient the dimension so 0081 //! the dimension lines attaches to anchor point on the circle. 0082 //! The dimension will become invalid if the radius of the circle 0083 //! is less than Precision::Confusion(). 0084 //! @param theCircle [in] the circle to measure. 0085 //! @param theAnchorPoint [in] the point to attach the dimension lines, should be on the circle 0086 //! @param theHasAnchor [in] should be set TRUE if theAnchorPoint should be used 0087 Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle, 0088 const gp_Pnt& theAnchorPoint, 0089 const Standard_Boolean theHasAnchor = Standard_True); 0090 0091 //! Measure radius on the passed shape, if applicable. 0092 //! The dimension will become invalid if the passed shape is not 0093 //! measurable or if measured diameter value is less than Precision::Confusion(). 0094 //! @param theShape [in] the shape to measure. 0095 void SetMeasuredGeometry (const TopoDS_Shape& theShape) { SetMeasuredGeometry (theShape, gp_Pnt(), Standard_False); } 0096 0097 //! Measure radius on the passed shape, if applicable. 0098 //! The dimension will become invalid if the passed shape is not 0099 //! measurable or if measured diameter value is less than Precision::Confusion(). 0100 //! @param theShape [in] the shape to measure. 0101 //! @param theAnchorPoint [in] the point to attach the dimension lines, should be on the circle 0102 //! @param theHasAnchor [in] should be set TRUE if theAnchorPoint should be used 0103 Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Shape& theShape, 0104 const gp_Pnt& theAnchorPoint, 0105 const Standard_Boolean theHasAnchor = Standard_True); 0106 0107 //! @return the display units string. 0108 Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits() const Standard_OVERRIDE; 0109 0110 //! @return the model units string. 0111 Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits() const Standard_OVERRIDE; 0112 0113 Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits) Standard_OVERRIDE; 0114 0115 Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits) Standard_OVERRIDE; 0116 0117 Standard_EXPORT virtual void SetTextPosition (const gp_Pnt& theTextPos) Standard_OVERRIDE; 0118 0119 Standard_EXPORT virtual gp_Pnt GetTextPosition() const Standard_OVERRIDE; 0120 0121 protected: 0122 0123 Standard_EXPORT virtual void ComputePlane(); 0124 0125 //! Checks if anchor point and the center of the circle are on the plane. 0126 Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const Standard_OVERRIDE; 0127 0128 Standard_EXPORT virtual Standard_Real ComputeValue() const Standard_OVERRIDE; 0129 0130 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, 0131 const Handle(Prs3d_Presentation)& thePrs, 0132 const Standard_Integer theMode) Standard_OVERRIDE; 0133 0134 protected: 0135 0136 Standard_EXPORT Standard_Boolean IsValidCircle (const gp_Circ& theCircle) const; 0137 0138 Standard_EXPORT Standard_Boolean IsValidAnchor (const gp_Circ& theCircle, 0139 const gp_Pnt& thePnt) const; 0140 0141 private: 0142 0143 gp_Circ myCircle; 0144 gp_Pnt myAnchorPoint; 0145 TopoDS_Shape myShape; 0146 }; 0147 0148 #endif // _PrsDim_RadiusDimension_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |