0028044: Data Exchange - implement data structures for Saved Views
authorika <ika@opencascade.com>
Wed, 19 Oct 2016 15:31:56 +0000 (18:31 +0300)
committerapn <apn@opencascade.com>
Thu, 26 Jan 2017 10:27:19 +0000 (13:27 +0300)
Add new root label in Document for Views.
Add new attribute to store View in XDE.
Add object and tool to process Views.
Add new Draw commands for Views.

32 files changed:
src/BinMXCAFDoc/BinMXCAFDoc.cxx
src/BinMXCAFDoc/BinMXCAFDoc.hxx
src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.cxx [new file with mode: 0644]
src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.hxx [new file with mode: 0644]
src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.cxx [new file with mode: 0644]
src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.hxx [new file with mode: 0644]
src/BinMXCAFDoc/FILES
src/TKXCAF/PACKAGES
src/XCAFDoc/FILES
src/XCAFDoc/XCAFDoc.cxx
src/XCAFDoc/XCAFDoc.hxx
src/XCAFDoc/XCAFDoc_DocumentTool.cxx
src/XCAFDoc/XCAFDoc_DocumentTool.hxx
src/XCAFDoc/XCAFDoc_View.cxx [new file with mode: 0644]
src/XCAFDoc/XCAFDoc_View.hxx [new file with mode: 0644]
src/XCAFDoc/XCAFDoc_ViewTool.cxx [new file with mode: 0644]
src/XCAFDoc/XCAFDoc_ViewTool.hxx [new file with mode: 0644]
src/XCAFView/FILES [new file with mode: 0644]
src/XCAFView/XCAFView_Object.cxx [new file with mode: 0644]
src/XCAFView/XCAFView_Object.hxx [new file with mode: 0644]
src/XCAFView/XCAFView_ProjectionType.hxx [new file with mode: 0644]
src/XDEDRAW/FILES
src/XDEDRAW/XDEDRAW.cxx
src/XDEDRAW/XDEDRAW.hxx
src/XDEDRAW/XDEDRAW_Views.cxx [new file with mode: 0644]
src/XDEDRAW/XDEDRAW_Views.hxx [new file with mode: 0644]
src/XmlMXCAFDoc/FILES
src/XmlMXCAFDoc/XmlMXCAFDoc.cxx
src/XmlMXCAFDoc/XmlMXCAFDoc.hxx
src/XmlMXCAFDoc/XmlMXCAFDoc_ViewToolDriver.cxx [new file with mode: 0644]
src/XmlMXCAFDoc/XmlMXCAFDoc_ViewToolDriver.hxx [new file with mode: 0644]
tests/bugs/xde/bug28044 [new file with mode: 0644]

index 7dd68a5..c0ba1d8 100644 (file)
@@ -33,6 +33,8 @@
 #include <BinMXCAFDoc_MaterialDriver.hxx>
 #include <BinMXCAFDoc_MaterialToolDriver.hxx>
 #include <BinMXCAFDoc_ShapeToolDriver.hxx>
+#include <BinMXCAFDoc_ViewDriver.hxx>
+#include <BinMXCAFDoc_ViewToolDriver.hxx>
 #include <BinMXCAFDoc_VolumeDriver.hxx>
 #include <CDM_MessageDriver.hxx>
 #include <TNaming_NamedShape.hxx>
@@ -67,6 +69,7 @@ void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
   theDriverTable->AddDriver( new BinMXCAFDoc_DimensionDriver (theMsgDrv));
   theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver   (theMsgDrv));
   theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver (theMsgDrv));
+  theDriverTable->AddDriver( new BinMXCAFDoc_ViewDriver     (theMsgDrv));
 
   theDriverTable->AddDriver( new BinMXCAFDoc_ColorToolDriver   (theMsgDrv));
   theDriverTable->AddDriver( new BinMXCAFDoc_DocumentToolDriver(theMsgDrv));
@@ -74,4 +77,5 @@ void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
   theDriverTable->AddDriver( new BinMXCAFDoc_ShapeToolDriver   (theMsgDrv));
   theDriverTable->AddDriver( new BinMXCAFDoc_DimTolToolDriver  (theMsgDrv));
   theDriverTable->AddDriver( new BinMXCAFDoc_MaterialToolDriver(theMsgDrv));
+  theDriverTable->AddDriver( new BinMXCAFDoc_ViewToolDriver    (theMsgDrv));
 }
index 571748e..8a19c5c 100644 (file)
@@ -39,6 +39,8 @@ class BinMXCAFDoc_LayerToolDriver;
 class BinMXCAFDoc_ShapeToolDriver;
 class BinMXCAFDoc_DimTolToolDriver;
 class BinMXCAFDoc_MaterialToolDriver;
+class BinMXCAFDoc_ViewDriver;
+class BinMXCAFDoc_ViewToolDriver;
 
 
 
@@ -83,6 +85,8 @@ friend class BinMXCAFDoc_LayerToolDriver;
 friend class BinMXCAFDoc_ShapeToolDriver;
 friend class BinMXCAFDoc_DimTolToolDriver;
 friend class BinMXCAFDoc_MaterialToolDriver;
+friend class BinMXCAFDoc_ViewDriver;
+friend class BinMXCAFDoc_ViewToolDriver;
 
 };
 
diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.cxx b/src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.cxx
new file mode 100644 (file)
index 0000000..11bbc89
--- /dev/null
@@ -0,0 +1,63 @@
+// Created on: 2016-10-24
+// Created by: Irina KRYLOVA
+// 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_ViewDriver.hxx>
+#include <BinObjMgt_Persistent.hxx>
+#include <CDM_MessageDriver.hxx>
+#include <Standard_Type.hxx>
+#include <TDF_Attribute.hxx>
+#include <XCAFDoc_View.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_ViewDriver, BinMDF_ADriver)
+
+//=======================================================================
+//function : Constructor
+//purpose  : 
+//=======================================================================
+BinMXCAFDoc_ViewDriver::BinMXCAFDoc_ViewDriver (const Handle(CDM_MessageDriver)& theMsgDriver)
+: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_View)->Name())
+{
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) BinMXCAFDoc_ViewDriver::NewEmpty() const
+{
+  return new XCAFDoc_View();
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+Standard_Boolean BinMXCAFDoc_ViewDriver::Paste (const BinObjMgt_Persistent&  /*theSource*/,
+                                                const Handle(TDF_Attribute)& /*theTarget*/,
+                                                BinObjMgt_RRelocationTable&  /*theRelocTable*/) const
+{
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+void BinMXCAFDoc_ViewDriver::Paste (const Handle(TDF_Attribute)&  /*theSource*/,
+                                    BinObjMgt_Persistent&         /*theTarget*/,
+                                    BinObjMgt_SRelocationTable&   /*theRelocTable*/) const
+{
+}
diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.hxx b/src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.hxx
new file mode 100644 (file)
index 0000000..bd86b63
--- /dev/null
@@ -0,0 +1,56 @@
+// Created on: 2016-10-24
+// Created by: Irina KRYLOVA
+// 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_ViewDriver_HeaderFile
+#define _BinMXCAFDoc_ViewDriver_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 CDM_MessageDriver;
+class TDF_Attribute;
+class BinObjMgt_Persistent;
+
+class BinMXCAFDoc_ViewDriver;
+DEFINE_STANDARD_HANDLE(BinMXCAFDoc_ViewDriver, BinMDF_ADriver)
+
+class BinMXCAFDoc_ViewDriver : public BinMDF_ADriver
+{
+
+public:
+
+  
+  Standard_EXPORT BinMXCAFDoc_ViewDriver (const Handle(CDM_MessageDriver)& 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_ViewDriver, BinMDF_ADriver)
+
+};
+
+#endif // _BinMXCAFDoc_ViewDriver_HeaderFile
diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.cxx b/src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.cxx
new file mode 100644 (file)
index 0000000..33391b0
--- /dev/null
@@ -0,0 +1,65 @@
+// Created on: 2016-10-24
+// Created by: Irina KRYLOVA
+// 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_ViewToolDriver.hxx>
+#include <BinObjMgt_Persistent.hxx>
+#include <CDM_MessageDriver.hxx>
+#include <Standard_Type.hxx>
+#include <TDF_Attribute.hxx>
+#include <XCAFDoc_ViewTool.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_ViewToolDriver, BinMDF_ADriver)
+
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+BinMXCAFDoc_ViewToolDriver::BinMXCAFDoc_ViewToolDriver
+  (const Handle(CDM_MessageDriver)& theMsgDriver)
+: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_ViewTool)->Name())
+{
+}
+
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) BinMXCAFDoc_ViewToolDriver::NewEmpty() const
+{
+  return new XCAFDoc_ViewTool();
+}
+
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+Standard_Boolean BinMXCAFDoc_ViewToolDriver::Paste
+  (const BinObjMgt_Persistent& /*theSource*/,
+   const Handle(TDF_Attribute)& /*theTarget*/,
+   BinObjMgt_RRelocationTable& /*theRelocTable*/) const 
+{
+  return Standard_True;
+}
+
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+void BinMXCAFDoc_ViewToolDriver::Paste
+  (const Handle(TDF_Attribute)& /*theSource*/,
+   BinObjMgt_Persistent& /*theTarget*/,
+   BinObjMgt_SRelocationTable& /*theRelocTable*/) const {
+}
diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.hxx b/src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.hxx
new file mode 100644 (file)
index 0000000..144f8b3
--- /dev/null
@@ -0,0 +1,52 @@
+// Created on: 2016-10-24
+// Created by: Irina KRYLOVA
+// 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_ViewToolDriver_HeaderFile
+#define _BinMXCAFDoc_ViewToolDriver_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 CDM_MessageDriver;
+class TDF_Attribute;
+class BinObjMgt_Persistent;
+
+
+class BinMXCAFDoc_ViewToolDriver;
+DEFINE_STANDARD_HANDLE(BinMXCAFDoc_ViewToolDriver, BinMDF_ADriver)
+
+
+class BinMXCAFDoc_ViewToolDriver : public BinMDF_ADriver
+{
+
+public:
+
+  
+  Standard_EXPORT BinMXCAFDoc_ViewToolDriver(const Handle(CDM_MessageDriver)& 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_ViewToolDriver, BinMDF_ADriver)
+
+};
+#endif // _BinMXCAFDoc_ViewToolDriver_HeaderFile
index 99b3ced..5d89c2a 100644 (file)
@@ -33,5 +33,9 @@ BinMXCAFDoc_MaterialToolDriver.cxx
 BinMXCAFDoc_MaterialToolDriver.hxx
 BinMXCAFDoc_ShapeToolDriver.cxx
 BinMXCAFDoc_ShapeToolDriver.hxx
