0031382: Data Exchange - BinXCAF should preserve length unit information

Possibility for adding LengthUnit info to XCAF document using special class XCAFDoc_LenghtUnit and XCAFDoc_LenghtUnitTool is implemented.
Package UnitsMethods is split: geom methods were placed to new file GeomConvert_Units which is in the toolkit TKXSBase, internal step scale factors was placed to StepData.
Updated UnitMethods to convert scale factor to different unit types.
Now, XSAlgo::XSAlgo_AlgoContainer is used to update unit info from static interface values.
New Draw command "XSetLengthUnit" and "XGetLengthUnit" for set or get XDE attribute.
Upgraded tests for STEP, IGES, OBJ, glTF, VRML formats to check area regressing with used unit.
Upgraded tests\de test cases to use any units in the "loop back" algorithms.
This commit is contained in:
dpasukhi
2020-11-10 07:52:30 +03:00
committed by bugmaster
parent 9592ae247b
commit da80ff68f1
106 changed files with 2258 additions and 662 deletions

View File

@@ -21,10 +21,10 @@
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <StdFail_NotDone.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepGeom_CartesianPoint.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <UnitsMethods.hxx>
//=============================================================================
// Creation d' un cartesian_point de prostep a partir d' un point3d de gp
@@ -42,7 +42,7 @@ GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt& P)
// Pstep->SetCoordinates(Acoord);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
// Pstep->SetName(name);
Standard_Real fact = UnitsMethods::LengthFactor();
Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
Pstep->Init3D (name,X/fact,Y/fact,Z/fact);
theCartesianPoint = Pstep;
done = Standard_True;
@@ -87,7 +87,7 @@ GeomToStep_MakeCartesianPoint::
// Pstep->SetCoordinates(Acoord);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
// Pstep->SetName(name);
Standard_Real fact = UnitsMethods::LengthFactor();
Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
Pstep->Init3D (name,X/fact,Y/fact,Z/fact);
theCartesianPoint = Pstep;
done = Standard_True;

View File

@@ -23,11 +23,11 @@
#include <gp_Circ.hxx>
#include <gp_Circ2d.hxx>
#include <StdFail_NotDone.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement2d.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_Circle.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
//=============================================================================
// Creation d' un cercle de prostep a partir d' un cercle 3d de gp

View File

@@ -24,7 +24,7 @@ Handle(StepGeom_Circle) CStep = new StepGeom_Circle;
Rayon = C.Radius();
Ax2.SetValue(Ax2Step);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
CStep->Init(name, Ax2, Rayon / UnitsMethods::LengthFactor());
CStep->Init(name, Ax2, Rayon / StepData_GlobalFactors::Intance().LengthFactor());
theCircle = CStep;
done = Standard_True;

View File

@@ -20,10 +20,10 @@
#include <GeomToStep_MakeConicalSurface.hxx>
#include <Standard_DomainError.hxx>
#include <StdFail_NotDone.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_ConicalSurface.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
//=============================================================================
// Creation d' une conical_surface de prostep a partir d' une ConicalSurface
@@ -46,7 +46,7 @@ GeomToStep_MakeConicalSurface::GeomToStep_MakeConicalSurface
}
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
CSstep->Init(name, aPosition, aRadius / UnitsMethods::LengthFactor(), aSemiAngle);
CSstep->Init(name, aPosition, aRadius / StepData_GlobalFactors::Intance().LengthFactor(), aSemiAngle);
theConicalSurface = CSstep;
done = Standard_True;
}

View File

@@ -19,10 +19,10 @@
#include <GeomToStep_MakeAxis2Placement3d.hxx>
#include <GeomToStep_MakeCylindricalSurface.hxx>
#include <StdFail_NotDone.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_CylindricalSurface.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
//=============================================================================
// Creation d' une conical_surface de prostep a partir d' une
@@ -41,7 +41,7 @@ GeomToStep_MakeCylindricalSurface::GeomToStep_MakeCylindricalSurface
aRadius = CS->Radius();
CSstep = new StepGeom_CylindricalSurface;
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
CSstep->Init(name, aPosition, aRadius / UnitsMethods::LengthFactor());
CSstep->Init(name, aPosition, aRadius / StepData_GlobalFactors::Intance().LengthFactor());
theCylindricalSurface = CSstep;
done = Standard_True;
}

View File

@@ -23,11 +23,11 @@
#include <gp_Elips.hxx>
#include <gp_Elips2d.hxx>
#include <StdFail_NotDone.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement2d.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_Ellipse.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
//=============================================================================
// Creation d'une ellipse de prostep a partir d'une ellipse 3d de gp

View File

@@ -25,7 +25,7 @@ Handle(StepGeom_Ellipse) EStep = new StepGeom_Ellipse;
minorR = E.MinorRadius();
Ax2.SetValue(Ax2Step);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
Standard_Real fact = UnitsMethods::LengthFactor();
Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
EStep->Init(name, Ax2,majorR/fact,minorR/fact);
theEllipse = EStep;
done = Standard_True;

View File

