- XCAFNoteObjects_NoteObject transfer object for note's auxiliary data was added. It contains the following fields:
text and attachment positions, note plane and tesselated presentation
- GetObject/SetObject methods were added to XCAFDoc_Note attribute. The following sub-labels were added to handle transfer object:
1 - text position
2 - note plane
3 - attachment point
4 - tesselated presentation
- documentation updated
Off-topic: procedure genproj now gives meaningful error message if new package is added but not listed in UDLIST
t TKIVtkDraw
n Geom2dEvaluator
t TKVCAF
-n XCAFView
\ No newline at end of file
+n XCAFView
+n XCAFNoteObjects
"t" { set utyp "toolkit" }
"n" { set utyp "nocdlpack" }
"x" { set utyp "executable" }
+ default { error "Error: Cannot determine type of unit $loc, check adm/UDLIST!" }
}
if [array exists map] { unset map }
osutils:tk:loadunit $loc map
myCommentNote->Set("New comment");
}
~~~~~
+In order to edit auxiliary note data such as text and attachment position, plane for rendering and tesselated presentation,
+one should use a transfer object *XCAFNoteObjects_NoteObject* by GetObject and SetObject methods of *XCAFDoc_Note* class.
+*XCAFNoteObjects_NoteObject* class provides the following functionality:
+- HasPlane, GetPlane and SetPlane methods test, get and set plane for note rendering
+- HasPoint, GetPoint and SetPoint methods test, get and set note attachment position on the annotated object
+- HasPointText, GetPointText, SetPointText methods test, get and set test position
+- GetPresentation and SetPresentation methods allow to test for and specify tesselated presentation
+
+After getting, the transfer object can be edited and set back to the note:
+~~~~~
+Handle(XCAFNoteObjects_NoteObject) aNoteObj = myNote->GetObject();
+if (!aNoteObj.IsNull())
+{
+ gp_Pnt aPntTxt (...);
+ aNoteObj->SetPointText (aPntTxt);
+ TopoDS_Shape aS = ...;
+ aNoteObj->SetPresentation (aS);
+ myNote->SetObject (aNoteObj);
+}
+~~~~~
@subsubsection occt_xde_2_10_4 Adding Notes
XCAFApp
XCAFDimTolObjects
+XCAFNoteObjects
XCAFDoc
XCAFPrs
XCAFView
-// Created on: 2017-02-10
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <XCAFDoc_Note.hxx>
+
+#include <gp_Pln.hxx>
#include <Standard_GUID.hxx>
+#include <TDataXtd_Geometry.hxx>
+#include <TDataXtd_Plane.hxx>
+#include <TDataXtd_Point.hxx>
#include <TDF_AttributeIterator.hxx>
+#include <TDF_ChildIterator.hxx>
#include <TDF_Label.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+#include <TNaming_Tool.hxx>
#include <XCAFDoc.hxx>
#include <XCAFDoc_GraphNode.hxx>
-#include <XCAFDoc_Note.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_Note, TDF_Attribute)
-Standard_Boolean
+enum ChildLab
+{
+ ChildLab_PntText = 1,
+ ChildLab_Plane,
+ ChildLab_Pnt,
+ ChildLab_Presentation
+};
+
+// =======================================================================
+// function : IsMine
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_Note::IsMine(const TDF_Label& theLabel)
{
return !Get(theLabel).IsNull();
}
+// =======================================================================
+// function : XCAFDoc_Note
+// purpose :
+// =======================================================================
XCAFDoc_Note::XCAFDoc_Note()
{
}
-Handle(XCAFDoc_Note)
+// =======================================================================
+// function : Get
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_Note)
XCAFDoc_Note::Get(const TDF_Label& theLabel)
{
Handle(XCAFDoc_Note) aNote;
return aNote;
}
-void
+// =======================================================================
+// function : Set
+// purpose :
+// =======================================================================
+void
XCAFDoc_Note::Set(const TCollection_ExtendedString& theUserName,
const TCollection_ExtendedString& theTimeStamp)
{
myTimeStamp = theTimeStamp;
}
-const TCollection_ExtendedString&
-XCAFDoc_Note::UserName() const
+// =======================================================================
+// function : IsOrphan
+// purpose :
+// =======================================================================
+Standard_Boolean XCAFDoc_Note::IsOrphan() const
{
- return myUserName;
+ Handle(XCAFDoc_GraphNode) aFather;
+ return !Label().FindAttribute(XCAFDoc::NoteRefGUID(), aFather) ||
+ (aFather->NbChildren() == 0);
}
-const TCollection_ExtendedString&
-XCAFDoc_Note::TimeStamp() const
+// =======================================================================
+// function : GetObject
+// purpose :
+// =======================================================================
+Handle(XCAFNoteObjects_NoteObject) XCAFDoc_Note::GetObject() const
{
- return myTimeStamp;
+ Handle(XCAFNoteObjects_NoteObject) anObj = new XCAFNoteObjects_NoteObject();
+
+ Handle(TDataXtd_Point) aPnt;
+ if (Label().FindChild(ChildLab_Pnt).FindAttribute(TDataXtd_Point::GetID(), aPnt))
+ {
+ gp_Pnt aP;
+ if (TDataXtd_Geometry::Point(aPnt->Label(), aP))
+ {
+ anObj->SetPoint(aP);
+ }
+ }
+
+ Handle(TDataXtd_Plane) aPln;
+ if (Label().FindChild(ChildLab_Plane).FindAttribute(TDataXtd_Plane::GetID(), aPln))
+ {
+ gp_Pln aP;
+ if (TDataXtd_Geometry::Plane(aPln->Label(), aP))
+ {
+ anObj->SetPlane(aP.Position().Ax2());
+ }
+ }
+
+ Handle(TDataXtd_Point) aPntText;
+ if (Label().FindChild(ChildLab_PntText).FindAttribute(TDataXtd_Point::GetID(), aPntText))
+ {
+ gp_Pnt aP;
+ if (TDataXtd_Geometry::Point(aPntText->Label(), aP))
+ {
+ anObj->SetPointText(aP);
+ }
+ }
+
+ Handle(TNaming_NamedShape) aNS;
+ TDF_Label aLPres = Label().FindChild(ChildLab_Presentation);
+ if (aLPres.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+ {
+ TopoDS_Shape aPresentation = TNaming_Tool::GetShape(aNS);
+ if (!aPresentation.IsNull())
+ {
+ anObj->SetPresentation(aPresentation);
+ }
+ }
+
+ return anObj;
}
-Standard_Boolean
-XCAFDoc_Note::IsOrphan() const
+// =======================================================================
+// function : SetObject
+// purpose :
+// =======================================================================
+void XCAFDoc_Note::SetObject (const Handle(XCAFNoteObjects_NoteObject)& theObject)
{
- Handle(XCAFDoc_GraphNode) aFather;
- return !Label().FindAttribute(XCAFDoc::NoteRefGUID(), aFather) ||
- (aFather->NbChildren() == 0);
+ Backup();
+
+ for (TDF_ChildIterator anIter(Label()); anIter.More(); anIter.Next())
+ {
+ anIter.Value().ForgetAllAttributes();
+ }
+
+ if (theObject->HasPoint())
+ {
+ gp_Pnt aPnt1 = theObject->GetPoint();
+ TDataXtd_Point::Set (Label().FindChild (ChildLab_Pnt), aPnt1);
+ }
+
+ if (theObject->HasPlane())
+ {
+ gp_Ax2 anAx = theObject->GetPlane();
+
+ gp_Pln aP (anAx);
+ TDataXtd_Plane::Set (Label().FindChild (ChildLab_Plane), aP);
+ }
+
+ if (theObject->HasPointText())
+ {
+ gp_Pnt aPntText = theObject->GetPointText();
+ TDataXtd_Point::Set (Label().FindChild (ChildLab_PntText), aPntText);
+ }
+
+ TopoDS_Shape aPresentation = theObject->GetPresentation();
+ if (!aPresentation.IsNull())
+ {
+ TDF_Label aLPres = Label().FindChild (ChildLab_Presentation);
+ TNaming_Builder aBuilder (aLPres);
+ aBuilder.Generated (aPresentation);
+ }
}
-void
+// =======================================================================
+// function : Restore
+// purpose :
+// =======================================================================
+void
XCAFDoc_Note::Restore(const Handle(TDF_Attribute)& theAttr)
{
myUserName = Handle(XCAFDoc_Note)::DownCast(theAttr)->myUserName;
myTimeStamp = Handle(XCAFDoc_Note)::DownCast(theAttr)->myTimeStamp;
}
-void
+// =======================================================================
+// function : Paste
+// purpose :
+// =======================================================================
+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&
+// =======================================================================
+// function : Dump
+// purpose :
+// =======================================================================
+Standard_OStream&
XCAFDoc_Note::Dump(Standard_OStream& theOS) const
{
TDF_Attribute::Dump(theOS);
-// Created on: 2017-02-10
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
#include <OSD_File.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_LabelSequence.hxx>
+#include <XCAFNoteObjects_NoteObject.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.
//! \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);
+ const TCollection_ExtendedString& theTimeStamp);
//! Returns the user name, who created the note.
- Standard_EXPORT const TCollection_ExtendedString& UserName() const;
+ const TCollection_ExtendedString& UserName() const { return myUserName; }
//! Returns the timestamp of the note.
- Standard_EXPORT const TCollection_ExtendedString& TimeStamp() const;
+ const TCollection_ExtendedString& TimeStamp() const { return myTimeStamp; }
//! Checks if the note isn't linked to annotated items.
Standard_EXPORT Standard_Boolean IsOrphan() const;
+ //! Returns auxiliary data object
+ Standard_EXPORT Handle(XCAFNoteObjects_NoteObject) GetObject() const;
+
+ //! Updates auxiliary data
+ Standard_EXPORT void SetObject(const Handle(XCAFNoteObjects_NoteObject)& theObject);
+
public:
// Overrides TDF_Attribute virtuals
TCollection_ExtendedString myTimeStamp; ///< Timestamp, when the note was created.
};
+DEFINE_STANDARD_HANDLE(XCAFDoc_Note, TDF_Attribute)
+
#endif // _XCAFDoc_Note_HeaderFile
-// Created on: 2017-08-10
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteBalloon, XCAFDoc_NoteComment)
-const Standard_GUID&
+// =======================================================================
+// function : GetID
+// purpose :
+// =======================================================================
+const Standard_GUID&
XCAFDoc_NoteBalloon::GetID()
{
static Standard_GUID s_ID("1127951D-87D5-4ecc-89D5-D1406576C43F");
return s_ID;
}
+// =======================================================================
+// function : Get
+// purpose :
+// =======================================================================
Handle(XCAFDoc_NoteBalloon)
XCAFDoc_NoteBalloon::Get(const TDF_Label& theLabel)
{
return aThis;
}
+// =======================================================================
+// function : Set
+// purpose :
+// =======================================================================
Handle(XCAFDoc_NoteBalloon)
XCAFDoc_NoteBalloon::Set(const TDF_Label& theLabel,
const TCollection_ExtendedString& theUserName,
return aNoteBalloon;
}
+// =======================================================================
+// function : XCAFDoc_NoteBalloon
+// purpose :
+// =======================================================================
XCAFDoc_NoteBalloon::XCAFDoc_NoteBalloon()
{
}
-const Standard_GUID&
+// =======================================================================
+// function : ID
+// purpose :
+// =======================================================================
+const Standard_GUID&
XCAFDoc_NoteBalloon::ID() const
{
return GetID();
}
-Handle(TDF_Attribute)
+// =======================================================================
+// function : NewEmpty
+// purpose :
+// =======================================================================
+Handle(TDF_Attribute)
XCAFDoc_NoteBalloon::NewEmpty() const
{
return new XCAFDoc_NoteBalloon();
-// Created on: 2017-08-10
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
#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
DEFINE_STANDARD_RTTIEXT(XCAFDoc_NoteBalloon, XCAFDoc_NoteComment)
+ //! Returns default attribute GUID
Standard_EXPORT static const Standard_GUID& GetID();
//! Finds a reference attribute on the given label and returns it, if it is found
};
+DEFINE_STANDARD_HANDLE(XCAFDoc_NoteBalloon, XCAFDoc_NoteComment)
+
#endif // _XCAFDoc_NoteBalloon_HeaderFile
-// Created on: 2017-02-13
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteBinData, XCAFDoc_Note)
-const Standard_GUID&
+// =======================================================================
+// function : GetID
+// purpose :
+// =======================================================================
+const Standard_GUID&
XCAFDoc_NoteBinData::GetID()
{
static Standard_GUID s_ID("E9055501-F0FC-4864-BE4B-284FDA7DDEAC");
return s_ID;
}
+// =======================================================================
+// function : Get
+// purpose :
+// =======================================================================
Handle(XCAFDoc_NoteBinData)
XCAFDoc_NoteBinData::Get(const TDF_Label& theLabel)
{
return aThis;
}
-Handle(XCAFDoc_NoteBinData)
+// =======================================================================
+// function : Set
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_NoteBinData)
XCAFDoc_NoteBinData::Set(const TDF_Label& theLabel,
const TCollection_ExtendedString& theUserName,
const TCollection_ExtendedString& theTimeStamp,
return aNoteBinData;
}
-Handle(XCAFDoc_NoteBinData)
+// =======================================================================
+// function : Set
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_NoteBinData)
XCAFDoc_NoteBinData::Set(const TDF_Label& theLabel,
const TCollection_ExtendedString& theUserName,
const TCollection_ExtendedString& theTimeStamp,
return aNoteBinData;
}
+// =======================================================================
+// function : XCAFDoc_NoteBinData
+// purpose :
+// =======================================================================
XCAFDoc_NoteBinData::XCAFDoc_NoteBinData()
{
}
-Standard_Boolean
+// =======================================================================
+// function : Set
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
const TCollection_AsciiString& theMIMEtype,
OSD_File& theFile)
return Standard_True;
}
-void
+// =======================================================================
+// function : Set
+// purpose :
+// =======================================================================
+void
XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle,
const TCollection_AsciiString& theMIMEtype,
const Handle(TColStd_HArray1OfByte)& theData)
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
+// =======================================================================
+// function : ID
+// purpose :
+// =======================================================================
+const
Standard_GUID& XCAFDoc_NoteBinData::ID() const
{
return GetID();
}
-Handle(TDF_Attribute)
+// =======================================================================
+// function : NewEmpty
+// purpose :
+// =======================================================================
+Handle(TDF_Attribute)
XCAFDoc_NoteBinData::NewEmpty() const
{
return new XCAFDoc_NoteBinData();
}
-void
+// =======================================================================
+// function : Restore
+// purpose :
+// =======================================================================
+void
XCAFDoc_NoteBinData::Restore(const Handle(TDF_Attribute)& theAttr)
{
XCAFDoc_Note::Restore(theAttr);
}
}
-void
+// =======================================================================
+// function : Paste
+// purpose :
+// =======================================================================
+void
XCAFDoc_NoteBinData::Paste(const Handle(TDF_Attribute)& theAttrInto,
const Handle(TDF_RelocationTable)& theRT) const
{
aMine->Set(myTitle, myMIMEtype, myData);
}
-Standard_OStream&
+// =======================================================================
+// function : Dump
+// purpose :
+// =======================================================================
+Standard_OStream&
XCAFDoc_NoteBinData::Dump(Standard_OStream& theOS) const
{
XCAFDoc_Note::Dump(theOS);
-// Created on: 2017-02-13
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
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)
+ //! Returns default attribute GUID
Standard_EXPORT static const Standard_GUID& GetID();
//! Finds a binary data attribute on the given label and returns it, if it is found
//! @}
//! Returns the note title.
- Standard_EXPORT const TCollection_ExtendedString& Title() const;
+ const TCollection_ExtendedString& Title() const { return myTitle; }
//! Returns data MIME type.
- Standard_EXPORT const TCollection_AsciiString& MIMEtype() const;
+ const TCollection_AsciiString& MIMEtype() const { return myMIMEtype; }
//! Size of data in bytes.
- Standard_EXPORT Standard_Integer Size() const;
+ Standard_Integer Size() const { return (!myData.IsNull() ? myData->Length() : 0); }
//! Returns byte data array.
- Standard_EXPORT const Handle(TColStd_HArray1OfByte)& Data() const;
+ const Handle(TColStd_HArray1OfByte)& Data() const { return myData; }
public:
};
+DEFINE_STANDARD_HANDLE(XCAFDoc_NoteBinData, XCAFDoc_Note)
+
#endif // _XCAFDoc_NoteBinData_HeaderFile
-// Created on: 2017-02-13
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_NoteComment, XCAFDoc_Note)
-const Standard_GUID&
+// =======================================================================
+// function : GetID
+// purpose :
+// =======================================================================
+const Standard_GUID&
XCAFDoc_NoteComment::GetID()
{
static Standard_GUID s_ID("FDEA4C52-0F54-484c-B590-579E18F7B5D4");
return s_ID;
}
-Handle(XCAFDoc_NoteComment)
+// =======================================================================
+// function : Get
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_NoteComment)
XCAFDoc_NoteComment::Get(const TDF_Label& theLabel)
{
Handle(XCAFDoc_NoteComment) aThis;
return aThis;
}
-Handle(XCAFDoc_NoteComment)
+// =======================================================================
+// function : Set
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_NoteComment)
XCAFDoc_NoteComment::Set(const TDF_Label& theLabel,
const TCollection_ExtendedString& theUserName,
const TCollection_ExtendedString& theTimeStamp,
return aNoteComment;
}
+// =======================================================================
+// function : XCAFDoc_NoteComment
+// purpose :
+// =======================================================================
XCAFDoc_NoteComment::XCAFDoc_NoteComment()
{
}
-void
+// =======================================================================
+// function : Set
+// purpose :
+// =======================================================================
+void
XCAFDoc_NoteComment::Set(const TCollection_ExtendedString& theComment)
{
Backup();
myComment = theComment;
}
-const TCollection_ExtendedString&
-XCAFDoc_NoteComment::Comment() const
-{
- return myComment;
-}
-
-const Standard_GUID&
+// =======================================================================
+// function : ID
+// purpose :
+// =======================================================================
+const Standard_GUID&
XCAFDoc_NoteComment::ID() const
{
return GetID();
}
-Handle(TDF_Attribute)
+// =======================================================================
+// function : NewEmpty
+// purpose :
+// =======================================================================
+Handle(TDF_Attribute)
XCAFDoc_NoteComment::NewEmpty() const
{
return new XCAFDoc_NoteComment();
}
-void
+// =======================================================================
+// function : Restore
+// purpose :
+// =======================================================================
+void
XCAFDoc_NoteComment::Restore(const Handle(TDF_Attribute)& theAttr)
{
XCAFDoc_Note::Restore(theAttr);
myComment = aMine->myComment;
}
-void
+// =======================================================================
+// function : Paste
+// purpose :
+// =======================================================================
+void
XCAFDoc_NoteComment::Paste(const Handle(TDF_Attribute)& theAttrInto,
const Handle(TDF_RelocationTable)& theRT) const
{
aMine->Set(myComment);
}
-Standard_OStream&
+// =======================================================================
+// function : Dump
+// purpose :
+// =======================================================================
+Standard_OStream&
XCAFDoc_NoteComment::Dump(Standard_OStream& theOS) const
{
XCAFDoc_Note::Dump(theOS);
-// Created on: 2017-02-13
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
#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
DEFINE_STANDARD_RTTIEXT(XCAFDoc_NoteComment, XCAFDoc_Note)
+ //! Returns default attribute GUID
Standard_EXPORT static const Standard_GUID& GetID();
//! Finds a reference attribute on the given label and returns it, if it is found
Standard_EXPORT void Set(const TCollection_ExtendedString& theComment);
//! Returns the comment text.
- Standard_EXPORT const TCollection_ExtendedString& Comment() const;
+ const TCollection_ExtendedString& Comment() const { return myComment; }
public:
};
+DEFINE_STANDARD_HANDLE(XCAFDoc_NoteComment, XCAFDoc_Note)
+
#endif // _XCAFDoc_NoteComment_HeaderFile
-// Created on: 2017-02-10
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
NotesTool_AnnotatedItemsRoot
};
-const Standard_GUID&
+// =======================================================================
+// function : GetID
+// purpose :
+// =======================================================================
+const Standard_GUID&
XCAFDoc_NotesTool::GetID()
{
static Standard_GUID s_ID("8F8174B1-6125-47a0-B357-61BD2D89380C");
return s_ID;
}
-Handle(XCAFDoc_NotesTool)
+// =======================================================================
+// function : Set
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_NotesTool)
XCAFDoc_NotesTool::Set(const TDF_Label& theLabel)
{
Handle(XCAFDoc_NotesTool) aTool;
return aTool;
}
+// =======================================================================
+// function : XCAFDoc_NotesTool
+// purpose :
+// =======================================================================
XCAFDoc_NotesTool::XCAFDoc_NotesTool()
{
}
-TDF_Label
+// =======================================================================
+// function : GetNotesLabel
+// purpose :
+// =======================================================================
+TDF_Label
XCAFDoc_NotesTool::GetNotesLabel() const
{
return Label().FindChild(NotesTool_NotesRoot);
}
+// =======================================================================
+// function : GetAnnotatedItemsLabel
+// purpose :
+// =======================================================================
TDF_Label XCAFDoc_NotesTool::GetAnnotatedItemsLabel() const
{
return Label().FindChild(NotesTool_AnnotatedItemsRoot);
}
-Standard_Integer
+// =======================================================================
+// function : NbNotes
+// purpose :
+// =======================================================================
+Standard_Integer
XCAFDoc_NotesTool::NbNotes() const
{
Standard_Integer nbNotes = 0;
return nbNotes;
}
-Standard_Integer
+// =======================================================================
+// function : NbAnnotatedItems
+// purpose :
+// =======================================================================
+Standard_Integer
XCAFDoc_NotesTool::NbAnnotatedItems() const
{
Standard_Integer nbItems = 0;
return nbItems;
}
-void
+// =======================================================================
+// function : GetNotes
+// purpose :
+// =======================================================================
+void
XCAFDoc_NotesTool::GetNotes(TDF_LabelSequence& theNoteLabels) const
{
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
}
}
-void
+// =======================================================================
+// function : GetAnnotatedItems
+// purpose :
+// =======================================================================
+void
XCAFDoc_NotesTool::GetAnnotatedItems(TDF_LabelSequence& theItemLabels) const
{
for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
}
}
-Standard_Boolean
+// =======================================================================
+// function : IsAnnotatedItem
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::IsAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const
{
return !FindAnnotatedItem(theItemId).IsNull();
}
-Standard_Boolean
+// =======================================================================
+// function : IsAnnotatedItem
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::IsAnnotatedItem(const TDF_Label& theItemLabel) const
{
return IsAnnotatedItem(labeledItem(theItemLabel));
}
-TDF_Label
+// =======================================================================
+// function : FindAnnotatedItem
+// purpose :
+// =======================================================================
+TDF_Label
XCAFDoc_NotesTool::FindAnnotatedItem(const XCAFDoc_AssemblyItemId& theItemId) const
{
for (TDF_ChildIDIterator anIter(GetAnnotatedItemsLabel(), XCAFDoc_AssemblyItemRef::GetID()); anIter.More(); anIter.Next())
return TDF_Label();
}
-TDF_Label
+// =======================================================================
+// function : FindAnnotatedItem
+// purpose :
+// =======================================================================
+TDF_Label
XCAFDoc_NotesTool::FindAnnotatedItem(const TDF_Label& theItemLabel) const
{
return FindAnnotatedItem(labeledItem(theItemLabel));
}
-TDF_Label
+// =======================================================================
+// function : FindAnnotatedItemAttr
+// purpose :
+// =======================================================================
+TDF_Label
XCAFDoc_NotesTool::FindAnnotatedItemAttr(const XCAFDoc_AssemblyItemId& theItemId,
const Standard_GUID& theGUID) const
{
return TDF_Label();
}
+// =======================================================================
+// function : FindAnnotatedItemAttr
+// purpose :
+// =======================================================================
TDF_Label
XCAFDoc_NotesTool::FindAnnotatedItemAttr(const TDF_Label& theItemLabel,
const Standard_GUID& theGUID) const
return FindAnnotatedItemAttr(labeledItem(theItemLabel), theGUID);
}
-TDF_Label
+// =======================================================================
+// function : FindAnnotatedItemSubshape
+// purpose :
+// =======================================================================
+TDF_Label
XCAFDoc_NotesTool::FindAnnotatedItemSubshape(const XCAFDoc_AssemblyItemId& theItemId,
Standard_Integer theSubshapeIndex) const
{
return TDF_Label();
}
-TDF_Label
+// =======================================================================
+// function : FindAnnotatedItemSubshape
+// purpose :
+// =======================================================================
+TDF_Label
XCAFDoc_NotesTool::FindAnnotatedItemSubshape(const TDF_Label& theItemLabel,
Standard_Integer theSubshapeIndex) const
{
return FindAnnotatedItemSubshape(labeledItem(theItemLabel), theSubshapeIndex);
}
-Handle(XCAFDoc_Note)
+// =======================================================================
+// function : CreateComment
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_Note)
XCAFDoc_NotesTool::CreateComment(const TCollection_ExtendedString& theUserName,
const TCollection_ExtendedString& theTimeStamp,
const TCollection_ExtendedString& theComment)
return XCAFDoc_NoteComment::Set(aNoteLabel, theUserName, theTimeStamp, theComment);
}
-Handle(XCAFDoc_Note)
+// =======================================================================
+// function : CreateBalloon
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_Note)
XCAFDoc_NotesTool::CreateBalloon(const TCollection_ExtendedString& theUserName,
const TCollection_ExtendedString& theTimeStamp,
const TCollection_ExtendedString& theComment)
return XCAFDoc_NoteBalloon::Set(aNoteLabel, theUserName, theTimeStamp, theComment);
}
-Handle(XCAFDoc_Note)
+// =======================================================================
+// function : CreateBinData
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_Note)
XCAFDoc_NotesTool::CreateBinData(const TCollection_ExtendedString& theUserName,
const TCollection_ExtendedString& theTimeStamp,
const TCollection_ExtendedString& theTitle,
return XCAFDoc_NoteBinData::Set(aNoteLabel, theUserName, theTimeStamp, theTitle, theMIMEtype, theFile);
}
-Handle(XCAFDoc_Note)
+// =======================================================================
+// function : CreateBinData
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_Note)
XCAFDoc_NotesTool::CreateBinData(const TCollection_ExtendedString& theUserName,
const TCollection_ExtendedString& theTimeStamp,
const TCollection_ExtendedString& theTitle,
return XCAFDoc_NoteBinData::Set(aNoteLabel, theUserName, theTimeStamp, theTitle, theMIMEtype, theData);
}
+// =======================================================================
+// function : GetNotes
+// purpose :
+// =======================================================================
Standard_Integer
XCAFDoc_NotesTool::GetNotes(const XCAFDoc_AssemblyItemId& theItemId,
TDF_LabelSequence& theNoteLabels) const
return theNoteLabels.Length();
}
-Standard_Integer
+// =======================================================================
+// function : GetNotes
+// purpose :
+// =======================================================================
+Standard_Integer
XCAFDoc_NotesTool::GetNotes(const TDF_Label& theItemLabel,
TDF_LabelSequence& theNoteLabels) const
{
return GetNotes(labeledItem(theItemLabel), theNoteLabels);
}
+// =======================================================================
+// function : GetAttrNotes
+// purpose :
+// =======================================================================
Standard_Integer
XCAFDoc_NotesTool::GetAttrNotes(const XCAFDoc_AssemblyItemId& theItemId,
const Standard_GUID& theGUID,
return theNoteLabels.Length();
}
-Standard_Integer
+// =======================================================================
+// function : GetAttrNotes
+// purpose :
+// =======================================================================
+Standard_Integer
XCAFDoc_NotesTool::GetAttrNotes(const TDF_Label& theItemLabel,
const Standard_GUID& theGUID,
TDF_LabelSequence& theNoteLabels) const
return GetAttrNotes(labeledItem(theItemLabel), theGUID, theNoteLabels);
}
+// =======================================================================
+// function : GetSubshapeNotes
+// purpose :
+// =======================================================================
Standard_Integer
XCAFDoc_NotesTool::GetSubshapeNotes(const XCAFDoc_AssemblyItemId& theItemId,
Standard_Integer theSubshapeIndex,
return theNoteLabels.Length();
}
+// =======================================================================
+// function : AddNote
+// purpose :
+// =======================================================================
Handle(XCAFDoc_AssemblyItemRef)
XCAFDoc_NotesTool::AddNote(const TDF_Label& theNoteLabel,
const XCAFDoc_AssemblyItemId& theItemId)
return anItemRef;
}
-Handle(XCAFDoc_AssemblyItemRef)
+// =======================================================================
+// function : AddNote
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_AssemblyItemRef)
XCAFDoc_NotesTool::AddNote(const TDF_Label& theNoteLabel,
const TDF_Label& theItemLabel)
{
return AddNote(theNoteLabel, labeledItem(theItemLabel));
}
-Handle(XCAFDoc_AssemblyItemRef)
+// =======================================================================
+// function : AddNoteToAttr
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_AssemblyItemRef)
XCAFDoc_NotesTool::AddNoteToAttr(const TDF_Label& theNoteLabel,
const XCAFDoc_AssemblyItemId& theItemId,
const Standard_GUID& theGUID)
return anItemRef;
}
-Handle(XCAFDoc_AssemblyItemRef)
+// =======================================================================
+// function : AddNoteToAttr
+// purpose :
+// =======================================================================
+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)
+// =======================================================================
+// function : AddNoteToSubshape
+// purpose :
+// =======================================================================
+Handle(XCAFDoc_AssemblyItemRef)
XCAFDoc_NotesTool::AddNoteToSubshape(const TDF_Label& theNoteLabel,
const XCAFDoc_AssemblyItemId& theItemId,
Standard_Integer theSubshapeIndex)
return anItemRef;
}
-Handle(XCAFDoc_AssemblyItemRef)
+// =======================================================================
+// function : AddNoteToSubshape
+// purpose :
+// =======================================================================
+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
+// =======================================================================
+// function : RemoveNote
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveNote(const TDF_Label& theNoteLabel,
const XCAFDoc_AssemblyItemId& theItemId,
Standard_Boolean theDelIfOrphan)
return Standard_True;
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveNote
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveNote(const TDF_Label& theNoteLabel,
const TDF_Label& theItemLabel,
Standard_Boolean theDelIfOrphan)
return RemoveNote(theNoteLabel, labeledItem(theItemLabel), theDelIfOrphan);
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveSubshapeNote
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveSubshapeNote(const TDF_Label& theNoteLabel,
const XCAFDoc_AssemblyItemId& theItemId,
Standard_Integer theSubshapeIndex,
return Standard_True;
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveSubshapeNote
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveSubshapeNote(const TDF_Label& theNoteLabel,
const TDF_Label& theItemLabel,
Standard_Integer theSubshapeIndex,
return RemoveSubshapeNote(theNoteLabel, labeledItem(theItemLabel), theSubshapeIndex, theDelIfOrphan);
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveAttrNote
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveAttrNote(const TDF_Label& theNoteLabel,
const XCAFDoc_AssemblyItemId& theItemId,
const Standard_GUID& theGUID,
return Standard_True;
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveAttrNote
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveAttrNote(const TDF_Label& theNoteLabel,
const TDF_Label& theItemLabel,
const Standard_GUID& theGUID,
return RemoveAttrNote(theNoteLabel, labeledItem(theItemLabel), theGUID, theDelIfOrphan);
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveAllNotes
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveAllNotes(const XCAFDoc_AssemblyItemId& theItemId,
Standard_Boolean theDelIfOrphan)
{
return Standard_True;
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveAllNotes
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveAllNotes(const TDF_Label& theItemLabel,
Standard_Boolean theDelIfOrphan)
{
return RemoveAllNotes(labeledItem(theItemLabel), theDelIfOrphan);
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveAllSubshapeNotes
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveAllSubshapeNotes(const XCAFDoc_AssemblyItemId& theItemId,
Standard_Integer theSubshapeIndex,
Standard_Boolean theDelIfOrphan)
return Standard_True;
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveAllAttrNotes
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveAllAttrNotes(const XCAFDoc_AssemblyItemId& theItemId,
const Standard_GUID& theGUID,
Standard_Boolean theDelIfOrphan)
return Standard_True;
}
-Standard_Boolean
+// =======================================================================
+// function : RemoveAllAttrNotes
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::RemoveAllAttrNotes(const TDF_Label& theItemLabel,
const Standard_GUID& theGUID,
Standard_Boolean theDelIfOrphan)
return RemoveAllAttrNotes(labeledItem(theItemLabel), theGUID, theDelIfOrphan);
}
-Standard_Boolean
+// =======================================================================
+// function : DeleteNote
+// purpose :
+// =======================================================================
+Standard_Boolean
XCAFDoc_NotesTool::DeleteNote(const TDF_Label& theNoteLabel)
{
Handle(XCAFDoc_Note) aNote = XCAFDoc_Note::Get(theNoteLabel);
return Standard_False;
}
-Standard_Integer
+// =======================================================================
+// function : DeleteNotes
+// purpose :
+// =======================================================================
+Standard_Integer
XCAFDoc_NotesTool::DeleteNotes(TDF_LabelSequence& theNoteLabels)
{
Standard_Integer nbNotes = 0;
return nbNotes;
}
-Standard_Integer
+// =======================================================================
+// function : DeleteAllNotes
+// purpose :
+// =======================================================================
+Standard_Integer
XCAFDoc_NotesTool::DeleteAllNotes()
{
Standard_Integer nbNotes = 0;
return nbNotes;
}
-Standard_Integer
+// =======================================================================
+// function : NbOrphanNotes
+// purpose :
+// =======================================================================
+Standard_Integer
XCAFDoc_NotesTool::NbOrphanNotes() const
{
Standard_Integer nbNotes = 0;
return nbNotes;
}
-void
+// =======================================================================
+// function : GetOrphanNotes
+// purpose :
+// =======================================================================
+void
XCAFDoc_NotesTool::GetOrphanNotes(TDF_LabelSequence& theNoteLabels) const
{
for (TDF_ChildIterator anIter(GetNotesLabel()); anIter.More(); anIter.Next())
}
}
-Standard_Integer
+// =======================================================================
+// function : DeleteOrphanNotes
+// purpose :
+// =======================================================================
+Standard_Integer
XCAFDoc_NotesTool::DeleteOrphanNotes()
{
Standard_Integer nbNotes = 0;
return nbNotes;
}
-const Standard_GUID&
+// =======================================================================
+// function : ID
+// purpose :
+// =======================================================================
+const Standard_GUID&
XCAFDoc_NotesTool::ID() const
{
return GetID();
}
-Handle(TDF_Attribute)
+// =======================================================================
+// function : NewEmpty
+// purpose :
+// =======================================================================
+Handle(TDF_Attribute)
XCAFDoc_NotesTool::NewEmpty() const
{
return new XCAFDoc_NotesTool();
}
-void
+// =======================================================================
+// function : Restore
+// purpose :
+// =======================================================================
+void
XCAFDoc_NotesTool::Restore(const Handle(TDF_Attribute)& /*theAttr*/)
{
}
-void
+// =======================================================================
+// function : Paste
+// purpose :
+// =======================================================================
+void
XCAFDoc_NotesTool::Paste(const Handle(TDF_Attribute)& /*theAttrInto*/,
const Handle(TDF_RelocationTable)& /*theRT*/) const
{
}
-Standard_OStream&
+// =======================================================================
+// function : Dump
+// purpose :
+// =======================================================================
+Standard_OStream&
XCAFDoc_NotesTool::Dump(Standard_OStream& theOS) const
{
theOS
-// Created on: 2017-02-10
-// Created by: Sergey NIKONOV
-// Copyright (c) 2000-2017 OPEN CASCADE SAS
+// Copyright (c) 2017-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
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
DEFINE_STANDARD_RTTIEXT(XCAFDoc_NotesTool, TDF_Attribute)
+ //! Returns default attribute GUID
Standard_EXPORT static const Standard_GUID& GetID();
//! Create (if not exist) a notes tool from XCAFDoc on theLabel.
};
+DEFINE_STANDARD_HANDLE(XCAFDoc_NotesTool, TDF_Attribute)
+
#endif // _XCAFDoc_NotesTool_HeaderFile
--- /dev/null
+FILES
+XCAFNoteObjects_NoteObject.cxx
+XCAFNoteObjects_NoteObject.hxx
--- /dev/null
+// Copyright (c) 2018 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 <XCAFNoteObjects_NoteObject.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XCAFNoteObjects_NoteObject, Standard_Transient)
+
+//=======================================================================
+//function : XCAFDimTolObjects_DimensionObject
+//purpose :
+//=======================================================================
+XCAFNoteObjects_NoteObject::XCAFNoteObjects_NoteObject()
+: myHasPlane (Standard_False),
+ myHasPnt (Standard_False),
+ myHasPntTxt(Standard_False)
+{
+}
+
+//=======================================================================
+//function : XCAFDimTolObjects_DimensionObject
+//purpose :
+//=======================================================================
+XCAFNoteObjects_NoteObject::XCAFNoteObjects_NoteObject (const Handle(XCAFNoteObjects_NoteObject)& theObj)
+: myPlane (theObj->myPlane),
+ myPnt (theObj->myPnt),
+ myPntTxt (theObj->myPntTxt),
+ myPresentation (theObj->myPresentation),
+ myHasPlane (theObj->myHasPlane),
+ myHasPnt (theObj->myHasPnt),
+ myHasPntTxt (theObj->myHasPntTxt)
+{
+}
+
+//=======================================================================
+//function : SetPlane
+//purpose :
+//=======================================================================
+void XCAFNoteObjects_NoteObject::SetPlane (const gp_Ax2& thePlane)
+{
+ myPlane = thePlane;
+ myHasPlane = Standard_True;
+}
+
+//=======================================================================
+//function : SetPoint
+//purpose :
+//=======================================================================
+void XCAFNoteObjects_NoteObject::SetPoint (const gp_Pnt& thePnt)
+{
+ myPnt = thePnt;
+ myHasPnt = Standard_True;
+}
+
+//=======================================================================
+//function : SetPointText
+//purpose :
+//=======================================================================
+void XCAFNoteObjects_NoteObject::SetPointText (const gp_Pnt& thePnt)
+{
+ myPntTxt = thePnt;
+ myHasPntTxt = Standard_True;
+}
+
+//=======================================================================
+//function : SetPresentation
+//purpose :
+//=======================================================================
+void XCAFNoteObjects_NoteObject::SetPresentation (const TopoDS_Shape& thePresentation)
+{
+ myPresentation = thePresentation;
+}
+
+//=======================================================================
+//function : Reset
+//purpose :
+//=======================================================================
+void XCAFNoteObjects_NoteObject::Reset()
+{
+ myHasPlane = Standard_False;
+ myHasPnt = Standard_False;
+ myHasPntTxt = Standard_False;
+ myPresentation.Nullify();
+}
--- /dev/null
+// Copyright (c) 2018 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 _XCAFNoteObjects_NoteObject_HeaderFile
+#define _XCAFNoteObjects_NoteObject_HeaderFile
+
+#include <gp_Ax2.hxx>
+#include <gp_Pnt.hxx>
+#include <Standard.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <TopoDS_Shape.hxx>
+
+//! object to store note auxiliary data
+class XCAFNoteObjects_NoteObject : public Standard_Transient
+{
+ DEFINE_STANDARD_RTTIEXT(XCAFNoteObjects_NoteObject, Standard_Transient)
+public:
+
+ //! Empty object
+ Standard_EXPORT XCAFNoteObjects_NoteObject();
+
+ //! Copy constructor.
+ Standard_EXPORT XCAFNoteObjects_NoteObject (const Handle(XCAFNoteObjects_NoteObject)& theObj);
+
+ //! Returns True if plane is specified
+ Standard_Boolean HasPlane() const { return myHasPlane; }
+
+ //! Returns a right-handed coordinate system of the plane
+ const gp_Ax2& GetPlane() const { return myPlane; }
+
+ //! Sets a right-handed coordinate system of the plane
+ Standard_EXPORT void SetPlane (const gp_Ax2& thePlane);
+
+ //! Returns True if the attachment point on the annotated object is specified
+ Standard_Boolean HasPoint() const { return myHasPnt; }
+
+ //! Returns the attachment point on the annotated object
+ const gp_Pnt& GetPoint() const { return myPnt; }
+
+ //! Sets the anchor point on the annotated object
+ Standard_EXPORT void SetPoint (const gp_Pnt& thePnt);
+
+ //! Returns True if the text position is specified
+ Standard_Boolean HasPointText() const { return myHasPntTxt; }
+
+ //! Returns the text position
+ const gp_Pnt& GetPointText() const { return myPntTxt; }
+
+ //! Sets the text position
+ Standard_EXPORT void SetPointText (const gp_Pnt& thePnt);
+
+ //! Returns a tesselated annotation if specified
+ const TopoDS_Shape& GetPresentation() const { return myPresentation; }
+
+ //! Sets a tesselated annotation
+ Standard_EXPORT void SetPresentation (const TopoDS_Shape& thePresentation);
+
+ //! Resets data to the state after calling the default constructor
+ Standard_EXPORT void Reset();
+
+private:
+
+ gp_Ax2 myPlane;
+ gp_Pnt myPnt;
+ gp_Pnt myPntTxt;
+ TopoDS_Shape myPresentation;
+ Standard_Boolean myHasPlane;
+ Standard_Boolean myHasPnt;
+ Standard_Boolean myHasPntTxt;
+
+};
+
+DEFINE_STANDARD_HANDLE(XCAFNoteObjects_NoteObject, Standard_Transient)
+
+#endif // _XCAFNoteObjects_NoteObject_HeaderFile
}
}
+ Handle(XCAFNoteObjects_NoteObject) aNoteObj = aNote->GetObject();
+ if (!aNoteObj.IsNull())
+ {
+ di << "text point : ";
+ if (aNoteObj->HasPointText())
+ {
+ const gp_Pnt& aP = aNoteObj->GetPointText();
+ di << "[ " << aP.X() << " " << aP.Y() << " " << aP.Z() << " ]\n";
+ }
+ else
+ di << " not specified\n";
+ di << "plane : ";
+ if (aNoteObj->HasPlane())
+ {
+ const gp_Ax2& anAx = aNoteObj->GetPlane();
+ const gp_Pnt& aP = anAx.Location();
+ di << "P : [ " << aP.X() << " " << aP.Y() << " " << aP.Z() << " ]";
+ const gp_Dir& aN = anAx.Direction();
+ di << "N : [ " << aN.X() << " " << aN.Y() << " " << aN.Z() << " ]";
+ }
+ di << "attachment point : ";
+ if (aNoteObj->HasPoint())
+ {
+ const gp_Pnt& aP = aNoteObj->GetPoint();
+ di << "[ " << aP.X() << " " << aP.Y() << " " << aP.Z() << " ]\n";
+ }
+ else
+ di << " not specified\n";
+ di << "presentation : " << (aNoteObj->GetPresentation().IsNull() ? "no" : "specified");
+ }
+
return 0;
}