mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR). Used clang-format 18.1.8. New actions to validate code formatting is added. Update .clang-format with disabling of include sorting. It is temporary changes, then include will be sorted. Apply formatting for /src and /tools folder. The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -27,33 +27,105 @@ class Geom_Surface;
|
||||
class Prs3d_DimensionAspect;
|
||||
|
||||
//! Describes Standard Presentations for DsgIHM objects
|
||||
class DsgPrs
|
||||
class DsgPrs
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! draws symbols ((one or two) arrows,(one or two)points
|
||||
//! at thebeginning and at the end of the dimension
|
||||
Standard_EXPORT static void ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_DimensionAspect)& anAspect, const gp_Pnt& pt1, const gp_Pnt& pt2, const gp_Dir& dir1, const gp_Dir& dir2, const DsgPrs_ArrowSide ArrowSide, const Standard_Boolean drawFromCenter = Standard_True);
|
||||
|
||||
Standard_EXPORT static void ComputePlanarFacesLengthPresentation (const Standard_Real FirstArrowLength, const Standard_Real SecondArrowLength, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& DirAttach, const gp_Pnt& OffsetPoint, const gp_Pln& PlaneOfFaces, gp_Pnt& EndOfArrow1, gp_Pnt& EndOfArrow2, gp_Dir& DirOfArrow1);
|
||||
|
||||
Standard_EXPORT static void ComputeCurvilinearFacesLengthPresentation (const Standard_Real FirstArrowLength, const Standard_Real SecondArrowLength, const Handle(Geom_Surface)& SecondSurf, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& DirAttach, gp_Pnt& EndOfArrow2, gp_Dir& DirOfArrow1, Handle(Geom_Curve)& VCurve, Handle(Geom_Curve)& UCurve, Standard_Real& FirstU, Standard_Real& deltaU, Standard_Real& FirstV, Standard_Real& deltaV);
|
||||
|
||||
Standard_EXPORT static void ComputeFacesAnglePresentation (const Standard_Real ArrowLength, const Standard_Real Value, const gp_Pnt& CenterPoint, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& dir1, const gp_Dir& dir2, const gp_Dir& axisdir, const Standard_Boolean isPlane, const gp_Ax1& AxisOfSurf, const gp_Pnt& OffsetPoint, gp_Circ& AngleCirc, Standard_Real& FirstParAngleCirc, Standard_Real& LastParAngleCirc, gp_Pnt& EndOfArrow1, gp_Pnt& EndOfArrow2, gp_Dir& DirOfArrow1, gp_Dir& DirOfArrow2, gp_Pnt& ProjAttachPoint2, gp_Circ& AttachCirc, Standard_Real& FirstParAttachCirc, Standard_Real& LastParAttachCirc);
|
||||
|
||||
Standard_EXPORT static void ComputeRadiusLine (const gp_Pnt& aCenter, const gp_Pnt& anEndOfArrow, const gp_Pnt& aPosition, const Standard_Boolean drawFromCenter, gp_Pnt& aRadLineOrign, gp_Pnt& aRadLineEnd);
|
||||
|
||||
Standard_EXPORT static void ComputeSymbol(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_DimensionAspect)& anAspect,
|
||||
const gp_Pnt& pt1,
|
||||
const gp_Pnt& pt2,
|
||||
const gp_Dir& dir1,
|
||||
const gp_Dir& dir2,
|
||||
const DsgPrs_ArrowSide ArrowSide,
|
||||
const Standard_Boolean drawFromCenter = Standard_True);
|
||||
|
||||
Standard_EXPORT static void ComputePlanarFacesLengthPresentation(
|
||||
const Standard_Real FirstArrowLength,
|
||||
const Standard_Real SecondArrowLength,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& DirAttach,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const gp_Pln& PlaneOfFaces,
|
||||
gp_Pnt& EndOfArrow1,
|
||||
gp_Pnt& EndOfArrow2,
|
||||
gp_Dir& DirOfArrow1);
|
||||
|
||||
Standard_EXPORT static void ComputeCurvilinearFacesLengthPresentation(
|
||||
const Standard_Real FirstArrowLength,
|
||||
const Standard_Real SecondArrowLength,
|
||||
const Handle(Geom_Surface)& SecondSurf,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& DirAttach,
|
||||
gp_Pnt& EndOfArrow2,
|
||||
gp_Dir& DirOfArrow1,
|
||||
Handle(Geom_Curve)& VCurve,
|
||||
Handle(Geom_Curve)& UCurve,
|
||||
Standard_Real& FirstU,
|
||||
Standard_Real& deltaU,
|
||||
Standard_Real& FirstV,
|
||||
Standard_Real& deltaV);
|
||||
|
||||
Standard_EXPORT static void ComputeFacesAnglePresentation(const Standard_Real ArrowLength,
|
||||
const Standard_Real Value,
|
||||
const gp_Pnt& CenterPoint,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& dir1,
|
||||
const gp_Dir& dir2,
|
||||
const gp_Dir& axisdir,
|
||||
const Standard_Boolean isPlane,
|
||||
const gp_Ax1& AxisOfSurf,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
gp_Circ& AngleCirc,
|
||||
Standard_Real& FirstParAngleCirc,
|
||||
Standard_Real& LastParAngleCirc,
|
||||
gp_Pnt& EndOfArrow1,
|
||||
gp_Pnt& EndOfArrow2,
|
||||
gp_Dir& DirOfArrow1,
|
||||
gp_Dir& DirOfArrow2,
|
||||
gp_Pnt& ProjAttachPoint2,
|
||||
gp_Circ& AttachCirc,
|
||||
Standard_Real& FirstParAttachCirc,
|
||||
Standard_Real& LastParAttachCirc);
|
||||
|
||||
Standard_EXPORT static void ComputeRadiusLine(const gp_Pnt& aCenter,
|
||||
const gp_Pnt& anEndOfArrow,
|
||||
const gp_Pnt& aPosition,
|
||||
const Standard_Boolean drawFromCenter,
|
||||
gp_Pnt& aRadLineOrign,
|
||||
gp_Pnt& aRadLineEnd);
|
||||
|
||||
//! computes Geometry for fillet radius presentation;
|
||||
//! special case flag SpecCase equal Standard_True if
|
||||
//! radius of fillet circle = 0 or if anngle between
|
||||
//! Vec1(Center, FirstPoint) and Vec2(Center,SecondPoint) equal 0 or PI
|
||||
Standard_EXPORT static void ComputeFilletRadiusPresentation (const Standard_Real ArrowLength, const Standard_Real Value, const gp_Pnt& Position, const gp_Dir& NormalDir, const gp_Pnt& FirstPoint, const gp_Pnt& SecondPoint, const gp_Pnt& Center, const gp_Pnt& BasePnt, const Standard_Boolean drawRevers, Standard_Boolean& SpecCase, gp_Circ& FilletCirc, Standard_Real& FirstParCirc, Standard_Real& LastParCirc, gp_Pnt& EndOfArrow, gp_Dir& DirOfArrow, gp_Pnt& DrawPosition);
|
||||
|
||||
//! computes length of ellipse arc in parametric units
|
||||
Standard_EXPORT static Standard_Real DistanceFromApex (const gp_Elips& elips, const gp_Pnt& Apex, const Standard_Real par);
|
||||
Standard_EXPORT static void ComputeFilletRadiusPresentation(const Standard_Real ArrowLength,
|
||||
const Standard_Real Value,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Dir& NormalDir,
|
||||
const gp_Pnt& FirstPoint,
|
||||
const gp_Pnt& SecondPoint,
|
||||
const gp_Pnt& Center,
|
||||
const gp_Pnt& BasePnt,
|
||||
const Standard_Boolean drawRevers,
|
||||
Standard_Boolean& SpecCase,
|
||||
gp_Circ& FilletCirc,
|
||||
Standard_Real& FirstParCirc,
|
||||
Standard_Real& LastParCirc,
|
||||
gp_Pnt& EndOfArrow,
|
||||
gp_Dir& DirOfArrow,
|
||||
gp_Pnt& DrawPosition);
|
||||
|
||||
//! computes length of ellipse arc in parametric units
|
||||
Standard_EXPORT static Standard_Real DistanceFromApex(const gp_Elips& elips,
|
||||
const gp_Pnt& Apex,
|
||||
const Standard_Real par);
|
||||
};
|
||||
|
||||
#endif // _DsgPrs_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -31,71 +31,114 @@ class gp_Pnt;
|
||||
class gp_Dir;
|
||||
class gp_Ax1;
|
||||
|
||||
|
||||
//! A framework for displaying angles.
|
||||
class DsgPrs_AnglePresentation
|
||||
class DsgPrs_AnglePresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Draws the presentation of the full angle of a cone.
|
||||
//! VminCircle - a circle at V parameter = Vmin
|
||||
//! VmaxCircle - a circle at V parameter = Vmax
|
||||
//! aCircle - a circle at V parameter from projection of aPosition to axis of the cone
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real aVal, const TCollection_ExtendedString& aText, const gp_Circ& aCircle, const gp_Pnt& aPosition, const gp_Pnt& Apex, const gp_Circ& VminCircle, const gp_Circ& VmaxCircle, const Standard_Real aArrowSize);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real aVal,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Circ& aCircle,
|
||||
const gp_Pnt& aPosition,
|
||||
const gp_Pnt& Apex,
|
||||
const gp_Circ& VminCircle,
|
||||
const gp_Circ& VmaxCircle,
|
||||
const Standard_Real aArrowSize);
|
||||
|
||||
//! Draws the representation of the angle
|
||||
//! defined by dir1 and dir2, centered on
|
||||
//! CenterPoint, using the offset point OffsetPoint.
|
||||
//! Lines are drawn to points AttachmentPoint1 and AttachmentPoint2
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real theval, const gp_Pnt& CenterPoint, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& dir1, const gp_Dir& dir2, const gp_Pnt& OffsetPoint);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const gp_Pnt& CenterPoint,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& dir1,
|
||||
const gp_Dir& dir2,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
//! Same as above, but <thevalstring> contains conversion
|
||||
//! in Session units....
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real theval, const TCollection_ExtendedString& thevalstring, const gp_Pnt& CenterPoint, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& dir1, const gp_Dir& dir2, const gp_Pnt& OffsetPoint);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& thevalstring,
|
||||
const gp_Pnt& CenterPoint,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& dir1,
|
||||
const gp_Dir& dir2,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
//! Same as above, may add one or
|
||||
//! two Arrows according to <ArrowSide> value
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real theval, const TCollection_ExtendedString& thevalstring, const gp_Pnt& CenterPoint, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& dir1, const gp_Dir& dir2, const gp_Pnt& OffsetPoint, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& thevalstring,
|
||||
const gp_Pnt& CenterPoint,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& dir1,
|
||||
const gp_Dir& dir2,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
//! Same as above, but axisdir contains the axis direction
|
||||
//! useful for Revol that can be opened with 180 degrees
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real theval, const TCollection_ExtendedString& thevalstring, const gp_Pnt& CenterPoint, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& dir1, const gp_Dir& dir2, const gp_Dir& axisdir, const gp_Pnt& OffsetPoint);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& thevalstring,
|
||||
const gp_Pnt& CenterPoint,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& dir1,
|
||||
const gp_Dir& dir2,
|
||||
const gp_Dir& axisdir,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
//! Same as above,may add one or
|
||||
//! two Arrows according to <ArrowSide> value
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real theval, const TCollection_ExtendedString& thevalstring, const gp_Pnt& CenterPoint, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& dir1, const gp_Dir& dir2, const gp_Dir& axisdir, const Standard_Boolean isPlane, const gp_Ax1& AxisOfSurf, const gp_Pnt& OffsetPoint, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& thevalstring,
|
||||
const gp_Pnt& CenterPoint,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& dir1,
|
||||
const gp_Dir& dir2,
|
||||
const gp_Dir& axisdir,
|
||||
const Standard_Boolean isPlane,
|
||||
const gp_Ax1& AxisOfSurf,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
//! simple representation of a poor lonesome angle dimension
|
||||
//! Draw a line from <theCenter> to <AttachmentPoint1>, then operates
|
||||
//! a rotation around the perpmay add one or
|
||||
//! two Arrows according to <ArrowSide> value. The
|
||||
//! attributes (color,arrowsize,...) are driven by the Drawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real theval, const gp_Pnt& theCenter, const gp_Pnt& AttachmentPoint1, const gp_Ax1& theAxe, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const gp_Pnt& theCenter,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Ax1& theAxe,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_AnglePresentation_HeaderFile
|
||||
|
@@ -21,15 +21,15 @@
|
||||
//! where they will be displayed in presenting a length.
|
||||
enum DsgPrs_ArrowSide
|
||||
{
|
||||
DsgPrs_AS_NONE,
|
||||
DsgPrs_AS_FIRSTAR,
|
||||
DsgPrs_AS_LASTAR,
|
||||
DsgPrs_AS_BOTHAR,
|
||||
DsgPrs_AS_FIRSTPT,
|
||||
DsgPrs_AS_LASTPT,
|
||||
DsgPrs_AS_BOTHPT,
|
||||
DsgPrs_AS_FIRSTAR_LASTPT,
|
||||
DsgPrs_AS_FIRSTPT_LASTAR
|
||||
DsgPrs_AS_NONE,
|
||||
DsgPrs_AS_FIRSTAR,
|
||||
DsgPrs_AS_LASTAR,
|
||||
DsgPrs_AS_BOTHAR,
|
||||
DsgPrs_AS_FIRSTPT,
|
||||
DsgPrs_AS_LASTPT,
|
||||
DsgPrs_AS_BOTHPT,
|
||||
DsgPrs_AS_FIRSTAR_LASTPT,
|
||||
DsgPrs_AS_FIRSTPT_LASTAR
|
||||
};
|
||||
|
||||
#endif // _DsgPrs_ArrowSide_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs.hxx>
|
||||
#include <DsgPrs_Chamf2dPresentation.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
@@ -27,56 +26,57 @@
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
void DsgPrs_Chamf2dPresentation::Add(
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntEnd,
|
||||
const TCollection_ExtendedString& aText)
|
||||
void DsgPrs_Chamf2dPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntEnd,
|
||||
const TCollection_ExtendedString& aText)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
|
||||
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(aPntAttach);
|
||||
aPrims->AddVertex(aPntEnd);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), aPntAttach, ArrowDir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntEnd);
|
||||
}
|
||||
gp_Dir ArrowDir(aPntAttach.XYZ() - aPntEnd.XYZ());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
aPntAttach,
|
||||
ArrowDir,
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntEnd);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// function : DsgPrs_Chamf2dPresentation::Add
|
||||
// purpose : it is possible to choose the symbol of extremities of the face (arrow, point ...)
|
||||
//==========================================================================
|
||||
|
||||
void DsgPrs_Chamf2dPresentation::Add(
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntEnd,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
void DsgPrs_Chamf2dPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntEnd,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
|
||||
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(aPntAttach);
|
||||
aPrims->AddVertex(aPntEnd);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntEnd);
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntEnd);
|
||||
|
||||
gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
|
||||
gp_Dir ArrowDir(aPntAttach.XYZ() - aPntEnd.XYZ());
|
||||
gp_Dir ArrowDir1 = ArrowDir;
|
||||
ArrowDir1.Reverse();
|
||||
|
||||
DsgPrs::ComputeSymbol(aPresentation,LA,aPntEnd,aPntAttach,ArrowDir1,ArrowDir,ArrowPrs);
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, aPntEnd, aPntAttach, ArrowDir1, ArrowDir, ArrowPrs);
|
||||
}
|
||||
|
@@ -29,21 +29,23 @@ class gp_Pnt;
|
||||
class TCollection_ExtendedString;
|
||||
|
||||
//! Framework for display of 2D chamfers.
|
||||
class DsgPrs_Chamf2dPresentation
|
||||
class DsgPrs_Chamf2dPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Defines the display of elements showing 2D chamfers on shapes.
|
||||
//! These include the text aText, the point of attachment,
|
||||
//! aPntAttach and the end point aPntEnd.
|
||||
//! These arguments are added to the presentation
|
||||
//! object aPresentation. Their display attributes are
|
||||
//! defined by the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& aPntAttach, const gp_Pnt& aPntEnd, const TCollection_ExtendedString& aText);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntEnd,
|
||||
const TCollection_ExtendedString& aText);
|
||||
|
||||
//! Defines the display of texts, symbols and icons used
|
||||
//! to present 2D chamfers.
|
||||
//! These include the text aText, the point of attachment,
|
||||
@@ -53,29 +55,15 @@ public:
|
||||
//! defined by the attribute manager aDrawer. The arrow
|
||||
//! at the point of attachment has a display defined by a
|
||||
//! value of the enumeration DsgPrs_Arrowside.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& aPntAttach, const gp_Pnt& aPntEnd, const TCollection_ExtendedString& aText, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntEnd,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_Chamf2dPresentation_HeaderFile
|
||||
|
@@ -26,46 +26,45 @@
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
|
||||
void DsgPrs_ConcentricPresentation::Add(
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aCenter,
|
||||
const Standard_Real aRadius,
|
||||
const gp_Dir& aNorm,
|
||||
const gp_Pnt& aPoint)
|
||||
void DsgPrs_ConcentricPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aCenter,
|
||||
const Standard_Real aRadius,
|
||||
const gp_Dir& aNorm,
|
||||
const gp_Pnt& aPoint)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
|
||||
//Creation et discretisation du plus gros cercle
|
||||
gp_Circ Circ(gp_Ax2(aCenter,aNorm), aRadius);
|
||||
const Standard_Integer nbp = 50;
|
||||
const Standard_Real dteta = (2. * M_PI)/nbp;
|
||||
// Creation et discretisation du plus gros cercle
|
||||
gp_Circ Circ(gp_Ax2(aCenter, aNorm), aRadius);
|
||||
const Standard_Integer nbp = 50;
|
||||
const Standard_Real dteta = (2. * M_PI) / nbp;
|
||||
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(2*nbp+6,4);
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(2 * nbp + 6, 4);
|
||||
|
||||
gp_Pnt pt1 = ElCLib::Value(0., Circ);
|
||||
aPrims->AddBound(nbp+1);
|
||||
aPrims->AddBound(nbp + 1);
|
||||
aPrims->AddVertex(pt1);
|
||||
Standard_Real ucur = dteta;
|
||||
Standard_Integer i ;
|
||||
for (i = 2; i<=nbp; i++, ucur += dteta)
|
||||
Standard_Real ucur = dteta;
|
||||
Standard_Integer i;
|
||||
for (i = 2; i <= nbp; i++, ucur += dteta)
|
||||
aPrims->AddVertex(ElCLib::Value(ucur, Circ));
|
||||
aPrims->AddVertex(pt1);
|
||||
|
||||
//Creation et discretisation du plus petit cercle
|
||||
Circ.SetRadius(0.5*aRadius);
|
||||
// Creation et discretisation du plus petit cercle
|
||||
Circ.SetRadius(0.5 * aRadius);
|
||||
pt1 = ElCLib::Value(0., Circ);
|
||||
aPrims->AddBound(nbp+1);
|
||||
aPrims->AddBound(nbp + 1);
|
||||
aPrims->AddVertex(pt1);
|
||||
ucur = dteta;
|
||||
for (i = 2; i<=nbp; i++, ucur += dteta)
|
||||
for (i = 2; i <= nbp; i++, ucur += dteta)
|
||||
aPrims->AddVertex(ElCLib::Value(ucur, Circ));
|
||||
aPrims->AddVertex(pt1);
|
||||
|
||||
//Creation de la croix
|
||||
//1er segment
|
||||
// Creation de la croix
|
||||
// 1er segment
|
||||
gp_Dir vecnorm(aPoint.XYZ() - aCenter.XYZ());
|
||||
gp_Vec vec(vecnorm);
|
||||
vec.Multiply(aRadius);
|
||||
@@ -76,9 +75,9 @@ void DsgPrs_ConcentricPresentation::Add(
|
||||
aPrims->AddVertex(p1);
|
||||
aPrims->AddVertex(p2);
|
||||
|
||||
//2ieme segment
|
||||
// 2ieme segment
|
||||
vec.Cross(aNorm);
|
||||
vecnorm.SetCoord(vec.X(), vec.Y(), vec.Z() );
|
||||
vecnorm.SetCoord(vec.X(), vec.Y(), vec.Z());
|
||||
vec.SetXYZ(vecnorm.XYZ());
|
||||
vec.Multiply(aRadius);
|
||||
p1 = aCenter.Translated(vec);
|
||||
|
@@ -27,13 +27,11 @@ class gp_Pnt;
|
||||
class gp_Dir;
|
||||
|
||||
//! A framework to define display of relations of concentricity.
|
||||
class DsgPrs_ConcentricPresentation
|
||||
class DsgPrs_ConcentricPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Defines the display of elements showing relations of
|
||||
//! concentricity between shapes.
|
||||
//! These include the center aCenter, the radius
|
||||
@@ -41,29 +39,15 @@ public:
|
||||
//! These arguments are added to the presentation
|
||||
//! object aPresentation. Their display attributes are
|
||||
//! defined by the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& aCenter, const Standard_Real aRadius, const gp_Dir& aNorm, const gp_Pnt& aPoint);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aCenter,
|
||||
const Standard_Real aRadius,
|
||||
const gp_Dir& aNorm,
|
||||
const gp_Pnt& aPoint);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_ConcentricPresentation_HeaderFile
|
||||
|
@@ -25,47 +25,68 @@
|
||||
// function : Add
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void DsgPrs_DatumPrs::Add (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Ax2& theDatum,
|
||||
const Handle(Prs3d_Drawer)& theDrawer)
|
||||
void DsgPrs_DatumPrs::Add(const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Ax2& theDatum,
|
||||
const Handle(Prs3d_Drawer)& theDrawer)
|
||||
{
|
||||
Handle(Prs3d_DatumAspect) aDatumAspect = theDrawer->DatumAspect();
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->CurrentGroup();
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->CurrentGroup();
|
||||
|
||||
gp_Ax2 anAxis (theDatum);
|
||||
gp_Ax2 anAxis(theDatum);
|
||||
gp_Pnt anOrigin = anAxis.Location();
|
||||
gp_Dir aXDir = anAxis.XDirection();
|
||||
gp_Dir aYDir = anAxis.YDirection();
|
||||
gp_Dir aZDir = anAxis.Direction();
|
||||
gp_Dir aXDir = anAxis.XDirection();
|
||||
gp_Dir aYDir = anAxis.YDirection();
|
||||
gp_Dir aZDir = anAxis.Direction();
|
||||
|
||||
Standard_Real anAxisLength;
|
||||
Standard_Real anAxisLength;
|
||||
const Standard_Boolean toDrawLabels = theDrawer->DatumAspect()->ToDrawLabels();
|
||||
|
||||
Prs3d_DatumAxes anAxes = aDatumAspect->DatumAxes();
|
||||
Prs3d_DatumAxes anAxes = aDatumAspect->DatumAxes();
|
||||
Handle(Prs3d_ArrowAspect) anArrowAspect = aDatumAspect->ArrowAspect();
|
||||
Handle(Prs3d_TextAspect) aTextAspect = theDrawer->TextAspect();
|
||||
Handle(Prs3d_TextAspect) aTextAspect = theDrawer->TextAspect();
|
||||
|
||||
if ((anAxes & Prs3d_DatumAxes_XAxis) != 0)
|
||||
{
|
||||
anAxisLength = aDatumAspect->Attribute (Prs3d_DatumAttribute_XAxisLength);
|
||||
const gp_Pnt aPoint1 (anOrigin.XYZ() + aXDir.XYZ()*anAxisLength);
|
||||
DsgPrs_XYZAxisPresentation::Add (thePresentation, aDatumAspect->LineAspect(Prs3d_DatumParts_XAxis), anArrowAspect,
|
||||
aTextAspect, aXDir, anAxisLength, toDrawLabels ? "X" : "", anOrigin, aPoint1);
|
||||
anAxisLength = aDatumAspect->Attribute(Prs3d_DatumAttribute_XAxisLength);
|
||||
const gp_Pnt aPoint1(anOrigin.XYZ() + aXDir.XYZ() * anAxisLength);
|
||||
DsgPrs_XYZAxisPresentation::Add(thePresentation,
|
||||
aDatumAspect->LineAspect(Prs3d_DatumParts_XAxis),
|
||||
anArrowAspect,
|
||||
aTextAspect,
|
||||
aXDir,
|
||||
anAxisLength,
|
||||
toDrawLabels ? "X" : "",
|
||||
anOrigin,
|
||||
aPoint1);
|
||||
}
|
||||
|
||||
if ((anAxes & Prs3d_DatumAxes_YAxis) != 0)
|
||||
{
|
||||
anAxisLength = aDatumAspect->Attribute (Prs3d_DatumAttribute_YAxisLength);
|
||||
const gp_Pnt aPoint2 (anOrigin.XYZ() + aYDir.XYZ()*anAxisLength);
|
||||
DsgPrs_XYZAxisPresentation::Add (thePresentation, aDatumAspect->LineAspect(Prs3d_DatumParts_YAxis), anArrowAspect,
|
||||
aTextAspect, aYDir, anAxisLength, toDrawLabels ? "Y" : "", anOrigin, aPoint2);
|
||||
anAxisLength = aDatumAspect->Attribute(Prs3d_DatumAttribute_YAxisLength);
|
||||
const gp_Pnt aPoint2(anOrigin.XYZ() + aYDir.XYZ() * anAxisLength);
|
||||
DsgPrs_XYZAxisPresentation::Add(thePresentation,
|
||||
aDatumAspect->LineAspect(Prs3d_DatumParts_YAxis),
|
||||
anArrowAspect,
|
||||
aTextAspect,
|
||||
aYDir,
|
||||
anAxisLength,
|
||||
toDrawLabels ? "Y" : "",
|
||||
anOrigin,
|
||||
aPoint2);
|
||||
}
|
||||
|
||||
if ((anAxes & Prs3d_DatumAxes_ZAxis) != 0)
|
||||
{
|
||||
anAxisLength = aDatumAspect->Attribute (Prs3d_DatumAttribute_ZAxisLength);
|
||||
const gp_Pnt aPoint3 (anOrigin.XYZ() + aZDir.XYZ()*anAxisLength);
|
||||
DsgPrs_XYZAxisPresentation::Add (thePresentation, aDatumAspect->LineAspect(Prs3d_DatumParts_ZAxis), anArrowAspect,
|
||||
aTextAspect, aZDir, anAxisLength, toDrawLabels ? "Z" : "", anOrigin, aPoint3);
|
||||
anAxisLength = aDatumAspect->Attribute(Prs3d_DatumAttribute_ZAxisLength);
|
||||
const gp_Pnt aPoint3(anOrigin.XYZ() + aZDir.XYZ() * anAxisLength);
|
||||
DsgPrs_XYZAxisPresentation::Add(thePresentation,
|
||||
aDatumAspect->LineAspect(Prs3d_DatumParts_ZAxis),
|
||||
anArrowAspect,
|
||||
aTextAspect,
|
||||
aZDir,
|
||||
anAxisLength,
|
||||
toDrawLabels ? "Z" : "",
|
||||
anOrigin,
|
||||
aPoint3);
|
||||
}
|
||||
}
|
||||
|
@@ -22,10 +22,10 @@
|
||||
class DsgPrs_DatumPrs : public Prs3d_Root
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Draw XYZ axes at specified location with attributes defined by the attribute manager theDrawer:
|
||||
//! Draw XYZ axes at specified location with attributes defined by the attribute manager
|
||||
//! theDrawer:
|
||||
//! - Prs3d_DatumAspect defines arrow, line and length trihedron axis parameters,
|
||||
//! - Prs3d_TextAspect defines displayed text.
|
||||
//! The thihedron origin and axis directions are defined by theDatum coordinate system.
|
||||
@@ -34,8 +34,8 @@ public:
|
||||
//! @param[out] thePresentation the modified presentation
|
||||
//! @param[in] theDatum the source of trihedron position
|
||||
//! @param[in] theDrawer the provider of display attributes
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const gp_Ax2& theDatum,
|
||||
const Handle(Prs3d_Drawer)& theDrawer);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Ax2& theDatum,
|
||||
const Handle(Prs3d_Drawer)& theDrawer);
|
||||
};
|
||||
#endif
|
||||
|
@@ -34,37 +34,38 @@
|
||||
// function : DsgPrs_DiameterPresentation::Add
|
||||
// purpose : it is possible to choose the symbol of extremities of the face (arrow, point ...)
|
||||
//==========================================================================
|
||||
void DsgPrs_DiameterPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const DsgPrs_ArrowSide ArrowPrs,
|
||||
const Standard_Boolean IsDiamSymbol )
|
||||
void DsgPrs_DiameterPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const DsgPrs_ArrowSide ArrowPrs,
|
||||
const Standard_Boolean IsDiamSymbol)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
Standard_Real parat = ElCLib::Parameter(aCircle, AttachmentPoint);
|
||||
gp_Pnt ptoncirc = ElCLib::Value (parat, aCircle);
|
||||
gp_Pnt ptoncirc = ElCLib::Value(parat, aCircle);
|
||||
|
||||
// sideline
|
||||
gp_Pnt center = aCircle.Location();
|
||||
gp_Vec vecrap (ptoncirc,center);
|
||||
gp_Pnt center = aCircle.Location();
|
||||
gp_Vec vecrap(ptoncirc, center);
|
||||
|
||||
Standard_Real dist = center.Distance(AttachmentPoint);
|
||||
Standard_Real aRadius = aCircle.Radius();
|
||||
Standard_Boolean inside = (dist < aRadius);
|
||||
Standard_Real dist = center.Distance(AttachmentPoint);
|
||||
Standard_Real aRadius = aCircle.Radius();
|
||||
Standard_Boolean inside = (dist < aRadius);
|
||||
|
||||
gp_Pnt pt1 = AttachmentPoint;
|
||||
if (inside) {
|
||||
pt1 = ptoncirc;
|
||||
if (inside)
|
||||
{
|
||||
pt1 = ptoncirc;
|
||||
dist = aRadius;
|
||||
}
|
||||
vecrap.Normalize();
|
||||
vecrap *= (dist+aRadius);
|
||||
vecrap *= (dist + aRadius);
|
||||
gp_Pnt OppositePoint = pt1.Translated(vecrap);
|
||||
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(pt1);
|
||||
aPrims->AddVertex(OppositePoint);
|
||||
@@ -72,107 +73,118 @@ void DsgPrs_DiameterPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
|
||||
|
||||
// value
|
||||
TCollection_ExtendedString Text = aText;
|
||||
if(IsDiamSymbol)
|
||||
Text = TCollection_ExtendedString("\330 ") + aText; // VRO (2007-05-17) inserted a blank.
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), Text, AttachmentPoint);
|
||||
if (IsDiamSymbol)
|
||||
Text = TCollection_ExtendedString("\330 ") + aText; // VRO (2007-05-17) inserted a blank.
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), Text, AttachmentPoint);
|
||||
|
||||
// arrows
|
||||
gp_Dir arrdir (vecrap);
|
||||
if (inside) arrdir.Reverse();
|
||||
gp_Dir arrdir(vecrap);
|
||||
if (inside)
|
||||
arrdir.Reverse();
|
||||
|
||||
gp_Vec vecrap2 = vecrap;
|
||||
gp_Vec vecrap2 = vecrap;
|
||||
gp_Pnt ptoncirc2 = ptoncirc;
|
||||
gp_Dir arrdir2 = arrdir;
|
||||
gp_Dir arrdir2 = arrdir;
|
||||
vecrap2.Normalize();
|
||||
vecrap2 *= (aCircle.Radius() * 2.);
|
||||
ptoncirc2.Translate (vecrap2);
|
||||
ptoncirc2.Translate(vecrap2);
|
||||
arrdir2.Reverse();
|
||||
|
||||
DsgPrs::ComputeSymbol(aPresentation,LA,ptoncirc,ptoncirc2,arrdir,arrdir2,ArrowPrs);
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, ptoncirc, ptoncirc2, arrdir, arrdir2, ArrowPrs);
|
||||
}
|
||||
|
||||
|
||||
static Standard_Boolean DsgPrs_InDomain(const Standard_Real fpar,
|
||||
const Standard_Real lpar,
|
||||
const Standard_Real para)
|
||||
const Standard_Real lpar,
|
||||
const Standard_Real para)
|
||||
{
|
||||
if (fpar >= 0.) {
|
||||
if(lpar > fpar)
|
||||
if (fpar >= 0.)
|
||||
{
|
||||
if (lpar > fpar)
|
||||
return ((para >= fpar) && (para <= lpar));
|
||||
else { // fpar > lpar
|
||||
Standard_Real delta = 2.*M_PI-fpar;
|
||||
else
|
||||
{ // fpar > lpar
|
||||
Standard_Real delta = 2. * M_PI - fpar;
|
||||
Standard_Real lp, par, fp;
|
||||
lp = lpar + delta;
|
||||
lp = lpar + delta;
|
||||
par = para + delta;
|
||||
while(lp > 2*M_PI) lp-=2*M_PI;
|
||||
while(par > 2*M_PI) par-=2*M_PI;
|
||||
while (lp > 2 * M_PI)
|
||||
lp -= 2 * M_PI;
|
||||
while (par > 2 * M_PI)
|
||||
par -= 2 * M_PI;
|
||||
fp = 0.;
|
||||
return ((par >= fp) && (par <= lp));
|
||||
}
|
||||
}
|
||||
if (para >= (fpar+2*M_PI)) return Standard_True;
|
||||
if (para <= lpar) return Standard_True;
|
||||
if (para >= (fpar + 2 * M_PI))
|
||||
return Standard_True;
|
||||
if (para <= lpar)
|
||||
return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DsgPrs_DiameterPresentation::Add
|
||||
//purpose : SZY 12-february-98
|
||||
// function : DsgPrs_DiameterPresentation::Add
|
||||
// purpose : SZY 12-february-98
|
||||
//=======================================================================
|
||||
|
||||
void DsgPrs_DiameterPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const Standard_Real uFirst,
|
||||
const Standard_Real uLast,
|
||||
const DsgPrs_ArrowSide ArrowPrs,//ArrowSide
|
||||
const Standard_Boolean IsDiamSymbol )
|
||||
void DsgPrs_DiameterPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const Standard_Real uFirst,
|
||||
const Standard_Real uLast,
|
||||
const DsgPrs_ArrowSide ArrowPrs, // ArrowSide
|
||||
const Standard_Boolean IsDiamSymbol)
|
||||
{
|
||||
Standard_Real fpara = uFirst;
|
||||
Standard_Real lpara = uLast;
|
||||
while (lpara > 2.*M_PI) {
|
||||
fpara -= 2.*M_PI;
|
||||
lpara -= 2.*M_PI;
|
||||
while (lpara > 2. * M_PI)
|
||||
{
|
||||
fpara -= 2. * M_PI;
|
||||
lpara -= 2. * M_PI;
|
||||
}
|
||||
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
Standard_Real parEndOfArrow = ElCLib::Parameter(aCircle,AttachmentPoint);
|
||||
gp_Pnt EndOfArrow;
|
||||
gp_Pnt DrawPosition = AttachmentPoint;// point of attachment
|
||||
Standard_Real parEndOfArrow = ElCLib::Parameter(aCircle, AttachmentPoint);
|
||||
gp_Pnt EndOfArrow;
|
||||
gp_Pnt DrawPosition = AttachmentPoint; // point of attachment
|
||||
|
||||
gp_Pnt Center = aCircle.Location();
|
||||
gp_Pnt FirstPoint = ElCLib::Value(uFirst, aCircle);
|
||||
gp_Pnt Center = aCircle.Location();
|
||||
gp_Pnt FirstPoint = ElCLib::Value(uFirst, aCircle);
|
||||
gp_Pnt SecondPoint = ElCLib::Value(uLast, aCircle);
|
||||
|
||||
if ( !DsgPrs_InDomain(fpara,lpara,parEndOfArrow)) {
|
||||
Standard_Real otherpar = parEndOfArrow + M_PI;// not in domain
|
||||
if (otherpar > 2*M_PI) otherpar -= 2*M_PI;
|
||||
if (DsgPrs_InDomain(fpara,lpara,otherpar)) {
|
||||
if (!DsgPrs_InDomain(fpara, lpara, parEndOfArrow))
|
||||
{
|
||||
Standard_Real otherpar = parEndOfArrow + M_PI; // not in domain
|
||||
if (otherpar > 2 * M_PI)
|
||||
otherpar -= 2 * M_PI;
|
||||
if (DsgPrs_InDomain(fpara, lpara, otherpar))
|
||||
{
|
||||
parEndOfArrow = otherpar; // parameter on circle
|
||||
EndOfArrow = ElCLib::Value(parEndOfArrow, aCircle);
|
||||
EndOfArrow = ElCLib::Value(parEndOfArrow, aCircle);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
gp_Dir dir1(gp_Vec(Center, FirstPoint));
|
||||
gp_Dir dir2(gp_Vec(Center, SecondPoint));
|
||||
gp_Lin L1( Center, dir1 );
|
||||
gp_Lin L2( Center, dir2 );
|
||||
if(L1.Distance(AttachmentPoint) < L2.Distance(AttachmentPoint))
|
||||
gp_Lin L1(Center, dir1);
|
||||
gp_Lin L2(Center, dir2);
|
||||
if (L1.Distance(AttachmentPoint) < L2.Distance(AttachmentPoint))
|
||||
{
|
||||
EndOfArrow = FirstPoint; //***
|
||||
DrawPosition = ElCLib::Value(ElCLib::Parameter( L1, AttachmentPoint ), L1);
|
||||
EndOfArrow = FirstPoint; //***
|
||||
DrawPosition = ElCLib::Value(ElCLib::Parameter(L1, AttachmentPoint), L1);
|
||||
}
|
||||
else
|
||||
{
|
||||
EndOfArrow = SecondPoint; //***
|
||||
DrawPosition = ElCLib::Value(ElCLib::Parameter( L2, AttachmentPoint ), L2);
|
||||
}
|
||||
EndOfArrow = SecondPoint; //***
|
||||
DrawPosition = ElCLib::Value(ElCLib::Parameter(L2, AttachmentPoint), L2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
}
|
||||
else
|
||||
{
|
||||
EndOfArrow = ElCLib::Value(parEndOfArrow, aCircle);
|
||||
DrawPosition = AttachmentPoint;
|
||||
}
|
||||
@@ -184,11 +196,17 @@ void DsgPrs_DiameterPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
|
||||
|
||||
// text
|
||||
TCollection_ExtendedString Text = aText;
|
||||
if(IsDiamSymbol)
|
||||
Text = TCollection_ExtendedString("\330 ") + Text;// => \330 | \370?
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), Text, DrawPosition);
|
||||
if (IsDiamSymbol)
|
||||
Text = TCollection_ExtendedString("\330 ") + Text; // => \330 | \370?
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), Text, DrawPosition);
|
||||
|
||||
// Add presentation of arrow
|
||||
gp_Dir DirOfArrow(gp_Vec(DrawPosition, EndOfArrow).XYZ());
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, EndOfArrow, EndOfArrow, DirOfArrow, DirOfArrow, ArrowPrs);
|
||||
// Add presentation of arrow
|
||||
gp_Dir DirOfArrow(gp_Vec(DrawPosition, EndOfArrow).XYZ());
|
||||
DsgPrs::ComputeSymbol(aPresentation,
|
||||
LA,
|
||||
EndOfArrow,
|
||||
EndOfArrow,
|
||||
DirOfArrow,
|
||||
DirOfArrow,
|
||||
ArrowPrs);
|
||||
}
|
||||
|
@@ -28,15 +28,12 @@ class TCollection_ExtendedString;
|
||||
class gp_Pnt;
|
||||
class gp_Circ;
|
||||
|
||||
|
||||
//! A framework for displaying diameters in shapes.
|
||||
class DsgPrs_DiameterPresentation
|
||||
class DsgPrs_DiameterPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Draws the diameter of the circle aCircle displayed in
|
||||
//! the presentation aPresentation and with attributes
|
||||
//! defined by the attribute manager aDrawer. The point
|
||||
@@ -45,8 +42,14 @@ public:
|
||||
//! The value of the enumeration ArrowSide controls
|
||||
//! whether arrows will be displayed at either or both
|
||||
//! ends of the length. The text aText labels the diameter.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint, const gp_Circ& aCircle, const DsgPrs_ArrowSide ArrowSide, const Standard_Boolean IsDiamSymbol);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const DsgPrs_ArrowSide ArrowSide,
|
||||
const Standard_Boolean IsDiamSymbol);
|
||||
|
||||
//! Draws the diameter of the arc anArc displayed in the
|
||||
//! presentation aPresentation and with attributes
|
||||
//! defined by the attribute manager aDrawer. The point
|
||||
@@ -56,29 +59,18 @@ public:
|
||||
//! arrows will be displayed at either or both ends of the
|
||||
//! length. The parameters uFirst and uLast define the
|
||||
//! first and last points of the arc. The text aText labels the diameter.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint, const gp_Circ& aCircle, const Standard_Real uFirst, const Standard_Real uLast, const DsgPrs_ArrowSide ArrowSide, const Standard_Boolean IsDiamSymbol);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const Standard_Real uFirst,
|
||||
const Standard_Real uLast,
|
||||
const DsgPrs_ArrowSide ArrowSide,
|
||||
const Standard_Boolean IsDiamSymbol);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_DiameterPresentation_HeaderFile
|
||||
|
@@ -33,26 +33,24 @@
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString & aText,
|
||||
const gp_Pnt & aPosition,
|
||||
const gp_Pnt & anEndOfArrow,
|
||||
const gp_Pnt & aCenter,
|
||||
const Standard_Boolean IsMaxRadius,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
//=================================================================================================
|
||||
|
||||
void DsgPrs_EllipseRadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aPosition,
|
||||
const gp_Pnt& anEndOfArrow,
|
||||
const gp_Pnt& aCenter,
|
||||
const Standard_Boolean IsMaxRadius,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
const Standard_Real dist = aCenter.Distance( aPosition );
|
||||
const Standard_Boolean inside = ( dist <= theval );
|
||||
gp_Pnt EndPoint(inside? anEndOfArrow : aPosition);
|
||||
|
||||
const Standard_Real dist = aCenter.Distance(aPosition);
|
||||
const Standard_Boolean inside = (dist <= theval);
|
||||
gp_Pnt EndPoint(inside ? anEndOfArrow : aPosition);
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(aCenter);
|
||||
@@ -60,110 +58,124 @@ void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aP
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// value
|
||||
TCollection_ExtendedString Text(IsMaxRadius? "a = " : "b = ");
|
||||
TCollection_ExtendedString Text(IsMaxRadius ? "a = " : "b = ");
|
||||
Text += aText;
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), Text, aPosition);
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), Text, aPosition);
|
||||
|
||||
// arrows
|
||||
gp_Dir arrdir( gp_Vec( aCenter, anEndOfArrow));
|
||||
if (!inside) arrdir.Reverse();
|
||||
gp_Dir arrdir(gp_Vec(aCenter, anEndOfArrow));
|
||||
if (!inside)
|
||||
arrdir.Reverse();
|
||||
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, anEndOfArrow, anEndOfArrow, arrdir, arrdir, ArrowPrs );
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, anEndOfArrow, anEndOfArrow, arrdir, arrdir, ArrowPrs);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString & aText,
|
||||
const gp_Elips & anEllipse,
|
||||
const gp_Pnt & aPosition,
|
||||
const gp_Pnt & anEndOfArrow,
|
||||
const gp_Pnt & aCenter,
|
||||
const Standard_Real uFirst,
|
||||
const Standard_Boolean IsInDomain,
|
||||
const Standard_Boolean IsMaxRadius,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
void DsgPrs_EllipseRadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Elips& anEllipse,
|
||||
const gp_Pnt& aPosition,
|
||||
const gp_Pnt& anEndOfArrow,
|
||||
const gp_Pnt& aCenter,
|
||||
const Standard_Real uFirst,
|
||||
const Standard_Boolean IsInDomain,
|
||||
const Standard_Boolean IsMaxRadius,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
if(!IsInDomain)
|
||||
if (!IsInDomain)
|
||||
{
|
||||
const Standard_Real uLast = ElCLib::Parameter ( anEllipse, anEndOfArrow );
|
||||
// clang-format off
|
||||
const Standard_Real uLast = ElCLib::Parameter(anEllipse, anEndOfArrow);
|
||||
// clang-format off
|
||||
const Standard_Real Alpha = DsgPrs::DistanceFromApex(anEllipse, anEndOfArrow, uFirst);//length of ellipse arc
|
||||
// clang-format on
|
||||
gp_Vec Vapex(aCenter, ElCLib::Value( uLast, anEllipse )) ;
|
||||
gp_Vec Vpnt(aCenter, ElCLib::Value( uFirst, anEllipse )) ;
|
||||
gp_Dir dir(Vpnt ^ Vapex);
|
||||
Standard_Real parFirst = anEllipse.Position().Direction().IsOpposite( dir, Precision::Angular())? uLast : uFirst;
|
||||
const Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / ( NodeNumber - 1 );
|
||||
// clang-format on
|
||||
gp_Vec Vapex(aCenter, ElCLib::Value(uLast, anEllipse));
|
||||
gp_Vec Vpnt(aCenter, ElCLib::Value(uFirst, anEllipse));
|
||||
gp_Dir dir(Vpnt ^ Vapex);
|
||||
Standard_Real parFirst =
|
||||
anEllipse.Position().Direction().IsOpposite(dir, Precision::Angular()) ? uLast : uFirst;
|
||||
const Standard_Integer NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / (NodeNumber - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
for (Standard_Integer i = 0 ; i < NodeNumber; i++, parFirst += delta)
|
||||
aPrims->AddVertex(ElCLib::Value( parFirst, anEllipse ));
|
||||
for (Standard_Integer i = 0; i < NodeNumber; i++, parFirst += delta)
|
||||
aPrims->AddVertex(ElCLib::Value(parFirst, anEllipse));
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
DsgPrs_EllipseRadiusPresentation::Add(aPresentation, aDrawer, theval, aText,
|
||||
aPosition, anEndOfArrow, aCenter, IsMaxRadius, ArrowPrs);
|
||||
DsgPrs_EllipseRadiusPresentation::Add(aPresentation,
|
||||
aDrawer,
|
||||
theval,
|
||||
aText,
|
||||
aPosition,
|
||||
anEndOfArrow,
|
||||
aCenter,
|
||||
IsMaxRadius,
|
||||
ArrowPrs);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose : // for offset curve
|
||||
// function : Add
|
||||
// purpose : // for offset curve
|
||||
//=======================================================================
|
||||
|
||||
void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString & aText,
|
||||
const Handle(Geom_OffsetCurve) & aCurve,
|
||||
const gp_Pnt & aPosition,
|
||||
const gp_Pnt & anEndOfArrow,
|
||||
const gp_Pnt & aCenter,
|
||||
const Standard_Real uFirst,
|
||||
const Standard_Boolean IsInDomain,
|
||||
const Standard_Boolean IsMaxRadius,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
void DsgPrs_EllipseRadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const Handle(Geom_OffsetCurve)& aCurve,
|
||||
const gp_Pnt& aPosition,
|
||||
const gp_Pnt& anEndOfArrow,
|
||||
const gp_Pnt& aCenter,
|
||||
const Standard_Real uFirst,
|
||||
const Standard_Boolean IsInDomain,
|
||||
const Standard_Boolean IsMaxRadius,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
if(!IsInDomain)
|
||||
if (!IsInDomain)
|
||||
{
|
||||
if(!aCurve->IsCN(1)) return ;
|
||||
gp_Elips aBEllipse = Handle(Geom_Ellipse)::DownCast(aCurve->BasisCurve ())->Elips();
|
||||
const Standard_Real Offset = aCurve->Offset();
|
||||
if (!aCurve->IsCN(1))
|
||||
return;
|
||||
gp_Elips aBEllipse = Handle(Geom_Ellipse)::DownCast(aCurve->BasisCurve())->Elips();
|
||||
const Standard_Real Offset = aCurve->Offset();
|
||||
aBEllipse.SetMajorRadius(aBEllipse.MajorRadius() + Offset);
|
||||
aBEllipse.SetMinorRadius(aBEllipse.MinorRadius() + Offset);
|
||||
const Standard_Real uLast = ElCLib::Parameter ( aBEllipse, anEndOfArrow );
|
||||
// clang-format off
|
||||
const Standard_Real uLast = ElCLib::Parameter(aBEllipse, anEndOfArrow);
|
||||
// clang-format off
|
||||
const Standard_Real Alpha = DsgPrs::DistanceFromApex(aBEllipse, anEndOfArrow, uFirst);//length of ellipse arc
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
gp_Pnt p1;
|
||||
aCurve->D0(uFirst, p1);
|
||||
gp_Vec Vapex(aCenter, anEndOfArrow) ;
|
||||
gp_Vec Vpnt (aCenter, p1) ;
|
||||
gp_Dir dir(Vpnt ^ Vapex);
|
||||
Standard_Real parFirst = aCurve->Direction().IsOpposite( dir, Precision::Angular())? uLast : uFirst;
|
||||
const Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / ( NodeNumber - 1 );
|
||||
gp_Vec Vapex(aCenter, anEndOfArrow);
|
||||
gp_Vec Vpnt(aCenter, p1);
|
||||
gp_Dir dir(Vpnt ^ Vapex);
|
||||
Standard_Real parFirst =
|
||||
aCurve->Direction().IsOpposite(dir, Precision::Angular()) ? uLast : uFirst;
|
||||
const Standard_Integer NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / (NodeNumber - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
for (Standard_Integer i = 0 ; i < NodeNumber; i++, parFirst += delta)
|
||||
{
|
||||
aCurve->D0( parFirst, p1 );
|
||||
aPrims->AddVertex(p1);
|
||||
}
|
||||
for (Standard_Integer i = 0; i < NodeNumber; i++, parFirst += delta)
|
||||
{
|
||||
aCurve->D0(parFirst, p1);
|
||||
aPrims->AddVertex(p1);
|
||||
}
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
DsgPrs_EllipseRadiusPresentation::Add(aPresentation, aDrawer, theval, aText,
|
||||
aPosition, anEndOfArrow, aCenter, IsMaxRadius, ArrowPrs);
|
||||
DsgPrs_EllipseRadiusPresentation::Add(aPresentation,
|
||||
aDrawer,
|
||||
theval,
|
||||
aText,
|
||||
aPosition,
|
||||
anEndOfArrow,
|
||||
aCenter,
|
||||
IsMaxRadius,
|
||||
ArrowPrs);
|
||||
}
|
||||
|
@@ -29,46 +29,55 @@ class gp_Pnt;
|
||||
class gp_Elips;
|
||||
class Geom_OffsetCurve;
|
||||
|
||||
class DsgPrs_EllipseRadiusPresentation
|
||||
class DsgPrs_EllipseRadiusPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! draws a Radius (Major or Minor)
|
||||
//! representation for whole ellipse case
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real theval, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint, const gp_Pnt& anEndOfArrow, const gp_Pnt& aCenter, const Standard_Boolean IsMaxRadius, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Pnt& anEndOfArrow,
|
||||
const gp_Pnt& aCenter,
|
||||
const Standard_Boolean IsMaxRadius,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
//! draws a Radius (Major or Minor) representation
|
||||
//! for arc of an ellipse case
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real theval, const TCollection_ExtendedString& aText, const gp_Elips& anEllipse, const gp_Pnt& AttachmentPoint, const gp_Pnt& anEndOfArrow, const gp_Pnt& aCenter, const Standard_Real uFirst, const Standard_Boolean IsInDomain, const Standard_Boolean IsMaxRadius, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Elips& anEllipse,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Pnt& anEndOfArrow,
|
||||
const gp_Pnt& aCenter,
|
||||
const Standard_Real uFirst,
|
||||
const Standard_Boolean IsInDomain,
|
||||
const Standard_Boolean IsMaxRadius,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
//! draws a Radius (Major or Minor) representation
|
||||
//! for arc of an offset curve from ellipse
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real theval, const TCollection_ExtendedString& aText, const Handle(Geom_OffsetCurve)& aCurve, const gp_Pnt& AttachmentPoint, const gp_Pnt& anEndOfArrow, const gp_Pnt& aCenter, const Standard_Real uFirst, const Standard_Boolean IsInDomain, const Standard_Boolean IsMaxRadius, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const Handle(Geom_OffsetCurve)& aCurve,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Pnt& anEndOfArrow,
|
||||
const gp_Pnt& aCenter,
|
||||
const Standard_Real uFirst,
|
||||
const Standard_Boolean IsInDomain,
|
||||
const Standard_Boolean IsMaxRadius,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_EllipseRadiusPresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs.hxx>
|
||||
#include <DsgPrs_EqualDistancePresentation.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
@@ -36,21 +35,22 @@
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
//=================================================================================
|
||||
//function : Add
|
||||
// function : Add
|
||||
//=================================================================================
|
||||
void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )& aPresentation,
|
||||
const Handle( Prs3d_Drawer )& aDrawer,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const gp_Pnt& Point3,
|
||||
const gp_Pnt& Point4,
|
||||
const Handle( Geom_Plane )& Plane )
|
||||
void DsgPrs_EqualDistancePresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const gp_Pnt& Point3,
|
||||
const gp_Pnt& Point4,
|
||||
const Handle(Geom_Plane)& Plane)
|
||||
{
|
||||
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
// Line between two middles
|
||||
gp_Pnt Middle12( (Point1.XYZ() + Point2.XYZ()) * 0.5 ), Middle34( (Point3.XYZ() + Point4.XYZ()) * 0.5 );
|
||||
gp_Pnt Middle12((Point1.XYZ() + Point2.XYZ()) * 0.5),
|
||||
Middle34((Point3.XYZ() + Point4.XYZ()) * 0.5);
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(Middle12);
|
||||
@@ -58,85 +58,84 @@ void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )&
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// Add presentation of arrows (points)
|
||||
gp_Dir aDir( 0, 0, 1 );
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, Middle12, Middle34, aDir, aDir, DsgPrs_AS_BOTHPT );
|
||||
// ota -- begin --
|
||||
gp_Dir aDir(0, 0, 1);
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, Middle12, Middle34, aDir, aDir, DsgPrs_AS_BOTHPT);
|
||||
// ota -- begin --
|
||||
// Two small lines in the middle of this line
|
||||
gp_Pnt Middle( (Middle12.XYZ() + Middle34.XYZ()) * 0.5 ), aTextPos;
|
||||
Standard_Real Dist = Middle12.Distance( Middle34 );
|
||||
gp_Pnt Middle((Middle12.XYZ() + Middle34.XYZ()) * 0.5), aTextPos;
|
||||
Standard_Real Dist = Middle12.Distance(Middle34);
|
||||
Standard_Real SmallDist;
|
||||
gp_Dir LineDir, OrtDir;
|
||||
gp_Vec LineVec, OrtVec;
|
||||
gp_Dir LineDir, OrtDir;
|
||||
gp_Vec LineVec, OrtVec;
|
||||
|
||||
if (Dist > Precision::Confusion())
|
||||
{
|
||||
SmallDist = Dist * 0.05; // 1/20.0 part
|
||||
if (SmallDist <= Precision::Confusion())
|
||||
SmallDist = Dist;
|
||||
LineDir = gce_MakeDir( Middle12, Middle34 );
|
||||
LineDir = gce_MakeDir(Middle12, Middle34);
|
||||
OrtDir = Plane->Pln().Axis().Direction() ^ LineDir;
|
||||
LineVec = gp_Vec( LineDir ) * SmallDist;
|
||||
OrtVec = gp_Vec( OrtDir ) * SmallDist;
|
||||
LineVec = gp_Vec(LineDir) * SmallDist;
|
||||
OrtVec = gp_Vec(OrtDir) * SmallDist;
|
||||
|
||||
aTextPos = Middle.Translated( OrtVec );
|
||||
aTextPos = Middle.Translated(OrtVec);
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Vec Vec1( Middle, Point1 );
|
||||
gp_Vec Vec1(Middle, Point1);
|
||||
|
||||
if (Vec1.SquareMagnitude() > Precision::Confusion()*Precision::Confusion())
|
||||
{
|
||||
Standard_Real Angle = gp_Vec( Middle, Point1 ).Angle( gp_Vec( Middle, Point3 ) );
|
||||
gp_Pnt MidPnt = Point1.Rotated( Plane->Pln().Axis(), Angle*0.5 );
|
||||
OrtDir = gce_MakeDir( Middle, MidPnt );
|
||||
LineDir = OrtDir ^ Plane->Pln().Axis().Direction();
|
||||
|
||||
Standard_Real Distance = Point1.Distance( Point2 );
|
||||
SmallDist = Distance * 0.05; // 1/20.0
|
||||
if (SmallDist <= Precision::Confusion())
|
||||
SmallDist = Distance;
|
||||
|
||||
OrtVec = gp_Vec( OrtDir ) * SmallDist;
|
||||
LineVec = gp_Vec( LineDir ) * SmallDist;
|
||||
}
|
||||
if (Vec1.SquareMagnitude() > Precision::Confusion() * Precision::Confusion())
|
||||
{
|
||||
Standard_Real Angle = gp_Vec(Middle, Point1).Angle(gp_Vec(Middle, Point3));
|
||||
gp_Pnt MidPnt = Point1.Rotated(Plane->Pln().Axis(), Angle * 0.5);
|
||||
OrtDir = gce_MakeDir(Middle, MidPnt);
|
||||
LineDir = OrtDir ^ Plane->Pln().Axis().Direction();
|
||||
|
||||
Standard_Real Distance = Point1.Distance(Point2);
|
||||
SmallDist = Distance * 0.05; // 1/20.0
|
||||
if (SmallDist <= Precision::Confusion())
|
||||
SmallDist = Distance;
|
||||
|
||||
OrtVec = gp_Vec(OrtDir) * SmallDist;
|
||||
LineVec = gp_Vec(LineDir) * SmallDist;
|
||||
}
|
||||
else
|
||||
{
|
||||
SmallDist = 5.0;
|
||||
OrtVec = gp_Vec( Plane->Pln().XAxis().Direction() ) * SmallDist;
|
||||
LineVec = gp_Vec( Plane->Pln().YAxis().Direction() ) * SmallDist;
|
||||
}
|
||||
aTextPos = Middle.Translated (OrtVec);
|
||||
{
|
||||
SmallDist = 5.0;
|
||||
OrtVec = gp_Vec(Plane->Pln().XAxis().Direction()) * SmallDist;
|
||||
LineVec = gp_Vec(Plane->Pln().YAxis().Direction()) * SmallDist;
|
||||
}
|
||||
aTextPos = Middle.Translated(OrtVec);
|
||||
}
|
||||
|
||||
TCollection_ExtendedString aText("==");
|
||||
|
||||
//Draw the text
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(),LA->TextAspect(), aText, aTextPos);
|
||||
// Draw the text
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, aTextPos);
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================
|
||||
//function : AddInterval
|
||||
//purpose : is used for presentation of interval between two lines or two points,
|
||||
// function : AddInterval
|
||||
// purpose : is used for presentation of interval between two lines or two points,
|
||||
// or between one line and one point.
|
||||
//==================================================================================
|
||||
void DsgPrs_EqualDistancePresentation::AddInterval(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPoint1,
|
||||
const gp_Pnt& aPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& aPosition,
|
||||
const DsgPrs_ArrowSide anArrowSide,
|
||||
gp_Pnt& aProj1,
|
||||
gp_Pnt& aProj2)
|
||||
void DsgPrs_EqualDistancePresentation::AddInterval(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPoint1,
|
||||
const gp_Pnt& aPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& aPosition,
|
||||
const DsgPrs_ArrowSide anArrowSide,
|
||||
gp_Pnt& aProj1,
|
||||
gp_Pnt& aProj2)
|
||||
{
|
||||
const Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Lin L1 (aPoint1,aDirection);
|
||||
gp_Lin L2 (aPoint2,aDirection);
|
||||
aProj1 = ElCLib::Value(ElCLib::Parameter(L1, aPosition),L1);
|
||||
aProj2 = ElCLib::Value(ElCLib::Parameter(L2, aPosition),L2);
|
||||
|
||||
gp_Lin L1(aPoint1, aDirection);
|
||||
gp_Lin L2(aPoint2, aDirection);
|
||||
aProj1 = ElCLib::Value(ElCLib::Parameter(L1, aPosition), L1);
|
||||
aProj2 = ElCLib::Value(ElCLib::Parameter(L2, aPosition), L2);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);
|
||||
aPrims->AddVertex(aPoint1);
|
||||
@@ -145,46 +144,49 @@ void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )&
|
||||
aPrims->AddVertex(aPoint2);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
//add arrows presentation
|
||||
// add arrows presentation
|
||||
gp_Dir aDir(aProj2.XYZ() - aProj1.XYZ());
|
||||
|
||||
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, aProj1, aProj2, aDir.Reversed(), aDir, anArrowSide);
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// function : AddIntervalBetweenTwoArcs
|
||||
// function : AddIntervalBetweenTwoArcs
|
||||
// purpose : is used for presentation of interval between two arcs. One
|
||||
// of the arcs can have a zero radius (being a point really)
|
||||
// of the arcs can have a zero radius (being a point really)
|
||||
//========================================================================
|
||||
void
|
||||
DsgPrs_EqualDistancePresentation::AddIntervalBetweenTwoArcs(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Circ& aCirc1,
|
||||
const gp_Circ& aCirc2,
|
||||
const gp_Pnt& aPoint1,
|
||||
const gp_Pnt& aPoint2,
|
||||
const gp_Pnt& aPoint3,
|
||||
const gp_Pnt& aPoint4,
|
||||
const DsgPrs_ArrowSide anArrowSide)
|
||||
void DsgPrs_EqualDistancePresentation::AddIntervalBetweenTwoArcs(
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Circ& aCirc1,
|
||||
const gp_Circ& aCirc2,
|
||||
const gp_Pnt& aPoint1,
|
||||
const gp_Pnt& aPoint2,
|
||||
const gp_Pnt& aPoint3,
|
||||
const gp_Pnt& aPoint4,
|
||||
const DsgPrs_ArrowSide anArrowSide)
|
||||
{
|
||||
const Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
Standard_Real aPar11, aPar12, aPar21, aPar22;
|
||||
if(aCirc1.Radius() > Precision::Confusion()){
|
||||
aPar11 = ElCLib::Parameter (aCirc1, aPoint1);
|
||||
if (aCirc1.Radius() > Precision::Confusion())
|
||||
{
|
||||
aPar11 = ElCLib::Parameter(aCirc1, aPoint1);
|
||||
aPar12 = ElCLib::Parameter(aCirc1, aPoint2);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
aPar11 = M_PI;
|
||||
aPar12 = M_PI;
|
||||
}
|
||||
if (aCirc2.Radius() > Precision::Confusion()){
|
||||
aPar21 = ElCLib::Parameter(aCirc2, aPoint3 );
|
||||
if (aCirc2.Radius() > Precision::Confusion())
|
||||
{
|
||||
aPar21 = ElCLib::Parameter(aCirc2, aPoint3);
|
||||
aPar22 = ElCLib::Parameter(aCirc2, aPoint4);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
aPar21 = M_PI;
|
||||
aPar22 = M_PI;
|
||||
}
|
||||
@@ -195,50 +197,59 @@ void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )&
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
Standard_Integer i, aNodeNb;
|
||||
Standard_Real aDelta, aCurPar;
|
||||
if(aPar12 < aPar11 ) aPar12 += 2.*M_PI;
|
||||
Standard_Real aDelta, aCurPar;
|
||||
if (aPar12 < aPar11)
|
||||
aPar12 += 2. * M_PI;
|
||||
if (Abs(aPar12 - aPar11) > Precision::Confusion())
|
||||
{
|
||||
aNodeNb = Standard_Integer(Max(Abs(aPar12 - aPar11)*50./M_PI + 0.5, 4.));
|
||||
aDelta = (aPar12 - aPar11)/aNodeNb;
|
||||
aCurPar= aPar11;
|
||||
aNodeNb = Standard_Integer(Max(Abs(aPar12 - aPar11) * 50. / M_PI + 0.5, 4.));
|
||||
aDelta = (aPar12 - aPar11) / aNodeNb;
|
||||
aCurPar = aPar11;
|
||||
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(aNodeNb+1);
|
||||
for (i = 1; i<= aNodeNb; aCurPar += aDelta, i++)
|
||||
aPrims->AddVertex(ElCLib::Value( aCurPar, aCirc1));
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(aNodeNb + 1);
|
||||
for (i = 1; i <= aNodeNb; aCurPar += aDelta, i++)
|
||||
aPrims->AddVertex(ElCLib::Value(aCurPar, aCirc1));
|
||||
aPrims->AddVertex(aPoint2);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
if (aPar22 < aPar21) aPar22 += 2.*M_PI;
|
||||
if ( Abs(aPar22 - aPar21) > Precision::Confusion())
|
||||
if (aPar22 < aPar21)
|
||||
aPar22 += 2. * M_PI;
|
||||
if (Abs(aPar22 - aPar21) > Precision::Confusion())
|
||||
{
|
||||
aNodeNb = Standard_Integer(Max(Abs(aPar22 - aPar21)*50./M_PI + 0.5, 4.));
|
||||
aDelta = (aPar22 - aPar21)/aNodeNb;
|
||||
aCurPar= aPar21;
|
||||
aNodeNb = Standard_Integer(Max(Abs(aPar22 - aPar21) * 50. / M_PI + 0.5, 4.));
|
||||
aDelta = (aPar22 - aPar21) / aNodeNb;
|
||||
aCurPar = aPar21;
|
||||
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(aNodeNb+1);
|
||||
for (i = 1; i<= aNodeNb; aCurPar += aDelta, i++)
|
||||
aPrims->AddVertex(ElCLib::Value( aCurPar, aCirc2));
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(aNodeNb + 1);
|
||||
for (i = 1; i <= aNodeNb; aCurPar += aDelta, i++)
|
||||
aPrims->AddVertex(ElCLib::Value(aCurPar, aCirc2));
|
||||
aPrims->AddVertex(aPoint4);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
|
||||
//get the direction of interval
|
||||
// get the direction of interval
|
||||
gp_Dir DirOfArrow;
|
||||
if(aPoint4.Distance(aPoint2) > Precision::Confusion())
|
||||
if (aPoint4.Distance(aPoint2) > Precision::Confusion())
|
||||
{
|
||||
DirOfArrow.SetXYZ(aPoint4.XYZ() - aPoint2.XYZ());
|
||||
}
|
||||
else
|
||||
{
|
||||
//Let's take the radius direction
|
||||
// Let's take the radius direction
|
||||
gp_Pnt aCenter = aCirc1.Location();
|
||||
if(aPoint4.Distance(aCenter) < Precision::Confusion())
|
||||
if (aPoint4.Distance(aCenter) < Precision::Confusion())
|
||||
return;
|
||||
DirOfArrow.SetXYZ(aPoint4.XYZ() - aCenter.XYZ());
|
||||
}
|
||||
|
||||
// Add presentation of arrows
|
||||
DsgPrs::ComputeSymbol( aPresentation, LA, aPoint2, aPoint4, DirOfArrow.Reversed(), DirOfArrow, anArrowSide );
|
||||
DsgPrs::ComputeSymbol(aPresentation,
|
||||
LA,
|
||||
aPoint2,
|
||||
aPoint4,
|
||||
DirOfArrow.Reversed(),
|
||||
DirOfArrow,
|
||||
anArrowSide);
|
||||
}
|
||||
|
||||
//-- ota -- end
|
||||
|
@@ -33,49 +33,51 @@ class gp_Circ;
|
||||
//! A framework to display equal distances between shapes and a given plane.
|
||||
//! The distance is the length of a projection from the shape to the plane.
|
||||
//! These distances are used to compare two shapes by this vector alone.
|
||||
class DsgPrs_EqualDistancePresentation
|
||||
class DsgPrs_EqualDistancePresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Adds the points Point1, Point2, Point3 Point4, and the
|
||||
//! plane Plane to the presentation object aPresentation.
|
||||
//! The display attributes of these elements is defined by the attribute manager aDrawer.
|
||||
//! The distance is the length of a projection from the shape to the plane.
|
||||
//! These distances are used to compare two shapes by this vector alone.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& Point1, const gp_Pnt& Point2, const gp_Pnt& Point3, const gp_Pnt& Point4, const Handle(Geom_Plane)& Plane);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const gp_Pnt& Point3,
|
||||
const gp_Pnt& Point4,
|
||||
const Handle(Geom_Plane)& Plane);
|
||||
|
||||
//! is used for presentation of interval between
|
||||
//! two lines or two points or between a line and a point.
|
||||
Standard_EXPORT static void AddInterval (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& aPoint1, const gp_Pnt& aPoint2, const gp_Dir& aDir, const gp_Pnt& aPosition, const DsgPrs_ArrowSide anArrowSide, gp_Pnt& anExtremePnt1, gp_Pnt& anExtremePnt2);
|
||||
|
||||
Standard_EXPORT static void AddInterval(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPoint1,
|
||||
const gp_Pnt& aPoint2,
|
||||
const gp_Dir& aDir,
|
||||
const gp_Pnt& aPosition,
|
||||
const DsgPrs_ArrowSide anArrowSide,
|
||||
gp_Pnt& anExtremePnt1,
|
||||
gp_Pnt& anExtremePnt2);
|
||||
|
||||
//! is used for presentation of interval between two arcs.
|
||||
//! One of arcs can have a zero radius.
|
||||
Standard_EXPORT static void AddIntervalBetweenTwoArcs (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Circ& aCircle1, const gp_Circ& aCircle2, const gp_Pnt& aPoint1, const gp_Pnt& aPoint2, const gp_Pnt& aPoint3, const gp_Pnt& aPoint4, const DsgPrs_ArrowSide anArrowSide);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void AddIntervalBetweenTwoArcs(
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Circ& aCircle1,
|
||||
const gp_Circ& aCircle2,
|
||||
const gp_Pnt& aPoint1,
|
||||
const gp_Pnt& aPoint2,
|
||||
const gp_Pnt& aPoint3,
|
||||
const gp_Pnt& aPoint4,
|
||||
const DsgPrs_ArrowSide anArrowSide);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_EqualDistancePresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs.hxx>
|
||||
#include <DsgPrs_EqualRadiusPresentation.hxx>
|
||||
#include <gce_MakeDir.hxx>
|
||||
@@ -32,16 +31,16 @@
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
void DsgPrs_EqualRadiusPresentation::Add( const Handle( Prs3d_Presentation )& aPresentation,
|
||||
const Handle( Prs3d_Drawer )& aDrawer,
|
||||
const gp_Pnt& FirstCenter,
|
||||
const gp_Pnt& SecondCenter,
|
||||
const gp_Pnt& FirstPoint,
|
||||
const gp_Pnt& SecondPoint,
|
||||
const Handle( Geom_Plane )& Plane )
|
||||
void DsgPrs_EqualRadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& FirstCenter,
|
||||
const gp_Pnt& SecondCenter,
|
||||
const gp_Pnt& FirstPoint,
|
||||
const gp_Pnt& SecondPoint,
|
||||
const Handle(Geom_Plane)& Plane)
|
||||
{
|
||||
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);
|
||||
aPrims->AddVertex(FirstPoint);
|
||||
@@ -51,45 +50,58 @@ void DsgPrs_EqualRadiusPresentation::Add( const Handle( Prs3d_Presentation )& aP
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// Add presentation of arrows
|
||||
gp_Dir FirstDir = gce_MakeDir( FirstCenter, FirstPoint ), SecondDir = gce_MakeDir( SecondCenter, SecondPoint );
|
||||
DsgPrs::ComputeSymbol( aPresentation, LA, FirstCenter, FirstPoint, FirstDir.Reversed(), FirstDir, DsgPrs_AS_FIRSTPT_LASTAR );
|
||||
DsgPrs::ComputeSymbol( aPresentation, LA, SecondCenter, SecondPoint, SecondDir.Reversed(), SecondDir, DsgPrs_AS_FIRSTPT_LASTAR );
|
||||
gp_Dir FirstDir = gce_MakeDir(FirstCenter, FirstPoint),
|
||||
SecondDir = gce_MakeDir(SecondCenter, SecondPoint);
|
||||
DsgPrs::ComputeSymbol(aPresentation,
|
||||
LA,
|
||||
FirstCenter,
|
||||
FirstPoint,
|
||||
FirstDir.Reversed(),
|
||||
FirstDir,
|
||||
DsgPrs_AS_FIRSTPT_LASTAR);
|
||||
DsgPrs::ComputeSymbol(aPresentation,
|
||||
LA,
|
||||
SecondCenter,
|
||||
SecondPoint,
|
||||
SecondDir.Reversed(),
|
||||
SecondDir,
|
||||
DsgPrs_AS_FIRSTPT_LASTAR);
|
||||
|
||||
//ota === begin ===
|
||||
gp_Pnt Middle( (FirstCenter.XYZ() + SecondCenter.XYZ()) *0.5 ), aTextPos;
|
||||
// ota === begin ===
|
||||
gp_Pnt Middle((FirstCenter.XYZ() + SecondCenter.XYZ()) * 0.5), aTextPos;
|
||||
Standard_Real SmallDist;
|
||||
//Mark of constraint
|
||||
// Mark of constraint
|
||||
TCollection_ExtendedString aText("==");
|
||||
|
||||
Standard_Real Dist = FirstCenter.Distance( SecondCenter );
|
||||
|
||||
Standard_Real Dist = FirstCenter.Distance(SecondCenter);
|
||||
if (Dist > Precision::Confusion())
|
||||
{
|
||||
SmallDist = Dist * 0.05; // take 1/20 part of length;
|
||||
if (SmallDist <= Precision::Confusion())
|
||||
SmallDist = Dist;
|
||||
gp_Dir LineDir = gce_MakeDir( FirstCenter, SecondCenter );
|
||||
gp_Dir LineDir = gce_MakeDir(FirstCenter, SecondCenter);
|
||||
gp_Dir OrtDir = Plane->Pln().Axis().Direction() ^ LineDir;
|
||||
|
||||
gp_Vec OrtVec = gp_Vec( OrtDir ) * SmallDist;
|
||||
|
||||
//Compute the text position
|
||||
gp_Vec OrtVec = gp_Vec(OrtDir) * SmallDist;
|
||||
|
||||
// Compute the text position
|
||||
aTextPos = Middle.Translated(OrtVec);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real Rad = Max(FirstCenter.Distance( FirstPoint ), SecondCenter.Distance(SecondPoint));
|
||||
|
||||
SmallDist = Rad *0.05; // take 1/20 part of length;
|
||||
Standard_Real Rad = Max(FirstCenter.Distance(FirstPoint), SecondCenter.Distance(SecondPoint));
|
||||
|
||||
SmallDist = Rad * 0.05; // take 1/20 part of length;
|
||||
if (SmallDist <= Precision::Confusion())
|
||||
SmallDist = Rad;
|
||||
|
||||
gp_Vec aVec(SmallDist, SmallDist, SmallDist);
|
||||
|
||||
//Compute the text position
|
||||
|
||||
// Compute the text position
|
||||
aTextPos = FirstCenter.Translated(aVec);
|
||||
}
|
||||
|
||||
//Draw the text
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aTextPos);
|
||||
//ota === end ===
|
||||
|
||||
// Draw the text
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, aTextPos);
|
||||
// ota === end ===
|
||||
}
|
||||
|
@@ -28,13 +28,11 @@ class gp_Pnt;
|
||||
class Geom_Plane;
|
||||
|
||||
//! A framework to define display of equality in radii.
|
||||
class DsgPrs_EqualRadiusPresentation
|
||||
class DsgPrs_EqualRadiusPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Adds the points FirstCenter, SecondCenter,
|
||||
//! FirstPoint, SecondPoint, and the plane Plane to the
|
||||
//! presentation object aPresentation.
|
||||
@@ -43,29 +41,16 @@ public:
|
||||
//! FirstCenter and SecondCenter are the centers of the
|
||||
//! first and second shapes respectively, and FirstPoint
|
||||
//! and SecondPoint are the attachment points of the radii to arcs.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& FirstCenter, const gp_Pnt& SecondCenter, const gp_Pnt& FirstPoint, const gp_Pnt& SecondPoint, const Handle(Geom_Plane)& Plane);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& FirstCenter,
|
||||
const gp_Pnt& SecondCenter,
|
||||
const gp_Pnt& FirstPoint,
|
||||
const gp_Pnt& SecondPoint,
|
||||
const Handle(Geom_Plane)& Plane);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_EqualRadiusPresentation_HeaderFile
|
||||
|
@@ -32,77 +32,76 @@
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DsgPrs_FilletRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString & aText,
|
||||
const gp_Pnt & aPosition,
|
||||
const gp_Dir & aNormalDir,
|
||||
const gp_Pnt & aBasePnt,
|
||||
const gp_Pnt & aFirstPoint,
|
||||
const gp_Pnt & aSecondPoint,
|
||||
const gp_Pnt & aCenter,
|
||||
const DsgPrs_ArrowSide ArrowPrs,
|
||||
const Standard_Boolean drawRevers,
|
||||
gp_Pnt & DrawPosition,
|
||||
gp_Pnt & EndOfArrow,
|
||||
Handle(Geom_TrimmedCurve)& TrimCurve,
|
||||
Standard_Boolean & HasCircle )
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void DsgPrs_FilletRadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real theval,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aPosition,
|
||||
const gp_Dir& aNormalDir,
|
||||
const gp_Pnt& aBasePnt,
|
||||
const gp_Pnt& aFirstPoint,
|
||||
const gp_Pnt& aSecondPoint,
|
||||
const gp_Pnt& aCenter,
|
||||
const DsgPrs_ArrowSide ArrowPrs,
|
||||
const Standard_Boolean drawRevers,
|
||||
gp_Pnt& DrawPosition,
|
||||
gp_Pnt& EndOfArrow,
|
||||
Handle(Geom_TrimmedCurve)& TrimCurve,
|
||||
Standard_Boolean& HasCircle)
|
||||
{
|
||||
char valcar[80];
|
||||
sprintf(valcar,"%5.2f",theval);
|
||||
sprintf(valcar, "%5.2f", theval);
|
||||
|
||||
Standard_Real FirstParCirc, LastParCirc;
|
||||
Standard_Real FirstParCirc, LastParCirc;
|
||||
Standard_Boolean SpecCase;
|
||||
gp_Dir DirOfArrow;
|
||||
gp_Circ FilletCirc;
|
||||
gp_Dir DirOfArrow;
|
||||
gp_Circ FilletCirc;
|
||||
// gp_Pnt NewPosition, EndOfArrow;
|
||||
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
Standard_Real ArrowLength = LA->ArrowAspect()->Length();
|
||||
DsgPrs::ComputeFilletRadiusPresentation( ArrowLength,
|
||||
theval,
|
||||
aPosition,
|
||||
aNormalDir,
|
||||
aFirstPoint,
|
||||
aSecondPoint,
|
||||
aCenter,
|
||||
aBasePnt,
|
||||
drawRevers,
|
||||
SpecCase,
|
||||
FilletCirc,
|
||||
FirstParCirc,
|
||||
LastParCirc,
|
||||
EndOfArrow,
|
||||
DirOfArrow,
|
||||
DrawPosition //NewPosition
|
||||
);
|
||||
// Creating the fillet's arc
|
||||
if( !SpecCase )
|
||||
DsgPrs::ComputeFilletRadiusPresentation(ArrowLength,
|
||||
theval,
|
||||
aPosition,
|
||||
aNormalDir,
|
||||
aFirstPoint,
|
||||
aSecondPoint,
|
||||
aCenter,
|
||||
aBasePnt,
|
||||
drawRevers,
|
||||
SpecCase,
|
||||
FilletCirc,
|
||||
FirstParCirc,
|
||||
LastParCirc,
|
||||
EndOfArrow,
|
||||
DirOfArrow,
|
||||
DrawPosition // NewPosition
|
||||
);
|
||||
// Creating the fillet's arc
|
||||
if (!SpecCase)
|
||||
{
|
||||
const Standard_Real Alpha = Abs(LastParCirc - FirstParCirc);
|
||||
const Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / ( NodeNumber - 1 );
|
||||
const Standard_Real Alpha = Abs(LastParCirc - FirstParCirc);
|
||||
const Standard_Integer NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
const Standard_Real delta = Alpha / (NodeNumber - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
for (Standard_Integer i = 0 ; i < NodeNumber; i++, FirstParCirc += delta)
|
||||
aPrims->AddVertex(ElCLib::Value( FirstParCirc, FilletCirc ));
|
||||
for (Standard_Integer i = 0; i < NodeNumber; i++, FirstParCirc += delta)
|
||||
aPrims->AddVertex(ElCLib::Value(FirstParCirc, FilletCirc));
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
HasCircle = Standard_True;
|
||||
Handle(Geom_Circle) Circle = new Geom_Circle( FilletCirc );
|
||||
TrimCurve = new Geom_TrimmedCurve( Circle, FirstParCirc, LastParCirc );
|
||||
HasCircle = Standard_True;
|
||||
Handle(Geom_Circle) Circle = new Geom_Circle(FilletCirc);
|
||||
TrimCurve = new Geom_TrimmedCurve(Circle, FirstParCirc, LastParCirc);
|
||||
}
|
||||
else // null or PI anle or Radius = 0
|
||||
{
|
||||
HasCircle = Standard_False;
|
||||
}
|
||||
|
||||
|
||||
// Line from position to intersection point on fillet's circle (EndOfArrow)
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(DrawPosition);
|
||||
@@ -110,8 +109,14 @@ void DsgPrs_FilletRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPr
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// Drawing the text
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, DrawPosition);
|
||||
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, DrawPosition);
|
||||
|
||||
// Add presentation of arrows
|
||||
DsgPrs::ComputeSymbol( aPresentation, LA, EndOfArrow, EndOfArrow, DirOfArrow, DirOfArrow, ArrowPrs );
|
||||
DsgPrs::ComputeSymbol(aPresentation,
|
||||
LA,
|
||||
EndOfArrow,
|
||||
EndOfArrow,
|
||||
DirOfArrow,
|
||||
DirOfArrow,
|
||||
ArrowPrs);
|
||||
}
|
||||
|
@@ -30,40 +30,34 @@ class gp_Dir;
|
||||
class Geom_TrimmedCurve;
|
||||
|
||||
//! A framework for displaying radii of fillets.
|
||||
class DsgPrs_FilletRadiusPresentation
|
||||
class DsgPrs_FilletRadiusPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Adds a display of the radius of a fillet to the
|
||||
//! presentation aPresentation. The display ttributes
|
||||
//! defined by the attribute manager aDrawer. the value
|
||||
//! specifies the length of the radius.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real thevalue, const TCollection_ExtendedString& aText, const gp_Pnt& aPosition, const gp_Dir& aNormalDir, const gp_Pnt& aBasePnt, const gp_Pnt& aFirstPoint, const gp_Pnt& aSecondPoint, const gp_Pnt& aCenter, const DsgPrs_ArrowSide ArrowPrs, const Standard_Boolean drawRevers, gp_Pnt& DrawPosition, gp_Pnt& EndOfArrow, Handle(Geom_TrimmedCurve)& TrimCurve, Standard_Boolean& HasCircle);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Standard_Real thevalue,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aPosition,
|
||||
const gp_Dir& aNormalDir,
|
||||
const gp_Pnt& aBasePnt,
|
||||
const gp_Pnt& aFirstPoint,
|
||||
const gp_Pnt& aSecondPoint,
|
||||
const gp_Pnt& aCenter,
|
||||
const DsgPrs_ArrowSide ArrowPrs,
|
||||
const Standard_Boolean drawRevers,
|
||||
gp_Pnt& DrawPosition,
|
||||
gp_Pnt& EndOfArrow,
|
||||
Handle(Geom_TrimmedCurve)& TrimCurve,
|
||||
Standard_Boolean& HasCircle);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_FilletRadiusPresentation_HeaderFile
|
||||
|
@@ -29,24 +29,21 @@
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DsgPrs_FixPresentation::Add(
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntEnd,
|
||||
const gp_Dir& aNormPln,
|
||||
const Standard_Real symbsize)
|
||||
//=================================================================================================
|
||||
|
||||
void DsgPrs_FixPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntEnd,
|
||||
const gp_Dir& aNormPln,
|
||||
const Standard_Real symbsize)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(10);
|
||||
|
||||
//Trace du segment de raccordement
|
||||
// Trace du segment de raccordement
|
||||
aPrims->AddVertex(aPntAttach);
|
||||
aPrims->AddVertex(aPntEnd);
|
||||
|
||||
@@ -55,8 +52,8 @@ void DsgPrs_FixPresentation::Add(
|
||||
dirac.Normalize();
|
||||
gp_Vec norac = dirac.Crossed(gp_Vec(aNormPln));
|
||||
gp_Ax1 ax(aPntEnd, aNormPln);
|
||||
norac.Rotate(ax, M_PI/8); // vecteur normal au seg. de raccord
|
||||
norac*=(symbsize/2);
|
||||
norac.Rotate(ax, M_PI / 8); // vecteur normal au seg. de raccord
|
||||
norac *= (symbsize / 2);
|
||||
gp_Pnt P1 = aPntEnd.Translated(norac);
|
||||
gp_Pnt P2 = aPntEnd.Translated(-norac);
|
||||
|
||||
@@ -64,10 +61,10 @@ void DsgPrs_FixPresentation::Add(
|
||||
aPrims->AddVertex(P2);
|
||||
|
||||
// trace des 'dents'
|
||||
norac*=0.8;
|
||||
norac *= 0.8;
|
||||
P1 = aPntEnd.Translated(norac);
|
||||
P2 = aPntEnd.Translated(-norac);
|
||||
dirac*=(symbsize/2);
|
||||
dirac *= (symbsize / 2);
|
||||
gp_Pnt PF = P1;
|
||||
gp_Pnt PL = PF.Translated(dirac);
|
||||
PL.Translate(norac);
|
||||
@@ -82,7 +79,7 @@ void DsgPrs_FixPresentation::Add(
|
||||
aPrims->AddVertex(PF);
|
||||
aPrims->AddVertex(PL);
|
||||
|
||||
PF.SetXYZ(0.5*(P1.XYZ() + P2.XYZ()));
|
||||
PF.SetXYZ(0.5 * (P1.XYZ() + P2.XYZ()));
|
||||
PL = PF.Translated(dirac);
|
||||
PL.Translate(norac);
|
||||
|
||||
@@ -93,10 +90,11 @@ void DsgPrs_FixPresentation::Add(
|
||||
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
Quantity_Color aColor = LA->LineAspect()->Aspect()->Color();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0);
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect (aMarkerAsp);
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
|
||||
anArrayOfPoints->AddVertex (aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z());
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray (anArrayOfPoints);
|
||||
Quantity_Color aColor = LA->LineAspect()->Aspect()->Color();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAsp =
|
||||
new Graphic3d_AspectMarker3d(Aspect_TOM_O, aColor, 1.0);
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(aMarkerAsp);
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints(1);
|
||||
anArrayOfPoints->AddVertex(aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z());
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(anArrayOfPoints);
|
||||
}
|
||||
|
@@ -27,41 +27,25 @@ class gp_Pnt;
|
||||
class gp_Dir;
|
||||
|
||||
//! class which draws the presentation of Fixed objects
|
||||
class DsgPrs_FixPresentation
|
||||
class DsgPrs_FixPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! draws the presentation of fixed objects by
|
||||
//! drawing the 'fix' symbol at position <aPntEnd>.
|
||||
//! A binding segment is drawn between <aPntAttach>
|
||||
//! ( which belongs to the fixed object) and <aPntEnd>.
|
||||
//! aSymbSize is the size of the 'fix'symbol
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& aPntAttach, const gp_Pnt& aPntEnd, const gp_Dir& aNormPln, const Standard_Real aSymbSize);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntEnd,
|
||||
const gp_Dir& aNormPln,
|
||||
const Standard_Real aSymbSize);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_FixPresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs_IdenticPresentation.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
@@ -35,11 +34,11 @@
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntOffset)
|
||||
void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntOffset)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
@@ -51,28 +50,28 @@ void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresent
|
||||
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
Quantity_Color aColor = LA->LineAspect()->Aspect()->Color();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0);
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect (aMarkerAsp);
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
|
||||
anArrayOfPoints->AddVertex (aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z());
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray (anArrayOfPoints);
|
||||
Quantity_Color aColor = LA->LineAspect()->Aspect()->Color();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAsp =
|
||||
new Graphic3d_AspectMarker3d(Aspect_TOM_O, aColor, 1.0);
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(aMarkerAsp);
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints(1);
|
||||
anArrayOfPoints->AddVertex(aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z());
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(anArrayOfPoints);
|
||||
|
||||
// texte
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
// texte
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
}
|
||||
|
||||
|
||||
void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset)
|
||||
void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(4);
|
||||
|
||||
aPrims->AddVertex(aFAttach);
|
||||
@@ -83,30 +82,29 @@ void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresent
|
||||
gp_Vec v2(aSAttach, aPntOffset);
|
||||
|
||||
aPrims->AddVertex(aPntOffset);
|
||||
if ( !v1.IsParallel(v2, Precision::Angular()))
|
||||
if (!v1.IsParallel(v2, Precision::Angular()))
|
||||
{
|
||||
// on joint aPntOffset a son projete
|
||||
gp_Lin ll(aFAttach, gp_Dir(v1));
|
||||
aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(ll,aPntOffset ), ll));
|
||||
aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(ll, aPntOffset), ll));
|
||||
}
|
||||
else
|
||||
aPrims->AddVertex(aSAttach);
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// texte
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
// texte
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
}
|
||||
|
||||
|
||||
void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& aCenter,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset)
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& aCenter,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
@@ -114,48 +112,49 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
gp_Ax2 ax = theAxe;
|
||||
ax.SetLocation(aCenter);
|
||||
Standard_Real rad = aCenter.Distance(aFAttach);
|
||||
gp_Circ CC(ax,rad );
|
||||
Standard_Real pFAttach = ElCLib::Parameter(CC, aFAttach);
|
||||
Standard_Real pSAttach = ElCLib::Parameter(CC, aSAttach);
|
||||
Standard_Real alpha = pSAttach - pFAttach;
|
||||
if ( alpha < 0 ) alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer )( 50. * alpha / M_PI);
|
||||
const Standard_Integer nbp = Max (4, nb);
|
||||
const Standard_Real dteta = alpha/(nbp-1);
|
||||
gp_Circ CC(ax, rad);
|
||||
Standard_Real pFAttach = ElCLib::Parameter(CC, aFAttach);
|
||||
Standard_Real pSAttach = ElCLib::Parameter(CC, aSAttach);
|
||||
Standard_Real alpha = pSAttach - pFAttach;
|
||||
if (alpha < 0)
|
||||
alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50. * alpha / M_PI);
|
||||
const Standard_Integer nbp = Max(4, nb);
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims;
|
||||
|
||||
|
||||
// trait joignant aPntOffset
|
||||
if ( Abs((aPntOffset.Distance(aCenter) - rad )) >= Precision::Confusion() )
|
||||
if (Abs((aPntOffset.Distance(aCenter) - rad)) >= Precision::Confusion())
|
||||
{
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp + 2, 2);
|
||||
aPrims->AddBound(2);
|
||||
aPrims->AddVertex(aPntOffset);
|
||||
aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(CC,aPntOffset ), CC));
|
||||
aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(CC, aPntOffset), CC));
|
||||
aPrims->AddBound(nbp);
|
||||
}
|
||||
else
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp);
|
||||
|
||||
for (Standard_Integer i = 1; i<=nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(pFAttach + dteta*(i-1),CC));
|
||||
for (Standard_Integer i = 1; i <= nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(pFAttach + dteta * (i - 1), CC));
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// texte
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
// texte
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
}
|
||||
|
||||
// jfa 16/10/2000
|
||||
void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& aCenter,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset,
|
||||
const gp_Pnt& aPntOnCirc)
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& aCenter,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset,
|
||||
const gp_Pnt& aPntOnCirc)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
@@ -163,21 +162,22 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
gp_Ax2 ax = theAxe;
|
||||
ax.SetLocation(aCenter);
|
||||
Standard_Real rad = aCenter.Distance(aFAttach);
|
||||
gp_Circ CC(ax,rad );
|
||||
gp_Circ CC(ax, rad);
|
||||
Standard_Real pFAttach = ElCLib::Parameter(CC, aFAttach);
|
||||
Standard_Real pSAttach = ElCLib::Parameter(CC, aSAttach);
|
||||
Standard_Real alpha = pSAttach - pFAttach;
|
||||
if ( alpha < 0 ) alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)( 50. * alpha / M_PI);
|
||||
const Standard_Integer nbp = Max (4, nb);
|
||||
const Standard_Real dteta = alpha/(nbp-1);
|
||||
Standard_Real alpha = pSAttach - pFAttach;
|
||||
if (alpha < 0)
|
||||
alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50. * alpha / M_PI);
|
||||
const Standard_Integer nbp = Max(4, nb);
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims;
|
||||
|
||||
// trait joignant aPntOffset
|
||||
if ( aPntOffset.Distance(aPntOnCirc) >= Precision::Confusion() )
|
||||
if (aPntOffset.Distance(aPntOnCirc) >= Precision::Confusion())
|
||||
{
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp + 2, 2);
|
||||
aPrims->AddBound(2);
|
||||
aPrims->AddVertex(aPntOffset);
|
||||
aPrims->AddVertex(aPntOnCirc);
|
||||
@@ -186,43 +186,45 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
else
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp);
|
||||
|
||||
for (Standard_Integer i = 1; i<=nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(pFAttach + dteta*(i-1),CC));
|
||||
for (Standard_Integer i = 1; i <= nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(pFAttach + dteta * (i - 1), CC));
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// texte
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
// texte
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
}
|
||||
|
||||
// jfa 16/10/2000 end
|
||||
|
||||
// jfa 10/10/2000
|
||||
void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Elips& anEllipse,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset,
|
||||
const gp_Pnt& aPntOnElli)
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Elips& anEllipse,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset,
|
||||
const gp_Pnt& aPntOnElli)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
Standard_Real pFAttach = ElCLib::Parameter(anEllipse, aFAttach);
|
||||
Standard_Real pSAttach = ElCLib::Parameter(anEllipse, aSAttach);
|
||||
Standard_Real alpha = pSAttach - pFAttach;
|
||||
if ( alpha < 0 ) alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50.0*alpha/M_PI);
|
||||
const Standard_Integer nbp = Max (4, nb);
|
||||
const Standard_Real dteta = alpha/(nbp-1);
|
||||
Standard_Real pFAttach = ElCLib::Parameter(anEllipse, aFAttach);
|
||||
Standard_Real pSAttach = ElCLib::Parameter(anEllipse, aSAttach);
|
||||
Standard_Real alpha = pSAttach - pFAttach;
|
||||
if (alpha < 0)
|
||||
alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50.0 * alpha / M_PI);
|
||||
const Standard_Integer nbp = Max(4, nb);
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims;
|
||||
|
||||
|
||||
// trait joignant aPntOffset
|
||||
if ( ! aPntOnElli.IsEqual(aPntOffset, Precision::Confusion()) )
|
||||
if (!aPntOnElli.IsEqual(aPntOffset, Precision::Confusion()))
|
||||
{
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp + 2, 2);
|
||||
aPrims->AddBound(2);
|
||||
aPrims->AddVertex(aPntOffset);
|
||||
aPrims->AddVertex(aPntOnElli);
|
||||
@@ -231,12 +233,13 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
else
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp);
|
||||
|
||||
for (Standard_Integer i = 1; i<=nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(pFAttach + dteta*(i-1),anEllipse));
|
||||
for (Standard_Integer i = 1; i <= nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(pFAttach + dteta * (i - 1), anEllipse));
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// texte
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
// texte
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, aPntOffset);
|
||||
}
|
||||
|
||||
// jfa 10/10/2000 end
|
||||
|
@@ -28,66 +28,76 @@ class gp_Pnt;
|
||||
class gp_Ax2;
|
||||
class gp_Elips;
|
||||
|
||||
class DsgPrs_IdenticPresentation
|
||||
class DsgPrs_IdenticPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! draws a line between <aPntAttach> and
|
||||
//! <aPntOffset>.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& aPntAttach, const gp_Pnt& aPntOffset);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aPntAttach,
|
||||
const gp_Pnt& aPntOffset);
|
||||
|
||||
//! draws the 'identic' presentation by
|
||||
//! drawing a line between <aFAttach> and
|
||||
//! <aSAttach> , and a linkimg segment
|
||||
//! between <aPntOffset> and its projection
|
||||
//! on the precedent line.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& aFAttach, const gp_Pnt& aSAttach, const gp_Pnt& aPntOffset);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset);
|
||||
|
||||
//! draws the 'identic' presentation in the case of
|
||||
//! circles : draws an arc of circle between
|
||||
//! <aFAttach> and <aSAttach> of center <aCenter>
|
||||
//! and of radius dist(aCenter, aFAttach), and
|
||||
//! draws a segment between <aPntOffset> and
|
||||
//! its projection on the arc.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Ax2& aAx2, const gp_Pnt& aCenter, const gp_Pnt& aFAttach, const gp_Pnt& aSAttach, const gp_Pnt& aPntOffset);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Ax2& aAx2,
|
||||
const gp_Pnt& aCenter,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset);
|
||||
|
||||
//! draws the 'identic' presentation in the case of
|
||||
//! circles : draws an arc of circle between
|
||||
//! <aFAttach> and <aSAttach> of center <aCenter>
|
||||
//! and of radius dist(aCenter, aFAttach), and
|
||||
//! draws a segment between <aPntOffset> and <aPntOnCirc>
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Ax2& aAx2, const gp_Pnt& aCenter, const gp_Pnt& aFAttach, const gp_Pnt& aSAttach, const gp_Pnt& aPntOffset, const gp_Pnt& aPntOnCirc);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Ax2& aAx2,
|
||||
const gp_Pnt& aCenter,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset,
|
||||
const gp_Pnt& aPntOnCirc);
|
||||
|
||||
//! draws the 'identic' presentation in the case of
|
||||
//! ellipses: draws an arc of the anEllipse
|
||||
//! between <aFAttach> and <aSAttach> and
|
||||
//! draws a segment between <aPntOffset> and <aPntOnElli>
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Elips& anEllipse, const gp_Pnt& aFAttach, const gp_Pnt& aSAttach, const gp_Pnt& aPntOffset, const gp_Pnt& aPntOnElli);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Elips& anEllipse,
|
||||
const gp_Pnt& aFAttach,
|
||||
const gp_Pnt& aSAttach,
|
||||
const gp_Pnt& aPntOffset,
|
||||
const gp_Pnt& aPntOnElli);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_IdenticPresentation_HeaderFile
|
||||
|
@@ -32,51 +32,56 @@
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Lin L1 (AttachmentPoint1,aDirection);
|
||||
gp_Lin L2 (AttachmentPoint2,aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
|
||||
gp_Lin L3 = Proj1.IsEqual(Proj2,Precision::Confusion())? gp_Lin(Proj1,aDirection) : gce_MakeLin(Proj1,Proj2);
|
||||
Standard_Real parmin,parmax,parcur;
|
||||
parmin = ElCLib::Parameter(L3,Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3,Proj2);
|
||||
Standard_Real dist = Abs(parmin-parcur);
|
||||
if (parcur < parmin) parmin = parcur;
|
||||
if (parcur > parmax) parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3,OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur,L3);
|
||||
gp_Lin L1(AttachmentPoint1, aDirection);
|
||||
gp_Lin L2(AttachmentPoint2, aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1, OffsetPoint), L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2, OffsetPoint), L2);
|
||||
gp_Lin L3 = Proj1.IsEqual(Proj2, Precision::Confusion()) ? gp_Lin(Proj1, aDirection)
|
||||
: gce_MakeLin(Proj1, Proj2);
|
||||
Standard_Real parmin, parmax, parcur;
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3, OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur, L3);
|
||||
|
||||
Standard_Boolean outside = Standard_False;
|
||||
if (parcur < parmin) {
|
||||
parmin = parcur;
|
||||
if (parcur < parmin)
|
||||
{
|
||||
parmin = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
if (parcur > parmax) {
|
||||
parmax = parcur;
|
||||
if (parcur > parmax)
|
||||
{
|
||||
parmax = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin, L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax, L3);
|
||||
|
||||
// face processing : 1st group
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
|
||||
aPrims->AddVertex(PointMin);
|
||||
aPrims->AddVertex(PointMax);
|
||||
|
||||
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
|
||||
if (dist < (LA->ArrowAspect()->Length() + LA->ArrowAspect()->Length()))
|
||||
outside = Standard_True;
|
||||
|
||||
gp_Dir arrdir = L3.Direction().Reversed();
|
||||
@@ -84,25 +89,33 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
|
||||
arrdir.Reverse();
|
||||
|
||||
// arrow 1 : 2nd group
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), Proj1, arrdir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
Proj1,
|
||||
arrdir,
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
|
||||
// arrow 2 : 3rd group
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), Proj2, arrdir.Reversed(), LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
Proj2,
|
||||
arrdir.Reversed(),
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
|
||||
aPresentation->NewGroup();
|
||||
|
||||
|
||||
// text : 4th group
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
// processing of call 1 : 5th group
|
||||
aPrims->AddVertex(AttachmentPoint1);
|
||||
aPrims->AddVertex(Proj1);
|
||||
|
||||
|
||||
// processing of call 2 : 6th group
|
||||
aPrims->AddVertex(AttachmentPoint2);
|
||||
aPrims->AddVertex(Proj2);
|
||||
@@ -111,46 +124,46 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
|
||||
}
|
||||
|
||||
//==================================================================================
|
||||
//function : Add
|
||||
//purpose : Adds presentation of length dimension between two planar faces
|
||||
// function : Add
|
||||
// purpose : Adds presentation of length dimension between two planar faces
|
||||
//==================================================================================
|
||||
|
||||
void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Pln& PlaneOfFaces,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowPrs )
|
||||
void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Pln& PlaneOfFaces,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Pnt EndOfArrow1, EndOfArrow2;
|
||||
gp_Dir DirOfArrow1;
|
||||
|
||||
DsgPrs::ComputePlanarFacesLengthPresentation( LA->ArrowAspect()->Length(),
|
||||
LA->ArrowAspect()->Length(),
|
||||
AttachmentPoint1,
|
||||
AttachmentPoint2,
|
||||
aDirection,
|
||||
OffsetPoint,
|
||||
PlaneOfFaces,
|
||||
EndOfArrow1,
|
||||
EndOfArrow2,
|
||||
DirOfArrow1 );
|
||||
|
||||
DsgPrs::ComputePlanarFacesLengthPresentation(LA->ArrowAspect()->Length(),
|
||||
LA->ArrowAspect()->Length(),
|
||||
AttachmentPoint1,
|
||||
AttachmentPoint2,
|
||||
aDirection,
|
||||
OffsetPoint,
|
||||
PlaneOfFaces,
|
||||
EndOfArrow1,
|
||||
EndOfArrow2,
|
||||
DirOfArrow1);
|
||||
|
||||
// Parameters for length's line
|
||||
gp_Lin LengthLine( OffsetPoint, DirOfArrow1 );
|
||||
Standard_Real Par1 = ElCLib::Parameter( LengthLine, EndOfArrow1 );
|
||||
Standard_Real Par2 = ElCLib::Parameter( LengthLine, EndOfArrow2 );
|
||||
gp_Pnt FirstPoint, LastPoint;
|
||||
gp_Lin LengthLine(OffsetPoint, DirOfArrow1);
|
||||
Standard_Real Par1 = ElCLib::Parameter(LengthLine, EndOfArrow1);
|
||||
Standard_Real Par2 = ElCLib::Parameter(LengthLine, EndOfArrow2);
|
||||
gp_Pnt FirstPoint, LastPoint;
|
||||
if ((Par1 > 0.0 && Par2 > 0.0) || (Par1 < 0.0 && Par2 < 0.0))
|
||||
{
|
||||
FirstPoint = OffsetPoint;
|
||||
LastPoint = (Abs( Par1 ) > Abs( Par2 ))? EndOfArrow1 : EndOfArrow2;
|
||||
LastPoint = (Abs(Par1) > Abs(Par2)) ? EndOfArrow1 : EndOfArrow2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -165,10 +178,16 @@ void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
|
||||
aPrims->AddVertex(LastPoint);
|
||||
|
||||
// Add presentation of arrows
|
||||
DsgPrs::ComputeSymbol( aPresentation, LA, EndOfArrow1, EndOfArrow2, DirOfArrow1, DirOfArrow1.Reversed(), ArrowPrs );
|
||||
|
||||
DsgPrs::ComputeSymbol(aPresentation,
|
||||
LA,
|
||||
EndOfArrow1,
|
||||
EndOfArrow2,
|
||||
DirOfArrow1,
|
||||
DirOfArrow1.Reversed(),
|
||||
ArrowPrs);
|
||||
|
||||
// Drawing the text
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, OffsetPoint);
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, OffsetPoint);
|
||||
|
||||
// Line from AttachmentPoint1 to end of Arrow1
|
||||
aPrims->AddVertex(AttachmentPoint1);
|
||||
@@ -181,127 +200,132 @@ void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
|
||||
|
||||
//=========================================================================================
|
||||
//function : Add
|
||||
//purpose : adds presentation of length between two edges, vertex and edge or two vertices
|
||||
// function : Add
|
||||
// purpose : adds presentation of length between two edges, vertex and edge or two vertices
|
||||
//=========================================================================================
|
||||
|
||||
void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Lin L1 (AttachmentPoint1,aDirection);
|
||||
gp_Lin L2 (AttachmentPoint2,aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
|
||||
gp_Lin L3 = Proj1.IsEqual(Proj2,Precision::Confusion())? gp_Lin(Proj1,aDirection) : gce_MakeLin(Proj1,Proj2);
|
||||
Standard_Real parmin,parmax,parcur;
|
||||
parmin = ElCLib::Parameter(L3,Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3,Proj2);
|
||||
Standard_Real dist = Abs(parmin-parcur);
|
||||
if (parcur < parmin) parmin = parcur;
|
||||
if (parcur > parmax) parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3,OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur,L3);
|
||||
gp_Lin L1(AttachmentPoint1, aDirection);
|
||||
gp_Lin L2(AttachmentPoint2, aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1, OffsetPoint), L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2, OffsetPoint), L2);
|
||||
gp_Lin L3 = Proj1.IsEqual(Proj2, Precision::Confusion()) ? gp_Lin(Proj1, aDirection)
|
||||
: gce_MakeLin(Proj1, Proj2);
|
||||
Standard_Real parmin, parmax, parcur;
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3, OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur, L3);
|
||||
|
||||
Standard_Boolean outside = Standard_False;
|
||||
if (parcur < parmin) {
|
||||
parmin = parcur;
|
||||
if (parcur < parmin)
|
||||
{
|
||||
parmin = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
if (parcur > parmax) {
|
||||
parmax = parcur;
|
||||
if (parcur > parmax)
|
||||
{
|
||||
parmax = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin, L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax, L3);
|
||||
|
||||
// processing of face
|
||||
// processing of face
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
|
||||
|
||||
aPrims->AddVertex(PointMin);
|
||||
aPrims->AddVertex(PointMax);
|
||||
|
||||
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
|
||||
if (dist < (LA->ArrowAspect()->Length() + LA->ArrowAspect()->Length()))
|
||||
outside = Standard_True;
|
||||
|
||||
gp_Dir arrdir = L3.Direction().Reversed();
|
||||
if (outside)
|
||||
arrdir.Reverse();
|
||||
|
||||
// processing of call 1
|
||||
|
||||
// processing of call 1
|
||||
aPrims->AddVertex(AttachmentPoint1);
|
||||
aPrims->AddVertex(Proj1);
|
||||
|
||||
// processing of call 2
|
||||
|
||||
// processing of call 2
|
||||
aPrims->AddVertex(AttachmentPoint2);
|
||||
aPrims->AddVertex(Proj2);
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// text
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
// text
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
|
||||
// symbols at the extremities of the face
|
||||
DsgPrs::ComputeSymbol(aPresentation,LA,Proj1,Proj2,arrdir,arrdir.Reversed(),ArrowPrs);
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, Proj1, Proj2, arrdir, arrdir.Reversed(), ArrowPrs);
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================
|
||||
//function : Add
|
||||
//purpose : Adds presentation of length dimension between two curvilinear faces
|
||||
// function : Add
|
||||
// purpose : Adds presentation of length dimension between two curvilinear faces
|
||||
//==================================================================================
|
||||
|
||||
void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const Handle( Geom_Surface )& SecondSurf,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowPrs )
|
||||
void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const Handle(Geom_Surface)& SecondSurf,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Pnt EndOfArrow2;
|
||||
gp_Dir DirOfArrow1;
|
||||
Handle( Geom_Curve ) VCurve, UCurve;
|
||||
Standard_Real FirstU, deltaU = 0.0e0, FirstV, deltaV = 0.0e0;
|
||||
|
||||
DsgPrs::ComputeCurvilinearFacesLengthPresentation( LA->ArrowAspect()->Length(),
|
||||
LA->ArrowAspect()->Length(),
|
||||
SecondSurf,
|
||||
AttachmentPoint1,
|
||||
AttachmentPoint2,
|
||||
aDirection,
|
||||
EndOfArrow2,
|
||||
DirOfArrow1,
|
||||
VCurve,
|
||||
UCurve,
|
||||
FirstU, deltaU,
|
||||
FirstV, deltaV );
|
||||
|
||||
gp_Lin LengthLine( OffsetPoint, DirOfArrow1 );
|
||||
Standard_Real Par1 = ElCLib::Parameter( LengthLine, AttachmentPoint1 );
|
||||
Standard_Real Par2 = ElCLib::Parameter( LengthLine, EndOfArrow2 );
|
||||
gp_Pnt FirstPoint, LastPoint;
|
||||
gp_Pnt EndOfArrow2;
|
||||
gp_Dir DirOfArrow1;
|
||||
Handle(Geom_Curve) VCurve, UCurve;
|
||||
Standard_Real FirstU, deltaU = 0.0e0, FirstV, deltaV = 0.0e0;
|
||||
|
||||
DsgPrs::ComputeCurvilinearFacesLengthPresentation(LA->ArrowAspect()->Length(),
|
||||
LA->ArrowAspect()->Length(),
|
||||
SecondSurf,
|
||||
AttachmentPoint1,
|
||||
AttachmentPoint2,
|
||||
aDirection,
|
||||
EndOfArrow2,
|
||||
DirOfArrow1,
|
||||
VCurve,
|
||||
UCurve,
|
||||
FirstU,
|
||||
deltaU,
|
||||
FirstV,
|
||||
deltaV);
|
||||
|
||||
gp_Lin LengthLine(OffsetPoint, DirOfArrow1);
|
||||
Standard_Real Par1 = ElCLib::Parameter(LengthLine, AttachmentPoint1);
|
||||
Standard_Real Par2 = ElCLib::Parameter(LengthLine, EndOfArrow2);
|
||||
gp_Pnt FirstPoint, LastPoint;
|
||||
if ((Par1 > 0.0 && Par2 > 0.0) || (Par1 < 0.0 && Par2 < 0.0))
|
||||
{
|
||||
FirstPoint = OffsetPoint;
|
||||
LastPoint = (Abs( Par1 ) > Abs( Par2 ))? AttachmentPoint1 : EndOfArrow2;
|
||||
LastPoint = (Abs(Par1) > Abs(Par2)) ? AttachmentPoint1 : EndOfArrow2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -316,77 +340,90 @@ void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// Add presentation of arrows
|
||||
DsgPrs::ComputeSymbol( aPresentation, LA, AttachmentPoint1, EndOfArrow2, DirOfArrow1, DirOfArrow1.Reversed(), ArrowPrs );
|
||||
|
||||
DsgPrs::ComputeSymbol(aPresentation,
|
||||
LA,
|
||||
AttachmentPoint1,
|
||||
EndOfArrow2,
|
||||
DirOfArrow1,
|
||||
DirOfArrow1.Reversed(),
|
||||
ArrowPrs);
|
||||
|
||||
// Drawing the text
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, OffsetPoint);
|
||||
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, OffsetPoint);
|
||||
|
||||
// Two curves from end of Arrow2 to AttachmentPoint2
|
||||
Standard_Real Alpha, delta;
|
||||
Standard_Real Alpha, delta;
|
||||
Standard_Integer NodeNumber;
|
||||
|
||||
Alpha = Abs( deltaU );
|
||||
if (Alpha > Precision::Angular() && Alpha<Precision::Infinite())
|
||||
|
||||
Alpha = Abs(deltaU);
|
||||
if (Alpha > Precision::Angular() && Alpha < Precision::Infinite())
|
||||
{
|
||||
NodeNumber = Max( 4 , Standard_Integer (50. * Alpha / M_PI) );
|
||||
delta = deltaU / (Standard_Real)( NodeNumber - 1 );
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
delta = deltaU / (Standard_Real)(NodeNumber - 1);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
for (Standard_Integer i = 1; i <= NodeNumber; i++, FirstU += delta)
|
||||
aPrims->AddVertex(VCurve->Value( FirstU ));
|
||||
aPrims->AddVertex(VCurve->Value(FirstU));
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
Alpha = Abs( deltaV );
|
||||
if (Alpha > Precision::Angular() && Alpha<Precision::Infinite())
|
||||
Alpha = Abs(deltaV);
|
||||
if (Alpha > Precision::Angular() && Alpha < Precision::Infinite())
|
||||
{
|
||||
NodeNumber = Max( 4 , Standard_Integer (50. * Alpha / M_PI) );
|
||||
delta = deltaV / (Standard_Real)( NodeNumber - 1 );
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
NodeNumber = Max(4, Standard_Integer(50. * Alpha / M_PI));
|
||||
delta = deltaV / (Standard_Real)(NodeNumber - 1);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
|
||||
for (Standard_Integer i = 1; i <= NodeNumber; i++, FirstV += delta)
|
||||
aPrims->AddVertex(UCurve->Value( FirstV ));
|
||||
aPrims->AddVertex(UCurve->Value(FirstV));
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//================================
|
||||
// Function:
|
||||
// Purpose: Rob 26-mar-96
|
||||
//=================================
|
||||
|
||||
void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPrs,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& Pt1,
|
||||
const gp_Pnt& Pt2,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
void DsgPrs_LengthPresentation::Add(const Handle(Prs3d_Presentation)& aPrs,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& Pt1,
|
||||
const gp_Pnt& Pt2,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(Pt1);
|
||||
aPrims->AddVertex(Pt2);
|
||||
aPrs->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
gp_Vec V ;
|
||||
switch(ArrowPrs)
|
||||
gp_Vec V;
|
||||
switch (ArrowPrs)
|
||||
{
|
||||
case DsgPrs_AS_LASTAR:
|
||||
Prs3d_Arrow::Draw (aPrs->CurrentGroup(), Pt2, gp_Dir(gp_Vec(Pt1,Pt2)),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Length());
|
||||
break;
|
||||
Prs3d_Arrow::Draw(aPrs->CurrentGroup(),
|
||||
Pt2,
|
||||
gp_Dir(gp_Vec(Pt1, Pt2)),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Length());
|
||||
break;
|
||||
case DsgPrs_AS_FIRSTAR:
|
||||
Prs3d_Arrow::Draw (aPrs->CurrentGroup(), Pt1, gp_Dir(gp_Vec(Pt2,Pt1)),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Length());
|
||||
break;
|
||||
Prs3d_Arrow::Draw(aPrs->CurrentGroup(),
|
||||
Pt1,
|
||||
gp_Dir(gp_Vec(Pt2, Pt1)),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Length());
|
||||
break;
|
||||
case DsgPrs_AS_BOTHAR:
|
||||
V = gp_Vec(Pt1,Pt2);
|
||||
Prs3d_Arrow::Draw (aPrs->CurrentGroup(), Pt2, gp_Dir(V),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw (aPrs->CurrentGroup(), Pt1, gp_Dir(V.Reversed()),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Length());
|
||||
break;
|
||||
V = gp_Vec(Pt1, Pt2);
|
||||
Prs3d_Arrow::Draw(aPrs->CurrentGroup(),
|
||||
Pt2,
|
||||
gp_Dir(V),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPrs->CurrentGroup(),
|
||||
Pt1,
|
||||
gp_Dir(V.Reversed()),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
|
||||
aDrawer->DimensionAspect()->ArrowAspect()->Length());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -34,13 +34,11 @@ class Geom_Surface;
|
||||
//! The length displayed is indicated by line segments
|
||||
//! and text alone or by a combination of line segment,
|
||||
//! text and arrows at either or both of its ends.
|
||||
class DsgPrs_LengthPresentation
|
||||
class DsgPrs_LengthPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Draws a line segment representing a length in the
|
||||
//! display aPresentation.
|
||||
//! This segment joins the points AttachmentPoint1 and
|
||||
@@ -48,8 +46,14 @@ public:
|
||||
//! The text aText will be displayed at the offset point OffsetPoint.
|
||||
//! The line and text attributes are specified by the
|
||||
//! attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& aDirection, const gp_Pnt& OffsetPoint);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
//! Draws a line segment representing a length in the
|
||||
//! display aPresentation.
|
||||
//! This segment joins the points AttachmentPoint1 and
|
||||
@@ -60,8 +64,15 @@ public:
|
||||
//! both ends of the length.
|
||||
//! The line, text and arrow attributes are specified by the
|
||||
//! attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& aDirection, const gp_Pnt& OffsetPoint, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
//! Draws a line segment representing a length in the
|
||||
//! display aPresentation.
|
||||
//! This segment joins the points AttachmentPoint1 and
|
||||
@@ -73,8 +84,16 @@ public:
|
||||
//! The plane PlaneOfFaces is used if length is null.
|
||||
//! The line, text and arrow attributes are specified by the
|
||||
//! attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Pln& PlaneOfFaces, const gp_Dir& aDirection, const gp_Pnt& OffsetPoint, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Pln& PlaneOfFaces,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
//! Draws a line segment representing a length in the
|
||||
//! display aPresentation.
|
||||
//! This segment joins the points AttachmentPoint1 and
|
||||
@@ -86,8 +105,16 @@ public:
|
||||
//! be displayed at either or both ends of the length.
|
||||
//! The line, text and arrow attributes are specified by the
|
||||
//! attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const Handle(Geom_Surface)& SecondSurf, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& aDirection, const gp_Pnt& OffsetPoint, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const Handle(Geom_Surface)& SecondSurf,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
//! Draws a line segment representing a length in the
|
||||
//! display aPresentation.
|
||||
//! This segment joins the points AttachmentPoint1 and
|
||||
@@ -95,29 +122,14 @@ public:
|
||||
//! The value of the enumeration ArrowSide controls
|
||||
//! whether arrows will be displayed at either or both ends of the length.
|
||||
//! The line and arrow attributes are specified by the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& Pt1, const gp_Pnt& Pt2, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& Pt1,
|
||||
const gp_Pnt& Pt2,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_LengthPresentation_HeaderFile
|
||||
|
@@ -13,7 +13,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs_MidPointPresentation.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
@@ -31,57 +30,57 @@
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
//===================================================================
|
||||
//Function:Add
|
||||
//Purpose: draws the representation of a radial symmetry between two vertices.
|
||||
// Function:Add
|
||||
// Purpose: draws the representation of a radial symmetry between two vertices.
|
||||
//===================================================================
|
||||
void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const Standard_Boolean first)
|
||||
{
|
||||
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
|
||||
void DsgPrs_MidPointPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const Standard_Boolean first)
|
||||
{
|
||||
Standard_Real rad = AttachPoint.Distance(MidPoint) / 20.0;
|
||||
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
|
||||
gp_Ax2 ax = theAxe;
|
||||
ax.SetLocation(MidPoint);
|
||||
gp_Circ aCircleM (ax,rad);
|
||||
gp_Circ aCircleM(ax, rad);
|
||||
|
||||
if ( first )
|
||||
if (first)
|
||||
{
|
||||
// center of the symmetry - circle around the MidPoint
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
const Standard_Real alpha = 2. * M_PI;
|
||||
const Standard_Integer nbp = 100;
|
||||
const Standard_Real dteta = alpha/(nbp-1);
|
||||
const Standard_Real alpha = 2. * M_PI;
|
||||
const Standard_Integer nbp = 100;
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp + 2, 2);
|
||||
aPrims->AddBound(nbp);
|
||||
for (Standard_Integer i = 1; i <= nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(dteta*(i-1),aCircleM));
|
||||
aPrims->AddVertex(ElCLib::Value(dteta * (i - 1), aCircleM));
|
||||
|
||||
// segment from mid point to the text position
|
||||
aPrims->AddBound(2);
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
aPrims->AddVertex(Position.IsEqual(MidPoint,rad)? MidPoint : ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM)); // mid point
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
aPrims->AddVertex(Position); // text position
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// texte
|
||||
// texte
|
||||
TCollection_ExtendedString aText(" (+)");
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, Position);
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, Position);
|
||||
}
|
||||
|
||||
if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
|
||||
if (!AttachPoint.IsEqual(MidPoint, Precision::Confusion()))
|
||||
{
|
||||
if ( !first )
|
||||
if (!first)
|
||||
{
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
@@ -89,36 +88,37 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
|
||||
|
||||
// segment from mid point to the geometry
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM)); // mid point
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
aPrims->AddVertex(AttachPoint); // attach point to the geometry
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===================================================================
|
||||
//Function:Add
|
||||
//Purpose: draws the representation of a radial symmetry between two linear segments.
|
||||
// Function:Add
|
||||
// Purpose: draws the representation of a radial symmetry between two linear segments.
|
||||
//===================================================================
|
||||
void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const Standard_Boolean first)
|
||||
void DsgPrs_MidPointPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const Standard_Boolean first)
|
||||
{
|
||||
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
|
||||
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
|
||||
Standard_Real rad = AttachPoint.Distance(MidPoint) / 20.0;
|
||||
if (rad <= Precision::Confusion())
|
||||
rad = Point1.Distance(Point2) / 20.0;
|
||||
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
|
||||
gp_Ax2 ax = theAxe;
|
||||
ax.SetLocation(MidPoint);
|
||||
gp_Circ aCircleM (ax,rad);
|
||||
gp_Circ aCircleM(ax, rad);
|
||||
|
||||
// segment on line
|
||||
aPresentation->NewGroup();
|
||||
@@ -129,195 +129,199 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
|
||||
aPrims->AddVertex(Point2);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
if ( first )
|
||||
if (first)
|
||||
{
|
||||
// center of the symmetry - circle around the MidPoint
|
||||
const Standard_Real alpha = 2. * M_PI;
|
||||
const Standard_Integer nbp = 100;
|
||||
const Standard_Real dteta = alpha/(nbp-1);
|
||||
const Standard_Real alpha = 2. * M_PI;
|
||||
const Standard_Integer nbp = 100;
|
||||
const Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp + 2, 2);
|
||||
aPrims->AddBound(nbp);
|
||||
for (Standard_Integer i = 1; i <= nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(dteta*(i-1),aCircleM));
|
||||
aPrims->AddVertex(ElCLib::Value(dteta * (i - 1), aCircleM));
|
||||
|
||||
// segment from mid point to the text position
|
||||
aPrims->AddBound(2);
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
aPrims->AddVertex(Position.IsEqual(MidPoint,rad)? MidPoint : ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM)); // mid point
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
aPrims->AddVertex(Position); // text position
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// texte
|
||||
TCollection_ExtendedString aText (" (+)");
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, Position);
|
||||
TCollection_ExtendedString aText(" (+)");
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, Position);
|
||||
}
|
||||
|
||||
if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
|
||||
if (!AttachPoint.IsEqual(MidPoint, Precision::Confusion()))
|
||||
{
|
||||
// mid point
|
||||
aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM));
|
||||
aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(aCircleM, AttachPoint), aCircleM));
|
||||
aPrims->AddVertex(AttachPoint); // attach point to the geometry
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===================================================================
|
||||
//Function:Add
|
||||
//Purpose: draws the representation of a radial symmetry between two circular arcs.
|
||||
// Function:Add
|
||||
// Purpose: draws the representation of a radial symmetry between two circular arcs.
|
||||
//===================================================================
|
||||
void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Circ& aCircle,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const Standard_Boolean first)
|
||||
void DsgPrs_MidPointPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Circ& aCircle,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const Standard_Boolean first)
|
||||
{
|
||||
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
|
||||
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
|
||||
Standard_Real rad = AttachPoint.Distance(MidPoint) / 20.0;
|
||||
if (rad <= Precision::Confusion())
|
||||
rad = Point1.Distance(Point2) / 20.0;
|
||||
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
|
||||
gp_Ax2 ax = aCircle.Position();
|
||||
ax.SetLocation(MidPoint);
|
||||
gp_Circ aCircleM (ax,rad);
|
||||
gp_Circ aCircleM(ax, rad);
|
||||
|
||||
// segment on circle
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
const Standard_Real pf = ElCLib::Parameter(aCircle,Point1);
|
||||
const Standard_Real pl = ElCLib::Parameter(aCircle,Point2);
|
||||
Standard_Real alpha = pl - pf;
|
||||
if ( alpha < 0 ) alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50.0*alpha/M_PI);
|
||||
Standard_Integer nbp = Max(4,nb);
|
||||
Standard_Real dteta = alpha/(nbp-1);
|
||||
const Standard_Real pf = ElCLib::Parameter(aCircle, Point1);
|
||||
const Standard_Real pl = ElCLib::Parameter(aCircle, Point2);
|
||||
Standard_Real alpha = pl - pf;
|
||||
if (alpha < 0)
|
||||
alpha += 2. * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50.0 * alpha / M_PI);
|
||||
Standard_Integer nbp = Max(4, nb);
|
||||
Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(nbp);
|
||||
for (Standard_Integer i = 1; i <= nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(pf + dteta*(i-1),aCircle));
|
||||
aPrims->AddVertex(ElCLib::Value(pf + dteta * (i - 1), aCircle));
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
if ( first )
|
||||
if (first)
|
||||
{
|
||||
// center of the symmetry - circle around the MidPoint
|
||||
alpha = 2. * M_PI;
|
||||
nbp = 100;
|
||||
dteta = alpha/(nbp-1);
|
||||
nbp = 100;
|
||||
dteta = alpha / (nbp - 1);
|
||||
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp + 2, 2);
|
||||
aPrims->AddBound(nbp);
|
||||
for (Standard_Integer i = 1; i <= nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(dteta*(i-1),aCircleM));
|
||||
aPrims->AddVertex(ElCLib::Value(dteta * (i - 1), aCircleM));
|
||||
|
||||
// segment from mid point to the text position
|
||||
aPrims->AddBound(2);
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
aPrims->AddVertex(Position.IsEqual(MidPoint,rad)? MidPoint : ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM)); // mid point
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
aPrims->AddVertex(Position); // text position
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// texte
|
||||
TCollection_ExtendedString aText (" (+)");
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, Position);
|
||||
// texte
|
||||
TCollection_ExtendedString aText(" (+)");
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, Position);
|
||||
}
|
||||
|
||||
if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
|
||||
if (!AttachPoint.IsEqual(MidPoint, Precision::Confusion()))
|
||||
{
|
||||
// segment from mid point to the geometry
|
||||
aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM)); // mid point
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
aPrims->AddVertex(AttachPoint); // attach point to the geometry
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===================================================================
|
||||
//Function:Add
|
||||
//Purpose: draws the representation of a radial symmetry between two elliptic arcs.
|
||||
// Function:Add
|
||||
// Purpose: draws the representation of a radial symmetry between two elliptic arcs.
|
||||
//===================================================================
|
||||
void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Elips& aCircle,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const Standard_Boolean first)
|
||||
void DsgPrs_MidPointPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Elips& aCircle,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const Standard_Boolean first)
|
||||
{
|
||||
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
|
||||
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
|
||||
Standard_Real rad = AttachPoint.Distance(MidPoint) / 20.0;
|
||||
if (rad <= Precision::Confusion())
|
||||
rad = Point1.Distance(Point2) / 20.0;
|
||||
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
|
||||
gp_Pnt Ptmp,ptcur;
|
||||
gp_Pnt Ptmp, ptcur;
|
||||
|
||||
gp_Ax2 ax = aCircle.Position();
|
||||
ax.SetLocation(MidPoint);
|
||||
gp_Circ aCircleM (ax,rad);
|
||||
gp_Circ aCircleM(ax, rad);
|
||||
|
||||
// segment on ellipse
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
const Standard_Real pf = ElCLib::Parameter(aCircle,Point1);
|
||||
const Standard_Real pl = ElCLib::Parameter(aCircle,Point2);
|
||||
Standard_Real alpha = pl - pf;
|
||||
if ( alpha < 0 ) alpha += 2 * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50.0*alpha/M_PI);
|
||||
Standard_Integer nbp = Max(4,nb);
|
||||
Standard_Real dteta = alpha/(nbp-1);
|
||||
const Standard_Real pf = ElCLib::Parameter(aCircle, Point1);
|
||||
const Standard_Real pl = ElCLib::Parameter(aCircle, Point2);
|
||||
Standard_Real alpha = pl - pf;
|
||||
if (alpha < 0)
|
||||
alpha += 2 * M_PI;
|
||||
const Standard_Integer nb = (Standard_Integer)(50.0 * alpha / M_PI);
|
||||
Standard_Integer nbp = Max(4, nb);
|
||||
Standard_Real dteta = alpha / (nbp - 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(nbp);
|
||||
for (Standard_Integer i = 1; i <= nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(pf + dteta*(i-1),aCircle));
|
||||
aPrims->AddVertex(ElCLib::Value(pf + dteta * (i - 1), aCircle));
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
if ( first )
|
||||
if (first)
|
||||
{
|
||||
// center of the symmetry - circle around the MidPoint
|
||||
alpha = 2. * M_PI;
|
||||
nbp = 100;
|
||||
dteta = alpha/(nbp-1);
|
||||
nbp = 100;
|
||||
dteta = alpha / (nbp - 1);
|
||||
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
|
||||
aPrims = new Graphic3d_ArrayOfPolylines(nbp + 2, 2);
|
||||
aPrims->AddBound(nbp);
|
||||
for (Standard_Integer i = 1; i <= nbp; i++)
|
||||
aPrims->AddVertex(ElCLib::Value(dteta*(i-1),aCircleM));
|
||||
aPrims->AddVertex(ElCLib::Value(dteta * (i - 1), aCircleM));
|
||||
|
||||
// segment from mid point to the text position
|
||||
aPrims->AddBound(2);
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
aPrims->AddVertex(Position.IsEqual(MidPoint,rad)? MidPoint : ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM)); // mid point
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
aPrims->AddVertex(Position); // text position
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// texte
|
||||
TCollection_ExtendedString aText (" (+)");
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, Position);
|
||||
// texte
|
||||
TCollection_ExtendedString aText(" (+)");
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, Position);
|
||||
}
|
||||
|
||||
if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
|
||||
if (!AttachPoint.IsEqual(MidPoint, Precision::Confusion()))
|
||||
{
|
||||
// segment from mid point to the geometry
|
||||
aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM)); // mid point
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
aPrims->AddVertex(AttachPoint); // attach point to the geometry
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
|
@@ -27,50 +27,59 @@ class gp_Pnt;
|
||||
class gp_Circ;
|
||||
class gp_Elips;
|
||||
|
||||
class DsgPrs_MidPointPresentation
|
||||
class DsgPrs_MidPointPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! draws the representation of a MidPoint between
|
||||
//! two vertices.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Ax2& theAxe, const gp_Pnt& MidPoint, const gp_Pnt& Position, const gp_Pnt& AttachPoint, const Standard_Boolean first);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const Standard_Boolean first);
|
||||
|
||||
//! draws the representation of a MidPoint between
|
||||
//! two lines or linear segments.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Ax2& theAxe, const gp_Pnt& MidPoint, const gp_Pnt& Position, const gp_Pnt& AttachPoint, const gp_Pnt& Point1, const gp_Pnt& Point2, const Standard_Boolean first);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Ax2& theAxe,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const Standard_Boolean first);
|
||||
|
||||
//! draws the representation of a MidPoint between
|
||||
//! two entire circles or two circular arcs.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Circ& aCircle, const gp_Pnt& MidPoint, const gp_Pnt& Position, const gp_Pnt& AttachPoint, const gp_Pnt& Point1, const gp_Pnt& Point2, const Standard_Boolean first);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Circ& aCircle,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const Standard_Boolean first);
|
||||
|
||||
//! draws the representation of a MidPoint between
|
||||
//! two entire ellipses or two elliptic arcs.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Elips& anElips, const gp_Pnt& MidPoint, const gp_Pnt& Position, const gp_Pnt& AttachPoint, const gp_Pnt& Point1, const gp_Pnt& Point2, const Standard_Boolean first);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Elips& anElips,
|
||||
const gp_Pnt& MidPoint,
|
||||
const gp_Pnt& Position,
|
||||
const gp_Pnt& AttachPoint,
|
||||
const gp_Pnt& Point1,
|
||||
const gp_Pnt& Point2,
|
||||
const Standard_Boolean first);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_MidPointPresentation_HeaderFile
|
||||
|
@@ -33,57 +33,63 @@
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
void DsgPrs_OffsetPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Dir& aDirection2,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
void DsgPrs_OffsetPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Dir& aDirection2,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Lin L1 (AttachmentPoint1,aDirection);
|
||||
gp_Lin L2 (AttachmentPoint2,aDirection2);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
|
||||
gp_Lin L3,L4;
|
||||
gp_Lin L1(AttachmentPoint1, aDirection);
|
||||
gp_Lin L2(AttachmentPoint2, aDirection2);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1, OffsetPoint), L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2, OffsetPoint), L2);
|
||||
gp_Lin L3, L4;
|
||||
Standard_Boolean DimNulle = Standard_False;
|
||||
if (!Proj1.IsEqual(Proj2,Precision::Confusion()*100.)) {
|
||||
L3 = gce_MakeLin(Proj1,Proj2);
|
||||
if (!Proj1.IsEqual(Proj2, Precision::Confusion() * 100.))
|
||||
{
|
||||
L3 = gce_MakeLin(Proj1, Proj2);
|
||||
}
|
||||
else {
|
||||
//std::cout<<"DsgPrs_OffsetPresentation Cote nulle"<<std::endl;
|
||||
else
|
||||
{
|
||||
// std::cout<<"DsgPrs_OffsetPresentation Cote nulle"<<std::endl;
|
||||
DimNulle = Standard_True;
|
||||
L3 = gp_Lin(Proj1,aDirection);
|
||||
gp_Vec v4 (Proj1,OffsetPoint);
|
||||
gp_Dir d4 (v4);
|
||||
L4 = gp_Lin(Proj1,d4); // normale
|
||||
L3 = gp_Lin(Proj1, aDirection);
|
||||
gp_Vec v4(Proj1, OffsetPoint);
|
||||
gp_Dir d4(v4);
|
||||
L4 = gp_Lin(Proj1, d4); // normale
|
||||
}
|
||||
Standard_Real parmin,parmax,parcur;
|
||||
parmin = ElCLib::Parameter(L3,Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3,Proj2);
|
||||
Standard_Real dist = Abs(parmin-parcur);
|
||||
if (parcur < parmin) parmin = parcur;
|
||||
if (parcur > parmax) parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3,OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur,L3);
|
||||
Standard_Real parmin, parmax, parcur;
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3, OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur, L3);
|
||||
|
||||
Standard_Boolean outside = Standard_False;
|
||||
if (parcur < parmin) {
|
||||
parmin = parcur;
|
||||
if (parcur < parmin)
|
||||
{
|
||||
parmin = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
if (parcur > parmax) {
|
||||
parmax = parcur;
|
||||
if (parcur > parmax)
|
||||
{
|
||||
parmax = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin, L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax, L3);
|
||||
|
||||
// trait de cote : 1er groupe
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
|
||||
@@ -95,35 +101,48 @@ void DsgPrs_OffsetPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
|
||||
|
||||
if (DimNulle)
|
||||
{
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), offp, L4.Direction(), LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), offp, L4.Direction().Reversed(), LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
offp,
|
||||
L4.Direction(),
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
offp,
|
||||
L4.Direction().Reversed(),
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
|
||||
if (dist < (LA->ArrowAspect()->Length() + LA->ArrowAspect()->Length()))
|
||||
outside = Standard_True;
|
||||
gp_Dir arrdir = L3.Direction().Reversed();
|
||||
if (outside)
|
||||
arrdir.Reverse();
|
||||
|
||||
// fleche 1 : 2eme groupe
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), Proj1, arrdir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
Proj1,
|
||||
arrdir,
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
|
||||
// ball 1 : 3eme groupe
|
||||
Quantity_Color aColor = LA->LineAspect()->Aspect()->Color();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0);
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect (aMarkerAsp);
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
|
||||
anArrayOfPoints->AddVertex (Proj2.X(), Proj2.Y(), Proj2.Z());
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray (anArrayOfPoints);
|
||||
Quantity_Color aColor = LA->LineAspect()->Aspect()->Color();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAsp =
|
||||
new Graphic3d_AspectMarker3d(Aspect_TOM_O, aColor, 1.0);
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(aMarkerAsp);
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints(1);
|
||||
anArrayOfPoints->AddVertex(Proj2.X(), Proj2.Y(), Proj2.Z());
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(anArrayOfPoints);
|
||||
|
||||
aPresentation->NewGroup();
|
||||
|
||||
// texte : 4eme groupe
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
}
|
||||
|
||||
aPresentation->NewGroup();
|
||||
@@ -140,28 +159,28 @@ void DsgPrs_OffsetPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
|
||||
void DsgPrs_OffsetPresentation::AddAxes (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& /*aText*/,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Dir& /*aDirection2*/,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
void DsgPrs_OffsetPresentation::AddAxes(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& /*aText*/,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Dir& /*aDirection2*/,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
{
|
||||
gp_Lin L1 (AttachmentPoint1,aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
|
||||
gp_Lin L1(AttachmentPoint1, aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1, OffsetPoint), L1);
|
||||
|
||||
gp_Lin L2 (AttachmentPoint2,aDirection);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
|
||||
gp_Lin L2(AttachmentPoint2, aDirection);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2, OffsetPoint), L2);
|
||||
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
Quantity_Color acolor = LA->LineAspect()->Aspect()->Color();
|
||||
Aspect_TypeOfLine atype = LA->LineAspect()->Aspect()->Type();
|
||||
Standard_Real awidth = LA->LineAspect()->Aspect()->Width();
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
Quantity_Color acolor = LA->LineAspect()->Aspect()->Color();
|
||||
Aspect_TypeOfLine atype = LA->LineAspect()->Aspect()->Type();
|
||||
Standard_Real awidth = LA->LineAspect()->Aspect()->Width();
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) AxeAsp = new Graphic3d_AspectLine3d (acolor, atype, awidth);
|
||||
AxeAsp->SetType( Aspect_TOL_DOTDASH);
|
||||
Handle(Graphic3d_AspectLine3d) AxeAsp = new Graphic3d_AspectLine3d(acolor, atype, awidth);
|
||||
AxeAsp->SetType(Aspect_TOL_DOTDASH);
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(AxeAsp);
|
||||
|
||||
@@ -173,9 +192,9 @@ void DsgPrs_OffsetPresentation::AddAxes (const Handle(Prs3d_Presentation)& aPres
|
||||
|
||||
aPresentation->NewGroup();
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) Axe2Asp = new Graphic3d_AspectLine3d (acolor, atype, awidth);
|
||||
Axe2Asp->SetType ( Aspect_TOL_DOTDASH);
|
||||
Axe2Asp->SetWidth ( 4.);
|
||||
Handle(Graphic3d_AspectLine3d) Axe2Asp = new Graphic3d_AspectLine3d(acolor, atype, awidth);
|
||||
Axe2Asp->SetType(Aspect_TOL_DOTDASH);
|
||||
Axe2Asp->SetWidth(4.);
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(Axe2Asp);
|
||||
|
||||
// trait d'axe: 2eme groupe
|
||||
@@ -185,24 +204,24 @@ void DsgPrs_OffsetPresentation::AddAxes (const Handle(Prs3d_Presentation)& aPres
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// anneau : 3eme et 4eme groupes
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
|
||||
anArrayOfPoints->AddVertex (Proj2.X(), Proj2.Y(), Proj2.Z());
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints(1);
|
||||
anArrayOfPoints->AddVertex(Proj2.X(), Proj2.Y(), Proj2.Z());
|
||||
|
||||
aPresentation->NewGroup();
|
||||
Handle(Graphic3d_AspectMarker3d) MarkerAsp = new Graphic3d_AspectMarker3d();
|
||||
MarkerAsp->SetType(Aspect_TOM_O);
|
||||
MarkerAsp->SetScale(4.);
|
||||
//MarkerAsp->SetColor(Quantity_Color(Quantity_NOC_RED));
|
||||
// MarkerAsp->SetColor(Quantity_Color(Quantity_NOC_RED));
|
||||
MarkerAsp->SetColor(acolor);
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(MarkerAsp);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray (anArrayOfPoints);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(anArrayOfPoints);
|
||||
|
||||
aPresentation->NewGroup();
|
||||
Handle(Graphic3d_AspectMarker3d) Marker2Asp = new Graphic3d_AspectMarker3d();
|
||||
Marker2Asp->SetType(Aspect_TOM_O);
|
||||
Marker2Asp->SetScale(2.);
|
||||
//Marker2Asp->SetColor(Quantity_Color(Quantity_NOC_GREEN));
|
||||
// Marker2Asp->SetColor(Quantity_Color(Quantity_NOC_GREEN));
|
||||
Marker2Asp->SetColor(acolor);
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(Marker2Asp);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray (anArrayOfPoints);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(anArrayOfPoints);
|
||||
}
|
||||
|
@@ -28,13 +28,11 @@ class gp_Pnt;
|
||||
class gp_Dir;
|
||||
|
||||
//! A framework to define display of offsets.
|
||||
class DsgPrs_OffsetPresentation
|
||||
class DsgPrs_OffsetPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Defines the display of elements showing offset shapes.
|
||||
//! These include the two points of attachment
|
||||
//! AttachmentPoint1 and AttachmentPoint1, the two
|
||||
@@ -42,35 +40,30 @@ public:
|
||||
//! These arguments are added to the presentation
|
||||
//! object aPresentation. Their display attributes are
|
||||
//! defined by the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& aDirection, const gp_Dir& aDirection2, const gp_Pnt& OffsetPoint);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Dir& aDirection2,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
//! draws the representation of axes alignment Constraint
|
||||
//! between the point AttachmentPoint1 and the
|
||||
//! point AttachmentPoint2, along direction
|
||||
//! aDirection, using the offset point OffsetPoint.
|
||||
Standard_EXPORT static void AddAxes (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& aDirection, const gp_Dir& aDirection2, const gp_Pnt& OffsetPoint);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void AddAxes(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Dir& aDirection2,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_OffsetPresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs.hxx>
|
||||
#include <DsgPrs_ParalPresentation.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
@@ -30,43 +29,47 @@
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
void DsgPrs_ParalPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
gp_Lin L1 (AttachmentPoint1,aDirection);
|
||||
gp_Lin L2 (AttachmentPoint2,aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
|
||||
gp_Lin L3 = gce_MakeLin(Proj1,Proj2);
|
||||
Standard_Real parmin,parmax,parcur;
|
||||
parmin = ElCLib::Parameter(L3,Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3,Proj2);
|
||||
Standard_Real dist = Abs(parmin-parcur);
|
||||
if (parcur < parmin) parmin = parcur;
|
||||
if (parcur > parmax) parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3,OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur,L3);
|
||||
gp_Lin L1(AttachmentPoint1, aDirection);
|
||||
gp_Lin L2(AttachmentPoint2, aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1, OffsetPoint), L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2, OffsetPoint), L2);
|
||||
gp_Lin L3 = gce_MakeLin(Proj1, Proj2);
|
||||
Standard_Real parmin, parmax, parcur;
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3, OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur, L3);
|
||||
|
||||
Standard_Boolean outside = Standard_False;
|
||||
if (parcur < parmin) {
|
||||
parmin = parcur;
|
||||
if (parcur < parmin)
|
||||
{
|
||||
parmin = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
if (parcur > parmax) {
|
||||
parmax = parcur;
|
||||
if (parcur > parmax)
|
||||
{
|
||||
parmax = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin, L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax, L3);
|
||||
|
||||
// processing of side : 1st group
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
|
||||
@@ -75,33 +78,41 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
|
||||
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
|
||||
|
||||
if (dist < (LA->ArrowAspect()->Length() + LA->ArrowAspect()->Length()))
|
||||
outside = Standard_True;
|
||||
gp_Dir arrdir = L3.Direction().Reversed();
|
||||
if (outside)
|
||||
arrdir.Reverse();
|
||||
|
||||
// arrow 1 : 2nd group
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), Proj1, arrdir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
Proj1,
|
||||
arrdir,
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
|
||||
// arrow 2 : 3rd group
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), Proj2, arrdir.Reversed(), LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
Proj2,
|
||||
arrdir.Reversed(),
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
|
||||
aPresentation->NewGroup();
|
||||
|
||||
|
||||
// text : 4th group
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
// processing of call 1 : 5th group
|
||||
aPrims->AddVertex(AttachmentPoint1);
|
||||
aPrims->AddVertex(Proj1);
|
||||
|
||||
|
||||
// processing of call 2 : 6th group
|
||||
aPrims->AddVertex(AttachmentPoint2);
|
||||
aPrims->AddVertex(Proj2);
|
||||
@@ -109,75 +120,78 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
// function : DsgPrs_ParalPresentation::Add
|
||||
// purpose : it is possible to choose the symbol of extremities of the face (arrow, point...)
|
||||
//==========================================================================
|
||||
void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
void DsgPrs_ParalPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowPrs)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Lin L1 (AttachmentPoint1,aDirection);
|
||||
gp_Lin L2 (AttachmentPoint2,aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
|
||||
gp_Lin L3 = gce_MakeLin(Proj1,Proj2);
|
||||
Standard_Real parmin,parmax,parcur;
|
||||
parmin = ElCLib::Parameter(L3,Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3,Proj2);
|
||||
Standard_Real dist = Abs(parmin-parcur);
|
||||
if (parcur < parmin) parmin = parcur;
|
||||
if (parcur > parmax) parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3,OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur,L3);
|
||||
gp_Lin L1(AttachmentPoint1, aDirection);
|
||||
gp_Lin L2(AttachmentPoint2, aDirection);
|
||||
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1, OffsetPoint), L1);
|
||||
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2, OffsetPoint), L2);
|
||||
gp_Lin L3 = gce_MakeLin(Proj1, Proj2);
|
||||
Standard_Real parmin, parmax, parcur;
|
||||
parmin = ElCLib::Parameter(L3, Proj1);
|
||||
parmax = parmin;
|
||||
parcur = ElCLib::Parameter(L3, Proj2);
|
||||
Standard_Real dist = Abs(parmin - parcur);
|
||||
if (parcur < parmin)
|
||||
parmin = parcur;
|
||||
if (parcur > parmax)
|
||||
parmax = parcur;
|
||||
parcur = ElCLib::Parameter(L3, OffsetPoint);
|
||||
gp_Pnt offp = ElCLib::Value(parcur, L3);
|
||||
|
||||
Standard_Boolean outside = Standard_False;
|
||||
if (parcur < parmin) {
|
||||
parmin = parcur;
|
||||
if (parcur < parmin)
|
||||
{
|
||||
parmin = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
if (parcur > parmax) {
|
||||
parmax = parcur;
|
||||
if (parcur > parmax)
|
||||
{
|
||||
parmax = parcur;
|
||||
outside = Standard_True;
|
||||
}
|
||||
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
|
||||
gp_Pnt PointMin = ElCLib::Value(parmin, L3);
|
||||
gp_Pnt PointMax = ElCLib::Value(parmax, L3);
|
||||
|
||||
// processing of face
|
||||
// processing of face
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
|
||||
aPrims->AddVertex(PointMin);
|
||||
aPrims->AddVertex(PointMax);
|
||||
|
||||
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
|
||||
|
||||
if (dist < (LA->ArrowAspect()->Length() + LA->ArrowAspect()->Length()))
|
||||
outside = Standard_True;
|
||||
gp_Dir arrdir = L3.Direction().Reversed();
|
||||
if (outside)
|
||||
arrdir.Reverse();
|
||||
|
||||
// processing of call 1
|
||||
// processing of call 1
|
||||
aPrims->AddVertex(AttachmentPoint1);
|
||||
aPrims->AddVertex(Proj1);
|
||||
|
||||
// processing of call 2
|
||||
|
||||
// processing of call 2
|
||||
aPrims->AddVertex(AttachmentPoint2);
|
||||
aPrims->AddVertex(Proj2);
|
||||
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// text
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
|
||||
//arrows
|
||||
DsgPrs::ComputeSymbol(aPresentation,LA,Proj1,Proj2,arrdir,arrdir.Reversed(),ArrowPrs);
|
||||
// text
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, offp);
|
||||
|
||||
// arrows
|
||||
DsgPrs::ComputeSymbol(aPresentation, LA, Proj1, Proj2, arrdir, arrdir.Reversed(), ArrowPrs);
|
||||
}
|
||||
|
@@ -26,13 +26,11 @@ class gp_Pnt;
|
||||
class gp_Dir;
|
||||
|
||||
//! A framework to define display of relations of parallelism between shapes.
|
||||
class DsgPrs_ParalPresentation
|
||||
class DsgPrs_ParalPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Defines the display of elements showing relations of
|
||||
//! parallelism between shapes.
|
||||
//! These include the two points of attachment
|
||||
@@ -41,8 +39,14 @@ public:
|
||||
//! These arguments are added to the presentation
|
||||
//! object aPresentation. Their display attributes are
|
||||
//! defined by the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& aDirection, const gp_Pnt& OffsetPoint);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
//! Defines the display of elements showing relations of
|
||||
//! parallelism between shapes.
|
||||
//! These include the two points of attachment
|
||||
@@ -52,29 +56,17 @@ public:
|
||||
//! These arguments are added to the presentation
|
||||
//! object aPresentation. Their display attributes are
|
||||
//! defined by the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& aDirection, const gp_Pnt& OffsetPoint, const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const DsgPrs_ArrowSide ArrowSide);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_ParalPresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs_PerpenPresentation.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gce_MakeDir.hxx>
|
||||
@@ -27,22 +26,22 @@
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
|
||||
void DsgPrs_PerpenPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& pAx1,
|
||||
const gp_Pnt& pAx2,
|
||||
const gp_Pnt& pnt1,
|
||||
const gp_Pnt& pnt2,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const Standard_Boolean intOut1,
|
||||
const Standard_Boolean intOut2)
|
||||
void DsgPrs_PerpenPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& pAx1,
|
||||
const gp_Pnt& pAx2,
|
||||
const gp_Pnt& pnt1,
|
||||
const gp_Pnt& pnt2,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const Standard_Boolean intOut1,
|
||||
const Standard_Boolean intOut2)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID); // ou DOT ou DOTDASH
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
|
||||
// segments
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(6,2);
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(6, 2);
|
||||
|
||||
aPrims->AddBound(3);
|
||||
aPrims->AddVertex(OffsetPoint);
|
||||
@@ -50,13 +49,13 @@ void DsgPrs_PerpenPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
|
||||
aPrims->AddVertex(pAx2);
|
||||
|
||||
// Symbol
|
||||
gp_Vec vec1(gce_MakeDir(OffsetPoint,pAx1));
|
||||
gp_Vec vec2(gce_MakeDir(OffsetPoint,pAx2));
|
||||
gp_Vec vec1(gce_MakeDir(OffsetPoint, pAx1));
|
||||
gp_Vec vec2(gce_MakeDir(OffsetPoint, pAx2));
|
||||
vec1 *= .2 * OffsetPoint.Distance(pAx1);
|
||||
vec2 *= .2 * OffsetPoint.Distance(pAx2);
|
||||
|
||||
gp_Pnt pAx11 = OffsetPoint.Translated(vec1);
|
||||
gp_Pnt pAx22 = OffsetPoint.Translated(vec2);
|
||||
gp_Pnt pAx11 = OffsetPoint.Translated(vec1);
|
||||
gp_Pnt pAx22 = OffsetPoint.Translated(vec2);
|
||||
gp_Pnt p_symb = pAx22.Translated(vec1);
|
||||
|
||||
aPrims->AddBound(3);
|
||||
@@ -73,13 +72,15 @@ void DsgPrs_PerpenPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
if (intOut1) {
|
||||
if (intOut1)
|
||||
{
|
||||
aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(pAx1);
|
||||
aPrims->AddVertex(pnt1);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
if (intOut2) {
|
||||
if (intOut2)
|
||||
{
|
||||
aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(pAx2);
|
||||
aPrims->AddVertex(pnt2);
|
||||
|
@@ -27,13 +27,11 @@ class gp_Pnt;
|
||||
|
||||
//! A framework to define display of perpendicular
|
||||
//! constraints between shapes.
|
||||
class DsgPrs_PerpenPresentation
|
||||
class DsgPrs_PerpenPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Defines the display of elements showing
|
||||
//! perpendicular constraints between shapes.
|
||||
//! These include the two axis points pAx1 and pAx2,
|
||||
@@ -42,29 +40,18 @@ public:
|
||||
//! These arguments are added to the presentation
|
||||
//! object aPresentation. Their display attributes are
|
||||
//! defined by the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& pAx1, const gp_Pnt& pAx2, const gp_Pnt& pnt1, const gp_Pnt& pnt2, const gp_Pnt& OffsetPoint, const Standard_Boolean intOut1, const Standard_Boolean intOut2);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& pAx1,
|
||||
const gp_Pnt& pAx2,
|
||||
const gp_Pnt& pnt1,
|
||||
const gp_Pnt& pnt2,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const Standard_Boolean intOut1,
|
||||
const Standard_Boolean intOut2);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_PerpenPresentation_HeaderFile
|
||||
|
@@ -37,68 +37,75 @@ static Standard_Boolean DsgPrs_InDomain(const Standard_Real fpar,
|
||||
{
|
||||
if (fpar >= 0.)
|
||||
return ((para >= fpar) && (para <= lpar));
|
||||
if (para >= (fpar+2.*M_PI)) return Standard_True;
|
||||
if (para <= lpar) return Standard_True;
|
||||
if (para >= (fpar + 2. * M_PI))
|
||||
return Standard_True;
|
||||
if (para <= lpar)
|
||||
return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void DsgPrs_RadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const Standard_Real firstparam,
|
||||
const Standard_Real lastparam,
|
||||
const Standard_Boolean drawFromCenter,
|
||||
const Standard_Boolean reverseArrow)
|
||||
void DsgPrs_RadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const Standard_Real firstparam,
|
||||
const Standard_Real lastparam,
|
||||
const Standard_Boolean drawFromCenter,
|
||||
const Standard_Boolean reverseArrow)
|
||||
{
|
||||
Standard_Real fpara = firstparam;
|
||||
Standard_Real lpara = lastparam;
|
||||
while (lpara > 2.*M_PI) {
|
||||
fpara -= 2.*M_PI;
|
||||
lpara -= 2.*M_PI;
|
||||
while (lpara > 2. * M_PI)
|
||||
{
|
||||
fpara -= 2. * M_PI;
|
||||
lpara -= 2. * M_PI;
|
||||
}
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
Standard_Real parat = ElCLib::Parameter(aCircle,AttachmentPoint);
|
||||
gp_Pnt attpoint = AttachmentPoint;
|
||||
Standard_Real parat = ElCLib::Parameter(aCircle, AttachmentPoint);
|
||||
gp_Pnt attpoint = AttachmentPoint;
|
||||
Standard_Boolean otherside = Standard_False;
|
||||
if ( !DsgPrs_InDomain(fpara,lpara,parat)) {
|
||||
if (!DsgPrs_InDomain(fpara, lpara, parat))
|
||||
{
|
||||
Standard_Real otherpar = parat + M_PI;
|
||||
if (otherpar > 2.*M_PI) otherpar -= 2.*M_PI;
|
||||
if (DsgPrs_InDomain(fpara,lpara,otherpar)) {
|
||||
parat = otherpar;
|
||||
if (otherpar > 2. * M_PI)
|
||||
otherpar -= 2. * M_PI;
|
||||
if (DsgPrs_InDomain(fpara, lpara, otherpar))
|
||||
{
|
||||
parat = otherpar;
|
||||
otherside = Standard_True;
|
||||
}
|
||||
else {
|
||||
const Standard_Real ecartpar = Min(Abs(fpara-parat),Abs(lpara-parat));
|
||||
const Standard_Real ecartoth = Min(Abs(fpara-otherpar),Abs(lpara-otherpar));
|
||||
if (ecartpar <= ecartoth) {
|
||||
parat = (parat < fpara)? fpara : lpara;
|
||||
else
|
||||
{
|
||||
const Standard_Real ecartpar = Min(Abs(fpara - parat), Abs(lpara - parat));
|
||||
const Standard_Real ecartoth = Min(Abs(fpara - otherpar), Abs(lpara - otherpar));
|
||||
if (ecartpar <= ecartoth)
|
||||
{
|
||||
parat = (parat < fpara) ? fpara : lpara;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
otherside = Standard_True;
|
||||
parat = (otherpar < fpara)? fpara : lpara;
|
||||
parat = (otherpar < fpara) ? fpara : lpara;
|
||||
}
|
||||
gp_Pnt ptdir = ElCLib::Value(parat,aCircle);
|
||||
gp_Lin lsup(aCircle.Location(),gp_Dir(ptdir.XYZ()-aCircle.Location().XYZ()));
|
||||
const Standard_Real parpos = ElCLib::Parameter(lsup,AttachmentPoint);
|
||||
attpoint = ElCLib::Value(parpos,lsup);
|
||||
gp_Pnt ptdir = ElCLib::Value(parat, aCircle);
|
||||
gp_Lin lsup(aCircle.Location(), gp_Dir(ptdir.XYZ() - aCircle.Location().XYZ()));
|
||||
const Standard_Real parpos = ElCLib::Parameter(lsup, AttachmentPoint);
|
||||
attpoint = ElCLib::Value(parpos, lsup);
|
||||
}
|
||||
}
|
||||
gp_Pnt ptoncirc = ElCLib::Value(parat,aCircle);
|
||||
gp_Lin L (aCircle.Location(),gp_Dir(attpoint.XYZ()-aCircle.Location().XYZ()));
|
||||
gp_Pnt firstpoint = attpoint;
|
||||
gp_Pnt ptoncirc = ElCLib::Value(parat, aCircle);
|
||||
gp_Lin L(aCircle.Location(), gp_Dir(attpoint.XYZ() - aCircle.Location().XYZ()));
|
||||
gp_Pnt firstpoint = attpoint;
|
||||
gp_Pnt drawtopoint = ptoncirc;
|
||||
if (drawFromCenter && !otherside) {
|
||||
const Standard_Real uatt = ElCLib::Parameter(L,attpoint);
|
||||
const Standard_Real uptc = ElCLib::Parameter(L,ptoncirc);
|
||||
if (drawFromCenter && !otherside)
|
||||
{
|
||||
const Standard_Real uatt = ElCLib::Parameter(L, attpoint);
|
||||
const Standard_Real uptc = ElCLib::Parameter(L, ptoncirc);
|
||||
if (Abs(uatt) > Abs(uptc))
|
||||
drawtopoint = aCircle.Location();
|
||||
else
|
||||
@@ -115,33 +122,42 @@ void DsgPrs_RadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
|
||||
arrdir.Reverse();
|
||||
|
||||
// fleche
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), ptoncirc, arrdir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
ptoncirc,
|
||||
arrdir,
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
|
||||
// texte
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, attpoint);
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, attpoint);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DsgPrs_RadiusPresentation::Add
|
||||
//purpose : SZY 20-february-98
|
||||
// function : DsgPrs_RadiusPresentation::Add
|
||||
// purpose : SZY 20-february-98
|
||||
// : adds radius representation according drawFromCenter value
|
||||
//=======================================================================
|
||||
|
||||
void DsgPrs_RadiusPresentation::Add( const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Pnt& Center,
|
||||
const gp_Pnt& EndOfArrow,
|
||||
const DsgPrs_ArrowSide ArrowPrs,
|
||||
const Standard_Boolean drawFromCenter,
|
||||
const Standard_Boolean reverseArrow)
|
||||
void DsgPrs_RadiusPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Pnt& Center,
|
||||
const gp_Pnt& EndOfArrow,
|
||||
const DsgPrs_ArrowSide ArrowPrs,
|
||||
const Standard_Boolean drawFromCenter,
|
||||
const Standard_Boolean reverseArrow)
|
||||
{
|
||||
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
|
||||
gp_Pnt LineOrigin, LineEnd;
|
||||
DsgPrs::ComputeRadiusLine(Center, EndOfArrow, AttachmentPoint, drawFromCenter, LineOrigin, LineEnd);
|
||||
DsgPrs::ComputeRadiusLine(Center,
|
||||
EndOfArrow,
|
||||
AttachmentPoint,
|
||||
drawFromCenter,
|
||||
LineOrigin,
|
||||
LineEnd);
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(LineOrigin);
|
||||
@@ -149,10 +165,17 @@ void DsgPrs_RadiusPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// text
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), LA->TextAspect(), aText, AttachmentPoint);
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), LA->TextAspect(), aText, AttachmentPoint);
|
||||
|
||||
gp_Dir ArrowDir = gce_MakeDir( LineOrigin , LineEnd );
|
||||
gp_Dir ArrowDir = gce_MakeDir(LineOrigin, LineEnd);
|
||||
if (reverseArrow)
|
||||
ArrowDir.Reverse();
|
||||
DsgPrs::ComputeSymbol( aPresentation, LA, Center, EndOfArrow, ArrowDir.Reversed(), ArrowDir, ArrowPrs, drawFromCenter );
|
||||
DsgPrs::ComputeSymbol(aPresentation,
|
||||
LA,
|
||||
Center,
|
||||
EndOfArrow,
|
||||
ArrowDir.Reversed(),
|
||||
ArrowDir,
|
||||
ArrowPrs,
|
||||
drawFromCenter);
|
||||
}
|
||||
|
@@ -28,15 +28,12 @@ class TCollection_ExtendedString;
|
||||
class gp_Pnt;
|
||||
class gp_Circ;
|
||||
|
||||
|
||||
//! A framework to define display of radii.
|
||||
class DsgPrs_RadiusPresentation
|
||||
class DsgPrs_RadiusPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Adds the point AttachmentPoint, the circle aCircle,
|
||||
//! the text aText, and the parameters firstparam and
|
||||
//! lastparam to the presentation object aPresentation.
|
||||
@@ -46,8 +43,16 @@ public:
|
||||
//! arrowhead will point towards the center of aCircle.
|
||||
//! If the Boolean reverseArrow is true, the arrowhead
|
||||
//! will point away from the attachment point.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint, const gp_Circ& aCircle, const Standard_Real firstparam, const Standard_Real lastparam, const Standard_Boolean drawFromCenter = Standard_True, const Standard_Boolean reverseArrow = Standard_False);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const Standard_Real firstparam,
|
||||
const Standard_Real lastparam,
|
||||
const Standard_Boolean drawFromCenter = Standard_True,
|
||||
const Standard_Boolean reverseArrow = Standard_False);
|
||||
|
||||
//! Adds the point AttachmentPoint, the circle aCircle,
|
||||
//! the text aText, and the parameters firstparam and
|
||||
//! lastparam to the presentation object aPresentation.
|
||||
@@ -60,8 +65,17 @@ public:
|
||||
//! arrowhead will point towards the center of aCircle.
|
||||
//! If the Boolean reverseArrow is true, the arrowhead
|
||||
//! will point away from the attachment point.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint, const gp_Circ& aCircle, const Standard_Real firstparam, const Standard_Real lastparam, const DsgPrs_ArrowSide ArrowSide, const Standard_Boolean drawFromCenter = Standard_True, const Standard_Boolean reverseArrow = Standard_False);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Circ& aCircle,
|
||||
const Standard_Real firstparam,
|
||||
const Standard_Real lastparam,
|
||||
const DsgPrs_ArrowSide ArrowSide,
|
||||
const Standard_Boolean drawFromCenter = Standard_True,
|
||||
const Standard_Boolean reverseArrow = Standard_False);
|
||||
|
||||
//! Adds the circle aCircle, the text aText, the points
|
||||
//! AttachmentPoint, Center and EndOfArrow to the
|
||||
//! presentation object aPresentation.
|
||||
@@ -74,29 +88,18 @@ public:
|
||||
//! arrowhead will point towards the center of aCircle.
|
||||
//! If the Boolean reverseArrow is true, the arrowhead
|
||||
//! will point away from the attachment point.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& AttachmentPoint, const gp_Pnt& Center, const gp_Pnt& EndOfArrow, const DsgPrs_ArrowSide ArrowSide, const Standard_Boolean drawFromCenter = Standard_True, const Standard_Boolean reverseArrow = Standard_False);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& AttachmentPoint,
|
||||
const gp_Pnt& Center,
|
||||
const gp_Pnt& EndOfArrow,
|
||||
const DsgPrs_ArrowSide ArrowSide,
|
||||
const Standard_Boolean drawFromCenter = Standard_True,
|
||||
const Standard_Boolean reverseArrow = Standard_False);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_RadiusPresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs_ShadedPlanePresentation.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_ArrayOfPolygons.hxx>
|
||||
@@ -23,15 +22,13 @@
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void DsgPrs_ShadedPlanePresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPt1,
|
||||
const gp_Pnt& aPt2,
|
||||
const gp_Pnt& aPt3)
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPt1,
|
||||
const gp_Pnt& aPt2,
|
||||
const gp_Pnt& aPt3)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = aPresentation->CurrentGroup();
|
||||
aGroup->SetPrimitivesAspect(aDrawer->PlaneAspect()->EdgesAspect()->Aspect());
|
||||
|
@@ -26,40 +26,23 @@
|
||||
class gp_Pnt;
|
||||
|
||||
//! A framework to define display of shaded planes.
|
||||
class DsgPrs_ShadedPlanePresentation
|
||||
class DsgPrs_ShadedPlanePresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Adds the points aPt1, aPt2 and aPt3 to the
|
||||
//! presentation object, aPresentation.
|
||||
//! The display attributes of the shaded plane are
|
||||
//! defined by the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& aPt1, const gp_Pnt& aPt2, const gp_Pnt& aPt3);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPt1,
|
||||
const gp_Pnt& aPt2,
|
||||
const gp_Pnt& aPt3);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_ShadedPlanePresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
@@ -42,72 +41,82 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : FindPointOnFace
|
||||
//purpose : internal use
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
static Standard_Boolean FindPointOnFace(const TopoDS_Face& face, gp_Pnt2d& pt2d)
|
||||
{
|
||||
// discredisation of the external contour and computing the center of gravity
|
||||
|
||||
TopExp_Explorer wireExp;
|
||||
wireExp.Init(face, TopAbs_WIRE);
|
||||
if (!wireExp.More()) {
|
||||
if (!wireExp.More())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Integer npoints, nptt = 21;
|
||||
Standard_Integer npoints, nptt = 21;
|
||||
TColgp_Array1OfPnt2d points(1, nptt);
|
||||
Standard_Real area=0., xcent=0., ycent=0.;
|
||||
TopExp_Explorer edgeExp;
|
||||
Standard_Real area = 0., xcent = 0., ycent = 0.;
|
||||
TopExp_Explorer edgeExp;
|
||||
|
||||
for (edgeExp.Init(wireExp.Current(), TopAbs_EDGE); edgeExp.More(); edgeExp.Next()) {
|
||||
for (edgeExp.Init(wireExp.Current(), TopAbs_EDGE); edgeExp.More(); edgeExp.Next())
|
||||
{
|
||||
// discretize the 2d curve
|
||||
Standard_Real first, last;
|
||||
Handle(Geom2d_Curve) c2d = BRep_Tool::CurveOnSurface(TopoDS::Edge(edgeExp.Current()), face, first, last);
|
||||
if (TopoDS::Edge(edgeExp.Current()).Orientation() == TopAbs_REVERSED) {
|
||||
Standard_Real first, last;
|
||||
Handle(Geom2d_Curve) c2d =
|
||||
BRep_Tool::CurveOnSurface(TopoDS::Edge(edgeExp.Current()), face, first, last);
|
||||
if (TopoDS::Edge(edgeExp.Current()).Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
Standard_Real change = first;
|
||||
first = last;
|
||||
last = change;
|
||||
first = last;
|
||||
last = change;
|
||||
}
|
||||
if (c2d->DynamicType() == STANDARD_TYPE(Geom2d_Line)) {
|
||||
if (c2d->DynamicType() == STANDARD_TYPE(Geom2d_Line))
|
||||
{
|
||||
npoints = 2;
|
||||
c2d->D0(first, points(1));
|
||||
c2d->D0(last, points(2));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Standard_Real deltaT, t;
|
||||
npoints = nptt;
|
||||
deltaT = (last - first) / (nptt-1);
|
||||
for (Standard_Integer i=1; i<=nptt; i++) {
|
||||
if (i == 1) {
|
||||
t = first;
|
||||
}
|
||||
else if (i == nptt) {
|
||||
t = last;
|
||||
}
|
||||
else {
|
||||
t = first + (i-1) * deltaT;
|
||||
}
|
||||
c2d->D0(t, points(i));
|
||||
}
|
||||
deltaT = (last - first) / (nptt - 1);
|
||||
for (Standard_Integer i = 1; i <= nptt; i++)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
t = first;
|
||||
}
|
||||
else if (i == nptt)
|
||||
{
|
||||
t = last;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = first + (i - 1) * deltaT;
|
||||
}
|
||||
c2d->D0(t, points(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// compute the contribution to the center of gravity
|
||||
|
||||
Standard_Real h, c, d;
|
||||
for (Standard_Integer i=1; i<=npoints-1; i++) {
|
||||
for (Standard_Integer i = 1; i <= npoints - 1; i++)
|
||||
{
|
||||
|
||||
h = 0.5*(points(i).Y() + points(i+1).Y());
|
||||
c = points(i+1).X() - points(i).X();
|
||||
d = points(i+1).X() + points(i).X();
|
||||
area += h*c;
|
||||
xcent += 0.5*h*c*d;
|
||||
ycent += 0.5*h*h*c;
|
||||
h = 0.5 * (points(i).Y() + points(i + 1).Y());
|
||||
c = points(i + 1).X() - points(i).X();
|
||||
d = points(i + 1).X() + points(i).X();
|
||||
area += h * c;
|
||||
xcent += 0.5 * h * c * d;
|
||||
ycent += 0.5 * h * h * c;
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(area) < gp::Resolution()) {
|
||||
if (Abs(area) < gp::Resolution())
|
||||
{
|
||||
pt2d.SetCoord(points(1).X(), points(1).Y());
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -118,134 +127,145 @@ static Standard_Boolean FindPointOnFace(const TopoDS_Face& face, gp_Pnt2d& pt2d)
|
||||
|
||||
BRepClass_FaceClassifier fClass(face, pt2d, gp::Resolution());
|
||||
|
||||
if ((fClass.State() == TopAbs_OUT) || (fClass.State() == TopAbs_UNKNOWN)) {
|
||||
if ((fClass.State() == TopAbs_OUT) || (fClass.State() == TopAbs_UNKNOWN))
|
||||
{
|
||||
// try to find a point on face
|
||||
pt2d=points(1);
|
||||
pt2d = points(1);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeDir
|
||||
//purpose : internal use
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean ComputeDir(const TopoDS_Shape& shape, gp_Pnt& pt, gp_Dir& dir, const Standard_Integer mode)
|
||||
static Standard_Boolean ComputeDir(const TopoDS_Shape& shape,
|
||||
gp_Pnt& pt,
|
||||
gp_Dir& dir,
|
||||
const Standard_Integer mode)
|
||||
{
|
||||
TopLoc_Location loc;
|
||||
if (shape.ShapeType() == TopAbs_EDGE) {
|
||||
Standard_Real first, last;
|
||||
if (shape.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
Standard_Real first, last;
|
||||
Handle(Geom_Curve) curv0 = BRep_Tool::Curve(TopoDS::Edge(shape), loc, first, last);
|
||||
Handle(Geom_Curve) curve = Handle(Geom_Curve)::DownCast(curv0->Copy());
|
||||
curve->Transform(loc.Transformation());
|
||||
curve->Transform(loc.Transformation());
|
||||
GeomLProp_CLProps lProps(curve, 1, gp::Resolution());
|
||||
lProps.SetParameter((mode == 0)? last : first);
|
||||
lProps.SetParameter((mode == 0) ? last : first);
|
||||
if (!lProps.IsTangentDefined())
|
||||
return Standard_False;
|
||||
pt = lProps.Value();
|
||||
lProps.Tangent(dir);
|
||||
}
|
||||
else if (shape.ShapeType() == TopAbs_FACE) {
|
||||
gp_Pnt2d pt2d;
|
||||
Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(shape));
|
||||
if (BRep_Tool::NaturalRestriction(TopoDS::Face(shape))) {
|
||||
else if (shape.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
gp_Pnt2d pt2d;
|
||||
Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(shape));
|
||||
if (BRep_Tool::NaturalRestriction(TopoDS::Face(shape)))
|
||||
{
|
||||
Standard_Real u1, u2, v1, v2;
|
||||
surface->Bounds(u1, u2, v1, v2);
|
||||
pt2d.SetCoord((u1+u2)*0.5, (v1+v2)*0.5);
|
||||
pt2d.SetCoord((u1 + u2) * 0.5, (v1 + v2) * 0.5);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (!FindPointOnFace(TopoDS::Face(shape), pt2d))
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
GeomLProp_SLProps lProps(surface, pt2d.X(), pt2d.Y(), 1, gp::Resolution());
|
||||
if (!lProps.IsNormalDefined())
|
||||
return Standard_False;
|
||||
|
||||
pt = lProps.Value();
|
||||
pt = lProps.Value();
|
||||
dir = lProps.Normal();
|
||||
}
|
||||
if (((shape.Orientation() == TopAbs_FORWARD) && (mode == 1)) ||
|
||||
((shape.Orientation() == TopAbs_REVERSED) && (mode == 0))) {
|
||||
if (((shape.Orientation() == TopAbs_FORWARD) && (mode == 1))
|
||||
|| ((shape.Orientation() == TopAbs_REVERSED) && (mode == 0)))
|
||||
{
|
||||
dir.Reverse();
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void DsgPrs_ShapeDirPresentation::Add(const Handle(Prs3d_Presentation)& prs,
|
||||
const Handle(Prs3d_Drawer)& drawer,
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Integer mode)
|
||||
|
||||
const Handle(Prs3d_Drawer)& drawer,
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Integer mode)
|
||||
|
||||
{
|
||||
if ((mode != 0) && (mode != 1))
|
||||
return;
|
||||
|
||||
gp_Dir dir;
|
||||
gp_Pnt pt;
|
||||
|
||||
gp_Dir dir;
|
||||
gp_Pnt pt;
|
||||
Bnd_Box box;
|
||||
|
||||
if (shape.ShapeType() == TopAbs_EDGE) {
|
||||
if (shape.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
ComputeDir(shape, pt, dir, mode);
|
||||
BRepBndLib::Add(shape, box);
|
||||
}
|
||||
else if (shape.ShapeType() == TopAbs_FACE) {
|
||||
else if (shape.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
ComputeDir(shape, pt, dir, mode);
|
||||
BRepBndLib::Add(shape, box);
|
||||
}
|
||||
else if (shape.ShapeType() == TopAbs_WIRE) {
|
||||
TopTools_ListOfShape aList;
|
||||
Standard_Integer nb = 0;
|
||||
}
|
||||
else if (shape.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
TopTools_ListOfShape aList;
|
||||
Standard_Integer nb = 0;
|
||||
BRepTools_WireExplorer anExp;
|
||||
for (anExp.Init(TopoDS::Wire(shape)); anExp.More(); anExp.Next()) {
|
||||
for (anExp.Init(TopoDS::Wire(shape)); anExp.More(); anExp.Next())
|
||||
{
|
||||
const TopoDS_Edge& edge = anExp.Current();
|
||||
nb++;
|
||||
if (nb <=3)
|
||||
if (nb <= 3)
|
||||
BRepBndLib::Add(edge, box);
|
||||
aList.Append(edge);
|
||||
}
|
||||
|
||||
if (mode == 0) {
|
||||
if (mode == 0)
|
||||
{
|
||||
const TopoDS_Edge& edge = TopoDS::Edge(aList.Last());
|
||||
ComputeDir(edge, pt, dir, mode);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
const TopoDS_Edge& edge = TopoDS::Edge(aList.First());
|
||||
ComputeDir(edge, pt, dir, mode);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
TopExp_Explorer faceExp;
|
||||
|
||||
|
||||
TopTools_ListOfShape aList;
|
||||
Standard_Integer nb = 0;
|
||||
for (faceExp.Init(shape, TopAbs_FACE); faceExp.More(); faceExp.Next()) {
|
||||
Standard_Integer nb = 0;
|
||||
for (faceExp.Init(shape, TopAbs_FACE); faceExp.More(); faceExp.Next())
|
||||
{
|
||||
nb++;
|
||||
const TopoDS_Face& face = TopoDS::Face(faceExp.Current());
|
||||
aList.Append(face);
|
||||
BRepBndLib::Add(face, box);
|
||||
if (nb > 3) break;
|
||||
if (nb > 3)
|
||||
break;
|
||||
}
|
||||
const TopoDS_Face& face = TopoDS::Face(aList.Last());
|
||||
ComputeDir(face, pt, dir, mode);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real c[6];
|
||||
box.Get(c[0],c[1],c[2],c[3],c[4],c[5]);
|
||||
|
||||
gp_Pnt ptmin(c[0], c[1], c[2]), ptmax(c[3], c[4], c[5]);
|
||||
Standard_Real leng = ptmin.Distance(ptmax)/3.;
|
||||
// mei 19/09/96 extrusion infinie -> taille fixe
|
||||
if (leng >= 20000.) leng = 50;
|
||||
box.Get(c[0], c[1], c[2], c[3], c[4], c[5]);
|
||||
|
||||
gp_Pnt pt2(pt.XYZ()+leng*dir.XYZ());
|
||||
gp_Pnt ptmin(c[0], c[1], c[2]), ptmax(c[3], c[4], c[5]);
|
||||
Standard_Real leng = ptmin.Distance(ptmax) / 3.;
|
||||
// mei 19/09/96 extrusion infinie -> taille fixe
|
||||
if (leng >= 20000.)
|
||||
leng = 50;
|
||||
|
||||
gp_Pnt pt2(pt.XYZ() + leng * dir.XYZ());
|
||||
|
||||
prs->CurrentGroup()->SetPrimitivesAspect(drawer->LineAspect()->Aspect());
|
||||
|
||||
@@ -254,5 +274,5 @@ void DsgPrs_ShapeDirPresentation::Add(const Handle(Prs3d_Presentation)& prs,
|
||||
aPrims->AddVertex(pt2);
|
||||
prs->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
Prs3d_Arrow::Draw (prs->CurrentGroup(), pt2, dir, M_PI/180.*10., leng*0.3);
|
||||
Prs3d_Arrow::Draw(prs->CurrentGroup(), pt2, dir, M_PI / 180. * 10., leng * 0.3);
|
||||
}
|
||||
|
@@ -28,13 +28,11 @@ class TopoDS_Shape;
|
||||
|
||||
//! A framework to define display of the normal to the
|
||||
//! surface of a shape.
|
||||
class DsgPrs_ShapeDirPresentation
|
||||
class DsgPrs_ShapeDirPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Adds the shape shape and the mode mode to the
|
||||
//! presentation object prs.
|
||||
//! The display attributes of the normal are defined by the
|
||||
@@ -42,29 +40,13 @@ public:
|
||||
//! mode determines whether the first or the last point of
|
||||
//! the normal is given to the presentation object. If the
|
||||
//! first point: 0; if the last point, 1.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& prs, const Handle(Prs3d_Drawer)& aDrawer, const TopoDS_Shape& shape, const Standard_Integer mode);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& prs,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Integer mode);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_ShapeDirPresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs_SymbPresentation.hxx>
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
@@ -26,21 +25,19 @@
|
||||
#include <StdPrs_Point.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
void DsgPrs_SymbPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
void DsgPrs_SymbPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& OffsetPoint)
|
||||
{
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
Handle(Prs3d_TextAspect) TA = LA->TextAspect();
|
||||
Handle(Prs3d_TextAspect) TA = LA->TextAspect();
|
||||
TA->SetColor(Quantity_NOC_GREEN);
|
||||
Prs3d_Text::Draw (aPresentation->CurrentGroup(), TA, aText, OffsetPoint);
|
||||
|
||||
Prs3d_Text::Draw(aPresentation->CurrentGroup(), TA, aText, OffsetPoint);
|
||||
|
||||
// 2eme groupe : marker
|
||||
Handle(Geom_CartesianPoint) theP = new Geom_CartesianPoint(OffsetPoint);
|
||||
Handle(Prs3d_PointAspect) PA = aDrawer->PointAspect();
|
||||
Handle(Prs3d_PointAspect) PA = aDrawer->PointAspect();
|
||||
PA->SetTypeOfMarker(Aspect_TOM_RING2);
|
||||
StdPrs_Point::Add(aPresentation,theP,aDrawer);
|
||||
StdPrs_Point::Add(aPresentation, theP, aDrawer);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -27,40 +27,22 @@ class TCollection_ExtendedString;
|
||||
class gp_Pnt;
|
||||
|
||||
//! A framework to define display of symbols.
|
||||
class DsgPrs_SymbPresentation
|
||||
class DsgPrs_SymbPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Adds the text aText and the point OffsetPoint to the
|
||||
//! presentation object aPresentation.
|
||||
//! The display attributes of the shaded plane are
|
||||
//! defined by the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const TCollection_ExtendedString& aText, const gp_Pnt& OffsetPoint);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_SymbPresentation_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -29,21 +29,25 @@ class gp_Lin;
|
||||
class gp_Circ;
|
||||
|
||||
//! A framework to define display of symmetry between shapes.
|
||||
class DsgPrs_SymmetricPresentation
|
||||
class DsgPrs_SymmetricPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Adds the points OffsetPoint, AttachmentPoint1,
|
||||
//! AttachmentPoint2, the direction aDirection1 and the
|
||||
//! axis anAxis to the presentation object aPresentation.
|
||||
//! The display attributes of the symmetry are defined by
|
||||
//! the attribute manager aDrawer.
|
||||
//! This syntax is used for display of symmetries between two segments.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Dir& aDirection1, const gp_Lin& aAxis, const gp_Pnt& OffsetPoint);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Dir& aDirection1,
|
||||
const gp_Lin& aAxis,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
//! Adds the points OffsetPoint, AttachmentPoint1,
|
||||
//! AttachmentPoint2, the direction aDirection1 the circle
|
||||
//! aCircle1 and the axis anAxis to the presentation
|
||||
@@ -51,37 +55,29 @@ public:
|
||||
//! The display attributes of the symmetry are defined by
|
||||
//! the attribute manager aDrawer.
|
||||
//! This syntax is used for display of symmetries between two arcs.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Circ& aCircle1, const gp_Lin& aAxis, const gp_Pnt& OffsetPoint);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Circ& aCircle1,
|
||||
const gp_Lin& aAxis,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
//! Adds the points OffsetPoint, AttachmentPoint1,
|
||||
//! AttachmentPoint2 and the axis anAxis to the
|
||||
//! presentation object aPresentation.
|
||||
//! The display attributes of the symmetry are defined by
|
||||
//! the attribute manager aDrawer.
|
||||
//! This syntax is used for display of symmetries between two vertices.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& AttachmentPoint1, const gp_Pnt& AttachmentPoint2, const gp_Lin& aAxis, const gp_Pnt& OffsetPoint);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& AttachmentPoint1,
|
||||
const gp_Pnt& AttachmentPoint2,
|
||||
const gp_Lin& aAxis,
|
||||
const gp_Pnt& OffsetPoint);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_SymmetricPresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs_TangentPresentation.hxx>
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
@@ -27,25 +26,25 @@
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <StdPrs_Point.hxx>
|
||||
|
||||
void DsgPrs_TangentPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const gp_Dir& aDirection,
|
||||
const Standard_Real length)
|
||||
void DsgPrs_TangentPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const gp_Dir& aDirection,
|
||||
const Standard_Real length)
|
||||
{
|
||||
gp_Vec vec(aDirection);
|
||||
gp_Vec vec1 = vec.Multiplied(length);
|
||||
gp_Vec vec2 = vec.Multiplied(-length);
|
||||
gp_Pnt p1 = OffsetPoint.Translated(vec1);
|
||||
gp_Pnt p2 = OffsetPoint.Translated(vec2);
|
||||
|
||||
gp_Pnt p1 = OffsetPoint.Translated(vec1);
|
||||
gp_Pnt p2 = OffsetPoint.Translated(vec2);
|
||||
|
||||
// Aspect
|
||||
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
|
||||
LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID);
|
||||
Handle(Prs3d_ArrowAspect) ARR1 = LA->ArrowAspect();
|
||||
Handle(Prs3d_ArrowAspect) ARR2 = LA->ArrowAspect();
|
||||
ARR1->SetLength(length/5);
|
||||
ARR2->SetLength(length/5);
|
||||
ARR1->SetLength(length / 5);
|
||||
ARR2->SetLength(length / 5);
|
||||
|
||||
// Array1OfVertex
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
@@ -55,13 +54,21 @@ void DsgPrs_TangentPresentation::Add (const Handle(Prs3d_Presentation)& aPresent
|
||||
aPrims->AddVertex(p2);
|
||||
aPresentation->CurrentGroup()->AddPrimitiveArray(aPrims);
|
||||
|
||||
// fleche 1 :
|
||||
// fleche 1 :
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), p1, aDirection, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
p1,
|
||||
aDirection,
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
|
||||
// fleche 2
|
||||
aPresentation->NewGroup();
|
||||
aPresentation->CurrentGroup()->SetPrimitivesAspect(LA->LineAspect()->Aspect());
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), p2, aDirection.Reversed(), LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
p2,
|
||||
aDirection.Reversed(),
|
||||
LA->ArrowAspect()->Angle(),
|
||||
LA->ArrowAspect()->Length());
|
||||
}
|
||||
|
@@ -27,40 +27,23 @@ class gp_Pnt;
|
||||
class gp_Dir;
|
||||
|
||||
//! A framework to define display of tangents.
|
||||
class DsgPrs_TangentPresentation
|
||||
class DsgPrs_TangentPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Adds the point OffsetPoint, the direction aDirection
|
||||
//! and the length aLength to the presentation object aPresentation.
|
||||
//! The display attributes of the tangent are defined by
|
||||
//! the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& OffsetPoint, const gp_Dir& aDirection, const Standard_Real aLength);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& OffsetPoint,
|
||||
const gp_Dir& aDirection,
|
||||
const Standard_Real aLength);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_TangentPresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs_XYZAxisPresentation.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
@@ -26,18 +25,15 @@
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DsgPrs_XYZAxisPresentation::Add(
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_LineAspect)& aLineAspect,
|
||||
const gp_Dir & aDir,
|
||||
const Standard_Real aVal,
|
||||
const Standard_CString theText,
|
||||
const gp_Pnt& aPfirst,
|
||||
const gp_Pnt& aPlast)
|
||||
//=================================================================================================
|
||||
|
||||
void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_LineAspect)& aLineAspect,
|
||||
const gp_Dir& aDir,
|
||||
const Standard_Real aVal,
|
||||
const Standard_CString theText,
|
||||
const gp_Pnt& aPfirst,
|
||||
const gp_Pnt& aPlast)
|
||||
{
|
||||
Handle(Graphic3d_Group) G = aPresentation->CurrentGroup();
|
||||
G->SetPrimitivesAspect(aLineAspect->Aspect());
|
||||
@@ -46,28 +42,27 @@ void DsgPrs_XYZAxisPresentation::Add(
|
||||
aPrims->AddVertex(aPfirst);
|
||||
aPrims->AddVertex(aPlast);
|
||||
G->AddPrimitiveArray(aPrims);
|
||||
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), aPlast,aDir, M_PI/180.*10., aVal/10.);
|
||||
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(), aPlast, aDir, M_PI / 180. * 10., aVal / 10.);
|
||||
|
||||
if (*theText != '\0')
|
||||
{
|
||||
Handle(Graphic3d_Text) aText = new Graphic3d_Text (1.0f/81.0f);
|
||||
aText->SetText (theText);
|
||||
aText->SetPosition (aPlast);
|
||||
aPresentation->CurrentGroup()->AddText (aText);
|
||||
Handle(Graphic3d_Text) aText = new Graphic3d_Text(1.0f / 81.0f);
|
||||
aText->SetText(theText);
|
||||
aText->SetPosition(aPlast);
|
||||
aPresentation->CurrentGroup()->AddText(aText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_LineAspect)& aLineAspect,
|
||||
const Handle(Prs3d_ArrowAspect)& anArrowAspect,
|
||||
const Handle(Prs3d_TextAspect)& aTextAspect,
|
||||
const gp_Dir & aDir,
|
||||
const Standard_Real aVal,
|
||||
const Standard_CString theText,
|
||||
const gp_Pnt& aPfirst,
|
||||
const gp_Pnt& aPlast)
|
||||
const Handle(Prs3d_LineAspect)& aLineAspect,
|
||||
const Handle(Prs3d_ArrowAspect)& anArrowAspect,
|
||||
const Handle(Prs3d_TextAspect)& aTextAspect,
|
||||
const gp_Dir& aDir,
|
||||
const Standard_Real aVal,
|
||||
const Standard_CString theText,
|
||||
const gp_Pnt& aPfirst,
|
||||
const gp_Pnt& aPlast)
|
||||
{
|
||||
Handle(Graphic3d_Group) G = aPresentation->CurrentGroup();
|
||||
G->SetPrimitivesAspect(aLineAspect->Aspect());
|
||||
@@ -77,16 +72,20 @@ void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
aPrims->AddVertex(aPlast);
|
||||
G->AddPrimitiveArray(aPrims);
|
||||
|
||||
G->SetPrimitivesAspect( anArrowAspect->Aspect() );
|
||||
Prs3d_Arrow::Draw (aPresentation->CurrentGroup(), aPlast, aDir, anArrowAspect->Angle(), aVal/10.);
|
||||
G->SetPrimitivesAspect(anArrowAspect->Aspect());
|
||||
Prs3d_Arrow::Draw(aPresentation->CurrentGroup(),
|
||||
aPlast,
|
||||
aDir,
|
||||
anArrowAspect->Angle(),
|
||||
aVal / 10.);
|
||||
|
||||
G->SetPrimitivesAspect(aTextAspect->Aspect());
|
||||
|
||||
if (*theText != '\0')
|
||||
{
|
||||
Handle(Graphic3d_Text) aText = new Graphic3d_Text (1.0f/81.0f);
|
||||
aText->SetText (theText);
|
||||
aText->SetPosition (aPlast);
|
||||
Handle(Graphic3d_Text) aText = new Graphic3d_Text(1.0f / 81.0f);
|
||||
aText->SetText(theText);
|
||||
aText->SetPosition(aPlast);
|
||||
aPresentation->CurrentGroup()->AddText(aText);
|
||||
}
|
||||
}
|
||||
|
@@ -30,13 +30,11 @@ class Prs3d_ArrowAspect;
|
||||
class Prs3d_TextAspect;
|
||||
|
||||
//! A framework for displaying the axes of an XYZ trihedron.
|
||||
class DsgPrs_XYZAxisPresentation
|
||||
class DsgPrs_XYZAxisPresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Draws each axis of a trihedron displayed in the
|
||||
//! presentation aPresentation and with lines shown by
|
||||
//! the values of aLineAspect. Each axis is defined by:
|
||||
@@ -46,32 +44,27 @@ public:
|
||||
//! The value for length is provided so that the trihedron
|
||||
//! can vary in length relative to the scale of shape display.
|
||||
//! Each axis will be identified as X, Y, or Z by the text aText.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_LineAspect)& anLineAspect, const gp_Dir& aDir, const Standard_Real aVal, const Standard_CString aText, const gp_Pnt& aPfirst, const gp_Pnt& aPlast);
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_LineAspect)& anLineAspect,
|
||||
const gp_Dir& aDir,
|
||||
const Standard_Real aVal,
|
||||
const Standard_CString aText,
|
||||
const gp_Pnt& aPfirst,
|
||||
const gp_Pnt& aPlast);
|
||||
|
||||
//! draws the presentation X ,Y ,Z axis
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_LineAspect)& aLineAspect, const Handle(Prs3d_ArrowAspect)& anArrowAspect, const Handle(Prs3d_TextAspect)& aTextAspect, const gp_Dir& aDir, const Standard_Real aVal, const Standard_CString aText, const gp_Pnt& aPfirst, const gp_Pnt& aPlast);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_LineAspect)& aLineAspect,
|
||||
const Handle(Prs3d_ArrowAspect)& anArrowAspect,
|
||||
const Handle(Prs3d_TextAspect)& aTextAspect,
|
||||
const gp_Dir& aDir,
|
||||
const Standard_Real aVal,
|
||||
const Standard_CString aText,
|
||||
const gp_Pnt& aPfirst,
|
||||
const gp_Pnt& aPlast);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_XYZAxisPresentation_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DsgPrs_XYZPlanePresentation.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
@@ -22,16 +21,13 @@
|
||||
#include <Prs3d_PlaneAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DsgPrs_XYZPlanePresentation::Add(
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPt1,
|
||||
const gp_Pnt& aPt2,
|
||||
const gp_Pnt& aPt3)
|
||||
//=================================================================================================
|
||||
|
||||
void DsgPrs_XYZPlanePresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPt1,
|
||||
const gp_Pnt& aPt2,
|
||||
const gp_Pnt& aPt3)
|
||||
{
|
||||
Handle(Graphic3d_Group) TheGroup = aPresentation->CurrentGroup();
|
||||
TheGroup->SetPrimitivesAspect(aDrawer->PlaneAspect()->EdgesAspect()->Aspect());
|
||||
|
@@ -26,40 +26,23 @@
|
||||
class gp_Pnt;
|
||||
|
||||
//! A framework for displaying the planes of an XYZ trihedron.
|
||||
class DsgPrs_XYZPlanePresentation
|
||||
class DsgPrs_XYZPlanePresentation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Draws each plane of a trihedron displayed in the
|
||||
//! presentation aPresentation and with attributes
|
||||
//! defined by the attribute manager aDrawer. Each
|
||||
//! triangular plane is defined by the points aPt1 aPt2 and aPt3.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const gp_Pnt& aPt1, const gp_Pnt& aPt2, const gp_Pnt& aPt3);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const gp_Pnt& aPt1,
|
||||
const gp_Pnt& aPt2,
|
||||
const gp_Pnt& aPt3);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _DsgPrs_XYZPlanePresentation_HeaderFile
|
||||
|
Reference in New Issue
Block a user