Corrected checks of working plane and dimension geometry.
Corrected remarks: IsComputed flag was added to the SelectionGeometry to check if it is filled; AdjustParameters() methods became const ones.
minor remark
{
gp_Pln aComputedPlane;
- myFirstShape = theFirstEdge;
- mySecondShape = theSecondEdge;
- myThirdShape = TopoDS_Shape();
- myGeometryType = GeometryType_Edges;
- myIsValid = InitTwoEdgesAngle (aComputedPlane);
+ myFirstShape = theFirstEdge;
+ mySecondShape = theSecondEdge;
+ myThirdShape = TopoDS_Shape();
+ myGeometryType = GeometryType_Edges;
+ myIsGeometryValid = InitTwoEdgesAngle (aComputedPlane);
- if (myIsValid && !myIsPlaneCustom)
+ if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
mySecondShape = BRepLib_MakeVertex (myCenterPoint);
myThirdShape = BRepLib_MakeVertex (mySecondPoint);
myGeometryType = GeometryType_Points;
- myIsValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
+ myIsGeometryValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
- if (myIsValid && !myIsPlaneCustom)
+ if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
const TopoDS_Vertex& theSecondVertex,
const TopoDS_Vertex& theThirdVertex)
{
- myFirstShape = theFirstVertex;
- mySecondShape = theSecondVertex;
- myThirdShape = theThirdVertex;
- myFirstPoint = BRep_Tool::Pnt (theFirstVertex);
- myCenterPoint = BRep_Tool::Pnt (theSecondVertex);
- mySecondPoint = BRep_Tool::Pnt (theThirdVertex);
- myGeometryType = GeometryType_Points;
- myIsValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
-
- if (myIsValid && !myIsPlaneCustom)
+ myFirstShape = theFirstVertex;
+ mySecondShape = theSecondVertex;
+ myThirdShape = theThirdVertex;
+ myFirstPoint = BRep_Tool::Pnt (theFirstVertex);
+ myCenterPoint = BRep_Tool::Pnt (theSecondVertex);
+ mySecondPoint = BRep_Tool::Pnt (theThirdVertex);
+ myGeometryType = GeometryType_Points;
+ myIsGeometryValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
+
+ if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
//=======================================================================
void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theCone)
{
- myFirstShape = theCone;
- mySecondShape = TopoDS_Shape();
- myThirdShape = TopoDS_Shape();
- myGeometryType = GeometryType_Face;
- myIsValid = InitConeAngle();
+ myFirstShape = theCone;
+ mySecondShape = TopoDS_Shape();
+ myThirdShape = TopoDS_Shape();
+ myGeometryType = GeometryType_Face;
+ myIsGeometryValid = InitConeAngle();
- if (myIsValid && !myIsPlaneCustom)
+ if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
const TopoDS_Face& theSecondFace)
{
- myFirstShape = theFirstFace;
- mySecondShape = theSecondFace;
- myThirdShape = TopoDS_Shape();
- myGeometryType = GeometryType_Faces;
- myIsValid = InitTwoFacesAngle();
+ myFirstShape = theFirstFace;
+ mySecondShape = theSecondFace;
+ myThirdShape = TopoDS_Shape();
+ myGeometryType = GeometryType_Faces;
+ myIsGeometryValid = InitTwoFacesAngle();
- if (myIsValid && !myIsPlaneCustom)
+ if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
const TopoDS_Face& theSecondFace,
const gp_Pnt& thePoint)
{
- myFirstShape = theFirstFace;
- mySecondShape = theSecondFace;
- myThirdShape = TopoDS_Shape();
- myGeometryType = GeometryType_Faces;
- myIsValid = InitTwoFacesAngle (thePoint);
+ myFirstShape = theFirstFace;
+ mySecondShape = theSecondFace;
+ myThirdShape = TopoDS_Shape();
+ myGeometryType = GeometryType_Faces;
+ myIsGeometryValid = InitTwoFacesAngle (thePoint);
- if (myIsValid && !myIsPlaneCustom)
+ if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
//=======================================================================
void AIS_AngleDimension::ComputePlane()
{
- if (!IsValid())
+ if (!myIsGeometryValid)
{
return;
}
if (IsTextPositionCustom())
{
- AdjustParameters (myFixedTextPosition,anExtensionSize, aHorisontalTextPos);
+ AdjustParameters (myFixedTextPosition,anExtensionSize, aHorisontalTextPos, myFlyout);
}
// Handle user-defined and automatic arrow placement
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
}
- myIsComputed = Standard_True;
+ mySelectionGeom.IsComputed = Standard_True;
}
//=======================================================================
}
//=======================================================================
-//function : AdjustAspectParameters
+//function : AdjustParameters
//purpose :
//=======================================================================
void AIS_AngleDimension::AdjustParameters (const gp_Pnt& theTextPos,
Standard_Real& theExtensionSize,
- Prs3d_DimensionTextHorizontalPosition& theAlignment)
+ Prs3d_DimensionTextHorizontalPosition& theAlignment,
+ Standard_Real& theFlyout) const
{
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
// Horizontal center
if (aTextPar > aParamBeg && aTextPar < aParamEnd)
{
- myFlyout = aRadius;
-
- SetToUpdate();
+ theFlyout = aRadius;
return;
}
if (aTextPar > aParamBeg && aTextPar < aParamEnd)
{
- myFlyout = -aRadius;
-
- SetToUpdate();
+ theFlyout = -aRadius;
return;
}
gp_Vec aPosFlyoutDir = gp_Vec (myCenterPoint, myFirstPoint).Normalized().Scaled (aRadius);
- myFlyout = aFirstTextProj.Distance (myCenterPoint.Translated (aPosFlyoutDir)) > Precision::Confusion()
+ theFlyout = aFirstTextProj.Distance (myCenterPoint.Translated (aPosFlyoutDir)) > Precision::Confusion()
? -aRadius : aRadius;
}
else
gp_Vec aPosFlyoutDir = gp_Vec (myCenterPoint, mySecondPoint).Normalized().Scaled (aRadius);
- myFlyout = aSecondTextProj.Distance (myCenterPoint.Translated (aPosFlyoutDir)) > Precision::Confusion()
+ theFlyout = aSecondTextProj.Distance (myCenterPoint.Translated (aPosFlyoutDir)) > Precision::Confusion()
? -aRadius : aRadius;
}
}
//! Adjusts aspect parameters according the text position:
//! extension size, vertical text alignment and flyout.
- //! It changes flyout of the dimension.
//! @param theTextPos [in] the user defined 3d point of text position.
//! @param theExtensionSize [out] the adjusted extension size.
//! @param theAlignment [out] the horizontal label alignment.
+ //! @param theFlyout [out] the adjusted value of flyout.
Standard_EXPORT void AdjustParameters (const gp_Pnt& theTextPos,
Standard_Real& theExtensionSize,
- Prs3d_DimensionTextHorizontalPosition& theAlignment);
+ Prs3d_DimensionTextHorizontalPosition& theAlignment,
+ Standard_Real& theFlyout) const;
protected:
//=======================================================================
void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
{
- myCircle = theCircle;
- myGeometryType = GeometryType_Edge;
- myShape = BRepLib_MakeEdge (theCircle);
- myAnchorPoint = gp::Origin();
- myIsValid = IsValidCircle (myCircle);
+ myCircle = theCircle;
+ myGeometryType = GeometryType_Edge;
+ myShape = BRepLib_MakeEdge (theCircle);
+ myAnchorPoint = gp::Origin();
+ myIsGeometryValid = IsValidCircle (myCircle);
- if (myIsValid && myIsPlaneCustom)
+ if (myIsGeometryValid && myIsPlaneCustom)
{
ComputeAnchorPoint();
}
myAnchorPoint = ElCLib::Value (0.0, myCircle);
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
gp_Pnt aDummyPnt (gp::Origin());
Standard_Boolean isClosed = Standard_False;
- myGeometryType = GeometryType_UndefShapes;
- myShape = theShape;
- myAnchorPoint = gp::Origin();
- myIsValid = InitCircularDimension (theShape, myCircle, aDummyPnt, isClosed)
- && IsValidCircle (myCircle)
- && isClosed;
+ myGeometryType = GeometryType_UndefShapes;
+ myShape = theShape;
+ myAnchorPoint = gp::Origin();
+ myIsGeometryValid = InitCircularDimension (theShape, myCircle, aDummyPnt, isClosed)
+ && IsValidCircle (myCircle)
+ && isClosed;
- if (myIsValid && myIsPlaneCustom)
+ if (myIsGeometryValid && myIsPlaneCustom)
{
ComputeAnchorPoint();
}
myAnchorPoint = ElCLib::Value (0.0, myCircle);
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
//=======================================================================
void AIS_DiameterDimension::ComputePlane()
{
- if (!IsValid())
+ if (!myIsGeometryValid)
{
return;
}
GeomAPI_IntCS anIntersector (aCircle, aPlane);
if (!anIntersector.IsDone())
{
- myIsValid = Standard_False;
+ myIsGeometryValid = Standard_False;
return;
}
if (anIntersector.NbPoints() != 2)
{
myAnchorPoint = ElCLib::Value (0.0, myCircle);
- myIsValid = Standard_True;
+ myIsGeometryValid = Standard_True;
return;
}
//=======================================================================
void AIS_DiameterDimension::SetTextPosition (const gp_Pnt& theTextPos)
{
- if (!myIsValid)
+ if (!IsValid())
{
return;
}
myGeometryType (GeometryType_UndefShapes),
myIsPlaneCustom (Standard_False),
myFlyout (0.0),
- myIsValid (Standard_False),
+ myIsGeometryValid (Standard_False),
myKindOfDimension (theType)
{
}
myPlane = thePlane;
myIsPlaneCustom = Standard_True;
- // Disable fixed text position
+ // Disable fixed (custom) text position
UnsetFixedTextPosition();
// Check validity if geometry has been set already.
- if (myIsValid)
+ if (IsValid())
{
- myIsValid &= CheckPlane (myPlane);
SetToUpdate();
}
}
Prs3d_DimensionTextHorizontalPosition aHorisontalTextPos = aDimensionAspect->TextHorizontalPosition();
if (IsTextPositionCustom())
{
- AdjustParametersForLinear (myFixedTextPosition, theFirstPoint, theSecondPoint,
- anExtensionSize, aHorisontalTextPos);
-
+ if (!AdjustParametersForLinear (myFixedTextPosition, theFirstPoint, theSecondPoint,
+ anExtensionSize, aHorisontalTextPos, myFlyout, myPlane, myIsPlaneCustom))
+ {
+ Standard_ProgramError::Raise ("Can not adjust plane to the custom label position.");
+ }
}
FitTextAlignmentForLinear (theFirstPoint, theSecondPoint, theIsOneSide, aHorisontalTextPos,
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
}
- myIsComputed = Standard_True;
+ mySelectionGeom.IsComputed = Standard_True;
}
//=======================================================================
void AIS_Dimension::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode)
{
- if (!myIsComputed)
+ if (!mySelectionGeom.IsComputed)
{
return;
}
const gp_Pnt& theSecondPoint,
const Standard_Boolean theIsOneSide) const
{
- if (!myIsValid)
+ if (!IsValid())
{
return gp::Origin();
}
}
//=======================================================================
-//function : AdjustAspectParameters
+//function : AdjustParametersForLinear
//purpose :
//=======================================================================
-void AIS_Dimension::AdjustParametersForLinear (const gp_Pnt& theTextPos,
- const gp_Pnt& theFirstPoint,
- const gp_Pnt& theSecondPoint,
- Standard_Real& theExtensionSize,
- Prs3d_DimensionTextHorizontalPosition& theAlignment)
+Standard_Boolean AIS_Dimension::AdjustParametersForLinear (const gp_Pnt& theTextPos,
+ const gp_Pnt& theFirstPoint,
+ const gp_Pnt& theSecondPoint,
+ Standard_Real& theExtensionSize,
+ Prs3d_DimensionTextHorizontalPosition& theAlignment,
+ Standard_Real& theFlyout,
+ gp_Pln& thePlane,
+ Standard_Boolean& theIsPlaneOld) const
{
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
- //Set new automatic plane.
- myPlane = gce_MakePln (theTextPos, theFirstPoint, theSecondPoint);
- myIsPlaneCustom = Standard_False;
-
- // Compute dimension line points.
- gp_Dir aPlaneNormal = GetPlane().Axis().Direction();
gp_Dir aTargetPointsDir = gce_MakeDir (theFirstPoint, theSecondPoint);
gp_Vec aTargetPointsVec (theFirstPoint, theSecondPoint);
+ // Don't set new plane if the text position lies on the attachment points line.
+ gp_Lin aTargetPointsLin (theFirstPoint, aTargetPointsDir);
+ if (!aTargetPointsLin.Contains (theTextPos, Precision::Confusion()))
+ {
+ //Set new automatic plane.
+ thePlane = gce_MakePln (theTextPos, theFirstPoint, theSecondPoint);
+ theIsPlaneOld = Standard_False;
+ }
+
// Compute flyout direction vector.
+ gp_Dir aPlaneNormal = GetPlane().Axis().Direction();
gp_Dir aPositiveFlyout = aPlaneNormal ^ aTargetPointsDir;
+ // Additional check of collinearity of the plane normal and attachment points vector.
+ if (aPlaneNormal.IsParallel (aTargetPointsDir, Precision::Angular()))
+ {
+ return Standard_False;
+ }
+
// Set flyout.
gp_Vec aFirstToTextVec (theFirstPoint, theTextPos);
// Compute flyout value and direction.
gp_Vec aFlyoutVector = gp_Vec (aTextPosProj, theTextPos);
- myFlyout = gp_Dir (aFlyoutVector).IsOpposite (aPositiveFlyout, Precision::Angular())
- ? -aFlyoutVector.Magnitude()
- : aFlyoutVector.Magnitude();
-
+ theFlyout = 0.0;
+ if (aFlyoutVector.Magnitude() > Precision::Confusion())
+ {
+ theFlyout = gp_Dir (aFlyoutVector).IsOpposite (aPositiveFlyout, Precision::Angular())
+ ? -aFlyoutVector.Magnitude()
+ : aFlyoutVector.Magnitude();
+ }
+
// Compute attach points (through which main dimension line passes).
gp_Pnt aFirstAttach = theFirstPoint.Translated (aFlyoutVector);
gp_Pnt aSecondAttach = theSecondPoint.Translated (aFlyoutVector);
- // Set horisontal text alignment.
+ // Set horizontal text alignment.
if (aCos < 0.0)
{
theAlignment = Prs3d_DTHP_Left;
{
theAlignment = Prs3d_DTHP_Center;
}
+ return Standard_True;
}
//=======================================================================
//! Check that the input geometry for dimension is valid and the
//! presentation can be successfully computed.
//! @return TRUE if dimension geometry is ok.
- Standard_Boolean IsValid() const
+ virtual Standard_Boolean IsValid() const
{
- return myIsValid;
+ return myIsGeometryValid && CheckPlane (GetPlane());
}
public:
//! @param theIsArrowExternal [out] is the arrows external,
//! if arrow orientation in the dimension aspect is Prs3d_DAO_Fit, it fits arrow
//! orientation automatically.
- void FitTextAlignmentForLinear (const gp_Pnt& theFirstPoint,
- const gp_Pnt& theSecondPoint,
- const Standard_Boolean theIsOneSide,
- const Prs3d_DimensionTextHorizontalPosition& theHorizontalTextPos,
- Standard_Integer& theLabelPosition,
- Standard_Boolean& theIsArrowsExternal) const;
+ Standard_EXPORT void FitTextAlignmentForLinear (const gp_Pnt& theFirstPoint,
+ const gp_Pnt& theSecondPoint,
+ const Standard_Boolean theIsOneSide,
+ const Prs3d_DimensionTextHorizontalPosition& theHorizontalTextPos,
+ Standard_Integer& theLabelPosition,
+ Standard_Boolean& theIsArrowsExternal) const;
//! Adjusts aspect parameters according the text position:
//! extension size, vertical text alignment and flyout.
- //! It changes working plane and flyout of linear dimension.
//! @param theTextPos [in] the user defined 3d point of text position
//! @param theFirstPoint [in] the first point of linear measurement.
//! @param theSecondPoint [in] the second point of linear measurement.
//! @param theExtensionSize [out] the adjusted extension size
//! @param theAlignment [out] the horizontal label alignment.
- void AdjustParametersForLinear (const gp_Pnt& theTextPos,
- const gp_Pnt& theFirstPoint,
- const gp_Pnt& theSecondPoint,
- Standard_Real& theExtensionSize,
- Prs3d_DimensionTextHorizontalPosition& theAlignment);
+ //! @param theFlyout [out] the adjusted value of flyout.
+ //! @param thePlane [out] the new plane that contains theTextPos and attachment points.
+ //! @param theIsPlaneOld [out] shows if new plane is computed.
+ Standard_EXPORT Standard_Boolean AdjustParametersForLinear (const gp_Pnt& theTextPos,
+ const gp_Pnt& theFirstPoint,
+ const gp_Pnt& theSecondPoint,
+ Standard_Real& theExtensionSize,
+ Prs3d_DimensionTextHorizontalPosition& theAlignment,
+ Standard_Real& theFlyout,
+ gp_Pln& thePlane,
+ Standard_Boolean& theIsPlaneOld) const;
protected: //! @name Behavior to implement
Standard_Real TextHeight; //!< Height of text label.
SeqOfCurves DimensionLine; //!< Sequence of points for composing the segments of dimension line.
SeqOfArrows Arrows; //!< Sequence of arrow geometries.
+ Standard_Boolean IsComputed; //!< Shows if the selection geometry was filled.
public:
TextWidth = 0.0;
TextHeight = 0.0;
}
+
+ IsComputed = Standard_False;
}
//! Add new curve entry and return the reference to populate it.
} mySelectionGeom;
Standard_Real mySelToleranceForText2d; //!< Sensitive point tolerance for 2d text selection.
- Standard_Boolean myIsComputed; //!< Shows if the presentation and selection was computed.
protected: //! @name Value properties
GeometryType myGeometryType; //!< defines type of shapes on which the dimension is to be built.
- gp_Pln myPlane; //!< Plane where dimension will be built (computed or user defined).
- Standard_Boolean myIsPlaneCustom; //!< Is plane defined by user (otherwise it will be computed automatically).
- Standard_Real myFlyout; //!< Flyout distance.
- Standard_Boolean myIsValid; //!< Is dimension geometry properly defined.
+ gp_Pln myPlane; //!< Plane where dimension will be built (computed or user defined).
+ Standard_Boolean myIsPlaneCustom; //!< Is plane defined by user (otherwise it will be computed automatically).
+ Standard_Real myFlyout; //!< Flyout distance.
+ Standard_Boolean myIsGeometryValid; //!< Is dimension geometry properly defined.
private:
const gp_Pnt& theSecondPoint,
const gp_Pln& thePlane)
{
- myFirstPoint = theFirstPoint;
- mySecondPoint = theSecondPoint;
- myFirstShape = BRepLib_MakeVertex (myFirstPoint);
- mySecondShape = BRepLib_MakeVertex (mySecondPoint);
- myGeometryType = GeometryType_Points;
+ myFirstPoint = theFirstPoint;
+ mySecondPoint = theSecondPoint;
+ myFirstShape = BRepLib_MakeVertex (myFirstPoint);
+ mySecondShape = BRepLib_MakeVertex (mySecondPoint);
+ myGeometryType = GeometryType_Points;
SetCustomPlane (thePlane);
- myIsValid = IsValidPoints (theFirstPoint, theSecondPoint) && CheckPlane (myPlane);
+ myIsGeometryValid = IsValidPoints (theFirstPoint, theSecondPoint);
SetToUpdate();
}
void AIS_LengthDimension::SetMeasuredGeometry (const TopoDS_Edge& theEdge,
const gp_Pln& thePlane)
{
- myFirstShape = theEdge;
- mySecondShape = TopoDS_Shape();
- myGeometryType = GeometryType_Edge;
+ myFirstShape = theEdge;
+ mySecondShape = TopoDS_Shape();
+ myGeometryType = GeometryType_Edge;
SetCustomPlane (thePlane);
- myIsValid = InitOneShapePoints (myFirstShape) && CheckPlane (myPlane);
+ myIsGeometryValid = InitOneShapePoints (myFirstShape);
SetToUpdate();
}
{
gp_Pln aComputedPlane;
Standard_Boolean isPlaneReturned = Standard_False;
- myFirstShape = theFirstShape;
- mySecondShape = theSecondShape;
- myIsValid = InitTwoShapesPoints (myFirstShape, mySecondShape, aComputedPlane, isPlaneReturned);
- if (myIsValid && !myIsPlaneCustom)
+ myFirstShape = theFirstShape;
+ mySecondShape = theSecondShape;
+ myIsGeometryValid = InitTwoShapesPoints (myFirstShape, mySecondShape, aComputedPlane, isPlaneReturned);
+
+ if (myIsGeometryValid && !myIsPlaneCustom)
{
if (isPlaneReturned)
{
}
else
{
- myIsValid = Standard_False;
+ myIsGeometryValid = Standard_False;
}
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
//=======================================================================
void AIS_LengthDimension::SetTextPosition (const gp_Pnt& theTextPos)
{
- if (!myIsValid)
+ if (!IsValid())
{
return;
}
//=======================================================================
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
{
- myCircle = theCircle;
- myGeometryType = GeometryType_Edge;
- myShape = BRepLib_MakeEdge (theCircle);
- myAnchorPoint = ElCLib::Value (0, myCircle);
- myIsValid = IsValidCircle (myCircle);
+ myCircle = theCircle;
+ myGeometryType = GeometryType_Edge;
+ myShape = BRepLib_MakeEdge (theCircle);
+ myAnchorPoint = ElCLib::Value (0, myCircle);
+ myIsGeometryValid = IsValidCircle (myCircle);
- if (myIsValid)
+ if (myIsGeometryValid)
{
ComputePlane();
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
const gp_Pnt& theAnchorPoint)
{
- myCircle = theCircle;
- myGeometryType = GeometryType_Edge;
- myShape = BRepLib_MakeEdge (theCircle);
- myAnchorPoint = theAnchorPoint;
- myIsValid = IsValidCircle (myCircle) && IsValidAnchor (myCircle, theAnchorPoint);
+ myCircle = theCircle;
+ myGeometryType = GeometryType_Edge;
+ myShape = BRepLib_MakeEdge (theCircle);
+ myAnchorPoint = theAnchorPoint;
+ myIsGeometryValid = IsValidCircle (myCircle) && IsValidAnchor (myCircle, theAnchorPoint);
- if (myIsValid)
+ if (myIsGeometryValid)
{
ComputePlane();
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
void AIS_RadiusDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
{
Standard_Boolean isClosed = Standard_False;
- myShape = theShape;
- myGeometryType = GeometryType_UndefShapes;
- myIsValid = InitCircularDimension (theShape, myCircle, myAnchorPoint, isClosed)
- && IsValidCircle (myCircle);
+ myShape = theShape;
+ myGeometryType = GeometryType_UndefShapes;
+ myIsGeometryValid = InitCircularDimension (theShape, myCircle, myAnchorPoint, isClosed)
+ && IsValidCircle (myCircle);
- if (myIsValid)
+ if (myIsGeometryValid)
{
ComputePlane();
}
- myIsValid &= CheckPlane (myPlane);
-
SetToUpdate();
}
//=======================================================================
void AIS_RadiusDimension::ComputePlane()
{
- if (!IsValid())
+ if (!myIsGeometryValid)
{
return;
}
//=======================================================================
void AIS_RadiusDimension::SetTextPosition (const gp_Pnt& theTextPos)
{
- if (!myIsValid)
+ if (!myIsGeometryValid)
{
return;
}