1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

XCAFDoc/View fixes to store in the view: image, parts transparency, notes, notes positions

- Improve performance of the storage of the transparent state of the assembly leafs

(cherry picked from commit b050e0a15c06403adfa545ad793555491a0b6b9f)
(cherry picked from commit 7099619e5d)
(cherry picked from commit ccd4b101f5ab18ab3518b9779e88d687e2db6ff1)
This commit is contained in:
nds
2018-09-27 17:38:43 +03:00
parent a22151d83c
commit 93e7cd3228
7 changed files with 455 additions and 115 deletions

View File

@@ -263,13 +263,24 @@ const Standard_GUID& XCAFDoc::ViewRefPlaneGUID()
}
//=======================================================================
//function : ViewRefPlaneGUID
//function : ViewRefNoteGUID
//purpose :
//=======================================================================
const Standard_GUID& XCAFDoc::ViewRefNoteGUID()
{
static const Standard_GUID ID("C814ACC6-43AC-4812-9B2A-4E9A2A549354");
static const Standard_GUID ID("efd213e2-6dfd-11d4-b9c8-0060b0ee281b");
return ID;
}
//=======================================================================
//function : ViewRefEnabledShapesGUID
//purpose :
//=======================================================================
Standard_GUID XCAFDoc::ViewRefEnabledShapesGUID()
{
static Standard_GUID ID("efd213e4-6dfd-11d4-b9c8-0060b0ee281b");
return ID;
}

View File

@@ -125,6 +125,10 @@ public:
//! Return GUIDs for GraphNode representing specified types of View
Standard_EXPORT static const Standard_GUID& ViewRefNoteGUID();
//! Return GUIDs for TreeNode representing specified types of View
Standard_EXPORT static Standard_GUID ViewRefEnabledShapesGUID();
Standard_EXPORT static const Standard_GUID& ViewRefAnnotationGUID();
//! Returns GUID for UAttribute identifying lock flag

View File

