mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
XCAF: assembly item ref extended to point on attributes and sub-shape indices
This commit is contained in:
parent
6277a5996c
commit
e3f977d899
@ -246,6 +246,48 @@ XCAFDoc_AssemblyItemRef::ClearExtraRef()
|
|||||||
myExtraId.Clear();
|
myExtraId.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
XCAFDoc_AssemblyItemRef::SetItem(const TColStd_ListOfAsciiString& thePath)
|
||||||
|
{
|
||||||
|
Backup();
|
||||||
|
myItemId.Init(thePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
XCAFDoc_AssemblyItemRef::SetItem(const TCollection_AsciiString& theString)
|
||||||
|
{
|
||||||
|
Backup();
|
||||||
|
myItemId.Init(theString);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XCAFDoc_AssemblyItemRef::SetGUID(const Standard_GUID& theAttrGUID)
|
||||||
|
{
|
||||||
|
Backup();
|
||||||
|
myExtraRef = ExtraRef_AttrGUID;
|
||||||
|
Standard_Character aGUIDStr[Standard_GUID_SIZE + 1];
|
||||||
|
theAttrGUID.ToCString(aGUIDStr);
|
||||||
|
aGUIDStr[Standard_GUID_SIZE] = '\0';
|
||||||
|
myExtraId.Clear();
|
||||||
|
myExtraId.AssignCat(aGUIDStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
XCAFDoc_AssemblyItemRef::SetSubshapeIndex(Standard_Integer theSubshapeIndex)
|
||||||
|
{
|
||||||
|
Backup();
|
||||||
|
myExtraRef = ExtraRef_SubshapeIndex;
|
||||||
|
myExtraId.Clear();
|
||||||
|
myExtraId.AssignCat(theSubshapeIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
XCAFDoc_AssemblyItemRef::ClearExtraRef()
|
||||||
|
{
|
||||||
|
Backup();
|
||||||
|
myExtraRef = ExtraRef_None;
|
||||||
|
myExtraId.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
const Standard_GUID&
|
const Standard_GUID&
|
||||||
XCAFDoc_AssemblyItemRef::ID() const
|
XCAFDoc_AssemblyItemRef::ID() const
|
||||||
{
|
{
|
||||||
|
@ -289,6 +289,12 @@ public:
|
|||||||
//! \return a handle to the assembly reference attribute.
|
//! \return a handle to the assembly reference attribute.
|
||||||
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNote(const TDF_Label& theNoteLabel,
|
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNote(const TDF_Label& theNoteLabel,
|
||||||
const XCAFDoc_AssemblyItemId& theItemId);
|
const XCAFDoc_AssemblyItemId& theItemId);
|
||||||
|
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNoteToAttr(const TDF_Label& theNoteLabel,
|
||||||
|
const XCAFDoc_AssemblyItemId& theItemId,
|
||||||
|
const Standard_GUID& theGUID);
|
||||||
|
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNoteToSubshape(const TDF_Label& theNoteLabel,
|
||||||
|
const XCAFDoc_AssemblyItemId& theItemId,
|
||||||
|
Standard_Integer theSubshapeIndex);
|
||||||
|
|
||||||
//! Adds the given note to the labeled item.
|
//! Adds the given note to the labeled item.
|
||||||
//! \param [in] theNoteLabel - note label.
|
//! \param [in] theNoteLabel - note label.
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_AssemblyItemRefDriver, XmlMDF_ADriver)
|
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_AssemblyItemRefDriver, XmlMDF_ADriver)
|
||||||
IMPLEMENT_DOMSTRING(Path, "path")
|
IMPLEMENT_DOMSTRING(Path, "path")
|
||||||
|
IMPLEMENT_DOMSTRING(AttrGUID, "guid")
|
||||||
|
IMPLEMENT_DOMSTRING(SubshapeIndex, "subshape_index")
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function :
|
//function :
|
||||||
@ -59,7 +61,26 @@ Standard_Boolean XmlMXCAFDoc_AssemblyItemRefDriver::Paste(const XmlObjMgt_Persis
|
|||||||
if (aThis.IsNull())
|
if (aThis.IsNull())
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
aThis->Set(aPath.GetString());
|
aThis->SetItem(aPath.GetString());
|
||||||
|
|
||||||
|
XmlObjMgt_DOMString anAttrGUID = anElement.getAttribute(::AttrGUID());
|
||||||
|
if (anAttrGUID != NULL)
|
||||||
|
{
|
||||||
|
Standard_GUID aGUID(anAttrGUID.GetString());
|
||||||
|
aThis->SetGUID(aGUID);
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlObjMgt_DOMString aSubshapeIndex = anElement.getAttribute(::SubshapeIndex());
|
||||||
|
if (aSubshapeIndex != NULL)
|
||||||
|
{
|
||||||
|
Standard_Integer anIndex;
|
||||||
|
if (!aSubshapeIndex.GetInteger(anIndex))
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
aThis->SetSubshapeIndex(anIndex);
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
@ -74,7 +95,23 @@ void XmlMXCAFDoc_AssemblyItemRefDriver::Paste(const Handle(TDF_Attribute)& theSo
|
|||||||
{
|
{
|
||||||
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theSource);
|
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theSource);
|
||||||
|
|
||||||
XmlObjMgt_DOMString aPath(aThis->Get().ToString().ToCString());
|
XmlObjMgt_DOMString aPath(aThis->GetItem().ToString().ToCString());
|
||||||
|
|
||||||
theTarget.Element().setAttribute(::Path(), aPath);
|
theTarget.Element().setAttribute(::Path(), aPath);
|
||||||
|
|
||||||
|
if (aThis->IsGUID())
|
||||||
|
{
|
||||||
|
Standard_GUID aGUID = aThis->GetGUID();
|
||||||
|
Standard_Character aGUIDStr[Standard_GUID_SIZE + 1];
|
||||||
|
aGUID.ToCString(aGUIDStr);
|
||||||
|
aGUIDStr[Standard_GUID_SIZE] = '\0';
|
||||||
|
XmlObjMgt_DOMString anAttrGUID(aGUIDStr);
|
||||||
|
theTarget.Element().setAttribute(::AttrGUID(), anAttrGUID);
|
||||||
|
}
|
||||||
|
else if (aThis->IsSubshapeIndex())
|
||||||
|
{
|
||||||
|
TCollection_AsciiString aSubshapeIndexStr(aThis->GetSubshapeIndex());
|
||||||
|
XmlObjMgt_DOMString aSubshapeIndex(aSubshapeIndexStr.ToCString());
|
||||||
|
theTarget.Element().setAttribute(::SubshapeIndex(), aSubshapeIndex);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user