]> OCCT Git - occt.git/commitdiff
// implement conversion into/from array2
authordpasukhi <dpasukhi@opencascade.com>
Thu, 25 May 2023 09:47:15 +0000 (10:47 +0100)
committeroan <oan@opencascade.com>
Tue, 20 Jun 2023 21:33:55 +0000 (22:33 +0100)
implement getting typeName

15 files changed:
src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx
src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx
src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx
src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx
src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx
src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx
src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx
src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx
src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx
src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx
src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx
src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx
src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx
src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx
src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx

index 84bf085d0bd5a234e54b96c208f07aaf50b2d103..86be349ccb7db99ade314f74430c81224fd1d7d5 100644 (file)
 //function : XCAFAnimObjects_CustomOperation
 //purpose  :
 //=======================================================================
-XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const int theObjectSize,
-                                                                 const TCollection_AsciiString& theCustomTypeName,
-                                                                 const NCollection_Array1<char>& thePresentation) :
+XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const NCollection_Array1<double>& thePresentation,
+                                                                 const TCollection_AsciiString& theCustomTypeName) :
   XCAFAnimObjects_Operation(false),
-  myObjectSize(theObjectSize),
   myTypeName(theCustomTypeName),
   myPresentation(1, 1, thePresentation.Lower(), thePresentation.Upper())
 {
@@ -35,12 +33,10 @@ XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const int theOb
 //function : XCAFAnimObjects_CustomOperation
 //purpose  :
 //=======================================================================
-XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const int theObjectSize,
-                                                                 const TCollection_AsciiString& theCustomTypeName,
-                                                                 const NCollection_Array2<char>& thePresentation,
-                                                                 const NCollection_Array1<double>& theTimeStamps) :
+XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const NCollection_Array2<double>& thePresentation,
+                                                                 const NCollection_Array1<double>& theTimeStamps,
+                                                                 const TCollection_AsciiString& theCustomTypeName) :
   XCAFAnimObjects_Operation(theTimeStamps),
-  myObjectSize(theObjectSize),
   myTypeName(theCustomTypeName),
   myPresentation(thePresentation)
 {}
index a7addbd3e75dca9f070e6cc424ace7088a785c4d..9fe53c66323768859fa7ae8eb120b8e3ff7b37ad 100644 (file)
@@ -24,33 +24,30 @@ class XCAFAnimObjects_CustomOperation : public XCAFAnimObjects_Operation
 public:
 
   //! 
-  Standard_EXPORT XCAFAnimObjects_CustomOperation(const int theObjectSize,
-                                                  const TCollection_AsciiString& theCustomTypeName,
-                                                  const NCollection_Array1<char>& thePresentation);
+  Standard_EXPORT XCAFAnimObjects_CustomOperation(const NCollection_Array1<double>& thePresentation,
+                                                  const TCollection_AsciiString& theCustomTypeName);
 
   //! 
-  Standard_EXPORT XCAFAnimObjects_CustomOperation(const int theObjectSize,
-                                                  const TCollection_AsciiString& theCustomTypeName,
-                                                  const NCollection_Array2<char>& thePresentation,
-                                                  const NCollection_Array1<double>& theTimeStamps);
+  Standard_EXPORT XCAFAnimObjects_CustomOperation(const NCollection_Array2<double>& thePresentation,
+                                                  const NCollection_Array1<double>& theTimeStamps,
+                                                  const TCollection_AsciiString& theCustomTypeName);
 
   //! 
   XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Custom; }
 
   //! 
-  int ObjectSize() const { return myObjectSize; }
+  NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE { return myPresentation; }
 
   //! 
-  const TCollection_AsciiString& CustomTypeName() const { return myTypeName; }
+  TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return myTypeName; }
 
   //! 
-  const NCollection_Array2<char>& CustomPresentation() const { return myPresentation; }
+  const NCollection_Array2<double>& CustomPresentation() const { return myPresentation; }
 
 private:
 
-  int myObjectSize; //!< 
   TCollection_AsciiString myTypeName; //!< 
