]> OCCT Git - occt.git/commitdiff
Fix
authorichesnok <ichesnok@opencascade.com>
Wed, 28 Jun 2023 10:39:00 +0000 (11:39 +0100)
committerichesnok <ichesnok@opencascade.com>
Wed, 28 Jun 2023 10:39:00 +0000 (11:39 +0100)
src/NCollection/NCollection_Array2.hxx
src/RWMesh/RWMesh_CafReader.cxx
src/RWMesh/RWMesh_CafReader.hxx
src/XCAFDoc/XCAFDoc_Animation.cxx
src/XCAFDoc/XCAFDoc_AnimationTool.cxx
src/XCAFDoc/XCAFDoc_AnimationTool.hxx

index 58dd25ffb59f9d1b6d44f1d25d0127e3f72a05d1..a06d435c74d40ccb2fa42a2f4e24ecf28c43e7b3 100644 (file)
@@ -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
index 9efd9e66dc107d1c0ae7081b509e962353a10e18..02b4494aa91490c15a10dcff504618d6f73a6173 100644 (file)
@@ -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);
index 3be45e7d2109cd5dd3c246926bed413da61c6d82..f84b88bc7ac96b3246fbfcc56d92ea64f872120c 100644 (file)
@@ -56,6 +56,7 @@ public:
     Handle(XCAFDoc_ColorTool)       ColorTool;
     Handle(XCAFDoc_VisMaterialTool) VisMaterialTool;
     NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> ComponentMap;
+    NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> OriginalShapeMap;
   };
 
 public:
index 705a58355b0e76696b52897db9a31cc621b4cf27..3d773f823d77f84dbcf914bccad1d2c5690d5582 100644 (file)
@@ -347,7 +347,7 @@ Handle(XCAFAnimObjects_AnimObject) XCAFDoc_Animation::GetObject()  const
     {
       continue;
     }
-    NCollection_Array2<double> aValuesArr(1, aDimAtrArr->Value(1), 1, aDimAtrArr->Value(2));
+    NCollection_Array2<double> aValuesArr(1, aDimAtrArr->Value(2), 1, aDimAtrArr->Value(1));
     int aValuesInd = 1;
     for (NCollection_Array2<double>::Iterator aOperValIter(aValuesArr);
          aOperValIter.More(); aOperValIter.Next(), aValuesInd++)
index bbd8d8647cc614674d78b8b8c89982b4937c05c0..396eb774fd9097509d5aa538aea7bd4215adb1d7 100644 (file)
@@ -14,6 +14,7 @@
 #include <XCAFDoc_AnimationTool.hxx>
 
 #include <Standard_GUID.hxx>
+#include <TDataStd_AsciiString.hxx>
 #include <TDataStd_Name.hxx>
 #include <TDataStd_Real.hxx>
 #include <TDataStd_TreeNode.hxx>
@@ -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  :
index ef85f5118c0603e1a99e5d70e8e0cb394674659d..36d7246eaf52b09effd05ec0b96f09920da8c992 100644 (file)
@@ -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;