diff --git a/src/TKXCAF/PACKAGES b/src/TKXCAF/PACKAGES index 740c0b62d1..22dd3f0595 100755 --- a/src/TKXCAF/PACKAGES +++ b/src/TKXCAF/PACKAGES @@ -1,6 +1,7 @@ XCAFApp +XCAFAnimObjects XCAFDimTolObjects XCAFNoteObjects XCAFDoc XCAFPrs -XCAFView +XCAFView \ No newline at end of file diff --git a/src/XCAFAnimObjects/FILES b/src/XCAFAnimObjects/FILES new file mode 100644 index 0000000000..6d7d92bf91 --- /dev/null +++ b/src/XCAFAnimObjects/FILES @@ -0,0 +1,20 @@ +XCAFAnimObjects_AnimObject.cxx +XCAFAnimObjects_AnimObject.hxx +XCAFAnimObjects_CustomOperation.cxx +XCAFAnimObjects_CustomOperation.hxx +XCAFAnimObjects_InterpolationType.hxx +XCAFAnimObjects_Operation.cxx +XCAFAnimObjects_Operation.hxx +XCAFAnimObjects_OperationType.hxx +XCAFAnimObjects_Orient.cxx +XCAFAnimObjects_Orient.hxx +XCAFAnimObjects_Rotate.cxx +XCAFAnimObjects_Rotate.hxx +XCAFAnimObjects_Scale.cxx +XCAFAnimObjects_Scale.hxx +XCAFAnimObjects_Skew.cxx +XCAFAnimObjects_Skew.hxx +XCAFAnimObjects_Transform.cxx +XCAFAnimObjects_Transform.hxx +XCAFAnimObjects_Translate.cxx +XCAFAnimObjects_Translate.hxx diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.cxx new file mode 100644 index 0000000000..81462a47a4 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.cxx @@ -0,0 +1,132 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE(XCAFDoc_AnimationTool, TDataStd_GenericEmpty, "xcaf", "AnimationTool") + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& XCAFDoc_AnimationTool::GetID() +{ + static Standard_GUID ShapeToolID("9E9914DD-154A-4E17-B89B-3E33CCF67BD0"); + return ShapeToolID; +} + +//======================================================================= +//function : Set +//purpose : +//======================================================================= +Handle(XCAFDoc_AnimationTool) XCAFDoc_AnimationTool::Set(const TDF_Label& theLabel) +{ + Handle(XCAFDoc_AnimationTool) anAnimTool; + if (!theLabel.FindAttribute(XCAFDoc_AnimationTool::GetID(), anAnimTool)) { + anAnimTool = new XCAFDoc_AnimationTool(); + theLabel.AddAttribute(anAnimTool); + } + return anAnimTool; +} + +//======================================================================= +//function : Constructor +//purpose : +//======================================================================= +XCAFDoc_AnimationTool::XCAFDoc_AnimationTool() +{} + +//======================================================================= +//function : ID +//purpose : +//======================================================================= +const Standard_GUID& XCAFDoc_AnimationTool::ID() const +{ + return GetID(); +} + +//======================================================================= +//function : BaseLabel +//purpose : +//======================================================================= +TDF_Label XCAFDoc_AnimationTool::BaseLabel() const +{ + return Label(); +} + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +Standard_OStream& XCAFDoc_AnimationTool::Dump(Standard_OStream& theOStream, + const Standard_Boolean theDepth) const +{ + (void)theOStream; + (void)theDepth; +} + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +Standard_OStream& XCAFDoc_AnimationTool::Dump(Standard_OStream& theDumpLog) const +{ + TDF_Attribute::Dump(theDumpLog); + Dump(theDumpLog, Standard_False); + return theDumpLog; +} + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void XCAFDoc_AnimationTool::DumpJson(Standard_OStream& theOStream, + Standard_Integer theDepth) const +{ + (void)theOStream; + (void)theDepth; +} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.hxx new file mode 100644 index 0000000000..93a3dc1163 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.hxx @@ -0,0 +1,83 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFDoc_AnimationTool_HeaderFile +#define _XCAFDoc_AnimationTool_HeaderFile + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Standard_GUID; +class TDF_Label; +class TopoDS_Shape; +class TopLoc_Location; +class XCAFDoc_GraphNode; + +//! A tool to store shapes in an XDE +//! document in the form of assembly structure, and to maintain this structure. +//! Attribute containing Shapes section of DECAF document. +//! Provide tools for management of Shapes section. +//! The API provided by this class allows to work with this +//! structure regardless of its low-level implementation. +//! All the shapes are stored on child labels of a main label which is +//! XCAFDoc_DocumentTool::LabelShapes(). The label for assembly also has +//! sub-labels, each of which represents the instance of +//! another shape in that assembly (component). Such sub-label +//! stores reference to the label of the original shape in the form +//! of TDataStd_TreeNode with GUID XCAFDoc::ShapeRefGUID(), and its +//! location encapsulated into the NamedShape. +//! For correct work with an XDE document, it is necessary to use +//! methods for analysis and methods for working with shapes. +class XCAFDoc_AnimationTool : public TDataStd_GenericEmpty +{ + +public: + + Standard_EXPORT static const Standard_GUID& GetID(); + + //! Create (if not exist) ShapeTool from XCAFDoc on . + Standard_EXPORT static Handle(XCAFDoc_AnimationTool) Set (const TDF_Label& theLabel); + + //! Creates an empty tool + //! Creates a tool to work with a document + //! Attaches to label XCAFDoc::LabelShapes() + Standard_EXPORT XCAFDoc_AnimationTool(); + + //! returns the label under which shapes are stored + Standard_EXPORT TDF_Label BaseLabel() const; + + Standard_EXPORT Standard_OStream& Dump (Standard_OStream& theOStream, const Standard_Boolean theDepth) const; + + Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + + Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; + + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + + DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_AnimationTool,TDataStd_GenericEmpty) + +}; + +#endif // _XCAFDoc_AnimationTool_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx new file mode 100644 index 0000000000..84bf085d0b --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx @@ -0,0 +1,46 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include "XCAFAnimObjects_CustomOperation.hxx" + +//======================================================================= +//function : XCAFAnimObjects_CustomOperation +//purpose : +//======================================================================= +XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const int theObjectSize, + const TCollection_AsciiString& theCustomTypeName, + const NCollection_Array1& thePresentation) : + XCAFAnimObjects_Operation(false), + myObjectSize(theObjectSize), + myTypeName(theCustomTypeName), + myPresentation(1, 1, thePresentation.Lower(), thePresentation.Upper()) +{ + for (int anInd = thePresentation.Lower(); anInd <= thePresentation.Upper(); anInd++) + { + myPresentation.SetValue(1, anInd, thePresentation.Value(anInd)); + } +} + +//======================================================================= +//function : XCAFAnimObjects_CustomOperation +//purpose : +//======================================================================= +XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const int theObjectSize, + const TCollection_AsciiString& theCustomTypeName, + const NCollection_Array2& thePresentation, + const NCollection_Array1& theTimeStamps) : + XCAFAnimObjects_Operation(theTimeStamps), + myObjectSize(theObjectSize), + myTypeName(theCustomTypeName), + myPresentation(thePresentation) +{} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx new file mode 100644 index 0000000000..a7addbd3e7 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx @@ -0,0 +1,56 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_CustomOperation_HeaderFile +#define _XCAFAnimObjects_CustomOperation_HeaderFile + +#include +#include +#include + +//! +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 int theObjectSize, + const TCollection_AsciiString& theCustomTypeName, + const NCollection_Array2& thePresentation, + const NCollection_Array1& theTimeStamps); + + //! + XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Custom; } + + //! + int ObjectSize() const { return myObjectSize; } + + //! + const TCollection_AsciiString& CustomTypeName() const { return myTypeName; } + + //! + const NCollection_Array2& CustomPresentation() const { return myPresentation; } + +private: + + int myObjectSize; //!< + TCollection_AsciiString myTypeName; //!< + NCollection_Array2 myPresentation; //!< +}; + +#endif // _XCAFAnimObjects_CustomOperation_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_InterpolationType.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_InterpolationType.hxx new file mode 100644 index 0000000000..1c84dda06e --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_InterpolationType.hxx @@ -0,0 +1,27 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_InterpolationType_HeaderFile +#define _XCAFAnimObjects_InterpolationType_HeaderFile + +//! Interpolation is a description of behavior between timestamps +enum XCAFAnimObjects_InterpolationType +{ + XCAFAnimObjects_InterpolationType_Custom = 0, //!< User-defined interpolation + XCAFAnimObjects_InterpolationType_Step, //!< No interpolation, just apply timestamps step by step + XCAFAnimObjects_InterpolationType_Linear, //!< Linear dependency from t_(i) to t_(i+1) + XCAFAnimObjects_InterpolationType_CubicSpline, //!< Cubic dependency from t_(i) to t_(i+1) + XCAFAnimObjects_InterpolationType_Static //!< No animation in this time period, use the closest static value +}; + +#endif // _XCAFAnimObjects_InterpolationType_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Operation.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Operation.cxx new file mode 100644 index 0000000000..5bf1ee7b3c --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Operation.cxx @@ -0,0 +1,32 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +//======================================================================= +//function : XCAFAnimObjects_Operation +//purpose : +//======================================================================= +XCAFAnimObjects_Operation::XCAFAnimObjects_Operation(const bool theIsInverse) : + myIsInverse(theIsInverse) +{} + +//======================================================================= +//function : XCAFAnimObjects_Operation +//purpose : +//======================================================================= +XCAFAnimObjects_Operation::XCAFAnimObjects_Operation(const NCollection_Array1& theTimeStamps, + const bool theIsInverse) : + myIsInverse(theIsInverse), + myTimeStamps(theTimeStamps) +{} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx new file mode 100644 index 0000000000..bd7481a8f8 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx @@ -0,0 +1,52 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_Operation_HeaderFile +#define _XCAFAnimObjects_Operation_HeaderFile + +#include +#include + +//! +class XCAFAnimObjects_Operation +{ +public: + + //! + Standard_EXPORT XCAFAnimObjects_Operation(const bool theIsInverse = false); + + //! + Standard_EXPORT XCAFAnimObjects_Operation(const NCollection_Array1& theTimeStamps, + const bool theIsInverse = false); + + //! + const NCollection_Array1& TimeStamps() const { return myTimeStamps; } + + //! + bool HasTimeStamps() const { return myTimeStamps.IsEmpty(); } + + //! + Standard_EXPORT virtual XCAFAnimObjects_OperationType GetType() const = 0; + + //! + bool IsInverse() const { return myIsInverse; } + + //! + void SetInverse(const bool theIsInverse) { myIsInverse = theIsInverse; } + +private: + bool myIsInverse; //! + NCollection_Array1 myTimeStamps; //!< +}; + +#endif // _XCAFAnimObjects_Operation_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_OperationType.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_OperationType.hxx new file mode 100644 index 0000000000..6842dcccc7 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_OperationType.hxx @@ -0,0 +1,29 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_OperationType_HeaderFile +#define _XCAFAnimObjects_OperationType_HeaderFile + +//! +enum XCAFAnimObjects_OperationType +{ + XCAFAnimObjects_OperationType_Custom = 0, //!< + XCAFAnimObjects_OperationType_Orient, //!< + XCAFAnimObjects_OperationType_Rotate, //!< + XCAFAnimObjects_OperationType_Scale, //!< + XCAFAnimObjects_OperationType_Skew, //!< + XCAFAnimObjects_OperationType_Transform, //!< + XCAFAnimObjects_OperationType_Translate //!< +}; + +#endif // _XCAFAnimObjects_OperationType_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx new file mode 100644 index 0000000000..2a4d732f34 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx @@ -0,0 +1,36 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +//======================================================================= +//function : XCAFAnimObjects_Orient +//purpose : +//======================================================================= +XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const gp_Quaternion& theOrient) : + XCAFAnimObjects_Operation(false), + myOrientPresentation(1,1) +{ + myOrientPresentation.SetValue(1, theOrient); +} + +//======================================================================= +//function : XCAFAnimObjects_Orient +//purpose : +//======================================================================= +XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const NCollection_Array1& theOrient, + const NCollection_Array1& theTimeStamps) : + + XCAFAnimObjects_Operation(theTimeStamps), + myOrientPresentation(theOrient) +{} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx new file mode 100644 index 0000000000..1845afac3b --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx @@ -0,0 +1,43 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_Orient_HeaderFile +#define _XCAFAnimObjects_Orient_HeaderFile + +#include +#include + +//! +class XCAFAnimObjects_Orient : public XCAFAnimObjects_Operation +{ +public: + + //! + Standard_EXPORT XCAFAnimObjects_Orient(const gp_Quaternion& theOrient); + + //! + Standard_EXPORT XCAFAnimObjects_Orient(const NCollection_Array1& theOrient, + const NCollection_Array1& theTimeStamps); + + //! + XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Orient; } + + //! + const NCollection_Array1& OrientPresentation() const { return myOrientPresentation; } + +private: + + NCollection_Array1 myOrientPresentation; //!< +}; + +#endif // _XCAFAnimObjects_Orient_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx new file mode 100644 index 0000000000..0980ba7eaf --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx @@ -0,0 +1,54 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include "XCAFAnimObjects_Rotate.hxx" + +//======================================================================= +//function : XCAFAnimObjects_Rotate +//purpose : +//======================================================================= +XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate(const gp_Quaternion& theRotate) : + XCAFAnimObjects_Operation(false), + myRotatePresentation(1, 1) +{ + myRotatePresentation.SetValue(1, theRotate); +} + +//======================================================================= +//function : XCAFAnimObjects_Rotate +//purpose : +//======================================================================= +XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate(const gp_XYZ& theRotate) : + XCAFAnimObjects_Operation(false), + myRotatePresentation(1, 1) +{ + // Convert angles from degrees to radians and create quaternions for each rotation. + gp_Quaternion aQuaternionX(gp_Dir(1, 0, 0), theRotate.X() * M_PI / 180.0); + gp_Quaternion aQuaternionY(gp_Dir(0, 1, 0), theRotate.Y() * M_PI / 180.0); + gp_Quaternion aQuaternionZ(gp_Dir(0, 0, 1), theRotate.Z() * M_PI / 180.0); + + // Combine the rotations. The order depends on the rotation order in the original Euler angles. + gp_Quaternion aCombinedQuaternion = aQuaternionX * aQuaternionY * aQuaternionZ; + + myRotatePresentation.SetValue(1, aCombinedQuaternion); +} + +//======================================================================= +//function : XCAFAnimObjects_Rotate +//purpose : +//======================================================================= +XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate(const NCollection_Array1& theRotate, + const NCollection_Array1& theTimeStamps) : + XCAFAnimObjects_Operation(theTimeStamps), + myRotatePresentation(theRotate) +{} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx new file mode 100644 index 0000000000..3095a47512 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx @@ -0,0 +1,46 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_Rotate_HeaderFile +#define _XCAFAnimObjects_Rotate_HeaderFile + +#include +#include + +//! +class XCAFAnimObjects_Rotate : public XCAFAnimObjects_Operation +{ +public: + + //! + Standard_EXPORT XCAFAnimObjects_Rotate(const gp_Quaternion& theRotate); + + //! + Standard_EXPORT XCAFAnimObjects_Rotate(const gp_XYZ& theRotate); + + //! + Standard_EXPORT XCAFAnimObjects_Rotate(const NCollection_Array1& theRotate, + const NCollection_Array1& theTimeStamps); + + //! + XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Rotate; } + + //! + const NCollection_Array1& RotatePresentation() const { return myRotatePresentation; } + +private: + + NCollection_Array1 myRotatePresentation; //!< +}; + +#endif // _XCAFAnimObjects_Rotate_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx new file mode 100644 index 0000000000..d6755692de --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx @@ -0,0 +1,35 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include "XCAFAnimObjects_Scale.hxx" + +//======================================================================= +//function : XCAFAnimObjects_Scale +//purpose : +//======================================================================= +XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const gp_XYZ& theScale) : + XCAFAnimObjects_Operation(false), + myScalePresentation(1, 1) +{ + myScalePresentation.SetValue(1, theScale); +} + +//======================================================================= +//function : XCAFAnimObjects_Scale +//purpose : +//======================================================================= +XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const NCollection_Array1& theScale, + const NCollection_Array1& theTimeStamps) : + XCAFAnimObjects_Operation(theTimeStamps), + myScalePresentation(theScale) +{} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx new file mode 100644 index 0000000000..955ab41a15 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx @@ -0,0 +1,43 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_Scale_HeaderFile +#define _XCAFAnimObjects_Scale_HeaderFile + +#include +#include + +//! +class XCAFAnimObjects_Scale : public XCAFAnimObjects_Operation +{ +public: + + //! + Standard_EXPORT XCAFAnimObjects_Scale(const gp_XYZ& theScale); + + //! + Standard_EXPORT XCAFAnimObjects_Scale(const NCollection_Array1& theScale, + const NCollection_Array1& theTimeStamps); + + //! + XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Scale; } + + //! + const NCollection_Array1& ScalePresentation() const { return myScalePresentation; } + +private: + + NCollection_Array1 myScalePresentation; //!< +}; + +#endif // _XCAFAnimObjects_Scale_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx new file mode 100644 index 0000000000..21fd9d0ab9 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx @@ -0,0 +1,35 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include "XCAFAnimObjects_Skew.hxx" + +//======================================================================= +//function : XCAFAnimObjects_Skew +//purpose : +//======================================================================= +XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const Skew& theSkew) : + XCAFAnimObjects_Operation(false), + mySkewPresentation(1, 1) +{ + mySkewPresentation.SetValue(1, theSkew); +} + +//======================================================================= +//function : XCAFAnimObjects_Skew +//purpose : +//======================================================================= +XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array1& theSkew, + const NCollection_Array1& theTimeStamps) : + XCAFAnimObjects_Operation(theTimeStamps), + mySkewPresentation(theSkew) +{} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx new file mode 100644 index 0000000000..3489becdba --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx @@ -0,0 +1,52 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_Skew_HeaderFile +#define _XCAFAnimObjects_Skew_HeaderFile + +#include +#include +#include + +//! +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 NCollection_Array1& theSkew, + const NCollection_Array1& theTimeStamps); + + //! + XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Skew; } + + //! + const NCollection_Array1& SkewPresentation() const { return mySkewPresentation; } + +private: + + NCollection_Array1 mySkewPresentation; //!< +}; + +#endif // _XCAFAnimObjects_Skew_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx new file mode 100644 index 0000000000..5537b916fc --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx @@ -0,0 +1,35 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include "XCAFAnimObjects_Transform.hxx" + +//======================================================================= +//function : XCAFAnimObjects_Transform +//purpose : +//======================================================================= +XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const gp_GTrsf& theTransform) : + XCAFAnimObjects_Operation(false), + myTransformPresentation(1, 1) +{ + myTransformPresentation.SetValue(1, theTransform); +} + +//======================================================================= +//function : XCAFAnimObjects_Transform +//purpose : +//======================================================================= +XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Array1& theTransform, + const NCollection_Array1& theTimeStamps) : + XCAFAnimObjects_Operation(theTimeStamps), + myTransformPresentation(theTransform) +{} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx new file mode 100644 index 0000000000..4e3423d301 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx @@ -0,0 +1,43 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_Transform_HeaderFile +#define _XCAFAnimObjects_Transform_HeaderFile + +#include +#include + +//! +class XCAFAnimObjects_Transform : public XCAFAnimObjects_Operation +{ +public: + + //! + Standard_EXPORT XCAFAnimObjects_Transform(const gp_GTrsf& theTransform); + + //! + Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Array1& theTransform, + const NCollection_Array1& theTimeStamps); + + //! + XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Transform; } + + //! + const NCollection_Array1& TransformPresentation() const { return myTransformPresentation; } + +private: + + NCollection_Array1 myTransformPresentation; //!< +}; + +#endif // _XCAFAnimObjects_Transform_HeaderFile diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx b/src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx new file mode 100644 index 0000000000..e66ed6ff88 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx @@ -0,0 +1,36 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include "XCAFAnimObjects_Translate.hxx" + +//======================================================================= +//function : XCAFAnimObjects_Translate +//purpose : +//======================================================================= +XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const gp_XYZ& theTranslate) : + XCAFAnimObjects_Operation(false), + myTranslatePresentation(1, 1) +{ + myTranslatePresentation.SetValue(1, theTranslate); +} + +//======================================================================= +//function : XCAFAnimObjects_Translate +//purpose : +//======================================================================= +XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const NCollection_Array1& theTranslate, + const NCollection_Array1& theTimeStamps) : + + XCAFAnimObjects_Operation(theTimeStamps), + myTranslatePresentation(theTranslate) +{} diff --git a/src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx b/src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx new file mode 100644 index 0000000000..850fd75a14 --- /dev/null +++ b/src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx @@ -0,0 +1,43 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFAnimObjects_Translate_HeaderFile +#define _XCAFAnimObjects_Translate_HeaderFile + +#include +#include + +//! +class XCAFAnimObjects_Translate : public XCAFAnimObjects_Operation +{ +public: + + //! + Standard_EXPORT XCAFAnimObjects_Translate(const gp_XYZ& theTranslate); + + //! + Standard_EXPORT XCAFAnimObjects_Translate(const NCollection_Array1& theTranslate, + const NCollection_Array1& theTimeStamps); + + //! + XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Translate; } + + //! + const NCollection_Array1& TranslatePresentation() const { return myTranslatePresentation; } + +private: + + NCollection_Array1 myTranslatePresentation; //!< +}; + +#endif // _XCAFAnimObjects_Translate_HeaderFile diff --git a/src/XCAFDoc/FILES b/src/XCAFDoc/FILES index 2398d99643..d9031a1eb3 100755 --- a/src/XCAFDoc/FILES +++ b/src/XCAFDoc/FILES @@ -2,6 +2,10 @@ FILES GUID.txt XCAFDoc.cxx XCAFDoc.hxx +XCAFDoc_Animation.cxx +XCAFDoc_Animation.hxx +XCAFDoc_AnimationTool.cxx +XCAFDoc_AnimationTool.hxx XCAFDoc_AssemblyItemId.cxx XCAFDoc_AssemblyItemId.hxx XCAFDoc_AssemblyItemRef.cxx diff --git a/src/XCAFDoc/XCAFDoc_Animation.cxx b/src/XCAFDoc/XCAFDoc_Animation.cxx new file mode 100644 index 0000000000..b82722b8a2 --- /dev/null +++ b/src/XCAFDoc/XCAFDoc_Animation.cxx @@ -0,0 +1,114 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_DERIVED_ATTRIBUTE(XCAFDoc_Animation, TDataStd_GenericEmpty) +enum ChildLab +{ + ChildLab_Begin = 1, + ChildLab_Type = ChildLab_Begin, + + ChildLab_End +}; + +//======================================================================= +//function : XCAFDoc_Animation +//purpose : +//======================================================================= +XCAFDoc_Animation::XCAFDoc_Animation() +{ +} + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& XCAFDoc_Animation::GetID() +{ + static Standard_GUID DGTID("58ed092c-44de-11d8-8776-001083004c77"); + //static Standard_GUID ID("efd212e9-6dfd-11d4-b9c8-0060b0ee281b"); + return DGTID; + //return ID; +} + +//======================================================================= +//function : Set +//purpose : +//======================================================================= +Handle(XCAFDoc_Animation) XCAFDoc_Animation::Set(const TDF_Label& theLabel) +{ + Handle(XCAFDoc_Animation) A; + if (!theLabel.FindAttribute(XCAFDoc_Animation::GetID(), A)) { + A = new XCAFDoc_Animation(); + theLabel.AddAttribute(A); + } + return A; +} + +//======================================================================= +//function : SetObject +//purpose : +//======================================================================= +void XCAFDoc_Animation::SetObject(const Handle(XCAFAnimObjects_AnimObject)& theObject) +{ + Backup(); + +} + +//======================================================================= +//function : GetObject +//purpose : +//======================================================================= +Handle(XCAFAnimObjects_AnimObject) XCAFDoc_Animation::GetObject() const +{ + Handle(XCAFAnimObjects_AnimObject) anObj = new XCAFAnimObjects_AnimObject(); + + return anObj; +} + +//======================================================================= +//function : ID +//purpose : +//======================================================================= + +const Standard_GUID& XCAFDoc_Animation::ID() const +{ + return GetID(); +} + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void XCAFDoc_Animation::DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth) const +{ + +} diff --git a/src/XCAFDoc/XCAFDoc_Animation.hxx b/src/XCAFDoc/XCAFDoc_Animation.hxx new file mode 100644 index 0000000000..1199f56b7c --- /dev/null +++ b/src/XCAFDoc/XCAFDoc_Animation.hxx @@ -0,0 +1,55 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFDoc_Animation_HeaderFile +#define _XCAFDoc_Animation_HeaderFile + +#include + +class Standard_GUID; +class TDF_Label; +class XCAFAnimObjects_AnimObject; + +// resolve name collisions with WinAPI headers +#ifdef GetObject + #undef GetObject +#endif + +//! +class XCAFDoc_Animation : public TDataStd_GenericEmpty +{ +public: + + Standard_EXPORT XCAFDoc_Animation(); + + Standard_EXPORT static const Standard_GUID& GetID(); + + Standard_EXPORT static Handle(XCAFDoc_Animation) Set (const TDF_Label& theLabel); + + Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; + + //! Updates parent's label and its sub-labels with data taken from theDimensionObject. + //! Old data associated with the label will be lost. + Standard_EXPORT void SetObject (const Handle(XCAFAnimObjects_AnimObject)& theDimensionObject); + + //! Returns dimension object data taken from the parent's label and its sub-labels. + Standard_EXPORT Handle(XCAFAnimObjects_AnimObject) GetObject() const; + + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + + DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_Animation,TDataStd_GenericEmpty) + +}; + +#endif diff --git a/src/XCAFDoc/XCAFDoc_AnimationTool.cxx b/src/XCAFDoc/XCAFDoc_AnimationTool.cxx new file mode 100644 index 0000000000..81462a47a4 --- /dev/null +++ b/src/XCAFDoc/XCAFDoc_AnimationTool.cxx @@ -0,0 +1,132 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE(XCAFDoc_AnimationTool, TDataStd_GenericEmpty, "xcaf", "AnimationTool") + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& XCAFDoc_AnimationTool::GetID() +{ + static Standard_GUID ShapeToolID("9E9914DD-154A-4E17-B89B-3E33CCF67BD0"); + return ShapeToolID; +} + +//======================================================================= +//function : Set +//purpose : +//======================================================================= +Handle(XCAFDoc_AnimationTool) XCAFDoc_AnimationTool::Set(const TDF_Label& theLabel) +{ + Handle(XCAFDoc_AnimationTool) anAnimTool; + if (!theLabel.FindAttribute(XCAFDoc_AnimationTool::GetID(), anAnimTool)) { + anAnimTool = new XCAFDoc_AnimationTool(); + theLabel.AddAttribute(anAnimTool); + } + return anAnimTool; +} + +//======================================================================= +//function : Constructor +//purpose : +//======================================================================= +XCAFDoc_AnimationTool::XCAFDoc_AnimationTool() +{} + +//======================================================================= +//function : ID +//purpose : +//======================================================================= +const Standard_GUID& XCAFDoc_AnimationTool::ID() const +{ + return GetID(); +} + +//======================================================================= +//function : BaseLabel +//purpose : +//======================================================================= +TDF_Label XCAFDoc_AnimationTool::BaseLabel() const +{ + return Label(); +} + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +Standard_OStream& XCAFDoc_AnimationTool::Dump(Standard_OStream& theOStream, + const Standard_Boolean theDepth) const +{ + (void)theOStream; + (void)theDepth; +} + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +Standard_OStream& XCAFDoc_AnimationTool::Dump(Standard_OStream& theDumpLog) const +{ + TDF_Attribute::Dump(theDumpLog); + Dump(theDumpLog, Standard_False); + return theDumpLog; +} + +//======================================================================= +//function : DumpJson +//purpose : +//======================================================================= +void XCAFDoc_AnimationTool::DumpJson(Standard_OStream& theOStream, + Standard_Integer theDepth) const +{ + (void)theOStream; + (void)theDepth; +} diff --git a/src/XCAFDoc/XCAFDoc_AnimationTool.hxx b/src/XCAFDoc/XCAFDoc_AnimationTool.hxx new file mode 100644 index 0000000000..93a3dc1163 --- /dev/null +++ b/src/XCAFDoc/XCAFDoc_AnimationTool.hxx @@ -0,0 +1,83 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XCAFDoc_AnimationTool_HeaderFile +#define _XCAFDoc_AnimationTool_HeaderFile + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Standard_GUID; +class TDF_Label; +class TopoDS_Shape; +class TopLoc_Location; +class XCAFDoc_GraphNode; + +//! A tool to store shapes in an XDE +//! document in the form of assembly structure, and to maintain this structure. +//! Attribute containing Shapes section of DECAF document. +//! Provide tools for management of Shapes section. +//! The API provided by this class allows to work with this +//! structure regardless of its low-level implementation. +//! All the shapes are stored on child labels of a main label which is +//! XCAFDoc_DocumentTool::LabelShapes(). The label for assembly also has +//! sub-labels, each of which represents the instance of +//! another shape in that assembly (component). Such sub-label +//! stores reference to the label of the original shape in the form +//! of TDataStd_TreeNode with GUID XCAFDoc::ShapeRefGUID(), and its +//! location encapsulated into the NamedShape. +//! For correct work with an XDE document, it is necessary to use +//! methods for analysis and methods for working with shapes. +class XCAFDoc_AnimationTool : public TDataStd_GenericEmpty +{ + +public: + + Standard_EXPORT static const Standard_GUID& GetID(); + + //! Create (if not exist) ShapeTool from XCAFDoc on . + Standard_EXPORT static Handle(XCAFDoc_AnimationTool) Set (const TDF_Label& theLabel); + + //! Creates an empty tool + //! Creates a tool to work with a document + //! Attaches to label XCAFDoc::LabelShapes() + Standard_EXPORT XCAFDoc_AnimationTool(); + + //! returns the label under which shapes are stored + Standard_EXPORT TDF_Label BaseLabel() const; + + Standard_EXPORT Standard_OStream& Dump (Standard_OStream& theOStream, const Standard_Boolean theDepth) const; + + Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& theOStream) const Standard_OVERRIDE; + + Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; + + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; + + DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_AnimationTool,TDataStd_GenericEmpty) + +}; + +#endif // _XCAFDoc_AnimationTool_HeaderFile diff --git a/src/XCAFDoc/XCAFDoc_Area.cxx b/src/XCAFDoc/XCAFDoc_Area.cxx index 47d05bc156..725b51805a 100644 --- a/src/XCAFDoc/XCAFDoc_Area.cxx +++ b/src/XCAFDoc/XCAFDoc_Area.cxx @@ -1,6 +1,4 @@ -// Created on: 2000-09-08 -// Created by: data exchange team -// Copyright (c) 2000-2014 OPEN CASCADE SAS +// Copyright (c) 2000-2023 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. //