-  NCollection_Array2<char> myPresentation; //!< 
+  NCollection_Array2<double> myPresentation; //!< 
 };
 
 #endif // _XCAFAnimObjects_CustomOperation_HeaderFile
index bd7481a8f89f04291432a7922242d9350fffff11..a550b467086bd9865038e87a5fbf3512712526bf 100644 (file)
@@ -15,6 +15,8 @@
 #define _XCAFAnimObjects_Operation_HeaderFile
 
 #include <NCollection_Array1.hxx>
+#include <NCollection_Array2.hxx>
+#include <TCollection_AsciiString.hxx>
 #include <XCAFAnimObjects_OperationType.hxx>
 
 //! 
@@ -38,12 +40,18 @@ public:
   //! 
   Standard_EXPORT virtual XCAFAnimObjects_OperationType GetType() const = 0;
 
+  //! 
+  Standard_EXPORT virtual TCollection_AsciiString GetTypeName() const = 0;
+
   //! 
   bool IsInverse() const { return myIsInverse; }
 
   //! 
   void SetInverse(const bool theIsInverse) { myIsInverse = theIsInverse; }
 
+  //! 
+  Standard_EXPORT virtual NCollection_Array2<double> GeneralPresentation() const = 0;
+
 private:
   bool myIsInverse; //!
   NCollection_Array1<double> myTimeStamps; //!< 
index 2a4d732f3463085683ff43a62136da8fbc5e490e..1a36a7b7077f312865cf2c1e23b0fcd99a2e0fa4 100644 (file)
 
 #include <XCAFAnimObjects_Orient.hxx>
 
+#include <Message.hxx>
+
 //=======================================================================
 //function : XCAFAnimObjects_Orient
 //purpose  :
 //=======================================================================
 XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const gp_Quaternion& theOrient) :
   XCAFAnimObjects_Operation(false),
-  myOrientPresentation(1,1)
+  myOrientPresentation(1, 1)
 {
   myOrientPresentation.SetValue(1, theOrient);
 }
@@ -30,7 +32,49 @@ XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const gp_Quaternion& theOrient) :
 //=======================================================================
 XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const NCollection_Array1<gp_Quaternion>& theOrient,
                                                const NCollection_Array1<double>& theTimeStamps) :
-  
+
   XCAFAnimObjects_Operation(theTimeStamps),
   myOrientPresentation(theOrient)
 {}
+
+//=======================================================================
+//function : XCAFAnimObjects_Orient
+//purpose  :
+//=======================================================================
+XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const NCollection_Array2<double>& theGeneralPresentation,
+                                               const NCollection_Array1<double>& theTimeStamps) :
+  XCAFAnimObjects_Operation(false),
+  myOrientPresentation(1, theGeneralPresentation.RowLength())
+{
+  if (theGeneralPresentation.ColLength() != 4)
+  {
+    Message::SendWarning() << "Warning: XCAFAnimObjects_Orient: Incorrect Quaternion general presentation";
+    return;
+  }
+  for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+  {
+    gp_Quaternion aQuat(theGeneralPresentation.Value(aRowInd, 1),
+                        theGeneralPresentation.Value(aRowInd, 2),
+                        theGeneralPresentation.Value(aRowInd, 3),
+                        theGeneralPresentation.Value(aRowInd, 4));
+    myOrientPresentation.SetValue(aRowInd, aQuat);
+  }
+}
+
+//=======================================================================
+//function : GeneralPresentation
+//purpose  :
+//=======================================================================
+NCollection_Array2<double> XCAFAnimObjects_Orient::GeneralPresentation() const
+{
+  NCollection_Array2<double> aRes(1, myOrientPresentation.Length(), 1, 4);
+  for (int aRowInd = 1; aRowInd <= myOrientPresentation.Length(); aRowInd++)
+  {
+    const gp_Quaternion& aQuat = myOrientPresentation.Value(aRowInd);
+
+    aRes.SetValue(aRowInd, 1, aQuat.X());
+    aRes.SetValue(aRowInd, 2, aQuat.Y());
+    aRes.SetValue(aRowInd, 3, aQuat.Z());
+    aRes.SetValue(aRowInd, 4, aQuat.W());
+  }
+}
\ No newline at end of file
index 1845afac3b66a1422f4f58fa57dcfccf2ac39e91..7549ba265194f0d0a029ab5359060e156e916936 100644 (file)
@@ -29,9 +29,19 @@ public:
   Standard_EXPORT XCAFAnimObjects_Orient(const NCollection_Array1<gp_Quaternion>& theOrient,
                                          const NCollection_Array1<double>& theTimeStamps);
 