@@ -20,11 +20,11 @@
#include <gp_Hypr.hxx>
#include <gp_Hypr2d.hxx>
#include <StdFail_NotDone.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement2d.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_Hyperbola.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
//=============================================================================
// Creation d'une hyperbola de prostep a partir d'une hyperbola de
@@ -72,7 +72,7 @@ GeomToStep_MakeHyperbola::GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola
minorR = gpHyp.MinorRadius();
Ax2.SetValue(Ax2Step);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
Standard_Real fact = UnitsMethods::LengthFactor();
Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
HStep->Init(name, Ax2,majorR/fact,minorR/fact);
theHyperbola = HStep;
done = Standard_True;

View File

@@ -20,11 +20,11 @@
#include <gp_Parab.hxx>
#include <gp_Parab2d.hxx>
#include <StdFail_NotDone.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement2d.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_Parabola.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
//=============================================================================
// Creation d'une Parabola de prostep a partir d'une Parabola de
@@ -70,7 +70,7 @@ GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)&
focal = gpPar.Focal();
Ax2.SetValue(Ax2Step);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
PStep->Init(name, Ax2, focal / UnitsMethods::LengthFactor());
PStep->Init(name, Ax2, focal / StepData_GlobalFactors::Intance().LengthFactor());
theParabola = PStep;
done = Standard_True;
}

View File

@@ -25,10 +25,10 @@
#include <GeomToStep_MakeRectangularTrimmedSurface.hxx>
#include <GeomToStep_MakeSurface.hxx>
#include <StdFail_NotDone.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepGeom_RectangularTrimmedSurface.hxx>
#include <StepGeom_Surface.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
//=============================================================================
// Creation d' une rectangular_trimmed_surface de STEP
@@ -61,7 +61,7 @@ GeomToStep_MakeRectangularTrimmedSurface::
Standard_Real AngleFact = 180./M_PI;
Standard_Real uFact = 1.;
Standard_Real vFact = 1.;
Standard_Real LengthFact = UnitsMethods::LengthFactor();
Standard_Real LengthFact = StepData_GlobalFactors::Intance().LengthFactor();
Handle(Geom_Surface) theSurf = RTSurf->BasisSurface();
if (theSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
uFact = AngleFact;

View File

@@ -22,7 +22,7 @@
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_SphericalSurface.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
#include <StepData_GlobalFactors.hxx>
//=============================================================================
// Creation d' une conical_surface de prostep a partir d' une SphericalSurface
@@ -41,7 +41,7 @@ GeomToStep_MakeSphericalSurface::GeomToStep_MakeSphericalSurface
aRadius = S->Radius();
Surf = new StepGeom_SphericalSurface;
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
Surf->Init(name, aPosition, aRadius/UnitsMethods::LengthFactor());
Surf->Init(name, aPosition, aRadius/ StepData_GlobalFactors::Intance().LengthFactor());
theSphericalSurface = Surf;
done = Standard_True;
}

View File

@@ -32,7 +32,7 @@
#include <StepGeom_Surface.hxx>
#include <StepGeom_SweptSurface.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
#include <StepData_GlobalFactors.hxx>
//=============================================================================
// Creation d' une Surface de prostep a partir d' une Surface de Geom
@@ -66,7 +66,7 @@ GeomToStep_MakeSurface::GeomToStep_MakeSurface ( const Handle(Geom_Surface)& S)
if (!done) return;
Handle(StepGeom_OffsetSurface) Surf = new StepGeom_OffsetSurface;
Surf->Init (new TCollection_HAsciiString(""),
MkBasis.Value(),S1->Offset()/UnitsMethods::LengthFactor(),StepData_LFalse);
MkBasis.Value(),S1->Offset()/ StepData_GlobalFactors::Intance().LengthFactor(),StepData_LFalse);
theSurface = Surf;
}
else {

View File

@@ -21,7 +21,7 @@
#include <StdFail_NotDone.hxx>
#include <StepGeom_ToroidalSurface.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
#include <StepData_GlobalFactors.hxx>
//=============================================================================
// Creation d' une toroidal_surface de prostep a partir d' une ToroidalSurface
@@ -41,7 +41,7 @@ GeomToStep_MakeToroidalSurface::GeomToStep_MakeToroidalSurface
aMinorRadius = S->MinorRadius();
Surf = new StepGeom_ToroidalSurface;
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
Standard_Real fact = UnitsMethods::LengthFactor();
Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
Surf->Init(name, aPosition, aMajorRadius/fact, aMinorRadius/fact);
theToroidalSurface = Surf;
done = Standard_True;

View File

@@ -24,9 +24,9 @@
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
#include <StdFail_NotDone.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepGeom_Vector.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
//=============================================================================
// Creation d' un vector de prostep a partir d' un Vec de gp
@@ -34,7 +34,7 @@
GeomToStep_MakeVector::GeomToStep_MakeVector( const gp_Vec& V)
{
gp_Dir D = gp_Dir(V);
Standard_Real lFactor = UnitsMethods::LengthFactor();
Standard_Real lFactor = StepData_GlobalFactors::Intance().LengthFactor();
#include "GeomToStep_MakeVector_gen.pxx"
}
//=============================================================================
@@ -58,7 +58,7 @@ GeomToStep_MakeVector::GeomToStep_MakeVector ( const Handle(Geom_Vector)&
gp_Vec V;
V = GVector->Vec();
gp_Dir D = gp_Dir(V);
Standard_Real lFactor = UnitsMethods::LengthFactor();
Standard_Real lFactor = StepData_GlobalFactors::Intance().LengthFactor();
#include "GeomToStep_MakeVector_gen.pxx"
}