+BinMXCAFDoc_ViewDriver.cxx
+BinMXCAFDoc_ViewDriver.hxx
+BinMXCAFDoc_ViewToolDriver.cxx
+BinMXCAFDoc_ViewToolDriver.hxx
 BinMXCAFDoc_VolumeDriver.cxx
 BinMXCAFDoc_VolumeDriver.hxx
index ad9e0b5..b7774d3 100755 (executable)
@@ -2,3 +2,4 @@ XCAFApp
 XCAFDimTolObjects
 XCAFDoc
 XCAFPrs
+XCAFView
index b06717f..4d51a8c 100755 (executable)
@@ -42,5 +42,9 @@ XCAFDoc_ShapeMapTool.cxx
 XCAFDoc_ShapeMapTool.hxx
 XCAFDoc_ShapeTool.cxx
 XCAFDoc_ShapeTool.hxx
+XCAFDoc_View.cxx
+XCAFDoc_View.hxx
+XCAFDoc_ViewTool.cxx
+XCAFDoc_ViewTool.hxx
 XCAFDoc_Volume.cxx
 XCAFDoc_Volume.hxx
index e40e7b6..590e462 100644 (file)
@@ -194,3 +194,36 @@ Standard_GUID XCAFDoc::SHUORefGUID ()
   static Standard_GUID ID ("efd212ea-6dfd-11d4-b9c8-0060b0ee281b");
   return ID;
 }
+
+//=======================================================================
+//function : ViewRefGUID
+//purpose  : 
+//=======================================================================
+
+Standard_GUID XCAFDoc::ViewRefGUID()
+{
+  static Standard_GUID ID("efd213e5-6dfd-11d4-b9c8-0060b0ee281b");
+  return ID;
+}
+
+//=======================================================================
+//function : ViewRefShapeGUID
+//purpose  : 
+//=======================================================================
+
+Standard_GUID XCAFDoc::ViewRefShapeGUID()
+{
+  static Standard_GUID ID("efd213e6-6dfd-11d4-b9c8-0060b0ee281b");
+  return ID;
+}
+
+//=======================================================================
+//function : ViewRefGDTGUID
+//purpose  : 
+//=======================================================================
+
+Standard_GUID XCAFDoc::ViewRefGDTGUID()
+{
+  static Standard_GUID ID("efd213e7-6dfd-11d4-b9c8-0060b0ee281b");
+  return ID;
+}
index 9b44ad7..a806cae 100644 (file)
@@ -41,6 +41,7 @@ class XCAFDoc_LayerTool;
 class XCAFDoc_MaterialTool;
 class XCAFDoc_GraphNode;
 class XCAFDoc_Editor;
+class XCAFDoc_ViewTool;
 
 
 //! Definition of general structure of DECAF document
@@ -104,8 +105,14 @@ public:
   //! Returns GUID for UAttribute identifying specified higher usage occurrence
   Standard_EXPORT static Standard_GUID SHUORefGUID();
 
+  //! Return GUIDs for TreeNode representing specified types of View
+  Standard_EXPORT static Standard_GUID ViewRefGUID();
 
+  //! Return GUIDs for TreeNode representing specified types of View
+  Standard_EXPORT static Standard_GUID ViewRefShapeGUID();
 
+  //! Return GUIDs for TreeNode representing specified types of View
+  Standard_EXPORT static Standard_GUID ViewRefGDTGUID();
 
 protected:
 
@@ -135,6 +142,7 @@ friend class XCAFDoc_LayerTool;
 friend class XCAFDoc_MaterialTool;
 friend class XCAFDoc_GraphNode;
 friend class XCAFDoc_Editor;
+friend class XCAFDoc_ViewTool;
 
 };
 
index b00f02e..52dd3d7 100644 (file)
@@ -30,6 +30,7 @@
 #include <XCAFDoc_LayerTool.hxx>
 #include <XCAFDoc_MaterialTool.hxx>
 #include <XCAFDoc_ShapeTool.hxx>
+#include <XCAFDoc_ViewTool.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_DocumentTool,TDF_Attribute)
 
@@ -81,6 +82,7 @@ Handle(XCAFDoc_DocumentTool) XCAFDoc_DocumentTool::Set(const TDF_Label& L,
     XCAFDoc_LayerTool::Set(LayersLabel(L));
     XCAFDoc_DimTolTool::Set(DGTsLabel(L));
     XCAFDoc_MaterialTool::Set(MaterialsLabel(L));
+    XCAFDoc_ViewTool::Set(ViewsLabel(L));
   }
   return A;
 }
@@ -183,6 +185,19 @@ TDF_Label XCAFDoc_DocumentTool::MaterialsLabel(const TDF_Label& acces)
 }
 
 
+//=======================================================================
+//function : ViewsLabel
+//purpose  : 
+//=======================================================================
+
+TDF_Label XCAFDoc_DocumentTool::ViewsLabel(const TDF_Label& acces)
+{
+  TDF_Label L = DocLabel(acces).FindChild(7, Standard_True);
+  TDataStd_Name::Set(L, "Views");
+  return L;
+}
+
+
 //=======================================================================
 //function : ShapeTool
 //purpose  : 
@@ -237,6 +252,16 @@ Handle(XCAFDoc_MaterialTool) XCAFDoc_DocumentTool::MaterialTool(const TDF_Label&
   return XCAFDoc_MaterialTool::Set(MaterialsLabel(acces));
 }
 
+//=======================================================================
+//function : ViewTool
+//purpose  : 
+//=======================================================================
+
+Handle(XCAFDoc_ViewTool) XCAFDoc_DocumentTool::ViewTool(const TDF_Label& acces)
+{
+  return XCAFDoc_ViewTool::Set(ViewsLabel(acces));
+}
+
 
 //=======================================================================
 //function : ID
index e67d725..5da41aa 100644 (file)
@@ -29,6 +29,7 @@ class XCAFDoc_ColorTool;
 class XCAFDoc_LayerTool;
 class XCAFDoc_DimTolTool;
 class XCAFDoc_MaterialTool;
+class XCAFDoc_ViewTool;
 class TDF_Attribute;
 class TDF_RelocationTable;
 
@@ -76,6 +77,9 @@ public:
   
   //! Returns sub-label of DocLabel() with tag 5.
   Standard_EXPORT static TDF_Label MaterialsLabel (const TDF_Label& acces);
+
+  //! Returns sub-label of DocLabel() with tag 7.
+  Standard_EXPORT static TDF_Label ViewsLabel(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);
@@ -91,6 +95,9 @@ public:
   
   //! Creates (if it does not exist) DimTolTool attribute on DGTsLabel().
   Standard_EXPORT static Handle(XCAFDoc_MaterialTool) MaterialTool (const TDF_Label& acces);
+
+  //! Creates (if it does not exist) ViewTool attribute on ViewsLabel().
+  Standard_EXPORT static Handle(XCAFDoc_ViewTool) ViewTool(const TDF_Label& acces);
   
   Standard_EXPORT XCAFDoc_DocumentTool();
   
