mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0024389: Invalid hilight of AIS dimension line in local selection
- Fixed invalid presentation of dimension highlight. - Fixed bug on switching between selection modes. Individual sensitive entities generated for each selection mode. - Revised selection: AIS_DimensionSelectionMode enumeration added, redundant AIS_DimensionDisplayMode is removed. - Revised entity owner usage: used standard SelectMgr_EntityOwner for neutral selection, AIS_DimensionOwner for "line", "text" selection modes. - Made arrows selectable. - Got rid of predefined arrow angle. The arrow angle is now taken from dimension aspect. - The 3D text is now centered by bounding box for better alignment.
This commit is contained in:
parent
73cd8a8afd
commit
fe83e1ea69
@ -321,8 +321,8 @@ is
|
||||
enumeration DisplaySpecialSymbol is DSS_No, DSS_Before, DSS_After;
|
||||
---Purpose: Specifies dimension special symbol display options
|
||||
|
||||
enumeration DimensionDisplayMode is DDM_All, DDM_Line, DDM_Text;
|
||||
---Purpose: Specifies dimension display modes for advanced highlighting and selection.
|
||||
enumeration DimensionSelectionMode is DSM_All, DSM_Line, DSM_Text;
|
||||
---Purpose: Specifies dimension selection modes.
|
||||
|
||||
class Triangulation;
|
||||
|
||||
|
@ -28,6 +28,12 @@
|
||||
#include <ElCLib.hxx>
|
||||
#include <gce_MakeLin2d.hxx>
|
||||
#include <gce_MakeCone.hxx>
|
||||
#include <gce_MakePln.hxx>
|
||||
#include <gce_MakeCirc.hxx>
|
||||
#include <gce_MakeDir.hxx>
|
||||
#include <GC_MakeArcOfCircle.hxx>
|
||||
#include <GCPnts_UniformAbscissa.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
@ -53,8 +59,10 @@ IMPLEMENT_STANDARD_RTTIEXT (AIS_AngleDimension, AIS_Dimension)
|
||||
|
||||
namespace
|
||||
{
|
||||
static const TCollection_ExtendedString THE_EMPTY_LABEL;
|
||||
static const Standard_ExtCharacter THE_DEGREE_SYMBOL (0x00B0);
|
||||
static const TCollection_ExtendedString THE_EMPTY_LABEL_STRING;
|
||||
static const Standard_Real THE_EMPTY_LABEL_WIDTH = 0.0;
|
||||
static const Standard_ExtCharacter THE_DEGREE_SYMBOL (0x00B0);
|
||||
static const Standard_Real THE_3D_TEXT_MARGIN = 0.1;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
@ -305,6 +313,7 @@ Standard_Boolean AIS_AngleDimension::initTwoFacesAngle ()
|
||||
TopoDS_Face aSecondFace = TopoDS::Face (mySecondShape);
|
||||
gp_Dir aFirstDir, aSecondDir;
|
||||
gp_Pln aFirstPlane, aSecondPlane;
|
||||
gp_Pnt aTextPos;
|
||||
Handle(Geom_Surface) aFirstBasisSurf, aSecondBasisSurf;
|
||||
AIS_KindOfSurface aFirstSurfType, aSecondSurfType;
|
||||
Standard_Real aFirstOffset, aSecondOffset;
|
||||
@ -323,7 +332,7 @@ Standard_Boolean AIS_AngleDimension::initTwoFacesAngle ()
|
||||
GetWorkingPlane().Axis(),
|
||||
myValue,
|
||||
Standard_True,
|
||||
myGeom.myTextPosition,
|
||||
aTextPos,
|
||||
myCenter,
|
||||
myFirstPoint,
|
||||
mySecondPoint,
|
||||
@ -343,7 +352,7 @@ Standard_Boolean AIS_AngleDimension::initTwoFacesAngle ()
|
||||
GetWorkingPlane().Axis(),
|
||||
myValue,
|
||||
Standard_True,
|
||||
myGeom.myTextPosition,
|
||||
aTextPos,
|
||||
myCenter,
|
||||
myFirstPoint,
|
||||
mySecondPoint,
|
||||
@ -572,67 +581,81 @@ void AIS_AngleDimension::drawArcWithText (const Handle(Prs3d_Presentation)& theP
|
||||
const gp_Pnt& theFirstAttach,
|
||||
const gp_Pnt& theSecondAttach,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const AIS_DimensionDisplayMode theMode,
|
||||
const Standard_Real theTextWidth,
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Integer theLabelPosition)
|
||||
{
|
||||
gp_Pnt2d aCenter2d = ProjLib::Project (GetWorkingPlane(), myCenter),
|
||||
aFirstAttach2d = ProjLib::Project (GetWorkingPlane(), theFirstAttach),
|
||||
aSecondAttach2d = ProjLib::Project (GetWorkingPlane(), theSecondAttach);
|
||||
gp_Lin2d anAttachLine2d = gce_MakeLin2d (aFirstAttach2d, aSecondAttach2d);
|
||||
|
||||
// Getting text center
|
||||
gp_Pnt2d aTextCenterPnt = ElCLib::Value ((ElCLib::Parameter (anAttachLine2d, aFirstAttach2d) + ElCLib::Parameter (anAttachLine2d, aSecondAttach2d)) / 2., anAttachLine2d);
|
||||
gp_Lin2d aCenterToTextCenterLin = gce_MakeLin2d (aCenter2d, aTextCenterPnt);
|
||||
|
||||
// Drawing circle
|
||||
Standard_Real aRadius = theFirstAttach.Distance (myCenter);
|
||||
gp_Circ2d aCircle (gp_Ax22d (aCenter2d, gp_Dir2d (1, 0)), aRadius);
|
||||
|
||||
// Getting text position in the center of arc
|
||||
IntAna2d_AnaIntersection anInt2d (aCenterToTextCenterLin, aCircle);
|
||||
gp_Pnt2d aTextCenterOnArc2d;
|
||||
if (anInt2d.IsDone())
|
||||
if (!anInt2d.IsEmpty())
|
||||
aTextCenterOnArc2d = gp_Pnt2d (anInt2d.Point (1).Value());
|
||||
myGeom.myTextPosition = ElCLib::To3d (GetWorkingPlane().Position().Ax2(), aTextCenterOnArc2d);
|
||||
|
||||
// Drawing text
|
||||
gp_Vec aVec (theFirstAttach, theSecondAttach);
|
||||
Standard_Real aTextWidth = drawText (thePresentation,
|
||||
myIsTextReversed ? aVec.Reversed() : aVec,
|
||||
theText, theMode,
|
||||
theLabelPosition);
|
||||
|
||||
// Getting text begin and end points
|
||||
gp_Pnt2d aTextBeginPnt = ElCLib::Value ((ElCLib::Parameter (anAttachLine2d, aFirstAttach2d) +
|
||||
ElCLib::Parameter (anAttachLine2d, aSecondAttach2d) -
|
||||
aTextWidth) / 2., anAttachLine2d),
|
||||
aTextEndPnt = ElCLib::Value (ElCLib::Parameter (anAttachLine2d,aTextBeginPnt) + aTextWidth, anAttachLine2d);
|
||||
|
||||
|
||||
gp_Lin2d aCenterToTextBeginLin = gce_MakeLin2d (aCenter2d, aTextBeginPnt),
|
||||
aCenterToTextEndLin = gce_MakeLin2d (aCenter2d, aTextEndPnt);
|
||||
|
||||
// Text begin and end on the dimension arc
|
||||
gp_Pnt2d aTextBeginOnArc2d, aTextEndOnArc2d;
|
||||
anInt2d.Perform (aCenterToTextBeginLin, aCircle);
|
||||
if (anInt2d.IsDone())
|
||||
if (!anInt2d.IsEmpty())
|
||||
aTextBeginOnArc2d = gp_Pnt2d (anInt2d.Point (1).Value());
|
||||
|
||||
anInt2d.Perform (aCenterToTextEndLin, aCircle);
|
||||
if (anInt2d.IsDone())
|
||||
if (!anInt2d.IsEmpty())
|
||||
aTextEndOnArc2d = gp_Pnt2d (anInt2d.Point (1).Value());
|
||||
|
||||
gp_Pnt aTextBeginOnArc = ElCLib::To3d (GetWorkingPlane().Position().Ax2(), aTextBeginOnArc2d);
|
||||
gp_Pnt aTextEndOnArc = ElCLib::To3d (GetWorkingPlane().Position().Ax2(), aTextEndOnArc2d);
|
||||
|
||||
// Drawing arcs
|
||||
if (theMode != AIS_DDM_Text)
|
||||
// construct plane where the circle and the arc are located
|
||||
gce_MakePln aConstructPlane (theFirstAttach, theSecondAttach, myCenter);
|
||||
if (!aConstructPlane.IsDone())
|
||||
{
|
||||
drawArc (thePresentation, theFirstAttach, aTextBeginOnArc, myCenter, aRadius, theMode);
|
||||
drawArc (thePresentation, aTextEndOnArc, theSecondAttach, myCenter, aRadius, theMode);
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Pln aPlane = aConstructPlane.Value();
|
||||
|
||||
Standard_Real aRadius = theFirstAttach.Distance (myCenter);
|
||||
|
||||
// construct circle forming the arc
|
||||
gce_MakeCirc aConstructCircle (myCenter, aPlane, aRadius);
|
||||
if (!aConstructCircle.IsDone())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Circ aCircle = aConstructCircle.Value();
|
||||
|
||||
// compute angle parameters of arc end-points on circle
|
||||
Standard_Real aParamBeg = ElCLib::Parameter (aCircle, theFirstAttach);
|
||||
Standard_Real aParamEnd = ElCLib::Parameter (aCircle, theSecondAttach);
|
||||
ElCLib::AdjustPeriodic (aParamBeg, aParamEnd,
|
||||
Precision::PConfusion(),
|
||||
aParamBeg, aParamEnd);
|
||||
|
||||
// middle point of arc parameter on circle
|
||||
Standard_Real aParamMid = (aParamBeg + aParamEnd) * 0.5;
|
||||
|
||||
// add text graphical primitives
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
|
||||
{
|
||||
gp_Pnt aTextPos = ElCLib::Value (aParamMid, aCircle);
|
||||
gp_Dir aTextDir = IsTextReversed()
|
||||
? gce_MakeDir (theSecondAttach, theFirstAttach)
|
||||
: gce_MakeDir (theFirstAttach, theSecondAttach);
|
||||
|
||||
// Drawing text
|
||||
drawText (thePresentation,
|
||||
aTextPos,
|
||||
aTextDir,
|
||||
theText,
|
||||
theLabelPosition);
|
||||
}
|
||||
|
||||
if (theMode != ComputeMode_All && theMode != ComputeMode_Line)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||
|
||||
Standard_Boolean isLineBreak = aDimensionAspect->TextVerticalPosition() == Prs3d_DTVP_Center
|
||||
&& aDimensionAspect->IsText3d();
|
||||
|
||||
if (isLineBreak)
|
||||
{
|
||||
// compute gap for label as parameteric size of sector on circle segment
|
||||
Standard_Real aSectorOnCircle = theTextWidth / aRadius;
|
||||
|
||||
gp_Pnt aTextPntBeg = ElCLib::Value (aParamMid - aSectorOnCircle * 0.5, aCircle);
|
||||
gp_Pnt aTextPntEnd = ElCLib::Value (aParamMid + aSectorOnCircle * 0.5, aCircle);
|
||||
|
||||
// Drawing arcs
|
||||
drawArc (thePresentation, theFirstAttach, aTextPntBeg, myCenter, aRadius, theMode);
|
||||
drawArc (thePresentation, theSecondAttach, aTextPntEnd, myCenter, aRadius, theMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawArc (thePresentation, theFirstAttach, theSecondAttach, myCenter, aRadius, theMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -645,48 +668,74 @@ void AIS_AngleDimension::drawArc (const Handle(Prs3d_Presentation)& thePresentat
|
||||
const gp_Pnt& theSecondAttach,
|
||||
const gp_Pnt& theCenter,
|
||||
const Standard_Real theRadius,
|
||||
const AIS_DimensionDisplayMode theMode)
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anEmptyOwner;
|
||||
|
||||
gp_Vec aCenterToFirstVec (theCenter,theFirstAttach);
|
||||
gp_Vec aCenterToSecondVec (theCenter,theSecondAttach);
|
||||
gp_Dir aCenterToFirstDir (aCenterToFirstVec);
|
||||
gp_Dir aPlaneNormal = GetWorkingPlane().Axis().Direction();
|
||||
gp_Dir aCenterToSecondDir = aPlaneNormal.Crossed (aCenterToFirstDir);
|
||||
|
||||
const Standard_Real anAngle = aCenterToFirstVec.Angle(aCenterToSecondVec);
|
||||
const Standard_Integer aPointsOnArc = Max (4 , Standard_Integer (50. * anAngle / M_PI));
|
||||
const Standard_Real anAngleStep = anAngle / (aPointsOnArc - 1);
|
||||
TColgp_Array1OfPnt aPointArray (0,aPointsOnArc-1);
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrimSegments = new Graphic3d_ArrayOfPolylines (aPointsOnArc,2);
|
||||
aPrimSegments->AddVertex (theFirstAttach);
|
||||
aPointArray.SetValue(0, theFirstAttach);
|
||||
gp_Pnt aPoint = theFirstAttach;
|
||||
gp_Vec aVector;
|
||||
|
||||
for (Standard_Integer anI = 1; anI < aPointsOnArc - 1; ++anI)
|
||||
// construct plane where the circle and the arc are located
|
||||
gce_MakePln aConstructPlane (theFirstAttach, theSecondAttach, theCenter);
|
||||
if (!aConstructPlane.IsDone())
|
||||
{
|
||||
aVector = (gp_Vec(aCenterToFirstDir) * Cos ( (anI - 1) * anAngleStep) + gp_Vec(aCenterToSecondDir) * Sin ( (anI - 1) * anAngleStep)) * theRadius;
|
||||
aPoint = theCenter.Translated(aVector);
|
||||
aPrimSegments->AddVertex(aPoint);
|
||||
aPointArray.SetValue (anI,aPoint);
|
||||
return;
|
||||
}
|
||||
aPrimSegments->AddVertex (theSecondAttach);
|
||||
aPointArray.SetValue (aPointsOnArc - 1,theSecondAttach);
|
||||
|
||||
// Fill sensitive list
|
||||
myGeom.mySensitiveSegments.Append(new Select3D_SensitiveCurve(anEmptyOwner,aPointArray));
|
||||
gp_Pln aPlane = aConstructPlane.Value();
|
||||
|
||||
// Fill display presentation
|
||||
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == AIS_DDM_All)
|
||||
// construct circle forming the arc
|
||||
gce_MakeCirc aConstructCircle (theCenter, aPlane, theRadius);
|
||||
if (!aConstructCircle.IsDone())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Circ aCircle = aConstructCircle.Value();
|
||||
|
||||
// construct the arc
|
||||
GC_MakeArcOfCircle aConstructArc (aCircle, theFirstAttach, theSecondAttach, Standard_True);
|
||||
if (!aConstructArc.IsDone())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// generate points with specified deflection
|
||||
const Handle(Geom_TrimmedCurve)& anArcCurve = aConstructArc.Value();
|
||||
|
||||
GeomAdaptor_Curve anArcAdaptor (anArcCurve, anArcCurve->FirstParameter(), anArcCurve->LastParameter());
|
||||
|
||||
// compute number of discretization elements in old-fanshioned way
|
||||
gp_Vec aCenterToFirstVec (theCenter, theFirstAttach);
|
||||
gp_Vec aCenterToSecondVec (theCenter, theSecondAttach);
|
||||
const Standard_Real anAngle = aCenterToFirstVec.Angle (aCenterToSecondVec);
|
||||
const Standard_Integer aNbPoints = Max (4, Standard_Integer (50.0 * anAngle / M_PI));
|
||||
|
||||
GCPnts_UniformAbscissa aMakePnts (anArcAdaptor, aNbPoints);
|
||||
if (!aMakePnts.IsDone())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// init data arrays for graphical and selection primitives
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrimSegments = new Graphic3d_ArrayOfPolylines (aNbPoints);
|
||||
|
||||
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
|
||||
|
||||
// load data into arrays
|
||||
for (Standard_Integer aPntIt = 1; aPntIt <= aMakePnts.NbPoints(); ++aPntIt)
|
||||
{
|
||||
gp_Pnt aPnt = anArcAdaptor.Value (aMakePnts.Parameter (aPntIt));
|
||||
|
||||
aPrimSegments->AddVertex (aPnt);
|
||||
|
||||
aSensitiveCurve.Append (aPnt);
|
||||
}
|
||||
|
||||
// add display presentation
|
||||
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_True);
|
||||
}
|
||||
Handle(Graphic3d_AspectLine3d) aDimensionLineStyle = myDrawer->DimensionAspect()->LineAspect()->Aspect();
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionLineStyle);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == AIS_DDM_All)
|
||||
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_False);
|
||||
}
|
||||
@ -701,7 +750,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePresentation->Clear();
|
||||
myGeom.mySensitiveSegments.Clear();
|
||||
mySelectionGeom.Clear (theMode);
|
||||
Handle(SelectMgr_EntityOwner) anEmptyOwner;
|
||||
|
||||
if (!myIsInitialized)
|
||||
@ -752,6 +801,12 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
Standard_Real aTextLength;
|
||||
getTextWidthAndString (aTextLength, aValueString);
|
||||
|
||||
// add margins to label width
|
||||
if (aDimensionAspect->IsText3d())
|
||||
{
|
||||
aTextLength += aDimensionAspect->TextAspect()->Height() * THE_3D_TEXT_MARGIN * 2.0;
|
||||
}
|
||||
|
||||
if (!myIsWorkingPlaneCustom)
|
||||
{
|
||||
countDefaultPlane();
|
||||
@ -770,7 +825,13 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
{
|
||||
gp_Vec anAttachVector (aFirstAttach, aSecondAttach);
|
||||
Standard_Real aDimensionWidth = anAttachVector.Magnitude();
|
||||
Standard_Real anArrowsWidth = anArrowLength * 2.0;
|
||||
|
||||
// add margin to ensure a small tail between text and arrow
|
||||
Standard_Real anArrowMargin = aDimensionAspect->IsText3d()
|
||||
? aDimensionAspect->TextAspect()->Height() * THE_3D_TEXT_MARGIN
|
||||
: 0.0;
|
||||
|
||||
Standard_Real anArrowsWidth = (anArrowLength + anArrowMargin) * 2.0;
|
||||
|
||||
isArrowsExternal = aDimensionWidth < aTextLength + anArrowsWidth;
|
||||
break;
|
||||
@ -850,31 +911,35 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
aFirstAttach,
|
||||
aSecondAttach,
|
||||
aValueString,
|
||||
(AIS_DimensionDisplayMode)theMode,
|
||||
aTextLength,
|
||||
theMode,
|
||||
aLabelPosition);
|
||||
break;
|
||||
}
|
||||
|
||||
gp_Vec aTextDir (aFirstArrowEnd, aSecondArrowBegin);
|
||||
myGeom.myTextPosition = getCenterOnArc (aFirstArrowEnd, aSecondArrowBegin);
|
||||
|
||||
drawText (thePresentation,
|
||||
myIsTextReversed ? aTextDir.Reversed() : aTextDir,
|
||||
aValueString,
|
||||
(AIS_DimensionDisplayMode)theMode,
|
||||
aLabelPosition);
|
||||
|
||||
if (theMode == AIS_DDM_Text)
|
||||
// compute text primitives
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
|
||||
{
|
||||
break;
|
||||
gp_Vec aDimensionDir (aFirstArrowEnd, aSecondArrowBegin);
|
||||
gp_Pnt aTextPos = getCenterOnArc (aFirstArrowEnd, aSecondArrowBegin);
|
||||
gp_Dir aTextDir = myIsTextReversed ? aDimensionDir.Reversed() : aDimensionDir;
|
||||
|
||||
drawText (thePresentation,
|
||||
aTextPos,
|
||||
aTextDir,
|
||||
aValueString,
|
||||
aLabelPosition);
|
||||
}
|
||||
|
||||
drawArc (thePresentation,
|
||||
isArrowsExternal ? aFirstAttach : aFirstArrowEnd,
|
||||
isArrowsExternal ? aSecondAttach : aSecondArrowEnd,
|
||||
myCenter,
|
||||
Abs (GetFlyout()),
|
||||
(AIS_DimensionDisplayMode)theMode);
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
|
||||
{
|
||||
drawArc (thePresentation,
|
||||
isArrowsExternal ? aFirstAttach : aFirstArrowEnd,
|
||||
isArrowsExternal ? aSecondAttach : aSecondArrowEnd,
|
||||
myCenter,
|
||||
Abs (GetFlyout()),
|
||||
theMode);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -885,7 +950,8 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
isArrowsExternal ? aFirstArrowEnd : aFirstAttach,
|
||||
aFirstExtensionDir,
|
||||
aValueString,
|
||||
(AIS_DimensionDisplayMode)theMode,
|
||||
aTextLength,
|
||||
theMode,
|
||||
aLabelPosition);
|
||||
}
|
||||
break;
|
||||
@ -897,14 +963,15 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
isArrowsExternal ? aSecondArrowEnd : aSecondAttach,
|
||||
aSecondExtensionDir,
|
||||
aValueString,
|
||||
(AIS_DimensionDisplayMode)theMode,
|
||||
aTextLength,
|
||||
theMode,
|
||||
aLabelPosition);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// dimension arc without text
|
||||
if (theMode != AIS_DDM_Text && aHPosition != LabelPosition_HCenter)
|
||||
if ((theMode == ComputeMode_All || theMode == ComputeMode_Line) && aHPosition != LabelPosition_HCenter)
|
||||
{
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
@ -913,11 +980,11 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
isArrowsExternal ? aSecondAttach : aSecondArrowEnd,
|
||||
myCenter,
|
||||
Abs(GetFlyout ()),
|
||||
(AIS_DimensionDisplayMode)theMode);
|
||||
theMode);
|
||||
}
|
||||
|
||||
// arrows and arrow extensions
|
||||
if (theMode != AIS_DDM_Text)
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
|
||||
{
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
@ -925,7 +992,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
drawArrow (thePresentation, aSecondArrowBegin, gp_Dir (aSecondArrowVec));
|
||||
}
|
||||
|
||||
if (theMode != AIS_DDM_Text && isArrowsExternal)
|
||||
if ((theMode == ComputeMode_All || theMode == ComputeMode_Line) && isArrowsExternal)
|
||||
{
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
@ -935,8 +1002,9 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
anExtensionSize,
|
||||
aFirstArrowEnd,
|
||||
aFirstExtensionDir,
|
||||
THE_EMPTY_LABEL,
|
||||
(AIS_DimensionDisplayMode)theMode,
|
||||
THE_EMPTY_LABEL_STRING,
|
||||
THE_EMPTY_LABEL_WIDTH,
|
||||
theMode,
|
||||
LabelPosition_None);
|
||||
}
|
||||
|
||||
@ -946,14 +1014,15 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
anExtensionSize,
|
||||
aSecondArrowEnd,
|
||||
aSecondExtensionDir,
|
||||
THE_EMPTY_LABEL,
|
||||
(AIS_DimensionDisplayMode)theMode,
|
||||
THE_EMPTY_LABEL_STRING,
|
||||
THE_EMPTY_LABEL_WIDTH,
|
||||
theMode,
|
||||
LabelPosition_None);
|
||||
}
|
||||
}
|
||||
|
||||
// flyouts
|
||||
if (theMode == AIS_DDM_All && myIsFlyoutLines)
|
||||
if (theMode == ComputeMode_All && myIsFlyoutLines)
|
||||
{
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
@ -976,17 +1045,19 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
//purpose : computes selection for flyouts
|
||||
//=======================================================================
|
||||
void AIS_AngleDimension::computeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(AIS_DimensionOwner)& theOwner)
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner)
|
||||
{
|
||||
if (!myIsFlyoutLines)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!myIsFlyoutLines)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Pnt aFirstAttach = myCenter.Translated (gp_Vec (myCenter, myFirstPoint).Normalized() * GetFlyout());
|
||||
gp_Pnt aSecondAttach = myCenter.Translated (gp_Vec (myCenter, mySecondPoint).Normalized() * GetFlyout());
|
||||
Handle(Select3D_SensitiveGroup) aSensitiveEntity = new Select3D_SensitiveGroup (theOwner);
|
||||
aSensitiveEntity->Add (new Select3D_SensitiveSegment (theOwner, myCenter, aFirstAttach));
|
||||
aSensitiveEntity->Add (new Select3D_SensitiveSegment (theOwner, myCenter, aSecondAttach));
|
||||
theSelection->Add (aSensitiveEntity);
|
||||
gp_Pnt aFirstAttach = myCenter.Translated (gp_Vec (myCenter, myFirstPoint).Normalized() * GetFlyout());
|
||||
gp_Pnt aSecondAttach = myCenter.Translated (gp_Vec (myCenter, mySecondPoint).Normalized() * GetFlyout());
|
||||
|
||||
Handle(Select3D_SensitiveGroup) aSensitiveEntity = new Select3D_SensitiveGroup (theOwner);
|
||||
aSensitiveEntity->Add (new Select3D_SensitiveSegment (theOwner, myCenter, aFirstAttach));
|
||||
aSensitiveEntity->Add (new Select3D_SensitiveSegment (theOwner, myCenter, aSecondAttach));
|
||||
|
||||
theSelection->Add (aSensitiveEntity);
|
||||
}
|
||||
|
@ -101,13 +101,14 @@ protected:
|
||||
const gp_Pnt& theSecondAttach,
|
||||
const gp_Pnt& theCenter,
|
||||
const Standard_Real theRadius,
|
||||
const AIS_DimensionDisplayMode theMode);
|
||||
const Standard_Integer theMode);
|
||||
|
||||
Standard_EXPORT void drawArcWithText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theFirstAttach,
|
||||
const gp_Pnt& theSecondAttach,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const AIS_DimensionDisplayMode theMode,
|
||||
const Standard_Real theTextWidth,
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Integer theLabelPosition);
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
@ -134,7 +135,7 @@ protected:
|
||||
|
||||
//! Fills sensitive entity for flyouts and adds it to the selection
|
||||
Standard_EXPORT virtual void computeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(AIS_DimensionOwner)& theOwner);
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -108,6 +108,7 @@ void AIS_DiameterDimension::Compute (const Handle(PrsMgr_PresentationManager3d)&
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePresentation->Clear();
|
||||
mySelectionGeom.Clear (theMode);
|
||||
|
||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
@ -126,7 +127,7 @@ void AIS_DiameterDimension::Compute (const Handle(PrsMgr_PresentationManager3d)&
|
||||
countDefaultPlane();
|
||||
}
|
||||
|
||||
drawLinearDimension (thePresentation, (AIS_DimensionDisplayMode)theMode);
|
||||
drawLinearDimension (thePresentation, theMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -42,7 +42,8 @@ public:
|
||||
//! Constructs a diameter display object defined by the <br>
|
||||
//! circle <theCircle>
|
||||
Standard_EXPORT AIS_DiameterDimension(const gp_Circ& theCircle);
|
||||
//! Consctructor that allows to set a attach point <br>
|
||||
|
||||
//! Constructor that allows to set a attach point <br>
|
||||
//! on the circle <theCircle> where to attach dimension
|
||||
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@
|
||||
#ifndef _AIS_Dimension_Headerfile
|
||||
#define _AIS_Dimension_Headerfile
|
||||
|
||||
#include <AIS_DimensionDisplayMode.hxx>
|
||||
#include <AIS_DimensionSelectionMode.hxx>
|
||||
#include <AIS_DimensionOwner.hxx>
|
||||
#include <AIS_DisplaySpecialSymbol.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
@ -38,9 +38,11 @@
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TColgp_HSequenceOfPnt.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <NCollection_Handle.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_Dimension, AIS_InteractiveObject)
|
||||
|
||||
@ -65,6 +67,18 @@ protected:
|
||||
LabelPosition_VMask = LabelPosition_Above | LabelPosition_Below | LabelPosition_VCenter
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Specifies supported presentation compute modes.
|
||||
//! Used to compute only parts of presentation for
|
||||
//! advanced highlighting.
|
||||
enum ComputeMode
|
||||
{
|
||||
ComputeMode_All = 0, //!< "0" is reserved as neutral mode
|
||||
ComputeMode_Line = 1, //!< corresponds to selection mode
|
||||
ComputeMode_Text = 2 //!< corresponds to selection mode
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor with default parameters values
|
||||
@ -136,7 +150,7 @@ public:
|
||||
//! shows if Units are to be displayed along with dimension value
|
||||
Standard_EXPORT Standard_Boolean IsUnitsDisplayed() const;
|
||||
|
||||
//! sets to display units along with the dimansion value or no
|
||||
//! sets to display units along with the dimension value or no
|
||||
Standard_EXPORT void MakeUnitsDisplayed (const Standard_Boolean toDisplayUnits);
|
||||
|
||||
//! returns the current type of units
|
||||
@ -218,31 +232,33 @@ protected:
|
||||
|
||||
//! Performs drawing of 2d or 3d text on the working plane
|
||||
//! @return text width relative to the dimension working plane. For 2d text this value will be zero.
|
||||
Standard_EXPORT Standard_Real drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Dir& theTextDir,
|
||||
const TCollection_ExtendedString theText,
|
||||
const AIS_DimensionDisplayMode theMode,
|
||||
const Standard_Integer theLabelPosition);
|
||||
Standard_EXPORT void drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theTextPos,
|
||||
const gp_Dir& theTextDir,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const Standard_Integer theLabelPosition);
|
||||
|
||||
//! Performs computing of dimension linear extension with text
|
||||
//! @param thePresentation [in] the presentation to fill with graphical primitives.
|
||||
//! @param theExtensionSize [in] the size of extension line.
|
||||
//! @param theExtensionStart [in] the point where extension line connects to dimension.
|
||||
//! @param theExtensionDir [in] the direction of extension line.
|
||||
//! @param theValueString [in] the string with value.
|
||||
//! @param theLabelString [in] the string with value.
|
||||
//! @param theLabelWidth [in] the geometrical width computed for value string.
|
||||
//! @param theMode [in] the display mode.
|
||||
//! @param theLabelPosition [in] position flags for the text label.
|
||||
Standard_EXPORT void drawExtension (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Real theExtensionSize,
|
||||
const gp_Pnt& theExtensionStart,
|
||||
const gp_Dir& theExtensionDir,
|
||||
const TCollection_ExtendedString& theValueString,
|
||||
const AIS_DimensionDisplayMode theMode,
|
||||
const TCollection_ExtendedString& theLabelString,
|
||||
const Standard_Real theLabelWidth,
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Integer theLabelPosition);
|
||||
|
||||
//! Performs computing of linear dimension (for length, diameter, radius and so on)
|
||||
Standard_EXPORT void drawLinearDimension (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const AIS_DimensionDisplayMode theMode,
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Boolean isOneSideDimension = Standard_False);
|
||||
|
||||
//! If it's possible computes circle from planar face
|
||||
@ -261,15 +277,28 @@ protected:
|
||||
|
||||
Standard_EXPORT void setComputed (Standard_Boolean isComputed);
|
||||
|
||||
Standard_EXPORT gp_Pnt textPosition() const;
|
||||
|
||||
Standard_EXPORT void setTextPosition (const gp_Pnt thePosition);
|
||||
|
||||
Standard_EXPORT void resetGeom();
|
||||
|
||||
//! Fills sensitive entity for flyouts and adds it to the selection.
|
||||
Standard_EXPORT virtual void computeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(AIS_DimensionOwner)& theOwner);
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||
|
||||
//! Produce points for triangular arrow face.
|
||||
//! @param thePeakPnt [in] the arrow peak position.
|
||||
//! @param theDirection [in] the arrow direction.
|
||||
//! @param thePlane [in] the face plane.
|
||||
//! @param theArrowLength [in] the length of arrow.
|
||||
//! @param theArrowAngle [in] the angle of arrow.
|
||||
//! @param thePeakPnt [in] the arrow peak point.
|
||||
//! @param theSidePnt1 [in] the first side point.
|
||||
//! @param theSidePnt2 [in] the second side point.
|
||||
Standard_EXPORT void PointsForArrow (const gp_Pnt& thePeakPnt,
|
||||
const gp_Dir& theDirection,
|
||||
const gp_Dir& thePlane,
|
||||
const Standard_Real theArrowLength,
|
||||
const Standard_Real theArrowAngle,
|
||||
gp_Pnt& theSidePnt1,
|
||||
gp_Pnt& theSidePnt2);
|
||||
|
||||
protected: //! @name Working plane properties
|
||||
|
||||
@ -307,34 +336,74 @@ protected: // !@name Units properties
|
||||
//! Special symbol display options
|
||||
AIS_DisplaySpecialSymbol myDisplaySpecialSymbol;
|
||||
|
||||
protected: //! @name Geometry properties
|
||||
protected: //! @name Selection geometry
|
||||
|
||||
//! Geometry of dimensions, needs for advanced selection
|
||||
//! Geometry is computed in Compute() method and is used
|
||||
//! in ComputeSelection() method.
|
||||
//! If it is computed successfully, myIsComputed = Standard_True.
|
||||
//! to check computing result use IsComputed() method
|
||||
struct DimensionGeom
|
||||
//! Selection geometry of dimension presentation. The structure is filled with data
|
||||
//! during compute of presentation, then this data is used to generate selection
|
||||
//! sensitives when computing selection.
|
||||
struct SelectionGeometry
|
||||
{
|
||||
//! Text position
|
||||
gp_Pnt myTextPosition;
|
||||
//! Arrows are represented by directed triangles.
|
||||
struct Arrow
|
||||
{
|
||||
gp_Pnt Position;
|
||||
gp_Dir Direction;
|
||||
};
|
||||
typedef NCollection_Sequence<gp_Pnt> Curve;
|
||||
typedef NCollection_Handle<Curve> HCurve;
|
||||
typedef NCollection_Handle<Arrow> HArrow;
|
||||
typedef NCollection_Sequence<HCurve> SeqOfCurves;
|
||||
typedef NCollection_Sequence<HArrow> SeqOfArrows;
|
||||
|
||||
//! Text bounding box, stored for advanced selection
|
||||
Bnd_Box myTextBndBox;
|
||||
gp_Pnt TextPos; //!< Center of text label.
|
||||
gp_Dir TextDir; //!< Direction of text label.
|
||||
Standard_Real TextWidth; //!< Width of text label.
|
||||
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.
|
||||
|
||||
//! Sensitive point tolerance for 2d text selection
|
||||
Standard_Real mySelToleranceForText2d;
|
||||
public:
|
||||
|
||||
//! For advanced dimension line selection
|
||||
Select3D_ListOfSensitive mySensitiveSegments;
|
||||
//! Clear geometry of sensitives for the specified compute mode.
|
||||
//! @param theMode [in] the compute mode to clear.
|
||||
void Clear (const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
|
||||
{
|
||||
DimensionLine.Clear();
|
||||
Arrows.Clear();
|
||||
}
|
||||
|
||||
//! Shows if attachment points were computed
|
||||
Standard_Boolean myIsComputed;
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
|
||||
{
|
||||
TextPos = gp::Origin();
|
||||
TextDir = gp::DX();
|
||||
TextWidth = 0.0;
|
||||
TextHeight = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
//! Add new curve entry and return the referenece to populate it.
|
||||
Curve& NewCurve()
|
||||
{
|
||||
DimensionLine.Append( new Curve );
|
||||
HCurve& aLastCurve = DimensionLine.ChangeLast();
|
||||
return *aLastCurve;
|
||||
}
|
||||
|
||||
DimensionGeom () : myIsComputed (Standard_False) {}
|
||||
};
|
||||
//! Add new arrow entry and return the referenece to populate it.
|
||||
Arrow& NewArrow()
|
||||
{
|
||||
Arrows.Append( new Arrow );
|
||||
HArrow& aLastArrow = Arrows.ChangeLast();
|
||||
return *aLastArrow;
|
||||
}
|
||||
} mySelectionGeom;
|
||||
|
||||
Standard_Real mySelToleranceForText2d; //!< Sensitive point tolerance for 2d text selection.
|
||||
Standard_Boolean myIsComputed; //!< Shows if the presentation and selection was computed.
|
||||
|
||||
protected:
|
||||
|
||||
//! Shows if text is inverted
|
||||
Standard_Boolean myIsTextReversed;
|
||||
@ -365,13 +434,6 @@ protected: //! @name Geometry properties
|
||||
//! myFlyout value defined the size of flyout.
|
||||
Standard_Real myFlyout;
|
||||
|
||||
//! Geometry of dimensions, needs for advanced selection
|
||||
//! Geometry is computed in Compute() method and is used
|
||||
//! in ComputeSelection() method.
|
||||
//! If it is computed successfully, myIsComputed = Standard_True.
|
||||
//! to check computing result use IsComputed() method
|
||||
DimensionGeom myGeom;
|
||||
|
||||
private:
|
||||
|
||||
//! Type of dimension
|
||||
|
@ -35,26 +35,24 @@ class DimensionOwner from AIS inherits EntityOwner from SelectMgr
|
||||
|
||||
uses
|
||||
|
||||
SelectableObject from SelectMgr,
|
||||
PresentationManager from PrsMgr,
|
||||
PresentationManager3d from PrsMgr,
|
||||
NameOfColor from Quantity,
|
||||
DimensionDisplayMode from AIS
|
||||
SelectableObject from SelectMgr,
|
||||
PresentationManager from PrsMgr,
|
||||
PresentationManager3d from PrsMgr,
|
||||
NameOfColor from Quantity,
|
||||
DimensionSelectionMode from AIS
|
||||
|
||||
is
|
||||
|
||||
Create (theSelObject : SelectableObject;
|
||||
theDisplayMode : DimensionDisplayMode from AIS;
|
||||
theSelMode : DimensionSelectionMode from AIS;
|
||||
thePriority : Integer from Standard = 0)
|
||||
returns mutable DimensionOwner from AIS;
|
||||
---Purpose:
|
||||
-- Initializes the dimension owner, theSO, and attributes it
|
||||
-- the priority, thePriority.
|
||||
|
||||
SetDisplayMode (me : mutable; theMode : DimensionDisplayMode from AIS);
|
||||
|
||||
DisplayMode (me)
|
||||
returns DimensionDisplayMode from AIS;
|
||||
SelectionMode (me)
|
||||
returns DimensionSelectionMode from AIS;
|
||||
|
||||
HilightWithColor (me : mutable;
|
||||
thePM : PresentationManager3d from PrsMgr;
|
||||
@ -77,8 +75,9 @@ is
|
||||
thePM : PresentationManager from PrsMgr;
|
||||
theMode : Integer from Standard =0) is redefined virtual;
|
||||
---Purpose: Removes highlighting from the selected part of dimension.
|
||||
|
||||
fields
|
||||
|
||||
myDisplayMode : DimensionDisplayMode from AIS;
|
||||
mySelectionMode : DimensionSelectionMode from AIS;
|
||||
|
||||
end DimensionOwner;
|
||||
|
@ -18,108 +18,105 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
#include <AIS_DimensionOwner.ixx>
|
||||
#include <AIS_DimensionDisplayMode.hxx>
|
||||
#include <AIS_Dimension.hxx>
|
||||
|
||||
#include <StdSelect_Shape.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
//=======================================================================
|
||||
//function : HighlightMode
|
||||
//purpose : Return corresponding compute mode for selection type.
|
||||
//=======================================================================
|
||||
static AIS_Dimension::ComputeMode HighlightMode (const Standard_Integer theSelMode)
|
||||
{
|
||||
switch (theSelMode)
|
||||
{
|
||||
case AIS_DSM_Line : return AIS_Dimension::ComputeMode_Line;
|
||||
case AIS_DSM_Text : return AIS_Dimension::ComputeMode_Text;
|
||||
default:
|
||||
return AIS_Dimension::ComputeMode_All;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DimensionOwner::AIS_DimensionOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const AIS_DimensionDisplayMode theMode,
|
||||
const AIS_DimensionSelectionMode theMode,
|
||||
const Standard_Integer thePriority)
|
||||
: SelectMgr_EntityOwner(theSelObject, thePriority),
|
||||
myDisplayMode (theMode)
|
||||
mySelectionMode (theMode)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDisplayMode
|
||||
//function : AIS_DimensionSelectionMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DimensionOwner::SetDisplayMode (const AIS_DimensionDisplayMode theMode)
|
||||
AIS_DimensionSelectionMode AIS_DimensionOwner::SelectionMode () const
|
||||
{
|
||||
myDisplayMode = theMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DisplayMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DimensionDisplayMode AIS_DimensionOwner::DisplayMode () const
|
||||
{
|
||||
return myDisplayMode;
|
||||
return mySelectionMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHilighted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_DimensionOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) const
|
||||
const Standard_Integer /*theMode*/) const
|
||||
{
|
||||
if (HasSelectable())
|
||||
if (!HasSelectable())
|
||||
{
|
||||
Standard_Integer aMode = myDisplayMode != 0 ? myDisplayMode : theMode;
|
||||
return thePM->IsHighlighted(Selectable (), aMode);
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_False;
|
||||
|
||||
return thePM->IsHighlighted (Selectable(), HighlightMode (mySelectionMode));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Hilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DimensionOwner::Hilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode)
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
if (HasSelectable())
|
||||
if (!HasSelectable())
|
||||
{
|
||||
Standard_Integer aMode = myDisplayMode != 0 ? myDisplayMode : theMode;
|
||||
thePM->Highlight (Selectable(),aMode);
|
||||
return;
|
||||
}
|
||||
|
||||
thePM->Highlight (Selectable(), HighlightMode (mySelectionMode));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unhilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DimensionOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode)
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
if (HasSelectable())
|
||||
if (!HasSelectable())
|
||||
{
|
||||
Standard_Integer aMode = myDisplayMode != 0 ? myDisplayMode : theMode;
|
||||
thePM->Unhighlight(Selectable(),aMode);
|
||||
return;
|
||||
}
|
||||
|
||||
thePM->Unhighlight (Selectable(), HighlightMode (mySelectionMode));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightWithColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DimensionOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Quantity_NameOfColor theColor,
|
||||
const Standard_Integer theMode)
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
// Highlight selectable part of dimension with color
|
||||
if (myDisplayMode != 0)
|
||||
{
|
||||
thePM->Color (Selectable(), theColor, myDisplayMode);
|
||||
}
|
||||
else
|
||||
thePM->Color (Selectable(), theColor, theMode);
|
||||
thePM->Color (Selectable(), theColor, HighlightMode (mySelectionMode));
|
||||
}
|
||||
|
@ -183,29 +183,29 @@ Standard_Boolean AIS_LengthDimension::initTwoEdgesLength (const TopoDS_Edge & th
|
||||
|
||||
// Offset to avoid confusion Edge and Dimension
|
||||
gp_Vec anOffset(theDirAttach);
|
||||
anOffset = anOffset*myDrawer->DimensionAspect()->ArrowAspect()->Length()*(-10.);
|
||||
aCurPos.Translate(anOffset);
|
||||
myGeom.myTextPosition = aCurPos;
|
||||
anOffset = anOffset * myDrawer->DimensionAspect()->ArrowAspect()->Length()*(-10.);
|
||||
aCurPos.Translate (anOffset);
|
||||
|
||||
// Find attachment points
|
||||
if (!isFirstInfinite)
|
||||
{
|
||||
if (myGeom.myTextPosition.Distance(aPoint11) > myGeom.myTextPosition.Distance(aPoint12))
|
||||
if (aCurPos.Distance (aPoint11) > aCurPos.Distance (aPoint12))
|
||||
myFirstPoint = aPoint12;
|
||||
else
|
||||
myFirstPoint = aPoint11;
|
||||
}
|
||||
else
|
||||
myFirstPoint = ElCLib::Value(ElCLib::Parameter(aLin1,myGeom.myTextPosition), aLin1);
|
||||
myFirstPoint = ElCLib::Value (ElCLib::Parameter (aLin1, aCurPos), aLin1);
|
||||
|
||||
if (!isSecondInfinite)
|
||||
{
|
||||
if (myGeom.myTextPosition.Distance(aPoint21) > myGeom.myTextPosition.Distance(aPoint22))
|
||||
if (aCurPos.Distance (aPoint21) > aCurPos.Distance (aPoint22))
|
||||
mySecondPoint = aPoint22;
|
||||
else
|
||||
mySecondPoint = aPoint21;
|
||||
}
|
||||
else
|
||||
mySecondPoint = ElCLib::Value(ElCLib::Parameter(aLin2, myGeom.myTextPosition), aLin2);
|
||||
mySecondPoint = ElCLib::Value (ElCLib::Parameter (aLin2, aCurPos), aLin2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
@ -240,13 +240,13 @@ Standard_Boolean AIS_LengthDimension::initEdgeVertexLength (const TopoDS_Edge &
|
||||
|
||||
if (!isInfinite)
|
||||
{
|
||||
if (myGeom.myTextPosition.Distance(anEdgePoint1) > myGeom.myTextPosition.Distance(anEdgePoint2))
|
||||
if (aCurPos.Distance (anEdgePoint1) > aCurPos.Distance (anEdgePoint2))
|
||||
mySecondPoint = anEdgePoint2;
|
||||
else
|
||||
mySecondPoint = anEdgePoint1;
|
||||
}
|
||||
else
|
||||
mySecondPoint = ElCLib::Value(ElCLib::Parameter(aLin,myGeom.myTextPosition),aLin);
|
||||
mySecondPoint = ElCLib::Value (ElCLib::Parameter (aLin, aCurPos), aLin);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@ -326,8 +326,8 @@ Standard_Boolean AIS_LengthDimension::initEdgeFaceLength (const TopoDS_Edge& the
|
||||
else theDirAttach = gp::DZ ();
|
||||
|
||||
gp_Vec aVector (theDirAttach);
|
||||
aVector.Multiply (1.5 * myValue);
|
||||
myGeom.myTextPosition = mySecondPoint.Translated (aVector);
|
||||
aVector.Multiply (1.5 * myValue);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@ -395,9 +395,10 @@ Standard_Boolean AIS_LengthDimension::initTwoShapesPoints (const TopoDS_Shape& t
|
||||
}
|
||||
else // curvilinear faces
|
||||
{
|
||||
AIS::ComputeLengthBetweenCurvilinearFaces (aFirstFace, aSecondFace, aFirstSurface,
|
||||
aSecondSurface,Standard_True, myValue,
|
||||
myGeom.myTextPosition,myFirstPoint,mySecondPoint,aDirAttach);
|
||||
AIS::ComputeLengthBetweenCurvilinearFaces (aFirstFace, aSecondFace, aFirstSurface,
|
||||
aSecondSurface, Standard_True, myValue,
|
||||
mySelectionGeom.TextPos, myFirstPoint,
|
||||
mySecondPoint, aDirAttach);
|
||||
isSuccess = Standard_True;
|
||||
}
|
||||
}
|
||||
@ -493,6 +494,9 @@ void AIS_LengthDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePresentation->Clear();
|
||||
mySelectionGeom.Clear (theMode);
|
||||
|
||||
// Initialization of points, if they are not set
|
||||
if (!myIsInitialized)
|
||||
{
|
||||
@ -516,9 +520,7 @@ void AIS_LengthDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /
|
||||
return;
|
||||
}
|
||||
|
||||
thePresentation->Clear();
|
||||
|
||||
drawLinearDimension (thePresentation, (AIS_DimensionDisplayMode)theMode);
|
||||
drawLinearDimension (thePresentation, theMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -60,7 +60,7 @@ class AIS_LengthDimension;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_LengthDimension,AIS_Dimension)
|
||||
|
||||
//! A dimention to display lengths. <br>
|
||||
//! A dimension to display lengths. <br>
|
||||
//! These can be lengths along a face or edge, or <br>
|
||||
//! between two faces or two edges.
|
||||
class AIS_LengthDimension : public AIS_Dimension
|
||||
|
@ -95,6 +95,7 @@ void AIS_RadiusDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePresentation->Clear();
|
||||
mySelectionGeom.Clear (theMode);
|
||||
|
||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
@ -117,7 +118,7 @@ void AIS_RadiusDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /
|
||||
countDefaultPlane();
|
||||
}
|
||||
|
||||
drawLinearDimension (thePresentation, (AIS_DimensionDisplayMode)theMode, Standard_True);
|
||||
drawLinearDimension (thePresentation, theMode, Standard_True);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -48,6 +48,7 @@ Prs3d_DimensionAspect::Prs3d_DimensionAspect()
|
||||
myTextAspect->SetVerticalJustification (Graphic3d_VTA_CENTER);
|
||||
myArrowAspect = new Prs3d_ArrowAspect;
|
||||
myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN);
|
||||
myArrowAspect->SetAngle (M_PI * 20.0 / 180.0);
|
||||
myArrowAspect->SetLength (6.0);
|
||||
myExtensionSize = 6.0;
|
||||
}
|
||||
|
@ -23,16 +23,24 @@ vpoint arrow_p2 50 0 0
|
||||
vpoint arrow_p3 100 0 0
|
||||
vpoint arrow_p4 150 0 0
|
||||
|
||||
vpoint arrow_p5 0 0 50
|
||||
vpoint arrow_p6 10 0 50
|
||||
vpoint arrow_p5 100 0 50
|
||||
vpoint arrow_p6 127 0 50
|
||||
|
||||
vpoint arrow_p7 100 0 50
|
||||
vpoint arrow_p8 127 0 50
|
||||
vpoint arrow_p7 0 0 50
|
||||
vpoint arrow_p8 10 0 50
|
||||
|
||||
# test forced internal arrow orientation
|
||||
vdimension length name=arrow_d1 text=3d plane=zox label=hfit flyout=10.0 arrows=internal arrow_p1 arrow_p2
|
||||
|
||||
# test forced external arrow orientation
|
||||
vdimension length name=arrow_d2 text=3d plane=zox label=hfit flyout=10.0 arrows=external arrow_p3 arrow_p4
|
||||
vdimension length name=arrow_d3 text=3d plane=zox label=hfit flyout=10.0 arrows=fit arrow_p5 arrow_p6
|
||||
|
||||
# test that auto-fit for arrow places them externally for small geometry
|
||||
vdimension length name=arrow_d3 text=3d plane=zox label=hcenter flyout=10.0 arrows=fit arrow_p5 arrow_p6
|
||||
|
||||
# test that auto-fit for text places the label externally for small geometry
|
||||
vdimension length name=arrow_d4 text=3d plane=zox label=hfit flyout=10.0 arrows=fit arrow_p7 arrow_p8
|
||||
|
||||
vdisplay arrow_d1 arrow_d2 arrow_d3 arrow_d4
|
||||
vfit
|
||||
|
||||
|
@ -17,24 +17,28 @@ set vpos "above vcenter below"
|
||||
# create dimensions with different arrow orientation and fit algorithm
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
# test forced internal arrow orientation
|
||||
vpoint circle1_p1 0 0 30
|
||||
vpoint circle1_p2 30 0 0
|
||||
vpoint circle1_p3 60 0 30
|
||||
vcircle circle1 circle1_p1 circle1_p2 circle1_p3 0
|
||||
vdimension diameter name=diam1 text=3d plane=zox label=hfit flyout=0 arrows=internal circle1
|
||||
|
||||
# test forced external arrow orientation
|
||||
vpoint circle2_p1 100 0 30
|
||||
vpoint circle2_p2 130 0 0
|
||||
vpoint circle2_p3 160 0 30
|
||||
vcircle circle2 circle2_p1 circle2_p2 circle2_p3 0
|
||||
vdimension diameter name=diam2 text=3d plane=zox label=hfit flyout=0 arrows=external circle2
|
||||
|
||||
# test that auto-fit for arrow places them externally for small geometry
|
||||
vpoint circle3_p1 0 0 102
|
||||
vpoint circle3_p2 22 0 80
|
||||
vpoint circle3_p3 44 0 102
|
||||
vcircle circle3 circle3_p1 circle3_p2 circle3_p3 0
|
||||
vdimension diameter name=diam3 text=3d plane=zox label=hfit flyout=0 label=hfit arrows=fit circle3
|
||||
vdimension diameter name=diam3 text=3d plane=zox label=hcenter flyout=0 label=hfit arrows=fit circle3
|
||||
|
||||
# test that auto-fit for text places the label externally for small geometry
|
||||
vpoint circle4_p1 100 0 92
|
||||
vpoint circle4_p2 112 0 80
|
||||
vpoint circle4_p3 124 0 92
|
||||
|
@ -17,24 +17,28 @@ set vpos "above vcenter below"
|
||||
# create dimensions with different arrow orientation and fit algorithm
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
# test forced internal arrow orientation
|
||||
vpoint circle1_p1 0 0 30
|
||||
vpoint circle1_p2 30 0 0
|
||||
vpoint circle1_p3 60 0 30
|
||||
vcircle circle1 circle1_p1 circle1_p2 circle1_p3 0
|
||||
vdimension radius name=rad1 text=3d plane=zox label=hfit flyout=0 arrows=internal circle1
|
||||
|
||||
vpoint circle2_p1 100 0 30
|
||||
vpoint circle2_p2 130 0 0
|
||||
vpoint circle2_p3 160 0 30
|
||||
# test forced external arrow orientation
|
||||
vpoint circle2_p1 100 0 35
|
||||
vpoint circle2_p2 135 0 0
|
||||
vpoint circle2_p3 170 0 35
|
||||
vcircle circle2 circle2_p1 circle2_p2 circle2_p3 0
|
||||
vdimension radius name=rad2 text=3d plane=zox label=hfit flyout=0 arrows=external circle2
|
||||
|
||||
# test that auto-fit for arrow places them externally for small geometry
|
||||
vpoint circle3_p1 0 0 113
|
||||
vpoint circle3_p2 33 0 80
|
||||
vpoint circle3_p3 66 0 113
|
||||
vcircle circle3 circle3_p1 circle3_p2 circle3_p3 0
|
||||
vdimension radius name=rad3 text=3d plane=zox label=hfit flyout=0 arrows=fit circle3
|
||||
vdimension radius name=rad3 text=3d plane=zox label=hcenter flyout=0 arrows=fit circle3
|
||||
|
||||
# test that auto-fit for text places the label externally for small geometry
|
||||
vpoint circle4_p1 120 0 95
|
||||
vpoint circle4_p2 135 0 80
|
||||
vpoint circle4_p3 150 0 95
|
||||
|
@ -17,25 +17,29 @@ set vpos "above vcenter below"
|
||||
# create dimensions with different arrow orientation and fit algorithm
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
# test forced internal arrow orientation
|
||||
vpoint angle1_p1 0 0 40
|
||||
vpoint angle1_p2 0 0 0
|
||||
vpoint angle1_p3 40 0 0
|
||||
vdimension angle name=ang1 text=3d plane=zox label=hfit flyout=40.0 arrows=internal angle1_p1 angle1_p2 angle1_p3
|
||||
|
||||
# test forced external arrow orientation
|
||||
vpoint angle2_p1 80 0 40
|
||||
vpoint angle2_p2 80 0 0
|
||||
vpoint angle2_p3 120 0 0
|
||||
vdimension angle name=ang2 text=3d plane=zox label=hfit flyout=40.0 arrows=external angle2_p1 angle2_p2 angle2_p3
|
||||
|
||||
vpoint angle3_p1 0 0 115
|
||||
# test that auto-fit for arrow places them externally for small geometry
|
||||
vpoint angle3_p1 0 0 100
|
||||
vpoint angle3_p2 0 0 80
|
||||
vpoint angle3_p3 35 0 80
|
||||
vdimension angle name=ang3 text=3d plane=zox label=hfit flyout=35.0 arrows=fit angle3_p1 angle3_p2 angle3_p3
|
||||
vpoint angle3_p3 20 0 80
|
||||
vdimension angle name=ang3 text=3d plane=zox label=hcenter flyout=20.0 arrows=fit angle3_p1 angle3_p2 angle3_p3
|
||||
|
||||
vpoint angle4_p1 80 0 100
|
||||
vpoint angle4_p2 80 0 80
|
||||
vpoint angle4_p3 100 0 80
|
||||
vdimension angle name=ang4 text=3d plane=zox label=hfit flyout=20.0 arrows=fit angle4_p1 angle4_p2 angle4_p3
|
||||
# test that auto-fit for text places the label externally for small geometry
|
||||
vpoint angle4_p1 85 0 100
|
||||
vpoint angle4_p2 85 0 85
|
||||
vpoint angle4_p3 100 0 85
|
||||
vdimension angle name=ang4 text=3d plane=zox label=hfit flyout=15.0 arrows=fit angle4_p1 angle4_p2 angle4_p3
|
||||
|
||||
vdisplay ang1 ang2 ang3 ang4
|
||||
vfit
|
||||
|
251
tests/bugs/vis/bug24389
Normal file
251
tests/bugs/vis/bug24389
Normal file
@ -0,0 +1,251 @@
|
||||
puts "============"
|
||||
puts "CR24389"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Invalid hilight of AIS dimension line in local selection
|
||||
#######################################################################
|
||||
|
||||
# ----------------------------------------------#
|
||||
# Check highlight of length dimension elements #
|
||||
# ----------------------------------------------#
|
||||
|
||||
vinit View1
|
||||
vtop
|
||||
|
||||
set anImage1 $imagedir/${casename}_1.png
|
||||
set anImage2 $imagedir/${casename}_2.png
|
||||
set anImage3 $imagedir/${casename}_3.png
|
||||
|
||||
# length
|
||||
|
||||
vpoint len_p1 0 0 0
|
||||
vpoint len_p2 40 0 0
|
||||
verase len_p1 len_p2
|
||||
|
||||
vdimension length name=len1 text=3d plane=xoy flyout=20 arrows=external label=left len_p1 len_p2
|
||||
vdimension length name=len2 text=3d plane=xoy flyout=-20 arrows=external label=right len_p1 len_p2
|
||||
|
||||
vpoint len_p3 0 20 0
|
||||
vpoint len_p4 40 20 0
|
||||
verase len_p3 len_p4
|
||||
|
||||
vdimension length name=len3 text=3d plane=xoy flyout=20 arrows=internal label=hcenter len_p3 len_p4
|
||||
vdisplay len1 len2 len3
|
||||
|
||||
# diameter
|
||||
|
||||
vpoint diam_p1 90 0 0
|
||||
vpoint diam_p2 120 0 0
|
||||
vpoint diam_p3 105 -15 0
|
||||
verase diam_p1 diam_p2 diam_p3
|
||||
vcircle diam_c1 diam_p1 diam_p2 diam_p3 0
|
||||
vdimension diameter name=diam1 text=3d plane=xoy arrows=external label=left diam_c1
|
||||
|
||||
vpoint diam_p4 90 40 0
|
||||
vpoint diam_p5 120 40 0
|
||||
vpoint diam_p6 105 25 0
|
||||
verase diam_p4 diam_p5 diam_p6
|
||||
vcircle diam_c2 diam_p4 diam_p5 diam_p6 0
|
||||
vdimension diameter name=diam2 text=3d plane=xoy arrows=external label=right diam_c2
|
||||
|
||||
vpoint diam_p7 80 -40 0
|
||||
vpoint diam_p8 120 -40 0
|
||||
vpoint diam_p9 100 -60 0
|
||||
verase diam_p7 diam_p8 diam_p9
|
||||
vcircle diam_c3 diam_p7 diam_p8 diam_p9 0
|
||||
vdimension diameter name=diam3 text=3d plane=xoy arrows=external label=hcenter flyout=30 diam_c3
|
||||
vdisplay diam1 diam2 diam3
|
||||
|
||||
# radius
|
||||
|
||||
vpoint rad_p1 140 -5 0
|
||||
vpoint rad_p2 180 -45 0
|
||||
vpoint rad_p3 220 -5 0
|
||||
verase rad_p1 rad_p2 rad_p3
|
||||
vcircle rad_c1 rad_p1 rad_p2 rad_p3 0
|
||||
vdimension radius name=rad1 text=3d plane=xoy arrows=internal label=hcenter flyout=0 rad_c1
|
||||
|
||||
vpoint rad_p4 180 -70 0
|
||||
vpoint rad_p5 160 -90 0
|
||||
vpoint rad_p6 140 -70 0
|
||||
verase rad_p4 rad_p5 rad_p6
|
||||
vcircle rad_c2 rad_p4 rad_p5 rad_p6 0
|
||||
vdimension radius name=rad2 text=3d plane=xoy arrows=external label=left rad_c2
|
||||
vdisplay rad1 rad2
|
||||
|
||||
# angles
|
||||
|
||||
vpoint ang_p1 0 -50 0
|
||||
vpoint ang_p2 25 -75 0
|
||||
vpoint ang_p3 0 -100 0
|
||||
verase ang_p1 ang_p2 ang_p3
|
||||
vdimension angle name=ang1 text=3d plane=xoy arrows=internal label=hcenter flyout=35 ang_p1 ang_p2 ang_p3
|
||||
|
||||
vpoint ang_p4 0 -120 0
|
||||
vpoint ang_p5 30 -80 0
|
||||
vpoint ang_p6 30 -120 0
|
||||
verase ang_p4 ang_p5 ang_p6
|
||||
vdimension angle name=ang2 text=3d plane=xoy arrows=external label=left flyout=55 ang_p4 ang_p5 ang_p6
|
||||
|
||||
vpoint ang_p8 55 -120 0
|
||||
vpoint ang_p9 55 -80 0
|
||||
vpoint ang_p10 95 -120 0
|
||||
verase ang_p8 ang_p9 ang_p10
|
||||
vdimension angle name=ang3 text=3d plane=xoy arrows=external label=right flyout=55 ang_p8 ang_p9 ang_p10
|
||||
|
||||
vdisplay ang1 ang2 ang3
|
||||
vpoint fit1 -75 0 0
|
||||
vpoint fit2 235 0 0
|
||||
vfit
|
||||
|
||||
# ----------------------------------------------------------------------------- #
|
||||
# Verify picking in neutral and local selections #
|
||||
# ----------------------------------------------------------------------------- #
|
||||
|
||||
proc check_picking { pick check name } {
|
||||
for {set i 0} {$i < [llength $pick]} {incr i} {
|
||||
|
||||
set pick_x [lindex [lindex $pick $i] 0]
|
||||
set pick_y [lindex [lindex $pick $i] 1]
|
||||
set check_x [lindex $check 0]
|
||||
set check_y [lindex $check 1]
|
||||
|
||||
vmoveto $pick_x $pick_y
|
||||
set res [checkcolor $check_x $check_y 0 1 1]
|
||||
|
||||
if { $res != 1 } {
|
||||
puts "Error : Highlighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc check_cross_picking { pick object name } {
|
||||
|
||||
vselmode 0 0
|
||||
|
||||
for {set i 1} {$i < 3} {incr i} {
|
||||
|
||||
vselmode $object $i 1
|
||||
|
||||
for {set j 1} {$j < 3} {incr j} {
|
||||
|
||||
set pick_idx_i [expr "[llength $pick] - 2 + $i - 1"]
|
||||
set pick_idx_j [expr "[llength $pick] - 2 + $j - 1"]
|
||||
|
||||
set pick_x [lindex [lindex $pick $pick_idx_i] 0]
|
||||
set pick_y [lindex [lindex $pick $pick_idx_i] 1]
|
||||
set check_x [lindex [lindex $pick $pick_idx_j] 0]
|
||||
set check_y [lindex [lindex $pick $pick_idx_j] 1]
|
||||
|
||||
vmoveto $pick_x $pick_y
|
||||
|
||||
if {$i == $j} {
|
||||
set res [checkcolor $check_x $check_y 0 1 1]
|
||||
if { $res != 1 } {
|
||||
puts "Error : No local hilighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
|
||||
}
|
||||
} else {
|
||||
set res [checkcolor $check_x $check_y 0 0 0]
|
||||
if { $res != 1 } {
|
||||
puts "Error : Unwanted hilighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
|
||||
}
|
||||
}
|
||||
}
|
||||
vselmode $object $i 0
|
||||
}
|
||||
vselmode 0 0
|
||||
}
|
||||
|
||||
# pick coord { [flyout], dimension line, text }
|
||||
|
||||
# check sensitives "len1"
|
||||
set pick_coord { { 99 133 } { 106 124 } { 76 131 } }
|
||||
set check_coord { 125 124 }
|
||||
check_picking $pick_coord $check_coord "length dimension (len1)"
|
||||
check_cross_picking $pick_coord len1 "length dimension (len1)"
|
||||
|
||||
# check sensitives "len2"
|
||||
set pick_coord { { 99 167 } { 127 176 } { 185 183 } }
|
||||
set check_coord { 112 176 }
|
||||
check_picking $pick_coord $check_coord "length dimension (len2)"
|
||||
check_cross_picking $pick_coord len2 "length dimension (len2)"
|
||||
|
||||
# check sensitives "len3"
|
||||
set pick_coord { { 99 114 } { 110 98 } { 131 105 } }
|
||||
set check_coord { 152 109 }
|
||||
check_picking $pick_coord $check_coord "length dimension (len3)"
|
||||
check_cross_picking $pick_coord len3 "length dimension (len3)"
|
||||
|
||||
# check sensitives "diam1"
|
||||
set pick_coord { { 247 150 } { 194 157 } }
|
||||
set check_coord { 236 150 }
|
||||
check_picking $pick_coord $check_coord "diameter dimension (diam1)"
|
||||
check_cross_picking $pick_coord diam1 "diameter dimension (diam1)"
|
||||
|
||||
# check sensitives "diam2"
|
||||
set pick_coord { { 221 98 } { 305 105 } }
|
||||
set check_coord { 238 98 }
|
||||
check_picking $pick_coord $check_coord "diameter dimension (diam2)"
|
||||
check_cross_picking $pick_coord diam2 "diameter dimension (diam2)"
|
||||
|
||||
# check sensitives "diam3"
|
||||
set pick_coord { { 204 225 } { 268 242 } { 243 249 } }
|
||||
set check_coord { 204 233 }
|
||||
check_picking $pick_coord $check_coord "diameter dimension (diam3)"
|
||||
check_cross_picking $pick_coord diam3 "diameter dimension (diam3)"
|
||||
|
||||
# check sensitives "rad1"
|
||||
set pick_coord { { 287 157 } { 326 165 } }
|
||||
set check_coord { 287 157 }
|
||||
check_picking $pick_coord $check_coord "radius dimension (rad1)"
|
||||
check_cross_picking $pick_coord rad1 "radius dimension (rad1)"
|
||||
|
||||
# check sensitives "rad2"
|
||||
set pick_coord { { 320 242 } { 383 249 } }
|
||||
set check_coord { 340 242 }
|
||||
check_picking $pick_coord $check_coord "radius dimension (rad2)"
|
||||
check_cross_picking $pick_coord rad2 "radius dimension (rad2)"
|
||||
|
||||
# check sensitives "ang1"
|
||||
set pick_coord { { 112 268 } { 96 220 } { 80 250 } }
|
||||
set check_coord { 96 220 }
|
||||
check_picking $pick_coord $check_coord "angle dimension (ang1)"
|
||||
check_cross_picking $pick_coord ang1 "angle dimension (ang1)"
|
||||
|
||||
# check sensitives "ang2"
|
||||
set pick_coord { { 139 301 } { 152 327 } { 65 297 } }
|
||||
set check_coord { 108 320 }
|
||||
check_picking $pick_coord $check_coord "angle dimension (ang2)"
|
||||
check_cross_picking $pick_coord ang2 "angle dimension (ang2)"
|
||||
|
||||
# check sensitives "ang3"
|
||||
set pick_coord { { 171 304 } { 199 321 } { 252 285 } }
|
||||
set check_coord { 191 324 }
|
||||
check_picking $pick_coord $check_coord "angle dimension (ang3)"
|
||||
check_cross_picking $pick_coord ang3 "angle dimension (ang3)"
|
||||
|
||||
# --------------------------------------------------- #
|
||||
# Dump selected images #
|
||||
# --------------------------------------------------- #
|
||||
|
||||
set xmin -500
|
||||
set xmax 500
|
||||
set ymin -500
|
||||
set ymax 500
|
||||
set shift 0
|
||||
|
||||
vselmode 0 0
|
||||
vselect $xmin $ymin $xmax $ymax $shift
|
||||
vdump $anImage1
|
||||
|
||||
vselect 0 0 0 0 0
|
||||
vselmode 1 1
|
||||
vselect $xmin $ymin $xmax $ymax $shift
|
||||
vdump $anImage2
|
||||
|
||||
vselect 0 0 0 0 0
|
||||
vselmode 0 0
|
||||
vselmode 2 1
|
||||
vselect $xmin $ymin $xmax $ymax $shift
|
||||
vdump $anImage3
|
Loading…
x
Reference in New Issue
Block a user