From 2c57ab72bcb00bb6a5387c3bb5e8384b839af1bb Mon Sep 17 00:00:00 2001 From: myn Date: Wed, 8 Jun 2016 14:10:23 +0300 Subject: [PATCH] 0027558: Restore support for legacy XCAF persistence format --- adm/UDLIST | 2 + src/StdResource/Plugin | 4 ++ src/StdResource/XCAF | 6 -- src/TKXCAF/EXTERNLIB | 2 + src/TKXCAF/PACKAGES | 2 + src/XCAFDrivers/FILES | 4 ++ src/XCAFDrivers/XCAFDrivers.cxx | 70 +++++++++++++++++++ src/XCAFDrivers/XCAFDrivers.hxx | 41 +++++++++++ .../XCAFDrivers_DocumentRetrievalDriver.cxx | 26 +++++++ .../XCAFDrivers_DocumentRetrievalDriver.hxx | 30 ++++++++ src/XCAFPersistent/FILES | 2 + src/XCAFPersistent/XCAFPersistent.cxx | 61 ++++++++++++++++ src/XCAFPersistent/XCAFPersistent.hxx | 29 ++++++++ 13 files changed, 273 insertions(+), 6 deletions(-) create mode 100644 src/XCAFDrivers/FILES create mode 100644 src/XCAFDrivers/XCAFDrivers.cxx create mode 100644 src/XCAFDrivers/XCAFDrivers.hxx create mode 100644 src/XCAFDrivers/XCAFDrivers_DocumentRetrievalDriver.cxx create mode 100644 src/XCAFDrivers/XCAFDrivers_DocumentRetrievalDriver.hxx create mode 100644 src/XCAFPersistent/FILES create mode 100644 src/XCAFPersistent/XCAFPersistent.cxx create mode 100644 src/XCAFPersistent/XCAFPersistent.hxx diff --git a/adm/UDLIST b/adm/UDLIST index b6d6b2fb69..bb2778d7ab 100644 --- a/adm/UDLIST +++ b/adm/UDLIST @@ -363,6 +363,8 @@ n XCAFApp n XCAFDimTolObjects n XCAFDoc n XCAFPrs +n XCAFDrivers +n XCAFPersistent n XSAlgo n XSControl n XmlMXCAFDoc diff --git a/src/StdResource/Plugin b/src/StdResource/Plugin index b346df48f4..283157d67f 100755 --- a/src/StdResource/Plugin +++ b/src/StdResource/Plugin @@ -33,6 +33,10 @@ bd696001-5b34-11d1-b5ba-00a0c9064368.Location: TKStdL 13a56835-8269-11d5-aab2-0050044b1af1.Location: TKBinL 13a56836-8269-11d5-aab2-0050044b1af1.Location: TKBinL ! +! XCAF Document Plugin +! +ed8793f9-3142-11d4-b9b5-0060b0ee281b.Location: TKXCAF +! ! XmlXCAF Document Plugin ! f78ff496-a779-11d5-aab4-0050044b1af1.Location: TKXmlXCAF diff --git a/src/StdResource/XCAF b/src/StdResource/XCAF index 4a67f6ec4d..12ca59a98d 100755 --- a/src/StdResource/XCAF +++ b/src/StdResource/XCAF @@ -7,9 +7,7 @@ xml.FileFormat: XmlXCAF ! MDTV-XCAF.Description: XCAF Document Version 1.0 MDTV-XCAF.FileExtension: dxc -MDTV-XCAF.StoragePlugin: ed8793f8-3142-11d4-b9b5-0060b0ee281b MDTV-XCAF.RetrievalPlugin: ed8793f9-3142-11d4-b9b5-0060b0ee281b -MDTV-XCAFSchema: ed8793fa-3142-11d4-b9b5-0060b0ee281b ! ! XmlXCAF format ! @@ -29,11 +27,7 @@ BinXCAF.RetrievalPlugin: a78ff497-a779-11d5-aab4-0050044b1af1 ! MDTV-Standard.Description: Standard Document Version 1.0 MDTV-Standard.FileExtension: std -MDTV-Standard.StoragePlugin: ad696000-5b34-11d1-b5ba-00a0c9064368 MDTV-Standard.RetrievalPlugin: ad696001-5b34-11d1-b5ba-00a0c9064368 -MDTV-StandardSchema: ad696002-5b34-11d1-b5ba-00a0c9064368 -MDTV-Standard.AttributeStoragePlugin: 47b0b826-d931-11d1-b5da-00a0c9064368 -MDTV-Standard.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c9064368 ! ! XmlOcaf format ! diff --git a/src/TKXCAF/EXTERNLIB b/src/TKXCAF/EXTERNLIB index b23eb5c108..115699d4b9 100755 --- a/src/TKXCAF/EXTERNLIB +++ b/src/TKXCAF/EXTERNLIB @@ -10,3 +10,5 @@ TKLCAF TKG3d TKCAF TKVCAF +TKStd +TKStdL diff --git a/src/TKXCAF/PACKAGES b/src/TKXCAF/PACKAGES index ad9e0b5c82..30208588e7 100755 --- a/src/TKXCAF/PACKAGES +++ b/src/TKXCAF/PACKAGES @@ -2,3 +2,5 @@ XCAFApp XCAFDimTolObjects XCAFDoc XCAFPrs +XCAFDrivers +XCAFPersistent diff --git a/src/XCAFDrivers/FILES b/src/XCAFDrivers/FILES new file mode 100644 index 0000000000..fa960bf700 --- /dev/null +++ b/src/XCAFDrivers/FILES @@ -0,0 +1,4 @@ +XCAFDrivers.cxx +XCAFDrivers.hxx +XCAFDrivers_DocumentRetrievalDriver.cxx +XCAFDrivers_DocumentRetrievalDriver.hxx diff --git a/src/XCAFDrivers/XCAFDrivers.cxx b/src/XCAFDrivers/XCAFDrivers.cxx new file mode 100644 index 0000000000..7455bbfb34 --- /dev/null +++ b/src/XCAFDrivers/XCAFDrivers.cxx @@ -0,0 +1,70 @@ +// Created on: 2000-05-24 +// Created by: Edward AGAPOV +// Copyright (c) 2000-2014 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 version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +static Standard_GUID XSRetrievalDriver ("ed8793f9-3142-11d4-b9b5-0060b0ee281b"); + +//======================================================================= +//function : Factory +//purpose : Depending from the ID, returns a list of storage +// or retrieval attribute drivers. Used for plugin +//======================================================================= +Handle(Standard_Transient) XCAFDrivers::Factory (const Standard_GUID& aGUID) +{ + if (aGUID == XSRetrievalDriver) + { +#ifdef OCCT_DEBUG + cout << "XCAFDrivers : Retrieval Plugin" << endl; +#endif + + static Handle (XCAFDrivers_DocumentRetrievalDriver) model_rd = new XCAFDrivers_DocumentRetrievalDriver; + return model_rd; + } + + return StdDrivers::Factory (aGUID); +} + +//======================================================================= +//function : BindTypes +//purpose : Register types +//======================================================================= +void XCAFDrivers::BindTypes (StdObjMgt_MapOfInstantiators& theMap) +{ + StdLPersistent ::BindTypes (theMap); + StdPersistent ::BindTypes (theMap); + ShapePersistent::BindTypes (theMap); + XCAFPersistent ::BindTypes (theMap); +} + + +#ifdef _MSC_VER +#pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */ +#endif + +// Declare entry point PLUGINFACTORY +PLUGIN(XCAFDrivers) diff --git a/src/XCAFDrivers/XCAFDrivers.hxx b/src/XCAFDrivers/XCAFDrivers.hxx new file mode 100644 index 0000000000..36b9773917 --- /dev/null +++ b/src/XCAFDrivers/XCAFDrivers.hxx @@ -0,0 +1,41 @@ +// 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 _XCAFDrivers_HeaderFile +#define _XCAFDrivers_HeaderFile + +#include +#include +#include + +class Standard_Transient; +class Standard_GUID; +class StdObjMgt_MapOfInstantiators; + + +class XCAFDrivers +{ + friend class XCAFDrivers_DocumentRetrievalDriver; + +public: + //! Depending from the ID, returns a list of storage + //! or retrieval attribute drivers. Used for plugin. + Standard_EXPORT static Handle(Standard_Transient) Factory (const Standard_GUID& aGUID); + + //! Register types. + Standard_EXPORT static void BindTypes (StdObjMgt_MapOfInstantiators& theMap); + + DEFINE_STANDARD_ALLOC +}; + +#endif // _XCAFDrivers_HeaderFile diff --git a/src/XCAFDrivers/XCAFDrivers_DocumentRetrievalDriver.cxx b/src/XCAFDrivers/XCAFDrivers_DocumentRetrievalDriver.cxx new file mode 100644 index 0000000000..f67bab42da --- /dev/null +++ b/src/XCAFDrivers/XCAFDrivers_DocumentRetrievalDriver.cxx @@ -0,0 +1,26 @@ +// 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 +#include + +IMPLEMENT_STANDARD_RTTIEXT (XCAFDrivers_DocumentRetrievalDriver, StdDrivers_DocumentRetrievalDriver) + +//======================================================================= +//function : bindTypes +//purpose : Register types +//======================================================================= +void XCAFDrivers_DocumentRetrievalDriver::bindTypes (StdObjMgt_MapOfInstantiators& theMap) +{ + XCAFDrivers::BindTypes (theMap); +} diff --git a/src/XCAFDrivers/XCAFDrivers_DocumentRetrievalDriver.hxx b/src/XCAFDrivers/XCAFDrivers_DocumentRetrievalDriver.hxx new file mode 100644 index 0000000000..f30efc6134 --- /dev/null +++ b/src/XCAFDrivers/XCAFDrivers_DocumentRetrievalDriver.hxx @@ -0,0 +1,30 @@ +// 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 _XCAFDrivers_DocumentRetrievalDriver_HeaderFile +#define _XCAFDrivers_DocumentRetrievalDriver_HeaderFile + +#include + +//! retrieval driver of a Part document +class XCAFDrivers_DocumentRetrievalDriver : public StdDrivers_DocumentRetrievalDriver +{ +public: + DEFINE_STANDARD_RTTIEXT (XCAFDrivers_DocumentRetrievalDriver, StdDrivers_DocumentRetrievalDriver) + +protected: + //! Register types. + Standard_EXPORT virtual void bindTypes (StdObjMgt_MapOfInstantiators& theMap) Standard_OVERRIDE; +}; + +#endif // _XCAFDrivers_DocumentRetrievalDriver_HeaderFile diff --git a/src/XCAFPersistent/FILES b/src/XCAFPersistent/FILES new file mode 100644 index 0000000000..51f4cf50a5 --- /dev/null +++ b/src/XCAFPersistent/FILES @@ -0,0 +1,2 @@ +XCAFPersistent.cxx +XCAFPersistent.hxx diff --git a/src/XCAFPersistent/XCAFPersistent.cxx b/src/XCAFPersistent/XCAFPersistent.cxx new file mode 100644 index 0000000000..621a73a529 --- /dev/null +++ b/src/XCAFPersistent/XCAFPersistent.cxx @@ -0,0 +1,61 @@ +// 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 +#include + +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include + + +//======================================================================= +//function : BindTypes +//purpose : Register types +//======================================================================= +void XCAFPersistent::BindTypes (StdObjMgt_MapOfInstantiators& theMap) +{ + // Attributes +// theMap.Bind ("PXCAFDoc_Area"); +// theMap.Bind ("PXCAFDoc_Centroid"); +// theMap.Bind ("PXCAFDoc_Color"); +// theMap.Bind ("PXCAFDoc_ColorTool"); +// theMap.Bind ("PXCAFDoc_Datum"); +// theMap.Bind ("PXCAFDoc_DimTol"); +// theMap.Bind ("PXCAFDoc_DimTolTool"); +// theMap.Bind ("PXCAFDoc_DocumentTool"); +// theMap.Bind ("PXCAFDoc_GraphNode"); +// theMap.Bind ("PXCAFDoc_LayerTool"); +// theMap.Bind ("PXCAFDoc_Location"); +// theMap.Bind ("PXCAFDoc_Material"); +// theMap.Bind ("PXCAFDoc_MaterialTool"); +// theMap.Bind ("PXCAFDoc_ShapeTool"); +// theMap.Bind ("PXCAFDoc_Volume"); + + // Non-attribute data +// theMap.Bind ("PXCAFDoc_GraphNodeSequence"); +// theMap.Bind ("PXCAFDoc_SeqNodeOfGraphNodeSequence"); +} diff --git a/src/XCAFPersistent/XCAFPersistent.hxx b/src/XCAFPersistent/XCAFPersistent.hxx new file mode 100644 index 0000000000..6734f169f9 --- /dev/null +++ b/src/XCAFPersistent/XCAFPersistent.hxx @@ -0,0 +1,29 @@ +// 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 _XCAFPersistent_HeaderFile +#define _XCAFPersistent_HeaderFile + +#include + +class StdObjMgt_MapOfInstantiators; + +class XCAFPersistent +{ +public: + //! Register types. + Standard_EXPORT static void BindTypes (StdObjMgt_MapOfInstantiators& theMap); +}; + +#endif -- 2.39.5