diff --git a/src/XCAFDoc/XCAFDoc_View.cxx b/src/XCAFDoc/XCAFDoc_View.cxx index 01f5da5dbf..dcd06a1d82 100644 --- a/src/XCAFDoc/XCAFDoc_View.cxx +++ b/src/XCAFDoc/XCAFDoc_View.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,8 @@ enum ChildLab ChildLab_BackPlaneDistance, ChildLab_ViewVolumeSidesClipping, ChildLab_ClippingExpression, - ChildLab_GDTPoints + ChildLab_GDTPoints, + ChildLab_Image }; //======================================================================= @@ -149,6 +151,15 @@ 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)); + } + } } //======================================================================= @@ -259,7 +270,11 @@ Handle(XCAFView_Object) XCAFDoc_View::GetObject() const anObj->SetGDTPoint(i, aPoint); } } - + //Image + Handle(TDataStd_ByteArray) anArr; + if (Label().FindChild(ChildLab_Image).FindAttribute(TDataStd_ByteArray::GetID(), anArr)) { + anObj->SetImage(anArr->InternalArray()); + } return anObj; } diff --git a/src/XCAFView/XCAFView_Object.cxx b/src/XCAFView/XCAFView_Object.cxx index bc1e06f1de..3b7ea48f44 100644 --- a/src/XCAFView/XCAFView_Object.cxx +++ b/src/XCAFView/XCAFView_Object.cxx @@ -28,6 +28,7 @@ XCAFView_Object::XCAFView_Object() myBackPlaneClipping = Standard_False; myViewVolumeSidesClipping = Standard_False; myGDTPoints = NULL; + myImage = NULL; } //======================================================================= @@ -50,5 +51,6 @@ XCAFView_Object::XCAFView_Object(const Handle(XCAFView_Object)& theObj) myBackPlaneDistance = theObj->myBackPlaneDistance; myViewVolumeSidesClipping = theObj->myViewVolumeSidesClipping; myGDTPoints = NULL; + myImage = theObj->myImage; } diff --git a/src/XCAFView/XCAFView_Object.hxx b/src/XCAFView/XCAFView_Object.hxx index 98b340796e..a41f6df732 100644 --- a/src/XCAFView/XCAFView_Object.hxx +++ b/src/XCAFView/XCAFView_Object.hxx @@ -26,6 +26,7 @@ #include #include #include +#include class XCAFView_Object; DEFINE_STANDARD_HANDLE(XCAFView_Object, Standard_Transient) @@ -217,7 +218,21 @@ 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()); + } DEFINE_STANDARD_RTTIEXT(XCAFView_Object,Standard_Transient) private: @@ -237,6 +252,7 @@ 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; }; #endif // _XCAFView_Object_HeaderFile