-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include <Standard_Stream.hxx>
#include <GEOM_Solver.hxx>
#include <GEOM_ISubShape.hxx>
+#include <Basics_OCCTVersion.hxx>
+
#include "utilities.h"
#include <TDF.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+// This modification was introduced in frame of Mantis issue 0021251.
+// This line allows to keep shape orientation together with the shape itself.
+// Otherwise orientation can be lost in some cases.
+#define KEEP_ORIENTATION_0021251
+
#define ARGUMENT_LABEL 1
#define RESULT_LABEL 2
#define DESCRIPTION_LABEL 3
#define HISTORY_LABEL 4
#define SUBSHAPES_LABEL 5 // 0020756: GetGroups
-#define NAMING_LABEL 6 // 002020750: Naming during STEP import
+#define NAMING_LABEL 6 // 0020750: Naming during STEP import
+
+#ifdef KEEP_ORIENTATION_0021251
+#define ORIENTATION_LABEL 7 // 0021251: TNaming_NamedShape doesn't store orientation
+#endif
#define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
#define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
if (!isResult) {
try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
#endif
GEOM_Solver aSolver(GEOM_Engine::GetEngine());
if (!aSolver.ComputeFunction(this)) {
- MESSAGE("GEOM_Object::GetValue Error : Can't build a sub shape");
+ MESSAGE("GEOM_Object::GetValue Error : Can't build a sub-shape");
return aShape;
}
}
aShape = aNS->Get();
+#ifdef KEEP_ORIENTATION_0021251
+ // 0021251: TNaming_NamedShape doesn't store orientation
+ TDF_Label anOrientationLabel = _label.FindChild(ORIENTATION_LABEL);
+ Handle(TDataStd_Integer) anInteger;
+ if (anOrientationLabel.FindAttribute(TDataStd_Integer::GetID(), anInteger)) {
+ aShape.Orientation((TopAbs_Orientation)anInteger->Get());
+ }
+#endif
+
_isDone = true;
return aShape;
}
{
_isDone = false;
TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
- TNaming_Builder aBuilder(aResultLabel);
+ TNaming_Builder aBuilder (aResultLabel);
aBuilder.Generated(theShape);
+#ifdef KEEP_ORIENTATION_0021251
+ // 0021251: TNaming_NamedShape doesn't store orientation
+ TDF_Label anOrientationLabel = _label.FindChild(ORIENTATION_LABEL);
+ TDataStd_Integer::Set(anOrientationLabel, (int)theShape.Orientation());
+#endif
+
// synchronisation between main shape and its sub-shapes
TDF_Label aLabel = GetOwnerEntry();
if (aLabel.IsRoot()) return;