1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0028985: XCAF data structures for generic text annotations linked to GD&T annotations and saved views

1. A tool to annotate items in the hierarchical product structure was added. The tool is located under
   fixed label 0:1:9. It operates two basic entities: notes and annotations located under 0:1:9:1 and 0:1:9:2
   hives correspondingly. A note is an attribute derived from base class XCAFDoc_Note that is attached to a separate
   label under the notes hive. An annotated item is represented by XCAFDoc_AssemblyItemRef attribute
   attached to a separate label under the annotated items hive. Notes are linked to annotated items by means of
   XCAFDoc_GraphNode attribute, where notes play parent roles and annotated items - child roles.
2. XCAFDoc_AssemblyItemRef defines a weak reference to a label with optional attribute GUID or sub-shape index.
3. A capability to store note/annotation labels in XCAFDoc_ViewTool was added.
4. XDE User guide was updated
This commit is contained in:
snn
2017-02-10 15:48:36 +03:00
committed by bugmaster
parent 80070d4915
commit 024d6f7775
82 changed files with 7061 additions and 17 deletions

View File

@@ -1,5 +1,7 @@
XmlMXCAFDoc.cxx
XmlMXCAFDoc.hxx
XmlMXCAFDoc_AssemblyItemRefDriver.cxx
XmlMXCAFDoc_AssemblyItemRefDriver.hxx
XmlMXCAFDoc_AreaDriver.cxx
XmlMXCAFDoc_AreaDriver.hxx
XmlMXCAFDoc_CentroidDriver.cxx
@@ -29,6 +31,16 @@ XmlMXCAFDoc_MaterialDriver.cxx
XmlMXCAFDoc_MaterialDriver.hxx
XmlMXCAFDoc_MaterialToolDriver.cxx
XmlMXCAFDoc_MaterialToolDriver.hxx
XmlMXCAFDoc_NoteDriver.cxx
XmlMXCAFDoc_NoteDriver.hxx
XmlMXCAFDoc_NoteBalloonDriver.cxx
XmlMXCAFDoc_NoteBalloonDriver.hxx
XmlMXCAFDoc_NoteCommentDriver.cxx
XmlMXCAFDoc_NoteCommentDriver.hxx
XmlMXCAFDoc_NoteBinDataDriver.cxx
XmlMXCAFDoc_NoteBinDataDriver.hxx
XmlMXCAFDoc_NotesToolDriver.cxx
XmlMXCAFDoc_NotesToolDriver.hxx
XmlMXCAFDoc_ShapeToolDriver.cxx
XmlMXCAFDoc_ShapeToolDriver.hxx
XmlMXCAFDoc_ViewToolDriver.cxx

View File

