]> OCCT Git - occt-copy.git/commitdiff
refs 474:Possibility to create and play animations
authornds <nds@opencascade.com>
Thu, 27 Sep 2018 14:53:53 +0000 (17:53 +0300)
committernds <nds@opencascade.com>
Thu, 19 Nov 2020 08:40:28 +0000 (11:40 +0300)
(cherry picked from commit d9a231a9ce2499615952944cae1a0db6552db2e4)
(cherry picked from commit ab078490cdc21bdcb344f94dcea9494a7db2f2c8)
(cherry picked from commit 277ea0a15e589efd7128f915959a18a59ebdfd1c)
(cherry picked from commit 89d8a85dd8ebc1801bcb6149ca05cf77b7da5ba9)
(cherry picked from commit 7bc6dba60c38dc1749f020361faf8763b700049b)
(cherry picked from commit d50043348c2ff6d755e3b41579a0686286e07649)

23 files changed:
src/BinMXCAFDoc/BinMXCAFDoc.hxx
src/BinMXCAFDoc/BinMXCAFDoc_AnimationDriver.cxx [new file with mode: 0644]
src/BinMXCAFDoc/BinMXCAFDoc_AnimationDriver.hxx [new file with mode: 0644]
src/BinMXCAFDoc/BinMXCAFDoc_AnimationToolDriver.cxx [new file with mode: 0644]
src/BinMXCAFDoc/BinMXCAFDoc_AnimationToolDriver.hxx [new file with mode: 0644]
src/BinMXCAFDoc/FILES
src/XCAFDoc/FILES
src/XCAFDoc/XCAFDoc_Animation.cxx [new file with mode: 0644]
src/XCAFDoc/XCAFDoc_Animation.hxx [new file with mode: 0644]
src/XCAFDoc/XCAFDoc_AnimationTool.cxx [new file with mode: 0644]
src/XCAFDoc/XCAFDoc_AnimationTool.hxx [new file with mode: 0644]
src/XCAFDoc/XCAFDoc_Annotation.hxx [new file with mode: 0644]
src/XCAFDoc/XCAFDoc_DocumentTool.cxx
src/XCAFDoc/XCAFDoc_DocumentTool.hxx
src/XDEDRAW/FILES
src/XDEDRAW/XDEDRAW.cxx
src/XDEDRAW/XDEDRAW_Animations.cxx [new file with mode: 0644]
src/XDEDRAW/XDEDRAW_Animations.hxx [new file with mode: 0644]
src/XmlMXCAFDoc/FILES
src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationDriver.cxx [new file with mode: 0644]
src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationDriver.hxx [new file with mode: 0644]
src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationToolDriver.cxx [new file with mode: 0644]
src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationToolDriver.hxx [new file with mode: 0644]

index bfd6213584dd66aae48d01c336e8386a6102b7c9..dae4167c28e40999c3fd39b6d63a5e9c7eb791a1 100644 (file)
@@ -42,6 +42,9 @@ class BinMXCAFDoc_DimTolToolDriver;
 class BinMXCAFDoc_MaterialToolDriver;
 class BinMXCAFDoc_ViewDriver;
 class BinMXCAFDoc_ViewToolDriver;
+class BinMXCAFDoc_AnimationDriver;
+class BinMXCAFDoc_AnimationToolDriver;
+
 
 
 
@@ -89,6 +92,9 @@ friend class BinMXCAFDoc_DimTolToolDriver;
 friend class BinMXCAFDoc_MaterialToolDriver;
 friend class BinMXCAFDoc_ViewDriver;
 friend class BinMXCAFDoc_ViewToolDriver;
+friend class BinMXCAFDoc_AnimationDriver;
+friend class BinMXCAFDoc_AnimationToolDriver;
+
 
 };
 
diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_AnimationDriver.cxx b/src/BinMXCAFDoc/BinMXCAFDoc_AnimationDriver.cxx
new file mode 100644 (file)
index 0000000..93074ec
--- /dev/null
@@ -0,0 +1,112 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 <BinMXCAFDoc_AnimationDriver.hxx>
+#include <BinObjMgt_Persistent.hxx>
+#include <Message_Messenger.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TDF_Attribute.hxx>
+#include <XCAFDoc_Animation.hxx>
+# include <TColStd_HArray1OfByte.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationDriver,BinMDF_ADriver)
+
+static Standard_Boolean getByteArray(const BinObjMgt_Persistent& theSource, Handle(TColStd_HArray1OfByte)& theArray)
+{
+  Standard_Integer aFirstInd, aLastInd;
+  if (!(theSource >> aFirstInd >> aLastInd))
+    return Standard_False;
+  if (aLastInd < aFirstInd)
+    return Standard_False;
+
+  theArray.reset(new TColStd_HArray1OfByte(aFirstInd, aLastInd - aFirstInd + 1));
+  theSource.GetByteArray(&theArray->ChangeFirst(), aLastInd - aFirstInd + 1);
+  return Standard_True;
+}
+
+static void putByteArray(BinObjMgt_Persistent& theTarget, const Handle(TColStd_HArray1OfByte)& theArray)
+{
+  if (theArray.IsNull())
+    return;
+  const Standard_Integer aFirstInd = theArray->Lower();
+  const Standard_Integer aLastInd = theArray->Upper();
+  if (aLastInd < aFirstInd)
+    return;
+  
+  theTarget << aFirstInd << aLastInd;
+  theTarget.PutByteArray(&theArray->ChangeFirst(), aLastInd - aFirstInd + 1);
+}
+
+//=======================================================================
+//function : Constructor
+//purpose  : 
+//=======================================================================
+BinMXCAFDoc_AnimationDriver::BinMXCAFDoc_AnimationDriver
+  (const Handle(Message_Messenger)& theMsgDriver)
+: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Animation)->Name())
+{
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) BinMXCAFDoc_AnimationDriver::NewEmpty() const
+{
+  return new XCAFDoc_Animation();
+}
+
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+Standard_Boolean BinMXCAFDoc_AnimationDriver::Paste(const BinObjMgt_Persistent& theSource,
+                                                 const Handle(TDF_Attribute)& theTarget,
+                                                 BinObjMgt_RRelocationTable& /*theRelocTable*/) const 
+{
+  Handle(XCAFDoc_Animation) anAtt = Handle(XCAFDoc_Animation)::DownCast(theTarget);
+  Standard_Real aDensity;
+  TCollection_AsciiString aName;
+  
+  if (!(theSource >> aName))
+    return Standard_False;
+  Handle(TColStd_HArray1OfByte) anImage, anAnimation;
+  if (!getByteArray(theSource, anImage) || anImage.IsNull())
+    return Standard_False;
+  if (!getByteArray(theSource, anAnimation) || anAnimation.IsNull())
+    return Standard_False;
+  anAtt->Set(new TCollection_HAsciiString(aName), anImage, anAnimation);
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+void BinMXCAFDoc_AnimationDriver::Paste(const Handle(TDF_Attribute)& theSource,
+                                     BinObjMgt_Persistent& theTarget,
+                                     BinObjMgt_SRelocationTable& /*theRelocTable*/) const
+{
+  Handle(XCAFDoc_Animation) anAtt = Handle(XCAFDoc_Animation)::DownCast(theSource);
+  Handle(TCollection_HAsciiString) aName = anAtt->GetName();
+  if (!aName.IsNull())
+    theTarget << aName->String();
+  
+  putByteArray(theTarget, anAtt->GetImage());
+  putByteArray(theTarget, anAtt->GetAnimation());
+}
diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_AnimationDriver.hxx b/src/BinMXCAFDoc/BinMXCAFDoc_AnimationDriver.hxx
new file mode 100644 (file)
index 0000000..669bdf4
--- /dev/null
@@ -0,0 +1,72 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 _BinMXCAFDoc_AnimationDriver_HeaderFile
+#define _BinMXCAFDoc_AnimationDriver_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <BinMDF_ADriver.hxx>
+#include <Standard_Boolean.hxx>
+#include <BinObjMgt_RRelocationTable.hxx>
+#include <BinObjMgt_SRelocationTable.hxx>
+class Message_Messenger;
+class TDF_Attribute;
+class BinObjMgt_Persistent;
+
+
+class BinMXCAFDoc_AnimationDriver;
+DEFINE_STANDARD_HANDLE(BinMXCAFDoc_AnimationDriver, BinMDF_ADriver)
+
+
+class BinMXCAFDoc_AnimationDriver : public BinMDF_ADriver
+{
+
+public:
+
+  
+  Standard_EXPORT BinMXCAFDoc_AnimationDriver(const Handle(Message_Messenger)& theMsgDriver);
+  
+  Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationDriver,BinMDF_ADriver)
+
+protected:
+
+
+
+
+private:
+
+
+
+
+};
+
+
+
+
+
+
+
+#endif // _BinMXCAFDoc_AnimationDriver_HeaderFile
diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_AnimationToolDriver.cxx b/src/BinMXCAFDoc/BinMXCAFDoc_AnimationToolDriver.cxx
new file mode 100644 (file)
index 0000000..7417545
--- /dev/null
@@ -0,0 +1,65 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 <BinMXCAFDoc_AnimationToolDriver.hxx>
+#include <BinObjMgt_Persistent.hxx>
+#include <Message_Messenger.hxx>
+#include <Standard_Type.hxx>
+#include <TDF_Attribute.hxx>
+#include <XCAFDoc_AnimationTool.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationToolDriver, BinMDF_ADriver)
+
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+BinMXCAFDoc_AnimationToolDriver::BinMXCAFDoc_AnimationToolDriver
+  (const Handle(Message_Messenger)& theMsgDriver)
+  : BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_AnimationTool)->Name())
+{
+}
+
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) BinMXCAFDoc_AnimationToolDriver::NewEmpty() const
+{
+  return new XCAFDoc_AnimationTool();
+}
+
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+Standard_Boolean BinMXCAFDoc_AnimationToolDriver::Paste
+  (const BinObjMgt_Persistent& /*theSource*/,
+  const Handle(TDF_Attribute)& /*theTarget*/,
+  BinObjMgt_RRelocationTable& /*theRelocTable*/) const
+{
+  return Standard_True;
+}
+
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+void BinMXCAFDoc_AnimationToolDriver::Paste
+  (const Handle(TDF_Attribute)& /*theSource*/,
+   BinObjMgt_Persistent& /*theTarget*/,
+   BinObjMgt_SRelocationTable& /*theRelocTable*/) const {
+}
diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_AnimationToolDriver.hxx b/src/BinMXCAFDoc/BinMXCAFDoc_AnimationToolDriver.hxx
new file mode 100644 (file)
index 0000000..8a53301
--- /dev/null
@@ -0,0 +1,50 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 _BinMXCAFDoc_AnimationToolDriver_HeaderFile
+#define _BinMXCAFDoc_AnimationToolDriver_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <BinMDF_ADriver.hxx>
+#include <Standard_Boolean.hxx>
+#include <BinObjMgt_RRelocationTable.hxx>
+#include <BinObjMgt_SRelocationTable.hxx>
+class Message_Messenger;
+class TDF_Attribute;
+class BinObjMgt_Persistent;
+
+
+class BinMXCAFDoc_AnimationToolDriver;
+DEFINE_STANDARD_HANDLE(BinMXCAFDoc_AnimationToolDriver, BinMDF_ADriver)
+
+
+class BinMXCAFDoc_AnimationToolDriver : public BinMDF_ADriver
+{
+public:
+
+  Standard_EXPORT BinMXCAFDoc_AnimationToolDriver(const Handle(Message_Messenger)& theMsgDriver);
+
+  Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
+
+  Standard_EXPORT virtual Standard_Boolean Paste(const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
+
+  Standard_EXPORT virtual void Paste(const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
+
+  DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationToolDriver, BinMDF_ADriver)
+
+};
+#endif // _BinMXCAFDoc_AnimationToolDriver_HeaderFile
index fbb3e8776410a2d7c00e79f0def810f348ea7c4b..cd756fb05986fa81a522418216297d4c3456f018 100644 (file)
@@ -53,3 +53,7 @@ BinMXCAFDoc_ViewToolDriver.cxx
 BinMXCAFDoc_ViewToolDriver.hxx
 BinMXCAFDoc_VolumeDriver.cxx
 BinMXCAFDoc_VolumeDriver.hxx
+BinMXCAFDoc_AnimationDriver.cxx
+BinMXCAFDoc_AnimationDriver.hxx
+BinMXCAFDoc_AnimationToolDriver.cxx
+BinMXCAFDoc_AnimationToolDriver.hxx
index 07384bb750244ee7f937b7a7a1fe76f40a7cfd5f..89987cad92893a83404e7bdc997587f7b93447b5 100755 (executable)
@@ -65,3 +65,8 @@ XCAFDoc_ViewTool.cxx
 XCAFDoc_ViewTool.hxx
 XCAFDoc_Volume.cxx
 XCAFDoc_Volume.hxx
+XCAFDoc_Animation.cxx
+XCAFDoc_Animation.hxx
+XCAFDoc_AnimationTool.cxx
+XCAFDoc_AnimationTool.hxx
+
diff --git a/src/XCAFDoc/XCAFDoc_Animation.cxx b/src/XCAFDoc/XCAFDoc_Animation.cxx
new file mode 100644 (file)
index 0000000..53b8412
--- /dev/null
@@ -0,0 +1,214 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 <Standard_GUID.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_RelocationTable.hxx>
+#include <XCAFDoc_Animation.hxx>
+
+#include <TColStd_HArray1OfByte.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_Animation, TDF_Attribute)
+
+//=======================================================================
+//function : XCAFDoc_Animation
+//purpose  : 
+//=======================================================================
+XCAFDoc_Animation::XCAFDoc_Animation()
+{
+}
+
+
+//=======================================================================
+//function : GetID
+//purpose  : 
+//=======================================================================
+
+const Standard_GUID& XCAFDoc_Animation::GetID()
+{
+  static Standard_GUID MatID("431A3BB7-7113-45C4-8653-AED7CC0012E1");
+  return MatID;
+}
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+Handle(XCAFDoc_Animation) XCAFDoc_Animation::Set(const TDF_Label& theLabel,
+                                                 const Handle(TCollection_HAsciiString)& theName,
+                                                 const Handle(TColStd_HArray1OfByte)& theImage,
+                                                 const Handle(TColStd_HArray1OfByte)& theAnimation)
+{
+  Handle(XCAFDoc_Animation) A;
+  if (!theLabel.FindAttribute(XCAFDoc_Animation::GetID(), A))
+  {
+    A = new XCAFDoc_Animation();
+    theLabel.AddAttribute(A);
+  }
+  A->Set(theName, theImage, theAnimation);
+  return A;
+}
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+Handle(XCAFDoc_Animation) XCAFDoc_Animation::Set(const TDF_Label& theLabel,
+                  const Handle(TCollection_HAsciiString)& theName,
+                  OSD_File& theImageFile,  OSD_File& theAnimationFile)
+{
+  Handle(XCAFDoc_Animation) anAnimation;
+  if (!theLabel.FindAttribute(XCAFDoc_Animation::GetID(), anAnimation))
+  {
+    anAnimation = new XCAFDoc_Animation();
+    if (anAnimation->Set(theName, theImageFile, theAnimationFile))
+      theLabel.AddAttribute(anAnimation);
+    else
+      anAnimation.Nullify();
+  }
+  else
+    anAnimation->Set(theName, theImageFile, theAnimationFile);
+  return anAnimation;
+}
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+Standard_Boolean XCAFDoc_Animation::Set(const Handle(TCollection_HAsciiString)& theName, OSD_File& theImageFile, OSD_File& theAnimationFile)
+{
+  if (!theImageFile.IsOpen() || !theImageFile.IsReadable() || !theAnimationFile.IsOpen() || !theAnimationFile.IsReadable())
+    return Standard_False;
+  if (theImageFile.Size() > (Standard_Size)IntegerLast() || theAnimationFile.Size() > (Standard_Size)IntegerLast())
+    return Standard_False;
+  myImage.reset(new TColStd_HArray1OfByte(1, static_cast<Standard_Integer>(theImageFile.Size())));
+  Standard_Integer nbReadBytes = 0;
+  theImageFile.Read((Standard_Address)&myImage->First(), myImage->Length(), nbReadBytes);
+  if (nbReadBytes < myImage->Length())
+    return Standard_False;
+  myAnimation.reset(new TColStd_HArray1OfByte(1, static_cast<Standard_Integer>(theAnimationFile.Size())));
+  nbReadBytes = 0;
+  theAnimationFile.Read((Standard_Address)&myAnimation->First(), myAnimation->Length(), nbReadBytes);
+  if (nbReadBytes < myAnimation->Length())
+    return Standard_False;
+  myName = theName;
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+void XCAFDoc_Animation::Set(const Handle(TCollection_HAsciiString)& theName, 
+                            const Handle(TColStd_HArray1OfByte)& theImage,
+                            const Handle(TColStd_HArray1OfByte)& theAnimation)
+{
+  myName = theName;
+  myImage = theImage;
+  myAnimation = theAnimation;
+}
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+void XCAFDoc_Animation::Set(const Handle(TCollection_HAsciiString)& theName)
+{
+  myName = theName;
+}
+//=======================================================================
+//function : GetName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) XCAFDoc_Animation::GetName() const
+{
+  return myName;
+}
+
+
+//=======================================================================
+//function : GetImage
+//purpose  : 
+//=======================================================================
+
+Handle(TColStd_HArray1OfByte) XCAFDoc_Animation::GetImage() const
+{
+  return myImage;
+}
+
+
+//=======================================================================
+//function : GetAnimation
+//purpose  : 
+//=======================================================================
+
+Handle(TColStd_HArray1OfByte) XCAFDoc_Animation::GetAnimation() const
+{
+  return myAnimation;
+}
+
+//=======================================================================
+//function : ID
+//purpose  : 
+//=======================================================================
+
+const Standard_GUID& XCAFDoc_Animation::ID() const
+{
+  return GetID();
+}
+
+
+//=======================================================================
+//function : Restore
+//purpose  : 
+//=======================================================================
+
+void XCAFDoc_Animation::Restore(const Handle(TDF_Attribute)& With)
+{
+  myName = Handle(XCAFDoc_Animation)::DownCast(With)->GetName();
+  myImage = Handle(XCAFDoc_Animation)::DownCast(With)->GetImage();
+  myAnimation = Handle(XCAFDoc_Animation)::DownCast(With)->GetAnimation();
+}
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+
+Handle(TDF_Attribute) XCAFDoc_Animation::NewEmpty() const
+{
+  return new XCAFDoc_Animation();
+}
+
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+
+void XCAFDoc_Animation::Paste(const Handle(TDF_Attribute)& Into,
+  const Handle(TDF_RelocationTable)& /*RT*/) const
+{
+  Handle(XCAFDoc_Animation)::DownCast(Into)->Set(myName, myImage, myAnimation);
+}
+
diff --git a/src/XCAFDoc/XCAFDoc_Animation.hxx b/src/XCAFDoc/XCAFDoc_Animation.hxx
new file mode 100644 (file)
index 0000000..0bb72a1
--- /dev/null
@@ -0,0 +1,82 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <OSD_File.hxx>
+#include <TDF_Attribute.hxx>
+class Standard_GUID;
+class TDF_Label;
+class TDF_Attribute;
+class TDF_RelocationTable;
+class XCAFView_Object;
+
+class XCAFDoc_Animation;
+class TCollection_HAsciiString;
+class TColStd_HArray1OfByte;
+
+DEFINE_STANDARD_HANDLE(XCAFDoc_Animation, TDF_Attribute)
+
+//! attribute to store animation
+class XCAFDoc_Animation : public TDF_Attribute
+{
+
+public:
+
+  Standard_EXPORT XCAFDoc_Animation();
+  
+  Standard_EXPORT static const Standard_GUID& GetID();
+  
+  Standard_EXPORT static Handle(XCAFDoc_Animation) Set(const TDF_Label& label, const Handle(TCollection_HAsciiString)& theName, const Handle(TColStd_HArray1OfByte)& theImage, const Handle(TColStd_HArray1OfByte)& theAnimation);
+  
+  Standard_EXPORT static Handle(XCAFDoc_Animation) Set(const TDF_Label& theLabel, const Handle(TCollection_HAsciiString)& theName, OSD_File& theImageFile, OSD_File& theAnimationFile);
+
+  Standard_EXPORT void Set(const Handle(TCollection_HAsciiString)& theName, const Handle(TColStd_HArray1OfByte)& theImage, const Handle(TColStd_HArray1OfByte)& theAnimation);
+  Standard_EXPORT Standard_Boolean Set(const Handle(TCollection_HAsciiString)& aName, OSD_File&  theImageFile, OSD_File& theAnimationFile);
+
+  Standard_EXPORT void Set(const Handle(TCollection_HAsciiString)& theName);
+
+  Standard_EXPORT Handle(TCollection_HAsciiString) GetName() const;
+
+  Standard_EXPORT Handle(TColStd_HArray1OfByte) GetImage() const;
+
+  Standard_EXPORT Handle(TColStd_HArray1OfByte) GetAnimation() const;
+  
+  Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
+
+  Standard_EXPORT void Restore(const Handle(TDF_Attribute)& With) Standard_OVERRIDE;
+
+  Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
+
+  Standard_EXPORT void Paste(const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
+
+  
+
+
+  DEFINE_STANDARD_RTTIEXT(XCAFDoc_Animation, TDF_Attribute)
+
+private:
+
+  Handle(TCollection_HAsciiString) myName;
+  Handle(TColStd_HArray1OfByte) myImage;
+  Handle(TColStd_HArray1OfByte) myAnimation;
+};
+
+#endif
diff --git a/src/XCAFDoc/XCAFDoc_AnimationTool.cxx b/src/XCAFDoc/XCAFDoc_AnimationTool.cxx
new file mode 100644 (file)
index 0000000..2d95be7
--- /dev/null
@@ -0,0 +1,236 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 <TCollection_HAsciiString.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDataStd_TreeNode.hxx>
+#include <TDataXtd_Geometry.hxx>
+#include <TDataXtd_Plane.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_ChildIDIterator.hxx>
+#include <XCAFDoc.hxx>
+#include <XCAFDoc_Animation.hxx>
+#include <XCAFDoc_AnimationTool.hxx>
+#include <TDF_AttributeIterator.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_AnimationTool, TDF_Attribute)
+
+//=======================================================================
+//function : BaseLabel
+//purpose  : 
+//=======================================================================
+
+TDF_Label XCAFDoc_AnimationTool::BaseLabel() const
+{
+  return Label();
+}
+
+//=======================================================================
+//function : IsAnimation
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean XCAFDoc_AnimationTool::IsAnimation(const TDF_Label& theLabel) const
+{
+  if (theLabel.Father() != Label())
+    return Standard_False;
+
+  Handle(XCAFDoc_Animation) anAnimAttribute;
+  if (!theLabel.FindAttribute(XCAFDoc_Animation::GetID(), anAnimAttribute))
+    return Standard_False;
+
+
+  return Standard_True;
+}
+
+//=======================================================================
+//function : GetAnimation
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean XCAFDoc_AnimationTool::GetAnimation(const TDF_Label& theLabel,
+                                                    Handle(TCollection_HAsciiString)& theName,
+                                                    Handle(TColStd_HArray1OfByte)& theImage,
+                                                    Handle(TColStd_HArray1OfByte)& theAnimation) const
+{
+
+  if (theLabel.Father() != Label())
+    return Standard_False;
+
+  Handle(XCAFDoc_Animation) animAttr;
+  if (!theLabel.FindAttribute(XCAFDoc_Animation::GetID(), animAttr)) {
+    return Standard_False;
+  }
+  theName = animAttr->GetName();
+  theImage = animAttr->GetImage();
+  theAnimation = animAttr->GetAnimation();
+  return Standard_True;
+}
+
+//=======================================================================
+//function : AddAnimation
+//purpose  : 
+//=======================================================================
+
+TDF_Label XCAFDoc_AnimationTool::AddAnimation(const Handle(TCollection_HAsciiString)& theName,
+                                              const Handle(TColStd_HArray1OfByte)& theImage,
+                                              const Handle(TColStd_HArray1OfByte)& theAnimation )
+{
+  TDF_Label animL;
+  TDF_TagSource aTag;
+  animL = aTag.NewChild(Label());
+  XCAFDoc_Animation::Set(animL, theName, theImage, theAnimation);
+  TDataStd_Name::Set(animL, TCollection_AsciiString(theName->ToCString()));
+  return animL;
+}
+
+//=======================================================================
+//function : AddAnimation
+//purpose  : 
+//=======================================================================
+
+TDF_Label XCAFDoc_AnimationTool::AddAnimation(const Handle(TCollection_HAsciiString)& theName,
+                                              OSD_File& theImageFile, OSD_File& theAnimationFile)
+{
+  TDF_Label animL;
+  TDF_TagSource aTag;
+  animL = aTag.NewChild(Label());
+  TDataStd_Name::Set(animL, TCollection_AsciiString(theName->ToCString()));
+  XCAFDoc_Animation::Set(animL, theName, theImageFile, theAnimationFile);
+  return animL;
+}
+
+//=======================================================================
+//function : RemoveAnimation
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean XCAFDoc_AnimationTool::RemoveAnimation(const TDF_Label& theLabel) const
+{
+  Handle(XCAFDoc_Animation)anAnimAttr;
+  if (!IsAnimation(theLabel) || !theLabel.FindAttribute(XCAFDoc_Animation::GetID(), anAnimAttr))
+    return Standard_False;
+
+  theLabel.ForgetAllAttributes(Standard_True);
+  return Standard_True;
+}
+
+//=======================================================================
+//function : GetAnimationLabels
+//purpose  : 
+//=======================================================================
+
+void XCAFDoc_AnimationTool::GetAnimationLabels(TDF_LabelSequence& theLabels) const
+{
+  theLabels.Clear();
+  TDF_ChildIterator aChildIterator(Label());
+  for (; aChildIterator.More(); aChildIterator.Next()) {
+    TDF_Label aLabel = aChildIterator.Value();
+    if (IsAnimation(aLabel)) theLabels.Append(aLabel);
+  }
+}
+
+//=======================================================================
+//function : SetName
+//purpose  : 
+//=======================================================================
+
+void XCAFDoc_AnimationTool::SetName(const TDF_Label& theLabel,
+                                            const Handle(TCollection_HAsciiString)& theName) const
+{
+  if (theLabel.Father() != Label())
+    return;
+
+  Handle(XCAFDoc_Animation)anAnimAttr;
+  if (!theLabel.FindAttribute(XCAFDoc_Animation::GetID(), anAnimAttr))
+    return;
+  anAnimAttr->Set(theName);
+}
+
+//=======================================================================
+//function : GetID
+//purpose  : 
+//=======================================================================
+
+const Standard_GUID& XCAFDoc_AnimationTool::GetID() 
+{
+  static Standard_GUID AnimationID("7261F539-43AD-4544-8419-AE63C6ED4A41");
+  return AnimationID;
+}
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+Handle(XCAFDoc_AnimationTool) XCAFDoc_AnimationTool::Set(const TDF_Label& L)
+{
+  Handle(XCAFDoc_AnimationTool) A;
+  if (!L.FindAttribute(XCAFDoc_AnimationTool::GetID(), A)) {
+    A = new XCAFDoc_AnimationTool();
+    L.AddAttribute(A);
+  }
+  return A;
+}
+
+//=======================================================================
+//function : ID
+//purpose  : 
+//=======================================================================
+
+const Standard_GUID& XCAFDoc_AnimationTool::ID() const
+{
+  return GetID();
+}
+
+//=======================================================================
+//function : Restore
+//purpose  : 
+//=======================================================================
+
+void XCAFDoc_AnimationTool::Restore(const Handle(TDF_Attribute)& /*with*/)
+{
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+
+Handle(TDF_Attribute) XCAFDoc_AnimationTool::NewEmpty() const
+{
+  return new XCAFDoc_AnimationTool;
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+
+void XCAFDoc_AnimationTool::Paste(const Handle(TDF_Attribute)& /*into*/,
+  const Handle(TDF_RelocationTable)& /*RT*/) const
+{
+}
+
+//=======================================================================
+//function : XCAFDoc_AnimationTool
+//purpose  : 
+//=======================================================================
+
+XCAFDoc_AnimationTool::XCAFDoc_AnimationTool()
+{
+}
+
diff --git a/src/XCAFDoc/XCAFDoc_AnimationTool.hxx b/src/XCAFDoc/XCAFDoc_AnimationTool.hxx
new file mode 100644 (file)
index 0000000..a6ad065
--- /dev/null
@@ -0,0 +1,85 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 <TDF_LabelSequence.hxx>
+#include <TColStd_HArray1OfByte.hxx>
+#include <OSD_File.hxx>
+
+class XCAFDoc_AnimationTool;
+DEFINE_STANDARD_HANDLE(XCAFDoc_AnimationToolTool, TDF_Attribute)
+
+//! Provide tool for management of Animations section of document.
+//! Provide tool to store, retrieve, remove and modify animations.
+//! Each animation has a name and binary data of screenshot and animation.
+class XCAFDoc_AnimationTool : public TDF_Attribute
+{
+
+public:
+
+  
+  Standard_EXPORT XCAFDoc_AnimationTool();
+  
+  //! Creates (if not exist) Animation tool.
+  Standard_EXPORT static Handle(XCAFDoc_AnimationTool) Set(const TDF_Label& theLabel);
+  
+  Standard_EXPORT static const Standard_GUID& GetID();
+  
+  //! returns the label under which Animations are stored
+  Standard_EXPORT TDF_Label BaseLabel() const;
+  
+  //! Returns True if label belongs to a Animations table and
+  //! is a animation definition
+  Standard_EXPORT Standard_Boolean IsAnimation (const TDF_Label& theLabel) const;
+  
+  //! Returns animation defined by label theLabel
+  //! Returns False if the label is not in Animations table
+  Standard_EXPORT Standard_Boolean GetAnimation(const TDF_Label& theLabel, Handle(TCollection_HAsciiString)& theName, Handle(TColStd_HArray1OfByte)& theImage, Handle(TColStd_HArray1OfByte)& theAnimation) const;
+
+  //! Adds an animation definition to a Animations table
+  //! Returns created label 
+  Standard_EXPORT TDF_Label AddAnimation(const Handle(TCollection_HAsciiString)& theName, const Handle(TColStd_HArray1OfByte)& theImage, const Handle(TColStd_HArray1OfByte)& theAnimation);
+  //! Adds an animation definition to a Animations table
+  //! Returns created label 
+  Standard_EXPORT TDF_Label AddAnimation(const Handle(TCollection_HAsciiString)& theName, OSD_File& theImageFile, OSD_File& theAnimationFile);
+  
+  //! Removes animation from the Animations table
+  Standard_EXPORT Standard_Boolean RemoveAnimation(const TDF_Label& theLabel) const;
+  
+  //! Returns a sequence of animations currently stored
+  //! in the Animations table
+  Standard_EXPORT void GetAnimationLabels(TDF_LabelSequence& Labels) const;
+  
+  //! Rename animation
+  Standard_EXPORT void SetName(const TDF_Label& theLabelL, const Handle(TCollection_HAsciiString)& theName) const;
+  
+  Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
+  
+  Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE;
+  
+  Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
+  
+  Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(XCAFDoc_AnimationTool, TDF_Attribute)
+
+};
+#endif // _XCAFDoc_ClippingPlaneTool_HeaderFile
diff --git a/src/XCAFDoc/XCAFDoc_Annotation.hxx b/src/XCAFDoc/XCAFDoc_Annotation.hxx
new file mode 100644 (file)
index 0000000..b666334
--- /dev/null
@@ -0,0 +1,65 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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_View_HeaderFile
+#define _XCAFDoc_View_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TDF_Attribute.hxx>
+class Standard_GUID;
+class TDF_Label;
+class TDF_Attribute;
+class TDF_RelocationTable;
+class XCAFView_Object;
+
+// resolve name collisions with WinAPI headers
+#ifdef GetObject
+  #undef GetObject
+#endif
+
+class XCAFDoc_View;
+DEFINE_STANDARD_HANDLE(XCAFDoc_View, TDF_Attribute)
+
+//! attribute to store view
+class XCAFDoc_View : public TDF_Attribute
+{
+
+public:
+
+  Standard_EXPORT XCAFDoc_View();
+  
+  Standard_EXPORT static const Standard_GUID& GetID();
+  
+  Standard_EXPORT static Handle(XCAFDoc_View) Set (const TDF_Label& theLabel);
+  
+  Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
+  
+  Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With) Standard_OVERRIDE;
+  
+  Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
+  
+  Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
+  
+  Standard_EXPORT void SetObject (const Handle(XCAFView_Object)& theViewObject);
+  
+  Standard_EXPORT Handle(XCAFView_Object) GetObject() const;
+
+  DEFINE_STANDARD_RTTIEXT(XCAFDoc_View, TDF_Attribute)
+
+};
+
+#endif
index 5614c690f0454b96193bd4ca64cd59bae37bf36b..8614586137e3ef3102ad44ea97c6e6fb41e5229c 100644 (file)
@@ -33,6 +33,7 @@
 #include <XCAFDoc_NotesTool.hxx>
 #include <XCAFDoc_ShapeTool.hxx>
 #include <XCAFDoc_ViewTool.hxx>
+#include <XCAFDoc_AnimationTool.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_DocumentTool,TDF_Attribute)
 
@@ -87,6 +88,7 @@ Handle(XCAFDoc_DocumentTool) XCAFDoc_DocumentTool::Set(const TDF_Label& L,
     XCAFDoc_NotesTool::Set(NotesLabel(L));
     XCAFDoc_ViewTool::Set(ViewsLabel(L));
     XCAFDoc_ClippingPlaneTool::Set(ClippingPlanesLabel(L));
+    XCAFDoc_AnimationTool::Set(AnimationsLabel(L));
   }
   return A;
 }
@@ -224,7 +226,17 @@ TDF_Label XCAFDoc_DocumentTool::NotesLabel(const TDF_Label& acces)
   TDataStd_Name::Set(L, "Notes");
   return L;
 }
+//=======================================================================
+//function : AnimationsLabel
+//purpose  : 
+//=======================================================================
 
+TDF_Label XCAFDoc_DocumentTool::AnimationsLabel(const TDF_Label& acces)
+{
+  TDF_Label L = DocLabel(acces).FindChild(10, Standard_True);
+  TDataStd_Name::Set(L, "Animations");
+  return L;
+}
 //=======================================================================
 //function : ShapeTool
 //purpose  : 
@@ -308,7 +320,15 @@ Handle(XCAFDoc_NotesTool) XCAFDoc_DocumentTool::NotesTool(const TDF_Label& acces
 {
   return XCAFDoc_NotesTool::Set(NotesLabel(acces));
 }
+//=======================================================================
+//function : AnimationTool
+//purpose  : 
+//=======================================================================
 
+Handle(XCAFDoc_AnimationTool) XCAFDoc_DocumentTool::AnimationTool(const TDF_Label& acces)
+{
+  return XCAFDoc_AnimationTool::Set(AnimationsLabel(acces));
+}
 //=======================================================================
 //function : ID
 //purpose  : 
index 51a793fccae602971cf962617c045fe723398e47..5ff52becd1edb536668eb724ae5e0c8e6ab808c2 100644 (file)
@@ -34,6 +34,7 @@ class XCAFDoc_NotesTool;
 class XCAFDoc_ViewTool;
 class TDF_Attribute;
 class TDF_RelocationTable;
+class XCAFDoc_AnimationTool;
 
 
 class XCAFDoc_DocumentTool;
@@ -88,6 +89,9 @@ public:
 
   //! Returns sub-label of DocLabel() with tag 9.
   Standard_EXPORT static TDF_Label NotesLabel(const TDF_Label& acces);
+  
+  //! Returns sub-label of DocLabel() with tag 10.
+  Standard_EXPORT static TDF_Label AnimationsLabel(const TDF_Label& acces);
 
   //! Creates (if it does not exist) ShapeTool attribute on ShapesLabel().
   Standard_EXPORT static Handle(XCAFDoc_ShapeTool) ShapeTool (const TDF_Label& acces);
@@ -112,6 +116,9 @@ public:
 
   //! Creates (if it does not exist) NotesTool attribute on NotesLabel().
   Standard_EXPORT static Handle(XCAFDoc_NotesTool) NotesTool(const TDF_Label& acces);
+  
+  //! Creates (if it does not exist) AnimationTool attribute on NotesLabel().
+  Standard_EXPORT static  Handle(XCAFDoc_AnimationTool) AnimationTool(const TDF_Label& acces);
 
   Standard_EXPORT XCAFDoc_DocumentTool();
   
index a896d4c95eb2471f93ff1651828a02dd38354a36..dd335fe843e12d4fdf7bceb54a0d3c5d53f873d9 100644 (file)
@@ -16,3 +16,6 @@ XDEDRAW_Views.cxx
 XDEDRAW_Views.hxx
 XDEDRAW_Notes.cxx
 XDEDRAW_Notes.hxx
+XDEDRAW_Animations.cxx
+XDEDRAW_Animations.hxx
+
index 07b3afaf72540e287c6dbb2245b97e08a8c9cd00..6c79d4f3a321dd18cc674b19b8cfe1926ca467a2 100644 (file)
@@ -91,6 +91,7 @@
 #include <XDEDRAW_GDTs.hxx>
 #include <XDEDRAW_Views.hxx>
 #include <XDEDRAW_Notes.hxx>
+#include <XDEDRAW_Animations.hxx>
 #include <XSDRAW.hxx>
 #include <XSDRAWIGES.hxx>
 #include <XSDRAWSTEP.hxx>
@@ -1496,6 +1497,7 @@ void XDEDRAW::Init(Draw_Interpretor& di)
   XDEDRAW_GDTs::InitCommands ( di );
   XDEDRAW_Views::InitCommands(di);
   XDEDRAW_Notes::InitCommands(di);
+  XDEDRAW_Animations::InitCommands( di );
   XDEDRAW_Common::InitCommands ( di );//moved from EXE
 
 }
diff --git a/src/XDEDRAW/XDEDRAW_Animations.cxx b/src/XDEDRAW/XDEDRAW_Animations.cxx
new file mode 100644 (file)
index 0000000..24188e8
--- /dev/null
@@ -0,0 +1,376 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 <DDocStd.hxx>
+#include <OSD_File.hxx>
+#include <OSD_Protection.hxx>
+#include <TDocStd_Document.hxx>
+#include <TDF_Tool.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XCAFDoc_AnimationTool.hxx>
+#include <XDEDRAW_Animations.hxx>
+#include <XCAFDoc_Animation.hxx>
+
+struct cmd
+{
+  const char*      name;
+  Standard_Integer nargsreq;
+  const char*      use;
+};
+
+//=======================================================================
+//function : animations
+//purpose  : returns list of all animations
+//=======================================================================
+static const cmd XAnimations = {
+  "XAnimations", 2, "XAnimations Doc"
+};
+static Standard_Integer
+animations(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  static const cmd& myCommand = XAnimations;
+
+  if (argc < myCommand.nargsreq)
+  {
+    di << "Use: " << myCommand.use << "\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull())
+  {
+    return 1;
+  }
+
+  Handle(XCAFDoc_AnimationTool) anAnimTool = XCAFDoc_DocumentTool::AnimationTool(aDoc->Main());
+
+  TDF_LabelSequence anAnimations;
+  anAnimTool->GetAnimationLabels(anAnimations);
+  for (TDF_LabelSequence::Iterator anIt(anAnimations); anIt.More(); anIt.Next())
+  {
+    TCollection_AsciiString anEntry;
+    TDF_Tool::Entry(anIt.Value(), anEntry);
+    di << anEntry << " ";
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : addAnimation
+//purpose  : add animation
+//=======================================================================
+static const cmd XAnimationAdd = {
+  "XAnimationAdd", 6, "XAnimationAdd Doc name --file image_path animation_path | --data image_data animation_data"
+};
+static Standard_Integer
+addAnimation(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  static const cmd& myCommand = XAnimationAdd;
+
+  if (argc < myCommand.nargsreq)
+  {
+    di << "Use: " << myCommand.use << "\n";
+    return 1;
+  }
+
+  Standard_Integer iarg = 0;
+
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[++iarg], aDoc);
+  if (aDoc.IsNull()) 
+  {
+    return 1;
+  }
+
+  TCollection_ExtendedString aName = argv[++iarg];
+  Standard_Boolean aFromFile = Standard_False;
+  Standard_Boolean aFromData = Standard_False;
+  TCollection_ExtendedString anImageFileStr;
+  TCollection_ExtendedString anAnimationFileStr;
+  Handle(TColStd_HArray1OfByte) anImage;
+  Handle(TColStd_HArray1OfByte) anAnimation;
+  for (++iarg; iarg < argc; ++iarg)
+  {
+    TCollection_AsciiString opt = argv[iarg];
+    if (opt == "--file")
+    {
+      if (aFromData)
+      {
+        di << "Error: data can be taken either from a file or a data array.\n";
+        di << "Use: " << myCommand.use << "\n";
+        return 1;
+      }
+      if (++iarg >= argc)
+      {
+        di << "Error: file image path is expected.\n";
+        di << "Use: " << myCommand.use << "\n";
+        return 1;
+      }
+      anImageFileStr = argv[iarg];
+      if (++iarg >= argc)
+      {
+        di << "Error: file animation path is expected.\n";
+        di << "Use: " << myCommand.use << "\n";
+        return 1;
+      }
+      anAnimationFileStr = argv[iarg];
+      aFromFile = Standard_True;
+    }
+    else if (opt == "--data")
+    {
+      if (aFromFile)
+      {
+        di << "Error: data can be taken either from a file or a data array.\n";
+        di << "Use: " << myCommand.use << "\n";
+        return 1;
+      }
+      if (++iarg >= argc)
+      {
+        di << "Error: image data array is expected.\n";
+        di << "Use: " << myCommand.use << "\n";
+        return 1;
+      }
+      Standard_SStream ss(std::ios_base::in | std::ios_base::out | std::ios_base::binary);
+      ss << argv[iarg];
+      Standard_Integer len = static_cast<Standard_Integer>(ss.tellp());
+      anImage = new TColStd_HArray1OfByte(1, len);
+      for (Standard_Integer i = 1; i <= len && !ss.eof(); ++i)
+      {
+        ss >> anImage->ChangeValue(i);
+      }
+
+      if (++iarg >= argc)
+      {
+        di << "Error: animation data array is expected.\n";
+        di << "Use: " << myCommand.use << "\n"; 
+        return 1;
+      }
+      Standard_SStream ssAn(std::ios_base::in | std::ios_base::out | std::ios_base::binary);
+      ssAn << argv[iarg];
+      len = static_cast<Standard_Integer>(ss.tellp());
+      anAnimation = new TColStd_HArray1OfByte(1, len);
+      for (Standard_Integer i = 1; i <= len && !ss.eof(); ++i)
+      {
+        ssAn >> anAnimation->ChangeValue(i);
+      }
+      aFromData = Standard_True;
+    }
+  }
+  Handle(XCAFDoc_AnimationTool) anAnimationTool = XCAFDoc_DocumentTool::AnimationTool(aDoc->Main());
+  TDF_Label aLabel;
+  if (aFromFile)
+  {
+    OSD_Path anImagePath(anImageFileStr);
+    OSD_File anImageFile(anImagePath);
+    anImageFile.Open(OSD_ReadOnly, OSD_Protection());
+    
+    OSD_Path anAnimPath(anAnimationFileStr);
+    OSD_File anAnimFile(anAnimPath);
+    anAnimFile.Open(OSD_ReadOnly, OSD_Protection());
+    
+    aLabel = anAnimationTool->AddAnimation(new TCollection_HAsciiString(aName), anImageFile, anAnimFile);
+  }
+  else if (aFromData)
+  {
+    aLabel = anAnimationTool->AddAnimation(new TCollection_HAsciiString(aName), anImage, anAnimation);
+  }
+  else
+  {
+    di << "Error: data can be taken either from a file or a data array.\n";
+    di << "Use: " << myCommand.use << "\n";
+    return 1;
+  }
+  TCollection_AsciiString anEntry;
+  TDF_Tool::Entry(aLabel, anEntry);
+  di << anEntry;
+  return 0;
+}
+
+//=======================================================================
+//function : removeAnimation
+//purpose  : deletes an animation  
+//=======================================================================
+static const cmd XAnimationRemove = {
+  "XAnimationRemove", 3, "XAnimationRemove Doc animation"
+};
+static Standard_Integer
+removeAnimation(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  static const cmd& myCommand = XAnimationRemove;
+
+  if (argc < myCommand.nargsreq)
+  {
+    di << "Use: " << myCommand.use << "\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull())
+  {
+    return 1;
+  }
+
+  TCollection_ExtendedString anEntry = argv[2];
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), anEntry, aLabel);
+  if (aLabel.IsNull())
+  {
+    di << anEntry << ": invalid animation entry.\n";
+    return 1;
+  }
+
+  Handle(XCAFDoc_AnimationTool) anAnimationTool = XCAFDoc_DocumentTool::AnimationTool(aDoc->Main());
+  if (!anAnimationTool->RemoveAnimation(aLabel))
+  {
+    di << "Error: couldn't remove animation.\n";
+    return 1;
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : animationDump
+//purpose  : dump an animation
+//=======================================================================
+static const cmd XAnimationDump = {
+  "XAnimationDump", 3, "XAnimationDump Doc animation"
+};
+static Standard_Integer
+animationDump(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  static const cmd& myCommand = XAnimationDump;
+
+  if (argc < myCommand.nargsreq)
+  {
+    di << "Use: " << myCommand.use << "\n";
+    return 1;
+  }
+
+  Standard_Integer iarg = 0;
+
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[++iarg], aDoc);
+  if (aDoc.IsNull())
+  {
+    return 1;
+  }
+
+  TCollection_AsciiString anEntry = argv[++iarg];
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), anEntry, aLabel);
+  if (aLabel.IsNull())
+  {
+    TCollection_AsciiString anEntry;
+    TDF_Tool::Entry(aLabel, anEntry);
+    di << anEntry << ": invalid animation entry.\n";
+    return 1;
+  }
+
+  Handle(XCAFDoc_AnimationTool) anAnimTool = XCAFDoc_DocumentTool::AnimationTool(aDoc->Main());
+  Handle(TCollection_HAsciiString) aName;
+  Handle(TColStd_HArray1OfByte) anImage, anAnimation;
+  
+  anAnimTool->GetAnimation(aLabel, aName, anImage, anAnimation);
+  if (!aName.IsNull())
+  {
+    di <<"Name  : " << aName->ToCString() << "\n";
+  }
+  static Standard_Integer theMaxLen = 64;
+  if (!anImage.IsNull())
+  {
+    di << "Image size     : " << anImage->Length()<<"\n";
+  }
+  else
+  {
+    di << "Image is NULL \n ";
+  }
+
+  if (!anAnimation.IsNull())
+  {
+    di << "Animation  size    : " << anAnimation->Length()<<"\n";
+  }
+  else
+  {
+    di << "Animation is NULL \n ";
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setName
+//purpose  : rename animation
+//=======================================================================
+static const cmd XAnimationSetName = {
+  "XAnimationSetName", 4, "XAnimationSetName Doc animation new_name"
+};
+static Standard_Integer
+setName(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  static const cmd& myCommand = XAnimationSetName;
+
+  if (argc < myCommand.nargsreq)
+  {
+    di << "Use: " << myCommand.use << "\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull())
+  {
+    return 1;
+  }
+
+  TCollection_ExtendedString anEntry = argv[2];
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), anEntry, aLabel);
+  if (aLabel.IsNull())
+  {
+    di << anEntry << ": invalid animation entry.\n";
+    return 1;
+  }
+  
+  Handle(XCAFDoc_AnimationTool) anAnimTool = XCAFDoc_DocumentTool::AnimationTool(aDoc->Main());
+  anAnimTool->SetName(aLabel, new TCollection_HAsciiString(argv[3]));
+  return 0;
+}
+
+//=======================================================================
+//function : InitCommands
+//purpose  : 
+//=======================================================================
+void XDEDRAW_Animations::InitCommands(Draw_Interpretor& di) 
+{
+  static Standard_Boolean initialized = Standard_False;
+  if (initialized)
+  {
+    return;
+  }
+  initialized = Standard_True;
+  
+  Standard_CString g = "XDE Animations commands";
+
+  di.Add(XAnimations.name, XAnimations.use, __FILE__, animations, g);
+  di.Add(XAnimationAdd.name, XAnimationAdd.use, __FILE__, addAnimation, g);
+  di.Add(XAnimationRemove.name, XAnimationRemove.use, __FILE__, removeAnimation, g);
+  di.Add(XAnimationDump.name, XAnimationDump.use, __FILE__, animationDump, g);
+  di.Add(XAnimationSetName.name, XAnimationSetName.use, __FILE__, setName, g);
+}
diff --git a/src/XDEDRAW/XDEDRAW_Animations.hxx b/src/XDEDRAW/XDEDRAW_Animations.hxx
new file mode 100644 (file)
index 0000000..d408513
--- /dev/null
@@ -0,0 +1,35 @@
+// Created on: 2017-10-02
+// Created by: Elena Mozokhina
+// Copyright (c) 2016 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 _XDEDRAW_Animations_HeaderFile
+#define _XDEDRAW_Animations_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Draw_Interpretor.hxx>
+
+//! Contains commands to work with notes
+class XDEDRAW_Animations 
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+  Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands);
+};
+
+#endif // _XDEDRAW_Animations_HeaderFile
index 965d5fbf555603c2d1b1da3c95810621ad6b4e7b..65a07bf988fa4b0ddecf370b46a5b3d14583678d 100644 (file)
@@ -47,3 +47,8 @@ XmlMXCAFDoc_ViewToolDriver.cxx
 XmlMXCAFDoc_ViewToolDriver.hxx
 XmlMXCAFDoc_VolumeDriver.cxx
 XmlMXCAFDoc_VolumeDriver.hxx
+XmlMXCAFDoc_AnimationDriver.cxx
+XmlMXCAFDoc_AnimationDriver.hxx
+XmlMXCAFDoc_AnimationToolDriver.cxx
+XmlMXCAFDoc_AnimationToolDriver.hxx
+
diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationDriver.cxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationDriver.cxx
new file mode 100644 (file)
index 0000000..aa4eb85
--- /dev/null
@@ -0,0 +1,152 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 <Message_Messenger.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HArray1OfByte.hxx>
+#include <TDF_Attribute.hxx>
+#include <XCAFDoc_Animation.hxx>
+#include <XmlMXCAFDoc_AnimationDriver.hxx>
+#include <XmlObjMgt.hxx>
+#include <XmlObjMgt_Persistent.hxx>
+#include <LDOM_OSStream.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_AnimationDriver,XmlMDF_ADriver)
+IMPLEMENT_DOMSTRING (AnimationName,     "name")
+IMPLEMENT_DOMSTRING (ImageFirstIdx,    "image_first_idx")
+IMPLEMENT_DOMSTRING (ImageLastIdx, "image_last_idx")
+IMPLEMENT_DOMSTRING(AnimationFirstIdx, "animation_first_idx")
+IMPLEMENT_DOMSTRING(AnimationLastIdx, "animation_last_idx")
+
+//=======================================================================
+//function : XmlMXCAFDoc_AnimationDriver
+//purpose  : Constructor
+//=======================================================================
+XmlMXCAFDoc_AnimationDriver::XmlMXCAFDoc_AnimationDriver
+  (const Handle(Message_Messenger)& theMsgDriver)
+: XmlMDF_ADriver (theMsgDriver, "xcaf", "Animation")
+{}
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) XmlMXCAFDoc_AnimationDriver::NewEmpty() const
+{
+  return (new XCAFDoc_Animation());
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : persistent -> transient (retrieve)
+//=======================================================================
+Standard_Boolean XmlMXCAFDoc_AnimationDriver::Paste
+                                (const XmlObjMgt_Persistent&  theSource,
+                                 const Handle(TDF_Attribute)& theTarget,
+                                 XmlObjMgt_RRelocationTable&  ) const
+{
+  const XmlObjMgt_Element& anElement = theSource;
+  Handle(XCAFDoc_Animation) aTarget = Handle(XCAFDoc_Animation)::DownCast(theTarget);
+  if (aTarget.IsNull())
+    return Standard_False;
+  XmlObjMgt_DOMString aNameStr = anElement.getAttribute(::AnimationName());
+  XmlObjMgt_DOMString anImageFirstIdxStr = anElement.getAttribute(::ImageFirstIdx());
+  XmlObjMgt_DOMString anImageLastIdxStr = anElement.getAttribute(::ImageLastIdx());
+  XmlObjMgt_DOMString anAnimFirstIdxStr = anElement.getAttribute(::AnimationFirstIdx());
+  XmlObjMgt_DOMString anAnimLastIdxStr = anElement.getAttribute(::AnimationLastIdx());
+
+  if (aNameStr == NULL || anImageFirstIdxStr == NULL ||  anImageLastIdxStr == NULL || 
+      anAnimFirstIdxStr == NULL || anAnimLastIdxStr == NULL)
+    return Standard_False;
+  
+  Standard_Integer anImageFirstIdx = 0;
+  Standard_Integer anImageLastIdx = 0;
+  if (!anImageFirstIdxStr.GetInteger(anImageFirstIdx) || !anImageLastIdxStr.GetInteger(anImageLastIdx))
+    return Standard_False;
+  Handle(TColStd_HArray1OfByte) anImage = new TColStd_HArray1OfByte(anImageFirstIdx, anImageLastIdx);
+  
+  Standard_Integer anAnimFirstIdx = 0;
+  Standard_Integer anAnimLastIdx = 0;
+  if (!anAnimFirstIdxStr.GetInteger(anAnimFirstIdx) || !anAnimLastIdxStr.GetInteger(anAnimLastIdx))
+    return Standard_False;
+  Handle(TColStd_HArray1OfByte) anAnim = new TColStd_HArray1OfByte(anAnimFirstIdx, anAnimLastIdx);
+  
+  //const Standard_Integer aMaxSize = anImageLastIdx - anImageFirstIdx + anAnimLastIdx - anAnimFirstIdx + 2;
+  
+  XmlObjMgt_DOMString aDataStr = XmlObjMgt::GetStringValue(theSource);
+  Standard_SStream anSS(aDataStr.GetString());
+  
+  Standard_Byte aValue;
+  for (Standard_Integer i = anImageFirstIdx; i <= anImageLastIdx; ++i)
+  {
+    anSS >> aValue;
+    anImage->ChangeValue(i) = aValue;
+  }
+
+  for (Standard_Integer i = anAnimFirstIdx; i <= anAnimLastIdx; ++i)
+  {
+    anSS >> aValue;
+    anAnim->ChangeValue(i) = aValue;
+  }
+
+  aTarget->Set(new TCollection_HAsciiString(aNameStr.GetString()), anImage, anImage);
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : transient -> persistent (store)
+//=======================================================================
+void XmlMXCAFDoc_AnimationDriver::Paste(const Handle(TDF_Attribute)& theSource,
+  XmlObjMgt_Persistent&        theTarget,
+  XmlObjMgt_SRelocationTable&) const
+{
+  Handle(XCAFDoc_Animation) anAnimation = Handle(XCAFDoc_Animation)::DownCast(theSource);
+  if (anAnimation.IsNull())
+    return;
+
+  XmlObjMgt_DOMString aName = anAnimation->GetName()->String().ToCString();
+  theTarget.Element().setAttribute(::AnimationName(), aName);
+  
+  Handle(TColStd_HArray1OfByte) anImage = anAnimation->GetImage();
+  Handle(TColStd_HArray1OfByte) anAnim = anAnimation->GetAnimation();
+  if (anImage.IsNull() || anAnim.IsNull())
+  {
+    return;
+  }
+  const Standard_Integer anImageFirstInd = anImage->Lower();
+  const Standard_Integer anImageLastInd = anAnim->Upper();
+
+  const Standard_Integer anAnimFirstInd = anAnim->Lower();
+  const Standard_Integer anAnimLastInd = anAnim->Upper();
+
+  const Standard_Integer aMaxSize = anImageLastInd - anImageFirstInd + anAnimLastInd - anAnimFirstInd + 2;
+
+  LDOM_OSStream anOSS(aMaxSize);
+  
+  for (Standard_Integer i = anImageFirstInd; i <= anImageLastInd; ++i)
+  {
+    anOSS << std::hex << anImage->Value(i);
+  }
+  for (Standard_Integer i = anAnimFirstInd; i <= anAnimLastInd; ++i)
+  {
+    anOSS << std::hex << anAnim->Value(i);
+  }
+  Standard_Character* dump = (Standard_Character*)anOSS.str(); // copying! Don't forget to delete it.
+  XmlObjMgt::SetStringValue(theTarget, dump, Standard_True);
+  delete[] dump;
+}
diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationDriver.hxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationDriver.hxx
new file mode 100644 (file)
index 0000000..7c23181
--- /dev/null
@@ -0,0 +1,51 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 _XmlMXCAFDoc_AnimationDriver_HeaderFile
+#define _XmlMXCAFDoc_AnimationDriver_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <XmlMDF_ADriver.hxx>
+#include <Standard_Boolean.hxx>
+#include <XmlObjMgt_RRelocationTable.hxx>
+#include <XmlObjMgt_SRelocationTable.hxx>
+class Message_Messenger;
+class TDF_Attribute;
+class XmlObjMgt_Persistent;
+
+
+class XmlMXCAFDoc_AnimationDriver;
+DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_AnimationDriver, XmlMDF_ADriver)
+
+//! Attribute Driver.
+class XmlMXCAFDoc_AnimationDriver : public XmlMDF_ADriver
+{
+
+public:
+
+  
+  Standard_EXPORT XmlMXCAFDoc_AnimationDriver(const Handle(Message_Messenger)& theMessageDriver);
+  
+  Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
+  
+  Standard_EXPORT Standard_Boolean Paste (const XmlObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, XmlObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
+  
+  Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, XmlObjMgt_Persistent& Target, XmlObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
+
+  DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_AnimationDriver,XmlMDF_ADriver)
+};
+#endif // _XmlMXCAFDoc_AnimationDriver_HeaderFile
diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationToolDriver.cxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationToolDriver.cxx
new file mode 100644 (file)
index 0000000..4dd5a9a
--- /dev/null
@@ -0,0 +1,63 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 <Message_Messenger.hxx>
+#include <Standard_Type.hxx>
+#include <TDF_Attribute.hxx>
+#include <XCAFDoc_AnimationTool.hxx>
+#include <XmlMXCAFDoc_AnimationToolDriver.hxx>
+#include <XmlObjMgt_Persistent.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_AnimationToolDriver,XmlMDF_ADriver)
+
+//=======================================================================
+//function :
+//purpose  : 
+//=======================================================================
+XmlMXCAFDoc_AnimationToolDriver::XmlMXCAFDoc_AnimationToolDriver
+  (const Handle(Message_Messenger)& theMsgDriver)
+: XmlMDF_ADriver (theMsgDriver, "xcaf", "AnimationTool")
+{
+}
+
+//=======================================================================
+//function :
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) XmlMXCAFDoc_AnimationToolDriver::NewEmpty() const
+{
+  return new XCAFDoc_AnimationTool();
+}
+
+//=======================================================================
+//function :
+//purpose  : 
+//=======================================================================
+Standard_Boolean XmlMXCAFDoc_AnimationToolDriver::Paste(const XmlObjMgt_Persistent& ,
+                                                       const Handle(TDF_Attribute)& ,
+                                                       XmlObjMgt_RRelocationTable& ) const
+{
+  return Standard_True;
+}
+
+//=======================================================================
+//function :
+//purpose  : 
+//=======================================================================
+void XmlMXCAFDoc_AnimationToolDriver::Paste(const Handle(TDF_Attribute)& ,
+                                           XmlObjMgt_Persistent& ,
+                                           XmlObjMgt_SRelocationTable& ) const
+{
+}
diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationToolDriver.hxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_AnimationToolDriver.hxx
new file mode 100644 (file)
index 0000000..2adf4ef
--- /dev/null
@@ -0,0 +1,52 @@
+// Created on: 2017-10-02
+// Created by: Elena MOZOKHINA
+// Copyright (c) 2016 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 _XmlMXCAFDoc_AnimationToolDriver_HeaderFile
+#define _XmlMXCAFDoc_AnimationToolDriver_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <XmlMDF_ADriver.hxx>
+#include <Standard_Boolean.hxx>
+#include <XmlObjMgt_RRelocationTable.hxx>
+#include <XmlObjMgt_SRelocationTable.hxx>
+class Message_Messenger;
+class TDF_Attribute;
+class XmlObjMgt_Persistent;
+
+
+class XmlMXCAFDoc_AnimationToolDriver;
+DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_AnimationToolDriver, XmlMDF_ADriver)
+
+//! Attribute Driver.
+class XmlMXCAFDoc_AnimationToolDriver : public XmlMDF_ADriver
+{
+
+public:
+
+
+  Standard_EXPORT XmlMXCAFDoc_AnimationToolDriver(const Handle(Message_Messenger)& theMsgDriver);
+  
+  Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual Standard_Boolean Paste (const XmlObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource, XmlObjMgt_Persistent& theTarget, XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
+
+  DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_AnimationToolDriver,XmlMDF_ADriver)
+
+};
+#endif // _XmlMXCAFDoc_AnimationToolDriver_HeaderFile