mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0031050: Data Exchange - XmlXCAF persistence stores triangulation-only Faces without any geometry
BRepTools_ShapeSet now ignores myWithTriangles flag in case if triangulation is the only geometry representation.
This commit is contained in:
parent
44fafc477f
commit
8c787b5fa9
@ -215,7 +215,7 @@ void BRepTools_ShapeSet::AddGeometry(const TopoDS_Shape& S)
|
|||||||
Handle(BRep_TFace) TF = Handle(BRep_TFace)::DownCast(S.TShape());
|
Handle(BRep_TFace) TF = Handle(BRep_TFace)::DownCast(S.TShape());
|
||||||
if (!TF->Surface().IsNull()) mySurfaces.Add(TF->Surface());
|
if (!TF->Surface().IsNull()) mySurfaces.Add(TF->Surface());
|
||||||
|
|
||||||
if (myWithTriangles) { // for XML Persistence
|
if (myWithTriangles || TF->Surface().IsNull()) { // for XML Persistence
|
||||||
Handle(Poly_Triangulation) Tr = TF->Triangulation();
|
Handle(Poly_Triangulation) Tr = TF->Triangulation();
|
||||||
if (!Tr.IsNull()) myTriangulations.Add(Tr);
|
if (!Tr.IsNull()) myTriangulations.Add(Tr);
|
||||||
}
|
}
|
||||||
@ -751,7 +751,7 @@ void BRepTools_ShapeSet::WriteGeometry(const TopoDS_Shape& S,
|
|||||||
OS << " " << 0;
|
OS << " " << 0;
|
||||||
OS << "\n";
|
OS << "\n";
|
||||||
}
|
}
|
||||||
if (myWithTriangles) { // for XML Persistence
|
if (myWithTriangles || TF->Surface().IsNull()) { // for XML Persistence
|
||||||
if (!(TF->Triangulation()).IsNull()) {
|
if (!(TF->Triangulation()).IsNull()) {
|
||||||
OS << 2;
|
OS << 2;
|
||||||
OS << " ";
|
OS << " ";
|
||||||
|
@ -7,6 +7,7 @@ puts ""
|
|||||||
set anImgDoc1 $imagedir/${casename}_doc1.png
|
set anImgDoc1 $imagedir/${casename}_doc1.png
|
||||||
set anImgDoc2 $imagedir/${casename}_doc2.png
|
set anImgDoc2 $imagedir/${casename}_doc2.png
|
||||||
set anImgDiff $imagedir/${casename}_diff.png
|
set anImgDiff $imagedir/${casename}_diff.png
|
||||||
|
set aTestFile $imagedir/${casename}.xbf
|
||||||
|
|
||||||
pload XDE OCAF MODELING VISUALIZATION
|
pload XDE OCAF MODELING VISUALIZATION
|
||||||
|
|
||||||
@ -16,27 +17,27 @@ explode s F
|
|||||||
NewDocument D BinXCAF
|
NewDocument D BinXCAF
|
||||||
XAddShape D s
|
XAddShape D s
|
||||||
XSetColor D s_1 1 0 0
|
XSetColor D s_1 1 0 0
|
||||||
XShow D
|
vclear
|
||||||
|
vinit View1
|
||||||
vaxo
|
vaxo
|
||||||
|
XDisplay -dispMode 1 D
|
||||||
vfit
|
vfit
|
||||||
vrotate 3 0 0
|
vrotate 3 0 0
|
||||||
vsetdispmode 1
|
|
||||||
vdump $anImgDoc1
|
vdump $anImgDoc1
|
||||||
|
|
||||||
file delete ${imagedir}/test.xbf
|
file delete $aTestFile
|
||||||
StoreTriangulation 1
|
StoreTriangulation 1
|
||||||
SaveAs D ${imagedir}/test.xbf
|
SaveAs D $aTestFile
|
||||||
Close D
|
Close D
|
||||||
|
|
||||||
XOpen ${imagedir}/test.xbf D
|
XOpen $aTestFile D
|
||||||
XShow D
|
file delete $aTestFile
|
||||||
vsetdispmode 1
|
vclear
|
||||||
|
XDisplay -dispMode 1 D
|
||||||
vaxo
|
vaxo
|
||||||
vfit
|
vfit
|
||||||
vrotate 3 0 0
|
vrotate 3 0 0
|
||||||
vdump $anImgDoc2
|
vdump $anImgDoc2
|
||||||
|
|
||||||
set aDiffRes [diffimage $anImgDoc2 $anImgDoc1 0.0 0 0 $anImgDiff]
|
set aDiffRes [diffimage $anImgDoc2 $anImgDoc1 0.0 0 0 $anImgDiff]
|
||||||
if {$aDiffRes != 0} {
|
if {$aDiffRes != 0} { puts "Error: document has changed after Save/Read" }
|
||||||
puts "Error: document has changed after Save/Read"
|
|
||||||
}
|
|
||||||
|
38
tests/bugs/caf/bug31050
Normal file
38
tests/bugs/caf/bug31050
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "0031050: Data Exchange - XmlXCAF persistence stores triangulation-only Faces without any geometry"
|
||||||
|
puts "============"
|
||||||
|
|
||||||
|
set anImgDoc1 $imagedir/${casename}_doc1.png
|
||||||
|
set anImgDoc2 $imagedir/${casename}_doc2.png
|
||||||
|
set anImgDiff $imagedir/${casename}_diff.png
|
||||||
|
set aTestFile $imagedir/${casename}.xml
|
||||||
|
|
||||||
|
pload XDE OCAF MODELING VISUALIZATION
|
||||||
|
|
||||||
|
restore [locate_data_file bug27821_nullsurf.brep] s
|
||||||
|
explode s F
|
||||||
|
|
||||||
|
NewDocument D XmlXCAF
|
||||||
|
XAddShape D s
|
||||||
|
XSetColor D s_1 1 0 0
|
||||||
|
vclear
|
||||||
|
vinit View1
|
||||||
|
vaxo
|
||||||
|
XDisplay -dispMode 1 D
|
||||||
|
vfit
|
||||||
|
vrotate 3 0 0
|
||||||
|
vdump $anImgDoc1
|
||||||
|
|
||||||
|
file delete $aTestFile
|
||||||
|
StoreTriangulation 1
|
||||||
|
SaveAs D $aTestFile
|
||||||
|
Close D
|
||||||
|
|
||||||
|
XOpen $aTestFile D
|
||||||
|
file delete $aTestFile
|
||||||
|
vclear
|
||||||
|
XDisplay -dispMode 1 D
|
||||||
|
vdump $anImgDoc2
|
||||||
|
|
||||||
|
set aDiffRes [diffimage $anImgDoc2 $anImgDoc1 0.0 0 0 $anImgDiff]
|
||||||
|
if {$aDiffRes != 0} { puts "Error: document has changed after Save/Read" }
|
Loading…
x
Reference in New Issue
Block a user