@@ -19,6 +19,7 @@
#include <XmlMDF_ADriverTable.hxx>
#include <XmlMNaming_NamedShapeDriver.hxx>
#include <XmlMXCAFDoc.hxx>
#include <XmlMXCAFDoc_AssemblyItemRefDriver.hxx>
#include <XmlMXCAFDoc_AreaDriver.hxx>
#include <XmlMXCAFDoc_CentroidDriver.hxx>
#include <XmlMXCAFDoc_ClippingPlaneToolDriver.hxx>
@@ -32,6 +33,10 @@
#include <XmlMXCAFDoc_LayerToolDriver.hxx>
#include <XmlMXCAFDoc_LocationDriver.hxx>
#include <XmlMXCAFDoc_MaterialDriver.hxx>
#include <XmlMXCAFDoc_NotesToolDriver.hxx>
#include <XmlMXCAFDoc_NoteBalloonDriver.hxx>
#include <XmlMXCAFDoc_NoteCommentDriver.hxx>
#include <XmlMXCAFDoc_NoteBinDataDriver.hxx>
#include <XmlMXCAFDoc_MaterialToolDriver.hxx>
#include <XmlMXCAFDoc_ShapeToolDriver.hxx>
#include <XmlMXCAFDoc_ViewToolDriver.hxx>
@@ -61,11 +66,15 @@ void XmlMXCAFDoc::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
aLocationDriver->SetSharedLocations( &(aNamedShapeDriver->GetShapesLocations()) );
}
aDriverTable -> AddDriver( aLocationDriver);
aDriverTable -> AddDriver (new XmlMXCAFDoc_VolumeDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_DatumDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_DimTolDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_MaterialDriver (anMsgDrv));
aDriverTable -> AddDriver (aLocationDriver);
aDriverTable -> AddDriver (new XmlMXCAFDoc_AssemblyItemRefDriver(anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_VolumeDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_DatumDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_DimTolDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_MaterialDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_NoteBalloonDriver(anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_NoteCommentDriver(anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_NoteBinDataDriver(anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_ColorToolDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_DocumentToolDriver (anMsgDrv));
@@ -73,6 +82,7 @@ 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_NotesToolDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_ViewToolDriver (anMsgDrv));
aDriverTable -> AddDriver (new XmlMXCAFDoc_ClippingPlaneToolDriver(anMsgDrv));
}

View File

@@ -31,6 +31,10 @@ class XmlMXCAFDoc_VolumeDriver;
class XmlMXCAFDoc_DatumDriver;
class XmlMXCAFDoc_DimTolDriver;
class XmlMXCAFDoc_MaterialDriver;
class XmlMXCAFDoc_NotesToolDriver;
class XmlMXCAFDoc_NoteDriver;
class XmlMXCAFDoc_NoteCommentDriver;
class XmlMXCAFDoc_NoteBinDataDriver;
class XmlMXCAFDoc_ClippingPlaneToolDriver;
class XmlMXCAFDoc_ColorToolDriver;
class XmlMXCAFDoc_DocumentToolDriver;

View File

@@ -0,0 +1,117 @@
// Created on: 2017-02-14
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_AssemblyItemRef.hxx>
#include <XmlMXCAFDoc_AssemblyItemRefDriver.hxx>
#include <XmlObjMgt_Persistent.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_AssemblyItemRefDriver, XmlMDF_ADriver)
IMPLEMENT_DOMSTRING(Path, "path")
IMPLEMENT_DOMSTRING(AttrGUID, "guid")
IMPLEMENT_DOMSTRING(SubshapeIndex, "subshape_index")
//=======================================================================
//function :
//purpose :
//=======================================================================
XmlMXCAFDoc_AssemblyItemRefDriver::XmlMXCAFDoc_AssemblyItemRefDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
: XmlMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_AssemblyItemRef)->Name())
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(TDF_Attribute) XmlMXCAFDoc_AssemblyItemRefDriver::NewEmpty() const
{
return new XCAFDoc_AssemblyItemRef();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean XmlMXCAFDoc_AssemblyItemRefDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& /*theRelocTable*/) const
{
const XmlObjMgt_Element& anElement = theSource;
XmlObjMgt_DOMString aPath = anElement.getAttribute(::Path());
if (aPath == NULL)
return Standard_False;
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theTarget);
if (aThis.IsNull())
return Standard_False;
aThis->SetItem(aPath.GetString());
XmlObjMgt_DOMString anAttrGUID = anElement.getAttribute(::AttrGUID());
if (anAttrGUID != NULL)
{
Standard_GUID aGUID(anAttrGUID.GetString());
aThis->SetGUID(aGUID);
return Standard_True;
}
XmlObjMgt_DOMString aSubshapeIndex = anElement.getAttribute(::SubshapeIndex());
if (aSubshapeIndex != NULL)
{
Standard_Integer anIndex;
if (!aSubshapeIndex.GetInteger(anIndex))
return Standard_False;
aThis->SetSubshapeIndex(anIndex);
return Standard_True;
}
return Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void XmlMXCAFDoc_AssemblyItemRefDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& /*theRelocTable*/) const
{
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theSource);
XmlObjMgt_DOMString aPath(aThis->GetItem().ToString().ToCString());
theTarget.Element().setAttribute(::Path(), aPath);
if (aThis->IsGUID())
{
Standard_GUID aGUID = aThis->GetGUID();
Standard_Character aGUIDStr[Standard_GUID_SIZE + 1];
aGUID.ToCString(aGUIDStr);
aGUIDStr[Standard_GUID_SIZE] = '\0';
XmlObjMgt_DOMString anAttrGUID(aGUIDStr);
theTarget.Element().setAttribute(::AttrGUID(), anAttrGUID);
}
else if (aThis->IsSubshapeIndex())
{
TCollection_AsciiString aSubshapeIndexStr(aThis->GetSubshapeIndex());
XmlObjMgt_DOMString aSubshapeIndex(aSubshapeIndexStr.ToCString());
theTarget.Element().setAttribute(::SubshapeIndex(), aSubshapeIndex);
}
}

View File