@@ -20,6 +20,7 @@
#include <TDataStd_Integer.hxx>
#include <TDataStd_Real.hxx>
#include <TDataStd_RealArray.hxx>
#include <TDataStd_ByteArray.hxx>
#include <TDataXtd_Axis.hxx>
#include <TDataXtd_Geometry.hxx>
#include <TDataXtd_Plane.hxx>
@@ -28,6 +29,7 @@
#include <TColStd_HArray1OfReal.hxx>
#include <XCAFDoc.hxx>
#include <XCAFView_Object.hxx>
#include <TDataStd_IntegerArray.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_View, TDF_Attribute)
@@ -45,7 +47,10 @@ enum ChildLab
ChildLab_BackPlaneDistance,
ChildLab_ViewVolumeSidesClipping,
ChildLab_ClippingExpression,
ChildLab_GDTPoints
ChildLab_GDTPoints,
ChildLab_Image,
ChildLab_EnabledShapes,
ChildLab_NotePoints
};
//=======================================================================
@@ -149,6 +154,30 @@ void XCAFDoc_View::SetObject (const Handle(XCAFView_Object)& theObject)
TDataXtd_Point::Set(aPointsLabel.FindChild(i), theObject->GDTPoint(i));
}
}
//Image
if (theObject->HasImage())
{
Handle(TColStd_HArray1OfByte) image = theObject->Image();
Handle(TDataStd_ByteArray) arr = TDataStd_ByteArray::Set(Label().FindChild(ChildLab_Image), image->Lower(), image->Upper());
for (Standard_Integer i = image->Lower(); i <= image->Upper(); i++) {
arr->SetValue(i, image->Value(i));
}
}
//shapes transparency
if (theObject->HasEnabledShapes())
{
TDF_Label aShapeTranspLabel = Label().FindChild(ChildLab_EnabledShapes);
Handle(TDataStd_IntegerArray) array = TDataStd_IntegerArray::Set(aShapeTranspLabel, 1, theObject->NbEnabledShapes());
array->ChangeArray(theObject->GetEnabledShapes(), Standard_False);
}
//note points
if (theObject->HasNotePoints())
{
TDF_Label aPointsLabel = Label().FindChild(ChildLab_NotePoints);
for (Standard_Integer i = 1; i <= theObject->NbNotePoints(); i++) {
TDataXtd_Point::Set(aPointsLabel.FindChild(i), theObject->NotePoint(i));
}
}
}
//=======================================================================
@@ -159,121 +188,176 @@ Handle(XCAFView_Object) XCAFDoc_View::GetObject() const
{
Handle(XCAFView_Object) anObj = new XCAFView_Object();
// Name
Handle(TDataStd_AsciiString) aName;
if (Label().FindChild(ChildLab_Name).FindAttribute(TDataStd_AsciiString::GetID(), aName))
TDF_ChildIterator it(Label(), false);
for ( ; it.More(); it.Next())
{
anObj->SetName(new TCollection_HAsciiString(aName->Get()));
}
// Type
Handle(TDataStd_Integer) aType;
if (Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType))
{
anObj->SetType((XCAFView_ProjectionType)aType->Get());
}
// Projection point
Handle(TDataXtd_Point) aPointAttr;
if (Label().FindChild(ChildLab_ProjectionPoint).FindAttribute(TDataXtd_Point::GetID(), aPointAttr)) {
gp_Pnt aPoint;
TDataXtd_Geometry::Point(aPointAttr->Label(), aPoint);
anObj->SetProjectionPoint(aPoint);
}
// View direction
Handle(TDataXtd_Axis) aViewDirAttr;
if (Label().FindChild(ChildLab_ViewDirection).FindAttribute(TDataXtd_Axis::GetID(), aViewDirAttr)) {
gp_Ax1 aDir;
TDataXtd_Geometry::Axis(aViewDirAttr->Label(), aDir);
anObj->SetViewDirection(aDir.Direction());
}
// Up direction
Handle(TDataXtd_Axis) anUpDirAttr;
if (Label().FindChild(ChildLab_UpDirection).FindAttribute(TDataXtd_Axis::GetID(), anUpDirAttr)) {
gp_Ax1 aDir;
TDataXtd_Geometry::Axis(anUpDirAttr->Label(), aDir);
anObj->SetUpDirection(aDir.Direction());
}
// Zoom factor
Handle(TDataStd_Real) aZoomFactor;
if (Label().FindChild(ChildLab_ZoomFactor).FindAttribute(TDataStd_Real::GetID(), aZoomFactor))
{
anObj->SetZoomFactor(aZoomFactor->Get());
}
// Window horizontal size
Handle(TDataStd_Real) aWindowHorizontalSize;
if (Label().FindChild(ChildLab_WindowHorizontalSize).FindAttribute(TDataStd_Real::GetID(), aWindowHorizontalSize))
{
anObj->SetWindowHorizontalSize(aWindowHorizontalSize->Get());
}
// Window vertical size
Handle(TDataStd_Real) aWindowVerticalSize;
if (Label().FindChild(ChildLab_WindowVerticalSize).FindAttribute(TDataStd_Real::GetID(), aWindowVerticalSize))
{
anObj->SetWindowVerticalSize(aWindowVerticalSize->Get());
}
// Front plane clipping
Handle(TDataStd_Real) aFrontPlaneDistance;
if (Label().FindChild(ChildLab_FrontPlaneDistance).FindAttribute(TDataStd_Real::GetID(), aFrontPlaneDistance))
{
anObj->SetFrontPlaneDistance(aFrontPlaneDistance->Get());
}
// Back plane clipping
Handle(TDataStd_Real) aBackPlaneDistance;
if (Label().FindChild(ChildLab_BackPlaneDistance).FindAttribute(TDataStd_Real::GetID(), aBackPlaneDistance))
{
anObj->SetBackPlaneDistance(aBackPlaneDistance->Get());
}
// View volume sides clipping
Handle(TDataStd_Integer) aViewVolumeSidesClipping;
if (Label().FindChild(ChildLab_ViewVolumeSidesClipping).FindAttribute(TDataStd_Integer::GetID(), aViewVolumeSidesClipping))
{
Standard_Boolean aValue = (aViewVolumeSidesClipping->Get() == 1);
anObj->SetViewVolumeSidesClipping(aValue);
}
// Name
Handle(TDataStd_AsciiString) aClippingExpression;
if (Label().FindChild(ChildLab_ClippingExpression).FindAttribute(TDataStd_AsciiString::GetID(), aClippingExpression))
{
anObj->SetClippingExpression(new TCollection_HAsciiString(aClippingExpression->Get()));
}
// GDT Points
if (!Label().FindChild(ChildLab_GDTPoints, Standard_False).IsNull()) {
TDF_Label aPointsLabel = Label().FindChild(ChildLab_GDTPoints);
// Find out the number of stored GDT-points in Ocaf tree.
Standard_Integer aNbGDTPoints = 0;
Handle(TDataXtd_Point) aGDTPointAttr;
TDF_ChildIterator anItrPnts (aPointsLabel, Standard_False);
for (; anItrPnts.More(); anItrPnts.Next()) {
if (anItrPnts.Value().FindAttribute (TDataXtd_Point::GetID(), aGDTPointAttr))
aNbGDTPoints++;
TDF_Label aLabel = it.Value();
ChildLab aTag = static_cast<ChildLab>(aLabel.Tag());
if (aTag == ChildLab_Name)
{
// Name
Handle(TDataStd_AsciiString) aName;
if (aLabel.FindAttribute(TDataStd_AsciiString::GetID(), aName))
{
anObj->SetName(new TCollection_HAsciiString(aName->Get()));
}
}
// Allocate the GDT-points and fill them in from Ocaf tree.
if (aNbGDTPoints) {
anObj->CreateGDTPoints (aNbGDTPoints);
const Standard_Integer aNbChildren = aPointsLabel.NbChildren();
for (Standard_Integer aLabelIndex = 1, aPointIndex = 1; aLabelIndex <= aNbChildren; aLabelIndex++) {
else if (aTag == ChildLab_Type)
{
// Type
Handle(TDataStd_Integer) aType;
if (aLabel.FindAttribute(TDataStd_Integer::GetID(), aType))
{
anObj->SetType((XCAFView_ProjectionType)aType->Get());
}
}
else if (aTag == ChildLab_ProjectionPoint)
{
// Projection point
Handle(TDataXtd_Point) aPointAttr;
if (aLabel.FindAttribute(TDataXtd_Point::GetID(), aPointAttr))
{
gp_Pnt aPoint;
if (aPointsLabel.FindChild (aLabelIndex).FindAttribute (TDataXtd_Point::GetID(), aGDTPointAttr)) {
TDataXtd_Geometry::Point (aGDTPointAttr->Label(), aPoint);
anObj->SetGDTPoint (aPointIndex++, aPoint);
TDataXtd_Geometry::Point(aPointAttr->Label(), aPoint);
anObj->SetProjectionPoint(aPoint);
}
}
else if (aTag == ChildLab_ViewDirection)
{
// View direction
Handle(TDataXtd_Axis) aViewDirAttr;
if (aLabel.FindAttribute(TDataXtd_Axis::GetID(), aViewDirAttr))
{
gp_Ax1 aDir;
TDataXtd_Geometry::Axis(aViewDirAttr->Label(), aDir);
anObj->SetViewDirection(aDir.Direction());
}
}
else if (aTag == ChildLab_UpDirection)
{
// Up direction
Handle(TDataXtd_Axis) anUpDirAttr;
if (aLabel.FindAttribute(TDataXtd_Axis::GetID(), anUpDirAttr))
{
gp_Ax1 aDir;
TDataXtd_Geometry::Axis(anUpDirAttr->Label(), aDir);
anObj->SetUpDirection(aDir.Direction());
}
}
else if (aTag == ChildLab_ZoomFactor)
{
// Zoom factor
Handle(TDataStd_Real) aZoomFactor;
if (aLabel.FindAttribute(TDataStd_Real::GetID(), aZoomFactor))
{
anObj->SetZoomFactor(aZoomFactor->Get());
}
}
else if (aTag == ChildLab_WindowHorizontalSize)
{
// Window horizontal size
Handle(TDataStd_Real) aWindowHorizontalSize;
if (aLabel.FindAttribute(TDataStd_Real::GetID(), aWindowHorizontalSize))
{
anObj->SetWindowHorizontalSize(aWindowHorizontalSize->Get());
}
}
else if (aTag == ChildLab_WindowVerticalSize)
{
// Window vertical size
Handle(TDataStd_Real) aWindowVerticalSize;
if (aLabel.FindAttribute(TDataStd_Real::GetID(), aWindowVerticalSize))
{
anObj->SetWindowVerticalSize(aWindowVerticalSize->Get());
}
}
else if (aTag == ChildLab_FrontPlaneDistance)
{
// Front plane clipping
Handle(TDataStd_Real) aFrontPlaneDistance;
if (aLabel.FindAttribute(TDataStd_Real::GetID(), aFrontPlaneDistance))
{
anObj->SetFrontPlaneDistance(aFrontPlaneDistance->Get());
}
}
else if (aTag == ChildLab_BackPlaneDistance)
{
// Back plane clipping
Handle(TDataStd_Real) aBackPlaneDistance;
if (aLabel.FindAttribute(TDataStd_Real::GetID(), aBackPlaneDistance))
{
anObj->SetBackPlaneDistance(aBackPlaneDistance->Get());
}
}
else if (aTag == ChildLab_ViewVolumeSidesClipping)
{
// View volume sides clipping
Handle(TDataStd_Integer) aViewVolumeSidesClipping;
if (aLabel.FindAttribute(TDataStd_Integer::GetID(), aViewVolumeSidesClipping))
{
Standard_Boolean aValue = (aViewVolumeSidesClipping->Get() == 1);
anObj->SetViewVolumeSidesClipping(aValue);
}
}
else if (aTag == ChildLab_ClippingExpression)
{
// Name
Handle(TDataStd_AsciiString) aClippingExpression;
if (aLabel.FindAttribute(TDataStd_AsciiString::GetID(), aClippingExpression))
{
anObj->SetClippingExpression(new TCollection_HAsciiString(aClippingExpression->Get()));
}
}
else if (aTag == ChildLab_GDTPoints)
{
// GDT Points
if (!aLabel.IsNull())
{
anObj->CreateGDTPoints(aLabel.NbChildren());
for (Standard_Integer i = 1; i <= aLabel.NbChildren(); i++)
{
gp_Pnt aPoint;
Handle(TDataXtd_Point) aGDTPointAttr;
aLabel.FindChild(i).FindAttribute(TDataXtd_Point::GetID(), aGDTPointAttr);
TDataXtd_Geometry::Point(aGDTPointAttr->Label(), aPoint);
anObj->SetGDTPoint(i, aPoint);
}
}
}
else if (aTag == ChildLab_Image)
{
//Image
Handle(TDataStd_ByteArray) anArr;
if (aLabel.FindAttribute(TDataStd_ByteArray::GetID(), anArr))
{
anObj->SetImage(anArr->InternalArray());
}
}
else if (aTag == ChildLab_EnabledShapes)
{
// Shapes transparency
Handle(TDataStd_IntegerArray) anArr;
if (aLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anArr))
{
anObj->SetEnabledShapes(anArr->Array());
}
}
else if (aTag == ChildLab_NotePoints)
{
// Note Points
anObj->CreateNotePoints(aLabel.NbChildren());
TDF_ChildIterator itPoints(aLabel);
int index = 1;
for (; itPoints.More(); itPoints.Next(), ++index)
{
gp_Pnt aPoint;
Handle(TDataXtd_Point) aPointAttr;
itPoints.Value().FindAttribute(TDataXtd_Point::GetID(), aPointAttr);
TDataXtd_Geometry::Point(aPointAttr->Label(), aPoint);
anObj->SetNotePoint(index, aPoint);
}
}
}
return anObj;
}

View File

@@ -305,11 +305,10 @@ void XCAFDoc_ViewTool::SetView(const TDF_LabelSequence& theShapeLabels,
aPlaneGNode = aChGNode->GetFather(1);
aPlaneGNode->UnSetChild(aChGNode);
if (aPlaneGNode->NbChildren() == 0)
aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID());
aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefPlaneGUID());
}
theViewL.ForgetAttribute(XCAFDoc::ViewRefPlaneGUID());
}
if (!theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode) && theShapeLabels.Length() > 0) {
aChGNode = new XCAFDoc_GraphNode;
aChGNode = XCAFDoc_GraphNode::Set(theViewL);
@@ -444,7 +443,7 @@ void XCAFDoc_ViewTool::SetClippingPlanes(const TDF_LabelSequence& theClippingPla
aPlaneGNode = aChGNode->GetFather(1);
aPlaneGNode->UnSetChild(aChGNode);
if (aPlaneGNode->NbChildren() == 0)
aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID());
aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefPlaneGUID());
}
theViewL.ForgetAttribute(XCAFDoc::ViewRefPlaneGUID());
}
@@ -465,7 +464,86 @@ void XCAFDoc_ViewTool::SetClippingPlanes(const TDF_LabelSequence& theClippingPla
aChGNode->SetFather(aPlaneGNode);
}
}
//=======================================================================
//function : SetEnabledShapes
//purpose :
//=======================================================================
void XCAFDoc_ViewTool::SetEnabledShapes(const TDF_LabelSequence& theShapesTransparencyLabels,
const TDF_Label& theViewL) const
{
if (!IsView(theViewL))
return;
Handle(XCAFDoc_GraphNode) aChGNode;
Handle(XCAFDoc_GraphNode) aShapeGNode;
if (theViewL.FindAttribute(XCAFDoc::ViewRefEnabledShapesGUID(), aChGNode)) {
while (aChGNode->NbFathers() > 0) {
aShapeGNode = aChGNode->GetFather(1);
aShapeGNode->UnSetChild(aChGNode);
if (aShapeGNode->NbChildren() == 0)
aShapeGNode->ForgetAttribute(XCAFDoc::ViewRefEnabledShapesGUID());
}
theViewL.ForgetAttribute(XCAFDoc::ViewRefEnabledShapesGUID());
}
if (!theViewL.FindAttribute(XCAFDoc::ViewRefEnabledShapesGUID(), aChGNode) && theShapesTransparencyLabels.Length() > 0) {
aChGNode = new XCAFDoc_GraphNode;
aChGNode = XCAFDoc_GraphNode::Set(theViewL);
aChGNode->SetGraphID(XCAFDoc::ViewRefEnabledShapesGUID());
}
for (Standard_Integer i = theShapesTransparencyLabels.Lower(); i <= theShapesTransparencyLabels.Upper(); i++)
{
if (!theShapesTransparencyLabels.Value(i).FindAttribute(XCAFDoc::ViewRefEnabledShapesGUID(), aShapeGNode)) {
aShapeGNode = new XCAFDoc_GraphNode;
aShapeGNode = XCAFDoc_GraphNode::Set(theShapesTransparencyLabels.Value(i));
}
aShapeGNode->SetGraphID(XCAFDoc::ViewRefEnabledShapesGUID());
aShapeGNode->SetChild(aChGNode);
aChGNode->SetFather(aShapeGNode);
}
}
//=======================================================================
//function : SetNotes
//purpose :
//=======================================================================
void XCAFDoc_ViewTool::SetNotes(const TDF_LabelSequence& theNoteLabels,
const TDF_Label& theViewL) const
{
if (!IsView(theViewL))
return;
Handle(XCAFDoc_GraphNode) aChGNode;
Handle(XCAFDoc_GraphNode) aNoteGNode;
if (theViewL.FindAttribute(XCAFDoc::ViewRefNoteGUID(), aChGNode)) {
while (aChGNode->NbFathers() > 0) {
aNoteGNode = aChGNode->GetFather(1);
aNoteGNode->UnSetChild(aChGNode);
if (aNoteGNode->NbChildren() == 0)
aNoteGNode->ForgetAttribute(XCAFDoc::ViewRefNoteGUID());
}
theViewL.ForgetAttribute(XCAFDoc::ViewRefNoteGUID());
}
if (!theViewL.FindAttribute(XCAFDoc::ViewRefNoteGUID(), aChGNode) && theNoteLabels.Length() > 0) {
aChGNode = new XCAFDoc_GraphNode;
aChGNode = XCAFDoc_GraphNode::Set(theViewL);
aChGNode->SetGraphID(XCAFDoc::ViewRefNoteGUID());
}
for (Standard_Integer i = theNoteLabels.Lower(); i <= theNoteLabels.Upper(); i++)
{
if (!theNoteLabels.Value(i).FindAttribute(XCAFDoc::ViewRefNoteGUID(), aNoteGNode)) {
aNoteGNode = new XCAFDoc_GraphNode;
aNoteGNode = XCAFDoc_GraphNode::Set(theNoteLabels.Value(i));
}
aNoteGNode->SetGraphID(XCAFDoc::ViewRefNoteGUID());
aNoteGNode->SetChild(aChGNode);
aChGNode->SetFather(aNoteGNode);
}
}
//=======================================================================
//function : RemoveView
//purpose :
@@ -579,6 +657,30 @@ Standard_Boolean XCAFDoc_ViewTool::GetRefClippingPlaneLabel(const TDF_Label& the
return Standard_True;
}
//=======================================================================
//function : GetRefEnabledShapesLabel
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ViewTool::GetRefEnabledShapesLabel(const TDF_Label& theViewL,
TDF_LabelSequence& theShapesTranspanencyLabels) const
{
theShapesTranspanencyLabels.Clear();
Handle(TDataStd_TreeNode) aNode;
if (!theViewL.FindAttribute(XCAFDoc::ViewRefGUID(), aNode) || !aNode->HasFather()) {
Handle(XCAFDoc_GraphNode) aGNode;
if (theViewL.FindAttribute(XCAFDoc::ViewRefEnabledShapesGUID(), aGNode) && aGNode->NbFathers() > 0) {
for (Standard_Integer i = 1; i <= aGNode->NbFathers(); i++)
theShapesTranspanencyLabels.Append(aGNode->GetFather(i)->Label());
return Standard_True;
}
else
return Standard_False;
}
theShapesTranspanencyLabels.Append(aNode->Father()->Label());
return Standard_True;
}
//=======================================================================
//function : GetRefNoteLabel
//purpose :
@@ -684,6 +786,25 @@ Standard_Boolean XCAFDoc_ViewTool::GetViewLabelsForClippingPlane(const TDF_Label
return aResult;
}
//=======================================================================
//function :GetViewLabelsForEnabledShapesLabel
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ViewTool::GetViewLabelsForEnabledShapesLabel(const TDF_Label& theShapesTransparencyL,
TDF_LabelSequence& theViews) const
{
Handle(XCAFDoc_GraphNode) aGNode;
Standard_Boolean aResult = Standard_False;
if (theShapesTransparencyL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), 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 : GetViewLabelsForNote
//purpose :

View File

@@ -86,6 +86,12 @@ public:
//! Set Clipping planes to given View
Standard_EXPORT void SetClippingPlanes(const TDF_LabelSequence& theClippingPlaneLabels,
const TDF_Label& theViewL) const;
Standard_EXPORT void SetEnabledShapes(const TDF_LabelSequence& theShapesTransparencyLabels,
const TDF_Label& theViewL) const;
//! Set Notes to given View
Standard_EXPORT void SetNotes(const TDF_LabelSequence& theNoteLabels,
const TDF_Label& theViewL) const;
//! Remove View
Standard_EXPORT void RemoveView(const TDF_Label& theViewL);
@@ -105,6 +111,9 @@ public:
//! Returns all View labels defined for label AnnotationL
Standard_EXPORT Standard_Boolean GetViewLabelsForAnnotation(const TDF_Label& theAnnotationL, TDF_LabelSequence& theViews) const;
//! Returns all View labels defined for label Shapes transparency
Standard_EXPORT Standard_Boolean GetViewLabelsForEnabledShapesLabel(const TDF_Label& theShapesTransparencyL, TDF_LabelSequence& theViews) const;
//! Adds a view definition to a View table and returns its label
Standard_EXPORT TDF_Label AddView() ;
@@ -120,6 +129,9 @@ 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 shapes transparency labels defined for label theViewL
//! Returns False if the theViewL is not in View table
Standard_EXPORT Standard_Boolean GetRefEnabledShapesLabel(const TDF_Label& theViewL, TDF_LabelSequence& theShapesTranspanencyLabels) 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;

View File

@@ -28,6 +28,9 @@ XCAFView_Object::XCAFView_Object()
myBackPlaneClipping = Standard_False;
myViewVolumeSidesClipping = Standard_False;
myGDTPoints = NULL;
myImage = NULL;
myEnabledShapes = NULL;
myNotePoints = NULL;
}
//=======================================================================
@@ -50,5 +53,8 @@ XCAFView_Object::XCAFView_Object(const Handle(XCAFView_Object)& theObj)
myBackPlaneDistance = theObj->myBackPlaneDistance;
myViewVolumeSidesClipping = theObj->myViewVolumeSidesClipping;
myGDTPoints = NULL;
myImage = theObj->myImage;
myEnabledShapes = theObj->myEnabledShapes;
myGDTPoints = NULL;
}

