mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
XCAF: comment and bin data note attributes added
This commit is contained in:
parent
fdab3e717d
commit
b87a2fa42c
@ -33,6 +33,8 @@
|
||||
#include <BinMXCAFDoc_MaterialDriver.hxx>
|
||||
#include <BinMXCAFDoc_MaterialToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteBinDataDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <BinMXCAFDoc_NotesToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_ShapeToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_ViewDriver.hxx>
|
||||
@ -73,7 +75,9 @@ void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver(new BinMXCAFDoc_ViewDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteBinDataDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteCommentDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver (new BinMXCAFDoc_ViewDriver (theMsgDrv));
|
||||
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ColorToolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DocumentToolDriver(theMsgDrv));
|
||||
|
85
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.cxx
Normal file
85
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.cxx
Normal file
@ -0,0 +1,85 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Eugeny NIKONOV
|
||||
// Copyright (c) 2005-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 <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <BinMXCAFDoc_NoteBinDataDriver.hxx>
|
||||
#include <XCAFDoc_NoteBinData.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteBinDataDriver::BinMXCAFDoc_NoteBinDataDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBinData)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NoteBinDataDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteBinData();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NoteBinDataDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aNoteBinData = Handle(XCAFDoc_NoteBinData)::DownCast(theTarget);
|
||||
|
||||
TCollection_AsciiString aData, aMIMEtype;
|
||||
if (!(theSource >> aData >> aMIMEtype))
|
||||
return Standard_False;
|
||||
|
||||
aNoteBinData->Set(new TCollection_HAsciiString(aData),
|
||||
new TCollection_HAsciiString(aMIMEtype));
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NoteBinDataDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aNoteBinData = Handle(XCAFDoc_NoteBinData)::DownCast(theSource);
|
||||
|
||||
Handle(TCollection_HAsciiString) aData = aNoteBinData->Data();
|
||||
Handle(TCollection_HAsciiString) aMIMEtype = aNoteBinData->MIMEtype();
|
||||
theTarget
|
||||
<< (aData ? aData->String() : TCollection_AsciiString(""))
|
||||
<< (aMIMEtype ? aMIMEtype->String() : TCollection_AsciiString(""))
|
||||
;
|
||||
}
|
44
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.hxx
Normal file
44
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.hxx
Normal file
@ -0,0 +1,44 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2005-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 _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
|
||||
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
|
||||
class BinMXCAFDoc_NoteBinDataDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
class BinMXCAFDoc_NoteBinDataDriver : public BinMXCAFDoc_NoteDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteBinDataDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
|
81
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.cxx
Normal file
81
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.cxx
Normal file
@ -0,0 +1,81 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Eugeny NIKONOV
|
||||
// Copyright (c) 2005-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 <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <XCAFDoc_NoteComment.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteCommentDriver::BinMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteComment)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NoteCommentDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteComment();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NoteCommentDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aNoteComment = Handle(XCAFDoc_NoteComment)::DownCast(theTarget);
|
||||
|
||||
TCollection_ExtendedString aComment;
|
||||
if (!(theSource >> aComment))
|
||||
return Standard_False;
|
||||
|
||||
aNoteComment->Set(new TCollection_HExtendedString(aComment));
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NoteCommentDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aNoteComment = Handle(XCAFDoc_NoteComment)::DownCast(theSource);
|
||||
|
||||
Handle(TCollection_HExtendedString) aComment = aNoteComment->TimeStamp();
|
||||
theTarget
|
||||
<< (aComment ? aComment->String() : TCollection_ExtendedString(""))
|
||||
;
|
||||
}
|
44
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.hxx
Normal file
44
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.hxx
Normal file
@ -0,0 +1,44 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2005-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 _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
||||
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
|
||||
class BinMXCAFDoc_NoteCommentDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
class BinMXCAFDoc_NoteCommentDriver : public BinMXCAFDoc_NoteDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
@ -31,6 +31,17 @@ BinMXCAFDoc_NoteDriver::BinMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)&
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteDriver::BinMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: BinMDF_ADriver(theMsgDriver, theName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@ -44,10 +55,19 @@ Handle(TDF_Attribute) BinMXCAFDoc_NoteDriver::NewEmpty() const
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NoteDriver::Paste(const BinObjMgt_Persistent& /*theSource*/,
|
||||
const Handle(TDF_Attribute)& /*theTarget*/,
|
||||
Standard_Boolean BinMXCAFDoc_NoteDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theTarget);
|
||||
|
||||
TCollection_ExtendedString aUserName, aTimeStamp;
|
||||
if (!(theSource >> aUserName >> aTimeStamp))
|
||||
return Standard_False;
|
||||
|
||||
aNote->Set(new TCollection_HExtendedString(aUserName),
|
||||
new TCollection_HExtendedString(aTimeStamp));
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@ -55,8 +75,15 @@ Standard_Boolean BinMXCAFDoc_NoteDriver::Paste(const BinObjMgt_Persistent& /*th
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NoteDriver::Paste(const Handle(TDF_Attribute)& /*theSource*/,
|
||||
BinObjMgt_Persistent& /*theTarget*/,
|
||||
void BinMXCAFDoc_NoteDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theSource);
|
||||
Handle(TCollection_HExtendedString) aUserName = aNote->UserName();
|
||||
Handle(TCollection_HExtendedString) aTimeStamp = aNote->TimeStamp();
|
||||
theTarget
|
||||
<< (aUserName ? aUserName->String() : TCollection_ExtendedString(""))
|
||||
<< (aTimeStamp ? aTimeStamp->String() : TCollection_ExtendedString(""))
|
||||
;
|
||||
}
|
||||
|
@ -49,6 +49,11 @@ public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteDriver, BinMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName);
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteDriver_HeaderFile
|
||||
|
@ -35,6 +35,10 @@ BinMXCAFDoc_MaterialToolDriver.cxx
|
||||
BinMXCAFDoc_MaterialToolDriver.hxx
|
||||
BinMXCAFDoc_NoteDriver.cxx
|
||||
BinMXCAFDoc_NoteDriver.hxx
|
||||
BinMXCAFDoc_NoteCommentDriver.cxx
|
||||
BinMXCAFDoc_NoteCommentDriver.hxx
|
||||
BinMXCAFDoc_NoteBinDataDriver.cxx
|
||||
BinMXCAFDoc_NoteBinDataDriver.hxx
|
||||
BinMXCAFDoc_NotesToolDriver.cxx
|
||||
BinMXCAFDoc_NotesToolDriver.hxx
|
||||
BinMXCAFDoc_ShapeToolDriver.cxx
|
||||
|
@ -42,6 +42,10 @@ XCAFDoc_MaterialTool.cxx
|
||||
XCAFDoc_MaterialTool.hxx
|
||||
XCAFDoc_Note.cxx
|
||||
XCAFDoc_Note.hxx
|
||||
XCAFDoc_NoteComment.cxx
|
||||
XCAFDoc_NoteComment.hxx
|
||||
XCAFDoc_NoteBinData.cxx
|
||||
XCAFDoc_NoteBinData.hxx
|
||||
XCAFDoc_NotesTool.cxx
|
||||
XCAFDoc_NotesTool.hxx
|
||||
XCAFDoc_ShapeMapTool.cxx
|
||||
|
@ -172,6 +172,17 @@ Standard_GUID XCAFDoc::MaterialRefGUID ()
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NoteRefGUID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_GUID XCAFDoc::NoteRefGUID()
|
||||
{
|
||||
static Standard_GUID ID ("F3599E50-F84A-493e-8D1B-1284E79322F1");
|
||||
return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InvisibleGUID
|
||||
//purpose :
|
||||
|
@ -97,7 +97,10 @@ public:
|
||||
Standard_EXPORT static Standard_GUID LayerRefGUID();
|
||||
|
||||
Standard_EXPORT static Standard_GUID MaterialRefGUID();
|
||||
|
||||
|
||||
//! Return GUIDs for TreeNode representing types of Note
|
||||
Standard_EXPORT static Standard_GUID NoteRefGUID();
|
||||
|
||||
Standard_EXPORT static Standard_GUID InvisibleGUID();
|
||||
|
||||
//! Returns GUID for UAttribute identifying external reference on no-step file
|
||||
|
@ -25,21 +25,49 @@ const Standard_GUID& XCAFDoc_Note::GetID()
|
||||
return s_ID;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note) XCAFDoc_Note::Set(const TDF_Label& theLabel)
|
||||
Standard_Boolean XCAFDoc_Note::IsMine(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_Note) aTool;
|
||||
if (!theLabel.FindAttribute(XCAFDoc_Note::GetID(), aTool))
|
||||
Handle(XCAFDoc_Note) anAttr;
|
||||
return (!theLabel.IsNull() && theLabel.FindAttribute(XCAFDoc_Note::GetID(), anAttr));
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note) XCAFDoc_Note::Set(const TDF_Label& theLabel,
|
||||
const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp)
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_Note::GetID(), aNote))
|
||||
{
|
||||
aTool = new XCAFDoc_Note();
|
||||
theLabel.AddAttribute(aTool);
|
||||
aNote = new XCAFDoc_Note();
|
||||
aNote->Set(theUserName, theTimeStamp);
|
||||
theLabel.AddAttribute(aNote);
|
||||
}
|
||||
return aTool;
|
||||
return aNote;
|
||||
}
|
||||
|
||||
XCAFDoc_Note::XCAFDoc_Note()
|
||||
{
|
||||
}
|
||||
|
||||
void XCAFDoc_Note::Set(const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp)
|
||||
{
|
||||
Backup();
|
||||
|
||||
myUserName = theUserName;
|
||||
myTimeStamp = theTimeStamp;
|
||||
}
|
||||
|
||||
Handle(TCollection_HExtendedString) XCAFDoc_Note::UserName() const
|
||||
{
|
||||
return myUserName;
|
||||
}
|
||||
|
||||
Handle(TCollection_HExtendedString) XCAFDoc_Note::TimeStamp() const
|
||||
{
|
||||
return myTimeStamp;
|
||||
}
|
||||
|
||||
const Standard_GUID& XCAFDoc_Note::ID() const
|
||||
{
|
||||
return GetID();
|
||||
@ -50,11 +78,25 @@ Handle(TDF_Attribute) XCAFDoc_Note::NewEmpty() const
|
||||
return new XCAFDoc_Note();
|
||||
}
|
||||
|
||||
void XCAFDoc_Note::Restore(const Handle(TDF_Attribute)& /*theAttr*/)
|
||||
void XCAFDoc_Note::Restore(const Handle(TDF_Attribute)& theAttr)
|
||||
{
|
||||
myUserName = Handle(XCAFDoc_Note)::DownCast(theAttr)->myUserName;
|
||||
myTimeStamp = Handle(XCAFDoc_Note)::DownCast(theAttr)->myTimeStamp;
|
||||
}
|
||||
|
||||
void XCAFDoc_Note::Paste(const Handle(TDF_Attribute)& /*theAttrInto*/,
|
||||
void XCAFDoc_Note::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& /*theRT*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Note)::DownCast(theAttrInto)->Set(myUserName, myTimeStamp);
|
||||
}
|
||||
|
||||
Standard_OStream& XCAFDoc_Note::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
theOS
|
||||
<< "Note : "
|
||||
<< (myUserName ? myUserName->String() : "<anonymous>")
|
||||
<< " on "
|
||||
<< (myTimeStamp ? myTimeStamp->String() : "<unknown>")
|
||||
;
|
||||
return theOS;
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_HExtendedString.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
|
||||
class Standard_GUID;
|
||||
@ -32,14 +34,23 @@ public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDoc_Note, TDF_Attribute)
|
||||
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
|
||||
//! Create (if not exist) NotesTool from XCAFDoc on <L>.
|
||||
Standard_EXPORT static Handle(XCAFDoc_Note) Set(const TDF_Label& theLabel);
|
||||
Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel);
|
||||
|
||||
Standard_EXPORT static Handle(XCAFDoc_Note) Set(const TDF_Label& theLabel,
|
||||
const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp);
|
||||
|
||||
//! Creates an empty tool
|
||||
Standard_EXPORT XCAFDoc_Note();
|
||||
|
||||
Standard_EXPORT void Set(const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp);
|
||||
|
||||
Standard_EXPORT Handle(TCollection_HExtendedString) UserName() const;
|
||||
|
||||
Standard_EXPORT Handle(TCollection_HExtendedString) TimeStamp() const;
|
||||
|
||||
public:
|
||||
|
||||
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
|
||||
@ -51,6 +62,12 @@ public:
|
||||
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(TCollection_HExtendedString) myUserName;
|
||||
Handle(TCollection_HExtendedString) myTimeStamp;
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_Note_HeaderFile
|
||||
|
128
src/XCAFDoc/XCAFDoc_NoteBinData.cxx
Normal file
128
src/XCAFDoc/XCAFDoc_NoteBinData.cxx
Normal file
@ -0,0 +1,128 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2000-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 <OSD_File.hxx>
|
||||
#include <Standard_GUID.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <XCAFDoc_NoteBinData.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteBinData, XCAFDoc_Note)
|
||||
|
||||
const Standard_GUID& XCAFDoc_NoteBinData::GetID()
|
||||
{
|
||||
static Standard_GUID s_ID("E9055501-F0FC-4864-BE4B-284FDA7DDEAC");
|
||||
return s_ID;
|
||||
}
|
||||
|
||||
Standard_Boolean XCAFDoc_NoteBinData::IsMine(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_NoteBinData) anAttr;
|
||||
return (!theLabel.IsNull() && theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), anAttr));
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) XCAFDoc_NoteBinData::Set(const TDF_Label& theLabel,
|
||||
const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp,
|
||||
OSD_File& theFile,
|
||||
const Handle(TCollection_HAsciiString)& theMIMEtype)
|
||||
{
|
||||
Handle(XCAFDoc_NoteBinData) aNoteBinData;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_Note::GetID(), aNoteBinData))
|
||||
{
|
||||
aNoteBinData = new XCAFDoc_NoteBinData();
|
||||
aNoteBinData->XCAFDoc_Note::Set(theUserName, theTimeStamp);
|
||||
aNoteBinData->Set(theFile, theMIMEtype);
|
||||
theLabel.AddAttribute(aNoteBinData);
|
||||
}
|
||||
return aNoteBinData;
|
||||
}
|
||||
|
||||
XCAFDoc_NoteBinData::XCAFDoc_NoteBinData()
|
||||
{
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteBinData::Set(OSD_File& theFile,
|
||||
const Handle(TCollection_HAsciiString)& theMIMEtype)
|
||||
{
|
||||
if (!theFile.IsOpen() || !theFile.IsReadable())
|
||||
return;
|
||||
|
||||
TCollection_AsciiString aStr;
|
||||
theFile.Read(aStr, theFile.Size());
|
||||
|
||||
Backup();
|
||||
|
||||
myData.reset(new TCollection_HAsciiString(aStr));
|
||||
myMIMEtype = theMIMEtype;
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteBinData::Set(const Handle(TCollection_HAsciiString)& theData,
|
||||
const Handle(TCollection_HAsciiString)& theMIMEtype)
|
||||
{
|
||||
Backup();
|
||||
|
||||
myData = theData;
|
||||
myMIMEtype = theMIMEtype;
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) XCAFDoc_NoteBinData::Data() const
|
||||
{
|
||||
return myData;
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) XCAFDoc_NoteBinData::MIMEtype() const
|
||||
{
|
||||
return myMIMEtype;
|
||||
}
|
||||
|
||||
const Standard_GUID& XCAFDoc_NoteBinData::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
Handle(TDF_Attribute) XCAFDoc_NoteBinData::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_Note();
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteBinData::Restore(const Handle(TDF_Attribute)& theAttr)
|
||||
{
|
||||
XCAFDoc_Note::Restore(theAttr);
|
||||
myData = Handle(XCAFDoc_NoteBinData)::DownCast(theAttr)->myData;
|
||||
myMIMEtype = Handle(XCAFDoc_NoteBinData)::DownCast(theAttr)->myMIMEtype;
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteBinData::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const
|
||||
{
|
||||
XCAFDoc_Note::Paste(theAttrInto, theRT);
|
||||
Handle(XCAFDoc_NoteBinData)::DownCast(theAttrInto)->Set(myData, myMIMEtype);
|
||||
}
|
||||
|
||||
Standard_OStream& XCAFDoc_NoteBinData::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
XCAFDoc_Note::Dump(theOS);
|
||||
theOS
|
||||
<< "\n"
|
||||
<< "MIME type : "
|
||||
<< (myMIMEtype ? myMIMEtype->String() : "<none>")
|
||||
<< "\n"
|
||||
<< "<BEGIN>"
|
||||
<< (myData ? myData->String() : "")
|
||||
<< "<END>"
|
||||
;
|
||||
return theOS;
|
||||
}
|
73
src/XCAFDoc/XCAFDoc_NoteBinData.hxx
Normal file
73
src/XCAFDoc/XCAFDoc_NoteBinData.hxx
Normal file
@ -0,0 +1,73 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2000-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 _XCAFDoc_NoteBinData_HeaderFile
|
||||
#define _XCAFDoc_NoteBinData_HeaderFile
|
||||
|
||||
#include <XCAFDoc_Note.hxx>
|
||||
|
||||
class OSD_File;
|
||||
class TCollection_HAsciiString;
|
||||
|
||||
class XCAFDoc_NoteBinData;
|
||||
DEFINE_STANDARD_HANDLE(XCAFDoc_NoteBinData, XCAFDoc_Note)
|
||||
|
||||
class XCAFDoc_NoteBinData : public XCAFDoc_Note
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDoc_NoteBinData, XCAFDoc_Note)
|
||||
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel);
|
||||
|
||||
Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Set(const TDF_Label& theLabel,
|
||||
const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp,
|
||||
OSD_File& theFile,
|
||||
const Handle(TCollection_HAsciiString)& theMIMEtype);
|
||||
|
||||
Standard_EXPORT XCAFDoc_NoteBinData();
|
||||
|
||||
Standard_EXPORT void Set(OSD_File& theFile,
|
||||
const Handle(TCollection_HAsciiString)& theMIMEtype);
|
||||
|
||||
Standard_EXPORT void Set(const Handle(TCollection_HAsciiString)& theData,
|
||||
const Handle(TCollection_HAsciiString)& theMIMEtype);
|
||||
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) Data() const;
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) MIMEtype() const;
|
||||
|
||||
public:
|
||||
|
||||
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theAttrFrom) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(TCollection_HAsciiString) myData;
|
||||
Handle(TCollection_HAsciiString) myMIMEtype;
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_NoteBinData_HeaderFile
|
98
src/XCAFDoc/XCAFDoc_NoteComment.cxx
Normal file
98
src/XCAFDoc/XCAFDoc_NoteComment.cxx
Normal file
@ -0,0 +1,98 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2000-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 <Standard_GUID.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <XCAFDoc_NoteComment.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteComment, XCAFDoc_Note)
|
||||
|
||||
const Standard_GUID& XCAFDoc_NoteComment::GetID()
|
||||
{
|
||||
static Standard_GUID s_ID("FDEA4C52-0F54-484c-B590-579E18F7B5D4");
|
||||
return s_ID;
|
||||
}
|
||||
|
||||
Standard_Boolean XCAFDoc_NoteComment::IsMine(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_NoteComment) anAttr;
|
||||
return (!theLabel.IsNull() && theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), anAttr));
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteComment) XCAFDoc_NoteComment::Set(const TDF_Label& theLabel,
|
||||
const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp,
|
||||
const Handle(TCollection_HExtendedString)& theComment)
|
||||
{
|
||||
Handle(XCAFDoc_NoteComment) aNoteComment;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_Note::GetID(), aNoteComment))
|
||||
{
|
||||
aNoteComment = new XCAFDoc_NoteComment();
|
||||
aNoteComment->XCAFDoc_Note::Set(theUserName, theTimeStamp);
|
||||
aNoteComment->Set(theComment);
|
||||
theLabel.AddAttribute(aNoteComment);
|
||||
}
|
||||
return aNoteComment;
|
||||
}
|
||||
|
||||
XCAFDoc_NoteComment::XCAFDoc_NoteComment()
|
||||
{
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteComment::Set(const Handle(TCollection_HExtendedString)& theComment)
|
||||
{
|
||||
Backup();
|
||||
|
||||
myComment = theComment;
|
||||
}
|
||||
|
||||
Handle(TCollection_HExtendedString) XCAFDoc_NoteComment::Comment() const
|
||||
{
|
||||
return myComment;
|
||||
}
|
||||
|
||||
const Standard_GUID& XCAFDoc_NoteComment::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
Handle(TDF_Attribute) XCAFDoc_NoteComment::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_Note();
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteComment::Restore(const Handle(TDF_Attribute)& theAttr)
|
||||
{
|
||||
XCAFDoc_Note::Restore(theAttr);
|
||||
myComment = Handle(XCAFDoc_NoteComment)::DownCast(theAttr)->myComment;
|
||||
}
|
||||
|
||||
void XCAFDoc_NoteComment::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const
|
||||
{
|
||||
XCAFDoc_Note::Paste(theAttrInto, theRT);
|
||||
Handle(XCAFDoc_NoteComment)::DownCast(theAttrInto)->Set(myComment);
|
||||
}
|
||||
|
||||
Standard_OStream& XCAFDoc_NoteComment::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
XCAFDoc_Note::Dump(theOS);
|
||||
theOS
|
||||
<< "\n"
|
||||
<< "Comment : "
|
||||
<< (myComment ? myComment->String() : "<empty>")
|
||||
;
|
||||
return theOS;
|
||||
}
|
63
src/XCAFDoc/XCAFDoc_NoteComment.hxx
Normal file
63
src/XCAFDoc/XCAFDoc_NoteComment.hxx
Normal file
@ -0,0 +1,63 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2000-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 _XCAFDoc_NoteComment_HeaderFile
|
||||
#define _XCAFDoc_NoteComment_HeaderFile
|
||||
|
||||
#include <XCAFDoc_Note.hxx>
|
||||
|
||||
class XCAFDoc_NoteComment;
|
||||
DEFINE_STANDARD_HANDLE(XCAFDoc_NoteComment, XCAFDoc_Note)
|
||||
|
||||
class XCAFDoc_NoteComment : public XCAFDoc_Note
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDoc_NoteComment, XCAFDoc_Note)
|
||||
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel);
|
||||
|
||||
Standard_EXPORT static Handle(XCAFDoc_NoteComment) Set(const TDF_Label& theLabel,
|
||||
const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp,
|
||||
const Handle(TCollection_HExtendedString)& theComment);
|
||||
|
||||
Standard_EXPORT XCAFDoc_NoteComment();
|
||||
|
||||
Standard_EXPORT void Set(const Handle(TCollection_HExtendedString)& theComment);
|
||||
|
||||
Standard_EXPORT Handle(TCollection_HExtendedString) Comment() const;
|
||||
|
||||
public:
|
||||
|
||||
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theAttrFrom) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(TCollection_HExtendedString) myComment;
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_NoteComment_HeaderFile
|
@ -15,7 +15,12 @@
|
||||
|
||||
#include <Standard_GUID.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <TDF_LabelSequence.hxx>
|
||||
#include <XCAFDoc.hxx>
|
||||
#include <XCAFDoc_GraphNode.hxx>
|
||||
#include <XCAFDoc_NotesTool.hxx>
|
||||
#include <XCAFDoc_Note.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NotesTool, TDF_Attribute)
|
||||
|
||||
@ -40,6 +45,28 @@ XCAFDoc_NotesTool::XCAFDoc_NotesTool()
|
||||
{
|
||||
}
|
||||
|
||||
void XCAFDoc_NotesTool::GetNotes(TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
theNoteLabels.Clear();
|
||||
for (TDF_ChildIterator anIter(Label()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
if (XCAFDoc_Note::IsMine(aLabel))
|
||||
{
|
||||
theNoteLabels.Append(aLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note) XCAFDoc_NotesTool::AddNote(const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp)
|
||||
{
|
||||
TDF_Label aNoteLabel;
|
||||
TDF_TagSource aTag;
|
||||
aNoteLabel = aTag.NewChild(Label());
|
||||
return XCAFDoc_Note::Set(aNoteLabel, theUserName, theTimeStamp);
|
||||
}
|
||||
|
||||
const Standard_GUID& XCAFDoc_NotesTool::ID() const
|
||||
{
|
||||
return GetID();
|
||||
|
@ -19,9 +19,12 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDF_LabelSequence.hxx>
|
||||
|
||||
class Standard_GUID;
|
||||
class TCollection_HExtendedString;
|
||||
class TDF_RelocationTable;
|
||||
class XCAFDoc_Note;
|
||||
|
||||
class XCAFDoc_NotesTool;
|
||||
DEFINE_STANDARD_HANDLE(XCAFDoc_NotesTool, TDF_Attribute)
|
||||
@ -40,14 +43,19 @@ public:
|
||||
//! Creates an empty tool
|
||||
Standard_EXPORT XCAFDoc_NotesTool();
|
||||
|
||||
//! Returns a sequence of note labels currently stored in the tool table
|
||||
Standard_EXPORT void GetNotes(TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
//! Adds a new note and returns a handle to it
|
||||
Standard_EXPORT Handle(XCAFDoc_Note) AddNote(const Handle(TCollection_HExtendedString)& theUserName,
|
||||
const Handle(TCollection_HExtendedString)& theTimeStamp);
|
||||
|
||||
public:
|
||||
|
||||
// Overrides TDF_Attribute pure virtuals
|
||||
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theAttrFrom) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user