@@ -0,0 +1,55 @@
// Created on: 2017-02-16
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_AssemblyItemRefDriver_HeaderFile
#define _XmlMXCAFDoc_AssemblyItemRefDriver_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_AssemblyItemRefDriver;
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_AssemblyItemRefDriver, XmlMDF_ADriver)
//! Attribute Driver.
class XmlMXCAFDoc_AssemblyItemRefDriver : public XmlMDF_ADriver
{
public:
Standard_EXPORT XmlMXCAFDoc_AssemblyItemRefDriver(const Handle(CDM_MessageDriver)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_AssemblyItemRefDriver, XmlMDF_ADriver)
};
#endif // _XmlMXCAFDoc_AssemblyItemRefDriver_HeaderFile

View File

@@ -0,0 +1,52 @@
// Created on: 2017-08-10
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_NoteBalloon.hxx>
#include <XmlMXCAFDoc_NoteBalloonDriver.hxx>
#include <XmlObjMgt_Persistent.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteBalloonDriver, XmlMXCAFDoc_NoteCommentDriver)
//=======================================================================
//function :
//purpose :
//=======================================================================
XmlMXCAFDoc_NoteBalloonDriver::XmlMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
: XmlMXCAFDoc_NoteCommentDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBalloon)->Name())
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(TDF_Attribute) XmlMXCAFDoc_NoteBalloonDriver::NewEmpty() const
{
return new XCAFDoc_NoteBalloon();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
XmlMXCAFDoc_NoteBalloonDriver::XmlMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
Standard_CString theName)
: XmlMXCAFDoc_NoteCommentDriver(theMsgDriver, theName)
{
}

View File

@@ -0,0 +1,42 @@
// Created on: 2017-08-10
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_NoteBalloonDriver_HeaderFile
#define _XmlMXCAFDoc_NoteBalloonDriver_HeaderFile
#include <XmlMXCAFDoc_NoteCommentDriver.hxx>
class XmlMXCAFDoc_NoteBalloonDriver;
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NoteBalloonDriver, XmlMXCAFDoc_NoteCommentDriver)
//! Attribute Driver.
class XmlMXCAFDoc_NoteBalloonDriver : public XmlMXCAFDoc_NoteCommentDriver
{
public:
Standard_EXPORT XmlMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteBalloonDriver, XmlMXCAFDoc_NoteCommentDriver)
protected:
XmlMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
Standard_CString theName);
};
#endif // _XmlMXCAFDoc_NoteBalloonDriver_HeaderFile

View File

@@ -0,0 +1,121 @@
// Created on: 2017-02-14
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_NoteBinData.hxx>
#include <XmlObjMgt.hxx>
#include <XmlMXCAFDoc_NoteBinDataDriver.hxx>
#include <XmlObjMgt_Persistent.hxx>
#include <LDOM_OSStream.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteBinDataDriver, XmlMXCAFDoc_NoteDriver)
IMPLEMENT_DOMSTRING(Title, "title")
IMPLEMENT_DOMSTRING(MIMEtype, "mime_type")
IMPLEMENT_DOMSTRING(Size, "size")
//=======================================================================
//function :
//purpose :
//=======================================================================
XmlMXCAFDoc_NoteBinDataDriver::XmlMXCAFDoc_NoteBinDataDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
: XmlMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBinData)->Name())
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(TDF_Attribute) XmlMXCAFDoc_NoteBinDataDriver::NewEmpty() const
{
return new XCAFDoc_NoteBinData();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean XmlMXCAFDoc_NoteBinDataDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& theRelocTable) const
{
XmlMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
const XmlObjMgt_Element& anElement = theSource;
XmlObjMgt_DOMString aTitle = anElement.getAttribute(::Title());
XmlObjMgt_DOMString aMIMEtype = anElement.getAttribute(::MIMEtype());
XmlObjMgt_DOMString aSize = anElement.getAttribute(::Size());
if (aTitle == NULL || aMIMEtype == NULL || aSize == NULL)
return Standard_False;
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theTarget);
if (aNote.IsNull())
return Standard_False;
Standard_Integer nbSize = 0;
if (!aSize.GetInteger(nbSize))
return Standard_False;
XmlObjMgt_DOMString aDataStr = XmlObjMgt::GetStringValue(theSource);
Standard_SStream anSS(aDataStr.GetString());
Handle(TColStd_HArray1OfByte) aData = new TColStd_HArray1OfByte(1, nbSize);
for (Standard_Integer i = 1; i <= nbSize; ++i)
{
Standard_Byte aValue;
anSS >> aValue;
aData->ChangeValue(i) = aValue;
}
aNote->Set(aTitle.GetString(), aMIMEtype.GetString(), aData);
return Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void XmlMXCAFDoc_NoteBinDataDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& theRelocTable) const
{
XmlMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theSource);
XmlObjMgt_DOMString aTitle(TCollection_AsciiString(aNote->Title()).ToCString());
XmlObjMgt_DOMString aMIMEtype(aNote->MIMEtype().ToCString());
theTarget.Element().setAttribute(::Title(), aTitle);
theTarget.Element().setAttribute(::MIMEtype(), aMIMEtype);
theTarget.Element().setAttribute(::Size(), aNote->Size());
if (aNote->Size() > 0)
{
const Handle(TColStd_HArray1OfByte)& aData = aNote->Data();
LDOM_OSStream anOSS(aNote->Size());
for (Standard_Integer i = aData->Lower(); i <= aData->Upper(); ++i)
{
anOSS << std::hex << aData->Value(i);
}
Standard_Character* dump = (Standard_Character*)anOSS.str(); // copying! Don't forget to delete it.
XmlObjMgt::SetStringValue(theTarget, dump, Standard_True);
delete[] dump;
}
}

