From 127558670682d0855085546b488c4435a9f25581 Mon Sep 17 00:00:00 2001 From: rnc Date: Mon, 9 Jul 2012 12:26:16 +0000 Subject: [PATCH] Missing files --- .../AdvancedGUI_DividedDiskDlg.cxx | 227 ++++++++++++++ src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h | 62 ++++ src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx | 293 ++++++++++++++++++ src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx | 121 ++++++++ src/GEOMImpl/GEOMImpl_IDividedDisk.hxx | 45 +++ 5 files changed, 748 insertions(+) create mode 100644 src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx create mode 100644 src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h create mode 100644 src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx create mode 100644 src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx create mode 100644 src/GEOMImpl/GEOMImpl_IDividedDisk.hxx diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx new file mode 100644 index 000000000..13d45c6cf --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx @@ -0,0 +1,227 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include "AdvancedGUI_DividedDiskDlg.h" + +#include +#include +#include + +#include +#include +#include +#include + +// OCCT Includes +#include +#include +#include +#include +#include + +#include + +//================================================================================= +// Constructor +//================================================================================= +AdvancedGUI_DividedDiskDlg::AdvancedGUI_DividedDiskDlg (GeometryGUI* theGeometryGUI, QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false) +{ + QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_DIVIDEDDISK_R_RATIO"))); + QPixmap imageSel (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_DIVIDEDDISK_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_DIVIDEDDISK")); + mainFrame()->RadioButton1->setIcon(imageOp); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + GroupParams = new DlgRef_1Spin(centralWidget()); + //@@ setup dialog box layout here @@// + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupParams); + /***************************************************************/ + + setHelpFileName("create_divideddisk_page.html"); + + Init(); +} + +//================================================================================= +// Destructor +//================================================================================= +AdvancedGUI_DividedDiskDlg::~AdvancedGUI_DividedDiskDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::Init() +{ + // Get setting of step value from file configuration + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); + + // min, max, step and decimals for spin boxes & initial values + initSpinBox(GroupParams->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" ); + GroupParams->SpinBox_DX->setValue(100); + + // Signal/slot connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + this, SLOT(SetDoubleSpinBoxStep(double))); + + connect(GroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + initName(tr("GEOM_DIVIDEDDISK")); + + resize(minimumSizeHint()); + displayPreview(true); +} + +//================================================================================= +// function : SetDoubleSpinBoxStep() +// purpose : Double spin box management +//================================================================================= +void AdvancedGUI_DividedDiskDlg::SetDoubleSpinBoxStep (double step) +{ + //@@ set double spin box step for all spin boxes here @@// +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::ClickOnOk() +{ + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool AdvancedGUI_DividedDiskDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + + return true; +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + displayPreview(true); +} + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::ValueChangedInSpinBox() +{ + //@@ connect custom spin boxes or other widget to this slot in the Init() method for automatic preview update @@// + displayPreview(true); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr AdvancedGUI_DividedDiskDlg::createOperation() +{ + return getGeomEngine()->GetIAdvancedOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool AdvancedGUI_DividedDiskDlg::isValid (QString& msg) +{ + bool ok = true; + + //@@ add custom validation actions here @@// + + return ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool AdvancedGUI_DividedDiskDlg::execute (ObjectList& objects) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation()); + + //@@ retrieve input values from the widgets here @@// + CORBA::Double theR = GroupParams->SpinBox_DX->value(); //@@ init parameter value from dialog box @@; + CORBA::Double theRatio = 50; //@@ init parameter value from dialog box @@; + + // call engine function + anObj = anOper->MakeDividedDisk(theR, theRatio); + res = !anObj->_is_nil(); + if (res && !IsPreview()) + { + QStringList aParameters; + //@@ put stringified input parameters to the string list here to store in the data model for notebook @@// + //aParameters << @@ stringified parameter value @@; // R parameter + //aParameters << @@ stringified parameter value @@; // Ratio parameter + if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + + if (res) + objects.push_back(anObj._retn()); + + return res; +} diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h new file mode 100644 index 000000000..00da289da --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h @@ -0,0 +1,62 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef ADVANCEDGUI_DIVIDEDDISKDLG_H +#define ADVANCEDGUI_DIVIDEDDISKDLG_H + +#include + +class DlgRef_1Spin; + +//================================================================================= +// class : AdvancedGUI_DividedDiskDlg +// purpose : +//================================================================================= +class AdvancedGUI_DividedDiskDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + AdvancedGUI_DividedDiskDlg( GeometryGUI*, QWidget* = 0 ); + ~AdvancedGUI_DividedDiskDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + +private: + void Init(); + void enterEvent( QEvent* ); + +private: + DlgRef_1Spin* GroupParams; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void ValueChangedInSpinBox(); + void SetDoubleSpinBoxStep( double ); +}; + +#endif // ADVANCEDGUI_DIVIDEDDISKDLG_H diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx new file mode 100644 index 000000000..c4869a941 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx @@ -0,0 +1,293 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include + +#include +#include +#include +#include + +// OCCT includes +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include + +#include + +//@@ include required header files here @@// + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_DividedDiskDriver::GetID() +{ + static Standard_GUID aGUID("0b01da9a-c5da-11e1-8d80-78e7d1879630"); + return aGUID; +} + +//======================================================================= +//function : GEOMImpl_DividedDiskDriver +//purpose : +//======================================================================= +GEOMImpl_DividedDiskDriver::GEOMImpl_DividedDiskDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IDividedDisk aData (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == DIVIDEDDISK_R_RATIO) { + + // Getting data + double R = aData.GetR(); + double Ratio = aData.GetRatio(); + + // Geometry + gp_Dir ZDir(0,0,1); + gp_Dir XDir(1,0,0); + gp_Pnt Orig(0,0,0); + + // Circle + gp_Ax1 Ax1(Orig,ZDir); + gp_Ax2 Ax(Orig,ZDir,XDir); + gp_Circ aCircle(Ax, R); + + // Points + gp_Pnt P1(0.01*Ratio*R,0,0); + gp_Pnt P2(R,0,0); + gp_Pnt P3 = P2.Rotated(Ax1,M_PI/6.0); + gp_Pnt P4(P1.X(), + P1.X()/sqrt(3.0),0); + + //surfaces + gp_Ax2 anAx (gp::XOY()); + Handle(Geom_Plane) aPlane = new Geom_Plane (anAx); + + // Topology + + // Vertices + TopoDS_Vertex O = BRepBuilderAPI_MakeVertex(Orig); + TopoDS_Vertex V1_init = BRepBuilderAPI_MakeVertex(P1); + TopoDS_Vertex V2_init = BRepBuilderAPI_MakeVertex(P2); + TopoDS_Vertex V3 = BRepBuilderAPI_MakeVertex(P3); + TopoDS_Vertex V4 = BRepBuilderAPI_MakeVertex(P4); + + TopoDS_Vertex V1 = V1_init; + TopoDS_Vertex V2 = V2_init; + + //Rotation + gp_Trsf myTrsf; + myTrsf.SetRotation(Ax1, M_PI/3.0); + + BRepBuilderAPI_Transform xform(myTrsf); + xform.Perform(V1,Standard_True); + TopoDS_Vertex V1_60 = TopoDS::Vertex(xform.Shape()); + xform.Perform(V2,Standard_True); + TopoDS_Vertex V2_60 = TopoDS::Vertex(xform.Shape()); + + // Declaration of shapes (used in the loop) + TopoDS_Edge E1, E2, E3, E4, E5, E6, E7, E8, E9; + TopoDS_Wire W1, W2, W3; + TopoDS_Face F1, F2, F3; + TopoDS_Shell S; + + BRep_Builder aBuilder; + aBuilder.MakeShell(S); + + // Initialisation of edges + TopoDS_Edge E1_init = BRepBuilderAPI_MakeEdge(V1,TopoDS::Vertex(V2.Reversed())); + E1 = E1_init; + TopoDS_Edge E8_init = BRepBuilderAPI_MakeEdge(O,TopoDS::Vertex(V1.Reversed())); + E8 = E8_init; + + for (int i=1;i<=6;i++) + { + // Edges + // for Face1 + E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V3.Reversed())); + E3 = BRepBuilderAPI_MakeEdge(V3,TopoDS::Vertex(V4.Reversed())); + E4 = BRepBuilderAPI_MakeEdge(V4,TopoDS::Vertex(V1.Reversed())); + + // for Face2 + if (i==6) + { + E5 = BRepBuilderAPI_MakeEdge(aCircle, V3, TopoDS::Vertex(V2_init.Reversed())); + E7 = BRepBuilderAPI_MakeEdge(V1_init,TopoDS::Vertex(V4.Reversed())); + } + else + { + E5 = BRepBuilderAPI_MakeEdge(aCircle, V3, TopoDS::Vertex(V2_60.Reversed())); + E7 = BRepBuilderAPI_MakeEdge(V1_60,TopoDS::Vertex(V4.Reversed())); + } + E6 = BRepBuilderAPI_MakeEdge(V2_60,TopoDS::Vertex(V1_60.Reversed())); + + // for Face3 + E9 = BRepBuilderAPI_MakeEdge(V1_60,TopoDS::Vertex(O.Reversed())); + + + // Wires + //Wire1 + aBuilder.MakeWire(W1); + if (i==1) + aBuilder.Add(W1,E1); + else + aBuilder.Add(W1,TopoDS::Edge(E1.Reversed())); + aBuilder.Add(W1,E2); + aBuilder.Add(W1,E3); + aBuilder.Add(W1,E4); + + // Wire 2 + aBuilder.MakeWire(W2); + aBuilder.Add(W2,TopoDS::Edge(E3.Reversed())); + aBuilder.Add(W2,E5); + if (i==6) + aBuilder.Add(W2,TopoDS::Edge(E1_init.Reversed())); + else + aBuilder.Add(W2,E6); + aBuilder.Add(W2,E7); + + // Wire3 + aBuilder.MakeWire(W3); + if (i==1) + aBuilder.Add(W3,E8); + else + aBuilder.Add(W3,TopoDS::Edge(E8.Reversed())); + aBuilder.Add(W3,TopoDS::Edge(E4.Reversed())); + aBuilder.Add(W3,TopoDS::Edge(E7.Reversed())); + if (i==6) + aBuilder.Add(W3,TopoDS::Edge(E8_init.Reversed())); + else + aBuilder.Add(W3,E9); + + // Faces creation + F1 = BRepBuilderAPI_MakeFace(aPlane,W1); + F2 = BRepBuilderAPI_MakeFace(aPlane,W2); + F3 = BRepBuilderAPI_MakeFace(aPlane,W3); + + //Shell + aBuilder.Add(S, F1); + aBuilder.Add(S, F2); + aBuilder.Add(S, F3); + + + // rotation + V1=V1_60; + V2=V2_60; + + xform.Perform(V1_60,Standard_True); + V1_60 = TopoDS::Vertex(xform.Shape()); + xform.Perform(V2_60,Standard_True); + V2_60 = TopoDS::Vertex(xform.Shape()); + xform.Perform(V3,Standard_True); + V3 = TopoDS::Vertex(xform.Shape()); + xform.Perform(V4,Standard_True); + V4 = TopoDS::Vertex(xform.Shape()); + + // "Increment" of edges + E1=E6; + E8=E9; + } + + aShape = S; + } + else { + // other construction modes here + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + +//======================================================================= +//function : GEOMImpl_DividedDiskDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_DividedDiskDriver_Type_() +{ + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_DividedDiskDriver", + sizeof(GEOMImpl_DividedDiskDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_DividedDiskDriver) Handle(GEOMImpl_DividedDiskDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_DividedDiskDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_DividedDiskDriver))) { + _anOtherObject = Handle(GEOMImpl_DividedDiskDriver)((Handle(GEOMImpl_DividedDiskDriver)&)AnObject); + } + } + + return _anOtherObject; +} diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx new file mode 100644 index 000000000..9ce52f7ed --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx @@ -0,0 +1,121 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMImpl_DividedDiskDriver_HXX +#define _GEOMImpl_DividedDiskDriver_HXX + +#include + +class Handle_Standard_Type; +class GEOMImpl_DividedDiskDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_DividedDiskDriver); + +class Handle(GEOMImpl_DividedDiskDriver) : public Handle(TFunction_Driver) { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_DividedDiskDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_DividedDiskDriver)(const Handle(GEOMImpl_DividedDiskDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + {} + + Handle(GEOMImpl_DividedDiskDriver)(const GEOMImpl_DividedDiskDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + {} + + Handle(GEOMImpl_DividedDiskDriver)& operator=(const Handle(GEOMImpl_DividedDiskDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_DividedDiskDriver)& operator=(const GEOMImpl_DividedDiskDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_DividedDiskDriver* operator->() + { + return (GEOMImpl_DividedDiskDriver *)ControlAccess(); + } + + GEOMImpl_DividedDiskDriver* operator->() const + { + return (GEOMImpl_DividedDiskDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_DividedDiskDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_DividedDiskDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +class GEOMImpl_DividedDiskDriver : public TFunction_Driver { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT GEOMImpl_DividedDiskDriver(); + Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; + Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} + Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const + { + return Standard_True; + } + Standard_EXPORT static const Standard_GUID& GetID(); + Standard_EXPORT ~GEOMImpl_DividedDiskDriver() {}; + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_DividedDiskDriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const + { + return STANDARD_TYPE(GEOMImpl_DividedDiskDriver); + } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const + { + return (STANDARD_TYPE(GEOMImpl_DividedDiskDriver) == AType || TFunction_Driver::IsKind(AType)); + } +}; + +#endif // _GEOMImpl_DividedDiskDriver_HXX diff --git a/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx b/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx new file mode 100644 index 000000000..96eb5eec7 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx @@ -0,0 +1,45 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMImpl_IDividedDisk_HXX_ +#define _GEOMImpl_IDividedDisk_HXX_ + +#include "GEOM_Function.hxx" + +#define DIVIDEDDISK_ARG_R 1 +#define DIVIDEDDISK_ARG_RATIO 2 + +class GEOMImpl_IDividedDisk +{ +public: + GEOMImpl_IDividedDisk(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetR(double theR) { _func->SetReal(DIVIDEDDISK_ARG_R, theR); } + double GetR() { return _func->GetReal(DIVIDEDDISK_ARG_R); } + + void SetRatio(double theRatio) { _func->SetReal(DIVIDEDDISK_ARG_RATIO, theRatio); } + double GetRatio() { return _func->GetReal(DIVIDEDDISK_ARG_RATIO); } + +private: + Handle(GEOM_Function) _func; +}; + +#endif // _GEOMImpl_IDividedDisk_HXX_ -- 2.39.2