View File

@@ -26,6 +26,8 @@
#include <TColgp_HArray1OfPnt.hxx>
#include <TCollection_HAsciiString.hxx>
#include <XCAFView_ProjectionType.hxx>
#include <TColStd_HArray1OfByte.hxx>
#include <TColStd_HArray1OfInteger.hxx>
class XCAFView_Object;
DEFINE_STANDARD_HANDLE(XCAFView_Object, Standard_Transient)
@@ -217,7 +219,104 @@ public:
else
return gp_Pnt();
}
Standard_EXPORT void SetImage(Handle(TColStd_HArray1OfByte) theImage)
{
myImage = theImage;
}
Standard_EXPORT Handle(TColStd_HArray1OfByte) Image()
{
return myImage;
}
Standard_EXPORT Standard_Boolean HasImage()
{
return (!myImage.IsNull());
}
Standard_EXPORT void CreateEnabledShapes(const Standard_Integer theLenght)
{
if (theLenght > 0)
myEnabledShapes = new TColStd_HArray1OfInteger(1, theLenght);
}
Standard_EXPORT void SetEnabledShapes(Handle(TColStd_HArray1OfInteger) theArray)
{
myEnabledShapes = theArray;
}
const Handle(TColStd_HArray1OfInteger)& GetEnabledShapes() const
{
return myEnabledShapes;
}
Standard_EXPORT Standard_Boolean HasEnabledShapes()
{
return (!myEnabledShapes.IsNull());
}
Standard_EXPORT Standard_Integer NbEnabledShapes()
{
if (myEnabledShapes.IsNull())
return 0;
return myEnabledShapes->Length();
}
Standard_EXPORT void SetEnabledShape(const Standard_Integer theIndex, const Standard_Boolean theVal)
{
if (myEnabledShapes.IsNull())
return;
if (theIndex > 0 && theIndex <= myEnabledShapes->Length())
myEnabledShapes->SetValue(theIndex, theVal);
}
Standard_EXPORT Standard_Boolean EnabledShape(const Standard_Integer theIndex)
{
if (myEnabledShapes.IsNull())
return Standard_False;
if (theIndex > 0 && theIndex <= myEnabledShapes->Length())
return myEnabledShapes->Value(theIndex) == 1;
else
return Standard_False;
}
Standard_EXPORT void CreateNotePoints(const Standard_Integer theLenght)
{
if (theLenght > 0)
myNotePoints = new TColgp_HArray1OfPnt(1, theLenght);
}
Standard_EXPORT Standard_Boolean HasNotePoints()
{
return (!myNotePoints.IsNull());
}
Standard_EXPORT Standard_Integer NbNotePoints()
{
if (myNotePoints.IsNull())
return 0;
return myNotePoints->Length();
}
Standard_EXPORT void SetNotePoint(const Standard_Integer theIndex, const gp_Pnt thePoint)
{
if (myNotePoints.IsNull())
return;
if (theIndex > 0 && theIndex <= myNotePoints->Length())
myNotePoints->SetValue(theIndex, thePoint);
}
Standard_EXPORT gp_Pnt NotePoint(const Standard_Integer theIndex)
{
if (myNotePoints.IsNull())
return gp_Pnt();
if (theIndex > 0 && theIndex <= myNotePoints->Length())
return myNotePoints->Value(theIndex);
else
return gp_Pnt();
}
DEFINE_STANDARD_RTTIEXT(XCAFView_Object,Standard_Transient)
private:
@@ -237,6 +336,9 @@ private:
Standard_Real myBackPlaneDistance;
Standard_Boolean myViewVolumeSidesClipping;
Handle(TColgp_HArray1OfPnt) myGDTPoints; // Point for each GDT to describe position of GDT frame in View.
Handle(TColStd_HArray1OfByte) myImage;
Handle(TColStd_HArray1OfInteger) myEnabledShapes;
Handle(TColgp_HArray1OfPnt) myNotePoints;
};
#endif // _XCAFView_Object_HeaderFile