diff --git a/src/NCollection/NCollection_Array2.hxx b/src/NCollection/NCollection_Array2.hxx index 58dd25ffb5..a06d435c74 100644 --- a/src/NCollection/NCollection_Array2.hxx +++ b/src/NCollection/NCollection_Array2.hxx @@ -179,10 +179,10 @@ public: Standard_Integer NbColumns() const { return myUpperCol - myLowerCol + 1; } //! Returns length of the row, i.e. number of columns - Standard_Integer RowLength() const { return NbRows(); } + Standard_Integer RowLength() const { return NbColumns(); } //! Returns length of the column, i.e. number of rows - Standard_Integer ColLength() const { return NbColumns(); } + Standard_Integer ColLength() const { return NbRows(); } //! LowerRow Standard_Integer LowerRow (void) const diff --git a/src/RWMesh/RWMesh_CafReader.cxx b/src/RWMesh/RWMesh_CafReader.cxx index 9efd9e66dc..02b4494aa9 100644 --- a/src/RWMesh/RWMesh_CafReader.cxx +++ b/src/RWMesh/RWMesh_CafReader.cxx @@ -370,6 +370,16 @@ Standard_Boolean RWMesh_CafReader::addShapeIntoDoc (CafDocumentTools& theTools, return Standard_False; } + if (toMakeAssembly) + { + TDF_Label aRefLabel; + theTools.ShapeTool->GetReferredShape(aNewLabel, aRefLabel); + if (!aRefLabel.IsNull()) + { + theTools.OriginalShapeMap.Bind(theShape, aRefLabel); + } + } + // if new label is a reference get referred shape TDF_Label aNewRefLabel = aNewLabel; theTools.ShapeTool->GetReferredShape (aNewLabel, aNewRefLabel); diff --git a/src/RWMesh/RWMesh_CafReader.hxx b/src/RWMesh/RWMesh_CafReader.hxx index 3be45e7d21..f84b88bc7a 100644 --- a/src/RWMesh/RWMesh_CafReader.hxx +++ b/src/RWMesh/RWMesh_CafReader.hxx @@ -56,6 +56,7 @@ public: Handle(XCAFDoc_ColorTool) ColorTool; Handle(XCAFDoc_VisMaterialTool) VisMaterialTool; NCollection_DataMap ComponentMap; + NCollection_DataMap OriginalShapeMap; }; public: diff --git a/src/XCAFDoc/XCAFDoc_Animation.cxx b/src/XCAFDoc/XCAFDoc_Animation.cxx index 705a58355b..3d773f823d 100644 --- a/src/XCAFDoc/XCAFDoc_Animation.cxx +++ b/src/XCAFDoc/XCAFDoc_Animation.cxx @@ -347,7 +347,7 @@ Handle(XCAFAnimObjects_AnimObject) XCAFDoc_Animation::GetObject() const { continue; } - NCollection_Array2 aValuesArr(1, aDimAtrArr->Value(1), 1, aDimAtrArr->Value(2)); + NCollection_Array2 aValuesArr(1, aDimAtrArr->Value(2), 1, aDimAtrArr->Value(1)); int aValuesInd = 1; for (NCollection_Array2::Iterator aOperValIter(aValuesArr); aOperValIter.More(); aOperValIter.Next(), aValuesInd++) diff --git a/src/XCAFDoc/XCAFDoc_AnimationTool.cxx b/src/XCAFDoc/XCAFDoc_AnimationTool.cxx index bbd8d8647c..396eb774fd 100644 --- a/src/XCAFDoc/XCAFDoc_AnimationTool.cxx +++ b/src/XCAFDoc/XCAFDoc_AnimationTool.cxx @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -56,6 +57,26 @@ namespace static Standard_GUID aEndTimeCodeGUID("EF5305A3-961D-48AE-9A78-AC744A110A26"); return aEndTimeCodeGUID; } + + //======================================================================= + //function : GetFileLengthUnitGUID + //purpose : + //======================================================================= + const Standard_GUID& GetFileLengthUnitGUID() + { + static Standard_GUID aFileLengthUnitGUID("492f5372-9a28-4611-a663-d8394f98df00"); + return aFileLengthUnitGUID; + } + + //======================================================================= + //function : GetFileLengthUnitGUID + //purpose : + //======================================================================= + const Standard_GUID& GetUpAxisGUID() + { + static Standard_GUID anUpAxisGUID("05d55dd9-7175-44a7-97aa-43909ad6f9c7"); + return anUpAxisGUID; + } } //======================================================================= @@ -227,6 +248,66 @@ void XCAFDoc_AnimationTool::SetEndTimeCode(const double theCode) const TDataStd_Real::Set(BaseLabel(), GetEndTimeCodeGUID(), theCode); } +//======================================================================= +//function : GetFileLengthUnit +//purpose : +//======================================================================= +bool XCAFDoc_AnimationTool::GetFileLengthUnit(double& theLengthUnit) const +{ + Handle(TDataStd_Real) aLengthUnitAttr; + if (BaseLabel().FindAttribute(GetFileLengthUnitGUID(), aLengthUnitAttr)) + { + theLengthUnit = aLengthUnitAttr->Get(); + return true; + } + return false; +} + +//======================================================================= +//function : SetFileLengthUnit +//purpose : +//======================================================================= +void XCAFDoc_AnimationTool::SetFileLengthUnit(const double theLengthUnit) const +{ + Handle(TDataStd_Real) aLengthUnitAttr; + if (BaseLabel().FindAttribute(GetFileLengthUnitGUID(), aLengthUnitAttr)) + { + aLengthUnitAttr->Set(theLengthUnit); + return; + } + TDataStd_Real::Set(BaseLabel(), GetFileLengthUnitGUID(), theLengthUnit); +} + +//======================================================================= +//function : GetUpAxis +//purpose : +//======================================================================= +bool XCAFDoc_AnimationTool::GetUpAxis(TCollection_AsciiString& theAxis) const +{ + Handle(TDataStd_AsciiString) anAxisAttr; + if (BaseLabel().FindAttribute(GetUpAxisGUID(), anAxisAttr)) + { + theAxis = anAxisAttr->Get(); + return true; + } + return false; +} + +//======================================================================= +//function : SetUpAxis +//purpose : +//======================================================================= +void XCAFDoc_AnimationTool::SetUpAxis(const TCollection_AsciiString theAxis) const +{ + Handle(TDataStd_AsciiString) anAxisAttr; + if (BaseLabel().FindAttribute(GetUpAxisGUID(), anAxisAttr)) + { + anAxisAttr->Set(theAxis); + return; + } + TDataStd_AsciiString::Set(BaseLabel(), GetUpAxisGUID(), theAxis); +} + //======================================================================= //function : GetAnimationLabels //purpose : diff --git a/src/XCAFDoc/XCAFDoc_AnimationTool.hxx b/src/XCAFDoc/XCAFDoc_AnimationTool.hxx index ef85f5118c..36d7246eaf 100644 --- a/src/XCAFDoc/XCAFDoc_AnimationTool.hxx +++ b/src/XCAFDoc/XCAFDoc_AnimationTool.hxx @@ -76,6 +76,18 @@ public: //! Standard_EXPORT void SetEndTimeCode(const double theCode) const; + //! + Standard_EXPORT bool GetFileLengthUnit(double& theLengthUnit) const; + + //! + Standard_EXPORT void SetFileLengthUnit(const double theLengthUnit) const; + + //! + Standard_EXPORT bool GetUpAxis(TCollection_AsciiString& theAxis) const; + + //! + Standard_EXPORT void SetUpAxis(const TCollection_AsciiString theAxis) const; + //! Returns a sequence of Animation labels currently stored //! in the Animation table. Standard_EXPORT void GetAnimationLabels(TDF_LabelSequence& theLabels) const;