1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0025252: Slow down in reading of .brep on VS2011

Reading of .brep is slow down on VS2011 due to problems in realization reading ASCII strings to real. Implementation of dedicated function for reading of reals was implemented
This commit is contained in:
pdn 2014-09-22 16:54:59 +04:00 committed by bugmaster
parent 07dd6e9bee
commit 71598a83cd
7 changed files with 143 additions and 54 deletions

View File

@ -21,6 +21,7 @@
#include <BRepTools_ShapeSet.ixx> #include <BRepTools_ShapeSet.ixx>
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include <GeomTools.hxx>
#include <Poly.hxx> #include <Poly.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TColStd_HArray1OfInteger.hxx> #include <TColStd_HArray1OfInteger.hxx>
@ -837,8 +838,10 @@ void BRepTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
TopoDS_Vertex& V = TopoDS::Vertex(S); TopoDS_Vertex& V = TopoDS::Vertex(S);
// Read the point geometry // Read the point geometry
IS >> tol; GeomTools::GetReal(IS, tol);
IS >> X >> Y >> Z; GeomTools::GetReal(IS, X);
GeomTools::GetReal(IS, Y);
GeomTools::GetReal(IS, Z);
myBuilder.MakeVertex(V,gp_Pnt(X,Y,Z),tol); myBuilder.MakeVertex(V,gp_Pnt(X,Y,Z),tol);
Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(V.TShape()); Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(V.TShape());
@ -846,7 +849,8 @@ void BRepTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
TopLoc_Location L; TopLoc_Location L;
do { do {
IS >> p1 >> val; GeomTools::GetReal(IS, p1);
IS >> val;
Handle(BRep_PointRepresentation) PR; Handle(BRep_PointRepresentation) PR;
switch (val) { switch (val) {
@ -889,7 +893,8 @@ void BRepTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
case 3 : case 3 :
{ {
IS >> p2 >> s; GeomTools::GetReal(IS, p2);
IS >> s;
// Modified by Sergey KHROMOV - Wed Apr 24 13:59:09 2002 Begin // Modified by Sergey KHROMOV - Wed Apr 24 13:59:09 2002 Begin
if (mySurfaces.Surface(s).IsNull()) if (mySurfaces.Surface(s).IsNull())
@ -931,7 +936,7 @@ void BRepTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
myBuilder.MakeEdge(E); myBuilder.MakeEdge(E);
// Read the curve geometry // Read the curve geometry
IS >> tol; GeomTools::GetReal(IS, tol);
IS >> val; IS >> val;
myBuilder.SameParameter(E,(val == 1)); myBuilder.SameParameter(E,(val == 1));
IS >> val; IS >> val;
@ -949,7 +954,8 @@ void BRepTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
myBuilder.UpdateEdge(E,myCurves.Curve(c), myBuilder.UpdateEdge(E,myCurves.Curve(c),
Locations().Location(l),tol); Locations().Location(l),tol);
} }
IS >> first >> last; GeomTools::GetReal(IS, first);
GeomTools::GetReal(IS, last);
if (!myCurves.Curve(c).IsNull()) { if (!myCurves.Curve(c).IsNull()) {
Standard_Boolean Only3d = Standard_True; Standard_Boolean Only3d = Standard_True;
myBuilder.Range(E,first,last,Only3d); myBuilder.Range(E,first,last,Only3d);
@ -970,12 +976,16 @@ void BRepTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
IS >> s >> l; IS >> s >> l;
// range // range
IS >> first >> last; GeomTools::GetReal(IS, first);
GeomTools::GetReal(IS, last);
// read UV Points // for XML Persistence higher performance // read UV Points // for XML Persistence higher performance
if (FormatNb() == 2) if (FormatNb() == 2)
{ {
IS >> PfX >> PfY >> PlX >> PlY; GeomTools::GetReal(IS, PfX);
GeomTools::GetReal(IS, PfY);
GeomTools::GetReal(IS, PlX);
GeomTools::GetReal(IS, PlY);
aPf = gp_Pnt2d(PfX,PfY); aPf = gp_Pnt2d(PfX,PfY);
aPl = gp_Pnt2d(PlX,PlY); aPl = gp_Pnt2d(PlX,PlY);
} }
@ -1106,7 +1116,8 @@ void BRepTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
IS >> val; // natural restriction IS >> val; // natural restriction
if (val == 0 || val == 1) { if (val == 0 || val == 1) {
IS >> tol >> s >> l; GeomTools::GetReal(IS, tol);
IS >> s >> l;
// Modified by Sergey KHROMOV - Wed Apr 24 12:39:13 2002 Begin // Modified by Sergey KHROMOV - Wed Apr 24 12:39:13 2002 Begin
if (!mySurfaces.Surface(s).IsNull()) { if (!mySurfaces.Surface(s).IsNull()) {
// Modified by Sergey KHROMOV - Wed Apr 24 12:39:14 2002 End // Modified by Sergey KHROMOV - Wed Apr 24 12:39:14 2002 End
@ -1310,12 +1321,12 @@ void BRepTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
IS >> buffer; IS >> buffer;
// if (!strcasecmp(buffer, "p")) { // if (!strcasecmp(buffer, "p")) {
Standard_Real def; Standard_Real def;
IS >> def; GeomTools::GetReal(IS, def);
IS >> hasparameters; IS >> hasparameters;
if (hasparameters) { if (hasparameters) {
TColStd_Array1OfReal Param1(1, nbnodes); TColStd_Array1OfReal Param1(1, nbnodes);
for (j = 1; j <= nbnodes; j++) { for (j = 1; j <= nbnodes; j++) {
IS >> par; GeomTools::GetReal(IS, par);
Param1(j) = par; Param1(j) = par;
} }
Poly = new Poly_PolygonOnTriangulation(Nodes, Param1); Poly = new Poly_PolygonOnTriangulation(Nodes, Param1);
@ -1436,15 +1447,17 @@ void BRepTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
IS >> nbnodes; IS >> nbnodes;
IS >> hasparameters; IS >> hasparameters;
TColgp_Array1OfPnt Nodes(1, nbnodes); TColgp_Array1OfPnt Nodes(1, nbnodes);
IS >> d; GeomTools::GetReal(IS, d);
for (j = 1; j <= nbnodes; j++) { for (j = 1; j <= nbnodes; j++) {
IS >> x >> y >> z; GeomTools::GetReal(IS, x);
GeomTools::GetReal(IS, y);
GeomTools::GetReal(IS, z);
Nodes(j).SetCoord(x,y,z); Nodes(j).SetCoord(x,y,z);
} }
if (hasparameters) { if (hasparameters) {
TColStd_Array1OfReal Param(1,nbnodes); TColStd_Array1OfReal Param(1,nbnodes);
for (p = 1; p <= nbnodes; p++) { for (p = 1; p <= nbnodes; p++) {
IS >> Param(p); GeomTools::GetReal(IS, Param(p));
} }
P = new Poly_Polygon3D(Nodes, Param); P = new Poly_Polygon3D(Nodes, Param);
} }
@ -1586,19 +1599,22 @@ void BRepTools_ShapeSet::ReadTriangulation(Standard_IStream& IS)
for (i=1; i<=nbtri && PS.More();i++, PS.Next()) { for (i=1; i<=nbtri && PS.More();i++, PS.Next()) {
IS >> nbNodes >> nbTriangles >> hasUV; IS >> nbNodes >> nbTriangles >> hasUV;
IS >> d; GeomTools::GetReal(IS, d);
TColgp_Array1OfPnt Nodes(1, nbNodes); TColgp_Array1OfPnt Nodes(1, nbNodes);
TColgp_Array1OfPnt2d UVNodes(1, nbNodes); TColgp_Array1OfPnt2d UVNodes(1, nbNodes);
for (j = 1; j <= nbNodes; j++) { for (j = 1; j <= nbNodes; j++) {
IS >> x >> y >> z; GeomTools::GetReal(IS, x);
GeomTools::GetReal(IS, y);
GeomTools::GetReal(IS, z);
Nodes(j).SetCoord(x,y,z); Nodes(j).SetCoord(x,y,z);
} }
if (hasUV) { if (hasUV) {
for (j = 1; j <= nbNodes; j++) { for (j = 1; j <= nbNodes; j++) {
IS >> x >> y; GeomTools::GetReal(IS, x);
GeomTools::GetReal(IS, y);
UVNodes(j).SetCoord(x,y); UVNodes(j).SetCoord(x,y);
} }
} }

View File

@ -79,6 +79,11 @@ is
GetUndefinedTypeHandler returns UndefinedTypeHandler from GeomTools; GetUndefinedTypeHandler returns UndefinedTypeHandler from GeomTools;
GetReal(IS : out IStream from Standard; theValue : out Real from Standard);
---Purpose: Reads the Standard_Real value from the stream. Zero is read
--- in case of error
end GeomTools; end GeomTools;

View File

@ -88,3 +88,22 @@ Handle(GeomTools_UndefinedTypeHandler) GeomTools::GetUndefinedTypeHandler()
{ {
return theActiveHandler; return theActiveHandler;
} }
//=======================================================================
//function : GetReal
//purpose :
//=======================================================================
void GeomTools::GetReal(Standard_IStream& IS,Standard_Real& theValue)
{
theValue = 0.;
if (IS.eof())
return;
char buffer[256];
buffer[0] = '\0';
std::streamsize anOldWide = IS.width(256);
IS >> buffer;
IS.width(anOldWide);
theValue = Strtod(buffer, NULL);
}

View File

@ -519,7 +519,8 @@ void GeomTools_Curve2dSet::Write(Standard_OStream& OS)const
static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt2d& P) static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt2d& P)
{ {
Standard_Real X=0.,Y=0.; Standard_Real X=0.,Y=0.;
IS >> X >> Y; GeomTools::GetReal(IS, X);
GeomTools::GetReal(IS, Y);
P.SetCoord(X,Y); P.SetCoord(X,Y);
return IS; return IS;
} }
@ -532,7 +533,8 @@ static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt2d& P)
static Standard_IStream& operator>>(Standard_IStream& IS, gp_Dir2d& D) static Standard_IStream& operator>>(Standard_IStream& IS, gp_Dir2d& D)
{ {
Standard_Real X=0.,Y=0.; Standard_Real X=0.,Y=0.;
IS >> X >> Y; GeomTools::GetReal(IS, X);
GeomTools::GetReal(IS, Y);
D.SetCoord(X,Y); D.SetCoord(X,Y);
return IS; return IS;
} }
@ -564,7 +566,8 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
gp_Pnt2d P(0.,0.); gp_Pnt2d P(0.,0.);
gp_Dir2d AX(1.,0.),AY(1.,0.); gp_Dir2d AX(1.,0.),AY(1.,0.);
Standard_Real R=0.; Standard_Real R=0.;
IS >> P >> AX >> AY >> R; IS >> P >> AX >> AY;
GeomTools::GetReal(IS, R);
C = new Geom2d_Circle(gp_Ax22d(P,AX,AY),R); C = new Geom2d_Circle(gp_Ax22d(P,AX,AY),R);
return IS; return IS;
} }
@ -580,7 +583,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
gp_Pnt2d P(0.,0.); gp_Pnt2d P(0.,0.);
gp_Dir2d AX(1.,0.),AY(1.,0.); gp_Dir2d AX(1.,0.),AY(1.,0.);
Standard_Real R1=0.,R2=0.; Standard_Real R1=0.,R2=0.;
IS >> P >> AX >> AY >> R1 >> R2; IS >> P >> AX >> AY;
GeomTools::GetReal(IS, R1);
GeomTools::GetReal(IS, R2);
E = new Geom2d_Ellipse(gp_Ax22d(P,AX,AY),R1,R2); E = new Geom2d_Ellipse(gp_Ax22d(P,AX,AY),R1,R2);
return IS; return IS;
} }
@ -596,7 +601,8 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
gp_Pnt2d P(0.,0.); gp_Pnt2d P(0.,0.);
gp_Dir2d AX(1.,0.),AY(1.,0.); gp_Dir2d AX(1.,0.),AY(1.,0.);
Standard_Real R1=0.; Standard_Real R1=0.;
IS >> P >> AX >> AY >> R1; IS >> P >> AX >> AY;
GeomTools::GetReal(IS, R1);
C = new Geom2d_Parabola(gp_Ax22d(P,AX,AY),R1); C = new Geom2d_Parabola(gp_Ax22d(P,AX,AY),R1);
return IS; return IS;
} }
@ -612,7 +618,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
gp_Pnt2d P(0.,0.); gp_Pnt2d P(0.,0.);
gp_Dir2d AX(1.,0.),AY(1.,0.); gp_Dir2d AX(1.,0.),AY(1.,0.);
Standard_Real R1=0.,R2=0.; Standard_Real R1=0.,R2=0.;
IS >> P >> AX >> AY >> R1 >> R2; IS >> P >> AX >> AY;
GeomTools::GetReal(IS, R1);
GeomTools::GetReal(IS, R2);
H = new Geom2d_Hyperbola(gp_Ax22d(P,AX,AY),R1,R2); H = new Geom2d_Hyperbola(gp_Ax22d(P,AX,AY),R1,R2);
return IS; return IS;
} }
@ -638,7 +646,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
for (i = 1; i <= degree+1; i++) { for (i = 1; i <= degree+1; i++) {
IS >> poles(i); IS >> poles(i);
if (rational) if (rational)
IS >> weights(i); GeomTools::GetReal(IS, weights(i));
} }
if (rational) if (rational)
@ -670,14 +678,15 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
for (i = 1; i <= nbpoles; i++) { for (i = 1; i <= nbpoles; i++) {
IS >> poles(i); IS >> poles(i);
if (rational) if (rational)
IS >> weights(i); GeomTools::GetReal(IS, weights(i));
} }
TColStd_Array1OfReal knots(1,nbknots); TColStd_Array1OfReal knots(1,nbknots);
TColStd_Array1OfInteger mults(1,nbknots); TColStd_Array1OfInteger mults(1,nbknots);
for (i = 1; i <= nbknots; i++) { for (i = 1; i <= nbknots; i++) {
IS >> knots(i) >> mults(i); GeomTools::GetReal(IS, knots(i));
IS >> mults(i);
} }
if (rational) if (rational)
@ -697,7 +706,8 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
Handle(Geom2d_TrimmedCurve)& C) Handle(Geom2d_TrimmedCurve)& C)
{ {
Standard_Real p1=0.,p2=0.; Standard_Real p1=0.,p2=0.;
IS >> p1 >> p2; GeomTools::GetReal(IS, p1);
GeomTools::GetReal(IS, p2);
Handle(Geom2d_Curve) BC; Handle(Geom2d_Curve) BC;
GeomTools_Curve2dSet::ReadCurve2d(IS,BC); GeomTools_Curve2dSet::ReadCurve2d(IS,BC);
C = new Geom2d_TrimmedCurve(BC,p1,p2); C = new Geom2d_TrimmedCurve(BC,p1,p2);
@ -713,7 +723,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
Handle(Geom2d_OffsetCurve)& C) Handle(Geom2d_OffsetCurve)& C)
{ {
Standard_Real p=0.; Standard_Real p=0.;
IS >> p; GeomTools::GetReal(IS, p);
Handle(Geom2d_Curve) BC; Handle(Geom2d_Curve) BC;
GeomTools_Curve2dSet::ReadCurve2d(IS,BC); GeomTools_Curve2dSet::ReadCurve2d(IS,BC);
C = new Geom2d_OffsetCurve(BC,p); C = new Geom2d_OffsetCurve(BC,p);

View File

@ -536,7 +536,9 @@ void GeomTools_CurveSet::Write(Standard_OStream& OS)const
static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt& P) static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt& P)
{ {
Standard_Real X=0.,Y=0.,Z=0.; Standard_Real X=0.,Y=0.,Z=0.;
IS >> X >> Y >> Z; GeomTools::GetReal(IS, X);
GeomTools::GetReal(IS, Y);
GeomTools::GetReal(IS, Z);
P.SetCoord(X,Y,Z); P.SetCoord(X,Y,Z);
return IS; return IS;
} }
@ -549,7 +551,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt& P)
static Standard_IStream& operator>>(Standard_IStream& IS, gp_Dir& D) static Standard_IStream& operator>>(Standard_IStream& IS, gp_Dir& D)
{ {
Standard_Real X=0.,Y=0.,Z=0.; Standard_Real X=0.,Y=0.,Z=0.;
IS >> X >> Y >> Z; GeomTools::GetReal(IS, X);
GeomTools::GetReal(IS, Y);
GeomTools::GetReal(IS, Z);
D.SetCoord(X,Y,Z); D.SetCoord(X,Y,Z);
return IS; return IS;
} }
@ -581,7 +585,8 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
gp_Pnt P(0.,0.,0.); gp_Pnt P(0.,0.,0.);
gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.); gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.);
Standard_Real R=0.; Standard_Real R=0.;
IS >> P >> A >> AX >> AY >> R; IS >> P >> A >> AX >> AY;
GeomTools::GetReal(IS, R);
C = new Geom_Circle(gp_Ax2(P,A,AX),R); C = new Geom_Circle(gp_Ax2(P,A,AX),R);
return IS; return IS;
} }
@ -597,7 +602,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
gp_Pnt P(0.,0.,0.); gp_Pnt P(0.,0.,0.);
gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.); gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.);
Standard_Real R1=0.,R2=0.; Standard_Real R1=0.,R2=0.;
IS >> P >> A >> AX >> AY >> R1 >> R2; IS >> P >> A >> AX >> AY;
GeomTools::GetReal(IS, R1);
GeomTools::GetReal(IS, R2);
E = new Geom_Ellipse(gp_Ax2(P,A,AX),R1,R2); E = new Geom_Ellipse(gp_Ax2(P,A,AX),R1,R2);
return IS; return IS;
} }
@ -613,7 +620,8 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
gp_Pnt P(0.,0.,0.); gp_Pnt P(0.,0.,0.);
gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.); gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.);
Standard_Real R1=0.; Standard_Real R1=0.;
IS >> P >> A >> AX >> AY >> R1; IS >> P >> A >> AX >> AY;
GeomTools::GetReal(IS, R1);
C = new Geom_Parabola(gp_Ax2(P,A,AX),R1); C = new Geom_Parabola(gp_Ax2(P,A,AX),R1);
return IS; return IS;
} }
@ -629,7 +637,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
gp_Pnt P(0.,0.,0.); gp_Pnt P(0.,0.,0.);
gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.); gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.);
Standard_Real R1=0.,R2=0.; Standard_Real R1=0.,R2=0.;
IS >> P >> A >> AX >> AY >> R1 >> R2; IS >> P >> A >> AX >> AY;
GeomTools::GetReal(IS, R1);
GeomTools::GetReal(IS, R2);
H = new Geom_Hyperbola(gp_Ax2(P,A,AX),R1,R2); H = new Geom_Hyperbola(gp_Ax2(P,A,AX),R1,R2);
return IS; return IS;
} }
@ -655,7 +665,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
for (i = 1; i <= degree+1; i++) { for (i = 1; i <= degree+1; i++) {
IS >> poles(i); IS >> poles(i);
if (rational) if (rational)
IS >> weights(i); GeomTools::GetReal(IS, weights(i));
} }
if (rational) if (rational)
@ -688,14 +698,15 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
for (i = 1; i <= nbpoles; i++) { for (i = 1; i <= nbpoles; i++) {
IS >> poles(i); IS >> poles(i);
if (rational) if (rational)
IS >> weights(i); GeomTools::GetReal(IS, weights(i));
} }
TColStd_Array1OfReal knots(1,nbknots); TColStd_Array1OfReal knots(1,nbknots);
TColStd_Array1OfInteger mults(1,nbknots); TColStd_Array1OfInteger mults(1,nbknots);
for (i = 1; i <= nbknots; i++) { for (i = 1; i <= nbknots; i++) {
IS >> knots(i) >> mults(i); GeomTools::GetReal(IS, knots(i));
IS >> mults(i);
} }
if (rational) if (rational)
@ -715,7 +726,8 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
Handle(Geom_TrimmedCurve)& C) Handle(Geom_TrimmedCurve)& C)
{ {
Standard_Real p1=0.,p2=0.; Standard_Real p1=0.,p2=0.;
IS >> p1 >> p2; GeomTools::GetReal(IS, p1);
GeomTools::GetReal(IS, p2);
Handle(Geom_Curve) BC; Handle(Geom_Curve) BC;
GeomTools_CurveSet::ReadCurve(IS,BC); GeomTools_CurveSet::ReadCurve(IS,BC);
C = new Geom_TrimmedCurve(BC,p1,p2); C = new Geom_TrimmedCurve(BC,p1,p2);
@ -731,7 +743,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
Handle(Geom_OffsetCurve)& C) Handle(Geom_OffsetCurve)& C)
{ {
Standard_Real p=0.; Standard_Real p=0.;
IS >> p; GeomTools::GetReal(IS, p);
gp_Dir D(1.,0.,0.); gp_Dir D(1.,0.,0.);
IS >> D; IS >> D;
Handle(Geom_Curve) BC; Handle(Geom_Curve) BC;

View File

@ -656,7 +656,9 @@ void GeomTools_SurfaceSet::Write(Standard_OStream& OS)const
static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt& P) static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt& P)
{ {
Standard_Real X=0.,Y=0.,Z=0.; Standard_Real X=0.,Y=0.,Z=0.;
IS >> X >> Y >> Z; GeomTools::GetReal(IS, X);
GeomTools::GetReal(IS, Y);
GeomTools::GetReal(IS, Z);
P.SetCoord(X,Y,Z); P.SetCoord(X,Y,Z);
return IS; return IS;
} }
@ -669,7 +671,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt& P)
static Standard_IStream& operator>>(Standard_IStream& IS, gp_Dir& D) static Standard_IStream& operator>>(Standard_IStream& IS, gp_Dir& D)
{ {
Standard_Real X=0.,Y=0.,Z=0.; Standard_Real X=0.,Y=0.,Z=0.;
IS >> X >> Y >> Z; GeomTools::GetReal(IS, X);
GeomTools::GetReal(IS, Y);
GeomTools::GetReal(IS, Z);
D.SetCoord(X,Y,Z); D.SetCoord(X,Y,Z);
return IS; return IS;
} }
@ -716,7 +720,8 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
{ {
gp_Ax3 A; gp_Ax3 A;
Standard_Real R=0.; Standard_Real R=0.;
IS >> A >> R; IS >> A;
GeomTools::GetReal(IS, R);
S = new Geom_CylindricalSurface(A,R); S = new Geom_CylindricalSurface(A,R);
return IS; return IS;
} }
@ -731,7 +736,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
{ {
gp_Ax3 A; gp_Ax3 A;
Standard_Real R=0.,Ang=0.; Standard_Real R=0.,Ang=0.;
IS >> A >> R >> Ang; IS >> A;
GeomTools::GetReal(IS, R);
GeomTools::GetReal(IS, Ang);
S = new Geom_ConicalSurface(A,Ang,R); S = new Geom_ConicalSurface(A,Ang,R);
return IS; return IS;
} }
@ -746,7 +753,8 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
{ {
gp_Ax3 A; gp_Ax3 A;
Standard_Real R=0.; Standard_Real R=0.;
IS >> A >> R; IS >> A;
GeomTools::GetReal(IS, R);
S = new Geom_SphericalSurface(A,R); S = new Geom_SphericalSurface(A,R);
return IS; return IS;
} }
@ -761,7 +769,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
{ {
gp_Ax3 A; gp_Ax3 A;
Standard_Real R1=0.,R2=0.; Standard_Real R1=0.,R2=0.;
IS >> A >> R1 >> R2; IS >> A;
GeomTools::GetReal(IS, R1);
GeomTools::GetReal(IS, R2);
S = new Geom_ToroidalSurface(A,R1,R2); S = new Geom_ToroidalSurface(A,R1,R2);
return IS; return IS;
} }
@ -819,7 +829,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
for (j = 1; j <= vdegree+1; j++) { for (j = 1; j <= vdegree+1; j++) {
IS >> poles(i,j); IS >> poles(i,j);
if (urational || vrational) if (urational || vrational)
IS >> weights(i,j); GeomTools::GetReal(IS, weights(i,j));
} }
} }
@ -855,20 +865,22 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
for (j = 1; j <= nbvpoles; j++) { for (j = 1; j <= nbvpoles; j++) {
IS >> poles(i,j); IS >> poles(i,j);
if (urational || vrational) if (urational || vrational)
IS >> weights(i,j); GeomTools::GetReal(IS, weights(i,j));
} }
} }
TColStd_Array1OfReal uknots(1,nbuknots); TColStd_Array1OfReal uknots(1,nbuknots);
TColStd_Array1OfInteger umults(1,nbuknots); TColStd_Array1OfInteger umults(1,nbuknots);
for (i = 1; i <= nbuknots; i++) { for (i = 1; i <= nbuknots; i++) {
IS >> uknots(i) >> umults(i); GeomTools::GetReal(IS, uknots(i));
IS >> umults(i);
} }
TColStd_Array1OfReal vknots(1,nbvknots); TColStd_Array1OfReal vknots(1,nbvknots);
TColStd_Array1OfInteger vmults(1,nbvknots); TColStd_Array1OfInteger vmults(1,nbvknots);
for (i = 1; i <= nbvknots; i++) { for (i = 1; i <= nbvknots; i++) {
IS >> vknots(i) >> vmults(i); GeomTools::GetReal(IS, vknots(i));
IS >> vmults(i);
} }
if (urational || vrational) if (urational || vrational)
@ -889,7 +901,10 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
Handle(Geom_RectangularTrimmedSurface)& S) Handle(Geom_RectangularTrimmedSurface)& S)
{ {
Standard_Real U1=0.,U2=0.,V1=0.,V2=0.; Standard_Real U1=0.,U2=0.,V1=0.,V2=0.;
IS >> U1 >> U2 >> V1 >> V2; GeomTools::GetReal(IS, U1);
GeomTools::GetReal(IS, U2);
GeomTools::GetReal(IS, V1);
GeomTools::GetReal(IS, V2);
Handle(Geom_Surface) BS; Handle(Geom_Surface) BS;
GeomTools_SurfaceSet::ReadSurface(IS,BS); GeomTools_SurfaceSet::ReadSurface(IS,BS);
S = new Geom_RectangularTrimmedSurface(BS,U1,U2,V1,V2); S = new Geom_RectangularTrimmedSurface(BS,U1,U2,V1,V2);
@ -905,7 +920,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
Handle(Geom_OffsetSurface)& S) Handle(Geom_OffsetSurface)& S)
{ {
Standard_Real O=0.; Standard_Real O=0.;
IS >> O; GeomTools::GetReal(IS, O);
Handle(Geom_Surface) BS; Handle(Geom_Surface) BS;
GeomTools_SurfaceSet::ReadSurface(IS,BS); GeomTools_SurfaceSet::ReadSurface(IS,BS);
S = new Geom_OffsetSurface(BS,O); S = new Geom_OffsetSurface(BS,O);

View File

@ -19,6 +19,7 @@
#include <TopLoc_Location.hxx> #include <TopLoc_Location.hxx>
#include <Message_ProgressSentry.hxx> #include <Message_ProgressSentry.hxx>
#include <GeomTools.hxx>
#include <gp_Ax3.hxx> #include <gp_Ax3.hxx>
#include <gp_Vec.hxx> #include <gp_Vec.hxx>
#include <Precision.hxx> #include <Precision.hxx>
@ -219,9 +220,20 @@ static void ReadTrsf(gp_Trsf& T,
Standard_Real V1[3],V2[3],V3[3]; Standard_Real V1[3],V2[3],V3[3];
Standard_Real V[3]; Standard_Real V[3];
IS >> V1[0] >> V1[1] >> V1[2] >> V[0]; GeomTools::GetReal(IS, V1[0]);
IS >> V2[0] >> V2[1] >> V2[2] >> V[1]; GeomTools::GetReal(IS, V1[1]);
IS >> V3[0] >> V3[1] >> V3[2] >> V[2]; GeomTools::GetReal(IS, V1[2]);
GeomTools::GetReal(IS, V[0]);
GeomTools::GetReal(IS, V2[0]);
GeomTools::GetReal(IS, V2[1]);
GeomTools::GetReal(IS, V2[2]);
GeomTools::GetReal(IS, V[1]);
GeomTools::GetReal(IS, V3[0]);
GeomTools::GetReal(IS, V3[1]);
GeomTools::GetReal(IS, V3[2]);
GeomTools::GetReal(IS, V[2]);
T.SetValues(V1[0],V1[1],V1[2],V[0], T.SetValues(V1[0],V1[1],V1[2],V[0],
V2[0],V2[1],V2[2],V[1], V2[0],V2[1],V2[2],V[1],