mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028727: Visualization, AIS_RadiusDimension - fix misprint in AIS_RadiusDimension::IsValidAnchor() check
This commit is contained in:
@@ -69,38 +69,19 @@ AIS_RadiusDimension::AIS_RadiusDimension (const TopoDS_Shape& theShape)
|
||||
SetFlyout (0.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
||||
{
|
||||
myCircle = theCircle;
|
||||
myGeometryType = GeometryType_Edge;
|
||||
myShape = BRepLib_MakeEdge (theCircle);
|
||||
myAnchorPoint = ElCLib::Value (0, myCircle);
|
||||
myIsGeometryValid = IsValidCircle (myCircle);
|
||||
|
||||
if (myIsGeometryValid)
|
||||
{
|
||||
ComputePlane();
|
||||
}
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAnchorPoint)
|
||||
const gp_Pnt& theAnchorPoint,
|
||||
const Standard_Boolean theHasAnchor)
|
||||
{
|
||||
myCircle = theCircle;
|
||||
myGeometryType = GeometryType_Edge;
|
||||
myShape = BRepLib_MakeEdge (theCircle);
|
||||
myAnchorPoint = theAnchorPoint;
|
||||
myIsGeometryValid = IsValidCircle (myCircle) && IsValidAnchor (myCircle, theAnchorPoint);
|
||||
myAnchorPoint = theHasAnchor ? theAnchorPoint : ElCLib::Value (0, myCircle);
|
||||
myIsGeometryValid = IsValidCircle (myCircle) && IsValidAnchor (myCircle, myAnchorPoint);
|
||||
|
||||
if (myIsGeometryValid)
|
||||
{
|
||||
@@ -114,13 +95,20 @@ void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
|
||||
void AIS_RadiusDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape,
|
||||
const gp_Pnt& theAnchorPoint,
|
||||
const Standard_Boolean theHasAnchor)
|
||||
{
|
||||
Standard_Boolean isClosed = Standard_False;
|
||||
myShape = theShape;
|
||||
myGeometryType = GeometryType_UndefShapes;
|
||||
myIsGeometryValid = InitCircularDimension (theShape, myCircle, myAnchorPoint, isClosed)
|
||||
&& IsValidCircle (myCircle);
|
||||
&& IsValidCircle (myCircle);
|
||||
if (theHasAnchor)
|
||||
{
|
||||
myAnchorPoint = theAnchorPoint;
|
||||
myIsGeometryValid = myIsGeometryValid && IsValidAnchor (myCircle, myAnchorPoint);
|
||||
}
|
||||
|
||||
if (myIsGeometryValid)
|
||||
{
|
||||
@@ -252,7 +240,7 @@ Standard_Boolean AIS_RadiusDimension::IsValidAnchor (const gp_Circ& theCircle,
|
||||
Standard_Real anAnchorDist = theAnchor.Distance (theCircle.Location());
|
||||
Standard_Real aRadius = myCircle.Radius();
|
||||
|
||||
return Abs (anAnchorDist - aRadius) > Precision::Confusion()
|
||||
return Abs (anAnchorDist - aRadius) <= Precision::Confusion()
|
||||
&& aCirclePlane.Contains (theAnchor, Precision::Confusion());
|
||||
}
|
||||
|
||||
|
@@ -85,22 +85,34 @@ public:
|
||||
//! The dimension will become invalid if the radius of the circle
|
||||
//! is less than Precision::Confusion().
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle);
|
||||
void SetMeasuredGeometry (const gp_Circ& theCircle) { SetMeasuredGeometry (theCircle, gp_Pnt(), Standard_False); }
|
||||
|
||||
//! Measure radius of the circle and orient the dimension so
|
||||
//! the dimension lines attaches to anchor point on the circle.
|
||||
//! The dimension will become invalid if the radius of the circle
|
||||
//! is less than Precision::Confusion().
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
//! @param theAnchorPoint [in] the point to attach the dimension lines.
|
||||
//! @param theAnchorPoint [in] the point to attach the dimension lines, should be on the circle
|
||||
//! @param theHasAnchor [in] should be set TRUE if theAnchorPoint should be used
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAnchorPoint);
|
||||
const gp_Pnt& theAnchorPoint,
|
||||
const Standard_Boolean theHasAnchor = Standard_True);
|
||||
|
||||
//! Measure radius on the passed shape, if applicable.
|
||||
//! The dimension will become invalid if the passed shape is not
|
||||
//! measurable or if measured diameter value is less than Precision::Confusion().
|
||||
//! @param theShape [in] the shape to measure.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Shape& theShape);
|
||||
void SetMeasuredGeometry (const TopoDS_Shape& theShape) { SetMeasuredGeometry (theShape, gp_Pnt(), Standard_False); }
|
||||
|
||||
//! Measure radius on the passed shape, if applicable.
|
||||
//! The dimension will become invalid if the passed shape is not
|
||||
//! measurable or if measured diameter value is less than Precision::Confusion().
|
||||
//! @param theShape [in] the shape to measure.
|
||||
//! @param theAnchorPoint [in] the point to attach the dimension lines, should be on the circle
|
||||
//! @param theHasAnchor [in] should be set TRUE if theAnchorPoint should be used
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Shape& theShape,
|
||||
const gp_Pnt& theAnchorPoint,
|
||||
const Standard_Boolean theHasAnchor = Standard_True);
|
||||
|
||||
//! @return the display units string.
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits() const Standard_OVERRIDE;
|
||||
|
Reference in New Issue
Block a user