diff --git a/src/XCAFDoc/XCAFDoc_View.cxx b/src/XCAFDoc/XCAFDoc_View.cxx
new file mode 100644 (file)
index 0000000..dad74ff
--- /dev/null
@@ -0,0 +1,281 @@
+// Created on: 2016-10-19
+// Created by: Irina KRYLOVA
+// 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 <XCAFDoc_View.hxx>
+
+#include <Standard_GUID.hxx>
+#include <TDataStd_AsciiString.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_Real.hxx>
+#include <TDataStd_RealArray.hxx>
+#include <TDataXtd_Axis.hxx>
+#include <TDataXtd_Geometry.hxx>
+#include <TDataXtd_Plane.hxx>
+#include <TDataXtd_Point.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <XCAFDoc.hxx>
+#include <XCAFView_Object.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_View, TDF_Attribute)
+
+enum ChildLab
+{
+  ChildLab_Name = 1,
+  ChildLab_Type,
+  ChildLab_ProjectionPoint,
+  ChildLab_ViewDirection,
+  ChildLab_UpDirection,
+  ChildLab_ZoomFactor,
+  ChildLab_WindowHorizontalSize,
+  ChildLab_WindowVerticalSize,
+  ChildLab_ClippingPlane,
+  ChildLab_FrontPlaneDistance,
+  ChildLab_BackPlaneDistance,
+  ChildLab_ViewVolumeSidesClipping
+};
+
+//=======================================================================
+//function : XCAFDoc_View
+//purpose  : 
+//=======================================================================
+XCAFDoc_View::XCAFDoc_View()
+{
+}
+
+
+//=======================================================================
+//function : GetID
+//purpose  : 
+//=======================================================================
+const Standard_GUID& XCAFDoc_View::GetID() 
+{
+  static Standard_GUID ViewID ("efd213e8-6dfd-11d4-b9c8-0060b0ee281b");
+  return ViewID; 
+}
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+Handle(XCAFDoc_View) XCAFDoc_View::Set(const TDF_Label& theLabel) 
+{
+  Handle(XCAFDoc_View) A;
+  if (!theLabel.FindAttribute(XCAFDoc_View::GetID(), A)) {
+    A = new XCAFDoc_View();
+    theLabel.AddAttribute(A);
+  }
+  return A;
+}
+
+//=======================================================================
+//function : SetObject
+//purpose  : 
+//=======================================================================
+void XCAFDoc_View::SetObject (const Handle(XCAFView_Object)& theObject)
+{
+  Backup();
+
+  TDF_ChildIterator anIter(Label());
+  for(;anIter.More(); anIter.Next())
+  {
+    anIter.Value().ForgetAllAttributes();
+  }
+
+  // Name
+  TDataStd_AsciiString::Set(Label().FindChild(ChildLab_Name), theObject->Name()->String());
+
+  // Type
+  TDataStd_Integer::Set(Label().FindChild(ChildLab_Type), theObject->Type());
+
+  // Projection point
+  TDataXtd_Point::Set(Label().FindChild(ChildLab_ProjectionPoint), theObject->ProjectionPoint());
+
+  // View direction
+  gp_Ax1 aViewDir(gp_Pnt(), theObject->ViewDirection());
+  TDataXtd_Axis::Set(Label().FindChild(ChildLab_ViewDirection), aViewDir);
+
+  // Up direction
+  gp_Ax1 anUpDir(gp_Pnt(), theObject->UpDirection());
+  TDataXtd_Axis::Set(Label().FindChild(ChildLab_UpDirection), anUpDir);
+  
+  // Zoom factor
+  TDataStd_Real::Set(Label().FindChild(ChildLab_ZoomFactor), theObject->ZoomFactor());
+
+  // Window horizontal size
+  TDataStd_Real::Set(Label().FindChild(ChildLab_WindowHorizontalSize), theObject->WindowHorizontalSize());
+
+  // Window vertical size
+  TDataStd_Real::Set(Label().FindChild(ChildLab_WindowVerticalSize), theObject->WindowVerticalSize());
+
+  // Clipping plane
+  if (theObject->HasClippingPlane())
+  {
+    TDataXtd_Plane::Set(Label().FindChild(ChildLab_ClippingPlane), theObject->ClippingPlane());
+  }
+
+  // Front plane clipping
+  if (theObject->HasFrontPlaneClipping())
+  {
+    TDataStd_Real::Set(Label().FindChild(ChildLab_FrontPlaneDistance), theObject->FrontPlaneDistance());
+  }
+
+  // Back plane clipping
+  if (theObject->HasBackPlaneClipping())
+  {
+    TDataStd_Real::Set(Label().FindChild(ChildLab_BackPlaneDistance), theObject->BackPlaneDistance());
+  }
+
+  // View volume sides clipping
+  Standard_Integer aValue = theObject->HasViewVolumeSidesClipping() ? 1 : 0;
+  TDataStd_Integer::Set(Label().FindChild(ChildLab_ViewVolumeSidesClipping), aValue);
+}
+
+//=======================================================================
+//function : GetObject
+//purpose  : 
+//=======================================================================
+Handle(XCAFView_Object) XCAFDoc_View::GetObject()  const
+{
+  Handle(XCAFView_Object) anObj = new XCAFView_Object();
+
+  // Name
+  Handle(TDataStd_AsciiString) aName;
+  if (Label().FindChild(ChildLab_Name).FindAttribute(TDataStd_AsciiString::GetID(), aName))
+  {
+    anObj->SetName(new TCollection_HAsciiString(aName->Get()));
+  }
+
+  // Type
+  Handle(TDataStd_Integer) aType;
+  if (Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType))
+  {
+    anObj->SetType((XCAFView_ProjectionType)aType->Get());
+  }
+
+  // Projection point
+  Handle(TDataXtd_Point) aPointAttr;
+  if (Label().FindChild(ChildLab_ProjectionPoint).FindAttribute(TDataXtd_Point::GetID(), aPointAttr)) {
+    gp_Pnt aPoint;
+    TDataXtd_Geometry::Point(aPointAttr->Label(), aPoint);
+    anObj->SetProjectionPoint(aPoint);
+  }
+
+  // View direction
+  Handle(TDataXtd_Axis) aViewDirAttr;
+  if (Label().FindChild(ChildLab_ViewDirection).FindAttribute(TDataXtd_Axis::GetID(), aViewDirAttr)) {
+    gp_Ax1 aDir;
+    TDataXtd_Geometry::Axis(aViewDirAttr->Label(), aDir);
+    anObj->SetViewDirection(aDir.Direction());
+  }
+
+  // Up direction
+  Handle(TDataXtd_Axis) anUpDirAttr;
+  if (Label().FindChild(ChildLab_UpDirection).FindAttribute(TDataXtd_Axis::GetID(), anUpDirAttr)) {
+    gp_Ax1 aDir;
+    TDataXtd_Geometry::Axis(anUpDirAttr->Label(), aDir);
+    anObj->SetUpDirection(aDir.Direction());
+  }
+
+  // Zoom factor
+  Handle(TDataStd_Real) aZoomFactor;
+  if (Label().FindChild(ChildLab_ZoomFactor).FindAttribute(TDataStd_Real::GetID(), aZoomFactor))
+  {
+    anObj->SetZoomFactor(aZoomFactor->Get());
+  }
+
+  // Window horizontal size
+  Handle(TDataStd_Real) aWindowHorizontalSize;
+  if (Label().FindChild(ChildLab_WindowHorizontalSize).FindAttribute(TDataStd_Real::GetID(), aWindowHorizontalSize))
+  {
+    anObj->SetWindowHorizontalSize(aWindowHorizontalSize->Get());
+  }
+
+  // Window vertical size
+  Handle(TDataStd_Real) aWindowVerticalSize;
+  if (Label().FindChild(ChildLab_WindowVerticalSize).FindAttribute(TDataStd_Real::GetID(), aWindowVerticalSize))
+  {
+    anObj->SetWindowVerticalSize(aWindowVerticalSize->Get());
+  }
+
+  // Clipping plane
+  Handle(TDataXtd_Plane) aPlaneAttr;
+  if (Label().FindChild(ChildLab_ClippingPlane).FindAttribute(TDataXtd_Plane::GetID(), aPlaneAttr)) {
+    gp_Pln aPlane;
+    TDataXtd_Geometry::Plane(aPlaneAttr->Label(), aPlane);
+    anObj->SetClippingPlane(aPlane);
+  }
+
+  // Front plane clipping
+  Handle(TDataStd_Real) aFrontPlaneDistance;
+  if (Label().FindChild(ChildLab_FrontPlaneDistance).FindAttribute(TDataStd_Real::GetID(), aFrontPlaneDistance))
+  {
+    anObj->SetFrontPlaneDistance(aFrontPlaneDistance->Get());
+  }
+
+  // Back plane clipping
+  Handle(TDataStd_Real) aBackPlaneDistance;
+  if (Label().FindChild(ChildLab_BackPlaneDistance).FindAttribute(TDataStd_Real::GetID(), aBackPlaneDistance))
+  {
+    anObj->SetBackPlaneDistance(aBackPlaneDistance->Get());
+  }
+
+  // View volume sides clipping
+  Handle(TDataStd_Integer) aViewVolumeSidesClipping;
+  if (Label().FindChild(ChildLab_ViewVolumeSidesClipping).FindAttribute(TDataStd_Integer::GetID(), aViewVolumeSidesClipping))
+  {
+    Standard_Boolean aValue = (aViewVolumeSidesClipping->Get() == 1);
+    anObj->SetViewVolumeSidesClipping(aValue);
+  }
+
+  return anObj;
+}
+
+//=======================================================================
+//function : ID
+//purpose  : 
+//=======================================================================
+const Standard_GUID& XCAFDoc_View::ID() const
+{
+  return GetID();
+}
+
+//=======================================================================
+//function : Restore
+//purpose  : 
+//=======================================================================
+void XCAFDoc_View::Restore(const Handle(TDF_Attribute)& /*With*/) 
+{
+}
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) XCAFDoc_View::NewEmpty() const
+{
+  return new XCAFDoc_View();
+}
+
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+void XCAFDoc_View::Paste(const Handle(TDF_Attribute)& /*Into*/,
+                         const Handle(TDF_RelocationTable)& /*RT*/) const
+{
+}
diff --git a/src/XCAFDoc/XCAFDoc_View.hxx b/src/XCAFDoc/XCAFDoc_View.hxx
new file mode 100644 (file)
index 0000000..f48aad2
--- /dev/null
@@ -0,0 +1,61 @@
+// Created on: 2016-10-19
+// Created by: Irina KRYLOVA
+// 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;
+
+
+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
diff --git a/src/XCAFDoc/XCAFDoc_ViewTool.cxx b/src/XCAFDoc/XCAFDoc_ViewTool.cxx
new file mode 100644 (file)
index 0000000..62e9193
--- /dev/null
@@ -0,0 +1,309 @@
+// Created on: 2016-10-19
+// Created by: Irina KRYLOVA
+// 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 <TDataStd_Name.hxx>
+#include <TDataStd_TreeNode.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_ChildIDIterator.hxx>
+#include <TDF_Label.hxx>
+#include <XCAFDoc.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XCAFDoc_GraphNode.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
+#include <XCAFDoc_View.hxx>
+#include <XCAFDoc_ViewTool.hxx>
+
+
+IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_ViewTool, TDF_Attribute)
+
+//=======================================================================
+//function : XCAFDoc_ViewTool
+//purpose  : 
+//=======================================================================
+XCAFDoc_ViewTool::XCAFDoc_ViewTool()
+{
+}
+
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+Handle(XCAFDoc_ViewTool) XCAFDoc_ViewTool::Set(const TDF_Label& L) 
+{
+  Handle(XCAFDoc_ViewTool) A;
+  if (!L.FindAttribute (XCAFDoc_ViewTool::GetID(), A)) {
+    A = new XCAFDoc_ViewTool ();
+    L.AddAttribute(A);
+  }
+  return A;
+}
+
+
+//=======================================================================
+//function : GetID
+//purpose  : 
+//=======================================================================
+const Standard_GUID& XCAFDoc_ViewTool::GetID() 
+{
+  static Standard_GUID ViewToolID ("efd213e4-6dfd-11d4-b9c8-0060b0ee281b");
+  return ViewToolID; 
+}
+
+
+//=======================================================================
+//function : BaseLabel
+//purpose  : 
+//=======================================================================
+TDF_Label XCAFDoc_ViewTool::BaseLabel() const
+{
+  return Label();
+}
+
+//=======================================================================
+//function : IsView
+//purpose  : 
+//=======================================================================
+Standard_Boolean XCAFDoc_ViewTool::IsView(const TDF_Label& theLabel) const
+{
+  Handle(XCAFDoc_View) aViewAttr;
+  if(theLabel.FindAttribute(XCAFDoc_View::GetID(), aViewAttr)) {
+    return Standard_True;
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : GetViewLabels
+//purpose  : 
+//=======================================================================
+void XCAFDoc_ViewTool::GetViewLabels(TDF_LabelSequence& theLabels) const
+{
+  theLabels.Clear();
+  TDF_ChildIterator aChildIterator( Label() ); 
+  for (; aChildIterator.More(); aChildIterator.Next()) {
+    TDF_Label aLabel = aChildIterator.Value();
+    if ( IsView(aLabel)) theLabels.Append(aLabel);
+  }
+}
+
+//=======================================================================
+//function : AddView
+//purpose  : 
+//=======================================================================
+TDF_Label XCAFDoc_ViewTool::AddView()
+{
+  TDF_Label aViewL;
+  TDF_TagSource aTag;
+  aViewL = aTag.NewChild ( Label() );
+  Handle(XCAFDoc_View) aView = XCAFDoc_View::Set(aViewL);
+  TCollection_AsciiString aStr = "View";
+  TDataStd_Name::Set(aViewL, aStr);
+  return aViewL;
+}
+
+//=======================================================================
+//function : SetView
+//purpose  : 
+//=======================================================================
+void XCAFDoc_ViewTool::SetView(const TDF_LabelSequence& theShapeLabels,
+                               const TDF_LabelSequence& theGDTLabels,
+                               const TDF_Label& theViewL) const
+{
+  if(!IsView(theViewL))
+    return;
+
+  Handle(XCAFDoc_GraphNode) aChGNode;
+  Handle(XCAFDoc_GraphNode) aShapeGNode;
+  Handle(XCAFDoc_GraphNode) aGDTGNode;
+  
+  if ( theViewL.FindAttribute (XCAFDoc::ViewRefShapeGUID(), aChGNode) ) {
+    while (aChGNode->NbFathers() > 0) {
+      aShapeGNode = aChGNode->GetFather(1);
+      aShapeGNode->UnSetChild(aChGNode);
+      if(aShapeGNode->NbChildren() == 0)
+        aShapeGNode->ForgetAttribute( XCAFDoc::ViewRefShapeGUID() );
+    }
+    theViewL.ForgetAttribute ( XCAFDoc::ViewRefShapeGUID() );
+  }
+  if ( theViewL.FindAttribute (XCAFDoc::ViewRefGDTGUID(), aChGNode) ) {
+    while (aChGNode->NbFathers() > 0) {
+      aShapeGNode = aChGNode->GetFather(1);
+      aShapeGNode->UnSetChild(aChGNode);
+      if(aShapeGNode->NbChildren() == 0)
+        aShapeGNode->ForgetAttribute( XCAFDoc::ViewRefGDTGUID() );
+    }
+    theViewL.ForgetAttribute ( XCAFDoc::ViewRefGDTGUID() );
+  }
+  
+  if (!theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode) && theShapeLabels.Length() > 0) {
+    aChGNode = new XCAFDoc_GraphNode;
+    aChGNode = XCAFDoc_GraphNode::Set(theViewL);
+    aChGNode->SetGraphID(XCAFDoc::ViewRefShapeGUID());
+  }
+  for(Standard_Integer i = theShapeLabels.Lower(); i <= theShapeLabels.Upper(); i++)
+  {
+    if (!theShapeLabels.Value(i).FindAttribute(XCAFDoc::ViewRefShapeGUID(), aShapeGNode) ) {
+      aShapeGNode = new XCAFDoc_GraphNode;
+      aShapeGNode = XCAFDoc_GraphNode::Set(theShapeLabels.Value(i));
+    }
+    aShapeGNode->SetGraphID(XCAFDoc::ViewRefShapeGUID());
+    aShapeGNode->SetChild(aChGNode);
+    aChGNode->SetFather(aShapeGNode);
+  }
+  
+  if (!theViewL.FindAttribute(XCAFDoc::ViewRefGDTGUID(), aChGNode) && theGDTLabels.Length() > 0) {
+    aChGNode = new XCAFDoc_GraphNode;
+    aChGNode = XCAFDoc_GraphNode::Set(theViewL);
+    aChGNode->SetGraphID(XCAFDoc::ViewRefGDTGUID());
+  }
+  for(Standard_Integer i = theGDTLabels.Lower(); i <= theGDTLabels.Upper(); i++)
+  {
+    if(!theGDTLabels.Value(i).FindAttribute(XCAFDoc::ViewRefGDTGUID(), aGDTGNode) ) {
+      aGDTGNode = new XCAFDoc_GraphNode;
+      aGDTGNode = XCAFDoc_GraphNode::Set(theGDTLabels.Value(i));
+    }
+    aGDTGNode->SetGraphID(XCAFDoc::ViewRefGDTGUID());
+    aGDTGNode->SetChild(aChGNode);
+    aChGNode->SetFather(aGDTGNode);
+  }
+}
+
+//=======================================================================
+//function : GetRefShapeLabel
+//purpose  : 
+//=======================================================================
+Standard_Boolean XCAFDoc_ViewTool::GetRefShapeLabel(const TDF_Label& theViewL,
+                                                    TDF_LabelSequence& theShapeLabels) const
+{
+  theShapeLabels.Clear();
+  Handle(TDataStd_TreeNode) aNode;
+  if( !theViewL.FindAttribute(XCAFDoc::ViewRefGUID(), aNode) || !aNode->HasFather() ) {
+    Handle(XCAFDoc_GraphNode) aGNode;
+    if( theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aGNode) && aGNode->NbFathers() > 0 ) {
+      for(Standard_Integer i = 1; i <= aGNode->NbFathers(); i++)
+        theShapeLabels.Append(aGNode->GetFather(i)->Label());
+      return Standard_True;
+    }
+    else 
+      return Standard_False;
+  }
+
+  theShapeLabels.Append(aNode->Father()->Label());
+  return Standard_True;
+}
+
+//=======================================================================
+//function : GetRefGDTLabel
+//purpose  : 
+//=======================================================================
+Standard_Boolean XCAFDoc_ViewTool::GetRefGDTLabel(const TDF_Label& theViewL,
+                                                  TDF_LabelSequence& theGDTLabels) const
+{
+  theGDTLabels.Clear();
+  Handle(TDataStd_TreeNode) aNode;
+  if( !theViewL.FindAttribute(XCAFDoc::ViewRefGUID(), aNode) || !aNode->HasFather() ) {
+    Handle(XCAFDoc_GraphNode) aGNode;
+    if( theViewL.FindAttribute(XCAFDoc::ViewRefGDTGUID(), aGNode) && aGNode->NbFathers() > 0 ) {
+      for(Standard_Integer i = 1; i <= aGNode->NbFathers(); i++)
+        theGDTLabels.Append(aGNode->GetFather(i)->Label());
+      return Standard_True;
+    }
+    else 
+      return Standard_False;
+  }
+
+  theGDTLabels.Append(aNode->Father()->Label());
+  return Standard_True;
+}
+
+//=======================================================================
+//function : GetViewLabelsForShape
+//purpose  : 
+//=======================================================================
+Standard_Boolean XCAFDoc_ViewTool::GetViewLabelsForShape(const TDF_Label& theShapeL,
+                                                         TDF_LabelSequence& theViews) const
+{
+  Handle(XCAFDoc_GraphNode) aGNode;
+  Standard_Boolean aResult = Standard_False;
+  if (theShapeL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aGNode) && aGNode->NbChildren() > 0) {
+    for(Standard_Integer i = 1; i <= aGNode->NbChildren(); i++)
+    {
+      theViews.Append(aGNode->GetChild(i)->Label());
+    }
+    aResult = Standard_True;
+  }
+  return aResult;
+}
+
+//=======================================================================
+//function : GetViewLabelsForGDT
+//purpose  : 
+//=======================================================================
+Standard_Boolean XCAFDoc_ViewTool::GetViewLabelsForGDT(const TDF_Label& theGDTL,
+                                                       TDF_LabelSequence& theViews) const
+{
+  Handle(XCAFDoc_GraphNode) aGNode;
+  Standard_Boolean aResult = Standard_False;
+  if (theGDTL.FindAttribute(XCAFDoc::ViewRefGDTGUID(), aGNode) && aGNode->NbChildren() > 0) {
+    for(Standard_Integer i = 1; i <= aGNode->NbChildren(); i++)
+    {
+      theViews.Append(aGNode->GetChild(i)->Label());
+    }
+    aResult = Standard_True;
+  }
+  return aResult;
+}
+
+//=======================================================================
+//function : ID
+//purpose  : 
+//=======================================================================
+const Standard_GUID& XCAFDoc_ViewTool::ID() const
+{
+  return GetID();
+}
+
+
+//=======================================================================
+//function : Restore
+//purpose  : 
+//=======================================================================
+void XCAFDoc_ViewTool::Restore(const Handle(TDF_Attribute)& /*with*/) 
+{
+}
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) XCAFDoc_ViewTool::NewEmpty() const
+{
+  return new XCAFDoc_ViewTool;
+}
+
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+void XCAFDoc_ViewTool::Paste(const Handle(TDF_Attribute)& /*into*/,
+                             const Handle(TDF_RelocationTable)& /*RT*/) const
+{
+}
+
diff --git a/src/XCAFDoc/XCAFDoc_ViewTool.hxx b/src/XCAFDoc/XCAFDoc_ViewTool.hxx
new file mode 100644 (file)
index 0000000..39827a9
--- /dev/null
@@ -0,0 +1,98 @@
+// Created on: 2016-10-19
+// Created by: Irina KRYLOVA
+// 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_ViewTool_HeaderFile
+#define _XCAFDoc_ViewTool_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TDF_Attribute.hxx>
+#include <Standard_Boolean.hxx>
+#include <TDF_LabelSequence.hxx>
+#include <Standard_Integer.hxx>
+
+class XCAFDoc_ShapeTool;
+class XCAFDoc_DimTolTool;
+class TDF_Label;
+class Standard_GUID;
+class TDF_Attribute;
+
+
+class XCAFDoc_ViewTool;
+DEFINE_STANDARD_HANDLE(XCAFDoc_ViewTool, TDF_Attribute)
+
+//! Provides tools to store and retrieve Views
+//! in and from TDocStd_Document
+//! Each View contains parts XCAFDoc_View attribute
+//! with all information about camera and view window.
+//! Also each view contain information of displayed shapes and GDTs
+//! as sets of shape and GDT labels.
+class XCAFDoc_ViewTool : public TDF_Attribute
+{
+
+public:
+
+  
+  Standard_EXPORT XCAFDoc_ViewTool();
+  
+  //! Creates (if not exist) ViewTool.
+  Standard_EXPORT static Handle(XCAFDoc_ViewTool) Set (const TDF_Label& L);
+  
+  Standard_EXPORT static const Standard_GUID& GetID();
+  
+  //! Returns the label under which Views are stored
+  Standard_EXPORT TDF_Label BaseLabel() const;
+  
+  //! Returns True if label belongs to a View table and
+  //! is a View definition
+  Standard_EXPORT Standard_Boolean IsView (const TDF_Label& theLabel) const;
+  
+  //! Returns a sequence of View labels currently stored
+  //! in the View table
+  Standard_EXPORT void GetViewLabels (TDF_LabelSequence& theLabels) const;
+  
+  //! Sets a link with GUID
+  Standard_EXPORT void SetView (const TDF_LabelSequence& theShapes, const TDF_LabelSequence& theGDTs, const TDF_Label& theViewL) const;
+
+  //! Returns all View labels defined for label ShapeL
+  Standard_EXPORT Standard_Boolean GetViewLabelsForShape (const TDF_Label& theShapeL, TDF_LabelSequence& theViews) const;
+
+  //! Returns all View labels defined for label GDTL
+  Standard_EXPORT Standard_Boolean GetViewLabelsForGDT (const TDF_Label& theGDTL, TDF_LabelSequence& theViews) const;
+  
+  //! Adds a view definition to a View table and returns its label
+  Standard_EXPORT TDF_Label AddView() ;
+  
+  //! Returns shape labels defined for label theViewL
+  //! Returns False if the theViewL is not in View table
+  Standard_EXPORT Standard_Boolean GetRefShapeLabel (const TDF_Label& theViewL, TDF_LabelSequence& theShapeLabels) const;
+  
+  //! Returns GDT labels defined for label theViewL
+  //! Returns False if the theViewL is not in View table
+  Standard_EXPORT Standard_Boolean GetRefGDTLabel (const TDF_Label& theViewL, TDF_LabelSequence& theGDTLabels) 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_ViewTool, TDF_Attribute)
+
+};
+#endif // _XCAFDoc_ViewTool_HeaderFile
diff --git a/src/XCAFView/FILES b/src/XCAFView/FILES
new file mode 100644 (file)
index 0000000..a7a8476
--- /dev/null
@@ -0,0 +1,3 @@
+XCAFView_Object.cxx
+XCAFView_Object.hxx
+XCAFView_ProjectionType.hxx
diff --git a/src/XCAFView/XCAFView_Object.cxx b/src/XCAFView/XCAFView_Object.cxx
new file mode 100644 (file)
index 0000000..40ff068
--- /dev/null
@@ -0,0 +1,53 @@
+// Created on: 2016-10-20
+// Created by: Irina KRYLOVA
+// 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 <XCAFView_Object.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XCAFView_Object,Standard_Transient)
+
+//=======================================================================
+//function : XCAFView_Object
+//purpose  : 
+//=======================================================================
+XCAFView_Object::XCAFView_Object()
+{
+  myHasClippingPlane = Standard_False;
+  myFrontPlaneClipping = Standard_False;
+  myBackPlaneClipping = Standard_False;
+  myViewVolumeSidesClipping = Standard_False;
+}
+
+//=======================================================================
+//function : XCAFView_Object
+//purpose  : 
+//=======================================================================
+XCAFView_Object::XCAFView_Object(const Handle(XCAFView_Object)& theObj)
+{
+   
+  myType = theObj->myType;
+  myProjectionPoint = theObj->myProjectionPoint;
+  myViewDirection = theObj->myViewDirection;
+  myUpDirection = theObj->myUpDirection;
+  myZoomFactor = theObj->myZoomFactor;
+  myWindowHorizontalSize = theObj->myWindowHorizontalSize;
+  myWindowVerticalSize = theObj->myWindowVerticalSize;
+  myHasClippingPlane = theObj->myHasClippingPlane;
+  myClippingPlane = theObj->myClippingPlane;
+  myFrontPlaneClipping = theObj->myFrontPlaneClipping;
+  myFrontPlaneDistance = theObj->myFrontPlaneDistance;
+  myBackPlaneClipping = theObj->myBackPlaneClipping;
+  myBackPlaneDistance = theObj->myBackPlaneDistance;
+  myViewVolumeSidesClipping = theObj->myViewVolumeSidesClipping;
+}
diff --git a/src/XCAFView/XCAFView_Object.hxx b/src/XCAFView/XCAFView_Object.hxx
new file mode 100644 (file)
index 0000000..a5ca708
--- /dev/null
@@ -0,0 +1,217 @@
+// Created on: 2016-10-20
+// Created by: Irina KRYLOVA
+// 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 _XCAFView_Object_HeaderFile
+#define _XCAFView_Object_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <gp_Dir.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <XCAFView_ProjectionType.hxx>
+
+class XCAFView_Object;
+DEFINE_STANDARD_HANDLE(XCAFView_Object, Standard_Transient)
+                            
+//! object to store view
+class XCAFView_Object : public Standard_Transient
+{
+
+public:
+  
+  Standard_EXPORT XCAFView_Object();
+  
+  Standard_EXPORT XCAFView_Object(const Handle(XCAFView_Object)& theObj);
+
+  Standard_EXPORT void SetName(Handle(TCollection_HAsciiString) theName)
+  {
+    myName = theName;
+  }
+
+  Standard_EXPORT Handle(TCollection_HAsciiString) Name()
+  {
+    return myName;
+  }
+
+  Standard_EXPORT void SetType(XCAFView_ProjectionType theType)
+  {
+    myType = theType;
+  }
+
+  Standard_EXPORT XCAFView_ProjectionType Type()
+  {
+    return myType;
+  }
+
+  Standard_EXPORT void SetProjectionPoint(gp_Pnt thePoint)
+  {
+    myProjectionPoint = thePoint;
+  }
+
+  Standard_EXPORT gp_Pnt ProjectionPoint()
+  {
+    return myProjectionPoint;
+  }
+
+  Standard_EXPORT void SetViewDirection(gp_Dir theDirection)
+  {
+    myViewDirection = theDirection;
+  }
+
+  Standard_EXPORT gp_Dir ViewDirection()
+  {
+    return myViewDirection;
+  }
+
+  Standard_EXPORT void SetUpDirection(gp_Dir theDirection)
+  {
+    myUpDirection = theDirection;
+  }
+
+  Standard_EXPORT gp_Dir UpDirection()
+  {
+    return myUpDirection;
+  }
+
+  Standard_EXPORT void SetZoomFactor(Standard_Real theZoomFactor)
+  {
+    myZoomFactor = theZoomFactor;
+  }
+
+  Standard_EXPORT Standard_Real ZoomFactor()
+  {
+    return myZoomFactor;
+  }
+
+  Standard_EXPORT void SetWindowHorizontalSize(Standard_Real theSize)
+  {
+    myWindowHorizontalSize = theSize;
+  }
+
+  Standard_EXPORT Standard_Real WindowHorizontalSize()
+  {
+    return myWindowHorizontalSize;
+  }
+
+  Standard_EXPORT void SetWindowVerticalSize(Standard_Real theSize)
+  {
+    myWindowVerticalSize = theSize;
+  }
+
+  Standard_EXPORT Standard_Real WindowVerticalSize()
+  {
+    return myWindowVerticalSize;
+  }
+
+  Standard_EXPORT void UnsetClippingPlane()
+  {
+    myHasClippingPlane = Standard_False;
+  }
+
+  Standard_EXPORT Standard_Boolean HasClippingPlane()
+  {
+    return myHasClippingPlane;
+  }
+
+  Standard_EXPORT void SetClippingPlane(gp_Pln thePlane)
+  {
+    myClippingPlane = thePlane;
+    myHasClippingPlane = Standard_True;
+  }
+
+  Standard_EXPORT gp_Pln ClippingPlane()
+  {
+    return myClippingPlane;
+  }
+
+  Standard_EXPORT void UnsetFrontPlaneClipping()
+  {
+    myFrontPlaneClipping = Standard_False;
+  }
+
+  Standard_EXPORT Standard_Boolean HasFrontPlaneClipping()
+  {
+    return myFrontPlaneClipping;
+  }
+
+  Standard_EXPORT void SetFrontPlaneDistance(Standard_Real theDistance)
+  {
+    myFrontPlaneDistance = theDistance;
+    myFrontPlaneClipping = Standard_True;
+  }
+
+  Standard_EXPORT Standard_Real FrontPlaneDistance()
+  {
+    return myFrontPlaneDistance;
+  }
+
+  Standard_EXPORT void UnsetBackPlaneClipping()
+  {
+    myBackPlaneClipping = Standard_False;
+  }
+
+  Standard_EXPORT Standard_Boolean HasBackPlaneClipping()
+  {
+    return myBackPlaneClipping;
+  }
+
+  Standard_EXPORT void SetBackPlaneDistance(Standard_Real theDistance)
+  {
+    myBackPlaneDistance = theDistance;
+    myBackPlaneClipping = Standard_True;
+  }
+
+  Standard_EXPORT Standard_Real BackPlaneDistance()
+  {
+    return myBackPlaneDistance;
+  }
+
+  Standard_EXPORT void SetViewVolumeSidesClipping(Standard_Boolean theViewVolumeSidesClipping)
+  {
+    myViewVolumeSidesClipping = theViewVolumeSidesClipping;
+  }
+
+  Standard_EXPORT Standard_Boolean HasViewVolumeSidesClipping()
+  {
+    return myViewVolumeSidesClipping;
+  }
+  
+  DEFINE_STANDARD_RTTIEXT(XCAFView_Object,Standard_Transient)
+
+private:
+
+  Handle(TCollection_HAsciiString) myName;
+  XCAFView_ProjectionType myType;
+  gp_Pnt myProjectionPoint;
+  gp_Dir myViewDirection;
+  gp_Dir myUpDirection;
+  Standard_Real myZoomFactor;
+  Standard_Real myWindowHorizontalSize;
+  Standard_Real myWindowVerticalSize;
+  Standard_Boolean myHasClippingPlane;
+  gp_Pln myClippingPlane;
+  Standard_Boolean myFrontPlaneClipping;
+  Standard_Real myFrontPlaneDistance;
+  Standard_Boolean myBackPlaneClipping;
+  Standard_Real myBackPlaneDistance;
+  Standard_Boolean myViewVolumeSidesClipping;
+
+};
+
+#endif // _XCAFView_Object_HeaderFile
diff --git a/src/XCAFView/XCAFView_ProjectionType.hxx b/src/XCAFView/XCAFView_ProjectionType.hxx
new file mode 100644 (file)
index 0000000..513efe8
--- /dev/null
@@ -0,0 +1,28 @@
+// Created on: 2016-10-20
+// Created by: Irina KRYLOVA
+// 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 _XCAFView_ProjectionType_HeaderFile
+#define _XCAFView_ProjectionType_HeaderFile
+
+//! Defines projection types of view
+enum XCAFView_ProjectionType
+{
+XCAFView_ProjectionType_NoCamera,
+XCAFView_ProjectionType_Parallel,
+XCAFView_ProjectionType_Central
+};
+
+#endif // _XCAFView_ProjectionType_HeaderFile
index 5606a37..9787e20 100644 (file)
@@ -12,3 +12,5 @@ XDEDRAW_GDTs.cxx
 XDEDRAW_GDTs.hxx
 XDEDRAW_Shapes.cxx
 XDEDRAW_Shapes.hxx
