mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-20 11:54:07 +03:00
XCAF: assembly item/part id, notes for assembly items
This commit is contained in:
parent
bc1c59d0a0
commit
8feb46bb5d
76
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx
Normal file
76
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx
Normal file
@ -0,0 +1,76 @@
|
||||
// Created on: 2017-02-16
|
||||
// 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_AssemblyItemRefDriver.hxx>
|
||||
#include <XCAFDoc_AssemblyItemRef.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_AssemblyItemRefDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_AssemblyItemRefDriver::BinMXCAFDoc_AssemblyItemRefDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_AssemblyItemRef)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_AssemblyItemRefDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_AssemblyItemRef();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_AssemblyItemRefDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theTarget);
|
||||
if (aThis.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_AsciiString aStr;
|
||||
if (!(theSource >> aStr))
|
||||
return Standard_False;
|
||||
|
||||
aThis->Set(aStr);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_AssemblyItemRefDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theSource);
|
||||
if (!aThis.IsNull())
|
||||
theTarget << aThis->Get().ToString();
|
||||
}
|
54
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.hxx
Normal file
54
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.hxx
Normal file
@ -0,0 +1,54 @@
|
||||
// Created on: 2017-02-16
|
||||
// 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_AssemblyItemRefDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_AssemblyItemRefDriver_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_AssemblyItemRefDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_AssemblyItemRefDriver, BinMDF_ADriver)
|
||||
|
||||
class BinMXCAFDoc_AssemblyItemRefDriver : public BinMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_AssemblyItemRefDriver(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_AssemblyItemRefDriver, BinMDF_ADriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_AssemblyItemRefDriver_HeaderFile
|
@ -1,5 +1,7 @@
|
||||
BinMXCAFDoc.cxx
|
||||
BinMXCAFDoc.hxx
|
||||
BinMXCAFDoc_AssemblyItemRefDriver.cxx
|
||||
BinMXCAFDoc_AssemblyItemRefDriver.hxx
|
||||
BinMXCAFDoc_AreaDriver.cxx
|
||||
BinMXCAFDoc_AreaDriver.hxx
|
||||
BinMXCAFDoc_CentroidDriver.cxx
|
||||
|
@ -2,6 +2,11 @@ FILES
|
||||
GUID.txt
|
||||
XCAFDoc.cxx
|
||||
XCAFDoc.hxx
|
||||
XCAFDoc_AssemblyItemId.cxx
|
||||
XCAFDoc_AssemblyItemId.hxx
|
||||
XCAFDoc_AssemblyItemRef.cxx
|
||||
XCAFDoc_AssemblyItemRef.hxx
|
||||
XCAFDoc_PartId.hxx
|
||||
XCAFDoc_Area.cxx
|
||||
XCAFDoc_Area.hxx
|
||||
XCAFDoc_Centroid.cxx
|
||||
|
123
src/XCAFDoc/XCAFDoc_AssemblyItemId.cxx
Normal file
123
src/XCAFDoc/XCAFDoc_AssemblyItemId.cxx
Normal file
@ -0,0 +1,123 @@
|
||||
// Created on: 2017-02-16
|
||||
// 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 <XCAFDoc_AssemblyItemId.hxx>
|
||||
|
||||
XCAFDoc_AssemblyItemId::XCAFDoc_AssemblyItemId()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
XCAFDoc_AssemblyItemId::XCAFDoc_AssemblyItemId(const TColStd_ListOfAsciiString& thePath)
|
||||
{
|
||||
Init(thePath);
|
||||
}
|
||||
|
||||
XCAFDoc_AssemblyItemId::XCAFDoc_AssemblyItemId(const TCollection_AsciiString& theString)
|
||||
{
|
||||
Init(theString);
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemId::Init(const TColStd_ListOfAsciiString& thePath)
|
||||
{
|
||||
myPath = thePath;
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemId::Init(const TCollection_AsciiString& theString)
|
||||
{
|
||||
myPath.Clear();
|
||||
|
||||
for (Standard_Integer iEntry = 1; ; ++iEntry)
|
||||
{
|
||||
TCollection_AsciiString anEntry = theString.Token("/", iEntry);
|
||||
if (anEntry.IsEmpty())
|
||||
break;
|
||||
|
||||
myPath.Append(anEntry);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemId::IsNull() const
|
||||
{
|
||||
return myPath.IsEmpty();
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemId::Nullify()
|
||||
{
|
||||
myPath.Clear();
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemId::IsChild(const XCAFDoc_AssemblyItemId& theOther) const
|
||||
{
|
||||
if (myPath.Size() <= theOther.myPath.Size())
|
||||
return Standard_False;
|
||||
|
||||
TColStd_ListOfAsciiString::Iterator anIt(myPath), anItOther(theOther.myPath);
|
||||
for (; anItOther.More(); anIt.Next(), anItOther.Next())
|
||||
{
|
||||
if (anIt.Value() != anItOther.Value())
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemId::IsDirectChild(const XCAFDoc_AssemblyItemId& theOther) const
|
||||
{
|
||||
return ((myPath.Size() == theOther.myPath.Size() - 1) && IsChild(theOther));
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemId::IsEqual(const XCAFDoc_AssemblyItemId& theOther) const
|
||||
{
|
||||
if (this == &theOther)
|
||||
return Standard_True;
|
||||
|
||||
if (myPath.Size() != theOther.myPath.Size())
|
||||
return Standard_False;
|
||||
|
||||
TColStd_ListOfAsciiString::Iterator anIt(myPath), anItOther(theOther.myPath);
|
||||
for (; anIt.More() && anItOther.More(); anIt.Next(), anItOther.Next())
|
||||
{
|
||||
if (anIt.Value() != anItOther.Value())
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
const
|
||||
TColStd_ListOfAsciiString& XCAFDoc_AssemblyItemId::GetPath() const
|
||||
{
|
||||
return myPath;
|
||||
}
|
||||
|
||||
TCollection_AsciiString
|
||||
XCAFDoc_AssemblyItemId::ToString() const
|
||||
{
|
||||
TCollection_AsciiString aStr;
|
||||
for (TColStd_ListOfAsciiString::Iterator anIt(myPath); anIt.More(); anIt.Next())
|
||||
{
|
||||
aStr += '/';
|
||||
aStr += anIt.Value();
|
||||
}
|
||||
return aStr;
|
||||
}
|
67
src/XCAFDoc/XCAFDoc_AssemblyItemId.hxx
Normal file
67
src/XCAFDoc/XCAFDoc_AssemblyItemId.hxx
Normal file
@ -0,0 +1,67 @@
|
||||
// Created on: 2017-02-16
|
||||
// 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_AssemblyItemId_HeaderFile
|
||||
#define _XCAFDoc_AssemblyItemId_HeaderFile
|
||||
|
||||
#include <Standard_GUID.hxx>
|
||||
#include <TColStd_ListOfAsciiString.hxx>
|
||||
|
||||
class XCAFDoc_AssemblyItemId
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Standard_EXPORT XCAFDoc_AssemblyItemId();
|
||||
Standard_EXPORT XCAFDoc_AssemblyItemId(const TColStd_ListOfAsciiString& thePath);
|
||||
Standard_EXPORT XCAFDoc_AssemblyItemId(const TCollection_AsciiString& theString);
|
||||
|
||||
Standard_EXPORT void Init(const TColStd_ListOfAsciiString& thePath);
|
||||
Standard_EXPORT void Init(const TCollection_AsciiString& theString);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsNull() const;
|
||||
Standard_EXPORT void Nullify();
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsChild(const XCAFDoc_AssemblyItemId& theOther) const;
|
||||
Standard_EXPORT Standard_Boolean IsDirectChild(const XCAFDoc_AssemblyItemId& theOther) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsEqual(const XCAFDoc_AssemblyItemId& theOther) const;
|
||||
|
||||
Standard_EXPORT const TColStd_ListOfAsciiString& GetPath() const;
|
||||
|
||||
Standard_EXPORT TCollection_AsciiString ToString() const;
|
||||
|
||||
struct Hasher
|
||||
{
|
||||
static int HashCode(const XCAFDoc_AssemblyItemId& theItem,
|
||||
const int upper)
|
||||
{
|
||||
return ::HashCode(theItem.ToString(), upper);
|
||||
}
|
||||
|
||||
static int IsEqual(const XCAFDoc_AssemblyItemId& theItem1,
|
||||
const XCAFDoc_AssemblyItemId& theItem2)
|
||||
{
|
||||
return theItem1.IsEqual(theItem2);
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
TColStd_ListOfAsciiString myPath;
|
||||
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_AssemblyItemId_HeaderFile
|
132
src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx
Normal file
132
src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx
Normal file
@ -0,0 +1,132 @@
|
||||
// Created on: 2017-02-16
|
||||
// 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 <TDF_RelocationTable.hxx>
|
||||
#include <XCAFDoc_AssemblyItemRef.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_AssemblyItemRef, TDF_Attribute)
|
||||
|
||||
const Standard_GUID&
|
||||
XCAFDoc_AssemblyItemRef::GetID()
|
||||
{
|
||||
static Standard_GUID s_ID("3F2E4CD6-169B-4747-A321-5670E4291F5D");
|
||||
return s_ID;
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemRef::IsMine(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis;
|
||||
return !theLabel.IsNull() &&
|
||||
theLabel.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), aThis) &&
|
||||
!aThis.IsNull();
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_AssemblyItemRef::Get(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis;
|
||||
theLabel.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), aThis);
|
||||
return aThis;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_AssemblyItemRef::Set(const TDF_Label& theLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId)
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), aThis))
|
||||
{
|
||||
aThis = new XCAFDoc_AssemblyItemRef();
|
||||
aThis->Set(theItemId);
|
||||
theLabel.AddAttribute(aThis);
|
||||
}
|
||||
return aThis;
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemRef::Set(const TColStd_ListOfAsciiString& thePath)
|
||||
{
|
||||
myItemId.Init(thePath);
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemRef::Set(const TCollection_AsciiString& theString)
|
||||
{
|
||||
myItemId.Init(theString);
|
||||
}
|
||||
|
||||
XCAFDoc_AssemblyItemRef::XCAFDoc_AssemblyItemRef()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemRef::IsOrphan() const
|
||||
{
|
||||
// TODO...
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const XCAFDoc_AssemblyItemId&
|
||||
XCAFDoc_AssemblyItemRef::Get() const
|
||||
{
|
||||
return myItemId;
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemRef::Set(const XCAFDoc_AssemblyItemId& theItemId)
|
||||
{
|
||||
Backup();
|
||||
myItemId = theItemId;
|
||||
}
|
||||
|
||||
const Standard_GUID&
|
||||
XCAFDoc_AssemblyItemRef::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
Handle(TDF_Attribute)
|
||||
XCAFDoc_AssemblyItemRef::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_AssemblyItemRef();
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemRef::Restore(const Handle(TDF_Attribute)& theAttrFrom)
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theAttrFrom);
|
||||
if (!aThis.IsNull())
|
||||
myItemId = aThis->myItemId;
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemRef::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& /*theRT*/) const
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theAttrInto);
|
||||
if (!aThis.IsNull())
|
||||
aThis->myItemId = myItemId;
|
||||
}
|
||||
|
||||
Standard_OStream&
|
||||
XCAFDoc_AssemblyItemRef::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
theOS << myItemId.ToString();
|
||||
return theOS;
|
||||
}
|
75
src/XCAFDoc/XCAFDoc_AssemblyItemRef.hxx
Normal file
75
src/XCAFDoc/XCAFDoc_AssemblyItemRef.hxx
Normal file
@ -0,0 +1,75 @@
|
||||
// Created on: 2017-02-16
|
||||
// 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_AssemblyItemRef_HeaderFile
|
||||
#define _XCAFDoc_AssemblyItemRef_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_AssemblyItemId.hxx>
|
||||
|
||||
class Standard_GUID;
|
||||
class TDF_RelocationTable;
|
||||
|
||||
class XCAFDoc_AssemblyItemRef;
|
||||
DEFINE_STANDARD_HANDLE(XCAFDoc_AssemblyItemRef, TDF_Attribute)
|
||||
|
||||
class XCAFDoc_AssemblyItemRef : public TDF_Attribute
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDoc_AssemblyItemRef, TDF_Attribute);
|
||||
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel);
|
||||
|
||||
Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Get(const TDF_Label& theLabel);
|
||||
|
||||
Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Set(const TDF_Label& theLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId);
|
||||
|
||||
Standard_EXPORT XCAFDoc_AssemblyItemRef();
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsOrphan() const;
|
||||
|
||||
Standard_EXPORT const XCAFDoc_AssemblyItemId& Get() const;
|
||||
|
||||
Standard_EXPORT void Set(const XCAFDoc_AssemblyItemId& theItemId);
|
||||
Standard_EXPORT void Set(const TColStd_ListOfAsciiString& thePath);
|
||||
Standard_EXPORT void Set(const TCollection_AsciiString& theString);
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
|
||||
XCAFDoc_AssemblyItemId myItemId;
|
||||
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_AssemblyItemRef_HeaderFile
|
@ -22,7 +22,8 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_Note, TDF_Attribute)
|
||||
|
||||
Standard_Boolean XCAFDoc_Note::IsMine(const TDF_Label& theLabel)
|
||||
Standard_Boolean
|
||||
XCAFDoc_Note::IsMine(const TDF_Label& theLabel)
|
||||
{
|
||||
return !Get(theLabel).IsNull();
|
||||
}
|
||||
@ -31,17 +32,20 @@ XCAFDoc_Note::XCAFDoc_Note()
|
||||
{
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note) XCAFDoc_Note::Get(const TDF_Label& theLabel)
|
||||
Handle(XCAFDoc_Note)
|
||||
XCAFDoc_Note::Get(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote;
|
||||
if (theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), aNote) ||
|
||||
theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), aNote))
|
||||
if (!theLabel.IsNull() &&
|
||||
(theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), aNote) ||
|
||||
theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), aNote)))
|
||||
return aNote;
|
||||
return aNote;
|
||||
}
|
||||
|
||||
void XCAFDoc_Note::Set(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp)
|
||||
void
|
||||
XCAFDoc_Note::Set(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp)
|
||||
{
|
||||
Backup();
|
||||
|
||||
@ -49,100 +53,42 @@ void XCAFDoc_Note::Set(const TCollection_ExtendedString& theUserName,
|
||||
myTimeStamp = theTimeStamp;
|
||||
}
|
||||
|
||||
const TCollection_ExtendedString& XCAFDoc_Note::UserName() const
|
||||
const TCollection_ExtendedString&
|
||||
XCAFDoc_Note::UserName() const
|
||||
{
|
||||
return myUserName;
|
||||
}
|
||||
|
||||
const TCollection_ExtendedString& XCAFDoc_Note::TimeStamp() const
|
||||
const TCollection_ExtendedString&
|
||||
XCAFDoc_Note::TimeStamp() const
|
||||
{
|
||||
return myTimeStamp;
|
||||
}
|
||||
|
||||
Standard_Boolean XCAFDoc_Note::IsAttached() const
|
||||
Standard_Boolean
|
||||
XCAFDoc_Note::IsOrphan() const
|
||||
{
|
||||
if (!IsMine(Label()))
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aFather;
|
||||
return Label().FindAttribute(XCAFDoc::NoteRefGUID(), aFather) &&
|
||||
(aFather->NbChildren() > 0);
|
||||
return !Label().FindAttribute(XCAFDoc::NoteRefGUID(), aFather) ||
|
||||
(aFather->NbChildren() == 0);
|
||||
}
|
||||
|
||||
void XCAFDoc_Note::Attach(const TDF_LabelSequence& theLabels)
|
||||
{
|
||||
if (!IsMine(Label()) || theLabels.Length() == 0)
|
||||
return;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aFather = XCAFDoc_GraphNode::Set(Label(), XCAFDoc::NoteRefGUID());
|
||||
|
||||
for (Standard_Integer i = theLabels.Lower(); i <= theLabels.Upper(); i++)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aChild = XCAFDoc_GraphNode::Set(theLabels.Value(i), XCAFDoc::NoteRefGUID());
|
||||
aChild->SetFather(aFather);
|
||||
aFather->SetChild(aChild);
|
||||
}
|
||||
}
|
||||
|
||||
void XCAFDoc_Note::Detach(const TDF_LabelSequence& theLabels)
|
||||
{
|
||||
if (!IsMine(Label()) || theLabels.Length() == 0)
|
||||
return;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aFather;
|
||||
if (Label().FindAttribute(XCAFDoc::NoteRefGUID(), aFather))
|
||||
{
|
||||
for (Standard_Integer i = theLabels.Lower(); i <= theLabels.Upper(); i++)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
if (theLabels.Value(i).FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
{
|
||||
Standard_Integer iFather = aChild->FatherIndex(aFather);
|
||||
if (iFather > 0)
|
||||
aChild->UnSetFather(iFather);
|
||||
if (aChild->NbFathers() == 0)
|
||||
theLabels.Value(i).ForgetAttribute(aChild);
|
||||
}
|
||||
}
|
||||
if (aFather->NbChildren() == 0)
|
||||
Label().ForgetAttribute(aFather);
|
||||
}
|
||||
}
|
||||
|
||||
void XCAFDoc_Note::DetachAll()
|
||||
{
|
||||
if (!IsMine(Label()))
|
||||
return;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aFather;
|
||||
if (Label().FindAttribute(XCAFDoc::NoteRefGUID(), aFather))
|
||||
{
|
||||
Standard_Integer nbChildren = aFather->NbChildren();
|
||||
for (Standard_Integer iChild = 1; iChild <= nbChildren; ++iChild)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aChild = aFather->GetChild(iChild);
|
||||
aFather->UnSetChild(iChild);
|
||||
if (aChild->NbFathers() == 0)
|
||||
aChild->Label().ForgetAttribute(aChild);
|
||||
}
|
||||
if (aFather->NbChildren() == 0)
|
||||
Label().ForgetAttribute(aFather);
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
const Handle(TDF_RelocationTable)& /*theRT*/) const
|
||||
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
|
||||
Standard_OStream&
|
||||
XCAFDoc_Note::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
theOS
|
||||
<< "Note : "
|
||||
|
@ -46,12 +46,7 @@ public:
|
||||
|
||||
Standard_EXPORT const TCollection_ExtendedString& TimeStamp() const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsAttached() const;
|
||||
|
||||
Standard_EXPORT void Attach(const TDF_LabelSequence& theLabels);
|
||||
|
||||
Standard_EXPORT void Detach(const TDF_LabelSequence& theLabels);
|
||||
Standard_EXPORT void DetachAll();
|
||||
Standard_EXPORT Standard_Boolean IsOrphan() const;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -14,8 +14,10 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Standard_GUID.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <TDF_LabelSequence.hxx>
|
||||
#include <XCAFDoc.hxx>
|
||||
@ -23,19 +25,28 @@
|
||||
#include <XCAFDoc_NotesTool.hxx>
|
||||
#include <XCAFDoc_NoteComment.hxx>
|
||||
#include <XCAFDoc_NoteBinData.hxx>
|
||||
#include <XCAFDoc_AssemblyItemRef.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NotesTool, TDF_Attribute)
|
||||
|
||||
const Standard_GUID& XCAFDoc_NotesTool::GetID()
|
||||
enum NotesTool_RootLabels
|
||||
{
|
||||
NotesTool_NotesRoot = 1,
|
||||
NotesTool_AnnotatedItemsRoot
|
||||
};
|
||||
|
||||
const Standard_GUID&
|
||||
XCAFDoc_NotesTool::GetID()
|
||||
{
|
||||
static Standard_GUID s_ID("8F8174B1-6125-47a0-B357-61BD2D89380C");
|
||||
return s_ID;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NotesTool) XCAFDoc_NotesTool::Set(const TDF_Label& theLabel)
|
||||
Handle(XCAFDoc_NotesTool)
|
||||
XCAFDoc_NotesTool::Set(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_NotesTool) aTool;
|
||||
if (!theLabel.FindAttribute(XCAFDoc_NotesTool::GetID(), aTool))
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_NotesTool::GetID(), aTool))
|
||||
{
|
||||
aTool = new XCAFDoc_NotesTool();
|
||||
theLabel.AddAttribute(aTool);
|
||||
@ -47,174 +58,368 @@ XCAFDoc_NotesTool::XCAFDoc_NotesTool()
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Integer XCAFDoc_NotesTool::NbNotes() const
|
||||
TDF_Label
|
||||
XCAFDoc_NotesTool::GetNotesLabel() const
|
||||
{
|
||||
return Label().FindChild(NotesTool_NotesRoot);
|
||||
}
|
||||
|
||||
TDF_Label XCAFDoc_NotesTool::GetAnnotatedItemsLabel() const
|
||||
{
|
||||
return Label().FindChild(NotesTool_AnnotatedItemsRoot);
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::NbNotes() const
|
||||
{
|
||||
Standard_Integer nbNotes = 0;
|
||||
for (TDF_ChildIterator anIter(Label()); anIter.More(); anIter.Next())
|
||||
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
if (XCAFDoc_Note::IsMine(aLabel))
|
||||
{
|
||||
++nbNotes;
|
||||
}
|
||||
}
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
void XCAFDoc_NotesTool::GetNotes(TDF_LabelSequence& theNoteLabels) const
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::NbAnnotatedItems() const
|
||||
{
|
||||
theNoteLabels.Clear();
|
||||
for (TDF_ChildIterator anIter(Label()); anIter.More(); anIter.Next())
|
||||
Standard_Integer nbItems = 0;
|
||||
for (TDF_ChildIterator anIter(GetAnnotatedItemsLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
if (XCAFDoc_AssemblyItemRef::IsMine(aLabel))
|
||||
++nbItems;
|
||||
}
|
||||
return nbItems;
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_NotesTool::GetNotes(TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
if (XCAFDoc_Note::IsMine(aLabel))
|
||||
{
|
||||
theNoteLabels.Append(aLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_NotesTool::GetAnnotatedItems(TDF_LabelSequence& theItemLabels) const
|
||||
{
|
||||
for (TDF_ChildIterator anIter(GetAnnotatedItemsLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
if (XCAFDoc_AssemblyItemRef::IsMine(aLabel))
|
||||
theItemLabels.Append(aLabel);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::IsAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const
|
||||
{
|
||||
return !FindAnnotatedItem(theItemId).IsNull();
|
||||
}
|
||||
|
||||
TDF_Label
|
||||
XCAFDoc_NotesTool::FindAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const
|
||||
{
|
||||
for (TDF_ChildIterator anIter(GetAnnotatedItemsLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
Handle(XCAFDoc_AssemblyItemRef) anItemRef = XCAFDoc_AssemblyItemRef::Get(aLabel);
|
||||
if (!anItemRef.IsNull() && anItemRef->Get().IsEqual(theItemId))
|
||||
return aLabel;
|
||||
}
|
||||
return TDF_Label();
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note)
|
||||
XCAFDoc_NotesTool::AddComment(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment)
|
||||
XCAFDoc_NotesTool::CreateComment(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment)
|
||||
{
|
||||
TDF_Label aNoteLabel;
|
||||
TDF_TagSource aTag;
|
||||
aNoteLabel = aTag.NewChild(Label());
|
||||
aNoteLabel = aTag.NewChild(GetNotesLabel());
|
||||
return XCAFDoc_NoteComment::Set(aNoteLabel, theUserName, theTimeStamp, theComment);
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note)
|
||||
XCAFDoc_NotesTool::AddBinData(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile)
|
||||
XCAFDoc_NotesTool::CreateBinData(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile)
|
||||
{
|
||||
TDF_Label aNoteLabel;
|
||||
TDF_TagSource aTag;
|
||||
aNoteLabel = aTag.NewChild(Label());
|
||||
aNoteLabel = aTag.NewChild(GetNotesLabel());
|
||||
return XCAFDoc_NoteBinData::Set(aNoteLabel, theUserName, theTimeStamp, theTitle, theMIMEtype, theFile);
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note)
|
||||
XCAFDoc_NotesTool::AddBinData(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData)
|
||||
XCAFDoc_NotesTool::CreateBinData(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData)
|
||||
{
|
||||
TDF_Label aNoteLabel;
|
||||
TDF_TagSource aTag;
|
||||
aNoteLabel = aTag.NewChild(Label());
|
||||
aNoteLabel = aTag.NewChild(GetNotesLabel());
|
||||
return XCAFDoc_NoteBinData::Set(aNoteLabel, theUserName, theTimeStamp, theTitle, theMIMEtype, theData);
|
||||
}
|
||||
|
||||
Standard_Boolean XCAFDoc_NotesTool::HasAttachedNotes(const TDF_Label& theLabel) const
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::GetNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItem(theItemId);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
return 0;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
return !theLabel.IsNull() &&
|
||||
theLabel.FindAttribute(XCAFDoc::NoteRefGUID(), aChild) &&
|
||||
(aChild->NbFathers() > 0);
|
||||
if (!anAnnotatedItem.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
return 0;
|
||||
|
||||
Standard_Integer nbFathers = aChild->NbFathers();
|
||||
for (Standard_Integer iFather = 1; iFather <= nbFathers; ++iFather)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aFather = aChild->GetFather(iFather);
|
||||
theNoteLabels.Append(aFather->Label());
|
||||
}
|
||||
|
||||
return theNoteLabels.Length();
|
||||
}
|
||||
|
||||
void XCAFDoc_NotesTool::GetAttachedNotes(const TDF_Label& theLabel,
|
||||
TDF_LabelSequence& theNoteLabels) const
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_NotesTool::AddNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId)
|
||||
{
|
||||
theNoteLabels.Clear();
|
||||
Handle(XCAFDoc_AssemblyItemRef) anItemRef;
|
||||
|
||||
if (!XCAFDoc_Note::IsMine(theNoteLabel))
|
||||
return anItemRef;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
if (!theLabel.IsNull() && theLabel.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItem(theItemId);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
{
|
||||
Standard_Integer nbNotes = aChild->NbFathers();
|
||||
for (Standard_Integer iNote = 1; iNote <= nbNotes; ++iNote)
|
||||
TDF_TagSource aTag;
|
||||
anAnnotatedItem = aTag.NewChild(GetAnnotatedItemsLabel());
|
||||
if (!anAnnotatedItem.IsNull())
|
||||
return anItemRef;
|
||||
}
|
||||
|
||||
if (!anAnnotatedItem.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
{
|
||||
aChild = XCAFDoc_GraphNode::Set(anAnnotatedItem, XCAFDoc::NoteRefGUID());
|
||||
if (aChild.IsNull())
|
||||
return anItemRef;
|
||||
}
|
||||
|
||||
if (!anAnnotatedItem.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), anItemRef))
|
||||
{
|
||||
anItemRef = XCAFDoc_AssemblyItemRef::Set(anAnnotatedItem, theItemId);
|
||||
if (anItemRef.IsNull())
|
||||
return anItemRef;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aFather;
|
||||
if (!theNoteLabel.FindAttribute(XCAFDoc::NoteRefGUID(), aFather))
|
||||
{
|
||||
aFather = XCAFDoc_GraphNode::Set(theNoteLabel, XCAFDoc::NoteRefGUID());
|
||||
if (aFather.IsNull())
|
||||
return anItemRef;
|
||||
}
|
||||
|
||||
aFather->SetChild(aChild);
|
||||
|
||||
return anItemRef;
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::RemoveNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Boolean theDelIfOrphan)
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(theNoteLabel);
|
||||
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aFather;
|
||||
if (!theNoteLabel.FindAttribute(XCAFDoc::NoteRefGUID(), aFather))
|
||||
return Standard_False;
|
||||
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItem(theItemId);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
if (!anAnnotatedItem.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
return Standard_False;
|
||||
|
||||
aChild->UnSetFather(aFather);
|
||||
if (aChild->NbFathers() == 0)
|
||||
anAnnotatedItem.ForgetAllAttributes();
|
||||
|
||||
if (theDelIfOrphan && aNote->IsOrphan())
|
||||
DeleteNote(theNoteLabel);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::RemoveAllNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Boolean theDelIfOrphan)
|
||||
{
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItem(theItemId);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
if (!anAnnotatedItem.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
return Standard_False;
|
||||
|
||||
Standard_Integer nbFathers = aChild->NbFathers();
|
||||
for (Standard_Integer iFather = 1; iFather <= nbFathers; ++iFather)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aFather = aChild->GetFather(iFather);
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(aFather->Label());
|
||||
if (!aNote.IsNull())
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aNote = aChild->GetFather(iNote);
|
||||
if (XCAFDoc_Note::IsMine(aNote->Label()))
|
||||
theNoteLabels.Append(aNote->Label());
|
||||
aFather->UnSetChild(aChild);
|
||||
if (theDelIfOrphan && aNote->IsOrphan())
|
||||
DeleteNote(aFather->Label());
|
||||
}
|
||||
}
|
||||
|
||||
anAnnotatedItem.ForgetAllAttributes();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Integer XCAFDoc_NotesTool::DetachAllNotes(const TDF_Label& theLabel) const
|
||||
{
|
||||
Standard_Integer nbNotes = 0;
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
if (!theLabel.IsNull() && theLabel.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
{
|
||||
Standard_Integer nbNotes = aChild->NbFathers();
|
||||
for (Standard_Integer iNote = 1; iNote <= nbNotes; ++iNote)
|
||||
{
|
||||
aChild->UnSetFather(iNote);
|
||||
++nbNotes;
|
||||
}
|
||||
}
|
||||
theLabel.ForgetAttribute(aChild);
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
Standard_Boolean XCAFDoc_NotesTool::RemoveNote(const TDF_Label& theNoteLabel)
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::DeleteNote(const TDF_Label& theNoteLabel)
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(theNoteLabel);
|
||||
if (!aNote.IsNull())
|
||||
{
|
||||
aNote->DetachAll();
|
||||
Handle(XCAFDoc_GraphNode) aFather;
|
||||
if (theNoteLabel.FindAttribute(XCAFDoc::NoteRefGUID(), aFather) && !aFather.IsNull())
|
||||
{
|
||||
Standard_Integer nbChildren = aFather->NbChildren();
|
||||
for (Standard_Integer iChild = 1; iChild <= nbChildren; ++iChild)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aChild = aFather->GetChild(iChild);
|
||||
aFather->UnSetChild(iChild);
|
||||
if (aChild->NbFathers() == 0)
|
||||
aChild->Label().ForgetAttribute(aChild);
|
||||
}
|
||||
}
|
||||
theNoteLabel.ForgetAllAttributes(Standard_True);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Integer XCAFDoc_NotesTool::RemoveNotes(TDF_LabelSequence& theNoteLabels)
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::DeleteNotes(TDF_LabelSequence& theNoteLabels)
|
||||
{
|
||||
Standard_Integer nbNotes = 0;
|
||||
for (TDF_LabelSequence::Iterator anIter(theNoteLabels); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (RemoveNote(anIter.Value()))
|
||||
if (DeleteNote(anIter.Value()))
|
||||
++nbNotes;
|
||||
}
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
Standard_Integer XCAFDoc_NotesTool::RemoveDetachedNotes()
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::DeleteAllNotes()
|
||||
{
|
||||
Standard_Integer nbNotes = 0;
|
||||
for (TDF_ChildIterator anIter(Label()); anIter.More(); anIter.Next())
|
||||
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(anIter.Value());
|
||||
if (!aNote.IsNull() && !aNote->IsAttached() && RemoveNote(anIter.Value()))
|
||||
if (DeleteNote(anIter.Value()))
|
||||
++nbNotes;
|
||||
}
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
Standard_Integer XCAFDoc_NotesTool::RemoveAllNotes()
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::NbOrphanNotes() const
|
||||
{
|
||||
Standard_Integer nbNotes = 0;
|
||||
for (TDF_ChildIterator anIter(Label()); anIter.More(); anIter.Next())
|
||||
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (RemoveNote(anIter.Value()))
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(aLabel);
|
||||
if (!aNote.IsNull() && aNote->IsOrphan())
|
||||
++nbNotes;
|
||||
}
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
const Standard_GUID& XCAFDoc_NotesTool::ID() const
|
||||
void
|
||||
XCAFDoc_NotesTool::GetOrphanNotes(TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(aLabel);
|
||||
if (!aNote.IsNull() && aNote->IsOrphan())
|
||||
theNoteLabels.Append(aLabel);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::DeleteOrphanNotes()
|
||||
{
|
||||
Standard_Integer nbNotes = 0;
|
||||
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(aLabel);
|
||||
if (!aNote.IsNull() && aNote->IsOrphan() && DeleteNote(aLabel))
|
||||
++nbNotes;
|
||||
}
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
const Standard_GUID&
|
||||
XCAFDoc_NotesTool::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
Handle(TDF_Attribute) XCAFDoc_NotesTool::NewEmpty() const
|
||||
Handle(TDF_Attribute)
|
||||
XCAFDoc_NotesTool::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NotesTool();
|
||||
}
|
||||
|
||||
void XCAFDoc_NotesTool::Restore(const Handle(TDF_Attribute)& /*theAttr*/)
|
||||
void
|
||||
XCAFDoc_NotesTool::Restore(const Handle(TDF_Attribute)& /*theAttr*/)
|
||||
{
|
||||
}
|
||||
|
||||
void XCAFDoc_NotesTool::Paste(const Handle(TDF_Attribute)& /*theAttrInto*/,
|
||||
const Handle(TDF_RelocationTable)& /*theRT*/) const
|
||||
void
|
||||
XCAFDoc_NotesTool::Paste(const Handle(TDF_Attribute)& /*theAttrInto*/,
|
||||
const Handle(TDF_RelocationTable)& /*theRT*/) const
|
||||
{
|
||||
}
|
||||
|
||||
Standard_OStream&
|
||||
XCAFDoc_NotesTool::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
theOS
|
||||
<< "Notes : " << NbNotes() << "\n"
|
||||
<< "Annotated items : " << NbAnnotatedItems() << "\n"
|
||||
;
|
||||
return theOS;
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ class TCollection_ExtendedString;
|
||||
class TColStd_HArray1OfByte;
|
||||
class TDF_RelocationTable;
|
||||
class XCAFDoc_Note;
|
||||
class XCAFDoc_AssemblyItemId;
|
||||
class XCAFDoc_AssemblyItemRef;
|
||||
|
||||
class XCAFDoc_NotesTool;
|
||||
DEFINE_STANDARD_HANDLE(XCAFDoc_NotesTool, TDF_Attribute)
|
||||
@ -44,36 +46,53 @@ public:
|
||||
|
||||
Standard_EXPORT XCAFDoc_NotesTool();
|
||||
|
||||
Standard_EXPORT TDF_Label GetNotesLabel() const;
|
||||
Standard_EXPORT TDF_Label GetAnnotatedItemsLabel() const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbNotes() const;
|
||||
Standard_EXPORT Standard_Integer NbAnnotatedItems() const;
|
||||
|
||||
Standard_EXPORT void GetNotes(TDF_LabelSequence& theNoteLabels) const;
|
||||
Standard_EXPORT void GetAnnotatedItems(TDF_LabelSequence& theLabels) const;
|
||||
|
||||
Standard_EXPORT Handle(XCAFDoc_Note) AddComment(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment);
|
||||
Standard_EXPORT Standard_Boolean IsAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const;
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const;
|
||||
|
||||
Standard_EXPORT Handle(XCAFDoc_Note) AddBinData(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile);
|
||||
Standard_EXPORT Handle(XCAFDoc_Note) CreateComment(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment);
|
||||
|
||||
Standard_EXPORT Handle(XCAFDoc_Note) AddBinData(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData);
|
||||
Standard_EXPORT Handle(XCAFDoc_Note) CreateBinData(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile);
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasAttachedNotes(const TDF_Label& theLabel) const;
|
||||
Standard_EXPORT Handle(XCAFDoc_Note) CreateBinData(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData);
|
||||
|
||||
Standard_EXPORT void GetAttachedNotes(const TDF_Label& theLabel,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
Standard_EXPORT Standard_Integer DetachAllNotes(const TDF_Label& theLabel) const;
|
||||
Standard_EXPORT Standard_Integer GetNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean RemoveNote(const TDF_Label& theNoteLabel);
|
||||
Standard_EXPORT Standard_Integer RemoveNotes(TDF_LabelSequence& theNoteLabels);
|
||||
Standard_EXPORT Standard_Integer RemoveDetachedNotes();
|
||||
Standard_EXPORT Standard_Integer RemoveAllNotes();
|
||||
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId);
|
||||
|
||||
Standard_EXPORT Standard_Boolean RemoveNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
Standard_EXPORT Standard_Boolean RemoveAllNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
Standard_EXPORT Standard_Boolean DeleteNote(const TDF_Label& theNoteLabel);
|
||||
Standard_EXPORT Standard_Integer DeleteNotes(TDF_LabelSequence& theNoteLabels);
|
||||
Standard_EXPORT Standard_Integer DeleteAllNotes();
|
||||
|
||||
Standard_EXPORT Standard_Integer NbOrphanNotes() const;
|
||||
Standard_EXPORT void GetOrphanNotes(TDF_LabelSequence& theNoteLabels) const;
|
||||
Standard_EXPORT Standard_Integer DeleteOrphanNotes();
|
||||
|
||||
public:
|
||||
|
||||
@ -83,6 +102,7 @@ public:
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
22
src/XCAFDoc/XCAFDoc_PartId.hxx
Normal file
22
src/XCAFDoc/XCAFDoc_PartId.hxx
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-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_PartId_HeaderFile
|
||||
#define _XCAFDoc_PartId_HeaderFile
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
typedef TCollection_AsciiString XCAFDoc_PartId;
|
||||
|
||||
#endif // _XCAFDoc_PartId_HeaderFile
|
@ -1,5 +1,7 @@
|
||||
XmlMXCAFDoc.cxx
|
||||
XmlMXCAFDoc.hxx
|
||||
XmlMXCAFDoc_AssemblyAtemRefDriver.cxx
|
||||
XmlMXCAFDoc_AssemblyAtemRefDriver.hxx
|
||||
XmlMXCAFDoc_AreaDriver.cxx
|
||||
XmlMXCAFDoc_AreaDriver.hxx
|
||||
XmlMXCAFDoc_CentroidDriver.cxx
|
||||
|
80
src/XmlMXCAFDoc/XmlMXCAFDoc_AssemblyAtemRefDriver.cxx
Normal file
80
src/XmlMXCAFDoc/XmlMXCAFDoc_AssemblyAtemRefDriver.cxx
Normal file
@ -0,0 +1,80 @@
|
||||
// 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_AssemblyAtemRefDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_AssemblyItemRefDriver, XmlMDF_ADriver)
|
||||
IMPLEMENT_DOMSTRING(Path, "path")
|
||||
|
||||
//=======================================================================
|
||||
//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->Set(aPath.GetString());
|
||||
|
||||
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->Get().ToString().ToCString());
|
||||
|
||||
theTarget.Element().setAttribute(::Path(), aPath);
|
||||
}
|
55
src/XmlMXCAFDoc/XmlMXCAFDoc_AssemblyAtemRefDriver.hxx
Normal file
55
src/XmlMXCAFDoc/XmlMXCAFDoc_AssemblyAtemRefDriver.hxx
Normal 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
|
Loading…
x
Reference in New Issue
Block a user