From 9cdeda1983956dd2b59b5b94f3ee35ad6954034f Mon Sep 17 00:00:00 2001 From: ibs Date: Tue, 15 Dec 2015 18:49:27 +0300 Subject: [PATCH] XCAFDimTolObjects_ GeomToleranceObject, DatumObject, DimensionObject has been extended with point: GetPoint2, SetPoint2, HasPoint2 methods have been implemented drivers for BinMXCAFDoc_GeomToleranceDriver and BinMXCAFDoc_DimensionDriver attributes are added --- src/BinMXCAFDoc/BinMXCAFDoc.cxx | 4 ++ src/BinMXCAFDoc/BinMXCAFDoc.hxx | 4 ++ .../BinMXCAFDoc_DimensionDriver.cxx | 68 +++++++++++++++++++ .../BinMXCAFDoc_DimensionDriver.hxx | 56 +++++++++++++++ .../BinMXCAFDoc_GeomToleranceDriver.cxx | 68 +++++++++++++++++++ .../BinMXCAFDoc_GeomToleranceDriver.hxx | 56 +++++++++++++++ src/BinMXCAFDoc/FILES | 4 ++ .../XCAFDimTolObjects_DatumObject.cxx | 3 + .../XCAFDimTolObjects_DatumObject.hxx | 13 +++- .../XCAFDimTolObjects_DimensionObject.cxx | 3 + .../XCAFDimTolObjects_DimensionObject.hxx | 12 ++++ .../XCAFDimTolObjects_GeomToleranceObject.cxx | 3 + .../XCAFDimTolObjects_GeomToleranceObject.hxx | 12 ++++ src/XCAFDoc/XCAFDoc_Datum.cxx | 21 ++++++ src/XCAFDoc/XCAFDoc_Dimension.cxx | 21 ++++++ src/XCAFDoc/XCAFDoc_GeomTolerance.cxx | 22 ++++++ 16 files changed, 369 insertions(+), 1 deletion(-) create mode 100644 src/BinMXCAFDoc/BinMXCAFDoc_DimensionDriver.cxx create mode 100644 src/BinMXCAFDoc/BinMXCAFDoc_DimensionDriver.hxx create mode 100644 src/BinMXCAFDoc/BinMXCAFDoc_GeomToleranceDriver.cxx create mode 100644 src/BinMXCAFDoc/BinMXCAFDoc_GeomToleranceDriver.hxx diff --git a/src/BinMXCAFDoc/BinMXCAFDoc.cxx b/src/BinMXCAFDoc/BinMXCAFDoc.cxx index 6e11985667..cc90e7219c 100644 --- a/src/BinMXCAFDoc/BinMXCAFDoc.cxx +++ b/src/BinMXCAFDoc/BinMXCAFDoc.cxx @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -59,6 +61,8 @@ 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_GeomToleranceDriver (theMsgDrv)); + theDriverTable->AddDriver( new BinMXCAFDoc_DimensionDriver (theMsgDrv)); theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver (theMsgDrv)); theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver (theMsgDrv)); diff --git a/src/BinMXCAFDoc/BinMXCAFDoc.hxx b/src/BinMXCAFDoc/BinMXCAFDoc.hxx index d0eca56625..571748edb3 100644 --- a/src/BinMXCAFDoc/BinMXCAFDoc.hxx +++ b/src/BinMXCAFDoc/BinMXCAFDoc.hxx @@ -29,6 +29,8 @@ class BinMXCAFDoc_GraphNodeDriver; class BinMXCAFDoc_LocationDriver; class BinMXCAFDoc_VolumeDriver; class BinMXCAFDoc_DatumDriver; +class BinMXCAFDoc_GeomToleranceDriver; +class BinMXCAFDoc_DimensionDriver; class BinMXCAFDoc_DimTolDriver; class BinMXCAFDoc_MaterialDriver; class BinMXCAFDoc_ColorToolDriver; @@ -71,6 +73,8 @@ friend class BinMXCAFDoc_GraphNodeDriver; friend class BinMXCAFDoc_LocationDriver; friend class BinMXCAFDoc_VolumeDriver; friend class BinMXCAFDoc_DatumDriver; +friend class BinMXCAFDoc_GeomToleranceDriver; +friend class BinMXCAFDoc_DimensionDriver; friend class BinMXCAFDoc_DimTolDriver; friend class BinMXCAFDoc_MaterialDriver; friend class BinMXCAFDoc_ColorToolDriver; diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_DimensionDriver.cxx b/src/BinMXCAFDoc/BinMXCAFDoc_DimensionDriver.cxx new file mode 100644 index 0000000000..160abcc9da --- /dev/null +++ b/src/BinMXCAFDoc/BinMXCAFDoc_DimensionDriver.cxx @@ -0,0 +1,68 @@ +// Created on: +// Created by: +// Copyright (c) 2015 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 +#include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_DimensionDriver,BinMDF_ADriver) + +//======================================================================= +//function : Constructor +//purpose : +//======================================================================= +BinMXCAFDoc_DimensionDriver::BinMXCAFDoc_DimensionDriver (const Handle(CDM_MessageDriver)& theMsgDriver) +: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Dimension)->Name()) +{ +} + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= +Handle(TDF_Attribute) BinMXCAFDoc_DimensionDriver::NewEmpty() const +{ + return new XCAFDoc_Dimension(); +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= +Standard_Boolean BinMXCAFDoc_DimensionDriver::Paste (const BinObjMgt_Persistent& /*theSource*/, + const Handle(TDF_Attribute)& /*theTarget*/, + BinObjMgt_RRelocationTable& /*theRelocTable*/) const +{ + //Handle(XCAFDoc_Dimension) anAtt = Handle(XCAFDoc_Dimension)::DownCast(theTarget); + return Standard_True; +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= +void BinMXCAFDoc_DimensionDriver::Paste (const Handle(TDF_Attribute)& /*theSource*/, + BinObjMgt_Persistent& /*theTarget*/, + BinObjMgt_SRelocationTable& /*theRelocTable*/) const +{ + //Handle(XCAFDoc_Dimension) anAtt = Handle(XCAFDoc_Dimension)::DownCast(theSource); +} diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_DimensionDriver.hxx b/src/BinMXCAFDoc/BinMXCAFDoc_DimensionDriver.hxx new file mode 100644 index 0000000000..3be43adede --- /dev/null +++ b/src/BinMXCAFDoc/BinMXCAFDoc_DimensionDriver.hxx @@ -0,0 +1,56 @@ +// Created on: +// Created by: +// Copyright (c) 20015 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_DimensionDriver_HeaderFile +#define _BinMXCAFDoc_DimensionDriver_HeaderFile + +#include +#include + +#include +#include +#include +#include + +class CDM_MessageDriver; +class TDF_Attribute; +class BinObjMgt_Persistent; + +class BinMXCAFDoc_DimensionDriver; +DEFINE_STANDARD_HANDLE(BinMXCAFDoc_DimensionDriver, BinMDF_ADriver) + +class BinMXCAFDoc_DimensionDriver : public BinMDF_ADriver +{ + +public: + + + Standard_EXPORT BinMXCAFDoc_DimensionDriver (const Handle(CDM_MessageDriver)& theMsgDriver); + + Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource, + const Handle(TDF_Attribute)& theTarget, + BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE; + + Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource, + BinObjMgt_Persistent& theTarget, + BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_DimensionDriver,BinMDF_ADriver) + +}; + +#endif // _BinMXCAFDoc_DimensionDriver_HeaderFile diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_GeomToleranceDriver.cxx b/src/BinMXCAFDoc/BinMXCAFDoc_GeomToleranceDriver.cxx new file mode 100644 index 0000000000..59bb73e05d --- /dev/null +++ b/src/BinMXCAFDoc/BinMXCAFDoc_GeomToleranceDriver.cxx @@ -0,0 +1,68 @@ +// Created on: +// Created by: +// Copyright (c) 2015 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 +#include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_GeomToleranceDriver,BinMDF_ADriver) + +//======================================================================= +//function : Constructor +//purpose : +//======================================================================= +BinMXCAFDoc_GeomToleranceDriver::BinMXCAFDoc_GeomToleranceDriver (const Handle(CDM_MessageDriver)& theMsgDriver) +: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_GeomTolerance)->Name()) +{ +} + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= +Handle(TDF_Attribute) BinMXCAFDoc_GeomToleranceDriver::NewEmpty() const +{ + return new XCAFDoc_GeomTolerance(); +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= +Standard_Boolean BinMXCAFDoc_GeomToleranceDriver::Paste (const BinObjMgt_Persistent& /*theSource*/, + const Handle(TDF_Attribute)& /*theTarget*/, + BinObjMgt_RRelocationTable& /*theRelocTable*/) const +{ + //Handle(XCAFDoc_GeomTolerance) anAtt = Handle(XCAFDoc_GeomTolerance)::DownCast(theTarget); + return Standard_True; +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= +void BinMXCAFDoc_GeomToleranceDriver::Paste (const Handle(TDF_Attribute)& /*theSource*/, + BinObjMgt_Persistent& /*theTarget*/, + BinObjMgt_SRelocationTable& /*theRelocTable*/) const +{ + //Handle(XCAFDoc_GeomTolerance) anAtt = Handle(XCAFDoc_GeomTolerance)::DownCast(theSource); +} diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_GeomToleranceDriver.hxx b/src/BinMXCAFDoc/BinMXCAFDoc_GeomToleranceDriver.hxx new file mode 100644 index 0000000000..0c01139dc6 --- /dev/null +++ b/src/BinMXCAFDoc/BinMXCAFDoc_GeomToleranceDriver.hxx @@ -0,0 +1,56 @@ +// Created on: +// Created by: +// Copyright (c) 20015 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_GeomToleranceDriver_HeaderFile +#define _BinMXCAFDoc_GeomToleranceDriver_HeaderFile + +#include +#include + +#include +#include +#include +#include + +class CDM_MessageDriver; +class TDF_Attribute; +class BinObjMgt_Persistent; + +class BinMXCAFDoc_GeomToleranceDriver; +DEFINE_STANDARD_HANDLE(BinMXCAFDoc_GeomToleranceDriver, BinMDF_ADriver) + +class BinMXCAFDoc_GeomToleranceDriver : public BinMDF_ADriver +{ + +public: + + + Standard_EXPORT BinMXCAFDoc_GeomToleranceDriver (const Handle(CDM_MessageDriver)& theMsgDriver); + + Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource, + const Handle(TDF_Attribute)& theTarget, + BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE; + + Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource, + BinObjMgt_Persistent& theTarget, + BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_GeomToleranceDriver,BinMDF_ADriver) + +}; + +#endif // _BinMXCAFDoc_GeomToleranceDriver_HeaderFile diff --git a/src/BinMXCAFDoc/FILES b/src/BinMXCAFDoc/FILES index 83d4887e36..99b3cedc5e 100644 --- a/src/BinMXCAFDoc/FILES +++ b/src/BinMXCAFDoc/FILES @@ -10,12 +10,16 @@ BinMXCAFDoc_ColorToolDriver.cxx BinMXCAFDoc_ColorToolDriver.hxx BinMXCAFDoc_DatumDriver.cxx BinMXCAFDoc_DatumDriver.hxx +BinMXCAFDoc_DimensionDriver.cxx +BinMXCAFDoc_DimensionDriver.hxx BinMXCAFDoc_DimTolDriver.cxx BinMXCAFDoc_DimTolDriver.hxx BinMXCAFDoc_DimTolToolDriver.cxx BinMXCAFDoc_DimTolToolDriver.hxx BinMXCAFDoc_DocumentToolDriver.cxx BinMXCAFDoc_DocumentToolDriver.hxx +BinMXCAFDoc_GeomToleranceDriver.cxx +BinMXCAFDoc_GeomToleranceDriver.hxx BinMXCAFDoc_GraphNodeDriver.cxx BinMXCAFDoc_GraphNodeDriver.hxx BinMXCAFDoc_LayerToolDriver.cxx diff --git a/src/XCAFDimTolObjects/XCAFDimTolObjects_DatumObject.cxx b/src/XCAFDimTolObjects/XCAFDimTolObjects_DatumObject.cxx index 883c096b1b..884444db4d 100644 --- a/src/XCAFDimTolObjects/XCAFDimTolObjects_DatumObject.cxx +++ b/src/XCAFDimTolObjects/XCAFDimTolObjects_DatumObject.cxx @@ -26,6 +26,7 @@ XCAFDimTolObjects_DatumObject::XCAFDimTolObjects_DatumObject() myIsDTarget = Standard_False; myHasPlane = Standard_False; myHasPnt = Standard_False; + myHasPnt2 = Standard_False; } //======================================================================= @@ -45,8 +46,10 @@ XCAFDimTolObjects_DatumObject::XCAFDimTolObjects_DatumObject(const Handle(XCAFDi myDTargetType = theObj->myDTargetType; myPlane = theObj->myPlane; myPnt= theObj->myPnt; + myPnt2= theObj->myPnt2; myHasPlane = theObj->myHasPlane; myHasPnt = theObj->myHasPnt; + myHasPnt2 = theObj->myHasPnt2; } //======================================================================= diff --git a/src/XCAFDimTolObjects/XCAFDimTolObjects_DatumObject.hxx b/src/XCAFDimTolObjects/XCAFDimTolObjects_DatumObject.hxx index 189b15071e..2eeecc6dd0 100644 --- a/src/XCAFDimTolObjects/XCAFDimTolObjects_DatumObject.hxx +++ b/src/XCAFDimTolObjects/XCAFDimTolObjects_DatumObject.hxx @@ -107,10 +107,20 @@ public: const gp_Pnt& GetPoint() const { return myPnt; } + void SetPoint2 (const gp_Pnt& thePnt) + { + myPnt2 = thePnt; + myHasPnt2 = Standard_True; + } + + const gp_Pnt& GetPoint2() const { return myPnt2; } + Standard_Boolean HasPlane() const { return myHasPlane; } Standard_Boolean HasPoint() const { return myHasPnt; } + Standard_Boolean HasPoint2() const { return myHasPnt2; } + DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_DatumObject,Standard_Transient) private: @@ -129,9 +139,10 @@ private: Standard_Integer myDatumTargetNumber; gp_Ax2 myPlane; gp_Pnt myPnt; + gp_Pnt myPnt2; Standard_Boolean myHasPlane; Standard_Boolean myHasPnt; - + Standard_Boolean myHasPnt2; }; #endif // _XCAFDimTolObjects_DatumObject_HeaderFile diff --git a/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.cxx b/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.cxx index 93648e751f..78b2eea3ce 100644 --- a/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.cxx +++ b/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.cxx @@ -27,6 +27,7 @@ IMPLEMENT_STANDARD_RTTIEXT(XCAFDimTolObjects_DimensionObject,Standard_Transient) XCAFDimTolObjects_DimensionObject::XCAFDimTolObjects_DimensionObject() { myHasPlane = Standard_False; + myHasPnt2 = Standard_False; } //======================================================================= @@ -48,8 +49,10 @@ XCAFDimTolObjects_DimensionObject::XCAFDimTolObjects_DimensionObject(const Handl myPath = theObj->myPath; myDir = theObj->myDir; myPnts = theObj->myPnts; + myPnt2= theObj->myPnt2; myHasPlane = theObj->myHasPlane; myPlane = theObj->myPlane; + myHasPnt2 = theObj->myHasPnt2; } //======================================================================= diff --git a/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.hxx b/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.hxx index bdd2ebfac2..e65fee84a2 100644 --- a/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.hxx +++ b/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.hxx @@ -117,6 +117,14 @@ public: Standard_EXPORT void SetPoints (const Handle(TColgp_HArray1OfPnt)& thePnts); + void SetPoint2 (const gp_Pnt& thePnt) + { + myPnt2 = thePnt; + myHasPnt2 = Standard_True; + } + + const gp_Pnt& GetPoint2() const { return myPnt2; } + void SetPlane (const gp_Ax2& thePlane) { myPlane = thePlane; @@ -129,6 +137,8 @@ public: Standard_Boolean HasPoints() const { !myPnts.IsNull() && myPnts->Length() > 0; } + Standard_Boolean HasPoint2() const { return myHasPnt2; } + DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_DimensionObject,Standard_Transient) private: @@ -145,8 +155,10 @@ private: TopoDS_Edge myPath; gp_Dir myDir; Handle(TColgp_HArray1OfPnt) myPnts; + gp_Pnt myPnt2; gp_Ax2 myPlane; Standard_Boolean myHasPlane; + Standard_Boolean myHasPnt2; }; diff --git a/src/XCAFDimTolObjects/XCAFDimTolObjects_GeomToleranceObject.cxx b/src/XCAFDimTolObjects/XCAFDimTolObjects_GeomToleranceObject.cxx index ed68daa2f0..91e7a08e77 100644 --- a/src/XCAFDimTolObjects/XCAFDimTolObjects_GeomToleranceObject.cxx +++ b/src/XCAFDimTolObjects/XCAFDimTolObjects_GeomToleranceObject.cxx @@ -25,6 +25,7 @@ XCAFDimTolObjects_GeomToleranceObject::XCAFDimTolObjects_GeomToleranceObject() myHasAxis = Standard_False; myHasPlane = Standard_False; myHasPnt = Standard_False; + myHasPnt2 = Standard_False; } //======================================================================= @@ -46,8 +47,10 @@ XCAFDimTolObjects_GeomToleranceObject::XCAFDimTolObjects_GeomToleranceObject(con myHasAxis = theObj->myHasAxis; myPlane = theObj->myPlane; myPnt= theObj->myPnt; + myPnt2= theObj->myPnt2; myHasPlane = theObj->myHasPlane; myHasPnt = theObj->myHasPnt; + myHasPnt2 = theObj->myHasPnt2; } //======================================================================= diff --git a/src/XCAFDimTolObjects/XCAFDimTolObjects_GeomToleranceObject.hxx b/src/XCAFDimTolObjects/XCAFDimTolObjects_GeomToleranceObject.hxx index 8baaa71a81..42ce2c1848 100644 --- a/src/XCAFDimTolObjects/XCAFDimTolObjects_GeomToleranceObject.hxx +++ b/src/XCAFDimTolObjects/XCAFDimTolObjects_GeomToleranceObject.hxx @@ -100,9 +100,19 @@ public: const gp_Pnt& GetPoint() const { return myPnt; } + void SetPoint2 (const gp_Pnt& thePnt) + { + myPnt2 = thePnt; + myHasPnt2 = Standard_True; + } + + const gp_Pnt& GetPoint2() const { return myPnt2; } + Standard_Boolean HasPlane() const { return myHasPlane; } Standard_Boolean HasPoint() const { return myHasPnt; } + + Standard_Boolean HasPoint2() const { return myHasPnt2; } DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_GeomToleranceObject,Standard_Transient) @@ -120,8 +130,10 @@ private: Standard_Boolean myHasAxis; gp_Ax2 myPlane; gp_Pnt myPnt; + gp_Pnt myPnt2; Standard_Boolean myHasPlane; Standard_Boolean myHasPnt; + Standard_Boolean myHasPnt2; }; diff --git a/src/XCAFDoc/XCAFDoc_Datum.cxx b/src/XCAFDoc/XCAFDoc_Datum.cxx index 90609317da..755a92711d 100644 --- a/src/XCAFDoc/XCAFDoc_Datum.cxx +++ b/src/XCAFDoc/XCAFDoc_Datum.cxx @@ -52,6 +52,7 @@ enum ChildLab ChildLab_PlaneN, ChildLab_PlaneRef, ChildLab_Pnt, + ChildLab_Pnt2, }; //======================================================================= @@ -325,6 +326,19 @@ void XCAFDoc_Datum::SetObject(const Handle(XCAFDimTolObjects_DatumObject)& theOb Label().FindChild(ChildLab_Pnt).AddAttribute(aLoc); } + + if (theObject->HasPoint2()) + { + Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray(); + gp_Pnt aPnt2 = theObject->GetPoint2(); + + Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3); + for (Standard_Integer i = 1; i <= 3; i++) + aLocArr->SetValue(i, aPnt2.Coord(i)); + aLoc->ChangeArray(aLocArr); + + Label().FindChild(ChildLab_Pnt2).AddAttribute(aLoc); + } } //======================================================================= @@ -388,6 +402,13 @@ Handle(XCAFDimTolObjects_DatumObject) XCAFDoc_Datum::GetObject() const anObj->SetPoint(aP); } + Handle(TDataStd_RealArray) aPnt2; + if(Label().FindChild(ChildLab_Pnt2).FindAttribute(TDataStd_RealArray::GetID(), aPnt2) && aPnt2->Length() == 3 ) + { + gp_Pnt aP (aPnt2->Value(aPnt2->Lower()), aPnt2->Value(aPnt2->Lower()+1), aPnt2->Value(aPnt2->Lower()+2)); + anObj->SetPoint2(aP); + } + Handle(TDataStd_Integer) aIsDTarget; if(Label().FindChild(ChildLab_IsDTarget).FindAttribute(TDataStd_Integer::GetID(), aIsDTarget)) { diff --git a/src/XCAFDoc/XCAFDoc_Dimension.cxx b/src/XCAFDoc/XCAFDoc_Dimension.cxx index fe88fb0c15..2c52517ff4 100644 --- a/src/XCAFDoc/XCAFDoc_Dimension.cxx +++ b/src/XCAFDoc/XCAFDoc_Dimension.cxx @@ -45,6 +45,7 @@ enum ChildLab ChildLab_PlaneLoc, ChildLab_PlaneN, ChildLab_PlaneRef, + ChildLab_Pnt2, }; //======================================================================= @@ -215,6 +216,19 @@ void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObjec Label().FindChild(ChildLab_PlaneN).AddAttribute(aN); Label().FindChild(ChildLab_PlaneRef).AddAttribute(aR); } + + if (theObject->HasPoint2()) + { + Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray(); + gp_Pnt aPnt2 = theObject->GetPoint2(); + + Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3); + for (Standard_Integer i = 1; i <= 3; i++) + aLocArr->SetValue(i, aPnt2.Coord(i)); + aLoc->ChangeArray(aLocArr); + + Label().FindChild(ChildLab_Pnt2).AddAttribute(aLoc); + } } //======================================================================= @@ -309,6 +323,13 @@ Handle(XCAFDimTolObjects_DimensionObject) XCAFDoc_Dimension::GetObject() const anObj->SetPlane(anAx); } + Handle(TDataStd_RealArray) aPnt2; + if(Label().FindChild(ChildLab_Pnt2).FindAttribute(TDataStd_RealArray::GetID(), aPnt2) && aPnt2->Length() == 3 ) + { + gp_Pnt aP(aPnt2->Value(aPnt2->Lower()), aPnt2->Value(aPnt2->Lower()+1), aPnt2->Value(aPnt2->Lower()+2)); + anObj->SetPoint2(aP); + } + return anObj; } diff --git a/src/XCAFDoc/XCAFDoc_GeomTolerance.cxx b/src/XCAFDoc/XCAFDoc_GeomTolerance.cxx index 78b224143a..7c15323eb5 100644 --- a/src/XCAFDoc/XCAFDoc_GeomTolerance.cxx +++ b/src/XCAFDoc/XCAFDoc_GeomTolerance.cxx @@ -42,6 +42,7 @@ enum ChildLab ChildLab_PlaneN, ChildLab_PlaneRef, ChildLab_Pnt, + ChildLab_Pnt2, }; //======================================================================= @@ -219,6 +220,19 @@ void XCAFDoc_GeomTolerance::SetObject (const Handle(XCAFDimTolObjects_GeomTolera Label().FindChild(ChildLab_Pnt).AddAttribute(aLoc); } + + if (theObject->HasPoint2()) + { + Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray(); + gp_Pnt aPnt2 = theObject->GetPoint2(); + + Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3); + for (Standard_Integer i = 1; i <= 3; i++) + aLocArr->SetValue(i, aPnt2.Coord(i)); + aLoc->ChangeArray(aLocArr); + + Label().FindChild(ChildLab_Pnt2).AddAttribute(aLoc); + } } //======================================================================= @@ -313,6 +327,14 @@ Handle(XCAFDimTolObjects_GeomToleranceObject) XCAFDoc_GeomTolerance::GetObject() gp_Pnt aP(aLoc->Value(aPnt->Lower()), aPnt->Value(aPnt->Lower()+1), aPnt->Value(aPnt->Lower()+2)); anObj->SetPoint(aP); } + + Handle(TDataStd_RealArray) aPnt2; + if(Label().FindChild(ChildLab_Pnt2).FindAttribute(TDataStd_RealArray::GetID(), aPnt2) && aPnt2->Length() == 3 ) + { + gp_Pnt aP(aPnt2->Value(aPnt2->Lower()), aPnt2->Value(aPnt2->Lower()+1), aPnt2->Value(aPnt2->Lower()+2)); + anObj->SetPoint2(aP); + } + return anObj; } -- 2.39.5