#include <Prs3d_Root.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <Select3D_SensitiveCurve.hxx>
+#include <Select3D_SensitiveGroup.hxx>
#include <Select3D_SensitiveSegment.hxx>
-#include <Select3D_SensitiveBox.hxx>
-#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_Type.hxx>
void AIS_AngleDimension::init()
{
+ SetKindOfDimension (AIS_KOD_PLANEANGLE);
+ SetFlyout (15.0);
// Default values of units
UnitsAPI::SetLocalSystem (UnitsAPI_SI);
SetUnitsQuantity ("PLANE ANGLE");
AIS_AngleDimension::AIS_AngleDimension (const TopoDS_Edge& theFirstEdge,
const TopoDS_Edge& theSecondEdge)
: AIS_Dimension(),
- myIsFlyoutLines (Standard_True),
- myFlyout (15.0)
+ myIsFlyoutLines (Standard_True)
{
init();
myShapesNumber = 2;
- SetKindOfDimension (AIS_KOD_PLANEANGLE);
myFirstShape = theFirstEdge;
mySecondShape = theSecondEdge;
}
const TopoDS_Edge& theSecondEdge,
const gp_Pln& thePlane)
: AIS_Dimension(),
- myIsFlyoutLines (Standard_True),
- myFlyout (15.0)
+ myIsFlyoutLines (Standard_True)
{
init();
myShapesNumber = 2;
- SetKindOfDimension (AIS_KOD_PLANEANGLE);
myFirstShape = theFirstEdge;
mySecondShape = theSecondEdge;
SetWorkingPlane (thePlane);
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize)
: AIS_Dimension (theDimensionAspect,theExtensionSize),
- myIsFlyoutLines (Standard_True),
- myFlyout (15.0)
+ myIsFlyoutLines (Standard_True)
{
myShapesNumber = 2;
- SetKindOfDimension (AIS_KOD_PLANEANGLE);
myFirstShape = theFirstEdge;
mySecondShape = theSecondEdge;
SetWorkingPlane (thePlane);
const gp_Pnt& theSecondPoint,
const gp_Pnt& theThirdPoint)
: AIS_Dimension(),
- myIsFlyoutLines (Standard_True),
- myFlyout (15.0)
+ myIsFlyoutLines (Standard_True)
{
init();
myIsInitialized = Standard_True;
- SetKindOfDimension (AIS_KOD_PLANEANGLE);
myFirstPoint = theFirstPoint;
myCenter = theSecondPoint;
mySecondPoint = theThirdPoint;
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize)
: AIS_Dimension (theDimensionAspect,theExtensionSize),
- myIsFlyoutLines (Standard_True),
- myFlyout (15.0)
+ myIsFlyoutLines (Standard_True)
{
myIsInitialized = Standard_True;
- SetKindOfDimension (AIS_KOD_PLANEANGLE);
myFirstPoint = theFirstPoint;
myCenter = theSecondPoint;
mySecondPoint = theThirdPoint;
AIS_AngleDimension::AIS_AngleDimension (const TopoDS_Face& theCone)
: AIS_Dimension(),
- myIsFlyoutLines (Standard_True),
- myFlyout (15.0)
+ myIsFlyoutLines (Standard_True)
{
init();
myIsInitialized = Standard_False;
- SetKindOfDimension (AIS_KOD_PLANEANGLE);
myFirstShape = theCone;
myShapesNumber = 1;
}
const TopoDS_Face& theSecondFace,
const gp_Ax1& theAxis)
: AIS_Dimension(),
- myIsFlyoutLines (Standard_True),
- myFlyout (15.0)
+ myIsFlyoutLines (Standard_True)
{
init();
myIsInitialized = Standard_False;
- SetKindOfDimension (AIS_KOD_PLANEANGLE);
myFirstShape = theFirstFace;
mySecondShape = theSecondFace;
myShapesNumber = 2;
return Standard_True;
}
-//=======================================================================
-//function : SetFlyout
-//purpose :
-//=======================================================================
-
-void AIS_AngleDimension::SetFlyout (const Standard_Real theFlyout)
-{
- myFlyout = theFlyout;
-}
-
-//=======================================================================
-//function : GetFlyout
-//purpose :
-//=======================================================================
-
-Standard_Real AIS_AngleDimension::GetFlyout () const
-{
- return myFlyout;
-}
-
//=======================================================================
//function : countDefaultPlane
//purpose :
setComputed (Standard_True);
}
+
+//=======================================================================
+//function : computeFlyoutSelection
+//purpose : computes selection for flyouts
+//=======================================================================
+
+void AIS_AngleDimension::computeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
+ const Handle(AIS_DimensionOwner)& theOwner)
+{
+ 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);
+}
\ No newline at end of file
const TopoDS_Face& theSecondFace,
const gp_Ax1& theAxis);
- //! Sets the flyout.
- Standard_EXPORT void SetFlyout (const Standard_Real theFlyout);
-
- //! Returns flyout value. If value > 0 the dimension is to be displayed inside the angle.
- //! Otherwise it is displayed outside one.
- Standard_EXPORT Standard_Real GetFlyout() const;
-
//! Sets first shape
Standard_EXPORT void SetFirstShape (const TopoDS_Shape& theShape,
const Standard_Boolean isSingleShape = Standard_False);
//! Fills default plane object if it is possible to count plane automatically.
Standard_EXPORT virtual void countDefaultPlane ();
+
+ //! 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);
protected:
//! The center of dimension arc
gp_Pnt myCenter;
-
- //! Defines flyout lines and direction
- //! Flyout direction in the working plane (stored in the base AIS_Dimension).
- //! can be negative , or positive and is defined by the sign of <myFlyout> value.
- //! The direction vector is counting using the working plane.
- //! <myFlyout> value defined the size of flyout (radius of angle).
- Standard_Real myFlyout;
};
#endif
AIS_DiameterDimension::AIS_DiameterDimension(const gp_Circ& theCircle)
: AIS_Dimension(),
- myFlyout (0.0),
myCircle (theCircle)
{
SetKindOfDimension(AIS_KOD_DIAMETER);
AIS_DiameterDimension::AIS_DiameterDimension(const gp_Circ& theCircle, const gp_Pnt& theAttachPoint)
: AIS_Dimension(),
- myFlyout (0.0),
myCircle (theCircle)
{
SetKindOfDimension(AIS_KOD_DIAMETER);
const Handle(Prs3d_DimensionAspect)& theDimensionStyle,
const Standard_Real theExtensionSize /*= 1.0*/)
: AIS_Dimension (theExtensionSize),
- myFlyout (0.0),
myCircle (theCircle)
{
SetKindOfDimension(AIS_KOD_DIAMETER);
//=======================================================================
AIS_DiameterDimension::AIS_DiameterDimension (const TopoDS_Shape& theShape)
-: AIS_Dimension (),
- myFlyout (0.)
+: AIS_Dimension ()
{
SetKindOfDimension(AIS_KOD_DIAMETER);
SetSpecialSymbol (0x00D8);
gp_Dir aTargetPointsVector = gce_MakeDir (myFirstPoint, mySecondPoint);
// Count a flyout direction vector.
gp_Dir aFlyoutVector = aWorkingPlaneNormal.Direction()^aTargetPointsVector;
- gp_Ax3 aLocalSystem (myFirstPoint, aTargetPointsVector, aFlyoutVector);
// Create lines for layouts
gp_Lin aLine1 (myFirstPoint, aFlyoutVector);
// Set computed value to <myWorkingPlane>
ResetWorkingPlane ();
}
-
-//=======================================================================
-//function : SetFlyout
-//purpose :
-//=======================================================================
-
-void AIS_DiameterDimension::SetFlyout (const Standard_Real theFlyout)
-{
- myFlyout = theFlyout;
-}
-
-//=======================================================================
-//function : GetFlyout
-//purpose :
-//=======================================================================
-
-Standard_Real AIS_DiameterDimension::GetFlyout () const
-{
- return myFlyout;
-}
Standard_EXPORT AIS_DiameterDimension (const TopoDS_Shape& theShape);
-
- Standard_EXPORT void SetFlyout(const Standard_Real theFlyout);
-
- Standard_EXPORT Standard_Real GetFlyout () const;
-
DEFINE_STANDARD_RTTI(AIS_DiameterDimension)
protected:
// Fields
- //! Defines flyout lines and direction
- //! Flyout direction in the working plane (stored in the base AIS_Dimension).
- //! can be negative , or positive and is defined by the sign of <myFlyout> value.
- //! The direction vector is counting using the working plane.
- //! <myFlyout> value defined the size of flyout.
- Standard_Real myFlyout;
gp_Circ myCircle;
};
#endif
myIsTextReversed (Standard_False),
myTextOffset (DimensionAspect()->ArrowAspect()->Length()),
myIsInitialized (Standard_False),
+ myFlyout (0.0),
myKindOfDimension (AIS_KOD_NONE),
myExtensionSize (theExtensionSize)
{
myIsTextReversed (Standard_False),
myTextOffset (DimensionAspect()->ArrowAspect()->Length()),
myIsInitialized (Standard_False),
+ myFlyout (0.0),
myKindOfDimension (AIS_KOD_NONE),
myExtensionSize (theExtensionSize)
{
return myGeom.mySelToleranceForText2d;
}
+//=======================================================================
+//function : SetFlyout
+//purpose :
+//=======================================================================
+
+void AIS_Dimension::SetFlyout (const Standard_Real theFlyout)
+{
+ myFlyout = theFlyout;
+}
+
+//=======================================================================
+//function : GetFlyout
+//purpose :
+//=======================================================================
+
+Standard_Real AIS_Dimension::GetFlyout () const
+{
+ return myFlyout;
+}
+
+//=======================================================================
+//function : computeFlyoutSelection
+//purpose : computes selection for flyouts
+//=======================================================================
+
+void AIS_Dimension::computeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
+ const Handle(AIS_DimensionOwner)& theOwner)
+{
+ //Count flyout direction
+ gp_Ax1 aWorkingPlaneNormal = GetWorkingPlane().Axis();
+ gp_Dir aTargetPointsVector = gce_MakeDir (myFirstPoint, mySecondPoint);
+ // Count a flyout direction vector.
+ gp_Dir aFlyoutVector = aWorkingPlaneNormal.Direction()^aTargetPointsVector;
+ // Create lines for layouts
+ gp_Lin aLine1 (myFirstPoint, aFlyoutVector);
+ gp_Lin aLine2 (mySecondPoint, aFlyoutVector);
+ // Get flyout end points
+ gp_Pnt aFlyoutEnd1 = ElCLib::Value (ElCLib::Parameter (aLine1, myFirstPoint) + GetFlyout(), aLine1);
+ gp_Pnt aFlyoutEnd2 = ElCLib::Value (ElCLib::Parameter (aLine2, mySecondPoint) + GetFlyout(), aLine2);
+
+ // Fill sensitive entity for flyouts
+ Handle(Select3D_SensitiveGroup) aSensitiveEntity = new Select3D_SensitiveGroup (theOwner);
+ aSensitiveEntity->Add (new Select3D_SensitiveSegment (theOwner, myFirstPoint, aFlyoutEnd1));
+ aSensitiveEntity->Add (new Select3D_SensitiveSegment (theOwner, mySecondPoint, aFlyoutEnd2));
+ theSelection->Add (aSensitiveEntity);
+}
+
//=======================================================================
//function : ComputeSelection
//purpose :
return;
}
- Handle( Select3D_SensitiveGroup) aSensitiveForLine;
+ Handle(Select3D_SensitiveGroup) aSensitiveForLine;
Handle(Select3D_SensitiveEntity) aSensitiveForText;
Select3D_ListOfSensitive aSensitiveList;
aSensitiveList.Assign (myGeom.mySensitiveSegments);
Handle(AIS_DimensionOwner) aTextOwner = new AIS_DimensionOwner (this, AIS_DDM_Text, 7);
aSensitiveForText->Set (aTextOwner);
}
+ else
+ computeFlyoutSelection (theSelection, anOwner);
theSelection->Add (aSensitiveForLine);
theSelection->Add (aSensitiveForText);
#define _AIS_Dimension_Headerfile
#include <AIS_DimensionDisplayMode.hxx>
+#include <AIS_DimensionOwner.hxx>
#include <AIS_DisplaySpecialSymbol.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_KindOfInteractive.hxx>
//! For 2d text selection detection sensitive point with tolerance is used
//! Important! Only for 2d text
Standard_EXPORT Standard_Real SelToleranceForText2d() const;
-
+ //! Sets flyout size for dimension.
+ Standard_EXPORT void SetFlyout (const Standard_Real theFlyout);
+ //! @return flyout size for dimension.
+ Standard_EXPORT Standard_Real GetFlyout () const;
DEFINE_STANDARD_RTTI(AIS_Dimension)
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);
// Fields
protected:
TopoDS_Shape mySecondShape;
//! Number of shapes
Standard_Integer myShapesNumber;
+ //! Defines flyout lines and direction
+ //! Flyout direction in the working plane.
+ //! Can be negative, or positive and is defined by the sign of myFlyout value.
+ //! The direction vector is counting using the working plane.
+ //! 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.
const gp_Pln& theDimensionPlane,
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize /*= 1.0*/)
- :AIS_Dimension (theDimensionAspect,theExtensionSize),
- myFlyout (15.)
+ :AIS_Dimension (theDimensionAspect,theExtensionSize)
{
myIsInitialized = Standard_True;
myFirstPoint = theFirstPoint;
myShapesNumber = 2;
myFirstShape = BRepLib_MakeVertex (myFirstPoint);
mySecondShape = BRepLib_MakeVertex (mySecondPoint);
+ SetFlyout (15.0);
SetKindOfDimension(AIS_KOD_LENGTH);
SetWorkingPlane (theDimensionPlane);
}
AIS_LengthDimension::AIS_LengthDimension (const gp_Pnt& theFirstPoint,
const gp_Pnt& theSecondPoint,
const gp_Pln& theDimensionPlane)
-: AIS_Dimension (),
- myFlyout (15.)
+: AIS_Dimension ()
{
myIsInitialized = Standard_True;
myFirstPoint = theFirstPoint;
myFirstShape = BRepLib_MakeVertex (myFirstPoint);
mySecondShape = BRepLib_MakeVertex (mySecondPoint);
myShapesNumber = 2;
+ SetFlyout (15.0);
SetKindOfDimension (AIS_KOD_LENGTH);
SetWorkingPlane (theDimensionPlane);
}
AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Shape& theFirstShape,
const TopoDS_Shape& theSecondShape,
const gp_Pln& theWorkingPlane)
-: AIS_Dimension (),
- myFlyout (15.)
+: AIS_Dimension ()
{
myIsInitialized = Standard_False;
myFirstShape = theFirstShape;
mySecondShape = theSecondShape;
myShapesNumber = 2;
+ SetFlyout (15.0);
SetKindOfDimension (AIS_KOD_LENGTH);
SetWorkingPlane (theWorkingPlane);
}
AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Edge& theEdge,
const gp_Pln& theWorkingPlane)
-: AIS_Dimension (),
- myFlyout (15.)
+: AIS_Dimension ()
{
myIsInitialized = Standard_False;
myFirstShape = theEdge;
myShapesNumber = 1;
+ SetFlyout (15.0);
SetKindOfDimension (AIS_KOD_LENGTH);
SetWorkingPlane (theWorkingPlane);
}
AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Face& theFirstFace,
const TopoDS_Face& theSecondFace)
-: AIS_Dimension (),
- myFlyout (15.)
+: AIS_Dimension ()
{
myIsInitialized = Standard_False;
myFirstShape = theFirstFace;
mySecondShape = theSecondFace;
myShapesNumber = 2;
+ SetFlyout (15.0);
SetKindOfDimension(AIS_KOD_LENGTH);
}
AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge)
- : AIS_Dimension (),
- myFlyout (15.)
+ : AIS_Dimension ()
{
SetKindOfDimension(AIS_KOD_LENGTH);
myIsInitialized = Standard_False;
myFirstShape = theFace;
mySecondShape = theEdge;
myShapesNumber = 2;
+ SetFlyout (15.0);
}
//=======================================================================
gp_Dir aTargetPointsVector = gce_MakeDir (myFirstPoint, mySecondPoint);
// Count a flyout direction vector.
gp_Dir aFlyoutVector = aWorkingPlaneNormal.Direction()^aTargetPointsVector;
- gp_Ax3 aLocalSystem (myFirstPoint, aTargetPointsVector, aFlyoutVector);
// Create lines for layouts
gp_Lin aLine1 (myFirstPoint, aFlyoutVector);
myValue = myFirstPoint.Distance (mySecondPoint);
AIS_Dimension::computeValue ();
}
-
-//=======================================================================
-//function : SetFlyout
-//purpose :
-//=======================================================================
-
-void AIS_LengthDimension::SetFlyout (const Standard_Real theFlyout)
-{
- myFlyout = theFlyout;
-}
-
-//=======================================================================
-//function : GetFlyout
-//purpose :
-//=======================================================================
-
-Standard_Real AIS_LengthDimension::GetFlyout () const
-{
- return myFlyout;
-}
Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge);
- Standard_EXPORT void SetFlyout (const Standard_Real theFlyout);
-
- Standard_EXPORT Standard_Real GetFlyout () const;
-
DEFINE_STANDARD_RTTI(AIS_LengthDimension)
private:
Standard_Boolean initTwoEdgesLength (const TopoDS_Edge & theFirstEdge,
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode = 0) ;
- // Fields
-
- //! Defines flyout lines and direction
- //! Flyout direction in the working plane (stored in the base AIS_Dimension).
- //! can be negative , or positive and is defined by the sign of <myFlyout> value.
- //! The direction vector is counting using the working plane.
- //! <myFlyout> value defined the size of flyout.
- Standard_Real myFlyout;
+
};
#endif
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle)
: AIS_Dimension(),
- myFlyout (0.0),
myCircle (theCircle)
{
myFirstPoint = ElCLib::Value(0, myCircle);
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
const gp_Pnt& theAttachPoint)
: AIS_Dimension(),
- myFlyout (0.0),
myCircle (theCircle)
{
myFirstPoint = theAttachPoint;
//=======================================================================
AIS_RadiusDimension::AIS_RadiusDimension (const TopoDS_Shape& theShape)
-: AIS_Dimension (),
- myFlyout (0.0)
+: AIS_Dimension ()
{
myFirstShape = theShape;
myIsInitialized = Standard_False;
const Standard_Real theExtensionSize/* = 1.0*/)
: AIS_Dimension (theDimensionAspect,theExtensionSize),
- myFlyout (0.0),
myCircle (theCircle)
{
myFirstPoint = ElCLib::Value(0, myCircle);
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize/* = 1.0*/)
: AIS_Dimension (theDimensionAspect,theExtensionSize),
- myFlyout (0.0),
myCircle (theCircle)
{
myFirstPoint = theAttachPoint;
//purpose :
//=======================================================================
-void AIS_RadiusDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePM*/,
- const Handle(Prs3d_Presentation)& thePresentation,
- const Standard_Integer theMode)
+void AIS_RadiusDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePM*/,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer theMode)
{
thePresentation->Clear();
gp_Dir aTargetPointsVector = gce_MakeDir (myFirstPoint, mySecondPoint);
// Count a flyout direction vector.
gp_Dir aFlyoutVector = aWorkingPlaneNormal.Direction()^aTargetPointsVector;
- gp_Ax3 aLocalSystem (myFirstPoint, aTargetPointsVector, aFlyoutVector);
// Create lines for layouts
gp_Lin aLine1 (myFirstPoint, aFlyoutVector);
// Set computed value to <myWorkingPlane>
ResetWorkingPlane ();
}
-
-//=======================================================================
-//function : SetFlyout
-//purpose :
-//=======================================================================
-
-void AIS_RadiusDimension::SetFlyout (const Standard_Real theFlyout)
-{
- myFlyout = theFlyout;
-}
-
-//=======================================================================
-//function : GetFlyout
-//purpose :
-//=======================================================================
-
-Standard_Real AIS_RadiusDimension::GetFlyout () const
-{
- return myFlyout;
-}
//! shape aShape, the dimension aVal, and the text aText.
Standard_EXPORT AIS_RadiusDimension (const TopoDS_Shape& aShape);
- Standard_EXPORT void SetFlyout (const Standard_Real theFlyoutSize);
-
- Standard_EXPORT Standard_Real GetFlyout () const;
-
DEFINE_STANDARD_RTTI(AIS_RadiusDimension)
protected:
// Fields
- //! Defines flyout lines and direction
- //! Flyout direction in the working plane (stored in the base AIS_Dimension).
- //! can be negative , or positive and is defined by the sign of <myFlyout> value.
- //! The direction vector is counting using the working plane.
- //! <myFlyout> value defined the size of flyout.
- Standard_Real myFlyout;
gp_Circ myCircle;
};
#endif
--- /dev/null
+puts "============"
+puts "CR24293"
+puts "============"
+puts ""
+#######################################################################
+# Dimension flyout lines don't belong to the dimension sensitive entity.
+#######################################################################
+pload VISUALIZATION
+
+vinit
+vpoint lengthP1 0 0 0
+vpoint lengthP2 10 10 10
+vdim -length -name=dim1 -plane=xoy lengthP1 lengthP2
+vdisplay dim1
+vfit
+vmoveto 202 191
+
+set x_coord 272
+set y_coord 198
+checkcolor $x_coord $y_coord 0 1 1
+if { $stat != 1 } {
+ puts "Error : Highlighting of length dimension is wrong."
+}
+
+set only_screen 1