const NCollection_Array1<double>& TimeStamps() const { return myTimeStamps; }
//!
- bool HasTimeStamps() const { return myTimeStamps.IsEmpty(); }
+ bool HasTimeStamps() const { return !myTimeStamps.IsEmpty(); }
//!
Standard_EXPORT virtual XCAFAnimObjects_OperationType GetType() const = 0;
XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
- myOrientPresentation(1, theGeneralPresentation.RowLength())
+ myOrientPresentation(1, theGeneralPresentation.NbRows())
{
- if (theGeneralPresentation.ColLength() != 4)
+ if (theGeneralPresentation.NbColumns() != 4)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Orient: Incorrect Quaternion general presentation";
return;
}
- for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+ for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); aRowInd++)
{
gp_Quaternion aQuat(theGeneralPresentation.Value(aRowInd, 1),
theGeneralPresentation.Value(aRowInd, 2),
{
aNbDouble = 1;
}
- if (theGeneralPresentation.ColLength() != aNbDouble)
+ if (theGeneralPresentation.NbColumns() != aNbDouble)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Rotate: Incorrect Rotate presentation";
}
XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
- myScalePresentation(1, theGeneralPresentation.RowLength())
+ myScalePresentation(1, theGeneralPresentation.NbRows())
{
- if (theGeneralPresentation.ColLength() != 3)
+ if (theGeneralPresentation.NbColumns() != 3)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Scale: Incorrect XYZ general presentation";
return;
}
- for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+ for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); aRowInd++)
{
gp_XYZ aXYZ(theGeneralPresentation.Value(aRowInd, 1),
theGeneralPresentation.Value(aRowInd, 2),
//function : XCAFAnimObjects_Skew
//purpose :
//=======================================================================
-XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const Skew& theSkew) :
+XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const gp_XYZ& theSkew) :
XCAFAnimObjects_Operation(false),
mySkewPresentation(1, 1)
{
//function : XCAFAnimObjects_Skew
//purpose :
//=======================================================================
-XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array1<Skew>& theSkew,
+XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array1<gp_XYZ>& theSkew,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
mySkewPresentation(theSkew)
XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
- mySkewPresentation(1, theGeneralPresentation.RowLength())
+ mySkewPresentation(1, theGeneralPresentation.NbRows())
{
- if (theGeneralPresentation.ColLength() != 7)
+ if (theGeneralPresentation.NbColumns() != 3)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Skew: Incorrect Skew general presentation";
return;
}
- for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+ for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); 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)} };
+ gp_XYZ aSkew(theGeneralPresentation.Value(aRowInd, 1),
+ theGeneralPresentation.Value(aRowInd, 2),
+ theGeneralPresentation.Value(aRowInd, 3));
mySkewPresentation.SetValue(aRowInd, aSkew);
}
}
//=======================================================================
NCollection_Array2<double> XCAFAnimObjects_Skew::GeneralPresentation() const
{
- NCollection_Array2<double> aRes(1, mySkewPresentation.Length(), 1, 7);
+ NCollection_Array2<double> aRes(1, mySkewPresentation.Length(), 1, 3);
for (int aRowInd = 1; aRowInd <= mySkewPresentation.Length(); aRowInd++)
{
- const Skew& aSkew = mySkewPresentation.Value(aRowInd);
+ const gp_XYZ& 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());
+ aRes.SetValue(aRowInd, 1, aSkew.X());
+ aRes.SetValue(aRowInd, 2, aSkew.Y());
+ aRes.SetValue(aRowInd, 3, aSkew.Z());
}
return aRes;
}
\ No newline at end of file
#define _XCAFAnimObjects_Skew_HeaderFile
#include <XCAFAnimObjects_Operation.hxx>
-#include <gp_Quaternion.hxx>
-#include <gp_Ax3.hxx>
+#include <gp_XYZ.hxx>
+
//!
class XCAFAnimObjects_Skew : public XCAFAnimObjects_Operation
public:
//!
- struct Skew
- {
- double Angle = 0.; //!<
- gp_Dir Axis1; //!<
- gp_Dir Axis2; //!<
- };
-
- //!
- Standard_EXPORT XCAFAnimObjects_Skew(const Skew& theSkew);
+ Standard_EXPORT XCAFAnimObjects_Skew(const gp_XYZ& theSkew);
//!
- Standard_EXPORT XCAFAnimObjects_Skew(const NCollection_Array1<Skew>& theSkew,
+ Standard_EXPORT XCAFAnimObjects_Skew(const NCollection_Array1<gp_XYZ>& theSkew,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
//!
- const NCollection_Array1<Skew>& SkewPresentation() const { return mySkewPresentation; }
+ const NCollection_Array1<gp_XYZ>& SkewPresentation() const { return mySkewPresentation; }
private:
- NCollection_Array1<Skew> mySkewPresentation; //!<
+ NCollection_Array1<gp_XYZ> mySkewPresentation; //!<
};
#endif // _XCAFAnimObjects_Skew_HeaderFile
XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
- myTransformPresentation(1, theGeneralPresentation.RowLength())
+ myTransformPresentation(1, theGeneralPresentation.NbRows())
{
- if (theGeneralPresentation.ColLength() != 16)
+ if (theGeneralPresentation.NbColumns() != 16)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Transform: Incorrect Mat4x4 general presentation";
return;
}
- for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+ for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); aRowInd++)
{
NCollection_Mat4<double> aTransform;
- aTransform.SetRow(1, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 1),
+ aTransform.SetRow(0, 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),
+ aTransform.SetRow(1, 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),
+ aTransform.SetRow(2, 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),
+ aTransform.SetRow(3, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 13),
theGeneralPresentation.Value(aRowInd, 14),
theGeneralPresentation.Value(aRowInd, 15),
theGeneralPresentation.Value(aRowInd, 16)));
-
myTransformPresentation.SetValue(aRowInd, aTransform);
}
}
{
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));
+ aRes.SetValue(aRowInd, 1, aTransform.GetValue(0, 0));
+ aRes.SetValue(aRowInd, 2, aTransform.GetValue(0, 1));
+ aRes.SetValue(aRowInd, 3, aTransform.GetValue(0, 2));
+ aRes.SetValue(aRowInd, 4, aTransform.GetValue(0, 3));
+ aRes.SetValue(aRowInd, 5, aTransform.GetValue(1, 0));
+ aRes.SetValue(aRowInd, 6, aTransform.GetValue(1, 1));
+ aRes.SetValue(aRowInd, 7, aTransform.GetValue(1, 2));
+ aRes.SetValue(aRowInd, 8, aTransform.GetValue(1, 3));
+ aRes.SetValue(aRowInd, 9, aTransform.GetValue(2, 0));
+ aRes.SetValue(aRowInd, 10, aTransform.GetValue(2, 1));
+ aRes.SetValue(aRowInd, 11, aTransform.GetValue(2, 2));
+ aRes.SetValue(aRowInd, 12, aTransform.GetValue(2, 3));
+ aRes.SetValue(aRowInd, 13, aTransform.GetValue(3, 0));
+ aRes.SetValue(aRowInd, 14, aTransform.GetValue(3, 1));
+ aRes.SetValue(aRowInd, 15, aTransform.GetValue(3, 2));
+ aRes.SetValue(aRowInd, 16, aTransform.GetValue(3, 3));
}
return aRes;
}
\ No newline at end of file
XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
- myTranslatePresentation(1, theGeneralPresentation.RowLength())
+ myTranslatePresentation(1, theGeneralPresentation.NbRows())
{
- if (theGeneralPresentation.ColLength() != 3)
+ if (theGeneralPresentation.NbColumns() != 3)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Translate: Incorrect XYZ general presentation";
return;
}
- for (int aRowInd = 1; aRowInd <= theGeneralPresentation.RowLength(); aRowInd++)
+ for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); aRowInd++)
{
gp_XYZ aXYZ(theGeneralPresentation.Value(aRowInd, 1),
theGeneralPresentation.Value(aRowInd, 2),
{
continue;
}
- TCollection_AsciiString aOperName = aOperNameAttr->Get();
+ const TCollection_AsciiString aOperName = aOperNameAttr->Get();
aNewOperObj = new XCAFAnimObjects_CustomOperation(aValuesArr, aTimeStampsArr, aOperName);
break;
}
#include <TDF_Label.hxx>
#include <TDF_Tool.hxx>
#include <TDocStd_Document.hxx>
+#include <XCAFDoc_AnimationTool.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <XCAFDoc_ClippingPlaneTool.hxx>
#include <XCAFDoc_DimTolTool.hxx>
XCAFDoc_NotesTool::Set(NotesLabel(L));
XCAFDoc_ViewTool::Set(ViewsLabel(L));
XCAFDoc_ClippingPlaneTool::Set(ClippingPlanesLabel(L));
+ XCAFDoc_AnimationTool::Set(AnimationlLabel(L));
}
return A;
}
return aLabel;
}
+//=======================================================================
+//function : AnimationlLabel
+//purpose :
+//=======================================================================
+TDF_Label XCAFDoc_DocumentTool::AnimationlLabel(const TDF_Label& theLabel)
+{
+ TDF_Label aLabel = DocLabel(theLabel).FindChild(18, Standard_True);
+ TDataStd_Name::Set(aLabel, "Animation");
+ return aLabel;
+}
+
//=======================================================================
//function : ShapeTool
//purpose :
return XCAFDoc_VisMaterialTool::Set (VisMaterialLabel (theLabel));
}
+//=======================================================================
+//function : AnimationTool
+//purpose :
+//=======================================================================
+Handle(XCAFDoc_AnimationTool) XCAFDoc_DocumentTool::AnimationTool(const TDF_Label& theLabel)
+{
+ return XCAFDoc_AnimationTool::Set(AnimationlLabel(theLabel));
+}
+
//=======================================================================
//function : CheckVisMaterialTool
//purpose :
return aLabel.IsAttribute(XCAFDoc_VisMaterialTool::GetID());
}
+//=======================================================================
+//function : CheckAnimationTool
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDoc_DocumentTool::CheckAnimationTool(const TDF_Label& theAcces)
+{
+ TDF_Label aLabel = DocLabel(theAcces).FindChild(18, Standard_False);
+ if (aLabel.IsNull())
+ {
+ return Standard_False;
+ }
+ return aLabel.IsAttribute(XCAFDoc_AnimationTool::GetID());
+}
+
//=======================================================================
//function : LayerTool
//purpose :
//=======================================================================
-Handle(XCAFDoc_LayerTool) XCAFDoc_DocumentTool::LayerTool (const TDF_Label& acces)
+Handle(XCAFDoc_LayerTool) XCAFDoc_DocumentTool::LayerTool (const TDF_Label& acces)
{
return XCAFDoc_LayerTool::Set(LayersLabel(acces));
}
class Standard_GUID;
class TDF_Label;
class TDocStd_Document;
+class XCAFDoc_AnimationTool;
class XCAFDoc_ShapeTool;
class XCAFDoc_ColorTool;
class XCAFDoc_ClippingPlaneTool;
//! Returns sub-label of DocLabel() with tag 10.
Standard_EXPORT static TDF_Label VisMaterialLabel (const TDF_Label& theLabel);
+ //! Returns sub-label of DocLabel() with tag 18.
+ Standard_EXPORT static TDF_Label AnimationlLabel(const TDF_Label& theLabel);
+
//! Creates (if it does not exist) ShapeTool attribute on ShapesLabel().
Standard_EXPORT static Handle(XCAFDoc_ShapeTool) ShapeTool (const TDF_Label& acces);
//! Should not be confused with MaterialTool() defining physical/manufacturing materials.
Standard_EXPORT static Handle(XCAFDoc_VisMaterialTool) VisMaterialTool (const TDF_Label& theLabel);
+ //! Creates (if it does not exist) XCAFDoc_AnimationTool attribute on AnimationLabell().
+ Standard_EXPORT static Handle(XCAFDoc_AnimationTool) AnimationTool(const TDF_Label& theLabel);
+
//! Checks for the VisMaterialTool attribute on the label's document
//! Returns TRUE if Tool exists, ELSE if it has not been created
Standard_EXPORT static Standard_Boolean CheckVisMaterialTool(const TDF_Label& theAcces);
+ //! Checks for the AnimationTool attribute on the label's document
+ //! Returns TRUE if Tool exists, ELSE if it has not been created
+ Standard_EXPORT static Standard_Boolean CheckAnimationTool(const TDF_Label& theAcces);
+
//! Creates (if it does not exist) LayerTool attribute on LayersLabel().
Standard_EXPORT static Handle(XCAFDoc_LayerTool) LayerTool (const TDF_Label& acces);