+  //! 
+  Standard_EXPORT XCAFAnimObjects_Orient(const NCollection_Array2<double>& theGeneralPresentation,
+                                         const NCollection_Array1<double>& theTimeStamps);
+
   //! 
   XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Orient; }
 
+  //! 
+  TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Orient"; }
+
+  //! 
+  Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
+
   //! 
   const NCollection_Array1<gp_Quaternion>& OrientPresentation() const { return myOrientPresentation; }
 
index 0980ba7eafb8ab922f546390675b9a28a24158a5..7a7c85ac9e450e84bec85f6a74317c7478933d37 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "XCAFAnimObjects_Rotate.hxx"
 
+#include <Message.hxx>
+
 //=======================================================================
 //function : XCAFAnimObjects_Rotate
 //purpose  :
@@ -52,3 +54,45 @@ XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate(const NCollection_Array1<gp_Quate
   XCAFAnimObjects_Operation(theTimeStamps),
   myRotatePresentation(theRotate)
 {}
+
+//=======================================================================
+//function : XCAFAnimObjects_Rotate
+//purpose  :
+//=======================================================================
+XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate(const NCollection_Array2<double>& theGeneralPresentation,
+                                               const NCollection_Array1<double>& theTimeStamps) :
+  XCAFAnimObjects_Operation(false),
+  myRotatePresentation(1, theGeneralPresentation.RowLength())
+{
+  if (theGeneralPresentation.ColLength() != 4)
+  {
+    Message::SendWarning() << "Warning: XCAFAnimObjects_Rotate: Incorrect Quaternion general presentation";
+    return;
+  }
+  for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+  {
+    gp_Quaternion aQuat(theGeneralPresentation.Value(aRowInd, 1),
+                        theGeneralPresentation.Value(aRowInd, 2),
+                        theGeneralPresentation.Value(aRowInd, 3),
+                        theGeneralPresentation.Value(aRowInd, 4));
+    myRotatePresentation.SetValue(aRowInd, aQuat);
+  }
+}
+
+//=======================================================================
+//function : GeneralPresentation
+//purpose  :
+//=======================================================================
+NCollection_Array2<double> XCAFAnimObjects_Rotate::GeneralPresentation() const
+{
+  NCollection_Array2<double> aRes(1, myRotatePresentation.Length(), 1, 4);
+  for (int aRowInd = 1; aRowInd <= myRotatePresentation.Length(); aRowInd++)
+  {
+    const gp_Quaternion& aQuat = myRotatePresentation.Value(aRowInd);
+
+    aRes.SetValue(aRowInd, 1, aQuat.X());
+    aRes.SetValue(aRowInd, 2, aQuat.Y());
+    aRes.SetValue(aRowInd, 3, aQuat.Z());
+    aRes.SetValue(aRowInd, 4, aQuat.W());
+  }
+}
index 3095a475128087af75c3d4575ef7c334c00c6d4a..e7483dd36657f864db15072e8f87af85265a482f 100644 (file)
@@ -32,9 +32,19 @@ public:
   Standard_EXPORT XCAFAnimObjects_Rotate(const NCollection_Array1<gp_Quaternion>& theRotate,
                                          const NCollection_Array1<double>& theTimeStamps);
 
+  //! 
+  Standard_EXPORT XCAFAnimObjects_Rotate(const NCollection_Array2<double>& theGeneralPresentation,
+                                         const NCollection_Array1<double>& theTimeStamps);
+
   //! 
   XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Rotate; }
 
+  //! 
+  TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Rotate"; }
+
+  //! 
+  Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
+
   //! 
   const NCollection_Array1<gp_Quaternion>& RotatePresentation() const { return myRotatePresentation; }
 