+XDEDRAW_Views.cxx
+XDEDRAW_Views.hxx
index 273f62e..7e698c8 100644 (file)
@@ -86,6 +86,7 @@
 #include <XDEDRAW_Props.hxx>
 #include <XDEDRAW_Shapes.hxx>
 #include <XDEDRAW_GDTs.hxx>
+#include <XDEDRAW_Views.hxx>
 #include <XSDRAW.hxx>
 #include <XSDRAWIGES.hxx>
 #include <XSDRAWSTEP.hxx>
@@ -793,6 +794,12 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer
     else if ( att->ID() == XCAFDoc::DatumRefGUID() ){
       type = "Datum Link";
     }
+    else if (att->ID() == XCAFDoc::ViewRefShapeGUID()){
+      type = "View Shape Link";
+    }
+    else if (att->ID() == XCAFDoc::ViewRefGDTGUID()){
+      type = "View GD&T Link";
+    }
     else return 0;
 
     Handle(XCAFDoc_GraphNode) DETGN = Handle(XCAFDoc_GraphNode)::DownCast(att);
@@ -1157,6 +1164,7 @@ void XDEDRAW::Init(Draw_Interpretor& di)
   XDEDRAW_Layers::InitCommands ( di );
   XDEDRAW_Props::InitCommands ( di );
   XDEDRAW_GDTs::InitCommands ( di );
