Default BinTools_ShapeSet format version has been changed from 3 to 1.
BinMNaming_NamedShapeDriver (Bin OCAF) now writes shapes in 1st version of Binary format instead of 3rd.
XmlMNaming_NamedShapeDriver (Xml OCAF) now writes shapes in 1st version of ASCII format instead of 2nd.
writebrep now by default writes into 1st binary format version instead of 3rd.
OS << "\n";
// Write UV Points // for XML Persistence higher performance
- if (FormatNb() >= TopTools_FormatVersion_VERSION_2)
+ if (FormatNb() == TopTools_FormatVersion_VERSION_2)
{
gp_Pnt2d Pf,Pl;
if (CR->IsCurveOnClosedSurface()) {
GeomTools::GetReal(IS, last);
// read UV Points // for XML Persistence higher performance
- if (FormatNb() >= TopTools_FormatVersion_VERSION_2)
+ if (FormatNb() == TopTools_FormatVersion_VERSION_2)
{
GeomTools::GetReal(IS, PfX);
GeomTools::GetReal(IS, PfY);
// Modified by Sergey KHROMOV - Wed Apr 24 12:11:17 2002 End
if (closed) {
- if (FormatNb() >= TopTools_FormatVersion_VERSION_2)
+ if (FormatNb() == TopTools_FormatVersion_VERSION_2)
myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
myCurves2d.Curve2d(pc2),
mySurfaces.Surface(s),
}
else
{
- if (FormatNb() >= TopTools_FormatVersion_VERSION_2)
+ if (FormatNb() == TopTools_FormatVersion_VERSION_2)
myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
mySurfaces.Surface(s),
Locations().Location(l),tol,
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TNaming_NamedShape)->Name()),
myShapeSet (Standard_False),
- myFormatNb (BinTools_FormatVersion_VERSION_3)
+ myFormatNb (BinTools_FormatVersion_VERSION_1)
{
}
BinTools_FormatVersion_VERSION_3 = 3, //!< (OCCT 6.2.1) Correctly processes geometry with points on Curve,
//! or point on Surface, or points on curve of surface [#0009745]
- BinTools_FormatVersion_CURRENT = BinTools_FormatVersion_VERSION_3 //!< The current version.
+ BinTools_FormatVersion_CURRENT = BinTools_FormatVersion_VERSION_1 //!< The current version.
};
#endif
//=======================================================================
void BinTools_ShapeSet::SetFormatNb(const Standard_Integer theFormatNb)
{
- Standard_ASSERT_RETURN(theFormatNb >= BinTools_FormatVersion_VERSION_1 &&
- theFormatNb <= BinTools_FormatVersion_CURRENT,
+ Standard_ASSERT_RETURN(theFormatNb == BinTools_FormatVersion_VERSION_1 ||
+ theFormatNb == BinTools_FormatVersion_VERSION_2 ||
+ theFormatNb == BinTools_FormatVersion_VERSION_3,
"Error: unsupported BinTools version.", );
myFormatNb = theFormatNb;
S.Free(aFree);
S.Modified(aMod);
- if (myFormatNb >= BinTools_FormatVersion_VERSION_2)
- S.Checked(aChecked);
- else
- S.Checked (Standard_False); // force check at reading..
+ if (myFormatNb != BinTools_FormatVersion_VERSION_2
+ && myFormatNb != BinTools_FormatVersion_VERSION_3)
+ {
+ aChecked = false; // force check at reading
+ }
+ S.Checked (aChecked);
S.Orientable(anOrient);
S.Closed (aClosed);
S.Infinite (anInf);
BinTools::PutReal(OS, last);
// Write UV Points for higher performance
- if (myFormatNb >= BinTools_FormatVersion_VERSION_2)
+ if (myFormatNb == BinTools_FormatVersion_VERSION_2
+ || myFormatNb == BinTools_FormatVersion_VERSION_3)
{
gp_Pnt2d Pf,Pl;
if (CR->IsCurveOnClosedSurface()) {
- Handle(BRep_CurveOnClosedSurface) COCS =
- Handle(BRep_CurveOnClosedSurface)::DownCast(CR);
+ Handle(BRep_CurveOnClosedSurface) COCS = Handle(BRep_CurveOnClosedSurface)::DownCast(CR);
COCS->UVPoints2(Pf,Pl);
}
else {
- Handle(BRep_CurveOnSurface) COS =
- Handle(BRep_CurveOnSurface)::DownCast(CR);
+ Handle(BRep_CurveOnSurface) COS = Handle(BRep_CurveOnSurface)::DownCast(CR);
COS->UVPoints(Pf,Pl);
}
BinTools::PutReal(OS, Pf.X());
BRep_ListOfPointRepresentation& lpr = TV->ChangePoints();
TopLoc_Location L;
- Standard_Boolean aNewF = (myFormatNb >= BinTools_FormatVersion_VERSION_3);
do {
- if(aNewF) {
+ if(myFormatNb == BinTools_FormatVersion_VERSION_3) {
val = (Standard_Integer)IS.get();//case {0|1|2|3}
if (val > 0 && val <= 3)
BinTools::GetReal(IS, p1);
BinTools::GetReal(IS, last);
// read UV Points // for XML Persistence higher performance
- if (myFormatNb >= BinTools_FormatVersion_VERSION_2)
+ if (myFormatNb == BinTools_FormatVersion_VERSION_2
+ || myFormatNb == BinTools_FormatVersion_VERSION_3)
{
BinTools::GetReal(IS, PfX);
BinTools::GetReal(IS, PfY);
break;
if (closed) {
- if (myFormatNb >= BinTools_FormatVersion_VERSION_2)
+ if (myFormatNb == BinTools_FormatVersion_VERSION_2
+ || myFormatNb == BinTools_FormatVersion_VERSION_3)
+ {
myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
myCurves2d.Curve2d(pc2),
mySurfaces.Surface(s),
Locations().Location(l),tol,
aPf, aPl);
+ }
else
+ {
myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
myCurves2d.Curve2d(pc2),
mySurfaces.Surface(s),
Locations().Location(l),tol);
+ }
myBuilder.Continuity(E,
mySurfaces.Surface(s),
}
else
{
- if (myFormatNb >= BinTools_FormatVersion_VERSION_2)
+ if (myFormatNb == BinTools_FormatVersion_VERSION_2
+ || myFormatNb == BinTools_FormatVersion_VERSION_3)
+ {
myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
mySurfaces.Surface(s),
Locations().Location(l),tol,
aPf, aPl);
+ }
else
+ {
myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
mySurfaces.Surface(s),
Locations().Location(l),tol);
+ }
}
myBuilder.Range(E,
mySurfaces.Surface(s),
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI);
if (isBinaryFormat)
{
- if (aVersion > BinTools_FormatVersion_CURRENT)
+ if (aVersion > BinTools_FormatVersion_VERSION_3)
{
theDI << "Syntax error: unknown format version";
return 1;
"\n\t\t: -binary write into the binary format (ASCII when unspecified)"
"\n\t\t: -version a number of format version to save;"
"\n\t\t: ASCII versions: 1, 2 (1 for ASCII when unspecified);"
- "\n\t\t: Binary versions: 1, 2 and 3 (3 for Binary when unspecified)."
+ "\n\t\t: Binary versions: 1, 2 and 3 (1 for Binary when unspecified)."
"\n\t\t: -noTriangles skip triangulation data (OFF when unspecified).",
__FILE__, writebrep, g);
theCommands.Add("readbrep",
//! Defined TopTools format version
enum TopTools_FormatVersion
{
- TopTools_FormatVersion_VERSION_1 = 1, //!< Does not write CurveOnSurface UV Points into the file. On reading calls Check() method.
- TopTools_FormatVersion_VERSION_2 = 2, //!< Stores CurveOnSurface UV Points. On reading format is recognized from Version string.
+ TopTools_FormatVersion_VERSION_1 = 1, //!< Does not write CurveOnSurface UV Points into the file.
+ //! On reading calls Check() method.
+ //! This is default version.
+ TopTools_FormatVersion_VERSION_2 = 2, //!< Stores CurveOnSurface UV Points.
+ //! On reading format is recognized from Version string.
TopTools_FormatVersion_CURRENT = TopTools_FormatVersion_VERSION_1 //!< The current version.
};
//purpose :
//=======================================================================
TopTools_ShapeSet::TopTools_ShapeSet()
-: myFormatNb (TopTools_FormatVersion_VERSION_1)
+: myFormatNb (TopTools_FormatVersion_CURRENT)
{
}
S.Free (buffer[0] == '1');
S.Modified (buffer[1] == '1');
- if (myFormatNb >= TopTools_FormatVersion_VERSION_2)
- S.Checked (buffer[2] == '1');
- else
- S.Checked (Standard_False); // force check at reading..
+ const bool isChecked = myFormatNb == TopTools_FormatVersion_VERSION_2
+ && buffer[2] == '1';
+ S.Checked (isChecked);
S.Orientable(buffer[3] == '1');
S.Closed (buffer[4] == '1');
// Add text to the "shapes" element
if (myShapeSet.NbShapes() > 0) {
- myShapeSet.SetFormatNb(TopTools_FormatVersion_VERSION_2);
+ myShapeSet.SetFormatNb(TopTools_FormatVersion_VERSION_1);
LDOM_OSStream aStream (16 * 1024);
// ostrstream aStream;
// aStream.rdbuf() -> setbuf (0, 16380);
--- /dev/null
+puts "=========="
+puts "0029723: Modeling Data - Get rid of second writing format (additional save of UV points)"
+puts "=========="
+puts ""
+
+pload MODELING VISUALIZATION
+
+box testBox 10 20 30
+nurbsconvert nurbsBox testBox
+
+writebrep nurbsBox "${imagedir}/${casename}_topBox1.brep" -version 1
+readbrep "${imagedir}/${casename}_topBox1.brep" topBox1
+checkprops topBox1 -equal nurbsBox
+
+writebrep nurbsBox "${imagedir}/${casename}_topBox2.brep" -version 2
+readbrep "${imagedir}/${casename}_topBox2.brep" topBox2
+checkprops topBox2 -equal nurbsBox
+
+writebrep nurbsBox "${imagedir}/${casename}_topBox3.bbrep" -version 1 -binary on
+readbrep "${imagedir}/${casename}_topBox3.bbrep" topBox3
+checkprops topBox3 -equal nurbsBox
+
+writebrep nurbsBox "${imagedir}/${casename}_topBox4.bbrep" -version 2 -binary on
+readbrep "${imagedir}/${casename}_topBox4.bbrep" topBox4
+checkprops topBox4 -equal nurbsBox
+
+writebrep nurbsBox "${imagedir}/${casename}_topBox5.bbrep" -version 3 -binary on
+readbrep "${imagedir}/${casename}_topBox5.bbrep" topBox5
+checkprops topBox5 -equal nurbsBox