View File

@@ -0,0 +1,45 @@
// Created on: 2017-02-14
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_NoteBinDataDriver_HeaderFile
#define _XmlMXCAFDoc_NoteBinDataDriver_HeaderFile
#include <XmlMXCAFDoc_NoteDriver.hxx>
class XmlMXCAFDoc_NoteBinDataDriver;
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NoteBinDataDriver, XmlMXCAFDoc_NoteDriver)
//! Attribute Driver.
class XmlMXCAFDoc_NoteBinDataDriver : public XmlMXCAFDoc_NoteDriver
{
public:
Standard_EXPORT XmlMXCAFDoc_NoteBinDataDriver(const Handle(CDM_MessageDriver)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteBinDataDriver, XmlMXCAFDoc_NoteDriver)
};
#endif // _XmlMXCAFDoc_NoteBinDataDriver_HeaderFile

View File

@@ -0,0 +1,95 @@
// Created on: 2017-02-14
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_NoteComment.hxx>
#include <XmlMXCAFDoc_NoteCommentDriver.hxx>
#include <XmlObjMgt_Persistent.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteCommentDriver, XmlMXCAFDoc_NoteDriver)
IMPLEMENT_DOMSTRING(Comment, "comment")
//=======================================================================
//function :
//purpose :
//=======================================================================
XmlMXCAFDoc_NoteCommentDriver::XmlMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
: XmlMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteComment)->Name())
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(TDF_Attribute) XmlMXCAFDoc_NoteCommentDriver::NewEmpty() const
{
return new XCAFDoc_NoteComment();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean XmlMXCAFDoc_NoteCommentDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& theRelocTable) const
{
XmlMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
const XmlObjMgt_Element& anElement = theSource;
XmlObjMgt_DOMString aComment = anElement.getAttribute(::Comment());
if (aComment == NULL)
return Standard_False;
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theTarget);
if (aNote.IsNull())
return Standard_False;
aNote->Set(aComment.GetString());
return Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void XmlMXCAFDoc_NoteCommentDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& theRelocTable) const
{
XmlMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theSource);
XmlObjMgt_DOMString aComment(TCollection_AsciiString(aNote->TimeStamp()).ToCString());
theTarget.Element().setAttribute(::Comment(), aComment);
}
//=======================================================================
//function :
//purpose :
//=======================================================================
XmlMXCAFDoc_NoteCommentDriver::XmlMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
Standard_CString theName)
: XmlMXCAFDoc_NoteDriver(theMsgDriver, theName)
{
}

View File

@@ -0,0 +1,50 @@
// Created on: 2017-02-14
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_NoteCommentDriver_HeaderFile
#define _XmlMXCAFDoc_NoteCommentDriver_HeaderFile
#include <XmlMXCAFDoc_NoteDriver.hxx>
class XmlMXCAFDoc_NoteCommentDriver;
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NoteCommentDriver, XmlMXCAFDoc_NoteDriver)
//! Attribute Driver.
class XmlMXCAFDoc_NoteCommentDriver : public XmlMXCAFDoc_NoteDriver
{
public:
Standard_EXPORT XmlMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteCommentDriver, XmlMXCAFDoc_NoteDriver)
protected:
XmlMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
Standard_CString theName);
};
#endif // _XmlMXCAFDoc_NoteCommentDriver_HeaderFile

