1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0023766: Shape orientation processing mechanism redesign

Added missed file.
Added missed MDF_Tool.cxx.
Adding test cases for issue CR23766
This commit is contained in:
szy
2013-08-15 15:36:08 +04:00
committed by bugmaster
parent 602952413f
commit 7dcac1dfa0
31 changed files with 1214 additions and 117 deletions

View File

@@ -26,6 +26,7 @@
#include <TNaming_Naming.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
#include <TNaming_Iterator.hxx>
#include <TDF_Tool.hxx>
//=======================================================================
@@ -41,6 +42,7 @@ IMPLEMENT_DOMSTRING (TypeString, "nametype")
IMPLEMENT_DOMSTRING (ShapeTypeString, "shapetype")
IMPLEMENT_DOMSTRING (ArgumentsString, "arguments")
IMPLEMENT_DOMSTRING (ContextLabelString, "contextlabel")
IMPLEMENT_DOMSTRING (OrientString, "orientation")
IMPLEMENT_DOMSTRING (NTUnknownString, "unknown")
IMPLEMENT_DOMSTRING (NTIdentityString, "identity")
@@ -203,6 +205,39 @@ Standard_Boolean XmlMNaming_NamingDriver::Paste
else
cout << "Retrieving Context Label is NULL" <<endl;
#endif
if(XmlMNaming::DocumentVersion() > 4 && XmlMNaming::DocumentVersion() < 7) {
// Orientation processing - converting from old format
Handle(TNaming_NamedShape) aNS;
if (aNg->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
//const TDF_Label& aLab = aNS->Label();
TNaming_Iterator itL (aNS);
for (; itL.More(); itL.Next()) {
const TopoDS_Shape& S = itL.NewShape();
if (S.IsNull()) continue;
if(aNS->Evolution() == TNaming_SELECTED) {
if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
!itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX ) {//OR-N
TopAbs_Orientation OrientationToApply = itL.OldShape().Orientation();
aNgName.Orientation(OrientationToApply);
}
}
}
}
}
if(XmlMNaming::DocumentVersion() > 6) {
aDOMStr = anElem.getAttribute(::OrientString());
if (!aDOMStr.GetInteger(aNb))
{
aMsgString = TCollection_ExtendedString
("XmlMNaming_NamingDriver: Cannot retrieve "
"integer value of orientation from \"") + aDOMStr + "\"";
WriteMessage (aMsgString);
return Standard_False;
}
aNgName.Orientation((TopAbs_Orientation)aNb);
}
// or. end
}
#ifdef DEB
else if(XmlMNaming::DocumentVersion() == -1)
@@ -287,6 +322,9 @@ void XmlMNaming_NamingDriver::Paste
cout << "XmlMNaming_NamingDriver::Store: aDOMString is NULL" <<endl;
#endif
// orientation
anElem.setAttribute(::OrientString(), (Standard_Integer)aNgName.Orientation());
}
//=======================================================================