mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-02 17:46:22 +03:00
0028985: XCAF data structures for generic text annotations linked to GD&T annotations and saved views
1. A tool to annotate items in the hierarchical product structure was added. The tool is located under fixed label 0:1:9. It operates two basic entities: notes and annotations located under 0:1:9:1 and 0:1:9:2 hives correspondingly. A note is an attribute derived from base class XCAFDoc_Note that is attached to a separate label under the notes hive. An annotated item is represented by XCAFDoc_AssemblyItemRef attribute attached to a separate label under the annotated items hive. Notes are linked to annotated items by means of XCAFDoc_GraphNode attribute, where notes play parent roles and annotated items - child roles. 2. XCAFDoc_AssemblyItemRef defines a weak reference to a label with optional attribute GUID or sub-shape index. 3. A capability to store note/annotation labels in XCAFDoc_ViewTool was added. 4. XDE User guide was updated
This commit is contained in:
parent
80070d4915
commit
024d6f7775
BIN
dox/user_guides/xde/images/xde_notes001.png
Normal file
BIN
dox/user_guides/xde/images/xde_notes001.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
@ -91,6 +91,26 @@ XDE can read and write colors and layers assigned to shapes or their subparts (d
|
||||
|
||||
@figure{/user_guides/xde/images/xde_image006.png,"Colors and Layers",240}
|
||||
|
||||
@subsection occt_xde_1_7 Custom notes
|
||||
|
||||
Custom notes is a kind of application specific data attached to assembly items, their attributes and sub-shapes. Basically, there are simple textual comments, binary data and other application specific data. Each note is provided with a timestamp and the user created it.
|
||||
|
||||
Notes API provides the following functionality:
|
||||
* Returns total number of notes and annotated items
|
||||
* Returns labels for all notes and annotated items
|
||||
* Creates notes:
|
||||
- Comment note from a text string
|
||||
- Binary data note from a file or byte array
|
||||
* Checks if an assembly item is annotated
|
||||
* Finds a label for the annotated item
|
||||
* Returns all note labels for the annotated item
|
||||
* Add a note to item(s):
|
||||
- Assembly item
|
||||
- Assembly item attribute
|
||||
- Assembly item subshape index
|
||||
* Remove note(s) from an annotated assembly item; orphan note(s) might be deleted optionally (items without linked notes will be deleted automatically)
|
||||
* Delete note(s) and removes them from annotated items
|
||||
* Get / delete orphan notes
|
||||
|
||||
@section occt_xde_2 Working with XDE
|
||||
|
||||
@ -607,6 +627,136 @@ To remove a Color and all the references to it (so that the related shapes will
|
||||
myColors->RemoveColor(ColLabel);
|
||||
~~~~~
|
||||
|
||||
@subsection occt_xde_2_7 Custom notes
|
||||
|
||||
In an XDE document, custom notes are managed by the class *XCAFDoc_NotesTool*. This is done with the same principles as for ShapeTool with Shapes, and with the same capability of having a tool on the Main Label, or on any sub-label. The Property itself is defined as sub-classes of an *XCAFDoc_Note* abstract class, which is a sub-class of *TDF_Attribute* one.
|
||||
|
||||
Custom notes are stored in a child of the *XCAFDoc_NotesTool* label: it is at label 0.1.9.1. Each note then corresponds to a dedicated label. A note may be attached to a document item identified by a label, a sub-shape identified by integer index or an attribute identified by GUID. Annotations are stored in a child of the *XCAFDoc_NotesTool* label: it is at label 0.1.9.2.
|
||||
Notes binding is done through *XCAFDoc_GraphNode* attribute.
|
||||
|
||||
@figure{/user_guides/xde/images/xde_notes001.png,"Structure of notes part of XCAF document",240}
|
||||
|
||||
@subsubsection occt_xde_2_7_1 Initialization
|
||||
|
||||
To query, edit, or initialize a Document to handle custom notes of XCAF, use:
|
||||
~~~~~
|
||||
Handle(XCAFDoc_NotesTool) myNotes =
|
||||
XCAFDoc_DocumentTool::NotesTool(Doc->Main ());
|
||||
~~~~~
|
||||
This call can be used at any time. The first time it is used, a relevant structure is added to the document. This definition is used for all the following notes calls and will not be repeated for these.
|
||||
|
||||
@subsubsection occt_xde_2_7_2 Creating Notes
|
||||
|
||||
Before annotating a Document item a note must be created using one of the following methods of *XCAFDoc_NotesTool* class:
|
||||
- CreateComment : creates a note with a textual comment
|
||||
- CreateBinData : creates a note with arbitrary binary data, e.g. contents of a file
|
||||
|
||||
Both methods return an instance of *XCAFDoc_Note* class.
|
||||
~~~~~
|
||||
Handle(XCAFDoc_NotesTool) myNotes = ...
|
||||
Handle(XCAFDoc_Note) myNote = myNotes->CreateComment("User", "Timestamp", "Hello, World!");
|
||||
~~~~~
|
||||
This code adds a child label to label 0.1.9.1 with *XCAFDoc_NoteComment* attribute.
|
||||
|
||||
@subsubsection occt_xde_2_7_3 Editing a Note
|
||||
An instance of *XCAFDoc_Note* class can be used for note editing.
|
||||
One may change common note data.
|
||||
~~~~~
|
||||
myNote->Set("New User", "New Timestamp");
|
||||
~~~~~
|
||||
To change specific data one need to down cast *myNote* handle to the appropriate sub-class:
|
||||
~~~~~
|
||||
Handle(XCAFDoc_NoteComment) myCommentNote = Handle(XCAFDoc_NoteComment)::DownCast(myNote);
|
||||
if (!myCommentNote.IsNull()) {
|
||||
myCommentNote->Set("New comment");
|
||||
}
|
||||
~~~~~
|
||||
|
||||
@subsubsection occt_xde_2_7_4 Adding Notes
|
||||
|
||||
Once a note has been created it can be bound to a Document item using the following *XCAFDoc_NotesTool* methods:
|
||||
- AddNote : binds a note to a label
|
||||
- AddNoteToAttr : binds a note to a label's attribute
|
||||
- AddNoteToSubshape : binds a note to a sub-shape
|
||||
|
||||
All methods return a pointer to *XCAFDoc_AssemblyItemRef* attribute identifying the annotated item.
|
||||
~~~~~
|
||||
Handle(XCAFDoc_NotesTool) myNotes = ...
|
||||
Handle(XCAFDoc_Note) myNote = ...
|
||||
TDF_Label theLabel; ...
|
||||
Handle(XCAFDoc_AssemblyItemRef) myRef = myNotes->AddNote(myNote->Label(), theLabel);
|
||||
Standard_GUID theAttrGUID; ...
|
||||
Handle(XCAFDoc_AssemblyItemRef) myRefAttr = myNotes->AddNoteToAttr(myNote->Label(), theAttrGUID);
|
||||
Standard_Integer theSubshape = 1;
|
||||
Handle(XCAFDoc_AssemblyItemRef) myRefSubshape = myNotes->AddNoteToSubshape(myNote->Label(), theSubshape);
|
||||
~~~~~
|
||||
This code adds three child labels to label 0.1.9.2 with *XCAFDoc_AssemblyItemRef* attribute with *XCAFDoc_GraphNode* attributes added to this and note labels.
|
||||
|
||||
@subsubsection occt_xde_2_7_5 Finding Notes
|
||||
|
||||
To find annotation labels under label 0.1.9.2 use the following *XCAFDoc_NotesTool* methods:
|
||||
- FindAnnotatedItem : returns an annotation label for a label
|
||||
- FindAnnotatedItemAttr : returns an annotation label for a label's attribute
|
||||
- FindAnnotatedItemSubshape : returns an annotation label for a sub-shape
|
||||
|
||||
~~~~~
|
||||
Handle(XCAFDoc_NotesTool) myNotes = ...
|
||||
TDF_Label theLabel; ...
|
||||
TDF_Label myLabel = myNotes->FindAnnotatedItem(theLabel);
|
||||
Standard_GUID theAttrGUID; ...
|
||||
TDF_Label myLabelAttr = myNotes->FindAnnotatedItemAttr(theLabel, theAttrGUID);
|
||||
Standard_Integer theSubshape = 1;
|
||||
TDF_Label myLabelSubshape = myNotes->FindAnnotatedItemSubshape(theLabel, theSubshape);
|
||||
~~~~~
|
||||
Null label will be returned if there is no corresponding annotation.
|
||||
|
||||
To get all notes of the Document item use the following *XCAFDoc_NotesTool* methods:
|
||||
- GetNotes : outputs a sequence of note labels bound to a label
|
||||
- GetAttrNotes : outputs a sequence of note labels bound to a label's attribute
|
||||
- GetAttrSubshape : outputs a sequence of note labels bound to a sub-shape
|
||||
|
||||
All these methods return the number of notes.
|
||||
~~~~~
|
||||
Handle(XCAFDoc_NotesTool) myNotes = ...
|
||||
TDF_Label theLabel; ...
|
||||
TDF_LabelSequence theNotes;
|
||||
myNotes->GetNotes(theLabel, theNotes);
|
||||
Standard_GUID theAttrGUID; ...
|
||||
TDF_LabelSequence theNotesAttr;
|
||||
myNotes->GetAttrNotes(theLabel, theAttrGUID, theNotesAttr);
|
||||
Standard_Integer theSubshape = 1;
|
||||
TDF_LabelSequence theNotesSubshape;
|
||||
myNotes->GetAttrSubshape(theLabel, theSubshape, theNotesSubshape);
|
||||
~~~~~
|
||||
|
||||
@subsubsection occt_xde_2_7_6 Removing Notes
|
||||
|
||||
To remove a note use one of the following *XCAFDoc_NotesTool* methods:
|
||||
- RemoveNote : unbinds a note from a label
|
||||
- RemoveAttrNote : unbinds a note from a label's attribute
|
||||
- RemoveSubshapeNote : unbinds a note from a sub-shape
|
||||
|
||||
~~~~~
|
||||
Handle(XCAFDoc_Note) myNote = ...
|
||||
TDF_Label theLabel; ...
|
||||
myNotes->RemoveNote(myNote->Label(), theLabel);
|
||||
Standard_GUID theAttrGUID; ...
|
||||
myRefAttr = myNotes->RemoveAttrNote(myNote->Label(), theAttrGUID);
|
||||
Standard_Integer theSubshape = 1;
|
||||
myNotes->RemoveSubshapeNote(myNote->Label(), theSubshape);
|
||||
~~~~~
|
||||
A note will not be deleted automatically.
|
||||
Counterpart methods to remove all notes are available too.
|
||||
|
||||
@subsubsection occt_xde_2_7_7 Deleting Notes
|
||||
|
||||
To delete note(s) use the following *XCAFDoc_NotesTool* methods:
|
||||
- DeleteNote : deletes a single note
|
||||
- DeleteNotes : deletes a sequence of notes
|
||||
- DeleteAllNotes : deletes all Document notes
|
||||
- DeleteOrphanNotes : deletes notes not bound to Document items
|
||||
|
||||
All these methods excepting the last one break all links with Document items as well.
|
||||
|
||||
@subsection occt_xde_2_8 Reading and Writing STEP or IGES
|
||||
Note that saving and restoring the document itself are standard OCAF operations. As the various previously described definitions enter into this frame, they will not be explained any further.
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <BinMDF_ADriverTable.hxx>
|
||||
#include <BinMNaming_NamedShapeDriver.hxx>
|
||||
#include <BinMXCAFDoc.hxx>
|
||||
#include <BinMXCAFDoc_AssemblyItemRefDriver.hxx>
|
||||
#include <BinMXCAFDoc_AreaDriver.hxx>
|
||||
#include <BinMXCAFDoc_CentroidDriver.hxx>
|
||||
#include <BinMXCAFDoc_ColorDriver.hxx>
|
||||
@ -32,6 +33,11 @@
|
||||
#include <BinMXCAFDoc_LocationDriver.hxx>
|
||||
#include <BinMXCAFDoc_MaterialDriver.hxx>
|
||||
#include <BinMXCAFDoc_MaterialToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteBalloonDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteBinDataDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <BinMXCAFDoc_NotesToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_ShapeToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_ViewDriver.hxx>
|
||||
#include <BinMXCAFDoc_ViewToolDriver.hxx>
|
||||
@ -44,7 +50,8 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
const Handle(CDM_MessageDriver)& theMsgDrv) {
|
||||
const Handle(CDM_MessageDriver)& theMsgDrv)
|
||||
{
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_AreaDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_CentroidDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ColorDriver (theMsgDrv));
|
||||
@ -63,13 +70,17 @@ void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
}
|
||||
|
||||
theDriverTable->AddDriver( aLocationDriver);
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_VolumeDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DatumDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_AssemblyItemRefDriver(theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_VolumeDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DatumDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_GeomToleranceDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimensionDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ViewDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimensionDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteBalloonDriver (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));
|
||||
@ -77,5 +88,6 @@ void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ShapeToolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimTolToolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_MaterialToolDriver(theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NotesToolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ViewToolDriver (theMsgDrv));
|
||||
}
|
||||
|
111
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx
Normal file
111
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx
Normal file
@ -0,0 +1,111 @@
|
||||
// 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 aPathStr;
|
||||
if (!(theSource >> aPathStr))
|
||||
return Standard_False;
|
||||
|
||||
aThis->SetItem(aPathStr);
|
||||
|
||||
Standard_Integer anExtraRef = 0;
|
||||
if (!(theSource >> anExtraRef))
|
||||
return Standard_False;
|
||||
|
||||
if (anExtraRef == 1)
|
||||
{
|
||||
Standard_GUID aGUID;
|
||||
if (!(theSource >> aGUID))
|
||||
return Standard_False;
|
||||
|
||||
aThis->SetGUID(aGUID);
|
||||
}
|
||||
else if (anExtraRef == 2)
|
||||
{
|
||||
Standard_Integer aSubshapeIndex;
|
||||
if (!(theSource >> aSubshapeIndex))
|
||||
return Standard_False;
|
||||
|
||||
aThis->SetSubshapeIndex(aSubshapeIndex);
|
||||
}
|
||||
|
||||
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->GetItem().ToString();
|
||||
if (aThis->IsGUID())
|
||||
{
|
||||
theTarget << Standard_Integer(1);
|
||||
theTarget << aThis->GetGUID();
|
||||
}
|
||||
else if (aThis->IsSubshapeIndex())
|
||||
{
|
||||
theTarget << Standard_Integer(2);
|
||||
theTarget << aThis->GetSubshapeIndex();
|
||||
}
|
||||
else
|
||||
theTarget << Standard_Integer(0);
|
||||
}
|
||||
}
|
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
|
52
src/BinMXCAFDoc/BinMXCAFDoc_NoteBalloonDriver.cxx
Normal file
52
src/BinMXCAFDoc/BinMXCAFDoc_NoteBalloonDriver.cxx
Normal file
@ -0,0 +1,52 @@
|
||||
// Created on: 2017-08-10
|
||||
// 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_NoteBalloonDriver.hxx>
|
||||
#include <XCAFDoc_NoteBalloon.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteCommentDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteBalloonDriver::BinMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMXCAFDoc_NoteCommentDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBalloon)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NoteBalloonDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteBalloon();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteBalloonDriver::BinMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: BinMXCAFDoc_NoteCommentDriver(theMsgDriver, theName)
|
||||
{
|
||||
|
||||
}
|
42
src/BinMXCAFDoc/BinMXCAFDoc_NoteBalloonDriver.hxx
Normal file
42
src/BinMXCAFDoc/BinMXCAFDoc_NoteBalloonDriver.hxx
Normal file
@ -0,0 +1,42 @@
|
||||
// Created on: 2017-08-10
|
||||
// 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_NoteBalloonDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteBalloonDriver_HeaderFile
|
||||
|
||||
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
|
||||
|
||||
class BinMXCAFDoc_NoteBalloonDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteCommentDriver)
|
||||
|
||||
class BinMXCAFDoc_NoteBalloonDriver : public BinMXCAFDoc_NoteCommentDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteCommentDriver)
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
BinMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName);
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
96
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.cxx
Normal file
96
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.cxx
Normal file
@ -0,0 +1,96 @@
|
||||
// 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 <TColStd_HArray1OfByte.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.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) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_ExtendedString aTitle;
|
||||
TCollection_AsciiString aMIMEtype;
|
||||
Standard_Integer nbSize;
|
||||
if (!(theSource >> aTitle >> aMIMEtype >> nbSize))
|
||||
return Standard_False;
|
||||
|
||||
Handle(TColStd_HArray1OfByte) aData;
|
||||
if (nbSize > 0)
|
||||
{
|
||||
aData.reset(new TColStd_HArray1OfByte(1, nbSize));
|
||||
theSource.GetByteArray(&aData->ChangeFirst(), nbSize);
|
||||
}
|
||||
|
||||
aNote->Set(aTitle, aMIMEtype, aData);
|
||||
|
||||
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) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theSource);
|
||||
if (!aNote.IsNull())
|
||||
{
|
||||
theTarget << aNote->Title() << aNote->MIMEtype() << aNote->Size();
|
||||
if (aNote->Size() > 0)
|
||||
theTarget.PutByteArray(&aNote->Data()->ChangeFirst(), aNote->Size());
|
||||
}
|
||||
}
|
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
|
91
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.cxx
Normal file
91
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.cxx
Normal file
@ -0,0 +1,91 @@
|
||||
// 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) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_ExtendedString aComment;
|
||||
if (!(theSource >> aComment))
|
||||
return Standard_False;
|
||||
|
||||
aNote->Set(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) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theSource);
|
||||
if (!aNote.IsNull())
|
||||
theTarget << aNote->Comment();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteCommentDriver::BinMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, theName)
|
||||
{
|
||||
|
||||
}
|
49
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.hxx
Normal file
49
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.hxx
Normal file
@ -0,0 +1,49 @@
|
||||
// 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)
|
||||
|
||||
protected:
|
||||
|
||||
BinMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName);
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
68
src/BinMXCAFDoc/BinMXCAFDoc_NoteDriver.cxx
Normal file
68
src/BinMXCAFDoc/BinMXCAFDoc_NoteDriver.cxx
Normal file
@ -0,0 +1,68 @@
|
||||
// Created on: 2017-02-10
|
||||
// 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_NoteDriver.hxx>
|
||||
#include <XCAFDoc_Note.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteDriver::BinMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: BinMDF_ADriver(theMsgDriver, theName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
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);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_ExtendedString aUserName, aTimeStamp;
|
||||
if (!(theSource >> aUserName >> aTimeStamp))
|
||||
return Standard_False;
|
||||
|
||||
aNote->Set(aUserName, aTimeStamp);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
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);
|
||||
if (!aNote.IsNull())
|
||||
theTarget << aNote->UserName() << aNote->TimeStamp();
|
||||
}
|
55
src/BinMXCAFDoc/BinMXCAFDoc_NoteDriver.hxx
Normal file
55
src/BinMXCAFDoc/BinMXCAFDoc_NoteDriver.hxx
Normal file
@ -0,0 +1,55 @@
|
||||
// Created on: 2017-02-10
|
||||
// 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_NoteDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteDriver_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_NoteDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteDriver, BinMDF_ADriver)
|
||||
|
||||
class BinMXCAFDoc_NoteDriver : public BinMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
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_NoteDriver, BinMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
BinMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName);
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteDriver_HeaderFile
|
62
src/BinMXCAFDoc/BinMXCAFDoc_NotesToolDriver.cxx
Normal file
62
src/BinMXCAFDoc/BinMXCAFDoc_NotesToolDriver.cxx
Normal file
@ -0,0 +1,62 @@
|
||||
// Created on: 2017-02-10
|
||||
// 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_NotesToolDriver.hxx>
|
||||
#include <XCAFDoc_NotesTool.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NotesToolDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NotesToolDriver::BinMXCAFDoc_NotesToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NotesTool)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NotesToolDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NotesTool();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NotesToolDriver::Paste(const BinObjMgt_Persistent& /*theSource*/,
|
||||
const Handle(TDF_Attribute)& /*theTarget*/,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NotesToolDriver::Paste(const Handle(TDF_Attribute)& /*theSource*/,
|
||||
BinObjMgt_Persistent& /*theTarget*/,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
}
|
54
src/BinMXCAFDoc/BinMXCAFDoc_NotesToolDriver.hxx
Normal file
54
src/BinMXCAFDoc/BinMXCAFDoc_NotesToolDriver.hxx
Normal file
@ -0,0 +1,54 @@
|
||||
// Created on: 2017-02-10
|
||||
// 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_NotesToolDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NotesToolDriver_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_NotesToolDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NotesToolDriver, BinMDF_ADriver)
|
||||
|
||||
class BinMXCAFDoc_NotesToolDriver : public BinMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NotesToolDriver(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_NotesToolDriver, BinMDF_ADriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NotesToolDriver_HeaderFile
|
@ -1,5 +1,7 @@
|
||||
BinMXCAFDoc.cxx
|
||||
BinMXCAFDoc.hxx
|
||||
BinMXCAFDoc_AssemblyItemRefDriver.cxx
|
||||
BinMXCAFDoc_AssemblyItemRefDriver.hxx
|
||||
BinMXCAFDoc_AreaDriver.cxx
|
||||
BinMXCAFDoc_AreaDriver.hxx
|
||||
BinMXCAFDoc_CentroidDriver.cxx
|
||||
@ -33,6 +35,16 @@ BinMXCAFDoc_MaterialDriver.cxx
|
||||
BinMXCAFDoc_MaterialDriver.hxx
|
||||
BinMXCAFDoc_MaterialToolDriver.cxx
|
||||
BinMXCAFDoc_MaterialToolDriver.hxx
|
||||
BinMXCAFDoc_NoteDriver.cxx
|
||||
BinMXCAFDoc_NoteDriver.hxx
|
||||
BinMXCAFDoc_NoteBalloonDriver.cxx
|
||||
BinMXCAFDoc_NoteBalloonDriver.hxx
|
||||
BinMXCAFDoc_NoteCommentDriver.cxx
|
||||
BinMXCAFDoc_NoteCommentDriver.hxx
|
||||
BinMXCAFDoc_NoteBinDataDriver.cxx
|
||||
BinMXCAFDoc_NoteBinDataDriver.hxx
|
||||
BinMXCAFDoc_NotesToolDriver.cxx
|
||||
BinMXCAFDoc_NotesToolDriver.hxx
|
||||
BinMXCAFDoc_ShapeToolDriver.cxx
|
||||
BinMXCAFDoc_ShapeToolDriver.hxx
|
||||
BinMXCAFDoc_ViewDriver.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
|
||||
@ -40,6 +45,16 @@ XCAFDoc_Material.cxx
|
||||
XCAFDoc_Material.hxx
|
||||
XCAFDoc_MaterialTool.cxx
|
||||
XCAFDoc_MaterialTool.hxx
|
||||
XCAFDoc_Note.cxx
|
||||
XCAFDoc_Note.hxx
|
||||
XCAFDoc_NoteBalloon.cxx
|
||||
XCAFDoc_NoteBalloon.hxx
|
||||
XCAFDoc_NoteComment.cxx
|
||||
XCAFDoc_NoteComment.hxx
|
||||
XCAFDoc_NoteBinData.cxx
|
||||
XCAFDoc_NoteBinData.hxx
|
||||
XCAFDoc_NotesTool.cxx
|
||||
XCAFDoc_NotesTool.hxx
|
||||
XCAFDoc_ShapeMapTool.cxx
|
||||
XCAFDoc_ShapeMapTool.hxx
|
||||
XCAFDoc_ShapeTool.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 :
|
||||
@ -239,6 +250,28 @@ Standard_GUID XCAFDoc::ViewRefPlaneGUID()
|
||||
return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ViewRefPlaneGUID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_GUID XCAFDoc::ViewRefNoteGUID()
|
||||
{
|
||||
static Standard_GUID ID("C814ACC6-43AC-4812-9B2A-4E9A2A549354");
|
||||
return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ViewRefPlaneGUID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_GUID XCAFDoc::ViewRefAnnotationGUID()
|
||||
{
|
||||
static Standard_GUID ID("A2B5BA42-DD00-43f5-8882-4B5F8E76B9D2");
|
||||
return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LockGUID
|
||||
//purpose :
|
||||
|
@ -97,7 +97,10 @@ public:
|
||||
Standard_EXPORT static Standard_GUID LayerRefGUID();
|
||||
|
||||
Standard_EXPORT static Standard_GUID MaterialRefGUID();
|
||||
|
||||
|
||||
//! Return GUIDs for representing notes
|
||||
Standard_EXPORT static Standard_GUID NoteRefGUID();
|
||||
|
||||
Standard_EXPORT static Standard_GUID InvisibleGUID();
|
||||
|
||||
//! Returns GUID for UAttribute identifying external reference on no-step file
|
||||
@ -118,6 +121,10 @@ public:
|
||||
//! Return GUIDs for TreeNode representing specified types of View
|
||||
Standard_EXPORT static Standard_GUID ViewRefPlaneGUID();
|
||||
|
||||
//! Return GUIDs for GraphNode representing specified types of View
|
||||
Standard_EXPORT static Standard_GUID ViewRefNoteGUID();
|
||||
Standard_EXPORT static Standard_GUID ViewRefAnnotationGUID();
|
||||
|
||||
//! Returns GUID for UAttribute identifying lock flag
|
||||
Standard_EXPORT static Standard_GUID LockGUID();
|
||||
|
||||
|
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;
|
||||
}
|
101
src/XCAFDoc/XCAFDoc_AssemblyItemId.hxx
Normal file
101
src/XCAFDoc/XCAFDoc_AssemblyItemId.hxx
Normal file
@ -0,0 +1,101 @@
|
||||
// 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>
|
||||
|
||||
//! Unique item identifier in the hierarchical product structure.
|
||||
//! A full path to an assembly component in the “part-of” graph starting from
|
||||
//! the root node.
|
||||
class XCAFDoc_AssemblyItemId
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Constructs an empty item ID.
|
||||
Standard_EXPORT XCAFDoc_AssemblyItemId();
|
||||
|
||||
//! Constructs an item ID from a list of strings, where every
|
||||
//! string is a label entry.
|
||||
//! \param [in] thePath - list of label entries.
|
||||
Standard_EXPORT XCAFDoc_AssemblyItemId(const TColStd_ListOfAsciiString& thePath);
|
||||
|
||||
//! Constructs an item ID from a formatted path, where label entries
|
||||
//! are separated by '/' symbol.
|
||||
//! \param [in] theString - formatted full path.
|
||||
Standard_EXPORT XCAFDoc_AssemblyItemId(const TCollection_AsciiString& theString);
|
||||
|
||||
//! Initializes the item ID from a list of strings, where every
|
||||
//! string is a label entry.
|
||||
//! \param [in] thePath - list of label entries.
|
||||
Standard_EXPORT void Init(const TColStd_ListOfAsciiString& thePath);
|
||||
|
||||
//! Initializes the item ID from a formatted path, where label entries
|
||||
//! are separated by '/' symbol.
|
||||
//! \param [in] theString - formatted full path.
|
||||
Standard_EXPORT void Init(const TCollection_AsciiString& theString);
|
||||
|
||||
//! Returns true if the full path is empty, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean IsNull() const;
|
||||
|
||||
//! Clears the full path.
|
||||
Standard_EXPORT void Nullify();
|
||||
|
||||
//! Checks if this item is a child of the given item.
|
||||
//! \param [in] theOther - potentially ancestor item.
|
||||
//! \return true if the item is a child of theOther item, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean IsChild(const XCAFDoc_AssemblyItemId& theOther) const;
|
||||
|
||||
//! Checks if this item is a direct child of the given item.
|
||||
//! \param [in] theOther - potentially parent item.
|
||||
//! \return true if the item is a direct child of theOther item, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean IsDirectChild(const XCAFDoc_AssemblyItemId& theOther) const;
|
||||
|
||||
//! Checks for item IDs equality.
|
||||
//! \param [in] theOther - the item ID to check equality with.
|
||||
//! \return true if this ID is equal to theOther, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean IsEqual(const XCAFDoc_AssemblyItemId& theOther) const;
|
||||
|
||||
//! Returns the full path as a list of label entries.
|
||||
Standard_EXPORT const TColStd_ListOfAsciiString& GetPath() const;
|
||||
|
||||
//! Returns the full pass as a formatted string.
|
||||
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; ///< List of label entries
|
||||
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_AssemblyItemId_HeaderFile
|
295
src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx
Normal file
295
src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx
Normal file
@ -0,0 +1,295 @@
|
||||
// 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_Data.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <TDF_RelocationTable.hxx>
|
||||
#include <TDocStd_Owner.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TNaming_NamedShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <XCAFDoc_AssemblyItemRef.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_AssemblyItemRef, TDF_Attribute)
|
||||
|
||||
enum {
|
||||
ExtraRef_None,
|
||||
ExtraRef_AttrGUID,
|
||||
ExtraRef_SubshapeIndex
|
||||
};
|
||||
|
||||
const Standard_GUID&
|
||||
XCAFDoc_AssemblyItemRef::GetID()
|
||||
{
|
||||
static Standard_GUID s_ID("3F2E4CD6-169B-4747-A321-5670E4291F5D");
|
||||
return s_ID;
|
||||
}
|
||||
|
||||
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->SetItem(theItemId);
|
||||
theLabel.AddAttribute(aThis);
|
||||
}
|
||||
return aThis;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_AssemblyItemRef::Set(const TDF_Label& theLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theAttrGUID)
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), aThis))
|
||||
{
|
||||
aThis = new XCAFDoc_AssemblyItemRef();
|
||||
aThis->SetItem(theItemId);
|
||||
aThis->SetGUID(theAttrGUID);
|
||||
theLabel.AddAttribute(aThis);
|
||||
}
|
||||
return aThis;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_AssemblyItemRef::Set(const TDF_Label& theLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_Integer theShapeIndex)
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), aThis))
|
||||
{
|
||||
aThis = new XCAFDoc_AssemblyItemRef();
|
||||
aThis->SetItem(theItemId);
|
||||
aThis->SetSubshapeIndex(theShapeIndex);
|
||||
theLabel.AddAttribute(aThis);
|
||||
}
|
||||
return aThis;
|
||||
}
|
||||
|
||||
XCAFDoc_AssemblyItemRef::XCAFDoc_AssemblyItemRef()
|
||||
: myExtraRef(ExtraRef_None)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemRef::IsOrphan() const
|
||||
{
|
||||
if (myItemId.IsNull())
|
||||
return Standard_True;
|
||||
|
||||
TDF_Label aRoot = Label().Root();
|
||||
|
||||
Handle(TDocStd_Owner) anOwner;
|
||||
if (!aRoot.FindAttribute(TDocStd_Owner::GetID(), anOwner))
|
||||
return Standard_True;
|
||||
|
||||
Handle(TDocStd_Document) aDoc = anOwner->GetDocument();
|
||||
if (aDoc.IsNull())
|
||||
return Standard_True;
|
||||
|
||||
Handle(TDF_Data) aData = aDoc->GetData();
|
||||
if (aData.IsNull())
|
||||
return Standard_True;
|
||||
|
||||
TDF_Label aLabel;
|
||||
TDF_Tool::Label(aData, myItemId.GetPath().Last(), aLabel);
|
||||
if (aLabel.IsNull())
|
||||
return Standard_True;
|
||||
|
||||
if (HasExtraRef())
|
||||
{
|
||||
if (IsGUID())
|
||||
{
|
||||
Handle(TDF_Attribute) anAttr;
|
||||
if (!aLabel.FindAttribute(GetGUID(), anAttr))
|
||||
return Standard_True;
|
||||
}
|
||||
else if (IsSubshapeIndex())
|
||||
{
|
||||
Handle(TNaming_NamedShape) aNamedShape;
|
||||
if (!aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNamedShape))
|
||||
return Standard_True;
|
||||
|
||||
TopoDS_Shape aShape = aNamedShape->Get();
|
||||
TopTools_IndexedMapOfShape aMap;
|
||||
TopExp::MapShapes(aShape, aMap);
|
||||
Standard_Integer aSubshapeIndex = GetSubshapeIndex();
|
||||
if (aSubshapeIndex < 1 || aMap.Size() < aSubshapeIndex)
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemRef::HasExtraRef() const
|
||||
{
|
||||
return (myExtraRef != ExtraRef_None);
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemRef::IsGUID() const
|
||||
{
|
||||
return (myExtraRef == ExtraRef_AttrGUID && Standard_GUID::CheckGUIDFormat(myExtraId.ToCString()));
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_AssemblyItemRef::IsSubshapeIndex() const
|
||||
{
|
||||
return (myExtraRef == ExtraRef_SubshapeIndex && myExtraId.IsIntegerValue());
|
||||
}
|
||||
|
||||
const XCAFDoc_AssemblyItemId&
|
||||
XCAFDoc_AssemblyItemRef::GetItem() const
|
||||
{
|
||||
return myItemId;
|
||||
}
|
||||
|
||||
Standard_GUID
|
||||
XCAFDoc_AssemblyItemRef::GetGUID() const
|
||||
{
|
||||
if (IsGUID())
|
||||
return Standard_GUID(myExtraId.ToCString());
|
||||
else
|
||||
return Standard_GUID();
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_AssemblyItemRef::GetSubshapeIndex() const
|
||||
{
|
||||
if (IsSubshapeIndex())
|
||||
return myExtraId.IntegerValue();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemRef::SetItem(const XCAFDoc_AssemblyItemId& theItemId)
|
||||
{
|
||||
Backup();
|
||||
myItemId = theItemId;
|
||||
ClearExtraRef();
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemRef::SetItem(const TColStd_ListOfAsciiString& thePath)
|
||||
{
|
||||
Backup();
|
||||
myItemId.Init(thePath);
|
||||
ClearExtraRef();
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemRef::SetItem(const TCollection_AsciiString& theString)
|
||||
{
|
||||
Backup();
|
||||
myItemId.Init(theString);
|
||||
ClearExtraRef();
|
||||
}
|
||||
|
||||
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&
|
||||
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) anOther = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theAttrFrom);
|
||||
if (!anOther.IsNull())
|
||||
{
|
||||
myItemId = anOther->myItemId;
|
||||
myExtraRef = anOther->myExtraRef;
|
||||
myExtraId = anOther->myExtraId;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_AssemblyItemRef::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& /*theRT*/) const
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) anOther = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theAttrInto);
|
||||
if (!anOther.IsNull())
|
||||
{
|
||||
anOther->myItemId = myItemId;
|
||||
anOther->myExtraRef = myExtraRef;
|
||||
anOther->myExtraId = myExtraId;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_OStream&
|
||||
XCAFDoc_AssemblyItemRef::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
theOS << "Path: " << myItemId.ToString();
|
||||
if (IsGUID())
|
||||
theOS << "/GUID:" << myExtraId;
|
||||
else if (IsSubshapeIndex())
|
||||
theOS << "/Subshape: " << myExtraId;
|
||||
return theOS;
|
||||
}
|
154
src/XCAFDoc/XCAFDoc_AssemblyItemRef.hxx
Normal file
154
src/XCAFDoc/XCAFDoc_AssemblyItemRef.hxx
Normal file
@ -0,0 +1,154 @@
|
||||
// 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 <Standard_GUID.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_AssemblyItemId.hxx>
|
||||
|
||||
class TDF_Data;
|
||||
class TDF_RelocationTable;
|
||||
|
||||
class XCAFDoc_AssemblyItemRef;
|
||||
DEFINE_STANDARD_HANDLE(XCAFDoc_AssemblyItemRef, TDF_Attribute)
|
||||
|
||||
//! An attribute that describes a weak reference to an assembly item
|
||||
//! or to a subshape or to an assembly label attribute.
|
||||
class XCAFDoc_AssemblyItemRef : public TDF_Attribute
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDoc_AssemblyItemRef, TDF_Attribute);
|
||||
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
|
||||
//! Finds a reference attribute on the given label and returns it, if it is found
|
||||
Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Get(const TDF_Label& theLabel);
|
||||
|
||||
//! @name Set reference attribute functions.
|
||||
//! @{
|
||||
|
||||
//! Create (if not exist) a reference to an assembly item.
|
||||
//! \param [in] theLabel - label to add the attribute.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \return A handle to the attribute instance.
|
||||
Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Set(const TDF_Label& theLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId);
|
||||
|
||||
//! Create (if not exist) a reference to an assembly item's label attribute.
|
||||
//! \param [in] theLabel - label to add the attribute.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theGUID - assembly item's label attribute ID.
|
||||
//! \return A handle to the attribute instance.
|
||||
Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Set(const TDF_Label& theLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID);
|
||||
|
||||
//! Create (if not exist) a reference to an assembly item's subshape.
|
||||
//! \param [in] theLabel - label to add the attribute.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theShapeIndex - assembly item's subshape index.
|
||||
//! \return A handle to the attribute instance.
|
||||
Standard_EXPORT static Handle(XCAFDoc_AssemblyItemRef) Set(const TDF_Label& theLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_Integer theShapeIndex);
|
||||
|
||||
//! @}
|
||||
|
||||
//! Creates an empty reference attribute.
|
||||
Standard_EXPORT XCAFDoc_AssemblyItemRef();
|
||||
|
||||
//! Checks if the reference points to a really existing item in XDE document.
|
||||
Standard_EXPORT Standard_Boolean IsOrphan() const;
|
||||
|
||||
//! @name Extra reference functions.
|
||||
//! @{
|
||||
|
||||
//! Checks if the reference points on an item's shapeindex or attribute.
|
||||
Standard_EXPORT Standard_Boolean HasExtraRef() const;
|
||||
|
||||
//! Checks is the reference points to an item's attribute.
|
||||
Standard_EXPORT Standard_Boolean IsGUID() const;
|
||||
|
||||
//! Checks is the reference points to an item's subshape.
|
||||
Standard_EXPORT Standard_Boolean IsSubshapeIndex() const;
|
||||
|
||||
//! Returns the assembly item's attribute that the reference points to.
|
||||
//! If the reference doesn't point to an attribute, returns an empty GUID.
|
||||
Standard_EXPORT Standard_GUID GetGUID() const;
|
||||
|
||||
//! Returns the assembly item's subshape that the reference points to.
|
||||
//! If the reference doesn't point to a subshape, returns 0.
|
||||
Standard_EXPORT Standard_Integer GetSubshapeIndex() const;
|
||||
|
||||
//! @}
|
||||
|
||||
//! Returns the assembly item ID that the reference points to.
|
||||
Standard_EXPORT const XCAFDoc_AssemblyItemId& GetItem() const;
|
||||
|
||||
//! @name Set reference data functions.
|
||||
//! @{
|
||||
|
||||
//! Sets the assembly item ID that the reference points to.
|
||||
//! Extra reference data (if any) will be cleared.
|
||||
Standard_EXPORT void SetItem(const XCAFDoc_AssemblyItemId& theItemId);
|
||||
|
||||
//! Sets the assembly item ID from a list of label entries
|
||||
//! that the reference points to.
|
||||
//! Extra reference data (if any) will be cleared.
|
||||
Standard_EXPORT void SetItem(const TColStd_ListOfAsciiString& thePath);
|
||||
|
||||
//! Sets the assembly item ID from a formatted path
|
||||
//! that the reference points to.
|
||||
//! Extra reference data (if any) will be cleared.
|
||||
Standard_EXPORT void SetItem(const TCollection_AsciiString& theString);
|
||||
|
||||
//! Sets the assembly item's label attribute that the reference points to.
|
||||
//! The base assembly item will not change.
|
||||
Standard_EXPORT void SetGUID(const Standard_GUID& theAttrGUID);
|
||||
|
||||
//! Sets the assembly item's subshape that the reference points to.
|
||||
//! The base assembly item will not change.
|
||||
Standard_EXPORT void SetSubshapeIndex(Standard_Integer theShapeIndex);
|
||||
|
||||
//! @}
|
||||
|
||||
//! Reverts the reference to empty state.
|
||||
Standard_EXPORT void ClearExtraRef();
|
||||
|
||||
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;
|
||||
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
XCAFDoc_AssemblyItemId myItemId; ///< Assembly item ID
|
||||
Standard_Integer myExtraRef; ///< Type of extra reference: subshape or attribute
|
||||
TCollection_AsciiString myExtraId; ///< Extra reference data
|
||||
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_AssemblyItemRef_HeaderFile
|
@ -30,6 +30,7 @@
|
||||
#include <XCAFDoc_DocumentTool.hxx>
|
||||
#include <XCAFDoc_LayerTool.hxx>
|
||||
#include <XCAFDoc_MaterialTool.hxx>
|
||||
#include <XCAFDoc_NotesTool.hxx>
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
#include <XCAFDoc_ViewTool.hxx>
|
||||
|
||||
@ -83,6 +84,7 @@ Handle(XCAFDoc_DocumentTool) XCAFDoc_DocumentTool::Set(const TDF_Label& L,
|
||||
XCAFDoc_LayerTool::Set(LayersLabel(L));
|
||||
XCAFDoc_DimTolTool::Set(DGTsLabel(L));
|
||||
XCAFDoc_MaterialTool::Set(MaterialsLabel(L));
|
||||
XCAFDoc_NotesTool::Set(NotesLabel(L));
|
||||
XCAFDoc_ViewTool::Set(ViewsLabel(L));
|
||||
XCAFDoc_ClippingPlaneTool::Set(ClippingPlanesLabel(L));
|
||||
}
|
||||
@ -211,6 +213,18 @@ TDF_Label XCAFDoc_DocumentTool::ClippingPlanesLabel(const TDF_Label& acces)
|
||||
return L;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NotesLabel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDF_Label XCAFDoc_DocumentTool::NotesLabel(const TDF_Label& acces)
|
||||
{
|
||||
TDF_Label L = DocLabel(acces).FindChild(9, Standard_True);
|
||||
TDataStd_Name::Set(L, "Notes");
|
||||
return L;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeTool
|
||||
//purpose :
|
||||
@ -285,6 +299,16 @@ Handle(XCAFDoc_ClippingPlaneTool) XCAFDoc_DocumentTool::ClippingPlaneTool(const
|
||||
return XCAFDoc_ClippingPlaneTool::Set(ClippingPlanesLabel(acces));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClippingPlaneTool
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(XCAFDoc_NotesTool) XCAFDoc_DocumentTool::NotesTool(const TDF_Label& acces)
|
||||
{
|
||||
return XCAFDoc_NotesTool::Set(NotesLabel(acces));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
|
@ -30,6 +30,7 @@ class XCAFDoc_ClippingPlaneTool;
|
||||
class XCAFDoc_LayerTool;
|
||||
class XCAFDoc_DimTolTool;
|
||||
class XCAFDoc_MaterialTool;
|
||||
class XCAFDoc_NotesTool;
|
||||
class XCAFDoc_ViewTool;
|
||||
class TDF_Attribute;
|
||||
class TDF_RelocationTable;
|
||||
@ -84,7 +85,10 @@ public:
|
||||
|
||||
//! Returns sub-label of DocLabel() with tag 8.
|
||||
Standard_EXPORT static TDF_Label ClippingPlanesLabel(const TDF_Label& acces);
|
||||
|
||||
|
||||
//! Returns sub-label of DocLabel() with tag 9.
|
||||
Standard_EXPORT static TDF_Label NotesLabel(const TDF_Label& acces);
|
||||
|
||||
//! Creates (if it does not exist) ShapeTool attribute on ShapesLabel().
|
||||
Standard_EXPORT static Handle(XCAFDoc_ShapeTool) ShapeTool (const TDF_Label& acces);
|
||||
|
||||
@ -105,7 +109,10 @@ public:
|
||||
|
||||
//! Creates (if it does not exist) ClippingPlaneTool attribute on ClippingPlanesLabel().
|
||||
Standard_EXPORT static Handle(XCAFDoc_ClippingPlaneTool) ClippingPlaneTool(const TDF_Label& acces);
|
||||
|
||||
|
||||
//! Creates (if it does not exist) NotesTool attribute on NotesLabel().
|
||||
Standard_EXPORT static Handle(XCAFDoc_NotesTool) NotesTool(const TDF_Label& acces);
|
||||
|
||||
Standard_EXPORT XCAFDoc_DocumentTool();
|
||||
|
||||
//! to be called when reading this attribute from file
|
||||
|
103
src/XCAFDoc/XCAFDoc_Note.cxx
Normal file
103
src/XCAFDoc/XCAFDoc_Note.cxx
Normal file
@ -0,0 +1,103 @@
|
||||
// Created on: 2017-02-10
|
||||
// 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_AttributeIterator.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <XCAFDoc.hxx>
|
||||
#include <XCAFDoc_GraphNode.hxx>
|
||||
#include <XCAFDoc_Note.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_Note, TDF_Attribute)
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_Note::IsMine(const TDF_Label& theLabel)
|
||||
{
|
||||
return !Get(theLabel).IsNull();
|
||||
}
|
||||
|
||||
XCAFDoc_Note::XCAFDoc_Note()
|
||||
{
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note)
|
||||
XCAFDoc_Note::Get(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote;
|
||||
for (TDF_AttributeIterator anIt(theLabel); anIt.More(); anIt.Next())
|
||||
{
|
||||
aNote = Handle(XCAFDoc_Note)::DownCast(anIt.Value());
|
||||
if (!aNote.IsNull())
|
||||
break;
|
||||
}
|
||||
return aNote;
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_Note::Set(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp)
|
||||
{
|
||||
Backup();
|
||||
|
||||
myUserName = theUserName;
|
||||
myTimeStamp = theTimeStamp;
|
||||
}
|
||||
|
||||
const TCollection_ExtendedString&
|
||||
XCAFDoc_Note::UserName() const
|
||||
{
|
||||
return myUserName;
|
||||
}
|
||||
|
||||
const TCollection_ExtendedString&
|
||||
XCAFDoc_Note::TimeStamp() const
|
||||
{
|
||||
return myTimeStamp;
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_Note::IsOrphan() const
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aFather;
|
||||
return !Label().FindAttribute(XCAFDoc::NoteRefGUID(), aFather) ||
|
||||
(aFather->NbChildren() == 0);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
Handle(XCAFDoc_Note)::DownCast(theAttrInto)->Set(myUserName, myTimeStamp);
|
||||
}
|
||||
|
||||
Standard_OStream&
|
||||
XCAFDoc_Note::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
TDF_Attribute::Dump(theOS);
|
||||
theOS
|
||||
<< "Note : "
|
||||
<< (myUserName.IsEmpty() ? myUserName : "<anonymous>")
|
||||
<< " on "
|
||||
<< (myTimeStamp.IsEmpty() ? myTimeStamp : "<unknown>")
|
||||
;
|
||||
return theOS;
|
||||
}
|
82
src/XCAFDoc/XCAFDoc_Note.hxx
Normal file
82
src/XCAFDoc/XCAFDoc_Note.hxx
Normal file
@ -0,0 +1,82 @@
|
||||
// Created on: 2017-02-10
|
||||
// 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_Note_HeaderFile
|
||||
#define _XCAFDoc_Note_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDF_LabelSequence.hxx>
|
||||
|
||||
class Standard_GUID;
|
||||
class TDF_RelocationTable;
|
||||
|
||||
class XCAFDoc_Note;
|
||||
DEFINE_STANDARD_HANDLE(XCAFDoc_Note, TDF_Attribute)
|
||||
|
||||
//! A base note attribute.
|
||||
//! Any note contains the name of the user created the note
|
||||
//! and the creation timestamp.
|
||||
class XCAFDoc_Note : public TDF_Attribute
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDoc_Note, TDF_Attribute)
|
||||
|
||||
//! Checks if the given label represents a note.
|
||||
Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel);
|
||||
|
||||
//! Finds a reference attribute on the given label and returns it, if it is found
|
||||
Standard_EXPORT static Handle(XCAFDoc_Note) Get(const TDF_Label& theLabel);
|
||||
|
||||
//! Sets the user name and the timestamp of the note.
|
||||
//! \param [in] theUserName - the user associated with the note.
|
||||
//! \param [in] theTimeStamp - timestamp of the note.
|
||||
//! \return A handle to the attribute instance.
|
||||
Standard_EXPORT void Set(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp);
|
||||
|
||||
//! Returns the user name, who created the note.
|
||||
Standard_EXPORT const TCollection_ExtendedString& UserName() const;
|
||||
|
||||
//! Returns the timestamp of the note.
|
||||
Standard_EXPORT const TCollection_ExtendedString& TimeStamp() const;
|
||||
|
||||
//! Checks if the note isn't linked to annotated items.
|
||||
Standard_EXPORT Standard_Boolean IsOrphan() const;
|
||||
|
||||
public:
|
||||
|
||||
// Overrides TDF_Attribute virtuals
|
||||
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:
|
||||
|
||||
//! Creates an empty note.
|
||||
Standard_EXPORT XCAFDoc_Note();
|
||||
|
||||
private:
|
||||
|
||||
TCollection_ExtendedString myUserName; ///< Name of the user, who created the note.
|
||||
TCollection_ExtendedString myTimeStamp; ///< Timestamp, when the note was created.
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_Note_HeaderFile
|
68
src/XCAFDoc/XCAFDoc_NoteBalloon.cxx
Normal file
68
src/XCAFDoc/XCAFDoc_NoteBalloon.cxx
Normal file
@ -0,0 +1,68 @@
|
||||
// Created on: 2017-08-10
|
||||
// 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_NoteBalloon.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteBalloon, XCAFDoc_NoteComment)
|
||||
|
||||
const Standard_GUID&
|
||||
XCAFDoc_NoteBalloon::GetID()
|
||||
{
|
||||
static Standard_GUID s_ID("1127951D-87D5-4ecc-89D5-D1406576C43F");
|
||||
return s_ID;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteBalloon)
|
||||
XCAFDoc_NoteBalloon::Get(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_NoteBalloon) aThis;
|
||||
theLabel.FindAttribute(XCAFDoc_NoteBalloon::GetID(), aThis);
|
||||
return aThis;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteBalloon)
|
||||
XCAFDoc_NoteBalloon::Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment)
|
||||
{
|
||||
Handle(XCAFDoc_NoteBalloon) aNoteBalloon;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_NoteBalloon::GetID(), aNoteBalloon))
|
||||
{
|
||||
aNoteBalloon = new XCAFDoc_NoteBalloon();
|
||||
aNoteBalloon->XCAFDoc_Note::Set(theUserName, theTimeStamp);
|
||||
aNoteBalloon->XCAFDoc_NoteComment::Set(theComment);
|
||||
theLabel.AddAttribute(aNoteBalloon);
|
||||
}
|
||||
return aNoteBalloon;
|
||||
}
|
||||
|
||||
XCAFDoc_NoteBalloon::XCAFDoc_NoteBalloon()
|
||||
{
|
||||
}
|
||||
|
||||
const Standard_GUID&
|
||||
XCAFDoc_NoteBalloon::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
Handle(TDF_Attribute)
|
||||
XCAFDoc_NoteBalloon::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteBalloon();
|
||||
}
|
58
src/XCAFDoc/XCAFDoc_NoteBalloon.hxx
Normal file
58
src/XCAFDoc/XCAFDoc_NoteBalloon.hxx
Normal file
@ -0,0 +1,58 @@
|
||||
// Created on: 2017-08-10
|
||||
// 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_NoteBalloon_HeaderFile
|
||||
#define _XCAFDoc_NoteBalloon_HeaderFile
|
||||
|
||||
#include <XCAFDoc_NoteComment.hxx>
|
||||
|
||||
class XCAFDoc_NoteBalloon;
|
||||
DEFINE_STANDARD_HANDLE(XCAFDoc_NoteBalloon, XCAFDoc_NoteComment)
|
||||
|
||||
//! A comment note attribute.
|
||||
//! Contains a textual comment.
|
||||
class XCAFDoc_NoteBalloon : public XCAFDoc_NoteComment
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDoc_NoteBalloon, XCAFDoc_NoteComment)
|
||||
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
|
||||
//! Finds a reference attribute on the given label and returns it, if it is found
|
||||
Standard_EXPORT static Handle(XCAFDoc_NoteBalloon) Get(const TDF_Label& theLabel);
|
||||
|
||||
//! Create (if not exist) a comment note on the given label.
|
||||
//! \param [in] theLabel - note label.
|
||||
//! \param [in] theUserName - the name of the user, who created the note.
|
||||
//! \param [in] theTimeStamp - creation timestamp of the note.
|
||||
//! \param [in] theComment - comment text.
|
||||
Standard_EXPORT static Handle(XCAFDoc_NoteBalloon) Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment);
|
||||
|
||||
//! Creates an empty comment note.
|
||||
Standard_EXPORT XCAFDoc_NoteBalloon();
|
||||
|
||||
public:
|
||||
|
||||
// Overrides TDF_Attribute virtuals
|
||||
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_NoteBalloon_HeaderFile
|
195
src/XCAFDoc/XCAFDoc_NoteBinData.cxx
Normal file
195
src/XCAFDoc/XCAFDoc_NoteBinData.cxx
Normal file
@ -0,0 +1,195 @@
|
||||
// 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 <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;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteBinData)
|
||||
XCAFDoc_NoteBinData::Get(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_NoteBinData) aThis;
|
||||
theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), aThis);
|
||||
return aThis;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteBinData)
|
||||
XCAFDoc_NoteBinData::Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile)
|
||||
{
|
||||
Handle(XCAFDoc_NoteBinData) aNoteBinData;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), aNoteBinData))
|
||||
{
|
||||
aNoteBinData = new XCAFDoc_NoteBinData();
|
||||
aNoteBinData->XCAFDoc_Note::Set(theUserName, theTimeStamp);
|
||||
if (aNoteBinData->Set(theTitle, theMIMEtype, theFile))
|
||||
theLabel.AddAttribute(aNoteBinData);
|
||||
else
|
||||
aNoteBinData.Nullify();
|
||||
}
|
||||
return aNoteBinData;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteBinData)
|
||||
XCAFDoc_NoteBinData::Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData)
|
||||
{
|
||||
Handle(XCAFDoc_NoteBinData) aNoteBinData;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_NoteBinData::GetID(), aNoteBinData))
|
||||
{
|
||||
aNoteBinData = new XCAFDoc_NoteBinData();
|
||||
aNoteBinData->XCAFDoc_Note::Set(theUserName, theTimeStamp);
|
||||
aNoteBinData->Set(theTitle, theMIMEtype, theData);
|
||||
theLabel.AddAttribute(aNoteBinData);
|
||||
}
|
||||
return aNoteBinData;
|
||||
}
|
||||
|
||||
XCAFDoc_NoteBinData::XCAFDoc_NoteBinData()
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile)
|
||||
{
|
||||
if (!theFile.IsOpen() || !theFile.IsReadable())
|
||||
return Standard_False;
|
||||
|
||||
Backup();
|
||||
|
||||
if (theFile.Size() > (Standard_Size)IntegerLast())
|
||||
return Standard_False;
|
||||
|
||||
myData.reset(new TColStd_HArray1OfByte(1, (Standard_Integer)theFile.Size()));
|
||||
Standard_Integer nbReadBytes = 0;
|
||||
theFile.Read((Standard_Address)&myData->First(), myData->Length(), nbReadBytes);
|
||||
if (nbReadBytes < myData->Length())
|
||||
return Standard_False;
|
||||
|
||||
myTitle = theTitle;
|
||||
myMIMEtype = theMIMEtype;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData)
|
||||
{
|
||||
Backup();
|
||||
|
||||
myData = theData;
|
||||
myTitle = theTitle;
|
||||
myMIMEtype = theMIMEtype;
|
||||
}
|
||||
|
||||
const TCollection_ExtendedString&
|
||||
XCAFDoc_NoteBinData::Title() const
|
||||
{
|
||||
return myTitle;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString&
|
||||
XCAFDoc_NoteBinData::MIMEtype() const
|
||||
{
|
||||
return myMIMEtype;
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NoteBinData::Size() const
|
||||
{
|
||||
return (!myData.IsNull() ? myData->Length() : 0);
|
||||
}
|
||||
|
||||
const Handle(TColStd_HArray1OfByte)&
|
||||
XCAFDoc_NoteBinData::Data() const
|
||||
{
|
||||
return myData;
|
||||
}
|
||||
|
||||
const
|
||||
Standard_GUID& XCAFDoc_NoteBinData::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
Handle(TDF_Attribute)
|
||||
XCAFDoc_NoteBinData::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteBinData();
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_NoteBinData::Restore(const Handle(TDF_Attribute)& theAttr)
|
||||
{
|
||||
XCAFDoc_Note::Restore(theAttr);
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aMine = Handle(XCAFDoc_NoteBinData)::DownCast(theAttr);
|
||||
if (!aMine.IsNull())
|
||||
{
|
||||
myTitle = aMine->myTitle;
|
||||
myMIMEtype = aMine->myMIMEtype;
|
||||
myData = aMine->myData;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_NoteBinData::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const
|
||||
{
|
||||
XCAFDoc_Note::Paste(theAttrInto, theRT);
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aMine = Handle(XCAFDoc_NoteBinData)::DownCast(theAttrInto);
|
||||
if (!aMine.IsNull())
|
||||
aMine->Set(myTitle, myMIMEtype, myData);
|
||||
}
|
||||
|
||||
Standard_OStream&
|
||||
XCAFDoc_NoteBinData::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
XCAFDoc_Note::Dump(theOS);
|
||||
theOS << "\n"
|
||||
<< "Title : " << (!myTitle.IsEmpty() ? myMIMEtype : "<untitled>") << "\n"
|
||||
<< "MIME type : " << (!myMIMEtype.IsEmpty() ? myMIMEtype : "<none>") << "\n"
|
||||
<< "Size : " << Size() << " bytes" << "\n"
|
||||
;
|
||||
if (!myData.IsNull())
|
||||
{
|
||||
for (Standard_Integer i = myData->Lower(); i <= myData->Upper(); ++i)
|
||||
theOS << myData->Value(i);
|
||||
}
|
||||
return theOS;
|
||||
}
|
129
src/XCAFDoc/XCAFDoc_NoteBinData.hxx
Normal file
129
src/XCAFDoc/XCAFDoc_NoteBinData.hxx
Normal file
@ -0,0 +1,129 @@
|
||||
// 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>
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
class OSD_File;
|
||||
|
||||
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();
|
||||
|
||||
//! Finds a binary data attribute on the given label and returns it, if it is found
|
||||
Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Get(const TDF_Label& theLabel);
|
||||
|
||||
//! @name Set attribute functions.
|
||||
//! @{
|
||||
|
||||
//! Create (if not exist) a binary note with data loaded from a binary file.
|
||||
//! \param [in] theLabel - label to add the attribute.
|
||||
//! \param [in] theUserName - the name of the user, who created the note.
|
||||
//! \param [in] theTimeStamp - creation timestamp of the note.
|
||||
//! \param [in] theTitle - file title.
|
||||
//! \param [in] theMIMEtype - MIME type of the file.
|
||||
//! \param [in] theFile - input binary file.
|
||||
//! \return A handle to the attribute instance.
|
||||
Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile);
|
||||
|
||||
//! Create (if not exist) a binary note byte data array.
|
||||
//! \param [in] theLabel - label to add the attribute.
|
||||
//! \param [in] theUserName - the name of the user, who created the note.
|
||||
//! \param [in] theTimeStamp - creation timestamp of the note.
|
||||
//! \param [in] theTitle - data title.
|
||||
//! \param [in] theMIMEtype - MIME type of data.
|
||||
//! \param [in] theData - byte data array.
|
||||
//! \return A handle to the attribute instance.
|
||||
Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData);
|
||||
|
||||
//! @}
|
||||
|
||||
//! Creates an empty binary data note.
|
||||
Standard_EXPORT XCAFDoc_NoteBinData();
|
||||
|
||||
//! @name Set attribute data functions.
|
||||
//! @{
|
||||
|
||||
//! Sets title, MIME type and data from a binary file.
|
||||
//! \param [in] theTitle - file title.
|
||||
//! \param [in] theMIMEtype - MIME type of the file.
|
||||
//! \param [in] theFile - input binary file.
|
||||
Standard_EXPORT Standard_Boolean Set(const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
OSD_File& theFile);
|
||||
|
||||
//! Sets title, MIME type and data from a byte array.
|
||||
//! \param [in] theTitle - data title.
|
||||
//! \param [in] theMIMEtype - MIME type of data.
|
||||
//! \param [in] theData - byte data array.
|
||||
Standard_EXPORT void Set(const TCollection_ExtendedString& theTitle,
|
||||
const TCollection_AsciiString& theMIMEtype,
|
||||
const Handle(TColStd_HArray1OfByte)& theData);
|
||||
|
||||
//! @}
|
||||
|
||||
//! Returns the note title.
|
||||
Standard_EXPORT const TCollection_ExtendedString& Title() const;
|
||||
|
||||
//! Returns data MIME type.
|
||||
Standard_EXPORT const TCollection_AsciiString& MIMEtype() const;
|
||||
|
||||
//! Size of data in bytes.
|
||||
Standard_EXPORT Standard_Integer Size() const;
|
||||
|
||||
//! Returns byte data array.
|
||||
Standard_EXPORT const Handle(TColStd_HArray1OfByte)& Data() const;
|
||||
|
||||
public:
|
||||
|
||||
// Overrides TDF_Attribute 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;
|
||||
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
TCollection_ExtendedString myTitle; ///< Note title.
|
||||
TCollection_AsciiString myMIMEtype; ///< MIME type of data.
|
||||
Handle(TColStd_HArray1OfByte) myData; ///< Byte data array.
|
||||
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_NoteBinData_HeaderFile
|
113
src/XCAFDoc/XCAFDoc_NoteComment.cxx
Normal file
113
src/XCAFDoc/XCAFDoc_NoteComment.cxx
Normal file
@ -0,0 +1,113 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteComment)
|
||||
XCAFDoc_NoteComment::Get(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_NoteComment) aThis;
|
||||
theLabel.FindAttribute(XCAFDoc_NoteComment::GetID(), aThis);
|
||||
return aThis;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_NoteComment)
|
||||
XCAFDoc_NoteComment::Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment)
|
||||
{
|
||||
Handle(XCAFDoc_NoteComment) aNoteComment;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_NoteComment::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 TCollection_ExtendedString& theComment)
|
||||
{
|
||||
Backup();
|
||||
|
||||
myComment = theComment;
|
||||
}
|
||||
|
||||
const TCollection_ExtendedString&
|
||||
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_NoteComment();
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_NoteComment::Restore(const Handle(TDF_Attribute)& theAttr)
|
||||
{
|
||||
XCAFDoc_Note::Restore(theAttr);
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aMine = Handle(XCAFDoc_NoteComment)::DownCast(theAttr);
|
||||
if (!aMine.IsNull())
|
||||
myComment = aMine->myComment;
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_NoteComment::Paste(const Handle(TDF_Attribute)& theAttrInto,
|
||||
const Handle(TDF_RelocationTable)& theRT) const
|
||||
{
|
||||
XCAFDoc_Note::Paste(theAttrInto, theRT);
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aMine = Handle(XCAFDoc_NoteComment)::DownCast(theAttrInto);
|
||||
if (!aMine.IsNull())
|
||||
aMine->Set(myComment);
|
||||
}
|
||||
|
||||
Standard_OStream&
|
||||
XCAFDoc_NoteComment::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
XCAFDoc_Note::Dump(theOS);
|
||||
theOS << "\n"
|
||||
<< "Comment : " << (!myComment.IsEmpty() ? myComment : "<empty>")
|
||||
;
|
||||
return theOS;
|
||||
}
|
72
src/XCAFDoc/XCAFDoc_NoteComment.hxx
Normal file
72
src/XCAFDoc/XCAFDoc_NoteComment.hxx
Normal file
@ -0,0 +1,72 @@
|
||||
// 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)
|
||||
|
||||
//! A comment note attribute.
|
||||
//! Contains a textual comment.
|
||||
class XCAFDoc_NoteComment : public XCAFDoc_Note
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDoc_NoteComment, XCAFDoc_Note)
|
||||
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
|
||||
//! Finds a reference attribute on the given label and returns it, if it is found
|
||||
Standard_EXPORT static Handle(XCAFDoc_NoteComment) Get(const TDF_Label& theLabel);
|
||||
|
||||
//! Create (if not exist) a comment note on the given label.
|
||||
//! \param [in] theLabel - note label.
|
||||
//! \param [in] theUserName - the name of the user, who created the note.
|
||||
//! \param [in] theTimeStamp - creation timestamp of the note.
|
||||
//! \param [in] theComment - comment text.
|
||||
Standard_EXPORT static Handle(XCAFDoc_NoteComment) Set(const TDF_Label& theLabel,
|
||||
const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment);
|
||||
|
||||
//! Creates an empty comment note.
|
||||
Standard_EXPORT XCAFDoc_NoteComment();
|
||||
|
||||
//! Sets the comment text.
|
||||
Standard_EXPORT void Set(const TCollection_ExtendedString& theComment);
|
||||
|
||||
//! Returns the comment text.
|
||||
Standard_EXPORT const TCollection_ExtendedString& Comment() const;
|
||||
|
||||
public:
|
||||
|
||||
// Overrides TDF_Attribute 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;
|
||||
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
TCollection_ExtendedString myComment; ///< Comment text.
|
||||
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_NoteComment_HeaderFile
|
848
src/XCAFDoc/XCAFDoc_NotesTool.cxx
Normal file
848
src/XCAFDoc/XCAFDoc_NotesTool.cxx
Normal file
@ -0,0 +1,848 @@
|
||||
// Created on: 2017-02-10
|
||||
// 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 <NCollection_Map.hxx>
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <TDF_ChildIDIterator.hxx>
|
||||
#include <TDF_LabelSequence.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <XCAFDoc.hxx>
|
||||
#include <XCAFDoc_GraphNode.hxx>
|
||||
#include <XCAFDoc_NotesTool.hxx>
|
||||
#include <XCAFDoc_NoteBalloon.hxx>
|
||||
#include <XCAFDoc_NoteComment.hxx>
|
||||
#include <XCAFDoc_NoteBinData.hxx>
|
||||
#include <XCAFDoc_AssemblyItemRef.hxx>
|
||||
|
||||
namespace {
|
||||
|
||||
XCAFDoc_AssemblyItemId labeledItem(const TDF_Label& theLabel)
|
||||
{
|
||||
TCollection_AsciiString anEntry;
|
||||
TDF_Tool::Entry(theLabel, anEntry);
|
||||
return XCAFDoc_AssemblyItemId(anEntry);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NotesTool, TDF_Attribute)
|
||||
|
||||
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) aTool;
|
||||
if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_NotesTool::GetID(), aTool))
|
||||
{
|
||||
aTool = new XCAFDoc_NotesTool();
|
||||
theLabel.AddAttribute(aTool);
|
||||
}
|
||||
return aTool;
|
||||
}
|
||||
|
||||
XCAFDoc_NotesTool::XCAFDoc_NotesTool()
|
||||
{
|
||||
}
|
||||
|
||||
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(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TDF_Label aLabel = anIter.Value();
|
||||
if (!XCAFDoc_Note::Get(aLabel).IsNull())
|
||||
++nbNotes;
|
||||
}
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::NbAnnotatedItems() const
|
||||
{
|
||||
Standard_Integer nbItems = 0;
|
||||
for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
|
||||
{
|
||||
++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::Get(aLabel).IsNull())
|
||||
theNoteLabels.Append(aLabel);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_NotesTool::GetAnnotatedItems(TDF_LabelSequence& theItemLabels) const
|
||||
{
|
||||
for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
|
||||
{
|
||||
theItemLabels.Append(anIter.Value()->Label());
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::IsAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const
|
||||
{
|
||||
return !FindAnnotatedItem(theItemId).IsNull();
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::IsAnnotatedItem(const TDF_Label& theItemLabel) const
|
||||
{
|
||||
return IsAnnotatedItem(labeledItem(theItemLabel));
|
||||
}
|
||||
|
||||
TDF_Label
|
||||
XCAFDoc_NotesTool::FindAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const
|
||||
{
|
||||
for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) anItemRef = Handle(XCAFDoc_AssemblyItemRef)::DownCast(anIter.Value());
|
||||
if (!anItemRef.IsNull() && anItemRef->GetItem().IsEqual(theItemId) && !anItemRef->HasExtraRef())
|
||||
return anItemRef->Label();
|
||||
}
|
||||
return TDF_Label();
|
||||
}
|
||||
|
||||
TDF_Label
|
||||
XCAFDoc_NotesTool::FindAnnotatedItem(const TDF_Label& theItemLabel) const
|
||||
{
|
||||
return FindAnnotatedItem(labeledItem(theItemLabel));
|
||||
}
|
||||
|
||||
TDF_Label
|
||||
XCAFDoc_NotesTool::FindAnnotatedItemAttr(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID) const
|
||||
{
|
||||
for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) anItemRef = Handle(XCAFDoc_AssemblyItemRef)::DownCast(anIter.Value());
|
||||
if (!anItemRef.IsNull() && anItemRef->GetItem().IsEqual(theItemId) &&
|
||||
anItemRef->HasExtraRef() && anItemRef->GetGUID() == theGUID)
|
||||
return anItemRef->Label();
|
||||
}
|
||||
return TDF_Label();
|
||||
}
|
||||
|
||||
TDF_Label
|
||||
XCAFDoc_NotesTool::FindAnnotatedItemAttr(const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID) const
|
||||
{
|
||||
return FindAnnotatedItemAttr(labeledItem(theItemLabel), theGUID);
|
||||
}
|
||||
|
||||
TDF_Label
|
||||
XCAFDoc_NotesTool::FindAnnotatedItemSubshape(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex) const
|
||||
{
|
||||
for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) anItemRef = Handle(XCAFDoc_AssemblyItemRef)::DownCast(anIter.Value());
|
||||
if (!anItemRef.IsNull() && anItemRef->GetItem().IsEqual(theItemId) &&
|
||||
anItemRef->HasExtraRef() && anItemRef->GetSubshapeIndex() == theSubshapeIndex)
|
||||
return anItemRef->Label();
|
||||
}
|
||||
return TDF_Label();
|
||||
}
|
||||
|
||||
TDF_Label
|
||||
XCAFDoc_NotesTool::FindAnnotatedItemSubshape(const TDF_Label& theItemLabel,
|
||||
Standard_Integer theSubshapeIndex) const
|
||||
{
|
||||
return FindAnnotatedItemSubshape(labeledItem(theItemLabel), theSubshapeIndex);
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note)
|
||||
XCAFDoc_NotesTool::CreateComment(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment)
|
||||
{
|
||||
TDF_Label aNoteLabel;
|
||||
TDF_TagSource aTag;
|
||||
aNoteLabel = aTag.NewChild(GetNotesLabel());
|
||||
return XCAFDoc_NoteComment::Set(aNoteLabel, theUserName, theTimeStamp, theComment);
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note)
|
||||
XCAFDoc_NotesTool::CreateBalloon(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment)
|
||||
{
|
||||
TDF_Label aNoteLabel;
|
||||
TDF_TagSource aTag;
|
||||
aNoteLabel = aTag.NewChild(GetNotesLabel());
|
||||
return XCAFDoc_NoteBalloon::Set(aNoteLabel, theUserName, theTimeStamp, theComment);
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note)
|
||||
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(GetNotesLabel());
|
||||
return XCAFDoc_NoteBinData::Set(aNoteLabel, theUserName, theTimeStamp, theTitle, theMIMEtype, theFile);
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_Note)
|
||||
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(GetNotesLabel());
|
||||
return XCAFDoc_NoteBinData::Set(aNoteLabel, theUserName, theTimeStamp, theTitle, theMIMEtype, theData);
|
||||
}
|
||||
|
||||
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;
|
||||
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();
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::GetNotes(const TDF_Label& theItemLabel,
|
||||
TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
return GetNotes(labeledItem(theItemLabel), theNoteLabels);
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::GetAttrNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID,
|
||||
TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemAttr(theItemId, theGUID);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
return 0;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
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();
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::GetAttrNotes(const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID,
|
||||
TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
return GetAttrNotes(labeledItem(theItemLabel), theGUID, theNoteLabels);
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::GetSubshapeNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemSubshape(theItemId, theSubshapeIndex);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
return 0;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
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();
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_NotesTool::AddNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId)
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) anItemRef;
|
||||
|
||||
if (!XCAFDoc_Note::IsMine(theNoteLabel))
|
||||
return anItemRef;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItem(theItemId);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
aChild->SetFather(aFather);
|
||||
aFather->SetChild(aChild);
|
||||
|
||||
return anItemRef;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_NotesTool::AddNote(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel)
|
||||
{
|
||||
return AddNote(theNoteLabel, labeledItem(theItemLabel));
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_NotesTool::AddNoteToAttr(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID)
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) anItemRef;
|
||||
|
||||
if (!XCAFDoc_Note::IsMine(theNoteLabel))
|
||||
return anItemRef;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemAttr(theItemId, theGUID);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
aChild->SetFather(aFather);
|
||||
aFather->SetChild(aChild);
|
||||
|
||||
anItemRef->SetGUID(theGUID);
|
||||
|
||||
return anItemRef;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_NotesTool::AddNoteToAttr(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID)
|
||||
{
|
||||
return AddNoteToAttr(theNoteLabel, labeledItem(theItemLabel), theGUID);
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_NotesTool::AddNoteToSubshape(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex)
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) anItemRef;
|
||||
|
||||
if (!XCAFDoc_Note::IsMine(theNoteLabel))
|
||||
return anItemRef;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemSubshape(theItemId, theSubshapeIndex);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
aChild->SetFather(aFather);
|
||||
aFather->SetChild(aChild);
|
||||
|
||||
anItemRef->SetSubshapeIndex(theSubshapeIndex);
|
||||
|
||||
return anItemRef;
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef)
|
||||
XCAFDoc_NotesTool::AddNoteToSubshape(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
Standard_Integer theSubshapeIndex)
|
||||
{
|
||||
return AddNoteToSubshape(theNoteLabel, labeledItem(theItemLabel), theSubshapeIndex);
|
||||
}
|
||||
|
||||
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::RemoveNote(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
Standard_Boolean theDelIfOrphan)
|
||||
{
|
||||
return RemoveNote(theNoteLabel, labeledItem(theItemLabel), theDelIfOrphan);
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::RemoveSubshapeNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
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 = FindAnnotatedItemSubshape(theItemId, theSubshapeIndex);
|
||||
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::RemoveSubshapeNote(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
Standard_Boolean theDelIfOrphan)
|
||||
{
|
||||
return RemoveSubshapeNote(theNoteLabel, labeledItem(theItemLabel), theSubshapeIndex, theDelIfOrphan);
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::RemoveAttrNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID,
|
||||
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 = FindAnnotatedItemAttr(theItemId, theGUID);
|
||||
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::RemoveAttrNote(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID,
|
||||
Standard_Boolean theDelIfOrphan)
|
||||
{
|
||||
return RemoveAttrNote(theNoteLabel, labeledItem(theItemLabel), theGUID, theDelIfOrphan);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
while (aChild->NbFathers() > 0)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aFather = aChild->GetFather(1);
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(aFather->Label());
|
||||
if (!aNote.IsNull())
|
||||
{
|
||||
aFather->UnSetChild(aChild);
|
||||
if (theDelIfOrphan && aNote->IsOrphan())
|
||||
DeleteNote(aFather->Label());
|
||||
}
|
||||
}
|
||||
|
||||
anAnnotatedItem.ForgetAllAttributes();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::RemoveAllNotes(const TDF_Label& theItemLabel,
|
||||
Standard_Boolean theDelIfOrphan)
|
||||
{
|
||||
return RemoveAllNotes(labeledItem(theItemLabel), theDelIfOrphan);
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::RemoveAllSubshapeNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
Standard_Boolean theDelIfOrphan)
|
||||
{
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemSubshape(theItemId, theSubshapeIndex);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
if (!anAnnotatedItem.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
return Standard_False;
|
||||
|
||||
while (aChild->NbFathers() > 0)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aFather = aChild->GetFather(1);
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(aFather->Label());
|
||||
if (!aNote.IsNull())
|
||||
{
|
||||
aFather->UnSetChild(aChild);
|
||||
if (theDelIfOrphan && aNote->IsOrphan())
|
||||
DeleteNote(aFather->Label());
|
||||
}
|
||||
}
|
||||
|
||||
anAnnotatedItem.ForgetAllAttributes();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::RemoveAllAttrNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID,
|
||||
Standard_Boolean theDelIfOrphan)
|
||||
{
|
||||
TDF_Label anAnnotatedItem = FindAnnotatedItemAttr(theItemId, theGUID);
|
||||
if (anAnnotatedItem.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChild;
|
||||
if (!anAnnotatedItem.FindAttribute(XCAFDoc::NoteRefGUID(), aChild))
|
||||
return Standard_False;
|
||||
|
||||
while (aChild->NbFathers() > 0)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aFather = aChild->GetFather(1);
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(aFather->Label());
|
||||
if (!aNote.IsNull())
|
||||
{
|
||||
aFather->UnSetChild(aChild);
|
||||
if (theDelIfOrphan && aNote->IsOrphan())
|
||||
DeleteNote(aFather->Label());
|
||||
}
|
||||
}
|
||||
|
||||
anAnnotatedItem.ForgetAllAttributes();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::RemoveAllAttrNotes(const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID,
|
||||
Standard_Boolean theDelIfOrphan)
|
||||
{
|
||||
return RemoveAllAttrNotes(labeledItem(theItemLabel), theGUID, theDelIfOrphan);
|
||||
}
|
||||
|
||||
Standard_Boolean
|
||||
XCAFDoc_NotesTool::DeleteNote(const TDF_Label& theNoteLabel)
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(theNoteLabel);
|
||||
if (!aNote.IsNull())
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aFather;
|
||||
if (theNoteLabel.FindAttribute(XCAFDoc::NoteRefGUID(), aFather) && !aFather.IsNull())
|
||||
{
|
||||
while (aFather->NbChildren() > 0)
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aChild = aFather->GetChild(1);
|
||||
aFather->UnSetChild(aChild);
|
||||
if (aChild->NbFathers() == 0)
|
||||
aChild->Label().ForgetAllAttributes(Standard_True);
|
||||
}
|
||||
}
|
||||
theNoteLabel.ForgetAllAttributes(Standard_True);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::DeleteNotes(TDF_LabelSequence& theNoteLabels)
|
||||
{
|
||||
Standard_Integer nbNotes = 0;
|
||||
for (TDF_LabelSequence::Iterator anIter(theNoteLabels); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (DeleteNote(anIter.Value()))
|
||||
++nbNotes;
|
||||
}
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::DeleteAllNotes()
|
||||
{
|
||||
Standard_Integer nbNotes = 0;
|
||||
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (DeleteNote(anIter.Value()))
|
||||
++nbNotes;
|
||||
}
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
XCAFDoc_NotesTool::NbOrphanNotes() const
|
||||
{
|
||||
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())
|
||||
++nbNotes;
|
||||
}
|
||||
return nbNotes;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
return new XCAFDoc_NotesTool();
|
||||
}
|
||||
|
||||
void
|
||||
XCAFDoc_NotesTool::Restore(const Handle(TDF_Attribute)& /*theAttr*/)
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
519
src/XCAFDoc/XCAFDoc_NotesTool.hxx
Normal file
519
src/XCAFDoc/XCAFDoc_NotesTool.hxx
Normal file
@ -0,0 +1,519 @@
|
||||
// Created on: 2017-02-10
|
||||
// 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_NotesTool_HeaderFile
|
||||
#define _XCAFDoc_NotesTool_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDF_LabelSequence.hxx>
|
||||
|
||||
class OSD_File;
|
||||
class Standard_GUID;
|
||||
class TCollection_AsciiString;
|
||||
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)
|
||||
|
||||
//! A tool to annotate items in the hierarchical product structure.
|
||||
//! There are two basic entities, which operates the notes tool: notes
|
||||
//! and annotated items. A note is a user defined data structure derived
|
||||
//! from \ref XCAFDoc_Note attribute that is attached to a separate label under
|
||||
//! the notes hive. An annotated item is represented by \ref XCAFDoc_AssemblyItemRef
|
||||
//! attribute attached to a separate label under the annotated items
|
||||
//! hive. Notes are linked with annotated items by means of \ref XCAFDoc_GraphNode
|
||||
//! attribute. Notes play parent roles and annotated items - child roles.
|
||||
//!
|
||||
//! ------------------------
|
||||
//! | XCAFDoc_DocumentTool |
|
||||
//! | 0:1 |
|
||||
//! ------------------------
|
||||
//! |1
|
||||
//! ------------------------
|
||||
//! | XCAFDoc_NotesTool |
|
||||
//! | 0:1:9 |
|
||||
//! ------------------------
|
||||
//! |1
|
||||
//! | ------------------- ---------------------------
|
||||
//! +___| Notes |-----| XCAFDoc_Note |
|
||||
//! | 1| 0:1:9:1 |1 *| 0:1:9:1:* |
|
||||
//! | ------------------- ---------------------------
|
||||
//! | !*
|
||||
//! | { XCAFDoc_GraphNode }
|
||||
//! | *!
|
||||
//! | ------------------- ---------------------------
|
||||
//! +___| Annotated items |-----| XCAFDoc_AssemblyItemRef |
|
||||
//! 1| 0:1:9:2 |1 *| 0:1:9:2:* |
|
||||
//! ------------------- ---------------------------
|
||||
//!
|
||||
//! A typical annotation procedure is illustrated by the code example below:
|
||||
//! \code{.c++}
|
||||
//! // Get the notes tool from a XCAF document
|
||||
//! Handle(XCAFDoc_NotesTool) aNotesTool = XCAFDoc_DocumentTool::NotesTool(aDoc->Main());
|
||||
//! // Create new comment note
|
||||
//! Handle(XCAFDoc_Note) aNote = aNotesTool->CreateComment(aUserName, aTimestamp, aComment);
|
||||
//! if (!aNote.IsNull()) {
|
||||
//! Handle(XCAFDoc_AssemblyItemRef) aRef = aNotesTool->AddNote(aNote->Label(), anAssemblyItemId);
|
||||
//! if (aRef.IsNull()) {
|
||||
//! // Process error...
|
||||
//! }
|
||||
//! }
|
||||
//! \endcode
|
||||
class XCAFDoc_NotesTool : public TDF_Attribute
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDoc_NotesTool, TDF_Attribute)
|
||||
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
|
||||
//! Create (if not exist) a notes tool from XCAFDoc on theLabel.
|
||||
Standard_EXPORT static Handle(XCAFDoc_NotesTool) Set(const TDF_Label& theLabel);
|
||||
|
||||
//! Creates an empty notes tool.
|
||||
Standard_EXPORT XCAFDoc_NotesTool();
|
||||
|
||||
//! Returns the label of the notes hive.
|
||||
Standard_EXPORT TDF_Label GetNotesLabel() const;
|
||||
|
||||
//! Returns the label of the annotated items hive.
|
||||
Standard_EXPORT TDF_Label GetAnnotatedItemsLabel() const;
|
||||
|
||||
//! Returns the number of labels in the notes hive.
|
||||
Standard_EXPORT Standard_Integer NbNotes() const;
|
||||
|
||||
//! Returns the number of labels in the annotated items hive.
|
||||
Standard_EXPORT Standard_Integer NbAnnotatedItems() const;
|
||||
|
||||
//! Returns all labels from the notes hive.
|
||||
//! The label sequence isn't cleared beforehand.
|
||||
//! \param [out] theNoteLabels - sequence of labels.
|
||||
Standard_EXPORT void GetNotes(TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
//! Returns all labels from the annotated items hive.
|
||||
//! The label sequence isn't cleared beforehand.
|
||||
//! \param [out] theNoteLabels - sequence of labels.
|
||||
Standard_EXPORT void GetAnnotatedItems(TDF_LabelSequence& theLabels) const;
|
||||
|
||||
//! Checks if the given assembly item is annotated.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \return true if the item is annotated, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean IsAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const;
|
||||
|
||||
//! Checks if the given labeled item is annotated.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \return true if the item is annotated, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean IsAnnotatedItem(const TDF_Label& theItemLabel) const;
|
||||
|
||||
//! @name Find annotated item functions
|
||||
//! @{
|
||||
|
||||
//! Finds a label of the given assembly item ID in the annotated items hive.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \return annotated item label if it is found, otherwise - null label.
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const;
|
||||
|
||||
//! Finds a label of the given labeled item in the annotated items hive.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \return annotated item label if it is found, otherwise - null label.
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItem(const TDF_Label& theItemLabel) const;
|
||||
|
||||
//! Finds a label of the given assembly item's attribute in the annotated items hive.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theGUID - assembly item's attribute GUID.
|
||||
//! \return annotated item label if it is found, otherwise - null label.
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItemAttr(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID) const;
|
||||
|
||||
//! Finds a label of the given labeled item's attribute in the annotated items hive.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theGUID - item's attribute GUID.
|
||||
//! \return annotated item label if it is found, otherwise - null label.
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItemAttr(const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID) const;
|
||||
|
||||
//! Finds a label of the given assembly item's subshape in the annotated items hive.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theSubshapeIndex - assembly item's subshape index.
|
||||
//! \return annotated item label if it is found, otherwise - null label.
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItemSubshape(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex) const;
|
||||
|
||||
//! Finds a label of the given labeled item's subshape in the annotated items hive.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theSubshapeIndex - labeled item's subshape index.
|
||||
//! \return annotated item label if it is found, otherwise - null label.
|
||||
Standard_EXPORT TDF_Label FindAnnotatedItemSubshape(const TDF_Label& theItemLabel,
|
||||
Standard_Integer theSubshapeIndex) const;
|
||||
|
||||
//! @}
|
||||
|
||||
//! @name Note creation functions
|
||||
//! @{
|
||||
|
||||
//! Create a new comment note.
|
||||
//! Creates a new label under the notes hive and attaches \ref XCAFDoc_NoteComment
|
||||
//! attribute (derived ftom \ref XCAFDoc_Note).
|
||||
//! \param [in] theUserName - the user associated with the note.
|
||||
//! \param [in] theTimeStamp - timestamp of the note.
|
||||
//! \param [in] theComment - textual comment.
|
||||
//! \return a handle to the base note attribute.
|
||||
Standard_EXPORT Handle(XCAFDoc_Note) CreateComment(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment);
|
||||
|
||||
//! Create a new 'balloon' note.
|
||||
//! Creates a new label under the notes hive and attaches \ref XCAFDoc_NoteBalloon
|
||||
//! attribute (derived ftom \ref XCAFDoc_Note).
|
||||
//! \param [in] theUserName - the user associated with the note.
|
||||
//! \param [in] theTimeStamp - timestamp of the note.
|
||||
//! \param [in] theComment - textual comment.
|
||||
//! \return a handle to the base note attribute.
|
||||
Standard_EXPORT Handle(XCAFDoc_Note) CreateBalloon(const TCollection_ExtendedString& theUserName,
|
||||
const TCollection_ExtendedString& theTimeStamp,
|
||||
const TCollection_ExtendedString& theComment);
|
||||
|
||||
//! Create a new note with data loaded from a binary file.
|
||||
//! Creates a new label under the notes hive and attaches \ref XCAFDoc_NoteComment
|
||||
//! attribute (derived ftom \ref XCAFDoc_Note).
|
||||
//! \param [in] theUserName - the user associated with the note.
|
||||
//! \param [in] theTimeStamp - timestamp of the note.
|
||||
//! \param [in] theTitle - file title.
|
||||
//! \param [in] theMIMEtype - MIME type of the file.
|
||||
//! \param [in] theFile - input binary file.
|
||||
//! \return a handle to the base note attribute.
|
||||
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);
|
||||
|
||||
//! Create a new note with data loaded from a byte data array.
|
||||
//! Creates a new label under the notes hive and attaches \ref XCAFDoc_NoteComment
|
||||
//! attribute (derived ftom \ref XCAFDoc_Note).
|
||||
//! \param [in] theUserName - the user associated with the note.
|
||||
//! \param [in] theTimeStamp - timestamp of the note.
|
||||
//! \param [in] theTitle - data title.
|
||||
//! \param [in] theMIMEtype - MIME type of the file.
|
||||
//! \param [in] theData - byte data array.
|
||||
//! \return a handle to the base note attribute.
|
||||
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);
|
||||
|
||||
//! @}
|
||||
|
||||
//! @name Get notes from annotated items functions
|
||||
//! @{
|
||||
|
||||
//! Gets all note labels of the assembly item.
|
||||
//! Notes linked to item's subshapes or attributes aren't
|
||||
//! taken into account. The label sequence isn't cleared beforehand.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [out] theNoteLabels - sequence of labels.
|
||||
//! \return number of added labels.
|
||||
Standard_EXPORT Standard_Integer GetNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
//! Gets all note labels of the labeled item.
|
||||
//! Notes linked to item's attributes aren't
|
||||
//! taken into account. The label sequence isn't cleared beforehand.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [out] theNoteLabels - sequence of labels.
|
||||
//! \return number of added labels.
|
||||
Standard_EXPORT Standard_Integer GetNotes(const TDF_Label& theItemLabel,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
//! Gets all note labels of the assembly item's attribute.
|
||||
//! Notes linked to the item itself or to item's subshapes
|
||||
//! aren't taken into account. The label sequence isn't cleared beforehand.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theGUID - assembly item's attribute GUID.
|
||||
//! \param [out] theNoteLabels - sequence of labels.
|
||||
//! \return number of added labels.
|
||||
Standard_EXPORT Standard_Integer GetAttrNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
//! Gets all note labels of the labeled item's attribute.
|
||||
//! Notes linked to the item itself or to item's subshapes
|
||||
//! aren't taken into account. The label sequence isn't cleared beforehand.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theGUID - item's attribute GUID.
|
||||
//! \param [out] theNoteLabels - sequence of labels.
|
||||
//! \return number of added labels.
|
||||
Standard_EXPORT Standard_Integer GetAttrNotes(const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
//! Gets all note labels of the annotated item.
|
||||
//! Notes linked to the item itself or to item's attributes
|
||||
//! taken into account. The label sequence isn't cleared beforehand.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theSubshapeIndex - assembly item's subshape index.
|
||||
//! \param [out] theNoteLabels - sequence of labels.
|
||||
//! \return number of added labels.
|
||||
Standard_EXPORT Standard_Integer GetSubshapeNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
//! @}
|
||||
|
||||
//! @name Annotation functions
|
||||
//! @{
|
||||
|
||||
//! Adds the given note to the assembly item.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \return a handle to the assembly reference attribute.
|
||||
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId);
|
||||
|
||||
//! Adds the given note to the labeled item.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \return a handle to the assembly reference attribute.
|
||||
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNote(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel);
|
||||
|
||||
//! Adds the given note to the assembly item's attribute.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theGUID - assembly item's attribute GUID.
|
||||
//! \return a handle to the assembly reference attribute.
|
||||
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNoteToAttr(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID);
|
||||
|
||||
//! Adds the given note to the labeled item's attribute.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theGUID - assembly item's attribute GUID.
|
||||
//! \return a handle to the assembly reference attribute.
|
||||
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNoteToAttr(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID);
|
||||
|
||||
//! Adds the given note to the assembly item's subshape.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theSubshapeIndex - assembly item's subshape index.
|
||||
//! \return a handle to the assembly reference attribute.
|
||||
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's subshape.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theSubshapeIndex - assembly item's subshape index.
|
||||
//! \return a handle to the assembly reference attribute.
|
||||
Standard_EXPORT Handle(XCAFDoc_AssemblyItemRef) AddNoteToSubshape(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
Standard_Integer theSubshapeIndex);
|
||||
|
||||
//! @}
|
||||
|
||||
//! @name Remove annotation functions
|
||||
//! @{
|
||||
|
||||
//! Removes the given note from the assembly item.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theDelIfOrphan - deletes the note from the notes hive
|
||||
//! if there are no more assembly items
|
||||
//! linked with the note.
|
||||
//! \return true if the note is removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes the given note from the labeled item.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theDelIfOrphan - deletes the note from the notes hive
|
||||
//! if there are no more labeled items
|
||||
//! linked with the note.
|
||||
//! \return true if the note is removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveNote(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes the given note from the assembly item's subshape.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theSubshapeIndex - assembly item's subshape index.
|
||||
//! \param [in] theDelIfOrphan - deletes the note from the notes hive
|
||||
//! if there are no more assembly item's
|
||||
//! subshape linked with the note.
|
||||
//! \return true if the note is removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveSubshapeNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes the given note from the labeled item's subshape.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theSubshapeIndex - labeled item's subshape index.
|
||||
//! \param [in] theDelIfOrphan - deletes the note from the notes hive
|
||||
//! if there are no more assembly item's
|
||||
//! subshape linked with the note.
|
||||
//! \return true if the note is removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveSubshapeNote(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes a note from the assembly item's attribute.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theGUID - assembly item's attribute GUID.
|
||||
//! \param [in] theDelIfOrphan - deletes the note from the notes hive
|
||||
//! if there are no more assembly item's
|
||||
//! attribute linked with the note.
|
||||
//! \return true if the note is removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveAttrNote(const TDF_Label& theNoteLabel,
|
||||
const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes a note from the labeled item's attribute.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theGUID - labeled item's attribute GUID.
|
||||
//! \param [in] theDelIfOrphan - deletes the note from the notes hive
|
||||
//! if there are no more assembly item's
|
||||
//! attribute linked with the note.
|
||||
//! \return true if the note is removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveAttrNote(const TDF_Label& theNoteLabel,
|
||||
const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes all notes from the assembly item.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theDelIfOrphan - deletes removed notes from the notes
|
||||
//! hive if there are no more annotated items
|
||||
//! linked with the notes.
|
||||
//! \return true if the notes are removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveAllNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes all notes from the labeled item.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theDelIfOrphan - deletes removed notes from the notes
|
||||
//! hive if there are no more annotated items
|
||||
//! linked with the notes.
|
||||
//! \return true if the notes are removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveAllNotes(const TDF_Label& theItemLabel,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes all notes from the assembly item's subshape.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theSubshapeIndex - assembly item's subshape index.
|
||||
//! \param [in] theDelIfOrphan - deletes removed notes from the notes
|
||||
//! hive if there are no more annotated items
|
||||
//! linked with the notes.
|
||||
//! \return true if the notes are removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveAllSubshapeNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
Standard_Integer theSubshapeIndex,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes all notes from the assembly item's attribute.
|
||||
//! \param [in] theItemId - assembly item ID.
|
||||
//! \param [in] theGUID - assembly item's attribute GUID.
|
||||
//! \param [in] theDelIfOrphan - deletes removed notes from the notes
|
||||
//! hive if there are no more annotated items
|
||||
//! linked with the notes.
|
||||
//! \return true if the notes are removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveAllAttrNotes(const XCAFDoc_AssemblyItemId& theItemId,
|
||||
const Standard_GUID& theGUID,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! Removes all notes from the labeled item's attribute.
|
||||
//! \param [in] theItemLabel - item label.
|
||||
//! \param [in] theGUID - labeled item's attribute GUID.
|
||||
//! \param [in] theDelIfOrphan - deletes removed notes from the notes
|
||||
//! hive if there are no more annotated items
|
||||
//! linked with the notes.
|
||||
//! \return true if the notes are removed, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean RemoveAllAttrNotes(const TDF_Label& theItemLabel,
|
||||
const Standard_GUID& theGUID,
|
||||
Standard_Boolean theDelIfOrphan = Standard_False);
|
||||
|
||||
//! @}
|
||||
|
||||
//! @name Delete note functions
|
||||
//! @{
|
||||
|
||||
//! Deletes the given note.
|
||||
//! Removes all links with items annotated by the note.
|
||||
//! \param [in] theNoteLabel - note label.
|
||||
//! \return true if the note is deleted, otherwise - false.
|
||||
Standard_EXPORT Standard_Boolean DeleteNote(const TDF_Label& theNoteLabel);
|
||||
|
||||
//! Deletes the given notes.
|
||||
//! Removes all links with items annotated by the notes.
|
||||
//! \param [in] theNoteLabels - note label sequence.
|
||||
//! \return number of deleted notes.
|
||||
Standard_EXPORT Standard_Integer DeleteNotes(TDF_LabelSequence& theNoteLabels);
|
||||
|
||||
//! Deletes all notes.
|
||||
//! Clears all annotations.
|
||||
//! \return number of deleted notes.
|
||||
Standard_EXPORT Standard_Integer DeleteAllNotes();
|
||||
|
||||
//! @}
|
||||
|
||||
//! @name Orphan annotated items functions
|
||||
//! @{
|
||||
|
||||
//! Returns number of notes that aren't linked to annotated items.
|
||||
Standard_EXPORT Standard_Integer NbOrphanNotes() const;
|
||||
|
||||
//! Returns note labels that aren't linked to annotated items.
|
||||
//! The label sequence isn't cleared beforehand.
|
||||
//! \param [out] theNoteLabels - sequence of labels.
|
||||
Standard_EXPORT void GetOrphanNotes(TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
//! Deletes all notes that aren't linked to annotated items.
|
||||
//! \return number of deleted notes.
|
||||
Standard_EXPORT Standard_Integer DeleteOrphanNotes();
|
||||
|
||||
//! @}
|
||||
|
||||
public:
|
||||
|
||||
// Overrides TDF_Attribute 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;
|
||||
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
|
||||
|
||||
};
|
||||
|
||||
#endif // _XCAFDoc_NotesTool_HeaderFile
|
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
|
@ -117,6 +117,136 @@ TDF_Label XCAFDoc_ViewTool::AddView()
|
||||
return aViewL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetView
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XCAFDoc_ViewTool::SetView(const TDF_LabelSequence& theShapes,
|
||||
const TDF_LabelSequence& theGDTs,
|
||||
const TDF_LabelSequence& theClippingPlanes,
|
||||
const TDF_LabelSequence& theNotes,
|
||||
const TDF_LabelSequence& theAnnotations,
|
||||
const TDF_Label& theViewL) const
|
||||
{
|
||||
if (!IsView(theViewL))
|
||||
return;
|
||||
|
||||
Handle(XCAFDoc_GraphNode) aChGNode;
|
||||
Handle(XCAFDoc_GraphNode) aShapeGNode;
|
||||
Handle(XCAFDoc_GraphNode) aGDTGNode;
|
||||
Handle(XCAFDoc_GraphNode) aPlaneGNode;
|
||||
Handle(XCAFDoc_GraphNode) aNoteGNode;
|
||||
Handle(XCAFDoc_GraphNode) aAnnotGNode;
|
||||
|
||||
if (theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode)) {
|
||||
while (aChGNode->NbFathers() > 0) {
|
||||
aShapeGNode = aChGNode->GetFather(1);
|
||||
aShapeGNode->UnSetChild(aChGNode);
|
||||
if (aShapeGNode->NbChildren() == 0)
|
||||
aShapeGNode->ForgetAttribute(XCAFDoc::ViewRefShapeGUID());
|
||||
}
|
||||
theViewL.ForgetAttribute(XCAFDoc::ViewRefShapeGUID());
|
||||
}
|
||||
if (theViewL.FindAttribute(XCAFDoc::ViewRefGDTGUID(), aChGNode)) {
|
||||
while (aChGNode->NbFathers() > 0) {
|
||||
aGDTGNode = aChGNode->GetFather(1);
|
||||
aGDTGNode->UnSetChild(aChGNode);
|
||||
if (aGDTGNode->NbChildren() == 0)
|
||||
aGDTGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID());
|
||||
}
|
||||
theViewL.ForgetAttribute(XCAFDoc::ViewRefGDTGUID());
|
||||
}
|
||||
if (theViewL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aChGNode)) {
|
||||
while (aChGNode->NbFathers() > 0) {
|
||||
aPlaneGNode = aChGNode->GetFather(1);
|
||||
aPlaneGNode->UnSetChild(aChGNode);
|
||||
if (aPlaneGNode->NbChildren() == 0)
|
||||
aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID());
|
||||
}
|
||||
theViewL.ForgetAttribute(XCAFDoc::ViewRefPlaneGUID());
|
||||
}
|
||||
|
||||
if (!theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode) && theShapes.Length() > 0) {
|
||||
aChGNode = new XCAFDoc_GraphNode;
|
||||
aChGNode = XCAFDoc_GraphNode::Set(theViewL);
|
||||
aChGNode->SetGraphID(XCAFDoc::ViewRefShapeGUID());
|
||||
}
|
||||
for (Standard_Integer i = theShapes.Lower(); i <= theShapes.Upper(); i++)
|
||||
{
|
||||
if (!theShapes.Value(i).FindAttribute(XCAFDoc::ViewRefShapeGUID(), aShapeGNode)) {
|
||||
aShapeGNode = new XCAFDoc_GraphNode;
|
||||
aShapeGNode = XCAFDoc_GraphNode::Set(theShapes.Value(i));
|
||||
}
|
||||
aShapeGNode->SetGraphID(XCAFDoc::ViewRefShapeGUID());
|
||||
aShapeGNode->SetChild(aChGNode);
|
||||
aChGNode->SetFather(aShapeGNode);
|
||||
}
|
||||
|
||||
if (!theViewL.FindAttribute(XCAFDoc::ViewRefGDTGUID(), aChGNode) && theGDTs.Length() > 0) {
|
||||
aChGNode = new XCAFDoc_GraphNode;
|
||||
aChGNode = XCAFDoc_GraphNode::Set(theViewL);
|
||||
aChGNode->SetGraphID(XCAFDoc::ViewRefGDTGUID());
|
||||
}
|
||||
for (Standard_Integer i = theGDTs.Lower(); i <= theGDTs.Upper(); i++)
|
||||
{
|
||||
if (!theGDTs.Value(i).FindAttribute(XCAFDoc::ViewRefGDTGUID(), aGDTGNode)) {
|
||||
aGDTGNode = new XCAFDoc_GraphNode;
|
||||
aGDTGNode = XCAFDoc_GraphNode::Set(theGDTs.Value(i));
|
||||
}
|
||||
aGDTGNode->SetGraphID(XCAFDoc::ViewRefGDTGUID());
|
||||
aGDTGNode->SetChild(aChGNode);
|
||||
aChGNode->SetFather(aGDTGNode);
|
||||
}
|
||||
|
||||
if (!theViewL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aChGNode) && theClippingPlanes.Length() > 0) {
|
||||
aChGNode = new XCAFDoc_GraphNode;
|
||||
aChGNode = XCAFDoc_GraphNode::Set(theViewL);
|
||||
aChGNode->SetGraphID(XCAFDoc::ViewRefPlaneGUID());
|
||||
}
|
||||
for (Standard_Integer i = theClippingPlanes.Lower(); i <= theClippingPlanes.Upper(); i++)
|
||||
{
|
||||
if (!theClippingPlanes.Value(i).FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aPlaneGNode)) {
|
||||
aPlaneGNode = new XCAFDoc_GraphNode;
|
||||
aPlaneGNode = XCAFDoc_GraphNode::Set(theClippingPlanes.Value(i));
|
||||
}
|
||||
aPlaneGNode->SetGraphID(XCAFDoc::ViewRefPlaneGUID());
|
||||
aPlaneGNode->SetChild(aChGNode);
|
||||
aChGNode->SetFather(aPlaneGNode);
|
||||
}
|
||||
|
||||
if (!theViewL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aChGNode) && theClippingPlanes.Length() > 0) {
|
||||
aChGNode = new XCAFDoc_GraphNode;
|
||||
aChGNode = XCAFDoc_GraphNode::Set(theViewL);
|
||||
aChGNode->SetGraphID(XCAFDoc::ViewRefPlaneGUID());
|
||||
}
|
||||
for (Standard_Integer i = theNotes.Lower(); i <= theNotes.Upper(); i++)
|
||||
{
|
||||
if (!theNotes.Value(i).FindAttribute(XCAFDoc::ViewRefNoteGUID(), aNoteGNode)) {
|
||||
aNoteGNode = new XCAFDoc_GraphNode;
|
||||
aNoteGNode = XCAFDoc_GraphNode::Set(theNotes.Value(i));
|
||||
}
|
||||
aNoteGNode->SetGraphID(XCAFDoc::ViewRefNoteGUID());
|
||||
aNoteGNode->SetChild(aChGNode);
|
||||
aChGNode->SetFather(aNoteGNode);
|
||||
}
|
||||
|
||||
if (!theViewL.FindAttribute(XCAFDoc::ViewRefAnnotationGUID(), aChGNode) && theAnnotations.Length() > 0) {
|
||||
aChGNode = new XCAFDoc_GraphNode;
|
||||
aChGNode = XCAFDoc_GraphNode::Set(theViewL);
|
||||
aChGNode->SetGraphID(XCAFDoc::ViewRefAnnotationGUID());
|
||||
}
|
||||
for (Standard_Integer i = theAnnotations.Lower(); i <= theAnnotations.Upper(); i++)
|
||||
{
|
||||
if (!theAnnotations.Value(i).FindAttribute(XCAFDoc::ViewRefAnnotationGUID(), aNoteGNode)) {
|
||||
aAnnotGNode = new XCAFDoc_GraphNode;
|
||||
aAnnotGNode = XCAFDoc_GraphNode::Set(theNotes.Value(i));
|
||||
}
|
||||
aAnnotGNode->SetGraphID(XCAFDoc::ViewRefAnnotationGUID());
|
||||
aAnnotGNode->SetChild(aChGNode);
|
||||
aChGNode->SetFather(aAnnotGNode);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetView
|
||||
//purpose :
|
||||
@ -431,6 +561,54 @@ Standard_Boolean XCAFDoc_ViewTool::GetRefClippingPlaneLabel(const TDF_Label& the
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetRefNoteLabel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XCAFDoc_ViewTool::GetRefNoteLabel(const TDF_Label& theViewL,
|
||||
TDF_LabelSequence& theNoteLabels) const
|
||||
{
|
||||
theNoteLabels.Clear();
|
||||
Handle(TDataStd_TreeNode) aNode;
|
||||
if (!theViewL.FindAttribute(XCAFDoc::ViewRefGUID(), aNode) || !aNode->HasFather()) {
|
||||
Handle(XCAFDoc_GraphNode) aGNode;
|
||||
if (theViewL.FindAttribute(XCAFDoc::ViewRefNoteGUID(), aGNode) && aGNode->NbFathers() > 0) {
|
||||
for (Standard_Integer i = 1; i <= aGNode->NbFathers(); i++)
|
||||
theNoteLabels.Append(aGNode->GetFather(i)->Label());
|
||||
return Standard_True;
|
||||
}
|
||||
else
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theNoteLabels.Append(aNode->Father()->Label());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetRefAnnotationLabel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XCAFDoc_ViewTool::GetRefAnnotationLabel(const TDF_Label& theViewL,
|
||||
TDF_LabelSequence& theAnnotationLabels) const
|
||||
{
|
||||
theAnnotationLabels.Clear();
|
||||
Handle(TDataStd_TreeNode) aNode;
|
||||
if (!theViewL.FindAttribute(XCAFDoc::ViewRefGUID(), aNode) || !aNode->HasFather()) {
|
||||
Handle(XCAFDoc_GraphNode) aGNode;
|
||||
if (theViewL.FindAttribute(XCAFDoc::ViewRefAnnotationGUID(), aGNode) && aGNode->NbFathers() > 0) {
|
||||
for (Standard_Integer i = 1; i <= aGNode->NbFathers(); i++)
|
||||
theAnnotationLabels.Append(aGNode->GetFather(i)->Label());
|
||||
return Standard_True;
|
||||
}
|
||||
else
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theAnnotationLabels.Append(aNode->Father()->Label());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetViewLabelsForShape
|
||||
//purpose :
|
||||
@ -488,6 +666,44 @@ Standard_Boolean XCAFDoc_ViewTool::GetViewLabelsForClippingPlane(const TDF_Label
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetViewLabelsForNote
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XCAFDoc_ViewTool::GetViewLabelsForNote(const TDF_Label& theNoteL,
|
||||
TDF_LabelSequence& theViews) const
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aGNode;
|
||||
Standard_Boolean aResult = Standard_False;
|
||||
if (theNoteL.FindAttribute(XCAFDoc::ViewRefNoteGUID(), aGNode) && aGNode->NbChildren() > 0) {
|
||||
for (Standard_Integer i = 1; i <= aGNode->NbChildren(); i++)
|
||||
{
|
||||
theViews.Append(aGNode->GetChild(i)->Label());
|
||||
}
|
||||
aResult = Standard_True;
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetViewLabelsForAnnotation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XCAFDoc_ViewTool::GetViewLabelsForAnnotation(const TDF_Label& theAnnotationL,
|
||||
TDF_LabelSequence& theViews) const
|
||||
{
|
||||
Handle(XCAFDoc_GraphNode) aGNode;
|
||||
Standard_Boolean aResult = Standard_False;
|
||||
if (theAnnotationL.FindAttribute(XCAFDoc::ViewRefAnnotationGUID(), aGNode) && aGNode->NbChildren() > 0) {
|
||||
for (Standard_Integer i = 1; i <= aGNode->NbChildren(); i++)
|
||||
{
|
||||
theViews.Append(aGNode->GetChild(i)->Label());
|
||||
}
|
||||
aResult = Standard_True;
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsLocked
|
||||
//purpose :
|
||||
|
@ -63,7 +63,15 @@ public:
|
||||
//! Returns a sequence of View labels currently stored
|
||||
//! in the View table
|
||||
Standard_EXPORT void GetViewLabels (TDF_LabelSequence& theLabels) const;
|
||||
|
||||
|
||||
//! Sets a link with GUID
|
||||
Standard_EXPORT void SetView(const TDF_LabelSequence& theShapes,
|
||||
const TDF_LabelSequence& theGDTs,
|
||||
const TDF_LabelSequence& theClippingPlanes,
|
||||
const TDF_LabelSequence& theNotes,
|
||||
const TDF_LabelSequence& theAnnotations,
|
||||
const TDF_Label& theViewL) const;
|
||||
|
||||
//! Sets a link with GUID
|
||||
Standard_EXPORT void SetView (const TDF_LabelSequence& theShapes,
|
||||
const TDF_LabelSequence& theGDTs,
|
||||
@ -90,7 +98,13 @@ public:
|
||||
|
||||
//! Returns all View labels defined for label ClippingPlaneL
|
||||
Standard_EXPORT Standard_Boolean GetViewLabelsForClippingPlane(const TDF_Label& theClippingPlaneL, TDF_LabelSequence& theViews) const;
|
||||
|
||||
|
||||
//! Returns all View labels defined for label NoteL
|
||||
Standard_EXPORT Standard_Boolean GetViewLabelsForNote(const TDF_Label& theNoteL, TDF_LabelSequence& theViews) const;
|
||||
|
||||
//! Returns all View labels defined for label AnnotationL
|
||||
Standard_EXPORT Standard_Boolean GetViewLabelsForAnnotation(const TDF_Label& theAnnotationL, TDF_LabelSequence& theViews) const;
|
||||
|
||||
//! Adds a view definition to a View table and returns its label
|
||||
Standard_EXPORT TDF_Label AddView() ;
|
||||
|
||||
@ -106,6 +120,14 @@ public:
|
||||
//! Returns False if the theViewL is not in View table
|
||||
Standard_EXPORT Standard_Boolean GetRefClippingPlaneLabel(const TDF_Label& theViewL, TDF_LabelSequence& theClippingPlaneLabels) const;
|
||||
|
||||
//! Returns Notes labels defined for label theViewL
|
||||
//! Returns False if the theViewL is not in View table
|
||||
Standard_EXPORT Standard_Boolean GetRefNoteLabel(const TDF_Label& theViewL, TDF_LabelSequence& theNoteLabels) const;
|
||||
|
||||
//! Returns Annotation labels defined for label theViewL
|
||||
//! Returns False if the theViewL is not in View table
|
||||
Standard_EXPORT Standard_Boolean GetRefAnnotationLabel(const TDF_Label& theViewL, TDF_LabelSequence& theAnnotationLabels) const;
|
||||
|
||||
//! Returns true if the given View is marked as locked
|
||||
Standard_EXPORT Standard_Boolean IsLocked(const TDF_Label& theViewL) const;
|
||||
|
||||
|
@ -14,3 +14,5 @@ XDEDRAW_Shapes.cxx
|
||||
XDEDRAW_Shapes.hxx
|
||||
XDEDRAW_Views.cxx
|
||||
XDEDRAW_Views.hxx
|
||||
XDEDRAW_Notes.cxx
|
||||
XDEDRAW_Notes.hxx
|
||||
|
@ -87,6 +87,7 @@
|
||||
#include <XDEDRAW_Shapes.hxx>
|
||||
#include <XDEDRAW_GDTs.hxx>
|
||||
#include <XDEDRAW_Views.hxx>
|
||||
#include <XDEDRAW_Notes.hxx>
|
||||
#include <XSDRAW.hxx>
|
||||
#include <XSDRAWIGES.hxx>
|
||||
#include <XSDRAWSTEP.hxx>
|
||||
@ -1171,6 +1172,7 @@ void XDEDRAW::Init(Draw_Interpretor& di)
|
||||
XDEDRAW_Props::InitCommands ( di );
|
||||
XDEDRAW_GDTs::InitCommands ( di );
|
||||
XDEDRAW_Views::InitCommands(di);
|
||||
XDEDRAW_Notes::InitCommands(di);
|
||||
XDEDRAW_Common::InitCommands ( di );//moved from EXE
|
||||
|
||||
}
|
||||
|
1438
src/XDEDRAW/XDEDRAW_Notes.cxx
Normal file
1438
src/XDEDRAW/XDEDRAW_Notes.cxx
Normal file
File diff suppressed because it is too large
Load Diff
35
src/XDEDRAW/XDEDRAW_Notes.hxx
Normal file
35
src/XDEDRAW/XDEDRAW_Notes.hxx
Normal file
@ -0,0 +1,35 @@
|
||||
// Created on: 2017-08-09
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _XDEDRAW_Notes_HeaderFile
|
||||
#define _XDEDRAW_Notes_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Draw_Interpretor.hxx>
|
||||
|
||||
//! Contains commands to work with notes
|
||||
class XDEDRAW_Notes
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands);
|
||||
};
|
||||
|
||||
#endif // _XDEDRAW_Notes_HeaderFile
|
@ -1,5 +1,7 @@
|
||||
XmlMXCAFDoc.cxx
|
||||
XmlMXCAFDoc.hxx
|
||||
XmlMXCAFDoc_AssemblyItemRefDriver.cxx
|
||||
XmlMXCAFDoc_AssemblyItemRefDriver.hxx
|
||||
XmlMXCAFDoc_AreaDriver.cxx
|
||||
XmlMXCAFDoc_AreaDriver.hxx
|
||||
XmlMXCAFDoc_CentroidDriver.cxx
|
||||
@ -29,6 +31,16 @@ XmlMXCAFDoc_MaterialDriver.cxx
|
||||
XmlMXCAFDoc_MaterialDriver.hxx
|
||||
XmlMXCAFDoc_MaterialToolDriver.cxx
|
||||
XmlMXCAFDoc_MaterialToolDriver.hxx
|
||||
XmlMXCAFDoc_NoteDriver.cxx
|
||||
XmlMXCAFDoc_NoteDriver.hxx
|
||||
XmlMXCAFDoc_NoteBalloonDriver.cxx
|
||||
XmlMXCAFDoc_NoteBalloonDriver.hxx
|
||||
XmlMXCAFDoc_NoteCommentDriver.cxx
|
||||
XmlMXCAFDoc_NoteCommentDriver.hxx
|
||||
XmlMXCAFDoc_NoteBinDataDriver.cxx
|
||||
XmlMXCAFDoc_NoteBinDataDriver.hxx
|
||||
XmlMXCAFDoc_NotesToolDriver.cxx
|
||||
XmlMXCAFDoc_NotesToolDriver.hxx
|
||||
XmlMXCAFDoc_ShapeToolDriver.cxx
|
||||
XmlMXCAFDoc_ShapeToolDriver.hxx
|
||||
XmlMXCAFDoc_ViewToolDriver.cxx
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <XmlMDF_ADriverTable.hxx>
|
||||
#include <XmlMNaming_NamedShapeDriver.hxx>
|
||||
#include <XmlMXCAFDoc.hxx>
|
||||
#include <XmlMXCAFDoc_AssemblyItemRefDriver.hxx>
|
||||
#include <XmlMXCAFDoc_AreaDriver.hxx>
|
||||
#include <XmlMXCAFDoc_CentroidDriver.hxx>
|
||||
#include <XmlMXCAFDoc_ClippingPlaneToolDriver.hxx>
|
||||
@ -32,6 +33,10 @@
|
||||
#include <XmlMXCAFDoc_LayerToolDriver.hxx>
|
||||
#include <XmlMXCAFDoc_LocationDriver.hxx>
|
||||
#include <XmlMXCAFDoc_MaterialDriver.hxx>
|
||||
#include <XmlMXCAFDoc_NotesToolDriver.hxx>
|
||||
#include <XmlMXCAFDoc_NoteBalloonDriver.hxx>
|
||||
#include <XmlMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <XmlMXCAFDoc_NoteBinDataDriver.hxx>
|
||||
#include <XmlMXCAFDoc_MaterialToolDriver.hxx>
|
||||
#include <XmlMXCAFDoc_ShapeToolDriver.hxx>
|
||||
#include <XmlMXCAFDoc_ViewToolDriver.hxx>
|
||||
@ -61,11 +66,15 @@ void XmlMXCAFDoc::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
|
||||
aLocationDriver->SetSharedLocations( &(aNamedShapeDriver->GetShapesLocations()) );
|
||||
}
|
||||
|
||||
aDriverTable -> AddDriver( aLocationDriver);
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_VolumeDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_DatumDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_DimTolDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_MaterialDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (aLocationDriver);
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_AssemblyItemRefDriver(anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_VolumeDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_DatumDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_DimTolDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_MaterialDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_NoteBalloonDriver(anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_NoteCommentDriver(anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_NoteBinDataDriver(anMsgDrv));
|
||||
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_ColorToolDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_DocumentToolDriver (anMsgDrv));
|
||||
@ -73,6 +82,7 @@ void XmlMXCAFDoc::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_ShapeToolDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_DimTolToolDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_MaterialToolDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_NotesToolDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_ViewToolDriver (anMsgDrv));
|
||||
aDriverTable -> AddDriver (new XmlMXCAFDoc_ClippingPlaneToolDriver(anMsgDrv));
|
||||
}
|
||||
|
@ -31,6 +31,10 @@ class XmlMXCAFDoc_VolumeDriver;
|
||||
class XmlMXCAFDoc_DatumDriver;
|
||||
class XmlMXCAFDoc_DimTolDriver;
|
||||
class XmlMXCAFDoc_MaterialDriver;
|
||||
class XmlMXCAFDoc_NotesToolDriver;
|
||||
class XmlMXCAFDoc_NoteDriver;
|
||||
class XmlMXCAFDoc_NoteCommentDriver;
|
||||
class XmlMXCAFDoc_NoteBinDataDriver;
|
||||
class XmlMXCAFDoc_ClippingPlaneToolDriver;
|
||||
class XmlMXCAFDoc_ColorToolDriver;
|
||||
class XmlMXCAFDoc_DocumentToolDriver;
|
||||
|
117
src/XmlMXCAFDoc/XmlMXCAFDoc_AssemblyItemRefDriver.cxx
Normal file
117
src/XmlMXCAFDoc/XmlMXCAFDoc_AssemblyItemRefDriver.cxx
Normal file
@ -0,0 +1,117 @@
|
||||
// Created on: 2017-02-14
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_AssemblyItemRef.hxx>
|
||||
#include <XmlMXCAFDoc_AssemblyItemRefDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_AssemblyItemRefDriver, XmlMDF_ADriver)
|
||||
IMPLEMENT_DOMSTRING(Path, "path")
|
||||
IMPLEMENT_DOMSTRING(AttrGUID, "guid")
|
||||
IMPLEMENT_DOMSTRING(SubshapeIndex, "subshape_index")
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XmlMXCAFDoc_AssemblyItemRefDriver::XmlMXCAFDoc_AssemblyItemRefDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: XmlMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_AssemblyItemRef)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) XmlMXCAFDoc_AssemblyItemRefDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_AssemblyItemRef();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlMXCAFDoc_AssemblyItemRefDriver::Paste(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
const XmlObjMgt_Element& anElement = theSource;
|
||||
|
||||
XmlObjMgt_DOMString aPath = anElement.getAttribute(::Path());
|
||||
if (aPath == NULL)
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theTarget);
|
||||
if (aThis.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
aThis->SetItem(aPath.GetString());
|
||||
|
||||
XmlObjMgt_DOMString anAttrGUID = anElement.getAttribute(::AttrGUID());
|
||||
if (anAttrGUID != NULL)
|
||||
{
|
||||
Standard_GUID aGUID(anAttrGUID.GetString());
|
||||
aThis->SetGUID(aGUID);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
XmlObjMgt_DOMString aSubshapeIndex = anElement.getAttribute(::SubshapeIndex());
|
||||
if (aSubshapeIndex != NULL)
|
||||
{
|
||||
Standard_Integer anIndex;
|
||||
if (!aSubshapeIndex.GetInteger(anIndex))
|
||||
return Standard_False;
|
||||
|
||||
aThis->SetSubshapeIndex(anIndex);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlMXCAFDoc_AssemblyItemRefDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theSource);
|
||||
|
||||
XmlObjMgt_DOMString aPath(aThis->GetItem().ToString().ToCString());
|
||||
theTarget.Element().setAttribute(::Path(), aPath);
|
||||
|
||||
if (aThis->IsGUID())
|
||||
{
|
||||
Standard_GUID aGUID = aThis->GetGUID();
|
||||
Standard_Character aGUIDStr[Standard_GUID_SIZE + 1];
|
||||
aGUID.ToCString(aGUIDStr);
|
||||
aGUIDStr[Standard_GUID_SIZE] = '\0';
|
||||
XmlObjMgt_DOMString anAttrGUID(aGUIDStr);
|
||||
theTarget.Element().setAttribute(::AttrGUID(), anAttrGUID);
|
||||
}
|
||||
else if (aThis->IsSubshapeIndex())
|
||||
{
|
||||
TCollection_AsciiString aSubshapeIndexStr(aThis->GetSubshapeIndex());
|
||||
XmlObjMgt_DOMString aSubshapeIndex(aSubshapeIndexStr.ToCString());
|
||||
theTarget.Element().setAttribute(::SubshapeIndex(), aSubshapeIndex);
|
||||
}
|
||||
|
||||
}
|
55
src/XmlMXCAFDoc/XmlMXCAFDoc_AssemblyItemRefDriver.hxx
Normal file
55
src/XmlMXCAFDoc/XmlMXCAFDoc_AssemblyItemRefDriver.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
|
52
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteBalloonDriver.cxx
Normal file
52
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteBalloonDriver.cxx
Normal file
@ -0,0 +1,52 @@
|
||||
// Created on: 2017-08-10
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_NoteBalloon.hxx>
|
||||
#include <XmlMXCAFDoc_NoteBalloonDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteBalloonDriver, XmlMXCAFDoc_NoteCommentDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XmlMXCAFDoc_NoteBalloonDriver::XmlMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: XmlMXCAFDoc_NoteCommentDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBalloon)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) XmlMXCAFDoc_NoteBalloonDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteBalloon();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XmlMXCAFDoc_NoteBalloonDriver::XmlMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: XmlMXCAFDoc_NoteCommentDriver(theMsgDriver, theName)
|
||||
{
|
||||
|
||||
}
|
42
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteBalloonDriver.hxx
Normal file
42
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteBalloonDriver.hxx
Normal file
@ -0,0 +1,42 @@
|
||||
// Created on: 2017-08-10
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _XmlMXCAFDoc_NoteBalloonDriver_HeaderFile
|
||||
#define _XmlMXCAFDoc_NoteBalloonDriver_HeaderFile
|
||||
|
||||
#include <XmlMXCAFDoc_NoteCommentDriver.hxx>
|
||||
|
||||
class XmlMXCAFDoc_NoteBalloonDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NoteBalloonDriver, XmlMXCAFDoc_NoteCommentDriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMXCAFDoc_NoteBalloonDriver : public XmlMXCAFDoc_NoteCommentDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT XmlMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMessageDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteBalloonDriver, XmlMXCAFDoc_NoteCommentDriver)
|
||||
|
||||
protected:
|
||||
|
||||
XmlMXCAFDoc_NoteBalloonDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName);
|
||||
|
||||
};
|
||||
|
||||
#endif // _XmlMXCAFDoc_NoteBalloonDriver_HeaderFile
|
121
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteBinDataDriver.cxx
Normal file
121
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteBinDataDriver.cxx
Normal file
@ -0,0 +1,121 @@
|
||||
// Created on: 2017-02-14
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_NoteBinData.hxx>
|
||||
#include <XmlObjMgt.hxx>
|
||||
#include <XmlMXCAFDoc_NoteBinDataDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
#include <LDOM_OSStream.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteBinDataDriver, XmlMXCAFDoc_NoteDriver)
|
||||
IMPLEMENT_DOMSTRING(Title, "title")
|
||||
IMPLEMENT_DOMSTRING(MIMEtype, "mime_type")
|
||||
IMPLEMENT_DOMSTRING(Size, "size")
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XmlMXCAFDoc_NoteBinDataDriver::XmlMXCAFDoc_NoteBinDataDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: XmlMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBinData)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) XmlMXCAFDoc_NoteBinDataDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteBinData();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlMXCAFDoc_NoteBinDataDriver::Paste(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
XmlMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
const XmlObjMgt_Element& anElement = theSource;
|
||||
|
||||
XmlObjMgt_DOMString aTitle = anElement.getAttribute(::Title());
|
||||
XmlObjMgt_DOMString aMIMEtype = anElement.getAttribute(::MIMEtype());
|
||||
XmlObjMgt_DOMString aSize = anElement.getAttribute(::Size());
|
||||
if (aTitle == NULL || aMIMEtype == NULL || aSize == NULL)
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Standard_Integer nbSize = 0;
|
||||
if (!aSize.GetInteger(nbSize))
|
||||
return Standard_False;
|
||||
|
||||
XmlObjMgt_DOMString aDataStr = XmlObjMgt::GetStringValue(theSource);
|
||||
Standard_SStream anSS(aDataStr.GetString());
|
||||
|
||||
Handle(TColStd_HArray1OfByte) aData = new TColStd_HArray1OfByte(1, nbSize);
|
||||
for (Standard_Integer i = 1; i <= nbSize; ++i)
|
||||
{
|
||||
Standard_Byte aValue;
|
||||
anSS >> aValue;
|
||||
aData->ChangeValue(i) = aValue;
|
||||
}
|
||||
|
||||
aNote->Set(aTitle.GetString(), aMIMEtype.GetString(), aData);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlMXCAFDoc_NoteBinDataDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
XmlMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theSource);
|
||||
|
||||
XmlObjMgt_DOMString aTitle(TCollection_AsciiString(aNote->Title()).ToCString());
|
||||
XmlObjMgt_DOMString aMIMEtype(aNote->MIMEtype().ToCString());
|
||||
|
||||
theTarget.Element().setAttribute(::Title(), aTitle);
|
||||
theTarget.Element().setAttribute(::MIMEtype(), aMIMEtype);
|
||||
theTarget.Element().setAttribute(::Size(), aNote->Size());
|
||||
|
||||
if (aNote->Size() > 0)
|
||||
{
|
||||
const Handle(TColStd_HArray1OfByte)& aData = aNote->Data();
|
||||
LDOM_OSStream anOSS(aNote->Size());
|
||||
for (Standard_Integer i = aData->Lower(); i <= aData->Upper(); ++i)
|
||||
{
|
||||
anOSS << std::hex << aData->Value(i);
|
||||
}
|
||||
Standard_Character* dump = (Standard_Character*)anOSS.str(); // copying! Don't forget to delete it.
|
||||
XmlObjMgt::SetStringValue(theTarget, dump, Standard_True);
|
||||
delete[] dump;
|
||||
}
|
||||
}
|
45
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteBinDataDriver.hxx
Normal file
45
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteBinDataDriver.hxx
Normal file
@ -0,0 +1,45 @@
|
||||
// Created on: 2017-02-14
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _XmlMXCAFDoc_NoteBinDataDriver_HeaderFile
|
||||
#define _XmlMXCAFDoc_NoteBinDataDriver_HeaderFile
|
||||
|
||||
#include <XmlMXCAFDoc_NoteDriver.hxx>
|
||||
|
||||
class XmlMXCAFDoc_NoteBinDataDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NoteBinDataDriver, XmlMXCAFDoc_NoteDriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMXCAFDoc_NoteBinDataDriver : public XmlMXCAFDoc_NoteDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT XmlMXCAFDoc_NoteBinDataDriver(const Handle(CDM_MessageDriver)& theMessageDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteBinDataDriver, XmlMXCAFDoc_NoteDriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _XmlMXCAFDoc_NoteBinDataDriver_HeaderFile
|
95
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteCommentDriver.cxx
Normal file
95
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteCommentDriver.cxx
Normal file
@ -0,0 +1,95 @@
|
||||
// Created on: 2017-02-14
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_NoteComment.hxx>
|
||||
#include <XmlMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteCommentDriver, XmlMXCAFDoc_NoteDriver)
|
||||
IMPLEMENT_DOMSTRING(Comment, "comment")
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XmlMXCAFDoc_NoteCommentDriver::XmlMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: XmlMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteComment)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) XmlMXCAFDoc_NoteCommentDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteComment();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlMXCAFDoc_NoteCommentDriver::Paste(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
XmlMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
const XmlObjMgt_Element& anElement = theSource;
|
||||
|
||||
XmlObjMgt_DOMString aComment = anElement.getAttribute(::Comment());
|
||||
if (aComment == NULL)
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
aNote->Set(aComment.GetString());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlMXCAFDoc_NoteCommentDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
XmlMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theSource);
|
||||
|
||||
XmlObjMgt_DOMString aComment(TCollection_AsciiString(aNote->TimeStamp()).ToCString());
|
||||
|
||||
theTarget.Element().setAttribute(::Comment(), aComment);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XmlMXCAFDoc_NoteCommentDriver::XmlMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: XmlMXCAFDoc_NoteDriver(theMsgDriver, theName)
|
||||
{
|
||||
|
||||
}
|
50
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteCommentDriver.hxx
Normal file
50
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteCommentDriver.hxx
Normal file
@ -0,0 +1,50 @@
|
||||
// Created on: 2017-02-14
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _XmlMXCAFDoc_NoteCommentDriver_HeaderFile
|
||||
#define _XmlMXCAFDoc_NoteCommentDriver_HeaderFile
|
||||
|
||||
#include <XmlMXCAFDoc_NoteDriver.hxx>
|
||||
|
||||
class XmlMXCAFDoc_NoteCommentDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NoteCommentDriver, XmlMXCAFDoc_NoteDriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMXCAFDoc_NoteCommentDriver : public XmlMXCAFDoc_NoteDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT XmlMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMessageDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteCommentDriver, XmlMXCAFDoc_NoteDriver)
|
||||
|
||||
protected:
|
||||
|
||||
XmlMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName);
|
||||
|
||||
};
|
||||
|
||||
#endif // _XmlMXCAFDoc_NoteCommentDriver_HeaderFile
|
78
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteDriver.cxx
Normal file
78
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteDriver.cxx
Normal file
@ -0,0 +1,78 @@
|
||||
// Created on: 2017-02-14
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_Note.hxx>
|
||||
#include <XmlMXCAFDoc_NoteDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteDriver, XmlMDF_ADriver)
|
||||
IMPLEMENT_DOMSTRING(UserName, "user_name")
|
||||
IMPLEMENT_DOMSTRING(TimeStamp, "time_stamp")
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XmlMXCAFDoc_NoteDriver::XmlMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: XmlMDF_ADriver(theMsgDriver, theName)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlMXCAFDoc_NoteDriver::Paste(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
const XmlObjMgt_Element& anElement = theSource;
|
||||
|
||||
XmlObjMgt_DOMString aUserName = anElement.getAttribute(::UserName());
|
||||
XmlObjMgt_DOMString aTimeStamp = anElement.getAttribute(::TimeStamp());
|
||||
if (aUserName == NULL || aTimeStamp == NULL)
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
aNote->Set(aUserName.GetString(), aTimeStamp.GetString());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlMXCAFDoc_NoteDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theSource);
|
||||
if (aNote.IsNull())
|
||||
return;
|
||||
|
||||
XmlObjMgt_DOMString aUserName(TCollection_AsciiString(aNote->UserName()).ToCString());
|
||||
XmlObjMgt_DOMString aTimeStamp(TCollection_AsciiString(aNote->TimeStamp()).ToCString());
|
||||
|
||||
theTarget.Element().setAttribute(::UserName(), aUserName);
|
||||
theTarget.Element().setAttribute(::TimeStamp(), aTimeStamp);
|
||||
}
|
56
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteDriver.hxx
Normal file
56
src/XmlMXCAFDoc/XmlMXCAFDoc_NoteDriver.hxx
Normal file
@ -0,0 +1,56 @@
|
||||
// Created on: 2017-02-14
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _XmlMXCAFDoc_NoteDriver_HeaderFile
|
||||
#define _XmlMXCAFDoc_NoteDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <XmlMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <XmlObjMgt_RRelocationTable.hxx>
|
||||
#include <XmlObjMgt_SRelocationTable.hxx>
|
||||
|
||||
class CDM_MessageDriver;
|
||||
class TDF_Attribute;
|
||||
class XmlObjMgt_Persistent;
|
||||
|
||||
class XmlMXCAFDoc_NoteDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NoteDriver, XmlMDF_ADriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMXCAFDoc_NoteDriver : public XmlMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteDriver, XmlMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
XmlMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName);
|
||||
|
||||
};
|
||||
|
||||
#endif // _XmlMXCAFDoc_NoteDriver_HeaderFile
|
62
src/XmlMXCAFDoc/XmlMXCAFDoc_NotesToolDriver.cxx
Normal file
62
src/XmlMXCAFDoc/XmlMXCAFDoc_NotesToolDriver.cxx
Normal file
@ -0,0 +1,62 @@
|
||||
// Created on: 2017-02-14
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_NotesTool.hxx>
|
||||
#include <XmlMXCAFDoc_NotesToolDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NotesToolDriver, XmlMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XmlMXCAFDoc_NotesToolDriver::XmlMXCAFDoc_NotesToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: XmlMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NotesTool)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) XmlMXCAFDoc_NotesToolDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NotesTool();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlMXCAFDoc_NotesToolDriver::Paste(const XmlObjMgt_Persistent& /*theSource*/,
|
||||
const Handle(TDF_Attribute)& /*theTarget*/,
|
||||
XmlObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlMXCAFDoc_NotesToolDriver::Paste(const Handle(TDF_Attribute)& /*theSource*/,
|
||||
XmlObjMgt_Persistent& /*theTarget*/,
|
||||
XmlObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
}
|
55
src/XmlMXCAFDoc/XmlMXCAFDoc_NotesToolDriver.hxx
Normal file
55
src/XmlMXCAFDoc/XmlMXCAFDoc_NotesToolDriver.hxx
Normal file
@ -0,0 +1,55 @@
|
||||
// Created on: 2017-02-14
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2008-2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _XmlMXCAFDoc_NotesToolDriver_HeaderFile
|
||||
#define _XmlMXCAFDoc_NotesToolDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <XmlMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <XmlObjMgt_RRelocationTable.hxx>
|
||||
#include <XmlObjMgt_SRelocationTable.hxx>
|
||||
|
||||
class CDM_MessageDriver;
|
||||
class TDF_Attribute;
|
||||
class XmlObjMgt_Persistent;
|
||||
|
||||
class XmlMXCAFDoc_NotesToolDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_NotesToolDriver, XmlMDF_ADriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMXCAFDoc_NotesToolDriver : public XmlMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT XmlMXCAFDoc_NotesToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_NotesToolDriver, XmlMDF_ADriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _XmlMXCAFDoc_NotesToolDriver_HeaderFile
|
@ -4,3 +4,4 @@
|
||||
004 export
|
||||
005 presentation
|
||||
006 view
|
||||
007 notes
|
||||
|
5
tests/gdt/notes/A1
Normal file
5
tests/gdt/notes/A1
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 0
|
||||
set nb_notes_result 0
|
||||
set nb_orphan_result 0
|
13
tests/gdt/notes/A2
Normal file
13
tests/gdt/notes/A2
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
# create comment note
|
||||
set comment [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment}
|
||||
|
||||
# create balloon note
|
||||
set balloon [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${balloon}
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 0
|
||||
set nb_notes_result 2
|
||||
set nb_orphan_result 2
|
9
tests/gdt/notes/A3
Normal file
9
tests/gdt/notes/A3
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
# create binary note
|
||||
set data [XNoteCreateBinData D "Binary data" --data "abcdefghijklmnopqrstuvwxyz" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${data}
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 0
|
||||
set nb_notes_result 1
|
||||
set nb_orphan_result 1
|
16
tests/gdt/notes/A4
Normal file
16
tests/gdt/notes/A4
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
# create comment note
|
||||
set comment [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment}
|
||||
|
||||
# create balloon note
|
||||
set balloon [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${balloon}
|
||||
|
||||
# delete comment note
|
||||
XNoteDelete D ${comment}
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 0
|
||||
set nb_notes_result 1
|
||||
set nb_orphan_result 1
|
16
tests/gdt/notes/A5
Normal file
16
tests/gdt/notes/A5
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
# create comment note
|
||||
set comment [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment}
|
||||
|
||||
# create balloon note
|
||||
set balloon [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${balloon}
|
||||
|
||||
# delete comment note
|
||||
XNoteDeleteAll D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 0
|
||||
set nb_notes_result 0
|
||||
set nb_orphan_result 0
|
18
tests/gdt/notes/B1
Normal file
18
tests/gdt/notes/B1
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
# create comment note
|
||||
set comment [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1}]
|
||||
|
||||
# annotate box_2
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_2}]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 2
|
||||
set nb_notes_result 1
|
||||
set nb_orphan_result 0
|
22
tests/gdt/notes/B2
Normal file
22
tests/gdt/notes/B2
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
|
||||
# annotate box_2
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_2}]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 2
|
||||
set nb_notes_result 2
|
||||
set nb_orphan_result 0
|
25
tests/gdt/notes/B3
Normal file
25
tests/gdt/notes/B3
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
|
||||
# annotate box_2
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_2}]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# delete orphan notes
|
||||
XNoteDeleteOrphan D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 2
|
||||
set nb_notes_result 1
|
||||
set nb_orphan_result 0
|
22
tests/gdt/notes/B4
Normal file
22
tests/gdt/notes/B4
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1}]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 1
|
||||
set nb_notes_result 2
|
||||
set nb_orphan_result 0
|
15
tests/gdt/notes/B5
Normal file
15
tests/gdt/notes/B5
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
# create comment note
|
||||
set comment [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment}
|
||||
|
||||
# annotate box_1 attribute
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1} --attr ${guid}]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 1
|
||||
set nb_notes_result 1
|
||||
set nb_orphan_result 0
|
18
tests/gdt/notes/B6
Normal file
18
tests/gdt/notes/B6
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
# create comment note
|
||||
set comment [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1}]
|
||||
|
||||
# annotate box_1 attribute
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1} --attr ${guid}]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 2
|
||||
set nb_notes_result 1
|
||||
set nb_orphan_result 0
|
21
tests/gdt/notes/B7
Normal file
21
tests/gdt/notes/B7
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
# create comment note
|
||||
set comment [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1}]
|
||||
|
||||
# annotate box_1 attribute
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1} --attr ${guid}]
|
||||
|
||||
# annotate box_1 subshape 1
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1} --subshape 1]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 3
|
||||
set nb_notes_result 1
|
||||
set nb_orphan_result 0
|
24
tests/gdt/notes/C1
Normal file
24
tests/gdt/notes/C1
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
# create comment note
|
||||
set comment [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1}]
|
||||
|
||||
# annotate box_2
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_2}]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# delete note
|
||||
XNoteDelete D ${comment}
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 0
|
||||
set nb_notes_result 0
|
||||
set nb_orphan_result 0
|
28
tests/gdt/notes/C2
Normal file
28
tests/gdt/notes/C2
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
|
||||
# annotate box_2
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_2}]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# delete comment_1 note
|
||||
XNoteDelete D ${comment_1}
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 1
|
||||
set nb_notes_result 1
|
||||
set nb_orphan_result 0
|
28
tests/gdt/notes/C3
Normal file
28
tests/gdt/notes/C3
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
|
||||
# annotate box_2
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_2}]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# remove comment_1 annotation
|
||||
XNoteRemove D ${box_1} ${comment_1}
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 1
|
||||
set nb_notes_result 2
|
||||
set nb_orphan_result 1
|
27
tests/gdt/notes/C4
Normal file
27
tests/gdt/notes/C4
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
# create comment note
|
||||
set comment [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1}]
|
||||
|
||||
# annotate box_1 attribute
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1} --attr ${guid}]
|
||||
|
||||
# annotate box_1 subshape 1
|
||||
XNoteRefDump D [XNoteAdd D ${comment} ${box_1} --subshape 1]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# remove attribute annotation
|
||||
XNoteRemove D ${box_1} ${comment} --attr ${guid}
|
||||
|
||||
# remove subshape annotation
|
||||
XNoteRemove D ${box_1} ${comment} --subshape 1
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 1
|
||||
set nb_notes_result 1
|
||||
set nb_orphan_result 0
|
29
tests/gdt/notes/C5
Normal file
29
tests/gdt/notes/C5
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
|
||||
# annotate box_1 attribute
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --attr ${guid}]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1} --attr ${guid}]
|
||||
|
||||
# annotate box_1 subshape 1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --subshape 1]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# remove all attribute annotations
|
||||
XNoteRemoveAll D ${box_1} --attr ${guid}
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 2
|
||||
set nb_notes_result 2
|
||||
set nb_orphan_result 1
|
29
tests/gdt/notes/C6
Normal file
29
tests/gdt/notes/C6
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
|
||||
# annotate box_1 attribute
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --attr ${guid}]
|
||||
|
||||
# annotate box_1 subshape 1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --subshape 1]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1} --subshape 1]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# remove all attribute annotations
|
||||
XNoteRemoveAll D ${box_1} --subshape 1
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 2
|
||||
set nb_notes_result 2
|
||||
set nb_orphan_result 1
|
31
tests/gdt/notes/C7
Normal file
31
tests/gdt/notes/C7
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1}]
|
||||
|
||||
# annotate box_1 attribute
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --attr ${guid}]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1} --attr ${guid}]
|
||||
|
||||
# annotate box_1 subshape 1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --subshape 1]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1} --subshape 1]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# remove all box annotations
|
||||
XNoteRemoveAll D ${box_1}
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 2
|
||||
set nb_notes_result 2
|
||||
set nb_orphan_result 0
|
33
tests/gdt/notes/C8
Normal file
33
tests/gdt/notes/C8
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1}]
|
||||
|
||||
# annotate box_1 attribute
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --attr ${guid}]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1} --attr ${guid}]
|
||||
|
||||
# annotate box_1 subshape 1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --subshape 1]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1} --subshape 1]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# remove all box annotations
|
||||
XNoteRemoveAll D ${box_1}
|
||||
XNoteRemoveAll D ${box_1} --attr ${guid}
|
||||
XNoteRemoveAll D ${box_1} --subshape 1
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 0
|
||||
set nb_notes_result 2
|
||||
set nb_orphan_result 2
|
33
tests/gdt/notes/C9
Normal file
33
tests/gdt/notes/C9
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1}]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1}]
|
||||
|
||||
# annotate box_1 attribute
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --attr ${guid}]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1} --attr ${guid}]
|
||||
|
||||
# annotate box_1 subshape 1
|
||||
XNoteRefDump D [XNoteAdd D ${comment_1} ${box_1} --subshape 1]
|
||||
XNoteRefDump D [XNoteAdd D ${comment_2} ${box_1} --subshape 1]
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# remove all box annotations
|
||||
XNoteRemoveAll D ${box_1} --del-orphan
|
||||
XNoteRemoveAll D ${box_1} --attr ${guid} --del-orphan
|
||||
XNoteRemoveAll D ${box_1} --subshape 1 --del-orphan
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 0
|
||||
set nb_notes_result 0
|
||||
set nb_orphan_result 0
|
51
tests/gdt/notes/D1
Normal file
51
tests/gdt/notes/D1
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
# create comment_1 note
|
||||
set comment_1 [XNoteCreateComment D "Hello, World!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_1}
|
||||
|
||||
# create comment_2 note
|
||||
set comment_2 [XNoteCreateComment D "Hello, Everyone!" --user "The user" --time [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]]
|
||||
XNoteDump D ${comment_2}
|
||||
|
||||
# annotate box_1
|
||||
set annotated_1 [XNoteAdd D ${comment_1} ${box_1}]
|
||||
set annotated_2 [XNoteAdd D ${comment_2} ${box_1}]
|
||||
if {${annotated_1} != ${annotated_2}} {
|
||||
puts "Error : item annotation labels (${annotated_1} and ${annotated_2}) must be equal not equal."
|
||||
}
|
||||
|
||||
# annotate box_1 attribute
|
||||
set annotated_1_attr [XNoteAdd D ${comment_1} ${box_1} --attr ${guid}]
|
||||
set annotated_2_attr [XNoteAdd D ${comment_2} ${box_1} --attr ${guid}]
|
||||
if {${annotated_1_attr} != ${annotated_2_attr}} {
|
||||
puts "Error : item's attribute annotation labels (${annotated_1_attr} and ${annotated_2_attr}) must be equal not equal."
|
||||
}
|
||||
|
||||
# annotate box_1 subshape 1
|
||||
set annotated_1_subshape [XNoteAdd D ${comment_1} ${box_1} --subshape 1]
|
||||
set annotated_2_subshape [XNoteAdd D ${comment_2} ${box_1} --subshape 1]
|
||||
if {${annotated_1_subshape} != ${annotated_2_subshape}} {
|
||||
puts "Error : item's subshape annotation labels (${annotated_1_subshape} and ${annotated_2_subshape}) must be equal not equal."
|
||||
}
|
||||
|
||||
# find annotations
|
||||
set annotated_found [XNoteFindAnnotated D ${box_1}]
|
||||
if {${annotated_1} != ${annotated_found}} {
|
||||
puts "Error : ${annotated_1} is expected to found instead of ${annotated_found}"
|
||||
}
|
||||
set annotated_attr_found [XNoteFindAnnotated D ${box_1} --attr ${guid}]
|
||||
if {${annotated_1_attr} != ${annotated_attr_found}} {
|
||||
puts "Error : ${annotated_1_attr} is expected to found instead of ${annotated_attr_found}"
|
||||
}
|
||||
set annotated_subshape_found [XNoteFindAnnotated D ${box_1} --subshape 1]
|
||||
if {${annotated_1_subshape} != ${annotated_subshape_found}} {
|
||||
puts "Error : ${annotated_1_subshape} is expected to found instead of ${annotated_subshape_found}"
|
||||
}
|
||||
|
||||
# list annotations
|
||||
XNoteAnnotations D
|
||||
|
||||
# expected results
|
||||
set nb_annotations_result 3
|
||||
set nb_notes_result 2
|
||||
set nb_orphan_result 0
|
21
tests/gdt/notes/begin
Normal file
21
tests/gdt/notes/begin
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
# assembly of 2 boxes
|
||||
box b1 1 1 1
|
||||
box b2 2 2 2
|
||||
btranslate b1 b1 2 2 2
|
||||
btranslate b2 b2 -3 -3 -3
|
||||
compound b1 b2 c
|
||||
|
||||
# new document
|
||||
NewDocument D
|
||||
|
||||
# populate D
|
||||
XAddShape D c
|
||||
|
||||
# box extries
|
||||
set box_1 "0:1:1:2"
|
||||
set box_2 "0:1:1:3"
|
||||
|
||||
# add int attribute to box_1
|
||||
set guid "27927843-72A0-41ef-901D-621FAB01C27A"
|
||||
SetInteger D ${box_1} 1965 ${guid}
|
20
tests/gdt/notes/end
Normal file
20
tests/gdt/notes/end
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
# check counts
|
||||
set count [XNoteCount D]
|
||||
set nb_annotations [lindex ${count} 0]
|
||||
set nb_notes [lindex ${count} 1]
|
||||
set nb_orphan [lindex ${count} 2]
|
||||
if {${nb_annotations} != ${nb_annotations_result}} {
|
||||
puts "Error : ${nb_annotations_result} number of annotated items is expected instead of ${nb_annotations}!"
|
||||
}
|
||||
if {${nb_notes} != ${nb_notes_result}} {
|
||||
puts "Error : ${nb_notes_result} number of notes is expected instead of ${nb_notes}!"
|
||||
}
|
||||
if {${nb_orphan} != ${nb_orphan_result}} {
|
||||
puts "Error : ${nb_orphan_result} number of orphan notes is expected instead of ${nb_orphan}!"
|
||||
}
|
||||
|
||||
# release document
|
||||
unset D
|
||||
|
||||
puts "TEST COMPLETED"
|
Loading…
x
Reference in New Issue
Block a user