mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0027958: Visualization, AIS_Trihedron - add shaded presentation option
A new Shaded presentation flag configured through Datum aspect (NOT as usual Display Mode). Creation of auxiliary Axis/Point/Plane presentations in Trihedron presentation is removed. 'vtrihedron' DRAW command to change parameters of trihedron is extended to cover whole functionality of AIS_Trihedron. The following classes are redesignede: AIS_Trihedron, Prs3d_DatumAspect. The followin enumermations are created to manage properties of trihedron: Prs3d_DatumAttribute, Prs3d/Prs3d_DatumAxes, Prs3d_DatumMode
This commit is contained in:
@@ -8,6 +8,10 @@ Prs3d_BasicAspect.cxx
|
||||
Prs3d_BasicAspect.hxx
|
||||
Prs3d_DatumAspect.cxx
|
||||
Prs3d_DatumAspect.hxx
|
||||
Prs3d_DatumAttribute.hxx
|
||||
Prs3d_DatumAxes.hxx
|
||||
Prs3d_DatumMode.hxx
|
||||
Prs3d_DatumParts.hxx
|
||||
Prs3d_DimensionArrowOrientation.hxx
|
||||
Prs3d_DimensionAspect.cxx
|
||||
Prs3d_DimensionAspect.hxx
|
||||
|
@@ -31,64 +31,85 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Arrow::Draw(const Handle(Graphic3d_Group)& theGroup,
|
||||
const gp_Pnt& aLocation,
|
||||
const gp_Dir& aDirection,
|
||||
const Quantity_PlaneAngle anAngle,
|
||||
const Quantity_Length aLength)
|
||||
const gp_Pnt& theLocation,
|
||||
const gp_Dir& theDirection,
|
||||
const Quantity_PlaneAngle theAngle,
|
||||
const Quantity_Length theLength)
|
||||
{
|
||||
Quantity_Length dx,dy,dz; aDirection.Coord(dx,dy,dz);
|
||||
//
|
||||
// Point of the arrow:
|
||||
Quantity_Length xo,yo,zo; aLocation.Coord(xo,yo,zo);
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimitives = Prs3d_Arrow::DrawSegments(theLocation,
|
||||
theDirection, theAngle, theLength, 15);
|
||||
theGroup->AddPrimitiveArray (aPrimitives);
|
||||
}
|
||||
|
||||
// Center of the base circle of the arrow:
|
||||
Quantity_Length xc = xo - dx * aLength;
|
||||
Quantity_Length yc = yo - dy * aLength;
|
||||
Quantity_Length zc = zo - dz * aLength;
|
||||
//=======================================================================
|
||||
//function : DrawSegments
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_ArrayOfSegments) Prs3d_Arrow::DrawSegments (const gp_Pnt& theLocation,
|
||||
const gp_Dir& theDir,
|
||||
const Quantity_PlaneAngle theAngle,
|
||||
const Quantity_Length theLength,
|
||||
const Standard_Integer theNbSegments)
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfSegments) aSegments = new Graphic3d_ArrayOfSegments (theNbSegments + 1, 2 * (2 * theNbSegments));
|
||||
|
||||
// Construction of i,j mark for the circle:
|
||||
Quantity_Length xn=0., yn=0., zn=0.;
|
||||
// center of the base circle of the arrow
|
||||
const gp_XYZ aC = theLocation.XYZ() + theDir.XYZ() * (-theLength);
|
||||
|
||||
if ( Abs(dx) <= Abs(dy) && Abs(dx) <= Abs(dz)) xn=1.;
|
||||
else if ( Abs(dy) <= Abs(dz) && Abs(dy) <= Abs(dx)) yn=1.;
|
||||
else zn=1.;
|
||||
Quantity_Length xi = dy * zn - dz * yn;
|
||||
Quantity_Length yi = dz * xn - dx * zn;
|
||||
Quantity_Length zi = dx * yn - dy * xn;
|
||||
|
||||
Quantity_Length Norme = sqrt ( xi*xi + yi*yi + zi*zi );
|
||||
xi = xi / Norme; yi = yi / Norme; zi = zi/Norme;
|
||||
|
||||
const Quantity_Length xj = dy * zi - dz * yi;
|
||||
const Quantity_Length yj = dz * xi - dx * zi;
|
||||
const Quantity_Length zj = dx * yi - dy * xi;
|
||||
|
||||
const Standard_Integer NbPoints = 15;
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims1 = new Graphic3d_ArrayOfSegments(2*NbPoints);
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims2 = new Graphic3d_ArrayOfPolylines(NbPoints+1);
|
||||
|
||||
gp_Pnt p1;
|
||||
const Standard_Real Tg=tan(anAngle);
|
||||
|
||||
for (Standard_Integer i = 1; i <= NbPoints ; i++)
|
||||
// construction of i,j mark for the circle
|
||||
gp_Dir aN;
|
||||
if (Abs(theDir.X()) <= Abs(theDir.Y())
|
||||
&& Abs(theDir.X()) <= Abs(theDir.Z()))
|
||||
{
|
||||
const Standard_Real cosinus = cos ( 2 * M_PI / NbPoints * (i-1) );
|
||||
const Standard_Real sinus = sin ( 2 * M_PI / NbPoints * (i-1) );
|
||||
|
||||
const gp_Pnt pp(xc + (cosinus * xi + sinus * xj) * aLength * Tg,
|
||||
yc + (cosinus * yi + sinus * yj) * aLength * Tg,
|
||||
zc + (cosinus * zi + sinus * zj) * aLength * Tg);
|
||||
|
||||
aPrims1->AddVertex(aLocation);
|
||||
aPrims1->AddVertex(pp);
|
||||
if(i==1) p1 = pp;
|
||||
aPrims2->AddVertex(pp);
|
||||
aN = gp::DX();
|
||||
}
|
||||
else if (Abs(theDir.Y()) <= Abs(theDir.Z())
|
||||
&& Abs(theDir.Y()) <= Abs(theDir.X()))
|
||||
{
|
||||
aN = gp::DY();
|
||||
}
|
||||
else
|
||||
{
|
||||
aN = gp::DZ();
|
||||
}
|
||||
aPrims2->AddVertex(p1);
|
||||
|
||||
theGroup->AddPrimitiveArray (aPrims1);
|
||||
theGroup->AddPrimitiveArray (aPrims2);
|
||||
const gp_Dir anXYZi = theDir.Crossed (aN.XYZ());
|
||||
const gp_XYZ anXYZj = theDir.XYZ().Crossed (anXYZi.XYZ());
|
||||
aSegments->AddVertex (theLocation);
|
||||
|
||||
const Standard_Real Tg = Tan (theAngle);
|
||||
for (Standard_Integer aVertIter = 1; aVertIter <= theNbSegments; ++aVertIter)
|
||||
{
|
||||
const Standard_Real aCos = Cos (2.0 * M_PI / theNbSegments * (aVertIter - 1));
|
||||
const Standard_Real aSin = Sin (2.0 * M_PI / theNbSegments * (aVertIter - 1));
|
||||
|
||||
const gp_Pnt pp(aC.X() + (aCos * anXYZi.X() + aSin * anXYZj.X()) * theLength * Tg,
|
||||
aC.Y() + (aCos * anXYZi.Y() + aSin * anXYZj.Y()) * theLength * Tg,
|
||||
aC.Z() + (aCos * anXYZi.Z() + aSin * anXYZj.Z()) * theLength * Tg);
|
||||
|
||||
aSegments->AddVertex (pp);
|
||||
}
|
||||
|
||||
Standard_Integer aNbVertices = theNbSegments + 1;
|
||||
Standard_Integer aFirstContourVertex = 2;
|
||||
Standard_Integer anEdgeCount = 0;
|
||||
for (Standard_Integer aVertIter = aFirstContourVertex; aVertIter <= aNbVertices; ++aVertIter)
|
||||
{
|
||||
aSegments->AddEdge (1);
|
||||
aSegments->AddEdge (aVertIter);
|
||||
++anEdgeCount;
|
||||
}
|
||||
aSegments->AddEdge (aNbVertices);
|
||||
aSegments->AddEdge (aFirstContourVertex);
|
||||
++anEdgeCount;
|
||||
|
||||
for (Standard_Integer aVertIter = aFirstContourVertex; aVertIter <= aNbVertices - 1; ++aVertIter)
|
||||
{
|
||||
aSegments->AddEdge (aVertIter);
|
||||
aSegments->AddEdge (aVertIter + 1);
|
||||
++anEdgeCount;
|
||||
}
|
||||
return aSegments;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Prs3d_Root.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Quantity_PlaneAngle.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
|
||||
@@ -46,6 +47,18 @@ public:
|
||||
const Standard_Real theConeLength,
|
||||
const Standard_Integer theNbFacettes);
|
||||
|
||||
//! Defines the representation of the arrow as a container of segments.
|
||||
//! @param theLocation location of the arrow tip
|
||||
//! @param theDir direction of the arrow
|
||||
//! @param theAngle angle of opening of the arrow head
|
||||
//! @param theLength length of the arrow (from the tip)
|
||||
//! @param theNbSegments count of points on polyline where location is connected
|
||||
Standard_EXPORT static Handle(Graphic3d_ArrayOfSegments) DrawSegments (const gp_Pnt& theLocation,
|
||||
const gp_Dir& theDir,
|
||||
const Quantity_PlaneAngle theAngle,
|
||||
const Quantity_Length theLength,
|
||||
const Standard_Integer theNbSegments);
|
||||
|
||||
//! Defines the representation of the arrow.
|
||||
//! Note that this method does NOT assign any presentation aspects to the primitives group!
|
||||
//! @param theGroup presentation group to add primitives
|
||||
|
@@ -21,14 +21,148 @@ IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Prs3d_DatumAspect::Prs3d_DatumAspect()
|
||||
: myDrawFirstAndSecondAxis (Standard_True),
|
||||
myDrawThirdAxis (Standard_True),
|
||||
myToDrawLabels (Standard_True),
|
||||
myFirstAxisLength (10.0),
|
||||
mySecondAxisLength (10.0),
|
||||
myThirdAxisLength (10.0)
|
||||
: myAxes (Prs3d_DA_XYZAxis),
|
||||
myToDrawLabels (Standard_True)
|
||||
{
|
||||
myFirstAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
|
||||
mySecondAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
|
||||
myThirdAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
|
||||
Standard_Real aDefaultLength = 100.0; // default axis lenght, the same as in context
|
||||
Quantity_Color aDefaultColor(Quantity_NOC_LIGHTSTEELBLUE4); // default axis color
|
||||
|
||||
myAttributes.Bind (Prs3d_DA_XAxisLength, aDefaultLength);
|
||||
myAttributes.Bind (Prs3d_DA_YAxisLength, aDefaultLength);
|
||||
myAttributes.Bind (Prs3d_DA_ZAxisLength, aDefaultLength);
|
||||
myAttributes.Bind (Prs3d_DP_ShadingTubeRadiusPercent, 0.02);
|
||||
myAttributes.Bind (Prs3d_DP_ShadingConeRadiusPercent, 0.04);
|
||||
myAttributes.Bind (Prs3d_DP_ShadingConeLengthPercent, 0.1);
|
||||
myAttributes.Bind (Prs3d_DP_ShadingOriginRadiusPercent, 0.015);
|
||||
myAttributes.Bind (Prs3d_DP_ShadingNumberOfFacettes, 12.0);
|
||||
|
||||
Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
|
||||
Standard_Real aWidth = 1.0;
|
||||
for (int aPartIter = Prs3d_DP_Origin; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter;
|
||||
if (aPart != Prs3d_DP_Origin) // origin point is used only in shading mode
|
||||
{
|
||||
myLineAspects.Bind (aPart, new Prs3d_LineAspect (aDefaultColor, aLineType, aWidth));
|
||||
}
|
||||
|
||||
Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect();
|
||||
aShadingAspect->SetColor (aDefaultColor);
|
||||
myShadedAspects.Bind (aPart, aShadingAspect);
|
||||
}
|
||||
myTextAspect = new Prs3d_TextAspect();
|
||||
myPointAspect = new Prs3d_PointAspect (Aspect_TOM_EMPTY, aDefaultColor, 1.0);
|
||||
myArrowAspect = new Prs3d_ArrowAspect();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : LineAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Prs3d_LineAspect) Prs3d_DatumAspect::LineAspect (Prs3d_DatumParts thePart) const
|
||||
{
|
||||
Handle(Prs3d_LineAspect) aLineAspect;
|
||||
myLineAspects.Find (thePart, aLineAspect);
|
||||
return aLineAspect;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ShadingAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Prs3d_ShadingAspect) Prs3d_DatumAspect::ShadingAspect (Prs3d_DatumParts thePart) const
|
||||
{
|
||||
Handle(Prs3d_ShadingAspect) aShadingAspect;
|
||||
myShadedAspects.Find (thePart, aShadingAspect);
|
||||
return aShadingAspect;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDrawFirstAndSecondAxis
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_DatumAspect::SetDrawFirstAndSecondAxis (Standard_Boolean theToDraw)
|
||||
{
|
||||
if (theToDraw)
|
||||
{
|
||||
myAxes = Prs3d_DatumAxes(myAxes | Prs3d_DA_XAxis | Prs3d_DA_YAxis);
|
||||
}
|
||||
else
|
||||
{
|
||||
myAxes = Prs3d_DatumAxes(myAxes & !Prs3d_DA_XAxis & !Prs3d_DA_YAxis);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDrawThirdAxis
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_DatumAspect::SetDrawThirdAxis (Standard_Boolean theToDraw)
|
||||
{
|
||||
if (theToDraw)
|
||||
{
|
||||
myAxes = Prs3d_DatumAxes(myAxes | Prs3d_DA_ZAxis);
|
||||
}
|
||||
else
|
||||
{
|
||||
myAxes = Prs3d_DatumAxes(myAxes & !Prs3d_DA_ZAxis);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DrawDatumPart
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool Prs3d_DatumAspect::DrawDatumPart (Prs3d_DatumParts thePart) const
|
||||
{
|
||||
switch (thePart)
|
||||
{
|
||||
case Prs3d_DP_Origin: return true;
|
||||
case Prs3d_DP_XAxis:
|
||||
case Prs3d_DP_XArrow: return (myAxes & Prs3d_DA_XAxis) != 0;
|
||||
case Prs3d_DP_YAxis:
|
||||
case Prs3d_DP_YArrow: return (myAxes & Prs3d_DA_YAxis) != 0;
|
||||
case Prs3d_DP_ZAxis:
|
||||
case Prs3d_DP_ZArrow: return (myAxes & Prs3d_DA_ZAxis) != 0;
|
||||
case Prs3d_DP_XOYAxis: return DrawDatumPart (Prs3d_DP_XAxis)
|
||||
&& DrawDatumPart (Prs3d_DP_YAxis);
|
||||
case Prs3d_DP_YOZAxis: return DrawDatumPart (Prs3d_DP_YAxis)
|
||||
&& DrawDatumPart (Prs3d_DP_ZAxis);
|
||||
case Prs3d_DP_XOZAxis: return DrawDatumPart (Prs3d_DP_XAxis)
|
||||
&& DrawDatumPart (Prs3d_DP_ZAxis);
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AxisLength
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Real Prs3d_DatumAspect::AxisLength (Prs3d_DatumParts thePart) const
|
||||
{
|
||||
switch (thePart)
|
||||
{
|
||||
case Prs3d_DP_XAxis: return myAttributes.Find (Prs3d_DA_XAxisLength);
|
||||
case Prs3d_DP_YAxis: return myAttributes.Find (Prs3d_DA_YAxisLength);
|
||||
case Prs3d_DP_ZAxis: return myAttributes.Find (Prs3d_DA_ZAxisLength);
|
||||
default: break;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ArrowPartForAxis
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis (Prs3d_DatumParts thePart) const
|
||||
{
|
||||
switch (thePart)
|
||||
{
|
||||
case Prs3d_DP_XAxis: return Prs3d_DP_XArrow;
|
||||
case Prs3d_DP_YAxis: return Prs3d_DP_YArrow;
|
||||
case Prs3d_DP_ZAxis: return Prs3d_DP_ZArrow;
|
||||
default: break;
|
||||
}
|
||||
return Prs3d_DP_None;
|
||||
}
|
||||
|
@@ -17,13 +17,16 @@
|
||||
#ifndef _Prs3d_DatumAspect_HeaderFile
|
||||
#define _Prs3d_DatumAspect_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
#include <Prs3d_BasicAspect.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_DatumAttribute.hxx>
|
||||
#include <Prs3d_DatumAxes.hxx>
|
||||
#include <Prs3d_DatumMode.hxx>
|
||||
#include <Prs3d_DatumParts.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
|
||||
//! A framework to define the display of datums.
|
||||
class Prs3d_DatumAspect : public Prs3d_BasicAspect
|
||||
@@ -33,63 +36,118 @@ public:
|
||||
|
||||
//! An empty framework to define the display of datums.
|
||||
Standard_EXPORT Prs3d_DatumAspect();
|
||||
|
||||
|
||||
//! Returns the right-handed coordinate system set in SetComponent.
|
||||
Standard_EXPORT Handle(Prs3d_LineAspect) LineAspect (Prs3d_DatumParts thePart) const;
|
||||
|
||||
//! Returns the right-handed coordinate system set in SetComponent.
|
||||
Standard_EXPORT Handle(Prs3d_ShadingAspect) ShadingAspect (Prs3d_DatumParts thePart) const;
|
||||
|
||||
//! Returns the right-handed coordinate system set in SetComponent.
|
||||
const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; }
|
||||
|
||||
//! Returns the point aspect of origin wireframe presentation
|
||||
const Handle(Prs3d_PointAspect)& PointAspect() const { return myPointAspect; }
|
||||
|
||||
//! Returns the arrow aspect of presentation
|
||||
const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; }
|
||||
|
||||
//! Returns the attributes for display of the first axis.
|
||||
const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myFirstAxisAspect; }
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
|
||||
const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myLineAspects.Find (Prs3d_DP_XAxis); }
|
||||
|
||||
//! Returns the attributes for display of the second axis.
|
||||
const Handle(Prs3d_LineAspect)& SecondAxisAspect() const { return mySecondAxisAspect; }
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
|
||||
const Handle(Prs3d_LineAspect)& SecondAxisAspect() const { return myLineAspects.Find (Prs3d_DP_YAxis); }
|
||||
|
||||
//! Returns the attributes for display of the third axis.
|
||||
const Handle(Prs3d_LineAspect)& ThirdAxisAspect() const { return myThirdAxisAspect; }
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
|
||||
const Handle(Prs3d_LineAspect)& ThirdAxisAspect() const { return myLineAspects.Find (Prs3d_DP_ZAxis); }
|
||||
|
||||
//! Sets the DrawFirstAndSecondAxis attributes to active.
|
||||
void SetDrawFirstAndSecondAxis (const Standard_Boolean theToDraw) { myDrawFirstAndSecondAxis = theToDraw; }
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
|
||||
Standard_EXPORT void SetDrawFirstAndSecondAxis (Standard_Boolean theToDraw);
|
||||
|
||||
//! Returns true if the first and second axes can be drawn.
|
||||
Standard_Boolean DrawFirstAndSecondAxis() const { return myDrawFirstAndSecondAxis; }
|
||||
Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
|
||||
Standard_Boolean DrawFirstAndSecondAxis() const
|
||||
{
|
||||
return (myAxes & Prs3d_DA_XAxis) != 0
|
||||
&& (myAxes & Prs3d_DA_YAxis) != 0;
|
||||
}
|
||||
|
||||
//! Sets the DrawThirdAxis attributes to active.
|
||||
void SetDrawThirdAxis (const Standard_Boolean theToDraw) { myDrawThirdAxis = theToDraw; }
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
|
||||
Standard_EXPORT void SetDrawThirdAxis (Standard_Boolean theToDraw);
|
||||
|
||||
//! Returns true if the third axis can be drawn.
|
||||
Standard_Boolean DrawThirdAxis() const { return myDrawThirdAxis; }
|
||||
Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
|
||||
Standard_Boolean DrawThirdAxis() const { return (myAxes & Prs3d_DA_ZAxis) != 0; }
|
||||
|
||||
//! Returns true if the given part is used in axes of aspect
|
||||
Standard_EXPORT Standard_Boolean DrawDatumPart (Prs3d_DatumParts thePart) const;
|
||||
|
||||
//! Sets the axes used in the datum aspect
|
||||
void SetDrawDatumAxes (Prs3d_DatumAxes theType) { myAxes = theType; }
|
||||
|
||||
//! Returns axes used in the datum aspect
|
||||
Prs3d_DatumAxes DatumAxes() const { return myAxes; }
|
||||
|
||||
//! Sets the attribute of the datum type
|
||||
void SetAttribute (Prs3d_DatumAttribute theType, const Standard_Real& theValue)
|
||||
{
|
||||
myAttributes.Bind (theType, theValue);
|
||||
}
|
||||
|
||||
//! Returns the attribute of the datum type
|
||||
Standard_Real Attribute (Prs3d_DatumAttribute theType) const
|
||||
{
|
||||
return myAttributes.Find (theType);
|
||||
}
|
||||
|
||||
//! Sets the lengths of the three axes.
|
||||
void SetAxisLength (const Standard_Real theL1, const Standard_Real theL2, const Standard_Real theL3)
|
||||
void SetAxisLength (Standard_Real theL1, Standard_Real theL2, Standard_Real theL3)
|
||||
{
|
||||
myFirstAxisLength = theL1;
|
||||
mySecondAxisLength = theL2;
|
||||
myThirdAxisLength = theL3;
|
||||
myAttributes.Bind (Prs3d_DA_XAxisLength, theL1);
|
||||
myAttributes.Bind (Prs3d_DA_YAxisLength, theL2);
|
||||
myAttributes.Bind (Prs3d_DA_ZAxisLength, theL3);
|
||||
}
|
||||
|
||||
//! Returns the length of the displayed first axis.
|
||||
Quantity_Length FirstAxisLength() const { return myFirstAxisLength; }
|
||||
Standard_EXPORT Standard_Real AxisLength (Prs3d_DatumParts thePart) const;
|
||||
|
||||
//! Returns the length of the displayed first axis.
|
||||
Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
|
||||
Standard_Real FirstAxisLength() const { return myAttributes.Find (Prs3d_DA_XAxisLength); }
|
||||
|
||||
//! Returns the length of the displayed second axis.
|
||||
Quantity_Length SecondAxisLength() const { return mySecondAxisLength; }
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
|
||||
Standard_Real SecondAxisLength() const { return myAttributes.Find (Prs3d_DA_YAxisLength); }
|
||||
|
||||
//! Returns the length of the displayed third axis.
|
||||
Quantity_Length ThirdAxisLength() const { return myThirdAxisLength; }
|
||||
Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
|
||||
Standard_Real ThirdAxisLength() const { return myAttributes.Find (Prs3d_DA_ZAxisLength); }
|
||||
|
||||
//! Sets option to draw or not to draw text labels for axes
|
||||
void SetToDrawLabels (const Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
|
||||
void SetToDrawLabels (Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
|
||||
|
||||
//! @return true if axes labels are drawn
|
||||
Standard_Boolean ToDrawLabels() const { return myToDrawLabels; }
|
||||
|
||||
//! Returns type of arrow for a type of axis
|
||||
Standard_EXPORT Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart) const;
|
||||
|
||||
private:
|
||||
|
||||
Handle(Prs3d_LineAspect) myFirstAxisAspect;
|
||||
Handle(Prs3d_LineAspect) mySecondAxisAspect;
|
||||
Handle(Prs3d_LineAspect) myThirdAxisAspect;
|
||||
Standard_Boolean myDrawFirstAndSecondAxis;
|
||||
Standard_Boolean myDrawThirdAxis;
|
||||
Prs3d_DatumAxes myAxes;
|
||||
Standard_Boolean myToDrawLabels;
|
||||
Quantity_Length myFirstAxisLength;
|
||||
Quantity_Length mySecondAxisLength;
|
||||
Quantity_Length myThirdAxisLength;
|
||||
NCollection_DataMap<Prs3d_DatumAttribute, Standard_Real> myAttributes;
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_ShadingAspect)> myShadedAspects;
|
||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_LineAspect)> myLineAspects;
|
||||
|
||||
Handle(Prs3d_TextAspect) myTextAspect;
|
||||
Handle(Prs3d_PointAspect) myPointAspect;
|
||||
Handle(Prs3d_ArrowAspect) myArrowAspect;
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||
|
30
src/Prs3d/Prs3d_DatumAttribute.hxx
Normal file
30
src/Prs3d/Prs3d_DatumAttribute.hxx
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Prs3d_DatumAttribute_HeaderFile
|
||||
#define _Prs3d_DatumAttribute_HeaderFile
|
||||
|
||||
//! Enumeration defining a part of datum aspect, see Prs3d_Datum.
|
||||
enum Prs3d_DatumAttribute
|
||||
{
|
||||
Prs3d_DA_XAxisLength = 0,
|
||||
Prs3d_DA_YAxisLength,
|
||||
Prs3d_DA_ZAxisLength,
|
||||
Prs3d_DP_ShadingTubeRadiusPercent,
|
||||
Prs3d_DP_ShadingConeRadiusPercent,
|
||||
Prs3d_DP_ShadingConeLengthPercent,
|
||||
Prs3d_DP_ShadingOriginRadiusPercent,
|
||||
Prs3d_DP_ShadingNumberOfFacettes
|
||||
};
|
||||
|
||||
#endif // _Prs3d_DatumAttribute_HeaderFile
|
34
src/Prs3d/Prs3d_DatumAxes.hxx
Normal file
34
src/Prs3d/Prs3d_DatumAxes.hxx
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Prs3d_DatumAxes_HeaderFile
|
||||
#define _Prs3d_DatumAxes_HeaderFile
|
||||
|
||||
//! Enumeration defining an axes used in datum aspect, see Prs3d_Datum.
|
||||
enum Prs3d_DatumAxes
|
||||
{
|
||||
Prs3d_DA_XAxis = 0x00000001, //!< X axis of the datum
|
||||
Prs3d_DA_YAxis = 0x00000002, //!< Y axis of the datum
|
||||
Prs3d_DA_ZAxis = 0x00000004, //!< Z axis of the datum
|
||||
Prs3d_DA_XYAxis = Prs3d_DA_XAxis
|
||||
| Prs3d_DA_YAxis, //!< XOY 2D axes
|
||||
Prs3d_DA_YZAxis = Prs3d_DA_YAxis
|
||||
| Prs3d_DA_ZAxis, //!< YOZ 2D axes
|
||||
Prs3d_DA_XZAxis = Prs3d_DA_XAxis
|
||||
| Prs3d_DA_ZAxis, //!< XOZ 2D axes
|
||||
Prs3d_DA_XYZAxis = Prs3d_DA_XAxis
|
||||
| Prs3d_DA_YAxis
|
||||
| Prs3d_DA_ZAxis //!< XYZ 3D axes
|
||||
};
|
||||
|
||||
#endif // _Prs3d_DatumParts_HeaderFile
|
24
src/Prs3d/Prs3d_DatumMode.hxx
Normal file
24
src/Prs3d/Prs3d_DatumMode.hxx
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Prs3d_DatumMode_HeaderFile
|
||||
#define _Prs3d_DatumMode_HeaderFile
|
||||
|
||||
//! Enumeration defining a mode of datum graphic presentation, see Prs3d_Datum.
|
||||
enum Prs3d_DatumMode
|
||||
{
|
||||
Prs3d_DM_WireFrame = 0,
|
||||
Prs3d_DM_Shaded
|
||||
};
|
||||
|
||||
#endif // _Prs3d_DatumMode_HeaderFile
|
33
src/Prs3d/Prs3d_DatumParts.hxx
Normal file
33
src/Prs3d/Prs3d_DatumParts.hxx
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Prs3d_DatumParts_HeaderFile
|
||||
#define _Prs3d_DatumParts_HeaderFile
|
||||
|
||||
//! Enumeration defining a part of datum aspect, see Prs3d_Datum.
|
||||
enum Prs3d_DatumParts
|
||||
{
|
||||
Prs3d_DP_Origin = 0,
|
||||
Prs3d_DP_XAxis,
|
||||
Prs3d_DP_YAxis,
|
||||
Prs3d_DP_ZAxis,
|
||||
Prs3d_DP_XArrow,
|
||||
Prs3d_DP_YArrow,
|
||||
Prs3d_DP_ZArrow,
|
||||
Prs3d_DP_XOYAxis,
|
||||
Prs3d_DP_YOZAxis,
|
||||
Prs3d_DP_XOZAxis,
|
||||
Prs3d_DP_None
|
||||
};
|
||||
|
||||
#endif // _Prs3d_DatumParts_HeaderFile
|
@@ -1187,9 +1187,9 @@ void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
|
||||
}
|
||||
if (!myDatumAspect.IsNull())
|
||||
{
|
||||
setAspectProgram (theProgram, myDatumAspect->FirstAxisAspect());
|
||||
setAspectProgram (theProgram, myDatumAspect->SecondAxisAspect());
|
||||
setAspectProgram (theProgram, myDatumAspect->ThirdAxisAspect());
|
||||
setAspectProgram (theProgram, myDatumAspect->LineAspect(Prs3d_DP_XAxis));
|
||||
setAspectProgram (theProgram, myDatumAspect->LineAspect(Prs3d_DP_YAxis));
|
||||
setAspectProgram (theProgram, myDatumAspect->LineAspect(Prs3d_DP_ZAxis));
|
||||
}
|
||||
setAspectProgram (theProgram, myArrowAspect);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user