mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024668: Null flyout value case in AIS_Dimension::SetTextPosition() method is not considered.
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
This commit is contained in:
parent
c69d58d816
commit
b0e6ae72af
@ -145,19 +145,17 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Edge& theFirstEdge,
|
|||||||
{
|
{
|
||||||
gp_Pln aComputedPlane;
|
gp_Pln aComputedPlane;
|
||||||
|
|
||||||
myFirstShape = theFirstEdge;
|
myFirstShape = theFirstEdge;
|
||||||
mySecondShape = theSecondEdge;
|
mySecondShape = theSecondEdge;
|
||||||
myThirdShape = TopoDS_Shape();
|
myThirdShape = TopoDS_Shape();
|
||||||
myGeometryType = GeometryType_Edges;
|
myGeometryType = GeometryType_Edges;
|
||||||
myIsValid = InitTwoEdgesAngle (aComputedPlane);
|
myIsGeometryValid = InitTwoEdgesAngle (aComputedPlane);
|
||||||
|
|
||||||
if (myIsValid && !myIsPlaneCustom)
|
if (myIsGeometryValid && !myIsPlaneCustom)
|
||||||
{
|
{
|
||||||
ComputePlane();
|
ComputePlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,15 +174,13 @@ void AIS_AngleDimension::SetMeasuredGeometry (const gp_Pnt& theFirstPoint,
|
|||||||
mySecondShape = BRepLib_MakeVertex (myCenterPoint);
|
mySecondShape = BRepLib_MakeVertex (myCenterPoint);
|
||||||
myThirdShape = BRepLib_MakeVertex (mySecondPoint);
|
myThirdShape = BRepLib_MakeVertex (mySecondPoint);
|
||||||
myGeometryType = GeometryType_Points;
|
myGeometryType = GeometryType_Points;
|
||||||
myIsValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
|
myIsGeometryValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
|
||||||
|
|
||||||
if (myIsValid && !myIsPlaneCustom)
|
if (myIsGeometryValid && !myIsPlaneCustom)
|
||||||
{
|
{
|
||||||
ComputePlane();
|
ComputePlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,22 +192,20 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Vertex& theFirstVerte
|
|||||||
const TopoDS_Vertex& theSecondVertex,
|
const TopoDS_Vertex& theSecondVertex,
|
||||||
const TopoDS_Vertex& theThirdVertex)
|
const TopoDS_Vertex& theThirdVertex)
|
||||||
{
|
{
|
||||||
myFirstShape = theFirstVertex;
|
myFirstShape = theFirstVertex;
|
||||||
mySecondShape = theSecondVertex;
|
mySecondShape = theSecondVertex;
|
||||||
myThirdShape = theThirdVertex;
|
myThirdShape = theThirdVertex;
|
||||||
myFirstPoint = BRep_Tool::Pnt (theFirstVertex);
|
myFirstPoint = BRep_Tool::Pnt (theFirstVertex);
|
||||||
myCenterPoint = BRep_Tool::Pnt (theSecondVertex);
|
myCenterPoint = BRep_Tool::Pnt (theSecondVertex);
|
||||||
mySecondPoint = BRep_Tool::Pnt (theThirdVertex);
|
mySecondPoint = BRep_Tool::Pnt (theThirdVertex);
|
||||||
myGeometryType = GeometryType_Points;
|
myGeometryType = GeometryType_Points;
|
||||||
myIsValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
|
myIsGeometryValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
|
||||||
|
|
||||||
if (myIsValid && !myIsPlaneCustom)
|
if (myIsGeometryValid && !myIsPlaneCustom)
|
||||||
{
|
{
|
||||||
ComputePlane();
|
ComputePlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,19 +215,17 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Vertex& theFirstVerte
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theCone)
|
void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theCone)
|
||||||
{
|
{
|
||||||
myFirstShape = theCone;
|
myFirstShape = theCone;
|
||||||
mySecondShape = TopoDS_Shape();
|
mySecondShape = TopoDS_Shape();
|
||||||
myThirdShape = TopoDS_Shape();
|
myThirdShape = TopoDS_Shape();
|
||||||
myGeometryType = GeometryType_Face;
|
myGeometryType = GeometryType_Face;
|
||||||
myIsValid = InitConeAngle();
|
myIsGeometryValid = InitConeAngle();
|
||||||
|
|
||||||
if (myIsValid && !myIsPlaneCustom)
|
if (myIsGeometryValid && !myIsPlaneCustom)
|
||||||
{
|
{
|
||||||
ComputePlane();
|
ComputePlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,19 +236,17 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theCone)
|
|||||||
void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
|
void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
|
||||||
const TopoDS_Face& theSecondFace)
|
const TopoDS_Face& theSecondFace)
|
||||||
{
|
{
|
||||||
myFirstShape = theFirstFace;
|
myFirstShape = theFirstFace;
|
||||||
mySecondShape = theSecondFace;
|
mySecondShape = theSecondFace;
|
||||||
myThirdShape = TopoDS_Shape();
|
myThirdShape = TopoDS_Shape();
|
||||||
myGeometryType = GeometryType_Faces;
|
myGeometryType = GeometryType_Faces;
|
||||||
myIsValid = InitTwoFacesAngle();
|
myIsGeometryValid = InitTwoFacesAngle();
|
||||||
|
|
||||||
if (myIsValid && !myIsPlaneCustom)
|
if (myIsGeometryValid && !myIsPlaneCustom)
|
||||||
{
|
{
|
||||||
ComputePlane();
|
ComputePlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,19 +258,17 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
|
|||||||
const TopoDS_Face& theSecondFace,
|
const TopoDS_Face& theSecondFace,
|
||||||
const gp_Pnt& thePoint)
|
const gp_Pnt& thePoint)
|
||||||
{
|
{
|
||||||
myFirstShape = theFirstFace;
|
myFirstShape = theFirstFace;
|
||||||
mySecondShape = theSecondFace;
|
mySecondShape = theSecondFace;
|
||||||
myThirdShape = TopoDS_Shape();
|
myThirdShape = TopoDS_Shape();
|
||||||
myGeometryType = GeometryType_Faces;
|
myGeometryType = GeometryType_Faces;
|
||||||
myIsValid = InitTwoFacesAngle (thePoint);
|
myIsGeometryValid = InitTwoFacesAngle (thePoint);
|
||||||
|
|
||||||
if (myIsValid && !myIsPlaneCustom)
|
if (myIsGeometryValid && !myIsPlaneCustom)
|
||||||
{
|
{
|
||||||
ComputePlane();
|
ComputePlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,7 +506,7 @@ Standard_Boolean AIS_AngleDimension::CheckPlane (const gp_Pln& thePlane)const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_AngleDimension::ComputePlane()
|
void AIS_AngleDimension::ComputePlane()
|
||||||
{
|
{
|
||||||
if (!IsValid())
|
if (!myIsGeometryValid)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -626,7 +614,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
|||||||
|
|
||||||
if (IsTextPositionCustom())
|
if (IsTextPositionCustom())
|
||||||
{
|
{
|
||||||
AdjustParameters (myFixedTextPosition,anExtensionSize, aHorisontalTextPos);
|
AdjustParameters (myFixedTextPosition,anExtensionSize, aHorisontalTextPos, myFlyout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle user-defined and automatic arrow placement
|
// Handle user-defined and automatic arrow placement
|
||||||
@ -810,7 +798,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
|||||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsComputed = Standard_True;
|
mySelectionGeom.IsComputed = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1243,12 +1231,13 @@ void AIS_AngleDimension::SetTextPosition (const gp_Pnt& theTextPos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : AdjustAspectParameters
|
//function : AdjustParameters
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_AngleDimension::AdjustParameters (const gp_Pnt& theTextPos,
|
void AIS_AngleDimension::AdjustParameters (const gp_Pnt& theTextPos,
|
||||||
Standard_Real& theExtensionSize,
|
Standard_Real& theExtensionSize,
|
||||||
Prs3d_DimensionTextHorizontalPosition& theAlignment)
|
Prs3d_DimensionTextHorizontalPosition& theAlignment,
|
||||||
|
Standard_Real& theFlyout) const
|
||||||
{
|
{
|
||||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||||
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
|
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
|
||||||
@ -1290,9 +1279,7 @@ void AIS_AngleDimension::AdjustParameters (const gp_Pnt& theTextPos,
|
|||||||
// Horizontal center
|
// Horizontal center
|
||||||
if (aTextPar > aParamBeg && aTextPar < aParamEnd)
|
if (aTextPar > aParamBeg && aTextPar < aParamEnd)
|
||||||
{
|
{
|
||||||
myFlyout = aRadius;
|
theFlyout = aRadius;
|
||||||
|
|
||||||
SetToUpdate();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1302,9 +1289,7 @@ void AIS_AngleDimension::AdjustParameters (const gp_Pnt& theTextPos,
|
|||||||
|
|
||||||
if (aTextPar > aParamBeg && aTextPar < aParamEnd)
|
if (aTextPar > aParamBeg && aTextPar < aParamEnd)
|
||||||
{
|
{
|
||||||
myFlyout = -aRadius;
|
theFlyout = -aRadius;
|
||||||
|
|
||||||
SetToUpdate();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1326,7 +1311,7 @@ void AIS_AngleDimension::AdjustParameters (const gp_Pnt& theTextPos,
|
|||||||
|
|
||||||
gp_Vec aPosFlyoutDir = gp_Vec (myCenterPoint, myFirstPoint).Normalized().Scaled (aRadius);
|
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;
|
? -aRadius : aRadius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1341,7 +1326,7 @@ void AIS_AngleDimension::AdjustParameters (const gp_Pnt& theTextPos,
|
|||||||
|
|
||||||
gp_Vec aPosFlyoutDir = gp_Vec (myCenterPoint, mySecondPoint).Normalized().Scaled (aRadius);
|
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;
|
? -aRadius : aRadius;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,13 +272,14 @@ protected:
|
|||||||
|
|
||||||
//! Adjusts aspect parameters according the text position:
|
//! Adjusts aspect parameters according the text position:
|
||||||
//! extension size, vertical text alignment and flyout.
|
//! 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 theTextPos [in] the user defined 3d point of text position.
|
||||||
//! @param theExtensionSize [out] the adjusted extension size.
|
//! @param theExtensionSize [out] the adjusted extension size.
|
||||||
//! @param theAlignment [out] the horizontal label alignment.
|
//! @param theAlignment [out] the horizontal label alignment.
|
||||||
|
//! @param theFlyout [out] the adjusted value of flyout.
|
||||||
Standard_EXPORT void AdjustParameters (const gp_Pnt& theTextPos,
|
Standard_EXPORT void AdjustParameters (const gp_Pnt& theTextPos,
|
||||||
Standard_Real& theExtensionSize,
|
Standard_Real& theExtensionSize,
|
||||||
Prs3d_DimensionTextHorizontalPosition& theAlignment);
|
Prs3d_DimensionTextHorizontalPosition& theAlignment,
|
||||||
|
Standard_Real& theFlyout) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -109,13 +109,13 @@ gp_Pnt AIS_DiameterDimension::AnchorPoint()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
||||||
{
|
{
|
||||||
myCircle = theCircle;
|
myCircle = theCircle;
|
||||||
myGeometryType = GeometryType_Edge;
|
myGeometryType = GeometryType_Edge;
|
||||||
myShape = BRepLib_MakeEdge (theCircle);
|
myShape = BRepLib_MakeEdge (theCircle);
|
||||||
myAnchorPoint = gp::Origin();
|
myAnchorPoint = gp::Origin();
|
||||||
myIsValid = IsValidCircle (myCircle);
|
myIsGeometryValid = IsValidCircle (myCircle);
|
||||||
|
|
||||||
if (myIsValid && myIsPlaneCustom)
|
if (myIsGeometryValid && myIsPlaneCustom)
|
||||||
{
|
{
|
||||||
ComputeAnchorPoint();
|
ComputeAnchorPoint();
|
||||||
}
|
}
|
||||||
@ -125,8 +125,6 @@ void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
|||||||
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,14 +137,14 @@ void AIS_DiameterDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
|
|||||||
gp_Pnt aDummyPnt (gp::Origin());
|
gp_Pnt aDummyPnt (gp::Origin());
|
||||||
Standard_Boolean isClosed = Standard_False;
|
Standard_Boolean isClosed = Standard_False;
|
||||||
|
|
||||||
myGeometryType = GeometryType_UndefShapes;
|
myGeometryType = GeometryType_UndefShapes;
|
||||||
myShape = theShape;
|
myShape = theShape;
|
||||||
myAnchorPoint = gp::Origin();
|
myAnchorPoint = gp::Origin();
|
||||||
myIsValid = InitCircularDimension (theShape, myCircle, aDummyPnt, isClosed)
|
myIsGeometryValid = InitCircularDimension (theShape, myCircle, aDummyPnt, isClosed)
|
||||||
&& IsValidCircle (myCircle)
|
&& IsValidCircle (myCircle)
|
||||||
&& isClosed;
|
&& isClosed;
|
||||||
|
|
||||||
if (myIsValid && myIsPlaneCustom)
|
if (myIsGeometryValid && myIsPlaneCustom)
|
||||||
{
|
{
|
||||||
ComputeAnchorPoint();
|
ComputeAnchorPoint();
|
||||||
}
|
}
|
||||||
@ -156,8 +154,6 @@ void AIS_DiameterDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
|
|||||||
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +178,7 @@ Standard_Boolean AIS_DiameterDimension::CheckPlane (const gp_Pln& thePlane) cons
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_DiameterDimension::ComputePlane()
|
void AIS_DiameterDimension::ComputePlane()
|
||||||
{
|
{
|
||||||
if (!IsValid())
|
if (!myIsGeometryValid)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -202,7 +198,7 @@ void AIS_DiameterDimension::ComputeAnchorPoint()
|
|||||||
GeomAPI_IntCS anIntersector (aCircle, aPlane);
|
GeomAPI_IntCS anIntersector (aCircle, aPlane);
|
||||||
if (!anIntersector.IsDone())
|
if (!anIntersector.IsDone())
|
||||||
{
|
{
|
||||||
myIsValid = Standard_False;
|
myIsGeometryValid = Standard_False;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +206,7 @@ void AIS_DiameterDimension::ComputeAnchorPoint()
|
|||||||
if (anIntersector.NbPoints() != 2)
|
if (anIntersector.NbPoints() != 2)
|
||||||
{
|
{
|
||||||
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
||||||
myIsValid = Standard_True;
|
myIsGeometryValid = Standard_True;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +375,7 @@ const gp_Pnt AIS_DiameterDimension::GetTextPosition() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_DiameterDimension::SetTextPosition (const gp_Pnt& theTextPos)
|
void AIS_DiameterDimension::SetTextPosition (const gp_Pnt& theTextPos)
|
||||||
{
|
{
|
||||||
if (!myIsValid)
|
if (!IsValid())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ AIS_Dimension::AIS_Dimension (const AIS_KindOfDimension theType)
|
|||||||
myGeometryType (GeometryType_UndefShapes),
|
myGeometryType (GeometryType_UndefShapes),
|
||||||
myIsPlaneCustom (Standard_False),
|
myIsPlaneCustom (Standard_False),
|
||||||
myFlyout (0.0),
|
myFlyout (0.0),
|
||||||
myIsValid (Standard_False),
|
myIsGeometryValid (Standard_False),
|
||||||
myKindOfDimension (theType)
|
myKindOfDimension (theType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -156,13 +156,12 @@ void AIS_Dimension::SetCustomPlane (const gp_Pln& thePlane)
|
|||||||
myPlane = thePlane;
|
myPlane = thePlane;
|
||||||
myIsPlaneCustom = Standard_True;
|
myIsPlaneCustom = Standard_True;
|
||||||
|
|
||||||
// Disable fixed text position
|
// Disable fixed (custom) text position
|
||||||
UnsetFixedTextPosition();
|
UnsetFixedTextPosition();
|
||||||
|
|
||||||
// Check validity if geometry has been set already.
|
// Check validity if geometry has been set already.
|
||||||
if (myIsValid)
|
if (IsValid())
|
||||||
{
|
{
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -650,9 +649,11 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
|||||||
Prs3d_DimensionTextHorizontalPosition aHorisontalTextPos = aDimensionAspect->TextHorizontalPosition();
|
Prs3d_DimensionTextHorizontalPosition aHorisontalTextPos = aDimensionAspect->TextHorizontalPosition();
|
||||||
if (IsTextPositionCustom())
|
if (IsTextPositionCustom())
|
||||||
{
|
{
|
||||||
AdjustParametersForLinear (myFixedTextPosition, theFirstPoint, theSecondPoint,
|
if (!AdjustParametersForLinear (myFixedTextPosition, theFirstPoint, theSecondPoint,
|
||||||
anExtensionSize, aHorisontalTextPos);
|
anExtensionSize, aHorisontalTextPos, myFlyout, myPlane, myIsPlaneCustom))
|
||||||
|
{
|
||||||
|
Standard_ProgramError::Raise ("Can not adjust plane to the custom label position.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FitTextAlignmentForLinear (theFirstPoint, theSecondPoint, theIsOneSide, aHorisontalTextPos,
|
FitTextAlignmentForLinear (theFirstPoint, theSecondPoint, theIsOneSide, aHorisontalTextPos,
|
||||||
@ -961,7 +962,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
|||||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsComputed = Standard_True;
|
mySelectionGeom.IsComputed = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1187,7 +1188,7 @@ Standard_Boolean AIS_Dimension::InitCircularDimension (const TopoDS_Shape& theSh
|
|||||||
void AIS_Dimension::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
void AIS_Dimension::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||||
const Standard_Integer theMode)
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
if (!myIsComputed)
|
if (!mySelectionGeom.IsComputed)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1350,7 +1351,7 @@ gp_Pnt AIS_Dimension::GetTextPositionForLinear (const gp_Pnt& theFirstPoint,
|
|||||||
const gp_Pnt& theSecondPoint,
|
const gp_Pnt& theSecondPoint,
|
||||||
const Standard_Boolean theIsOneSide) const
|
const Standard_Boolean theIsOneSide) const
|
||||||
{
|
{
|
||||||
if (!myIsValid)
|
if (!IsValid())
|
||||||
{
|
{
|
||||||
return gp::Origin();
|
return gp::Origin();
|
||||||
}
|
}
|
||||||
@ -1418,30 +1419,43 @@ gp_Pnt AIS_Dimension::GetTextPositionForLinear (const gp_Pnt& theFirstPoint,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : AdjustAspectParameters
|
//function : AdjustParametersForLinear
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_Dimension::AdjustParametersForLinear (const gp_Pnt& theTextPos,
|
Standard_Boolean AIS_Dimension::AdjustParametersForLinear (const gp_Pnt& theTextPos,
|
||||||
const gp_Pnt& theFirstPoint,
|
const gp_Pnt& theFirstPoint,
|
||||||
const gp_Pnt& theSecondPoint,
|
const gp_Pnt& theSecondPoint,
|
||||||
Standard_Real& theExtensionSize,
|
Standard_Real& theExtensionSize,
|
||||||
Prs3d_DimensionTextHorizontalPosition& theAlignment)
|
Prs3d_DimensionTextHorizontalPosition& theAlignment,
|
||||||
|
Standard_Real& theFlyout,
|
||||||
|
gp_Pln& thePlane,
|
||||||
|
Standard_Boolean& theIsPlaneOld) const
|
||||||
{
|
{
|
||||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||||
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
|
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_Dir aTargetPointsDir = gce_MakeDir (theFirstPoint, theSecondPoint);
|
||||||
gp_Vec aTargetPointsVec (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.
|
// Compute flyout direction vector.
|
||||||
|
gp_Dir aPlaneNormal = GetPlane().Axis().Direction();
|
||||||
gp_Dir aPositiveFlyout = aPlaneNormal ^ aTargetPointsDir;
|
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.
|
// Set flyout.
|
||||||
gp_Vec aFirstToTextVec (theFirstPoint, theTextPos);
|
gp_Vec aFirstToTextVec (theFirstPoint, theTextPos);
|
||||||
|
|
||||||
@ -1453,15 +1467,19 @@ void AIS_Dimension::AdjustParametersForLinear (const gp_Pnt& theTextPos,
|
|||||||
// Compute flyout value and direction.
|
// Compute flyout value and direction.
|
||||||
gp_Vec aFlyoutVector = gp_Vec (aTextPosProj, theTextPos);
|
gp_Vec aFlyoutVector = gp_Vec (aTextPosProj, theTextPos);
|
||||||
|
|
||||||
myFlyout = gp_Dir (aFlyoutVector).IsOpposite (aPositiveFlyout, Precision::Angular())
|
theFlyout = 0.0;
|
||||||
? -aFlyoutVector.Magnitude()
|
if (aFlyoutVector.Magnitude() > Precision::Confusion())
|
||||||
: aFlyoutVector.Magnitude();
|
{
|
||||||
|
theFlyout = gp_Dir (aFlyoutVector).IsOpposite (aPositiveFlyout, Precision::Angular())
|
||||||
|
? -aFlyoutVector.Magnitude()
|
||||||
|
: aFlyoutVector.Magnitude();
|
||||||
|
}
|
||||||
|
|
||||||
// Compute attach points (through which main dimension line passes).
|
// Compute attach points (through which main dimension line passes).
|
||||||
gp_Pnt aFirstAttach = theFirstPoint.Translated (aFlyoutVector);
|
gp_Pnt aFirstAttach = theFirstPoint.Translated (aFlyoutVector);
|
||||||
gp_Pnt aSecondAttach = theSecondPoint.Translated (aFlyoutVector);
|
gp_Pnt aSecondAttach = theSecondPoint.Translated (aFlyoutVector);
|
||||||
|
|
||||||
// Set horisontal text alignment.
|
// Set horizontal text alignment.
|
||||||
if (aCos < 0.0)
|
if (aCos < 0.0)
|
||||||
{
|
{
|
||||||
theAlignment = Prs3d_DTHP_Left;
|
theAlignment = Prs3d_DTHP_Left;
|
||||||
@ -1480,6 +1498,7 @@ void AIS_Dimension::AdjustParametersForLinear (const gp_Pnt& theTextPos,
|
|||||||
{
|
{
|
||||||
theAlignment = Prs3d_DTHP_Center;
|
theAlignment = Prs3d_DTHP_Center;
|
||||||
}
|
}
|
||||||
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -370,9 +370,9 @@ public:
|
|||||||
//! Check that the input geometry for dimension is valid and the
|
//! Check that the input geometry for dimension is valid and the
|
||||||
//! presentation can be successfully computed.
|
//! presentation can be successfully computed.
|
||||||
//! @return TRUE if dimension geometry is ok.
|
//! @return TRUE if dimension geometry is ok.
|
||||||
Standard_Boolean IsValid() const
|
virtual Standard_Boolean IsValid() const
|
||||||
{
|
{
|
||||||
return myIsValid;
|
return myIsGeometryValid && CheckPlane (GetPlane());
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -506,26 +506,31 @@ protected:
|
|||||||
//! @param theIsArrowExternal [out] is the arrows external,
|
//! @param theIsArrowExternal [out] is the arrows external,
|
||||||
//! if arrow orientation in the dimension aspect is Prs3d_DAO_Fit, it fits arrow
|
//! if arrow orientation in the dimension aspect is Prs3d_DAO_Fit, it fits arrow
|
||||||
//! orientation automatically.
|
//! orientation automatically.
|
||||||
void FitTextAlignmentForLinear (const gp_Pnt& theFirstPoint,
|
Standard_EXPORT void FitTextAlignmentForLinear (const gp_Pnt& theFirstPoint,
|
||||||
const gp_Pnt& theSecondPoint,
|
const gp_Pnt& theSecondPoint,
|
||||||
const Standard_Boolean theIsOneSide,
|
const Standard_Boolean theIsOneSide,
|
||||||
const Prs3d_DimensionTextHorizontalPosition& theHorizontalTextPos,
|
const Prs3d_DimensionTextHorizontalPosition& theHorizontalTextPos,
|
||||||
Standard_Integer& theLabelPosition,
|
Standard_Integer& theLabelPosition,
|
||||||
Standard_Boolean& theIsArrowsExternal) const;
|
Standard_Boolean& theIsArrowsExternal) const;
|
||||||
|
|
||||||
//! Adjusts aspect parameters according the text position:
|
//! Adjusts aspect parameters according the text position:
|
||||||
//! extension size, vertical text alignment and flyout.
|
//! 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 theTextPos [in] the user defined 3d point of text position
|
||||||
//! @param theFirstPoint [in] the first point of linear measurement.
|
//! @param theFirstPoint [in] the first point of linear measurement.
|
||||||
//! @param theSecondPoint [in] the second point of linear measurement.
|
//! @param theSecondPoint [in] the second point of linear measurement.
|
||||||
//! @param theExtensionSize [out] the adjusted extension size
|
//! @param theExtensionSize [out] the adjusted extension size
|
||||||
//! @param theAlignment [out] the horizontal label alignment.
|
//! @param theAlignment [out] the horizontal label alignment.
|
||||||
void AdjustParametersForLinear (const gp_Pnt& theTextPos,
|
//! @param theFlyout [out] the adjusted value of flyout.
|
||||||
const gp_Pnt& theFirstPoint,
|
//! @param thePlane [out] the new plane that contains theTextPos and attachment points.
|
||||||
const gp_Pnt& theSecondPoint,
|
//! @param theIsPlaneOld [out] shows if new plane is computed.
|
||||||
Standard_Real& theExtensionSize,
|
Standard_EXPORT Standard_Boolean AdjustParametersForLinear (const gp_Pnt& theTextPos,
|
||||||
Prs3d_DimensionTextHorizontalPosition& theAlignment);
|
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
|
protected: //! @name Behavior to implement
|
||||||
|
|
||||||
@ -587,6 +592,7 @@ protected: //! @name Selection geometry
|
|||||||
Standard_Real TextHeight; //!< Height of text label.
|
Standard_Real TextHeight; //!< Height of text label.
|
||||||
SeqOfCurves DimensionLine; //!< Sequence of points for composing the segments of dimension line.
|
SeqOfCurves DimensionLine; //!< Sequence of points for composing the segments of dimension line.
|
||||||
SeqOfArrows Arrows; //!< Sequence of arrow geometries.
|
SeqOfArrows Arrows; //!< Sequence of arrow geometries.
|
||||||
|
Standard_Boolean IsComputed; //!< Shows if the selection geometry was filled.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -607,6 +613,8 @@ protected: //! @name Selection geometry
|
|||||||
TextWidth = 0.0;
|
TextWidth = 0.0;
|
||||||
TextHeight = 0.0;
|
TextHeight = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IsComputed = Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Add new curve entry and return the reference to populate it.
|
//! Add new curve entry and return the reference to populate it.
|
||||||
@ -627,7 +635,6 @@ protected: //! @name Selection geometry
|
|||||||
} mySelectionGeom;
|
} mySelectionGeom;
|
||||||
|
|
||||||
Standard_Real mySelToleranceForText2d; //!< Sensitive point tolerance for 2d text selection.
|
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
|
protected: //! @name Value properties
|
||||||
|
|
||||||
@ -648,10 +655,10 @@ protected: //! @name Geometrical properties
|
|||||||
|
|
||||||
GeometryType myGeometryType; //!< defines type of shapes on which the dimension is to be built.
|
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).
|
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_Boolean myIsPlaneCustom; //!< Is plane defined by user (otherwise it will be computed automatically).
|
||||||
Standard_Real myFlyout; //!< Flyout distance.
|
Standard_Real myFlyout; //!< Flyout distance.
|
||||||
Standard_Boolean myIsValid; //!< Is dimension geometry properly defined.
|
Standard_Boolean myIsGeometryValid; //!< Is dimension geometry properly defined.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -108,13 +108,13 @@ void AIS_LengthDimension::SetMeasuredGeometry (const gp_Pnt& theFirstPoint,
|
|||||||
const gp_Pnt& theSecondPoint,
|
const gp_Pnt& theSecondPoint,
|
||||||
const gp_Pln& thePlane)
|
const gp_Pln& thePlane)
|
||||||
{
|
{
|
||||||
myFirstPoint = theFirstPoint;
|
myFirstPoint = theFirstPoint;
|
||||||
mySecondPoint = theSecondPoint;
|
mySecondPoint = theSecondPoint;
|
||||||
myFirstShape = BRepLib_MakeVertex (myFirstPoint);
|
myFirstShape = BRepLib_MakeVertex (myFirstPoint);
|
||||||
mySecondShape = BRepLib_MakeVertex (mySecondPoint);
|
mySecondShape = BRepLib_MakeVertex (mySecondPoint);
|
||||||
myGeometryType = GeometryType_Points;
|
myGeometryType = GeometryType_Points;
|
||||||
SetCustomPlane (thePlane);
|
SetCustomPlane (thePlane);
|
||||||
myIsValid = IsValidPoints (theFirstPoint, theSecondPoint) && CheckPlane (myPlane);
|
myIsGeometryValid = IsValidPoints (theFirstPoint, theSecondPoint);
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
@ -126,11 +126,11 @@ void AIS_LengthDimension::SetMeasuredGeometry (const gp_Pnt& theFirstPoint,
|
|||||||
void AIS_LengthDimension::SetMeasuredGeometry (const TopoDS_Edge& theEdge,
|
void AIS_LengthDimension::SetMeasuredGeometry (const TopoDS_Edge& theEdge,
|
||||||
const gp_Pln& thePlane)
|
const gp_Pln& thePlane)
|
||||||
{
|
{
|
||||||
myFirstShape = theEdge;
|
myFirstShape = theEdge;
|
||||||
mySecondShape = TopoDS_Shape();
|
mySecondShape = TopoDS_Shape();
|
||||||
myGeometryType = GeometryType_Edge;
|
myGeometryType = GeometryType_Edge;
|
||||||
SetCustomPlane (thePlane);
|
SetCustomPlane (thePlane);
|
||||||
myIsValid = InitOneShapePoints (myFirstShape) && CheckPlane (myPlane);
|
myIsGeometryValid = InitOneShapePoints (myFirstShape);
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
@ -164,11 +164,12 @@ void AIS_LengthDimension::SetMeasuredShapes (const TopoDS_Shape& theFirstShape,
|
|||||||
{
|
{
|
||||||
gp_Pln aComputedPlane;
|
gp_Pln aComputedPlane;
|
||||||
Standard_Boolean isPlaneReturned = Standard_False;
|
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)
|
if (isPlaneReturned)
|
||||||
{
|
{
|
||||||
@ -176,12 +177,10 @@ void AIS_LengthDimension::SetMeasuredShapes (const TopoDS_Shape& theFirstShape,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myIsValid = Standard_False;
|
myIsGeometryValid = Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,7 +729,7 @@ const gp_Pnt AIS_LengthDimension::GetTextPosition() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_LengthDimension::SetTextPosition (const gp_Pnt& theTextPos)
|
void AIS_LengthDimension::SetTextPosition (const gp_Pnt& theTextPos)
|
||||||
{
|
{
|
||||||
if (!myIsValid)
|
if (!IsValid())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -75,19 +75,17 @@ AIS_RadiusDimension::AIS_RadiusDimension (const TopoDS_Shape& theShape)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
||||||
{
|
{
|
||||||
myCircle = theCircle;
|
myCircle = theCircle;
|
||||||
myGeometryType = GeometryType_Edge;
|
myGeometryType = GeometryType_Edge;
|
||||||
myShape = BRepLib_MakeEdge (theCircle);
|
myShape = BRepLib_MakeEdge (theCircle);
|
||||||
myAnchorPoint = ElCLib::Value (0, myCircle);
|
myAnchorPoint = ElCLib::Value (0, myCircle);
|
||||||
myIsValid = IsValidCircle (myCircle);
|
myIsGeometryValid = IsValidCircle (myCircle);
|
||||||
|
|
||||||
if (myIsValid)
|
if (myIsGeometryValid)
|
||||||
{
|
{
|
||||||
ComputePlane();
|
ComputePlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,19 +96,17 @@ void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
|||||||
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
|
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
|
||||||
const gp_Pnt& theAnchorPoint)
|
const gp_Pnt& theAnchorPoint)
|
||||||
{
|
{
|
||||||
myCircle = theCircle;
|
myCircle = theCircle;
|
||||||
myGeometryType = GeometryType_Edge;
|
myGeometryType = GeometryType_Edge;
|
||||||
myShape = BRepLib_MakeEdge (theCircle);
|
myShape = BRepLib_MakeEdge (theCircle);
|
||||||
myAnchorPoint = theAnchorPoint;
|
myAnchorPoint = theAnchorPoint;
|
||||||
myIsValid = IsValidCircle (myCircle) && IsValidAnchor (myCircle, theAnchorPoint);
|
myIsGeometryValid = IsValidCircle (myCircle) && IsValidAnchor (myCircle, theAnchorPoint);
|
||||||
|
|
||||||
if (myIsValid)
|
if (myIsGeometryValid)
|
||||||
{
|
{
|
||||||
ComputePlane();
|
ComputePlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,18 +117,16 @@ void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
|
|||||||
void AIS_RadiusDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
|
void AIS_RadiusDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
|
||||||
{
|
{
|
||||||
Standard_Boolean isClosed = Standard_False;
|
Standard_Boolean isClosed = Standard_False;
|
||||||
myShape = theShape;
|
myShape = theShape;
|
||||||
myGeometryType = GeometryType_UndefShapes;
|
myGeometryType = GeometryType_UndefShapes;
|
||||||
myIsValid = InitCircularDimension (theShape, myCircle, myAnchorPoint, isClosed)
|
myIsGeometryValid = InitCircularDimension (theShape, myCircle, myAnchorPoint, isClosed)
|
||||||
&& IsValidCircle (myCircle);
|
&& IsValidCircle (myCircle);
|
||||||
|
|
||||||
if (myIsValid)
|
if (myIsGeometryValid)
|
||||||
{
|
{
|
||||||
ComputePlane();
|
ComputePlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsValid &= CheckPlane (myPlane);
|
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +152,7 @@ Standard_Boolean AIS_RadiusDimension::CheckPlane (const gp_Pln& thePlane) const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_RadiusDimension::ComputePlane()
|
void AIS_RadiusDimension::ComputePlane()
|
||||||
{
|
{
|
||||||
if (!IsValid())
|
if (!myIsGeometryValid)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -284,7 +278,7 @@ const gp_Pnt AIS_RadiusDimension::GetTextPosition() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_RadiusDimension::SetTextPosition (const gp_Pnt& theTextPos)
|
void AIS_RadiusDimension::SetTextPosition (const gp_Pnt& theTextPos)
|
||||||
{
|
{
|
||||||
if (!myIsValid)
|
if (!myIsGeometryValid)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user