+  XDEDRAW_Views::InitCommands(di);
   XDEDRAW_Common::InitCommands ( di );//moved from EXE
 
 }
index 7ef2fd4..253ee54 100644 (file)
@@ -27,6 +27,7 @@ class XDEDRAW_Colors;
 class XDEDRAW_Layers;
 class XDEDRAW_Props;
 class XDEDRAW_Common;
+class XDEDRAW_Views;
 
 
 //! Provides DRAW commands for work with DECAF data structures
diff --git a/src/XDEDRAW/XDEDRAW_Views.cxx b/src/XDEDRAW/XDEDRAW_Views.cxx
new file mode 100644 (file)
index 0000000..45ccc1f
--- /dev/null
@@ -0,0 +1,1147 @@
+// Created on: 2016-11-22
+// Created by: Irina KRYLOVA
+// 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 <XDEDRAW_Views.hxx>
+
+#include <DBRep.hxx>
+#include <DDocStd.hxx>
+#include <Draw.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TDF_Tool.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_LabelSequence.hxx>
+#include <TDocStd_Document.hxx>
+#include <XCAFDoc_DimTolTool.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
+#include <XCAFDoc_View.hxx>
+#include <XCAFDoc_ViewTool.hxx>
+#include <XCAFView_Object.hxx>
+
+//=======================================================================
+//function : setView
+//purpose  : 
+//=======================================================================
+static Standard_Integer setView(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XSetView Doc shape_label1 ... shape_labelN gdt_label1 ... gdt_labelN\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+  Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(aDoc->Main());
+  Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
+
+  TDF_LabelSequence aShapes, aGDTs;
+  for (Standard_Integer i = 2; i < argc; i++) {
+    TDF_Label aLabel;
+    TDF_Tool::Label(aDoc->GetData(), argv[i], aLabel);
+    if (aLabel.IsNull())
+      continue;
+    if (aShapeTool->IsShape(aLabel))
+      aShapes.Append(aLabel);
+    else if (aDimTolTool->IsDatum(aLabel) || aDimTolTool->IsDimension(aLabel) || aDimTolTool->IsGeomTolerance(aLabel))
+      aGDTs.Append(aLabel);
+  }
+
+  if (aShapes.Length() == 0 && aGDTs.Length() == 0)
+    return 1;
+
+  TDF_Label aViewL = aViewTool->AddView();
+  aViewTool->SetView(aShapes, aGDTs, aViewL);
+  TCollection_AsciiString anEntry;
+  TDF_Tool::Entry(aViewL, anEntry);
+  di << anEntry << "\n";
+  return 0;
+}
+
+//=======================================================================
+//function : isView
+//purpose  : 
+//=======================================================================
+static Standard_Integer isView(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XIsView Doc Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "Invalid label\n";
+    return 1;
+  }
+
+  if (aViewTool->IsView(aLabel))
+    di << "1";
+  else
+    di << "0";
+
+  return 0;
+}
+
+//=======================================================================
+//function : getRefShapes
+//purpose  : 
+//=======================================================================
+static Standard_Integer getRefShapes(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewShapes Doc ViewLabel\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull() || !aViewTool->IsView(aLabel))
+  {
+    di << "Invalid label\n";
+    return 1;
+  }
+
+  TDF_LabelSequence aShapes;
+  aViewTool->GetRefShapeLabel(aLabel, aShapes);
+  for (Standard_Integer i = 1; i <= aShapes.Length(); i++) {
+    TCollection_AsciiString anEntry;
+    TDF_Tool::Entry(aShapes.Value(i), anEntry);
+    di << anEntry << " ";
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getRefGDTs
+//purpose  : 
+//=======================================================================
+static Standard_Integer getRefGDTs(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewGDTs Doc ViewLabel\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull() || !aViewTool->IsView(aLabel))
+  {
+    di << "Invalid label\n";
+    return 1;
+  }
+
+  TDF_LabelSequence aGDTs;
+  aViewTool->GetRefShapeLabel(aLabel, aGDTs);
+  if (aGDTs.Length() == 0) {
+    di << "No GDTs in the given View\n";
+  }
+  for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) {
+    TCollection_AsciiString anEntry;
+    TDF_Tool::Entry(aGDTs.Value(i), anEntry);
+    di << anEntry << " ";
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setName
+//purpose  : 
+//=======================================================================
+static Standard_Integer setName(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 4) {
+    di << "Use: XSetViewName Doc ViewLabel name\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->SetName(new TCollection_HAsciiString(argv[3]));
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getName
+//purpose  : 
+//=======================================================================
+static Standard_Integer getName(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewName Doc View_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    di << aView->GetObject()->Name()->String();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setType
+//purpose  : 
+//=======================================================================
+static Standard_Integer setType(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 4) {
+    di << "Use: XSetViewType Doc ViewLabel type (central/parallel/no_camera)\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    XCAFView_ProjectionType aType = XCAFView_ProjectionType_NoCamera;
+    if (argv[3][0] == 'c')
+      aType = XCAFView_ProjectionType_Central;
+    else if (argv[3][0] == 'p')
+      aType = XCAFView_ProjectionType_Parallel;
+    anObj->SetType(aType);
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getType
+//purpose  : 
+//=======================================================================
+static Standard_Integer getType(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewType Doc View_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    XCAFView_ProjectionType aType = aView->GetObject()->Type();
+    switch (aType) {
+      case XCAFView_ProjectionType_NoCamera:
+      di << "no_camera";
+      break;
+      case XCAFView_ProjectionType_Central:
+      di << "central";
+      break;
+      case XCAFView_ProjectionType_Parallel:
+      di << "parallel";
+      break;
+    }
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setProjectionPont
+//purpose  : 
+//=======================================================================
+static Standard_Integer setProjectionPoint(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 6) {
+    di << "Use: XSetViewProjectionPoint Doc ViewLabel x y z\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->SetProjectionPoint(gp_Pnt(Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5])));
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getProjectionPoint
+//purpose  : 
+//=======================================================================
+static Standard_Integer getProjectionPoint(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewProjectionPoint Doc ViewLabel\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    gp_Pnt aPnt = aView->GetObject()->ProjectionPoint();
+    di << aPnt.X() << " " << aPnt.Y() << " " << aPnt.Z();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setViewDir
+//purpose  : 
+//=======================================================================
+static Standard_Integer setViewDir(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 6) {
+    di << "Use: XSetViewDir Doc ViewLabel x y z\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->SetViewDirection(gp_Dir(Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5])));
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getViewDir
+//purpose  : 
+//=======================================================================
+static Standard_Integer getViewDir(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewDir Doc ViewLabel\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    gp_Dir aDir = aView->GetObject()->ViewDirection();
+    di << aDir.X() << " " << aDir.Y() << " " << aDir.Z();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setUpDir
+//purpose  : 
+//=======================================================================
+static Standard_Integer setUpDir(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 6) {
+    di << "Use: XSetViewUpDir Doc ViewLabel x y z\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->SetUpDirection(gp_Dir(Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5])));
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getUpDir
+//purpose  : 
+//=======================================================================
+static Standard_Integer getUpDir(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewUpDir Doc ViewLabel\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    gp_Dir aDir = aView->GetObject()->UpDirection();
+    di << aDir.X() << " " << aDir.Y() << " " << aDir.Z();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setZoomFactor
+//purpose  : 
+//=======================================================================
+static Standard_Integer setZoomFactor(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 4) {
+    di << "Use: XSetViewZoom Doc View_Label value\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->SetZoomFactor(Draw::Atof(argv[3]));
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getZoomFactor
+//purpose  : 
+//=======================================================================
+static Standard_Integer getZoomFactor(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewZoom Doc View_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    di << aView->GetObject()->ZoomFactor();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setWindowSize
+//purpose  : 
+//=======================================================================
+static Standard_Integer setWindowSize(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 5) {
+    di << "Use: XSetViewWindowSize Doc ViewLabel width height\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->SetWindowHorizontalSize(Draw::Atof(argv[3]));
+    anObj->SetWindowVerticalSize(Draw::Atof(argv[4]));
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getWindowSize
+//purpose  : 
+//=======================================================================
+static Standard_Integer getWindowSize(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XSetViewWindowSize Doc Dim_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    di << "width " << aView->GetObject()->WindowHorizontalSize();
+    di << " height " << aView->GetObject()->WindowVerticalSize();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setFrontPlaneDistance
+//purpose  : 
+//=======================================================================
+static Standard_Integer setFrontPlaneDistance(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 4) {
+    di << "Use: XSetViewFrontPlaneDistance Doc View_Label value\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->SetFrontPlaneDistance(Draw::Atof(argv[3]));
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : unsetFrontPlaneDistance
+//purpose  : 
+//=======================================================================
+static Standard_Integer unsetFrontPlaneDistance(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XUnsetViewFrontPlaneDistance Doc View_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->UnsetFrontPlaneClipping();
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getFrontPlaneDistance
+//purpose  : 
+//=======================================================================
+static Standard_Integer getFrontPlaneDistance(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewFrontPlaneDistance Doc View_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    if (aView->GetObject()->HasFrontPlaneClipping())
+      di << aView->GetObject()->FrontPlaneDistance();
+    else
+      di << "View has not front plane clipping\n";
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setBackPlaneDistance
+//purpose  : 
+//=======================================================================
+static Standard_Integer setBackPlaneDistance(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 4) {
+    di << "Use: XSetViewBackPlaneDistance Doc View_Label value\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->SetBackPlaneDistance(Draw::Atof(argv[3]));
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : unsetBackPlaneDistance
+//purpose  : 
+//=======================================================================
+static Standard_Integer unsetBackPlaneDistance(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XUnsetViewBackPlaneDistance Doc View_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->UnsetBackPlaneClipping();
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getBackPlaneDistance
+//purpose  : 
+//=======================================================================
+static Standard_Integer getBackPlaneDistance(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewFrontPlaneDistance Doc View_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    if (aView->GetObject()->HasBackPlaneClipping())
+      di << aView->GetObject()->BackPlaneDistance();
+    else
+      di << "View has not back plane clipping\n";
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : setViewVolumeSidesClipping
+//purpose  : 
+//=======================================================================
+static Standard_Integer setViewVolumeSidesClipping(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 4) {
+    di << "Use: XSetViewVolumeSidesClipping Doc View_Label value\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    Handle(XCAFView_Object) anObj = aView->GetObject();
+    anObj->SetViewVolumeSidesClipping((Draw::Atoi(argv[3])) == 1);
+    aView->SetObject(anObj);
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getViewVolumeSidesClipping
+//purpose  : 
+//=======================================================================
+static Standard_Integer getViewVolumeSidesClipping(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XGetViewVolumeSidesClipping Doc View_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  if (aLabel.IsNull())
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.FindAttribute(XCAFDoc_View::GetID(), aView))
+  {
+    di << aView->GetObject()->HasViewVolumeSidesClipping();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getName
+//purpose  : 
+//=======================================================================
+static Standard_Integer dump(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 3) {
+    di << "Use: XDumpView Doc View_Label\n";
+    return 1;
+  }
+  Handle(TDocStd_Document) aDoc;
+  DDocStd::GetDocument(argv[1], aDoc);
+  if (aDoc.IsNull()) {
+    di << argv[1] << " is not a document\n";
+    return 1;
+  }
+  Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main());
+
+  TDF_Label aLabel;
+  TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
+  Handle(XCAFDoc_View) aView;
+  if (aLabel.IsNull() || !(aLabel.FindAttribute(XCAFDoc_View::GetID(), aView)))
+  {
+    di << "View " << argv[2] << " is absent in " << argv[1] << "\n";
+    return 1;
+  }
+
+  TDF_LabelSequence aShapes;
+  aViewTool->GetRefShapeLabel(aLabel, aShapes);
+  di << "Reference shapes: ";
+  for (Standard_Integer i = 1; i <= aShapes.Length(); i++) {
+    TCollection_AsciiString anEntry;
+    TDF_Tool::Entry(aShapes.Value(i), anEntry);
+    di << anEntry << " ";
+  }
+  di << "\n";
+
+  TDF_LabelSequence aGDTs;
+  aViewTool->GetRefGDTLabel(aLabel, aGDTs);
+  di << "Reference GD&Ts: ";
+  for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) {
+    TCollection_AsciiString anEntry;
+    TDF_Tool::Entry(aGDTs.Value(i), anEntry);
+    di << anEntry << " ";
+  }
+  di << "\n";
+
+  di << "Name: " << aView->GetObject()->Name()->String() << "\n";
+
+  XCAFView_ProjectionType aType = aView->GetObject()->Type();
+  switch (aType) {
+    case XCAFView_ProjectionType_NoCamera:
+    di << "Type: no_camera\n";
+    break;
+    case XCAFView_ProjectionType_Central:
+    di << "Type: central\n";
+    break;
+    case XCAFView_ProjectionType_Parallel:
+    di << "Type: parallel\n";
+    break;
+  }
+
+  gp_Pnt aPnt = aView->GetObject()->ProjectionPoint();
+  di << "Projection point: "<< aPnt.X() << " " << aPnt.Y() << " " << aPnt.Z() << "\n";
+
+  gp_Dir aDir = aView->GetObject()->ViewDirection();
+  di << "View Direction: " << aDir.X() << " " << aDir.Y() << " " << aDir.Z() << "\n";
+
+  aDir = aView->GetObject()->UpDirection();
+  di << "Up Direction: " << aDir.X() << " " << aDir.Y() << " " << aDir.Z() << "\n";
+
+  di << "Zoom factor: " << aView->GetObject()->ZoomFactor() << "\n";
+
+  di << "Window Size: width " << aView->GetObject()->WindowHorizontalSize() << ", " << " height " << aView->GetObject()->WindowVerticalSize() << "\n";
+
+  if (aView->GetObject()->HasFrontPlaneClipping())
+    di << "Front Plane Distance: " << aView->GetObject()->FrontPlaneDistance() << "\n";
+  else
+    di << "No Front Plane\n";
+
+  if (aView->GetObject()->HasFrontPlaneClipping())
+    di << "Front Back Distance: " << aView->GetObject()->BackPlaneDistance() << "\n";
+  else
+    di << "No Back Plane\n";
+
+  di << "View VolumeSized Clipping: " << aView->GetObject()->HasViewVolumeSidesClipping() << "\n";
+
+  return 0;
+}
+
+
+//=======================================================================
+//function : InitCommands
+//purpose  : 
+//=======================================================================
+
+void XDEDRAW_Views::InitCommands(Draw_Interpretor& di) 
+{
+
+  static Standard_Boolean initactor = Standard_False;
+  if (initactor) return;  initactor = Standard_True;
+
+  
+  Standard_CString g = "XDE Views commands";
+
+  di.Add("XSetView", "XSetView Doc shape_label1 ... shape_labelN gdt_label1 ... gdt_labelN",
+    __FILE__, setView, g);
+
+  di.Add("XIsView", "XIsView Doc Label",
+    __FILE__, isView, g);
+
+  di.Add("XGetViewShapes", "XGetViewShapes Doc ViewLabel" "Return labels of reference shapes",
+    __FILE__, getRefShapes, g);
+
+  di.Add("XGetViewGDTs", "XGetViewGDTs Doc ViewLabel" "Return labels of reference GDTs",
+    __FILE__, getRefGDTs, g);
+
+  di.Add("XSetViewName", "XSetViewName Doc ViewLabel name",
+    __FILE__, setName, g);
+
+  di.Add("XGetViewName", "XGetViewName Doc ViewLabel",
+    __FILE__, getName, g);
+
+  di.Add("XSetViewType", "XSetViewType Doc ViewLabel type (central/parallel/no_camera)",
+    __FILE__, setType, g);
+
+  di.Add("XGetViewType", "XGetViewType Doc ViewLabel",
+    __FILE__, getType, g);
+
+  di.Add("XSetViewProjectionPoint", "XSetViewProjectionPoint Doc ViewLabel x y z",
+    __FILE__, setProjectionPoint, g);
+
+  di.Add("XGetViewProjectionPoint", "XGetViewProjectionPoint Doc ViewLabel",
+    __FILE__, getProjectionPoint, g);
+
+  di.Add("XSetViewDir", "XSetViewDir Doc ViewLabel x y z",
+    __FILE__, setViewDir, g);
+
+  di.Add("XGetViewDir", "XGetViewDir Doc ViewLabel",
+    __FILE__, getViewDir, g);
+
+  di.Add("XSetViewUpDir", "XSetViewUpDir Doc ViewLabel x y z",
+    __FILE__, setUpDir, g);
+
+  di.Add("XGetViewUpDir", "XGetViewUpDir Doc ViewLabel",
+    __FILE__, getUpDir, g);
+
+  di.Add("XSetViewZoom", "XSetViewZoom Doc ViewLabel zoom_factor",
+    __FILE__, setZoomFactor, g);
+
+  di.Add("XGetViewZoom", "XGetViewZoom Doc ViewLabel",
+    __FILE__, getZoomFactor, g);
+
+  di.Add("XSetViewWindowSize", "XSetViewWindowSize Doc ViewLabel width height",
+    __FILE__, setWindowSize, g);
+
+  di.Add("XGetViewWindowSize", "XGetViewWindowSize Doc ViewLabel",
+    __FILE__, getWindowSize, g);
+
+  di.Add("XSetViewFrontPlaneDistance", "XSetViewFrontPlaneDistance Doc ViewLabel distance",
+    __FILE__, setFrontPlaneDistance, g);
+    
+  di.Add("XUnsetViewFrontPlaneDistance", "XSetViewFrontPlaneDistance Doc ViewLabel",
+    __FILE__, unsetFrontPlaneDistance, g);
+
+  di.Add("XGetViewFrontPlaneDistance", "XGetViewFrontPlaneDistance Doc ViewLabel",
+    __FILE__, getFrontPlaneDistance, g);
+    
+  di.Add("XSetViewBackPlaneDistance", "XSetViewBackPlaneDistance Doc ViewLabel distance",
+    __FILE__, setBackPlaneDistance, g);
+    
+  di.Add("XUnsetViewBackPlaneDistance", "XUnsetViewBackPlaneDistance Doc ViewLabel",
+    __FILE__, unsetBackPlaneDistance, g);
+
+  di.Add("XGetViewBackPlaneDistance", "XGetViewBackPlaneDistance Doc ViewLabel",
+    __FILE__, getBackPlaneDistance, g);
+    
+  di.Add("XSetViewVolumeSidesClipping", "XSetViewVolumeSidesClipping Doc ViewLabel value(0 - unset, 1- set)",
+    __FILE__, setViewVolumeSidesClipping, g);
+    
+  di.Add("XGetViewVolumeSidesClipping", "XGetViewVolumeSidesClipping Doc ViewLabel",
+    __FILE__, getViewVolumeSidesClipping, g);
+
+  di.Add("XDumpView", "XDumpView Doc ViewLabel",
+    __FILE__, dump, g);
+}
diff --git a/src/XDEDRAW/XDEDRAW_Views.hxx b/src/XDEDRAW/XDEDRAW_Views.hxx
new file mode 100644 (file)
index 0000000..ab47937
--- /dev/null
@@ -0,0 +1,36 @@
+// Created on: 2016-11-22
+// Created by: Irina KRYLOVA
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part  Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms  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  the license and disclaimer  any warranty.
+//
+// Alternatively, this file may be used under the terms  Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XDEDRAW_Views_HeaderFile
+#define _XDEDRAW_Views_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Draw_Interpretor.hxx>
+
+
+//! Contains commands to work with GDTs
+class XDEDRAW_Views 
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+  Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands);
+};
+
+#endif // _XDEDRAW_Views_HeaderFile
index 316f85b..6cab473 100644 (file)
@@ -29,5 +29,7 @@ XmlMXCAFDoc_MaterialToolDriver.cxx
 XmlMXCAFDoc_MaterialToolDriver.hxx
 XmlMXCAFDoc_ShapeToolDriver.cxx
 XmlMXCAFDoc_ShapeToolDriver.hxx
+XmlMXCAFDoc_ViewToolDriver.cxx
+XmlMXCAFDoc_ViewToolDriver.hxx
 XmlMXCAFDoc_VolumeDriver.cxx
 XmlMXCAFDoc_VolumeDriver.hxx
index c2f76a2..0d7decd 100644 (file)
@@ -33,6 +33,7 @@
 #include <XmlMXCAFDoc_MaterialDriver.hxx>
 #include <XmlMXCAFDoc_MaterialToolDriver.hxx>
 #include <XmlMXCAFDoc_ShapeToolDriver.hxx>
+#include <XmlMXCAFDoc_ViewToolDriver.hxx>
 #include <XmlMXCAFDoc_VolumeDriver.hxx>
 
 //=======================================================================
@@ -71,4 +72,5 @@ void XmlMXCAFDoc::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
   aDriverTable -> AddDriver (new XmlMXCAFDoc_ShapeToolDriver    (anMsgDrv));
   aDriverTable -> AddDriver (new XmlMXCAFDoc_DimTolToolDriver   (anMsgDrv));
   aDriverTable -> AddDriver (new XmlMXCAFDoc_MaterialToolDriver (anMsgDrv));
+  aDriverTable -> AddDriver (new XmlMXCAFDoc_ViewToolDriver     (anMsgDrv));
 }
index 5840968..6b23d13 100644 (file)
@@ -37,6 +37,7 @@ class XmlMXCAFDoc_LayerToolDriver;
 class XmlMXCAFDoc_ShapeToolDriver;
 class XmlMXCAFDoc_DimTolToolDriver;
 class XmlMXCAFDoc_MaterialToolDriver;
+class XmlMXCAFDoc_ViewToolDriver;
 
 
 //! Storage and Retrieval drivers for modelling attributes.
@@ -80,6 +81,7 @@ friend class XmlMXCAFDoc_LayerToolDriver;
 friend class XmlMXCAFDoc_ShapeToolDriver;
 friend class XmlMXCAFDoc_DimTolToolDriver;
 friend class XmlMXCAFDoc_MaterialToolDriver;
+friend class XmlMXCAFDoc_ViewToolDriver;
 
 };
 
diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_ViewToolDriver.cxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_ViewToolDriver.cxx
new file mode 100644 (file)
index 0000000..e8d23e7
--- /dev/null
@@ -0,0 +1,64 @@
+// Created on: 2016-10-24
+// Created by: Irina KRYLOVA
+// 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 <CDM_MessageDriver.hxx>
+#include <Standard_Type.hxx>
+#include <TDF_Attribute.hxx>
+#include <XCAFDoc_ViewTool.hxx>
+#include <XmlMXCAFDoc_ViewToolDriver.hxx>
+#include <XmlObjMgt_Persistent.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_ViewToolDriver, XmlMDF_ADriver)
+
+//=======================================================================
+//function :
+//purpose  : 
+//=======================================================================
+XmlMXCAFDoc_ViewToolDriver::XmlMXCAFDoc_ViewToolDriver
+  (const Handle(CDM_MessageDriver)& theMsgDriver)
+: XmlMDF_ADriver (theMsgDriver, "xcaf", "ViewTool")
+{
+}
+
+//=======================================================================
+//function :
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) XmlMXCAFDoc_ViewToolDriver::NewEmpty() const
+{
+  return new XCAFDoc_ViewTool();
+}
+
+//=======================================================================
+//function :
+//purpose  : 
+//=======================================================================
+Standard_Boolean XmlMXCAFDoc_ViewToolDriver::Paste(const XmlObjMgt_Persistent& ,
+                                                   const Handle(TDF_Attribute)& ,
+                                                   XmlObjMgt_RRelocationTable& ) const
+{
+  return Standard_True;
+}
+
+//=======================================================================
+//function :
+//purpose  : 
+//=======================================================================
+void XmlMXCAFDoc_ViewToolDriver::Paste(const Handle(TDF_Attribute)& ,
+                                       XmlObjMgt_Persistent& ,
+                                       XmlObjMgt_SRelocationTable& ) const
+{
+}
diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_ViewToolDriver.hxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_ViewToolDriver.hxx
new file mode 100644 (file)
index 0000000..198fb69
--- /dev/null
@@ -0,0 +1,52 @@
+// Created on: 2016-10-24
+// Created by: Irina KRYLOVA
+// 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_ViewToolDriver_HeaderFile
+#define _XmlMXCAFDoc_ViewToolDriver_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 CDM_MessageDriver;
+class TDF_Attribute;
+class XmlObjMgt_Persistent;
+
+
+class XmlMXCAFDoc_ViewToolDriver;
+DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_ViewToolDriver, XmlMDF_ADriver)
+
+//! Attribute Driver.
+class XmlMXCAFDoc_ViewToolDriver : public XmlMDF_ADriver
+{
+
+public:
+
+  
+  Standard_EXPORT XmlMXCAFDoc_ViewToolDriver(const Handle(CDM_MessageDriver)& 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_ViewToolDriver, XmlMDF_ADriver)
+};
+
+#endif // _XmlMXCAFDoc_ViewToolDriver_HeaderFile
diff --git a/tests/bugs/xde/bug28044 b/tests/bugs/xde/bug28044
new file mode 100644 (file)
index 0000000..aeba7d2
--- /dev/null
@@ -0,0 +1,82 @@
+puts "========"
+puts "OCC28044"
+puts "========"
+puts ""
+####################################################
+# Implement data structures in OCAF for Saved Views.
+####################################################
+
+pload OCAF
+
+# Create document with View
+box b 0 0 0 1 1 1
+box bb 2 2 2 1 1 1
+NewDocument D_First BinXCAF
+XAddShape D_First b
+# 0:1:1:1
+XAddShape D_First bb
+# 0:1:1:2
+explode b e
+XAddShape D_First b_1
+XAddDimension D_First b_1
+#0:1:4:1
+XSetDimensionType D_First 0:1:4:1 14
+XSetDimensionValue D_First 0:1:4:1 1
+#0:1:7:1
+XSetView D_First 0:1:1:1 0:1:1:2 0:1:4:1
+XSetViewName D_First 0:1:7:1 ALL
+XSetViewType D_First 0:1:7:1 parallel
+XSetViewProjectionPoint D_First 0:1:7:1 2 3 5
+XSetViewDir D_First 0:1:7:1 0 0 -1
+XSetViewUpDir D_First 0:1:7:1 0 1 0
+XSetViewZoom D_First 0:1:7:1 3
+XSetViewWindowSize D_First 0:1:7:1 480 640
+XSetViewFrontPlaneDistance D_First 0:1:7:1 10
+XSetViewVolumeSidesClipping D_First 0:1:7:1 1
+set first_view [XDumpView D_First 0:1:7:1]
+# Write file
+SaveAs D_First ${imagedir}/bug28044.xbf
+Close D_First
+# Read document
+XOpen ${imagedir}/bug28044.xbf D_Second
+set second_view [XDumpView D_Second 0:1:7:1]
+
+Close D_Second
+
+set ref_data {Reference shapes: 0:1:1:1 0:1:1:2 
+Reference GD&Ts: 0:1:4:1 
+Name: ALL
+Type: parallel
+Projection point: 2 3 5
+View Direction: 0 0 -1
+Up Direction: 0 1 0
+Zoom factor: 3
+Window Size: width 480,  height 640
+Front Plane Distance: 10
+Front Back Distance: 0
+View VolumeSized Clipping: 1
+}
+# Results validation
+set first_list [split $first_view \n]
+set second_list [split $second_view \n]
+set ref_list [split $ref_data \n]
+set err_compare_ref ""
+for { set i 0 } { $i < 12 } { incr i } {
+  set isOK 1
+  set first [lindex $first_list $i]
+  set second [lindex $second_list $i]
+  set ref [lindex $ref_list $i]
+  if {$ref != $first} {set isOK 0}
+  if {$ref != $second} {set isOK 0}
+  if {$isOK == 0} {
+    append err_compare_ref "$ref\n"
+  }
+}
+
+if {[llength $err_compare_ref] > 0} {
+  puts "Error : differences with reference data found :\n$err_compare_ref"
+} else {
+  puts "Comparision of current result with reference data - OK\n"
+} 
+
+puts "TEST COMPLETED"
\ No newline at end of file