View File

@@ -0,0 +1,78 @@
// Created on: 2017-02-14
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_Note.hxx>
#include <XmlMXCAFDoc_NoteDriver.hxx>
#include <XmlObjMgt_Persistent.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteDriver, XmlMDF_ADriver)
IMPLEMENT_DOMSTRING(UserName, "user_name")
IMPLEMENT_DOMSTRING(TimeStamp, "time_stamp")
//=======================================================================
//function :
//purpose :
//=======================================================================
XmlMXCAFDoc_NoteDriver::XmlMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
Standard_CString theName)
: XmlMDF_ADriver(theMsgDriver, theName)
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean XmlMXCAFDoc_NoteDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& /*theRelocTable*/) const
{
const XmlObjMgt_Element& anElement = theSource;
XmlObjMgt_DOMString aUserName = anElement.getAttribute(::UserName());
XmlObjMgt_DOMString aTimeStamp = anElement.getAttribute(::TimeStamp());
if (aUserName == NULL || aTimeStamp == NULL)
return Standard_False;
Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theTarget);
if (aNote.IsNull())
return Standard_False;
aNote->Set(aUserName.GetString(), aTimeStamp.GetString());
return Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void XmlMXCAFDoc_NoteDriver::Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& /*theRelocTable*/) const
{
Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theSource);
if (aNote.IsNull())
return;
XmlObjMgt_DOMString aUserName(TCollection_AsciiString(aNote->UserName()).ToCString());
XmlObjMgt_DOMString aTimeStamp(TCollection_AsciiString(aNote->TimeStamp()).ToCString());
theTarget.Element().setAttribute(::UserName(), aUserName);
theTarget.Element().setAttribute(::TimeStamp(), aTimeStamp);
}

View File

@@ -0,0 +1,56 @@
// Created on: 2017-02-14
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_NoteDriver_HeaderFile
#define _XmlMXCAFDoc_NoteDriver_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_NoteDriver;
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NoteDriver, XmlMDF_ADriver)
//! Attribute Driver.
class XmlMXCAFDoc_NoteDriver : public XmlMDF_ADriver
{
public:
Standard_EXPORT Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteDriver, XmlMDF_ADriver)
protected:
XmlMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
Standard_CString theName);
};
#endif // _XmlMXCAFDoc_NoteDriver_HeaderFile

View File

@@ -0,0 +1,62 @@
// Created on: 2017-02-14
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_NotesTool.hxx>
#include <XmlMXCAFDoc_NotesToolDriver.hxx>
#include <XmlObjMgt_Persistent.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NotesToolDriver, XmlMDF_ADriver)
//=======================================================================
//function :
//purpose :
//=======================================================================
XmlMXCAFDoc_NotesToolDriver::XmlMXCAFDoc_NotesToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
: XmlMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NotesTool)->Name())
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Handle(TDF_Attribute) XmlMXCAFDoc_NotesToolDriver::NewEmpty() const
{
return new XCAFDoc_NotesTool();
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean XmlMXCAFDoc_NotesToolDriver::Paste(const XmlObjMgt_Persistent& /*theSource*/,
const Handle(TDF_Attribute)& /*theTarget*/,
XmlObjMgt_RRelocationTable& /*theRelocTable*/) const
{
return Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void XmlMXCAFDoc_NotesToolDriver::Paste(const Handle(TDF_Attribute)& /*theSource*/,
XmlObjMgt_Persistent& /*theTarget*/,
XmlObjMgt_SRelocationTable& /*theRelocTable*/) const
{
}

View File

@@ -0,0 +1,55 @@
// Created on: 2017-02-14
// Created by: Sergey NIKONOV
// Copyright (c) 2008-2017 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_NotesToolDriver_HeaderFile
#define _XmlMXCAFDoc_NotesToolDriver_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_NotesToolDriver;
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NotesToolDriver, XmlMDF_ADriver)
//! Attribute Driver.
class XmlMXCAFDoc_NotesToolDriver : public XmlMDF_ADriver
{
public:
Standard_EXPORT XmlMXCAFDoc_NotesToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NotesToolDriver, XmlMDF_ADriver)
};
#endif // _XmlMXCAFDoc_NotesToolDriver_HeaderFile