index d6755692de701c523fdd0fd263684f20fb17bed6..0a4e61d17dc2e33eafd56fec5555056d36fbe35f 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "XCAFAnimObjects_Scale.hxx"
 
+#include <Message.hxx>
+
 //=======================================================================
 //function : XCAFAnimObjects_Scale
 //purpose  :
@@ -33,3 +35,43 @@ XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const NCollection_Array1<gp_XYZ>& t
   XCAFAnimObjects_Operation(theTimeStamps),
   myScalePresentation(theScale)
 {}
+
+//=======================================================================
+//function : XCAFAnimObjects_Scale
+//purpose  :
+//=======================================================================
+XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const NCollection_Array2<double>& theGeneralPresentation,
+                                             const NCollection_Array1<double>& theTimeStamps) :
+  XCAFAnimObjects_Operation(false),
+  myScalePresentation(1, theGeneralPresentation.RowLength())
+{
+  if (theGeneralPresentation.ColLength() != 3)
+  {
+    Message::SendWarning() << "Warning: XCAFAnimObjects_Scale: Incorrect XYZ general presentation";
+    return;
+  }
+  for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+  {
+    gp_XYZ aXYZ(theGeneralPresentation.Value(aRowInd, 1),
+                theGeneralPresentation.Value(aRowInd, 2),
+                theGeneralPresentation.Value(aRowInd, 3));
+    myScalePresentation.SetValue(aRowInd, aXYZ);
+  }
+}
+
+//=======================================================================
+//function : GeneralPresentation
+//purpose  :
+//=======================================================================
+NCollection_Array2<double> XCAFAnimObjects_Scale::GeneralPresentation() const
+{
+  NCollection_Array2<double> aRes(1, myScalePresentation.Length(), 1, 3);
+  for (int aRowInd = 1; aRowInd <= myScalePresentation.Length(); aRowInd++)
+  {
+    const gp_XYZ& aXYZ = myScalePresentation.Value(aRowInd);
+
+    aRes.SetValue(aRowInd, 1, aXYZ.X());
+    aRes.SetValue(aRowInd, 2, aXYZ.Y());
+    aRes.SetValue(aRowInd, 3, aXYZ.Z());
+  }
+}
index 955ab41a158fa261c583ecc489d42c6446d316ff..9e4250349ebe1a9cb628d41de213ca8c639e84c0 100644 (file)
@@ -29,9 +29,19 @@ public:
   Standard_EXPORT XCAFAnimObjects_Scale(const NCollection_Array1<gp_XYZ>& theScale,
                                         const NCollection_Array1<double>& theTimeStamps);
 
+  //! 
+  Standard_EXPORT XCAFAnimObjects_Scale(const NCollection_Array2<double>& theGeneralPresentation,
+                                        const NCollection_Array1<double>& theTimeStamps);
+
   //! 
   XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Scale; }
 
+  //! 
+  TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Scale"; }
+
+  //! 
+  Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
+
   //! 
   const NCollection_Array1<gp_XYZ>& ScalePresentation() const { return myScalePresentation; }
 
index 21fd9d0ab935b552774db0023cc17a887d6eb622..09a8586f627899377124f384434ac2ade73e8cda 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "XCAFAnimObjects_Skew.hxx"
 
+#include <Message.hxx>
+
 //=======================================================================
 //function : XCAFAnimObjects_Skew
 //purpose  :
@@ -33,3 +35,51 @@ XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array1<Skew>& theSk
   XCAFAnimObjects_Operation(theTimeStamps),
   mySkewPresentation(theSkew)
 {}
