diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx index 84bf085d0b..86be349ccb 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx @@ -17,11 +17,9 @@ //function : XCAFAnimObjects_CustomOperation //purpose : //======================================================================= -XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const int theObjectSize, - const TCollection_AsciiString& theCustomTypeName, - const NCollection_Array1& thePresentation) : +XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const NCollection_Array1& 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& thePresentation, - const NCollection_Array1& theTimeStamps) : +XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const NCollection_Array2& thePresentation, + const NCollection_Array1& theTimeStamps, + const TCollection_AsciiString& theCustomTypeName) : XCAFAnimObjects_Operation(theTimeStamps), - myObjectSize(theObjectSize), myTypeName(theCustomTypeName), myPresentation(thePresentation) {} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx index a7addbd3e7..9fe53c6632 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx @@ -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& thePresentation); + Standard_EXPORT XCAFAnimObjects_CustomOperation(const NCollection_Array1& thePresentation, + const TCollection_AsciiString& theCustomTypeName); //! - Standard_EXPORT XCAFAnimObjects_CustomOperation(const int theObjectSize, - const TCollection_AsciiString& theCustomTypeName, - const NCollection_Array2& thePresentation, - const NCollection_Array1& theTimeStamps); + Standard_EXPORT XCAFAnimObjects_CustomOperation(const NCollection_Array2& thePresentation, + const NCollection_Array1& theTimeStamps, + const TCollection_AsciiString& theCustomTypeName); //! XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Custom; } //! - int ObjectSize() const { return myObjectSize; } + NCollection_Array2 GeneralPresentation() const Standard_OVERRIDE { return myPresentation; } //! - const TCollection_AsciiString& CustomTypeName() const { return myTypeName; } + TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return myTypeName; } //! - const NCollection_Array2& CustomPresentation() const { return myPresentation; } + const NCollection_Array2& CustomPresentation() const { return myPresentation; } private: - int myObjectSize; //!< TCollection_AsciiString myTypeName; //!< - NCollection_Array2 myPresentation; //!< + NCollection_Array2 myPresentation; //!< }; #endif // _XCAFAnimObjects_CustomOperation_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx index bd7481a8f8..a550b46708 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx @@ -15,6 +15,8 @@ #define _XCAFAnimObjects_Operation_HeaderFile #include +#include +#include #include //! @@ -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 GeneralPresentation() const = 0; + private: bool myIsInverse; //! NCollection_Array1 myTimeStamps; //!< diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx index 2a4d732f34..1a36a7b707 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx @@ -13,13 +13,15 @@ #include +#include + //======================================================================= //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& theOrient, const NCollection_Array1& theTimeStamps) : - + XCAFAnimObjects_Operation(theTimeStamps), myOrientPresentation(theOrient) {} + +//======================================================================= +//function : XCAFAnimObjects_Orient +//purpose : +//======================================================================= +XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const NCollection_Array2& theGeneralPresentation, + const NCollection_Array1& 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 XCAFAnimObjects_Orient::GeneralPresentation() const +{ + NCollection_Array2 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 diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx index 1845afac3b..7549ba2651 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx @@ -29,9 +29,19 @@ public: Standard_EXPORT XCAFAnimObjects_Orient(const NCollection_Array1& theOrient, const NCollection_Array1& theTimeStamps); + //! + Standard_EXPORT XCAFAnimObjects_Orient(const NCollection_Array2& theGeneralPresentation, + const NCollection_Array1& theTimeStamps); + //! XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Orient; } + //! + TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Orient"; } + + //! + Standard_EXPORT NCollection_Array2 GeneralPresentation() const Standard_OVERRIDE; + //! const NCollection_Array1& OrientPresentation() const { return myOrientPresentation; } diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx index 0980ba7eaf..7a7c85ac9e 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx @@ -13,6 +13,8 @@ #include "XCAFAnimObjects_Rotate.hxx" +#include + //======================================================================= //function : XCAFAnimObjects_Rotate //purpose : @@ -52,3 +54,45 @@ XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate(const NCollection_Array1& theGeneralPresentation, + const NCollection_Array1& 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 XCAFAnimObjects_Rotate::GeneralPresentation() const +{ + NCollection_Array2 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()); + } +} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx index 3095a47512..e7483dd366 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx @@ -32,9 +32,19 @@ public: Standard_EXPORT XCAFAnimObjects_Rotate(const NCollection_Array1& theRotate, const NCollection_Array1& theTimeStamps); + //! + Standard_EXPORT XCAFAnimObjects_Rotate(const NCollection_Array2& theGeneralPresentation, + const NCollection_Array1& theTimeStamps); + //! XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Rotate; } + //! + TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Rotate"; } + + //! + Standard_EXPORT NCollection_Array2 GeneralPresentation() const Standard_OVERRIDE; + //! const NCollection_Array1& RotatePresentation() const { return myRotatePresentation; } diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx index d6755692de..0a4e61d17d 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx @@ -13,6 +13,8 @@ #include "XCAFAnimObjects_Scale.hxx" +#include + //======================================================================= //function : XCAFAnimObjects_Scale //purpose : @@ -33,3 +35,43 @@ XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const NCollection_Array1& t XCAFAnimObjects_Operation(theTimeStamps), myScalePresentation(theScale) {} + +//======================================================================= +//function : XCAFAnimObjects_Scale +//purpose : +//======================================================================= +XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const NCollection_Array2& theGeneralPresentation, + const NCollection_Array1& 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 XCAFAnimObjects_Scale::GeneralPresentation() const +{ + NCollection_Array2 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()); + } +} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx index 955ab41a15..9e4250349e 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx @@ -29,9 +29,19 @@ public: Standard_EXPORT XCAFAnimObjects_Scale(const NCollection_Array1& theScale, const NCollection_Array1& theTimeStamps); + //! + Standard_EXPORT XCAFAnimObjects_Scale(const NCollection_Array2& theGeneralPresentation, + const NCollection_Array1& theTimeStamps); + //! XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Scale; } + //! + TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Scale"; } + + //! + Standard_EXPORT NCollection_Array2 GeneralPresentation() const Standard_OVERRIDE; + //! const NCollection_Array1& ScalePresentation() const { return myScalePresentation; } diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx index 21fd9d0ab9..09a8586f62 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx @@ -13,6 +13,8 @@ #include "XCAFAnimObjects_Skew.hxx" +#include + //======================================================================= //function : XCAFAnimObjects_Skew //purpose : @@ -33,3 +35,51 @@ XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array1& theSk XCAFAnimObjects_Operation(theTimeStamps), mySkewPresentation(theSkew) {} + +//======================================================================= +//function : XCAFAnimObjects_Skew +//purpose : +//======================================================================= +XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array2& theGeneralPresentation, + const NCollection_Array1& 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 XCAFAnimObjects_Skew::GeneralPresentation() const +{ + NCollection_Array2 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 diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx index 3489becdba..b08728874c 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx @@ -38,9 +38,19 @@ public: Standard_EXPORT XCAFAnimObjects_Skew(const NCollection_Array1& theSkew, const NCollection_Array1& theTimeStamps); + //! + Standard_EXPORT XCAFAnimObjects_Skew(const NCollection_Array2& theGeneralPresentation, + const NCollection_Array1& theTimeStamps); + //! XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Skew; } + //! + TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Skew"; } + + //! + Standard_EXPORT NCollection_Array2 GeneralPresentation() const Standard_OVERRIDE; + //! const NCollection_Array1& SkewPresentation() const { return mySkewPresentation; } diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx index 5537b916fc..ca0e5d3c05 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx @@ -13,11 +13,13 @@ #include "XCAFAnimObjects_Transform.hxx" +#include + //======================================================================= //function : XCAFAnimObjects_Transform //purpose : //======================================================================= -XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const gp_GTrsf& theTransform) : +XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Mat4& 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& theTransform, +XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Array1>& theTransform, const NCollection_Array1& theTimeStamps) : XCAFAnimObjects_Operation(theTimeStamps), myTransformPresentation(theTransform) {} + +//======================================================================= +//function : XCAFAnimObjects_Transform +//purpose : +//======================================================================= +XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Array2& theGeneralPresentation, + const NCollection_Array1& 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 aTransform; + aTransform.SetRow(1, NCollection_Vec4(theGeneralPresentation.Value(aRowInd, 1), + theGeneralPresentation.Value(aRowInd, 2), + theGeneralPresentation.Value(aRowInd, 3), + theGeneralPresentation.Value(aRowInd, 4))); + aTransform.SetRow(2, NCollection_Vec4(theGeneralPresentation.Value(aRowInd, 5), + theGeneralPresentation.Value(aRowInd, 6), + theGeneralPresentation.Value(aRowInd, 7), + theGeneralPresentation.Value(aRowInd, 8))); + aTransform.SetRow(3, NCollection_Vec4(theGeneralPresentation.Value(aRowInd, 9), + theGeneralPresentation.Value(aRowInd, 10), + theGeneralPresentation.Value(aRowInd, 11), + theGeneralPresentation.Value(aRowInd, 12))); + aTransform.SetRow(4, NCollection_Vec4(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 XCAFAnimObjects_Transform::GeneralPresentation() const +{ + NCollection_Array2 aRes(1, myTransformPresentation.Length(), 1, 16); + for (int aRowInd = 1; aRowInd <= myTransformPresentation.Length(); aRowInd++) + { + const NCollection_Mat4& 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 diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx index 4e3423d301..c23b54e35e 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx @@ -15,7 +15,7 @@ #define _XCAFAnimObjects_Transform_HeaderFile #include -#include +#include //! 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& theTransform); //! - Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Array1& theTransform, + Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Array1>& theTransform, + const NCollection_Array1& theTimeStamps); + + //! + Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Array2& theGeneralPresentation, const NCollection_Array1& theTimeStamps); //! XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Transform; } //! - const NCollection_Array1& TransformPresentation() const { return myTransformPresentation; } + TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Transform"; } + + //! + Standard_EXPORT NCollection_Array2 GeneralPresentation() const Standard_OVERRIDE; + + //! + const NCollection_Array1>& TransformPresentation() const { return myTransformPresentation; } private: - NCollection_Array1 myTransformPresentation; //!< + NCollection_Array1> myTransformPresentation; //!< }; #endif // _XCAFAnimObjects_Transform_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx index e66ed6ff88..d5484eabbb 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx @@ -13,6 +13,8 @@ #include "XCAFAnimObjects_Translate.hxx" +#include + //======================================================================= //function : XCAFAnimObjects_Translate //purpose : @@ -34,3 +36,43 @@ XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const NCollection_Array1& theGeneralPresentation, + const NCollection_Array1& 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 XCAFAnimObjects_Translate::GeneralPresentation() const +{ + NCollection_Array2 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 diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx index 850fd75a14..3988505fec 100644 --- a/src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx @@ -29,9 +29,19 @@ public: Standard_EXPORT XCAFAnimObjects_Translate(const NCollection_Array1& theTranslate, const NCollection_Array1& theTimeStamps); + //! + Standard_EXPORT XCAFAnimObjects_Translate(const NCollection_Array2& theGeneralPresentation, + const NCollection_Array1& theTimeStamps); + //! XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Translate; } + //! + TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Translate"; } + + //! + Standard_EXPORT NCollection_Array2 GeneralPresentation() const Standard_OVERRIDE; + //! const NCollection_Array1& TranslatePresentation() const { return myTranslatePresentation; }