mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 10:10:34 +05:00
Mantis issue 0021251: Problem with normale of a face. Keep shape normales in a separate attribute, as they are not stored in NamedShape.
This commit is contained in:
parent
52744dc183
commit
8e9aa9b888
@ -60,12 +60,21 @@
|
|||||||
#include <Standard_Failure.hxx>
|
#include <Standard_Failure.hxx>
|
||||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
#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 ARGUMENT_LABEL 1
|
||||||
#define RESULT_LABEL 2
|
#define RESULT_LABEL 2
|
||||||
#define DESCRIPTION_LABEL 3
|
#define DESCRIPTION_LABEL 3
|
||||||
#define HISTORY_LABEL 4
|
#define HISTORY_LABEL 4
|
||||||
#define SUBSHAPES_LABEL 5 // 0020756: GetGroups
|
#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 ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
|
||||||
#define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
|
#define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
|
||||||
@ -221,6 +230,15 @@ TopoDS_Shape GEOM_Function::GetValue()
|
|||||||
|
|
||||||
aShape = aNS->Get();
|
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;
|
_isDone = true;
|
||||||
return aShape;
|
return aShape;
|
||||||
}
|
}
|
||||||
@ -234,10 +252,16 @@ void GEOM_Function::SetValue(TopoDS_Shape& theShape)
|
|||||||
{
|
{
|
||||||
_isDone = false;
|
_isDone = false;
|
||||||
TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
|
TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
|
||||||
TNaming_Builder aBuilder(aResultLabel);
|
TNaming_Builder aBuilder (aResultLabel);
|
||||||
|
|
||||||
aBuilder.Generated(theShape);
|
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
|
// synchronisation between main shape and its sub-shapes
|
||||||
TDF_Label aLabel = GetOwnerEntry();
|
TDF_Label aLabel = GetOwnerEntry();
|
||||||
if (aLabel.IsRoot()) return;
|
if (aLabel.IsRoot()) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user