+
+//=======================================================================
+//function : XCAFAnimObjects_Skew
+//purpose  :
+//=======================================================================
+XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array2<double>& theGeneralPresentation,
+                                           const NCollection_Array1<double>& theTimeStamps) :
+  XCAFAnimObjects_Operation(false),
+  mySkewPresentation(1, theGeneralPresentation.RowLength())
+{
+  if (theGeneralPresentation.ColLength() != 7)
+  {
+    Message::SendWarning() << "Warning: XCAFAnimObjects_Skew: Incorrect Skew general presentation";
+    return;
+  }
+  for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+  {
+    Skew aSkew{ theGeneralPresentation.Value(aRowInd, 1),
+               {theGeneralPresentation.Value(aRowInd, 2),
+               theGeneralPresentation.Value(aRowInd, 3),
+               theGeneralPresentation.Value(aRowInd, 4) },
+               {theGeneralPresentation.Value(aRowInd, 5),
+               theGeneralPresentation.Value(aRowInd, 6),
+               theGeneralPresentation.Value(aRowInd, 7)} };
+    mySkewPresentation.SetValue(aRowInd, aSkew);
+  }
+}
+
+//=======================================================================
+//function : GeneralPresentation
+//purpose  :
+//=======================================================================
+NCollection_Array2<double> XCAFAnimObjects_Skew::GeneralPresentation() const
+{
+  NCollection_Array2<double> aRes(1, mySkewPresentation.Length(), 1, 7);
+  for (int aRowInd = 1; aRowInd <= mySkewPresentation.Length(); aRowInd++)
+  {
+    const Skew& aSkew = mySkewPresentation.Value(aRowInd);
+
+    aRes.SetValue(aRowInd, 1, aSkew.Angle);
+    aRes.SetValue(aRowInd, 2, aSkew.Axis1.X());
+    aRes.SetValue(aRowInd, 3, aSkew.Axis1.Y());
+    aRes.SetValue(aRowInd, 4, aSkew.Axis1.Z());
+    aRes.SetValue(aRowInd, 5, aSkew.Axis2.X());
+    aRes.SetValue(aRowInd, 6, aSkew.Axis2.Y());
+    aRes.SetValue(aRowInd, 7, aSkew.Axis2.Z());
+  }
+}
\ No newline at end of file
index 3489becdbacdad4692b7beb1d244a30bef76fb17..b08728874ce7c9dbed70e477281f8164b86509cd 100644 (file)
@@ -38,9 +38,19 @@ public:
   Standard_EXPORT XCAFAnimObjects_Skew(const NCollection_Array1<Skew>& theSkew,
                                        const NCollection_Array1<double>& theTimeStamps);
 
+  //! 
+  Standard_EXPORT XCAFAnimObjects_Skew(const NCollection_Array2<double>& theGeneralPresentation,
+                                       const NCollection_Array1<double>& theTimeStamps);
+
   //! 
   XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Skew; }
 
+  //! 
+  TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Skew"; }
+
+  //! 
+  Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
+
   //! 
   const NCollection_Array1<Skew>& SkewPresentation() const { return mySkewPresentation; }
 
index 5537b916fc6535fa3c0d524abca46226bb996618..ca0e5d3c05909c45d1e72f9f3030cc04a28239ed 100644 (file)
 
 #include "XCAFAnimObjects_Transform.hxx"
 
+#include <Message.hxx>
+
 //=======================================================================
 //function : XCAFAnimObjects_Transform
 //purpose  :
 //=======================================================================
-XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const gp_GTrsf& theTransform) :
+XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Mat4<double>& theTransform) :
   XCAFAnimObjects_Operation(false),
   myTransformPresentation(1, 1)
 {
@@ -28,8 +30,76 @@ XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const gp_GTrsf& theTransfor
 //function : XCAFAnimObjects_Transform
 //purpose  :
 //=======================================================================
-XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Array1<gp_GTrsf>& theTransform,
+XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Array1<NCollection_Mat4<double>>& theTransform,
                                                      const NCollection_Array1<double>& theTimeStamps) :
   XCAFAnimObjects_Operation(theTimeStamps),
   myTransformPresentation(theTransform)
 {}
+
+//=======================================================================
+//function : XCAFAnimObjects_Transform
+//purpose  :
+//=======================================================================
+XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Array2<double>& theGeneralPresentation,
+                                                     const NCollection_Array1<double>& theTimeStamps) :
+  XCAFAnimObjects_Operation(false),
+  myTransformPresentation(1, theGeneralPresentation.RowLength())
+{
+  if (theGeneralPresentation.ColLength() != 16)
+  {
+    Message::SendWarning() << "Warning: XCAFAnimObjects_Transform: Incorrect Mat4x4 general presentation";
+    return;
+  }
+  for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+  {
+    NCollection_Mat4<double> aTransform;
+    aTransform.SetRow(1, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 1),
+                                                  theGeneralPresentation.Value(aRowInd, 2),
+                                                  theGeneralPresentation.Value(aRowInd, 3),
+                                                  theGeneralPresentation.Value(aRowInd, 4)));
+    aTransform.SetRow(2, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 5),
+                                                  theGeneralPresentation.Value(aRowInd, 6),
+                                                  theGeneralPresentation.Value(aRowInd, 7),
+                                                  theGeneralPresentation.Value(aRowInd, 8)));
+    aTransform.SetRow(3, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 9),
+                                                  theGeneralPresentation.Value(aRowInd, 10),
+                                                  theGeneralPresentation.Value(aRowInd, 11),
+                                                  theGeneralPresentation.Value(aRowInd, 12)));
+    aTransform.SetRow(4, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 13),
+                                                  theGeneralPresentation.Value(aRowInd, 14),
+                                                  theGeneralPresentation.Value(aRowInd, 15),
+                                                  theGeneralPresentation.Value(aRowInd, 16)));
+
+    myTransformPresentation.SetValue(aRowInd, aTransform);
+  }
+}
+
+//=======================================================================
+//function : GeneralPresentation
+//purpose  :
+//=======================================================================
+NCollection_Array2<double> XCAFAnimObjects_Transform::GeneralPresentation() const
+{
+  NCollection_Array2<double> aRes(1, myTransformPresentation.Length(), 1, 16);
+  for (int aRowInd = 1; aRowInd <= myTransformPresentation.Length(); aRowInd++)
+  {
+    const NCollection_Mat4<double>& aTransform = myTransformPresentation.Value(aRowInd);
+
+    aRes.SetValue(aRowInd, 1, aTransform.GetValue(1, 1));
+    aRes.SetValue(aRowInd, 2, aTransform.GetValue(1, 2));
+    aRes.SetValue(aRowInd, 3, aTransform.GetValue(1, 3));
+    aRes.SetValue(aRowInd, 4, aTransform.GetValue(1, 4));
+    aRes.SetValue(aRowInd, 5, aTransform.GetValue(2, 1));
+    aRes.SetValue(aRowInd, 6, aTransform.GetValue(2, 2));
+    aRes.SetValue(aRowInd, 7, aTransform.GetValue(2, 3));
+    aRes.SetValue(aRowInd, 8, aTransform.GetValue(2, 4));
+    aRes.SetValue(aRowInd, 9, aTransform.GetValue(3, 1));
+    aRes.SetValue(aRowInd, 10, aTransform.GetValue(3, 2));
+    aRes.SetValue(aRowInd, 11, aTransform.GetValue(3, 3));
+    aRes.SetValue(aRowInd, 12, aTransform.GetValue(3, 4));
+    aRes.SetValue(aRowInd, 13, aTransform.GetValue(4, 1));
+    aRes.SetValue(aRowInd, 14, aTransform.GetValue(4, 2));
+    aRes.SetValue(aRowInd, 15, aTransform.GetValue(4, 3));
+    aRes.SetValue(aRowInd, 16, aTransform.GetValue(4, 4));
+  }
+}
\ No newline at end of file
index 4e3423d301c922dda096f9c9056a77907d0c12db..c23b54e35e353b484b0fe390fc4963e7b3bf8719 100644 (file)
@@ -15,7 +15,7 @@
 #define _XCAFAnimObjects_Transform_HeaderFile
 
 #include <XCAFAnimObjects_Operation.hxx>
-#include <gp_GTrsf.hxx>
+#include <NCollection_Mat4.hxx>
 
 //! 
 class XCAFAnimObjects_Transform : public XCAFAnimObjects_Operation
@@ -23,21 +23,31 @@ class XCAFAnimObjects_Transform : public XCAFAnimObjects_Operation
 public:
 
   //! 
-  Standard_EXPORT XCAFAnimObjects_Transform(const gp_GTrsf& theTransform);
+  Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Mat4<double>& theTransform);
 
   //! 
-  Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Array1<gp_GTrsf>& theTransform,
+  Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Array1<NCollection_Mat4<double>>& theTransform,
+                                            const NCollection_Array1<double>& theTimeStamps);
+
+  //! 
+  Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Array2<double>& theGeneralPresentation,
                                             const NCollection_Array1<double>& theTimeStamps);
 
   //! 
   XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Transform; }
 
   //! 
-  const NCollection_Array1<gp_GTrsf>& TransformPresentation() const { return myTransformPresentation; }
+  TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Transform"; }
+
+  //! 
+  Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
+
+  //! 
+  const NCollection_Array1<NCollection_Mat4<double>>& TransformPresentation() const { return myTransformPresentation; }
 
 private:
 
-  NCollection_Array1<gp_GTrsf> myTransformPresentation; //!< 
+  NCollection_Array1<NCollection_Mat4<double>> myTransformPresentation; //!< 
 };
 
 #endif // _XCAFAnimObjects_Transform_HeaderFile
index e66ed6ff88c1e254419697729991624dc49517f7..d5484eabbb783e05ae8c0bdb2992cc6cbe23ae5d 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "XCAFAnimObjects_Translate.hxx"
 
+#include <Message.hxx>
+
 //=======================================================================
 //function : XCAFAnimObjects_Translate
 //purpose  :
@@ -34,3 +36,43 @@ XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const NCollection_Array1<gp
   XCAFAnimObjects_Operation(theTimeStamps),
   myTranslatePresentation(theTranslate)
 {}
+
+//=======================================================================
+//function : XCAFAnimObjects_Translate
+//purpose  :
+//=======================================================================
+XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const NCollection_Array2<double>& theGeneralPresentation,
+                                                     const NCollection_Array1<double>& theTimeStamps) :
+  XCAFAnimObjects_Operation(false),
+  myTranslatePresentation(1, theGeneralPresentation.RowLength())
+{
+  if (theGeneralPresentation.ColLength() != 3)
+  {
+    Message::SendWarning() << "Warning: XCAFAnimObjects_Translate: Incorrect XYZ general presentation";
+    return;
+  }
+  for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+  {
+    gp_XYZ aXYZ(theGeneralPresentation.Value(aRowInd, 1),
+                theGeneralPresentation.Value(aRowInd, 2),
+                theGeneralPresentation.Value(aRowInd, 3));
+    myTranslatePresentation.SetValue(aRowInd, aXYZ);
+  }
+}
+
+//=======================================================================
+//function : GeneralPresentation
+//purpose  :
+//=======================================================================
+NCollection_Array2<double> XCAFAnimObjects_Translate::GeneralPresentation() const
+{
+  NCollection_Array2<double> aRes(1, myTranslatePresentation.Length(), 1, 3);
+  for (int aRowInd = 1; aRowInd <= myTranslatePresentation.Length(); aRowInd++)
+  {
+    const gp_XYZ& aXYZ = myTranslatePresentation.Value(aRowInd);
+
+    aRes.SetValue(aRowInd, 1, aXYZ.X());
+    aRes.SetValue(aRowInd, 2, aXYZ.Y());
+    aRes.SetValue(aRowInd, 3, aXYZ.Z());
+  }
+}
\ No newline at end of file
index 850fd75a1495a53f9c1c16e077eca007f973c1f6..3988505fec8b93765f925006c039ebfc989e76d2 100644 (file)
@@ -29,9 +29,19 @@ public:
   Standard_EXPORT XCAFAnimObjects_Translate(const NCollection_Array1<gp_XYZ>& theTranslate,
                                             const NCollection_Array1<double>& theTimeStamps);
 
+  //! 
+  Standard_EXPORT XCAFAnimObjects_Translate(const NCollection_Array2<double>& theGeneralPresentation,
+                                            const NCollection_Array1<double>& theTimeStamps);
+
   //! 
   XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Translate; }
 
+  //! 
+  TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Translate"; }
+
+  //! 
+  Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
+
   //! 
   const NCollection_Array1<gp_XYZ>& TranslatePresentation() const { return myTranslatePresentation; }