diff --git a/configure.ac b/configure.ac index dcc973832..e249b1f5d 100644 --- a/configure.ac +++ b/configure.ac @@ -499,12 +499,14 @@ AC_OUTPUT([ \ src/DlgRef/Makefile \ src/EntityGUI/Makefile \ src/GEOM/Makefile \ + src/BlockFix/Makefile \ src/GEOMAlgo/Makefile \ src/GEOMBase/Makefile \ src/GEOMClient/Makefile \ src/GEOMFiltersSelection/Makefile \ src/Material/Makefile \ src/GEOMGUI/Makefile \ + src/GEOMUtils/Makefile \ src/GEOMImpl/Makefile \ src/GEOMToolsGUI/Makefile \ src/GEOM_I/Makefile \ diff --git a/doc/salome/gui/GEOM/images/curve4.png b/doc/salome/gui/GEOM/images/curve4.png index cbb60924d..2fe0db0ae 100644 Binary files a/doc/salome/gui/GEOM/images/curve4.png and b/doc/salome/gui/GEOM/images/curve4.png differ diff --git a/doc/salome/gui/GEOM/input/creating_curve.doc b/doc/salome/gui/GEOM/input/creating_curve.doc index 9c3371826..e70a6279c 100644 --- a/doc/salome/gui/GEOM/input/creating_curve.doc +++ b/doc/salome/gui/GEOM/input/creating_curve.doc @@ -70,10 +70,15 @@ closed edge.
  • If Reorder vertices taking into account distances is checked, the interpolation algorithm does not follow the order of vertices but searches for the closest vertex.
  • +
  • Tangents are two vectors, defining direction of curve at +its ends. Both or none vectors must be set. This option available only +if two above check boxes are not checked. +
  • \n TUI Command: geompy.MakeInterpol(ListOfShapes,isClosed,doReordering) +geompy.MakeInterpolWithTangents(ListOfShapes,Vector1,Vector2) Analytical Definition diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index f35c7935e..de18e7ee1 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -2804,6 +2804,17 @@ module GEOM in boolean theIsClosed, in boolean theDoReordering); + /*! + * \brief Create B-Spline curve on the set of points. + * \param thePoints Sequence of points for the B-Spline curve. + * \param theFirstVec Vector object, defining the curve direction at its first point. + * \param theLastVec Vector object, defining the curve direction at its last point. + * \return New GEOM_Object, containing the created B-Spline curve. + */ + GEOM_Object MakeSplineInterpolWithTangents (in ListOfGO thePoints, + in GEOM_Object theFirstVec, + in GEOM_Object theLastVec); + /*! * \brief Creates a curve using the parametric definition of the basic points. * \param thexExpr parametric equation of the coordinates X. diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index b69c3660c..90488fa74 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -280,7 +280,6 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) qApp->processEvents(); updateGeometry(); resize( minimumSizeHint() ); - SelectionIntoArgument(); myEditCurrentArgument->setFocus(); globalSelection(); // close local contexts, if any @@ -289,7 +288,7 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - displayPreview(true); + SelectionIntoArgument(); } //================================================================================= diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index c964983ae..ffb3f7ebf 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_CurveDlg.cxx @@ -59,66 +58,101 @@ BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* pare bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POLYLINE" ) ) ); - QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SPLINE" ) ) ); - QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BEZIER" ) ) ); - QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_POLYLINE"))); + QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SPLINE"))); + QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BEZIER"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); - setWindowTitle( tr( "GEOM_CURVE_TITLE" ) ); + setWindowTitle(tr("GEOM_CURVE_TITLE")); /***************************************************************/ - mainFrame()->RadioButton1->setIcon( image0 ); - mainFrame()->RadioButton2->setIcon( image3 ); - mainFrame()->RadioButton3->setIcon( image2 ); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setIcon(image3); + mainFrame()->RadioButton3->setIcon(image2); - QGroupBox* creationModeCroup = new QGroupBox(this); - QButtonGroup* bg = new QButtonGroup(this); + // Creation mode + QGroupBox* creationModeGroup = new QGroupBox (this); + QButtonGroup* bg = new QButtonGroup (this); - creationModeCroup->setTitle( tr( "GEOM_CURVE_CRMODE" ) ); - QHBoxLayout * creationModeLayout = new QHBoxLayout(creationModeCroup); - myBySelectionBtn = new QRadioButton( tr( "GEOM_CURVE_SELECTION" ) ,creationModeCroup ); - myAnaliticalBtn = new QRadioButton( tr( "GEOM_CURVE_ANALITICAL" ) ,creationModeCroup ); + creationModeGroup->setTitle(tr("GEOM_CURVE_CRMODE")); + QHBoxLayout * creationModeLayout = new QHBoxLayout (creationModeGroup); + myBySelectionBtn = new QRadioButton (tr("GEOM_CURVE_SELECTION") ,creationModeGroup); + myAnaliticalBtn = new QRadioButton (tr("GEOM_CURVE_ANALITICAL") ,creationModeGroup); bg->addButton(myBySelectionBtn); bg->addButton(myAnaliticalBtn); - + creationModeLayout->addWidget(myBySelectionBtn); creationModeLayout->addWidget(myAnaliticalBtn); - GroupPoints = new DlgRef_1Sel3Check( centralWidget() ); + // Points and flags + myGroupPoints = new DlgRef_1Sel3Check (centralWidget()); - GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) ); - GroupPoints->TextLabel1->setText( tr( "GEOM_POINTS" ) ); - GroupPoints->PushButton1->setIcon( image1 ); - GroupPoints->PushButton1->setDown( true ); + myGroupPoints->GroupBox1->setTitle(tr("GEOM_NODES")); + myGroupPoints->TextLabel1->setText(tr("GEOM_POINTS")); + myGroupPoints->PushButton1->setIcon(image1); + myGroupPoints->PushButton1->setDown(true); - GroupPoints->LineEdit1->setReadOnly( true ); + myGroupPoints->LineEdit1->setReadOnly( true ); - GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); - GroupPoints->CheckButton1->setChecked(false); - //GroupPoints->CheckButton1->hide(); + myGroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + myGroupPoints->CheckButton1->setChecked(false); + //myGroupPoints->CheckButton1->hide(); - GroupPoints->CheckButton2->setText( tr( "GEOM_IS_REORDER" ) ); - GroupPoints->CheckButton2->setChecked(false); - GroupPoints->CheckButton2->hide(); + myGroupPoints->CheckButton2->setText( tr( "GEOM_IS_REORDER" ) ); + myGroupPoints->CheckButton2->setChecked(false); + myGroupPoints->CheckButton2->hide(); - GroupPoints->CheckButton3->hide(); + myGroupPoints->CheckButton3->hide(); - myParams = new BasicGUI_ParamCurveWidget( centralWidget() ); + // Parametrical mode + myGroupParams = new BasicGUI_ParamCurveWidget( centralWidget() ); - QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); - layout->setMargin( 0 ); layout->setSpacing( 6 ); - layout->addWidget( creationModeCroup ); - layout->addWidget( GroupPoints ); - layout->addWidget( myParams ); + // Tangents (only for Interpolation constructor and only not closed and no reordering) + myGroupTangents = new QGroupBox (this); + myGroupTangents->setCheckable(true); + myGroupTangents->setChecked(false); + myGroupTangents->setTitle(tr("GEOM_INTERPOL_TANGENTS")); + + QGridLayout* tangentsLayout = new QGridLayout (myGroupTangents); + + myPushBtnV1 = new QPushButton (myGroupTangents); + myPushBtnV2 = new QPushButton (myGroupTangents); + myPushBtnV1->setIcon(image1); + myPushBtnV2->setIcon(image1); + + myLineEditV1 = new QLineEdit (myGroupTangents); + myLineEditV2 = new QLineEdit (myGroupTangents); + myLineEditV1->setReadOnly(true); + myLineEditV2->setReadOnly(true); + + QLabel* aTextLabelV1 = new QLabel (myGroupTangents); + QLabel* aTextLabelV2 = new QLabel (myGroupTangents); + aTextLabelV1->setText(tr("GEOM_INTERPOL_FIRST_VEC")); + aTextLabelV2->setText(tr("GEOM_INTERPOL_LAST_VEC")); + + tangentsLayout->addWidget(aTextLabelV1, 0, 0); + tangentsLayout->addWidget(myPushBtnV1 , 0, 1); + tangentsLayout->addWidget(myLineEditV1, 0, 2); + tangentsLayout->addWidget(aTextLabelV2, 1, 0); + tangentsLayout->addWidget(myPushBtnV2 , 1, 1); + tangentsLayout->addWidget(myLineEditV2, 1, 2); + + // Layout + QVBoxLayout* layout = new QVBoxLayout (centralWidget()); + layout->setMargin(0); + layout->setSpacing(6); + layout->addWidget(creationModeGroup); + layout->addWidget(myGroupPoints); + layout->addWidget(myGroupParams); + layout->addWidget(myGroupTangents); /***************************************************************/ - setHelpFileName( "create_curve_page.html" ); + setHelpFileName("create_curve_page.html"); Init(); } - //================================================================================= // function : ~BasicGUI_CurveDlg() // purpose : Destroys the object and frees any allocated resources @@ -127,7 +161,6 @@ BasicGUI_CurveDlg::~BasicGUI_CurveDlg() { } - //================================================================================= // function : Init() // purpose : @@ -135,13 +168,6 @@ BasicGUI_CurveDlg::~BasicGUI_CurveDlg() void BasicGUI_CurveDlg::Init() { /* init variables */ - myEditCurrentArgument = GroupPoints->LineEdit1; - - myPoints.clear(); - - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - showOnlyPreviewControl(); myBySelectionBtn->setChecked(true); @@ -152,87 +178,94 @@ void BasicGUI_CurveDlg::Init() double aMax( 100. ), aMin( 0.0 ); /* min, max, step and decimals for spin boxes & initial values */ - initSpinBox( myParams->myPMin, COORD_MIN, COORD_MAX, step, "length_precision" ); - initSpinBox( myParams->myPMax, COORD_MIN, COORD_MAX, step, "length_precision" ); - myParams->myPStep->setValue( 10 ); - myParams->myPStep->setMaximum( 999 ); - myParams->myPStep->setSingleStep( 10 ); - myParams->myPMin->setValue( aMin ); - myParams->myPMax->setValue( aMax ); - myParams->myPStep->setValue( step ); - myParams->myXExpr->setText("t"); - myParams->myYExpr->setText("t"); - myParams->myZExpr->setText("t"); - - myParams->hide(); + initSpinBox( myGroupParams->myPMin, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( myGroupParams->myPMax, COORD_MIN, COORD_MAX, step, "length_precision" ); + myGroupParams->myPStep->setValue( 10 ); + myGroupParams->myPStep->setMaximum( 999 ); + myGroupParams->myPStep->setSingleStep( 10 ); + myGroupParams->myPMin->setValue( aMin ); + myGroupParams->myPMax->setValue( aMax ); + myGroupParams->myPStep->setValue( step ); + myGroupParams->myXExpr->setText("t"); + myGroupParams->myYExpr->setText("t"); + myGroupParams->myZExpr->setText("t"); + + myGroupParams->hide(); /* signals and slots connections */ - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog( ) ) ); - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); - connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect(myGroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(myPushBtnV1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(myPushBtnV2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect( GroupPoints->CheckButton1, SIGNAL( toggled(bool) ), this, SLOT( CheckButtonToggled() ) ); - connect( GroupPoints->CheckButton2, SIGNAL( toggled(bool) ), this, SLOT( CheckButtonToggled() ) ); + connect(myGroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CheckButtonToggled())); + connect(myGroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(CheckButtonToggled())); - connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); - connect( myBySelectionBtn, SIGNAL( clicked() ), this, SLOT( CreationModeChanged() ) ); - connect( myAnaliticalBtn, SIGNAL( clicked() ), this, SLOT( CreationModeChanged() ) ); + connect(myBySelectionBtn, SIGNAL(clicked()), this, SLOT(CreationModeChanged())); + connect(myAnaliticalBtn, SIGNAL(clicked()), this, SLOT(CreationModeChanged())); - connect(myParams->myPMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myParams->myPMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myParams->myPStep, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); + connect(myGroupParams->myPMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGroupParams->myPMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGroupParams->myPStep, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); - connect(myParams->myXExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); - connect(myParams->myYExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); - connect(myParams->myZExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); + connect(myGroupParams->myXExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); + connect(myGroupParams->myYExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); + connect(myGroupParams->myZExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); - initName( tr( "GEOM_CURVE" ) ); - resize(100,100); - ConstructorsClicked( 0 ); + initName(tr("GEOM_CURVE")); + //resize(100, 100); + ConstructorsClicked(0); } //================================================================================= // function : ConstructorsClicked() // purpose : //================================================================================= -void BasicGUI_CurveDlg::ConstructorsClicked( int id ) +void BasicGUI_CurveDlg::ConstructorsClicked (int id) { - QString aTitle = tr( id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL" ); - mainFrame()->GroupConstructors->setTitle( aTitle ); + QString aTitle = tr(id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL"); + mainFrame()->GroupConstructors->setTitle(aTitle); if (id == 0) { // polyline (wire) - //GroupPoints->CheckButton1->hide(); - GroupPoints->CheckButton1->setText( tr( "GEOM_BUILD_CLOSED_WIRE" ) ); - GroupPoints->CheckButton2->hide(); + myGroupPoints->CheckButton1->setText( tr( "GEOM_BUILD_CLOSED_WIRE" ) ); + myGroupPoints->CheckButton2->hide(); + myGroupTangents->hide(); } else if (id == 1) { // bezier - //GroupPoints->CheckButton1->hide(); - GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); - GroupPoints->CheckButton2->hide(); + myGroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + myGroupPoints->CheckButton2->hide(); + myGroupTangents->hide(); } else { // b-spline - //GroupPoints->CheckButton1->show(); - GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); - GroupPoints->CheckButton2->show(); + myGroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + myGroupPoints->CheckButton2->show(); + myGroupTangents->setVisible(myBySelectionBtn->isChecked()); } myPoints.clear(); + myVec1.nullify(); + myVec2.nullify(); + + myGroupPoints->LineEdit1->setText(""); + myLineEditV1->setText(""); + myLineEditV2->setText(""); - myEditCurrentArgument->setText( "" ); qApp->processEvents(); updateGeometry(); - resize( minimumSizeHint() ); - SelectionIntoArgument(); -} + resize(minimumSizeHint()); + myGroupPoints->PushButton1->click(); +} //================================================================================= // function : SetEditCurrentArgument() @@ -240,9 +273,28 @@ void BasicGUI_CurveDlg::ConstructorsClicked( int id ) //================================================================================= void BasicGUI_CurveDlg::SetEditCurrentArgument() { - if ( sender() == GroupPoints->PushButton1 ) - myEditCurrentArgument = GroupPoints->LineEdit1; + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + globalSelection(); // close local contexts, if any + + if (sender() == myGroupPoints->PushButton1) { + myEditCurrentArgument = myGroupPoints->LineEdit1; + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + } + else if (sender() == myPushBtnV1) { + myEditCurrentArgument = myLineEditV1; + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + } + else if (sender() == myPushBtnV2) { + myEditCurrentArgument = myLineEditV2; + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + } + myEditCurrentArgument->setFocus(); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + SelectionIntoArgument(); } @@ -252,6 +304,11 @@ void BasicGUI_CurveDlg::SetEditCurrentArgument() //================================================================================= void BasicGUI_CurveDlg::CheckButtonToggled() { + if (getConstructorId() == 2) { // Interpolation + bool disableTangents = (myGroupPoints->CheckButton1->isChecked() || + myGroupPoints->CheckButton2->isChecked()); + myGroupTangents->setEnabled(!disableTangents); + } processPreview(); } @@ -261,8 +318,8 @@ void BasicGUI_CurveDlg::CheckButtonToggled() //================================================================================= void BasicGUI_CurveDlg::ClickOnOk() { - setIsApplyAndClose( true ); - if ( ClickOnApply() ) + setIsApplyAndClose(true); + if (ClickOnApply()) ClickOnCancel(); } @@ -272,20 +329,23 @@ void BasicGUI_CurveDlg::ClickOnOk() //================================================================================= bool BasicGUI_CurveDlg::ClickOnApply() { - if ( !onAccept() ) + if (!onAccept()) return false; initName(); - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + ConstructorsClicked(getConstructorId()); return true; } -static void synchronize( QList& left, QList& right ) +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +static void synchronize (QList& left, QList& right) { // 1. remove items from the "left" list that are not in the "right" list - QMutableListIterator it1( left ); - while ( it1.hasNext() ) { + QMutableListIterator it1 (left); + while (it1.hasNext()) { GEOM::GeomObjPtr o1 = it1.next(); bool found = false; QMutableListIterator it2( right ); @@ -307,22 +367,38 @@ static void synchronize( QList& left, QList& } } -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= void BasicGUI_CurveDlg::SelectionIntoArgument() { - QList points = getSelected( TopAbs_VERTEX, -1 ); - synchronize( myPoints, points ); - if ( !myPoints.isEmpty() ) - GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); - else - GroupPoints->LineEdit1->setText( "" ); + myEditCurrentArgument->setText(""); + + if (myEditCurrentArgument == myGroupPoints->LineEdit1) { + QList points = getSelected(TopAbs_VERTEX, -1); + synchronize(myPoints, points); + if (!myPoints.isEmpty()) + myGroupPoints->LineEdit1->setText(QString::number(myPoints.count()) + "_" + + tr("GEOM_POINT") + tr("_S_")); + } + else { + QList vecs = getSelected(TopAbs_EDGE, -1); + if (vecs.count() != 1) { + if (myEditCurrentArgument == myLineEditV1) myVec1.nullify(); + else if (myEditCurrentArgument == myLineEditV2) myVec2.nullify(); + } + else { + if (myEditCurrentArgument == myLineEditV1) { + myVec1 = vecs.first(); + } + else if (myEditCurrentArgument == myLineEditV2) { + myVec2 = vecs.first(); + } + QString aName = GEOMBase::GetName(vecs.first().get()); + myEditCurrentArgument->setText(aName); + } + } + processPreview(); } - //================================================================================= // function : ActivateThisDialog() // purpose : @@ -330,13 +406,11 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() void BasicGUI_CurveDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); - ConstructorsClicked( getConstructorId() ); + ConstructorsClicked(getConstructorId()); } //================================================================================= @@ -353,9 +427,9 @@ void BasicGUI_CurveDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_CurveDlg::enterEvent( QEvent* ) +void BasicGUI_CurveDlg::enterEvent (QEvent*) { - if ( !mainFrame()->GroupConstructors->isEnabled() ) + if (!mainFrame()->GroupConstructors->isEnabled()) ActivateThisDialog(); } @@ -365,24 +439,34 @@ void BasicGUI_CurveDlg::enterEvent( QEvent* ) //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation() { - return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); + return myGeomGUI->GetGeomGen()->GetICurvesOperations(getStudyId()); } //================================================================================= // function : isValid // purpose : //================================================================================= -bool BasicGUI_CurveDlg::isValid( QString& msg ) +bool BasicGUI_CurveDlg::isValid (QString& msg) { - if( myBySelectionBtn->isChecked() ) - return myPoints.count() > 1; + if (myBySelectionBtn->isChecked()) { + bool ok = true; + if (getConstructorId() == 2) { // Interpolation + bool disableTangents = (myGroupPoints->CheckButton1->isChecked() || + myGroupPoints->CheckButton2->isChecked()); + if (!disableTangents && myGroupTangents->isChecked()) { + ok = (myVec1 && myVec2); + if (!ok) msg = tr("GEOM_BOTH_TANGENTS_REQUIRED"); + } + } + return ok && myPoints.count() > 1; + } else { - bool ok = myParams->myPMin->isValid( msg, !IsPreview() ) && - myParams->myPMax->isValid( msg, !IsPreview() ) && - myParams->myPStep->isValid( msg, !IsPreview() ); - ok &= !myParams->myXExpr->text().isEmpty(); - ok &= !myParams->myYExpr->text().isEmpty(); - ok &= !myParams->myZExpr->text().isEmpty(); + bool ok = myGroupParams->myPMin->isValid( msg, !IsPreview() ) && + myGroupParams->myPMax->isValid( msg, !IsPreview() ) && + myGroupParams->myPStep->isValid( msg, !IsPreview() ); + ok &= !myGroupParams->myXExpr->text().isEmpty(); + ok &= !myGroupParams->myYExpr->text().isEmpty(); + ok &= !myGroupParams->myZExpr->text().isEmpty(); return ok; } } @@ -391,79 +475,85 @@ bool BasicGUI_CurveDlg::isValid( QString& msg ) // function : execute // purpose : //================================================================================= -bool BasicGUI_CurveDlg::execute( ObjectList& objects ) +bool BasicGUI_CurveDlg::execute (ObjectList& objects) { bool res = false; GEOM::GEOM_Object_var anObj; - GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() ); + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation()); GEOM::ListOfGO_var points = new GEOM::ListOfGO(); - points->length( myPoints.count() ); - for ( int i = 0; i < myPoints.count(); i++ ) + points->length(myPoints.count()); + for (int i = 0; i < myPoints.count(); i++) points[i] = myPoints[i].copy(); - switch ( getConstructorId() ) { + switch (getConstructorId()) { case 0 : - if( myBySelectionBtn->isChecked() ) - anObj = anOper->MakePolyline( points.in(), GroupPoints->CheckButton1->isChecked() ); + if (myBySelectionBtn->isChecked()) + anObj = anOper->MakePolyline(points.in(), myGroupPoints->CheckButton1->isChecked()); else - anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()), - qPrintable(myParams->myYExpr->text()), - qPrintable(myParams->myZExpr->text()), - myParams->myPMin->value(), - myParams->myPMax->value(), - myParams->myPStep->value(), - GEOM::Polyline); + anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()), + qPrintable(myGroupParams->myYExpr->text()), + qPrintable(myGroupParams->myZExpr->text()), + myGroupParams->myPMin->value(), + myGroupParams->myPMax->value(), + myGroupParams->myPStep->value(), + GEOM::Polyline); res = true; break; case 1 : - if( myBySelectionBtn->isChecked() ) - anObj = anOper->MakeSplineBezier( points.in(), GroupPoints->CheckButton1->isChecked() ); + if (myBySelectionBtn->isChecked()) + anObj = anOper->MakeSplineBezier(points.in(), myGroupPoints->CheckButton1->isChecked()); else - anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()), - qPrintable(myParams->myYExpr->text()), - qPrintable(myParams->myZExpr->text()), - myParams->myPMin->value(), - myParams->myPMax->value(), - myParams->myPStep->value(), - GEOM::Bezier); - + anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()), + qPrintable(myGroupParams->myYExpr->text()), + qPrintable(myGroupParams->myZExpr->text()), + myGroupParams->myPMin->value(), + myGroupParams->myPMax->value(), + myGroupParams->myPStep->value(), + GEOM::Bezier); res = true; break; case 2 : - if( myBySelectionBtn->isChecked() ) - anObj = anOper->MakeSplineInterpolation( points.in(), GroupPoints->CheckButton1->isChecked(), - GroupPoints->CheckButton2->isChecked() ); + if (myBySelectionBtn->isChecked()) { + bool disableTangents = (myGroupPoints->CheckButton1->isChecked() || + myGroupPoints->CheckButton2->isChecked()); + if (!disableTangents && myGroupTangents->isChecked()) { + anObj = anOper->MakeSplineInterpolWithTangents(points.in(), myVec1.get(), myVec2.get()); + } + else + anObj = anOper->MakeSplineInterpolation(points.in(), myGroupPoints->CheckButton1->isChecked(), + myGroupPoints->CheckButton2->isChecked()); + } else - anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()), - qPrintable(myParams->myYExpr->text()), - qPrintable(myParams->myZExpr->text()), - myParams->myPMin->value(), - myParams->myPMax->value(), - myParams->myPStep->value(), - GEOM::Interpolation); + anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()), + qPrintable(myGroupParams->myYExpr->text()), + qPrintable(myGroupParams->myZExpr->text()), + myGroupParams->myPMin->value(), + myGroupParams->myPMax->value(), + myGroupParams->myPStep->value(), + GEOM::Interpolation); res = true; break; } - if ( !anObj->_is_nil() ) { - if(myAnaliticalBtn->isChecked() && !IsPreview()) { + if (!anObj->_is_nil()) { + if (myAnaliticalBtn->isChecked() && !IsPreview()) { QStringList aParameters; - aParameters<myPMin->text(); - aParameters<myPMax->text(); - aParameters<myPStep->text(); + aParameters<myPMin->text(); + aParameters<myPMax->text(); + aParameters<myPStep->text(); anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } - objects.push_back( anObj._retn() ); + objects.push_back(anObj._retn()); } - + return res; } //================================================================================= -// function : addSubshapeToStudy +// function : addSubshapesToStudy // purpose : virtual method to add new SubObjects if local selection //================================================================================= void BasicGUI_CurveDlg::addSubshapesToStudy() @@ -476,19 +566,20 @@ void BasicGUI_CurveDlg::addSubshapesToStudy() // function : CreationModeChanged // purpose : //================================================================================= -void BasicGUI_CurveDlg::CreationModeChanged() { +void BasicGUI_CurveDlg::CreationModeChanged() +{ const QObject* s = sender(); - GroupPoints->setVisible(myBySelectionBtn == s); - myParams->setVisible(myBySelectionBtn != s); - - ConstructorsClicked( getConstructorId() ); + myGroupPoints->setVisible(myBySelectionBtn == s); + myGroupParams->setVisible(myBySelectionBtn != s); + + ConstructorsClicked(getConstructorId()); } //================================================================================= // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void BasicGUI_CurveDlg::ValueChangedInSpinBox(double/*theValue*/) +void BasicGUI_CurveDlg::ValueChangedInSpinBox (double/*theValue*/) { processPreview(); } @@ -497,15 +588,16 @@ void BasicGUI_CurveDlg::ValueChangedInSpinBox(double/*theValue*/) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void BasicGUI_CurveDlg::ValueChangedInSpinBox(int/*theValue*/) +void BasicGUI_CurveDlg::ValueChangedInSpinBox (int/*theValue*/) { processPreview(); } //================================================================================= -// function : ValueChangedInSpinBox() +// function : OnEditingFinished() // purpose : //================================================================================= -void BasicGUI_CurveDlg::OnEditingFinished() { +void BasicGUI_CurveDlg::OnEditingFinished() +{ processPreview(); } diff --git a/src/BasicGUI/BasicGUI_CurveDlg.h b/src/BasicGUI/BasicGUI_CurveDlg.h index ce9a6a9e7..8d6751b5e 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.h +++ b/src/BasicGUI/BasicGUI_CurveDlg.h @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_CurveDlg.h @@ -34,6 +33,9 @@ class DlgRef_1Sel3Check; class QRadioButton; +class QPushButton; +class QLineEdit; +class QGroupBox; class BasicGUI_ParamCurveWidget; //================================================================================= @@ -45,26 +47,34 @@ class BasicGUI_CurveDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_CurveDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + BasicGUI_CurveDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0); ~BasicGUI_CurveDlg(); protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& ); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); virtual void addSubshapesToStudy(); private: void Init(); - void enterEvent( QEvent* ); + void enterEvent (QEvent*); private: - DlgRef_1Sel3Check* GroupPoints; - QList myPoints; QRadioButton* myAnaliticalBtn; QRadioButton* myBySelectionBtn; - BasicGUI_ParamCurveWidget* myParams; + DlgRef_1Sel3Check* myGroupPoints; + BasicGUI_ParamCurveWidget* myGroupParams; + QGroupBox* myGroupTangents; + + QPushButton* myPushBtnV1; + QPushButton* myPushBtnV2; + QLineEdit* myLineEditV1; + QLineEdit* myLineEditV2; + + QList myPoints; + GEOM::GeomObjPtr myVec1, myVec2; private slots: void ClickOnOk(); @@ -73,13 +83,13 @@ private slots: void ActivateThisDialog(); void DeactivateActiveDialog(); - void ConstructorsClicked( int ); + void ConstructorsClicked (int); void CheckButtonToggled(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void CreationModeChanged(); - void ValueChangedInSpinBox(double/*theValue*/); - void ValueChangedInSpinBox(int /*theValue*/); + void ValueChangedInSpinBox (double/*theValue*/); + void ValueChangedInSpinBox (int /*theValue*/); void OnEditingFinished(); }; diff --git a/src/GEOMAlgo/BlockFix.cxx b/src/BlockFix/BlockFix.cxx similarity index 100% rename from src/GEOMAlgo/BlockFix.cxx rename to src/BlockFix/BlockFix.cxx diff --git a/src/GEOMAlgo/BlockFix.hxx b/src/BlockFix/BlockFix.hxx similarity index 78% rename from src/GEOMAlgo/BlockFix.hxx rename to src/BlockFix/BlockFix.hxx index 34007be5c..70d37df65 100644 --- a/src/GEOMAlgo/BlockFix.hxx +++ b/src/BlockFix/BlockFix.hxx @@ -18,14 +18,11 @@ // 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 _BlockFix_HeaderFile #define _BlockFix_HeaderFile -#ifndef _Standard_Real_HeaderFile #include -#endif class TopoDS_Shape; class BlockFix_SphereSpaceModifier; @@ -35,36 +32,16 @@ class BlockFix_BlockFixAPI; class BlockFix_PeriodicSurfaceModifier; class BlockFix_CheckTool; -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif -class BlockFix { +class BlockFix { public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Standard_EXPORT static TopoDS_Shape RotateSphereSpace(const TopoDS_Shape& S,const Standard_Real Tol); Standard_EXPORT static TopoDS_Shape RefillProblemFaces(const TopoDS_Shape& S); Standard_EXPORT static TopoDS_Shape FixRanges(const TopoDS_Shape& S,const Standard_Real Tol); -protected: - private: friend class BlockFix_SphereSpaceModifier; @@ -76,6 +53,4 @@ friend class BlockFix_CheckTool; }; -// other Inline functions and methods (like "C++: function call" methods) - #endif diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.cxx b/src/BlockFix/BlockFix_BlockFixAPI.cxx similarity index 85% rename from src/GEOMAlgo/BlockFix_BlockFixAPI.cxx rename to src/BlockFix/BlockFix_BlockFixAPI.cxx index 3c82e4a84..376632b4f 100644 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.cxx +++ b/src/BlockFix/BlockFix_BlockFixAPI.cxx @@ -23,7 +23,7 @@ // Created: Tue Dec 7 11:59:05 2004 // Author: Pavel DURANDIN -#include +#include #include #include @@ -35,22 +35,29 @@ #include +IMPLEMENT_STANDARD_HANDLE(BlockFix_BlockFixAPI, MMgt_TShared); +IMPLEMENT_STANDARD_RTTIEXT(BlockFix_BlockFixAPI, MMgt_TShared); + //======================================================================= -//function : ShapeConvert_CanonicAPI +//function : BlockFix_BlockFixAPI //purpose : //======================================================================= - BlockFix_BlockFixAPI::BlockFix_BlockFixAPI() { myTolerance = Precision::Confusion(); myOptimumNbFaces = 6; } +//======================================================================= +//function : ~BlockFix_BlockFixAPI +//purpose : +//======================================================================= +BlockFix_BlockFixAPI::~BlockFix_BlockFixAPI() {} + //======================================================================= //function : Perform //purpose : //======================================================================= - void BlockFix_BlockFixAPI::Perform() { // processing spheres with degenerativities diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.lxx b/src/BlockFix/BlockFix_BlockFixAPI.hxx similarity index 72% rename from src/GEOMAlgo/BlockFix_BlockFixAPI.lxx rename to src/BlockFix/BlockFix_BlockFixAPI.hxx index 5992e1794..84140aff5 100644 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.lxx +++ b/src/BlockFix/BlockFix_BlockFixAPI.hxx @@ -18,15 +18,46 @@ // 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 +#ifndef _BlockFix_BlockFixAPI_HeaderFile +#define _BlockFix_BlockFixAPI_HeaderFile + +#include +#include + +#include +#include +#include +#include + +DEFINE_STANDARD_HANDLE(BlockFix_BlockFixAPI, MMgt_TShared); + +class BlockFix_BlockFixAPI : public MMgt_TShared +{ +public: + Standard_EXPORT BlockFix_BlockFixAPI(); + Standard_EXPORT ~BlockFix_BlockFixAPI(); + + void SetShape(const TopoDS_Shape& Shape); + TopoDS_Shape Shape() const; + Handle_ShapeBuild_ReShape& Context(); + Standard_Real& Tolerance(); + Standard_Integer& OptimumNbFaces(); + Standard_EXPORT void Perform(); + + DEFINE_STANDARD_RTTI(BlockFix_BlockFixAPI); + +private: + Handle_ShapeBuild_ReShape myContext; + TopoDS_Shape myShape; + Standard_Real myTolerance; + Standard_Integer myOptimumNbFaces; +}; //======================================================================= //function : SetShape //purpose : //======================================================================= - inline void BlockFix_BlockFixAPI::SetShape(const TopoDS_Shape& Shape) { myShape = Shape; @@ -36,7 +67,6 @@ inline void BlockFix_BlockFixAPI::SetShape(const TopoDS_Shape& Shape) //function : Shape //purpose : //======================================================================= - inline TopoDS_Shape BlockFix_BlockFixAPI::Shape() const { return myShape; @@ -46,7 +76,6 @@ inline TopoDS_Shape BlockFix_BlockFixAPI::Shape() const //function : Context //purpose : //======================================================================= - inline Handle(ShapeBuild_ReShape)& BlockFix_BlockFixAPI::Context() { return myContext; @@ -56,7 +85,6 @@ inline Handle(ShapeBuild_ReShape)& BlockFix_BlockFixAPI::Context() //function : Tolerance //purpose : //======================================================================= - inline Standard_Real& BlockFix_BlockFixAPI::Tolerance() { return myTolerance; @@ -66,8 +94,9 @@ inline Standard_Real& BlockFix_BlockFixAPI::Tolerance() //function : OptimumNbFaces //purpose : //======================================================================= - inline Standard_Integer& BlockFix_BlockFixAPI::OptimumNbFaces() { return myOptimumNbFaces; } + +#endif diff --git a/src/GEOMAlgo/BlockFix_CheckTool.cxx b/src/BlockFix/BlockFix_CheckTool.cxx similarity index 98% rename from src/GEOMAlgo/BlockFix_CheckTool.cxx rename to src/BlockFix/BlockFix_CheckTool.cxx index 674ef69dd..ba1c5c6af 100644 --- a/src/GEOMAlgo/BlockFix_CheckTool.cxx +++ b/src/BlockFix/BlockFix_CheckTool.cxx @@ -18,48 +18,43 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File: BlockFix_CheckTool.cxx // Created: 17.12.04 11:15:25 // Author: Sergey KUUL -// -#include -//#include -//#include +#include #include #include #include + #include #include #include #include +#include + #include #include #include #include - //======================================================================= //function : BlockFix_CheckTool() //purpose : Constructor //======================================================================= - BlockFix_CheckTool::BlockFix_CheckTool( ) { myHasCheck = Standard_False; myPossibleBlocks.Clear(); } - //======================================================================= //function : SetShape //purpose : //======================================================================= - void BlockFix_CheckTool::SetShape(const TopoDS_Shape& aShape) { myHasCheck = Standard_False; @@ -67,12 +62,10 @@ void BlockFix_CheckTool::SetShape(const TopoDS_Shape& aShape) myPossibleBlocks.Clear(); } - //======================================================================= //function : Perform //purpose : //======================================================================= - void BlockFix_CheckTool::Perform() { myNbSolids=0; @@ -229,23 +222,19 @@ void BlockFix_CheckTool::Perform() myHasCheck = Standard_True; } - //======================================================================= //function : NbPossibleBlocks //purpose : //======================================================================= - Standard_Integer BlockFix_CheckTool::NbPossibleBlocks() const { return myPossibleBlocks.Length(); } - //======================================================================= //function : PossibleBlock //purpose : //======================================================================= - TopoDS_Shape BlockFix_CheckTool::PossibleBlock(const Standard_Integer num) const { TopoDS_Shape res; @@ -254,12 +243,10 @@ TopoDS_Shape BlockFix_CheckTool::PossibleBlock(const Standard_Integer num) const return res; } - //======================================================================= //function : DumpCheckResult //purpose : //======================================================================= - void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const { if(!myHasCheck) diff --git a/src/GEOMAlgo/BlockFix_CheckTool.jxx b/src/BlockFix/BlockFix_CheckTool.hxx similarity index 52% rename from src/GEOMAlgo/BlockFix_CheckTool.jxx rename to src/BlockFix/BlockFix_CheckTool.hxx index 7574af057..9378b25d1 100644 --- a/src/GEOMAlgo/BlockFix_CheckTool.jxx +++ b/src/BlockFix/BlockFix_CheckTool.hxx @@ -18,11 +18,42 @@ // 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 _TopoDS_Shape_HeaderFile -#include -#endif #ifndef _BlockFix_CheckTool_HeaderFile -#include +#define _BlockFix_CheckTool_HeaderFile + +#include +#include +#include +#include +#include + +class TopoDS_Shape; + +#include +#include + +class BlockFix_CheckTool { + +public: + Standard_EXPORT BlockFix_CheckTool(); + Standard_EXPORT void SetShape(const TopoDS_Shape& aShape) ; + Standard_EXPORT void Perform() ; + Standard_EXPORT Standard_Integer NbPossibleBlocks() const; + Standard_EXPORT TopoDS_Shape PossibleBlock(const Standard_Integer num) const; + Standard_EXPORT void DumpCheckResult(Standard_OStream& S) const; + +private: + TopoDS_Shape myShape; + Standard_Boolean myHasCheck; + Standard_Integer myNbSolids; + Standard_Integer myNbBlocks; + TopTools_SequenceOfShape myPossibleBlocks; + Standard_Integer myNbDegen; + Standard_Integer myNbUF; + Standard_Integer myNbUE; + Standard_Integer myNbUFUE; + Standard_Integer myBadRanges; +}; + #endif diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx b/src/BlockFix/BlockFix_PeriodicSurfaceModifier.cxx similarity index 92% rename from src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx rename to src/BlockFix/BlockFix_PeriodicSurfaceModifier.cxx index 1e9f33ca0..3894c353f 100644 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx +++ b/src/BlockFix/BlockFix_PeriodicSurfaceModifier.cxx @@ -18,51 +18,71 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File: BlockFix_PeriodicSurfaceModifier.cxx // Created: 15.12.04 10:08:50 // Author: Sergey KUUL -#include +#include + +#include + +#include + +#include +#include +#include + +#include #include #include + #include + #include #include -#include -#include +#include +#include +#include + +#include + +IMPLEMENT_STANDARD_HANDLE(BlockFix_PeriodicSurfaceModifier, BRepTools_Modification); +IMPLEMENT_STANDARD_RTTIEXT(BlockFix_PeriodicSurfaceModifier, BRepTools_Modification); //======================================================================= //function : BlockFix_PeriodicSurfaceModifier() //purpose : Constructor //======================================================================= - -BlockFix_PeriodicSurfaceModifier::BlockFix_PeriodicSurfaceModifier ( ) +BlockFix_PeriodicSurfaceModifier::BlockFix_PeriodicSurfaceModifier() { myMapOfFaces.Clear(); myMapOfSurfaces.Clear(); } +//======================================================================= +//function : ~BlockFix_PeriodicSurfaceModifier() +//purpose : Destructor +//======================================================================= +BlockFix_PeriodicSurfaceModifier::~BlockFix_PeriodicSurfaceModifier() +{ +} //======================================================================= //function : SetTolerance //purpose : //======================================================================= - void BlockFix_PeriodicSurfaceModifier::SetTolerance(const Standard_Real Tol) { myTolerance = Tol; } - //======================================================================= //function : ModifySurface //purpose : auxilary //======================================================================= - static Standard_Boolean ModifySurface(const TopoDS_Face& aFace, const Handle(Geom_Surface)& aSurface, Handle(Geom_Surface)& aNewSurface) @@ -102,12 +122,10 @@ static Standard_Boolean ModifySurface(const TopoDS_Face& aFace, return Standard_False; } - //======================================================================= //function : NewSurface //purpose : //======================================================================= - Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewSurface(const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L,Standard_Real& Tol, @@ -133,12 +151,10 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewSurface(const TopoDS_Face& return Standard_False; } - //======================================================================= //function : NewCurve //purpose : //======================================================================= - Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve(const TopoDS_Edge& /*E*/, Handle(Geom_Curve)& /*C*/, TopLoc_Location& /*L*/, @@ -147,12 +163,10 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve(const TopoDS_Edge& / return Standard_False; } - //======================================================================= //function : NewPoint //purpose : //======================================================================= - Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewPoint(const TopoDS_Vertex& /*V*/, gp_Pnt& /*P*/, Standard_Real& /*Tol*/) @@ -160,12 +174,10 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewPoint(const TopoDS_Vertex& return Standard_False; } - //======================================================================= //function : NewCurve2d //purpose : //======================================================================= - Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& E, const TopoDS_Face& F, const TopoDS_Edge& /*NewE*/, @@ -219,12 +231,10 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& return Standard_False; } - //======================================================================= //function : NewParameter //purpose : //======================================================================= - Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewParameter(const TopoDS_Vertex& /*V*/, const TopoDS_Edge& /*E*/, Standard_Real& /*P*/, @@ -233,12 +243,10 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewParameter(const TopoDS_Ver return Standard_False; } - //======================================================================= //function : Continuity //purpose : //======================================================================= - GeomAbs_Shape BlockFix_PeriodicSurfaceModifier::Continuity(const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, @@ -248,4 +256,3 @@ GeomAbs_Shape BlockFix_PeriodicSurfaceModifier::Continuity(const TopoDS_Edge& E, { return BRep_Tool::Continuity(E,F1,F2); } - diff --git a/src/BlockFix/BlockFix_PeriodicSurfaceModifier.hxx b/src/BlockFix/BlockFix_PeriodicSurfaceModifier.hxx new file mode 100644 index 000000000..0223b25e2 --- /dev/null +++ b/src/BlockFix/BlockFix_PeriodicSurfaceModifier.hxx @@ -0,0 +1,95 @@ +// Copyright (C) 2007-2012 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 _BlockFix_PeriodicSurfaceModifier_HeaderFile +#define _BlockFix_PeriodicSurfaceModifier_HeaderFile + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class TopoDS_Face; +class Geom_Surface; +class TopLoc_Location; +class TopoDS_Edge; +class Geom_Curve; +class TopoDS_Vertex; +class gp_Pnt; +class Geom2d_Curve; + +DEFINE_STANDARD_HANDLE(BlockFix_PeriodicSurfaceModifier, BRepTools_Modification); + +class BlockFix_PeriodicSurfaceModifier : public BRepTools_Modification { + +public: + Standard_EXPORT BlockFix_PeriodicSurfaceModifier(); + Standard_EXPORT ~BlockFix_PeriodicSurfaceModifier(); + + Standard_EXPORT void SetTolerance (const Standard_Real Toler) ; + Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, + Handle(Geom_Surface)& S, + TopLoc_Location& L, + Standard_Real& Tol, + Standard_Boolean& RevWires, + Standard_Boolean& RevFace); + Standard_EXPORT Standard_Boolean NewCurve (const TopoDS_Edge& E, + Handle(Geom_Curve)& C, + TopLoc_Location& L, + Standard_Real& Tol) ; + Standard_EXPORT Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P, Standard_Real& Tol); + Standard_EXPORT Standard_Boolean NewCurve2d (const TopoDS_Edge& E, + const TopoDS_Face& F, + const TopoDS_Edge& NewE, + const TopoDS_Face& NewF, + Handle(Geom2d_Curve)& C, + Standard_Real& Tol); + Standard_EXPORT Standard_Boolean NewParameter (const TopoDS_Vertex& V, + const TopoDS_Edge& E, + Standard_Real& P, + Standard_Real& Tol); + Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, + const TopoDS_Face& F1, + const TopoDS_Face& F2, + const TopoDS_Edge& NewE, + const TopoDS_Face& NewF1, + const TopoDS_Face& NewF2); + + DEFINE_STANDARD_RTTI(BlockFix_PeriodicSurfaceModifier); + +private: + Standard_Real myTolerance; + TopTools_DataMapOfShapeInteger myMapOfFaces; + TColStd_IndexedMapOfTransient myMapOfSurfaces; + +}; + +#endif diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx b/src/BlockFix/BlockFix_SphereSpaceModifier.cxx similarity index 94% rename from src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx rename to src/BlockFix/BlockFix_SphereSpaceModifier.cxx index 2abc08316..4a984cd45 100644 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx +++ b/src/BlockFix/BlockFix_SphereSpaceModifier.cxx @@ -18,60 +18,75 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File: BlockFix.cxx // Created: Tue Dec 7 11:59:05 2004 // Author: Pavel DURANDIN -#include +#include + +#include + +#include + +#include #include + +#include +#include +#include +#include + #include +#include + +#include +#include + #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include + +#include + +#include +#include + +IMPLEMENT_STANDARD_HANDLE(BlockFix_SphereSpaceModifier, BRepTools_Modification); +IMPLEMENT_STANDARD_RTTIEXT(BlockFix_SphereSpaceModifier, BRepTools_Modification); //======================================================================= //function : BlockFix_SphereSpaceModifier //purpose : //======================================================================= - BlockFix_SphereSpaceModifier::BlockFix_SphereSpaceModifier() { myMapOfFaces.Clear(); myMapOfSpheres.Clear(); } +//======================================================================= +//function : ~BlockFix_SphereSpaceModifier +//purpose : +//======================================================================= +BlockFix_SphereSpaceModifier::~BlockFix_SphereSpaceModifier() {} + //======================================================================= //function : SetTolerance //purpose : //======================================================================= - void BlockFix_SphereSpaceModifier::SetTolerance(const Standard_Real Tol) { myTolerance = Tol; } - //======================================================================= //function : NewSurface //purpose : //======================================================================= - - static Standard_Boolean ModifySurface(const TopoDS_Face& aFace, const Handle(Geom_Surface)& aSurface, Handle(Geom_Surface)& aNewSurface) @@ -132,7 +147,6 @@ static Standard_Boolean ModifySurface(const TopoDS_Face& aFace, return Standard_False; } - Standard_Boolean BlockFix_SphereSpaceModifier::NewSurface(const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L,Standard_Real& Tol, @@ -163,7 +177,6 @@ Standard_Boolean BlockFix_SphereSpaceModifier::NewSurface(const TopoDS_Face& F, //function : NewCurve //purpose : //======================================================================= - Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve(const TopoDS_Edge& /*E*/,Handle(Geom_Curve)& /*C*/, TopLoc_Location& /*L*/,Standard_Real& /*Tol*/) { @@ -174,7 +187,6 @@ Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve(const TopoDS_Edge& /*E*/ //function : NewPoint //purpose : //======================================================================= - Standard_Boolean BlockFix_SphereSpaceModifier::NewPoint(const TopoDS_Vertex& /*V*/, gp_Pnt& /*P*/, Standard_Real& /*Tol*/) @@ -186,7 +198,6 @@ Standard_Boolean BlockFix_SphereSpaceModifier::NewPoint(const TopoDS_Vertex& /*V //function : NewCurve2d //purpose : //======================================================================= - Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F, const TopoDS_Edge& /*NewE*/,const TopoDS_Face& /*NewF*/, Handle(Geom2d_Curve)& C,Standard_Real& Tol) @@ -249,24 +260,20 @@ Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve2d(const TopoDS_Edge& E,c return Standard_False; } - //======================================================================= //function : NewParameter //purpose : //======================================================================= - Standard_Boolean BlockFix_SphereSpaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,const TopoDS_Edge& /*E*/, Standard_Real& /*P*/,Standard_Real& /*Tol*/) { return Standard_False; } - //======================================================================= //function : Continuity //purpose : //======================================================================= - GeomAbs_Shape BlockFix_SphereSpaceModifier::Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1, const TopoDS_Face& F2,const TopoDS_Edge& /*NewE*/, const TopoDS_Face& /*NewF1*/,const TopoDS_Face& /*NewF2*/) diff --git a/src/BlockFix/BlockFix_SphereSpaceModifier.hxx b/src/BlockFix/BlockFix_SphereSpaceModifier.hxx new file mode 100644 index 000000000..fa620b4e3 --- /dev/null +++ b/src/BlockFix/BlockFix_SphereSpaceModifier.hxx @@ -0,0 +1,82 @@ +// Copyright (C) 2007-2012 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 _BlockFix_SphereSpaceModifier_HeaderFile +#define _BlockFix_SphereSpaceModifier_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class TopoDS_Face; +class Geom_Surface; +class TopLoc_Location; +class TopoDS_Edge; +class Geom_Curve; +class TopoDS_Vertex; +class gp_Pnt; +class Geom2d_Curve; + +DEFINE_STANDARD_HANDLE(BlockFix_SphereSpaceModifier, BRepTools_Modification); + +class BlockFix_SphereSpaceModifier : public BRepTools_Modification { + +public: + Standard_EXPORT BlockFix_SphereSpaceModifier(); + Standard_EXPORT ~BlockFix_SphereSpaceModifier(); + + Standard_EXPORT void SetTolerance (const Standard_Real Toler); + Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S, + TopLoc_Location& L, Standard_Real& Tol, + Standard_Boolean& RevWires, Standard_Boolean& RevFace); + Standard_EXPORT Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C, + TopLoc_Location& L, Standard_Real& Tol); + Standard_EXPORT Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P, Standard_Real& Tol); + Standard_EXPORT Standard_Boolean NewCurve2d (const TopoDS_Edge& E, const TopoDS_Face& F, + const TopoDS_Edge& NewE, const TopoDS_Face& NewF, + Handle(Geom2d_Curve)& C, Standard_Real& Tol); + Standard_EXPORT Standard_Boolean NewParameter (const TopoDS_Vertex& V, const TopoDS_Edge& E, + Standard_Real& P, Standard_Real& Tol); + Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, + const TopoDS_Face& F1,const TopoDS_Face& F2, + const TopoDS_Edge& NewE, + const TopoDS_Face& NewF1, const TopoDS_Face& NewF2); + Standard_EXPORT Standard_Boolean ForRotation (const TopoDS_Face& F); + + DEFINE_STANDARD_RTTI(BlockFix_SphereSpaceModifier); + +private: + Standard_Real myTolerance; + TopTools_DataMapOfShapeInteger myMapOfFaces; + TColStd_IndexedMapOfTransient myMapOfSpheres; + +}; + +#endif diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.cxx b/src/BlockFix/BlockFix_UnionEdges.cxx similarity index 99% rename from src/GEOMAlgo/BlockFix_UnionEdges.cxx rename to src/BlockFix/BlockFix_UnionEdges.cxx index 95a1a713e..531d30a5a 100644 --- a/src/GEOMAlgo/BlockFix_UnionEdges.cxx +++ b/src/BlockFix/BlockFix_UnionEdges.cxx @@ -23,10 +23,12 @@ // Created: 07.12.04 15:27:30 // Author: Sergey KUUL -#include +#include #include +#include + #include #include #include @@ -57,6 +59,7 @@ #include #include #include +#include #include diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.jxx b/src/BlockFix/BlockFix_UnionEdges.hxx similarity index 72% rename from src/GEOMAlgo/BlockFix_UnionEdges.jxx rename to src/BlockFix/BlockFix_UnionEdges.hxx index 558e8d82b..b63f5c7e2 100644 --- a/src/GEOMAlgo/BlockFix_UnionEdges.jxx +++ b/src/BlockFix/BlockFix_UnionEdges.hxx @@ -18,14 +18,30 @@ // 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 _ShapeBuild_ReShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif #ifndef _BlockFix_UnionEdges_HeaderFile -#include +#define _BlockFix_UnionEdges_HeaderFile + +#include + +#include + +#include +#include + +class TopoDS_Shape; + +class BlockFix_UnionEdges { + +public: + Standard_EXPORT BlockFix_UnionEdges(); + + Standard_EXPORT TopoDS_Shape Perform (const TopoDS_Shape& Shape,const Standard_Real Tol); + +private: + Standard_Real myTolerance; + Handle_ShapeBuild_ReShape myContext; + +}; + #endif diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.cxx b/src/BlockFix/BlockFix_UnionFaces.cxx similarity index 99% rename from src/GEOMAlgo/BlockFix_UnionFaces.cxx rename to src/BlockFix/BlockFix_UnionFaces.cxx index c800fd421..aae28cab6 100644 --- a/src/GEOMAlgo/BlockFix_UnionFaces.cxx +++ b/src/BlockFix/BlockFix_UnionFaces.cxx @@ -18,13 +18,12 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File: BlockFix_UnionFaces.cxx // Created: Tue Dec 7 17:15:42 2004 // Author: Pavel DURANDIN -#include +#include #include @@ -73,6 +72,7 @@ #include #include #include +#include #include @@ -104,43 +104,37 @@ //function : BlockFix_UnionFaces //purpose : //======================================================================= - BlockFix_UnionFaces::BlockFix_UnionFaces() : myTolerance(Precision::Confusion()), myOptimumNbFaces(6) { } - //======================================================================= //function : GetTolerance //purpose : //======================================================================= - Standard_Real& BlockFix_UnionFaces::GetTolerance() { return myTolerance; } - //======================================================================= //function : GetOptimumNbFaces //purpose : //======================================================================= - Standard_Integer& BlockFix_UnionFaces::GetOptimumNbFaces() { return myOptimumNbFaces; } - //======================================================================= //function : AddOrdinaryEdges //purpose : auxilary +// adds edges from the shape to the sequence +// seams and equal edges are dropped +// Returns true if one of original edges dropped //======================================================================= -// adds edges from the shape to the sequence -// seams and equal edges are dropped -// Returns true if one of original edges dropped static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges, const TopoDS_Shape aShape, Standard_Integer& anIndex) @@ -180,7 +174,6 @@ static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges, return isDropped; } - //======================================================================= //function : ClearRts //purpose : auxilary @@ -195,12 +188,10 @@ static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface) return aSurface; } - //======================================================================= //function : Perform //purpose : //======================================================================= - TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) { Handle(ShapeBuild_ReShape) myContext = new ShapeBuild_ReShape; @@ -519,12 +510,10 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) return aResShape; } - //======================================================================= //function : IsSameDomain //purpose : //======================================================================= - bool getCylinder (Handle(Geom_Surface)& theInSurface, gp_Cylinder& theOutCylinder) { bool isCylinder = false; @@ -683,12 +672,10 @@ Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace, return false; } - //======================================================================= //function : MovePCurves //purpose : //======================================================================= - void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget, const TopoDS_Face& aSource) const { diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.hxx b/src/BlockFix/BlockFix_UnionFaces.hxx similarity index 64% rename from src/GEOMAlgo/BlockFix_UnionFaces.hxx rename to src/BlockFix/BlockFix_UnionFaces.hxx index f676d5bcf..83140b08b 100644 --- a/src/GEOMAlgo/BlockFix_UnionFaces.hxx +++ b/src/BlockFix/BlockFix_UnionFaces.hxx @@ -18,23 +18,14 @@ // 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 _BlockFix_UnionFaces_HeaderFile #define _BlockFix_UnionFaces_HeaderFile -#ifndef _Standard_Real_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif class TopoDS_Shape; class TopoDS_Face; @@ -42,24 +33,9 @@ class TopoDS_Face; class BlockFix_UnionFaces { public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC - // Standard_EXPORT BlockFix_UnionFaces(); - Standard_EXPORT Standard_Real& GetTolerance(); + Standard_EXPORT Standard_Real& GetTolerance(); /* \brief To get/set the OptimumNbFaces parameter * @@ -71,18 +47,17 @@ public: * negative - do not perform any unions, regardless the faces quantity. * */ - Standard_EXPORT Standard_Integer& GetOptimumNbFaces(); + Standard_EXPORT Standard_Integer& GetOptimumNbFaces(); - Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape); + Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape); - Standard_EXPORT virtual Standard_Boolean IsSameDomain(const TopoDS_Face& aFace, - const TopoDS_Face& aChekedFace) const; - Standard_EXPORT virtual void MovePCurves(TopoDS_Face& aTarget, - const TopoDS_Face& aSource) const; + Standard_EXPORT virtual Standard_Boolean IsSameDomain(const TopoDS_Face& aFace, + const TopoDS_Face& aChekedFace) const; + + Standard_EXPORT virtual void MovePCurves(TopoDS_Face& aTarget, + const TopoDS_Face& aSource) const; private: - // Fields PRIVATE - // Standard_Real myTolerance; Standard_Integer myOptimumNbFaces; }; diff --git a/src/BlockFix/Makefile.am b/src/BlockFix/Makefile.am new file mode 100644 index 000000000..a3b37223d --- /dev/null +++ b/src/BlockFix/Makefile.am @@ -0,0 +1,55 @@ +# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +# +# 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 + +# GEOM BlockFix : tools for Blocks algorithms +# File : Makefile.am +# Author : Julia DOROVSKIKH +# Module : GEOM + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# Libraries targets +lib_LTLIBRARIES = libBlockFix.la + +dist_libBlockFix_la_SOURCES = \ + BlockFix_BlockFixAPI.cxx \ + BlockFix_CheckTool.cxx \ + BlockFix.cxx \ + BlockFix_PeriodicSurfaceModifier.cxx \ + BlockFix_SphereSpaceModifier.cxx \ + BlockFix_UnionEdges.cxx \ + BlockFix_UnionFaces.cxx + +# header files +salomeinclude_HEADERS = \ + BlockFix.hxx \ + BlockFix_BlockFixAPI.hxx \ + BlockFix_CheckTool.hxx \ + BlockFix_PeriodicSurfaceModifier.hxx \ + BlockFix_SphereSpaceModifier.hxx \ + BlockFix_UnionEdges.hxx \ + BlockFix_UnionFaces.hxx + +libBlockFix_la_CPPFLAGS = \ + $(CAS_CPPFLAGS) \ + $(KERNEL_CXXFLAGS) + +libBlockFix_la_LDFLAGS = \ + $(STDLIB) \ + $(CAS_LDPATH) -lTKBO -lTKShHealing -lTKBool -lTKMesh -lTKOffset \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace diff --git a/src/GEOMAlgo/BlockFix.cdl b/src/GEOMAlgo/BlockFix.cdl deleted file mode 100644 index 961af6625..000000000 --- a/src/GEOMAlgo/BlockFix.cdl +++ /dev/null @@ -1,67 +0,0 @@ --- Copyright (C) 2007-2012 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 --- - --- File: BlockFix.cdl --- Created: Tue Dec 7 11:59:05 2004 --- Author: Pavel Durandin --- -package BlockFix - -uses - - TColStd, - gp, - Geom, - Geom2d, - GeomAbs, - TopLoc, - TopoDS, - BRepTools, - TopTools, - ShapeBuild - -is - - class SphereSpaceModifier; - - class UnionFaces; - - class UnionEdges; - - class BlockFixAPI; - ---Purpose: API class to perform the fixing of the - -- block - - class PeriodicSurfaceModifier; - - class CheckTool; - - RotateSphereSpace (S: Shape from TopoDS; Tol: Real) - returns Shape from TopoDS; - - FixRanges (S: Shape from TopoDS; Tol: Real) - returns Shape from TopoDS; - ---Purpose: checking and fixing cases where parametric - -- boundaries of face based on periodic surface are not - -- contained in the range of this surface. - -end BlockFix; diff --git a/src/GEOMAlgo/BlockFix.ixx b/src/GEOMAlgo/BlockFix.ixx deleted file mode 100644 index 2ea228ff7..000000000 --- a/src/GEOMAlgo/BlockFix.ixx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2012 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 - - - - diff --git a/src/GEOMAlgo/BlockFix.jxx b/src/GEOMAlgo/BlockFix.jxx deleted file mode 100644 index 8649f8895..000000000 --- a/src/GEOMAlgo/BlockFix.jxx +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2007-2012 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _BlockFix_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl b/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl deleted file mode 100644 index 8cb4c49ce..000000000 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl +++ /dev/null @@ -1,68 +0,0 @@ --- Copyright (C) 2007-2012 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 --- - --- File: BlockFix_BlockFixAPI.cdl --- Created: Tue Dec 7 17:56:09 2004 --- Author: Pavel Durandin --- -class BlockFixAPI from BlockFix inherits TShared from MMgt - - ---Purpose: - -uses - - Shape from TopoDS, - ReShape from ShapeBuild - -is - Create returns BlockFixAPI from BlockFix; - ---Purpose: Empty constructor - - SetShape(me: mutable; Shape: Shape from TopoDS); - ---Purpose: Sets the shape to be operated on - ---C++: inline - - Perform(me: mutable); - ---Purpose: - - Shape(me) returns Shape from TopoDS; - ---Purpose: Returns resulting shape. - ---C++: inline - - Context(me:mutable) returns ReShape from ShapeBuild; - ---Purpose: Returns modifiable context for storing the - -- mofifications - ---C++: inline - ---C++: return & - - Tolerance (me:mutable) returns Real; - ---Purpose: Returns modifiable tolerance of recognition - ---C++: inline - ---C++: return & - -fields - - myContext : ReShape from ShapeBuild; - myShape : Shape from TopoDS; - myTolerance : Real from Standard; - -end BlockFixAPI from BlockFix; diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.hxx b/src/GEOMAlgo/BlockFix_BlockFixAPI.hxx deleted file mode 100644 index 7be25cc57..000000000 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.hxx +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (C) 2007-2012 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 _BlockFix_BlockFixAPI_HeaderFile -#define _BlockFix_BlockFixAPI_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_BlockFix_BlockFixAPI_HeaderFile -#include -#endif - -#ifndef _Handle_ShapeBuild_ReShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _MMgt_TShared_HeaderFile -#include -#endif - -class ShapeBuild_ReShape; -class TopoDS_Shape; - - -class BlockFix_BlockFixAPI : public MMgt_TShared -{ -public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC - // - Standard_EXPORT BlockFix_BlockFixAPI(); - void SetShape(const TopoDS_Shape& Shape); - Standard_EXPORT void Perform(); - TopoDS_Shape Shape() const; - Handle_ShapeBuild_ReShape& Context(); - Standard_Real& Tolerance(); - Standard_Integer& OptimumNbFaces(); - Standard_EXPORT ~BlockFix_BlockFixAPI(); - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& BlockFix_BlockFixAPI_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -private: - // Fields PRIVATE - // - Handle_ShapeBuild_ReShape myContext; - TopoDS_Shape myShape; - Standard_Real myTolerance; - Standard_Integer myOptimumNbFaces; -}; - -#include - -#endif diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.ixx b/src/GEOMAlgo/BlockFix_BlockFixAPI.ixx deleted file mode 100644 index 4d06a875e..000000000 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.ixx +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2007-2012 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -BlockFix_BlockFixAPI::~BlockFix_BlockFixAPI() {} - - - -Standard_EXPORT Handle_Standard_Type& BlockFix_BlockFixAPI_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("BlockFix_BlockFixAPI", - sizeof(BlockFix_BlockFixAPI), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(BlockFix_BlockFixAPI) Handle(BlockFix_BlockFixAPI)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(BlockFix_BlockFixAPI) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(BlockFix_BlockFixAPI))) { - _anOtherObject = Handle(BlockFix_BlockFixAPI)((Handle(BlockFix_BlockFixAPI)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& BlockFix_BlockFixAPI::DynamicType() const -{ - return STANDARD_TYPE(BlockFix_BlockFixAPI) ; -} -Standard_Boolean BlockFix_BlockFixAPI::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(BlockFix_BlockFixAPI) == AType || MMgt_TShared::IsKind(AType)); -} -Handle_BlockFix_BlockFixAPI::~Handle_BlockFix_BlockFixAPI() {} - diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx b/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx deleted file mode 100644 index 945a6ed88..000000000 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2007-2012 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 _ShapeBuild_ReShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _BlockFix_BlockFixAPI_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/BlockFix_CheckTool.cdl b/src/GEOMAlgo/BlockFix_CheckTool.cdl deleted file mode 100644 index c5423377f..000000000 --- a/src/GEOMAlgo/BlockFix_CheckTool.cdl +++ /dev/null @@ -1,67 +0,0 @@ --- Copyright (C) 2007-2012 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 --- - --- File: BlockFix_CheckTool.cdl --- Created: Fri Dec 17 10:36:58 2004 --- Author: Sergey KUUL --- -class CheckTool from BlockFix - - ---Purpose: - -uses - - Shape from TopoDS, - SequenceOfShape from TopTools - -is - - Create returns CheckTool from BlockFix; - ---Purpose: Empty constructor - - SetShape(me: in out; aShape: Shape from TopoDS); - - Perform(me: in out); - ---Purpose: - - NbPossibleBlocks(me) returns Integer; - - PossibleBlock(me; num: Integer) returns Shape from TopoDS; - - DumpCheckResult(me; S : in out OStream); - ---Purpose: Dumps results of checking - - -fields - - myShape : Shape from TopoDS; - myHasCheck : Boolean; - myNbSolids : Integer; - myNbBlocks : Integer; - myPossibleBlocks : SequenceOfShape from TopTools; - myNbDegen : Integer; - myNbUF : Integer; - myNbUE : Integer; - myNbUFUE : Integer; - myBadRanges : Integer; - -end CheckTool; diff --git a/src/GEOMAlgo/BlockFix_CheckTool.hxx b/src/GEOMAlgo/BlockFix_CheckTool.hxx deleted file mode 100644 index 652319e42..000000000 --- a/src/GEOMAlgo/BlockFix_CheckTool.hxx +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (C) 2007-2012 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 _BlockFix_CheckTool_HeaderFile -#define _BlockFix_CheckTool_HeaderFile - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TopTools_SequenceOfShape_HeaderFile -#include -#endif -#ifndef _Standard_OStream_HeaderFile -#include -#endif -class TopoDS_Shape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class BlockFix_CheckTool { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT BlockFix_CheckTool(); -Standard_EXPORT void SetShape(const TopoDS_Shape& aShape) ; -Standard_EXPORT void Perform() ; -Standard_EXPORT Standard_Integer NbPossibleBlocks() const; -Standard_EXPORT TopoDS_Shape PossibleBlock(const Standard_Integer num) const; -Standard_EXPORT void DumpCheckResult(Standard_OStream& S) const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Shape myShape; -Standard_Boolean myHasCheck; -Standard_Integer myNbSolids; -Standard_Integer myNbBlocks; -TopTools_SequenceOfShape myPossibleBlocks; -Standard_Integer myNbDegen; -Standard_Integer myNbUF; -Standard_Integer myNbUE; -Standard_Integer myNbUFUE; -Standard_Integer myBadRanges; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/BlockFix_CheckTool.ixx b/src/GEOMAlgo/BlockFix_CheckTool.ixx deleted file mode 100644 index d44f98056..000000000 --- a/src/GEOMAlgo/BlockFix_CheckTool.ixx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2012 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 - - - - diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl deleted file mode 100644 index 374af919c..000000000 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl +++ /dev/null @@ -1,135 +0,0 @@ --- Copyright (C) 2007-2012 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 --- - --- File: BlockFix_PeriodicSurfaceModifier.cdl --- Created: Wed Dec 15 10:03:50 2004 --- Author: Sergey KUUL --- -class PeriodicSurfaceModifier from BlockFix inherits Modification from BRepTools - - ---Purpose: - -uses - Vertex from TopoDS, - Edge from TopoDS, - Face from TopoDS, - Location from TopLoc, - Shape from GeomAbs, - Pnt from gp, - Curve from Geom, - Curve from Geom2d, - Surface from Geom, - IndexedMapOfTransient from TColStd, - DataMapOfShapeInteger from TopTools - -is - - Create returns mutable PeriodicSurfaceModifier from BlockFix; - - SetTolerance(me: mutable; Toler: Real); - ---Purpose: Sets the tolerance for recognition of geometry - - NewSurface(me: mutable; F : Face from TopoDS; - S : out Surface from Geom; - L : out Location from TopLoc; - Tol: out Real from Standard; - RevWires : out Boolean from Standard; - RevFace : out Boolean from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the face has been - -- modified. In this case, is the new geometric - -- support of the face, the new location, - -- the new tolerance. Otherwise, returns - -- Standard_False, and , , are not - -- significant. - - NewCurve(me: mutable; E : Edge from TopoDS; - C : out Curve from Geom; - L : out Location from TopLoc; - Tol: out Real from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the edge has been - -- modified. In this case, is the new geometric - -- support of the edge, the new location, - -- the new tolerance. Otherwise, returns - -- Standard_False, and , , are not - -- significant. - - NewPoint(me: mutable; V : Vertex from TopoDS; - P : out Pnt from gp; - Tol: out Real from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the vertex has been - -- modified. In this case,

    is the new geometric - -- support of the vertex, the new tolerance. - -- Otherwise, returns Standard_False, and

    , - -- are not significant. - - NewCurve2d(me: mutable; E : Edge from TopoDS; - F : Face from TopoDS; - NewE : Edge from TopoDS; - NewF : Face from TopoDS; - C : out Curve from Geom2d; - Tol : out Real from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the edge has a new - -- curve on surface on the face .In this case, - -- is the new geometric support of the edge, the - -- new location, the new tolerance. - -- - -- Otherwise, returns Standard_False, and , , - -- are not significant. - -- - -- is the new edge created from . - -- is the new face created from . They may be usefull. - - NewParameter(me: mutable; V : Vertex from TopoDS; - E : Edge from TopoDS; - P : out Real from Standard; - Tol: out Real from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the Vertex has a new - -- parameter on the edge . In this case,

    is - -- the parameter, the new tolerance. - -- Otherwise, returns Standard_False, and

    , - -- are not significant. - - Continuity(me: mutable; E : Edge from TopoDS; - F1,F2 : Face from TopoDS; - NewE : Edge from TopoDS; - NewF1,NewF2: Face from TopoDS) - returns Shape from GeomAbs; - ---Purpose: Returns the continuity of between - -- and . - -- - -- is the new edge created from . - -- (resp. ) is the new face created from - -- (resp. ). - - -fields - - myTolerance : Real; - myMapOfFaces : DataMapOfShapeInteger from TopTools; - myMapOfSurfaces: IndexedMapOfTransient from TColStd; - -end PeriodicSurfaceModifier; diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx deleted file mode 100644 index 39d2062ea..000000000 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (C) 2007-2012 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 _BlockFix_PeriodicSurfaceModifier_HeaderFile -#define _BlockFix_PeriodicSurfaceModifier_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile -#include -#endif - -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _TColStd_IndexedMapOfTransient_HeaderFile -#include -#endif -#ifndef _BRepTools_Modification_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_Geom_Surface_HeaderFile -#include -#endif -#ifndef _Handle_Geom_Curve_HeaderFile -#include -#endif -#ifndef _Handle_Geom2d_Curve_HeaderFile -#include -#endif -#ifndef _GeomAbs_Shape_HeaderFile -#include -#endif -class TopoDS_Face; -class Geom_Surface; -class TopLoc_Location; -class TopoDS_Edge; -class Geom_Curve; -class TopoDS_Vertex; -class gp_Pnt; -class Geom2d_Curve; - - -class BlockFix_PeriodicSurfaceModifier : public BRepTools_Modification { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT BlockFix_PeriodicSurfaceModifier(); -Standard_EXPORT void SetTolerance(const Standard_Real Toler) ; -Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ; -Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ; -Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ; -Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ; -Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ; -Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ; -Standard_EXPORT ~BlockFix_PeriodicSurfaceModifier(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myTolerance; -TopTools_DataMapOfShapeInteger myMapOfFaces; -TColStd_IndexedMapOfTransient myMapOfSurfaces; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx deleted file mode 100644 index da3bdc95e..000000000 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2007-2012 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -BlockFix_PeriodicSurfaceModifier::~BlockFix_PeriodicSurfaceModifier() {} - - - -Standard_EXPORT Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification); - 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("BlockFix_PeriodicSurfaceModifier", - sizeof(BlockFix_PeriodicSurfaceModifier), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(BlockFix_PeriodicSurfaceModifier) Handle(BlockFix_PeriodicSurfaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(BlockFix_PeriodicSurfaceModifier) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier))) { - _anOtherObject = Handle(BlockFix_PeriodicSurfaceModifier)((Handle(BlockFix_PeriodicSurfaceModifier)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& BlockFix_PeriodicSurfaceModifier::DynamicType() const -{ - return STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) ; -} -Standard_Boolean BlockFix_PeriodicSurfaceModifier::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) == AType || BRepTools_Modification::IsKind(AType)); -} -Handle_BlockFix_PeriodicSurfaceModifier::~Handle_BlockFix_PeriodicSurfaceModifier() {} - diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx deleted file mode 100644 index 29c1c1e34..000000000 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2012 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 _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _Geom_Surface_HeaderFile -#include -#endif -#ifndef _TopLoc_Location_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _Geom_Curve_HeaderFile -#include -#endif -#ifndef _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _Geom2d_Curve_HeaderFile -#include -#endif -#ifndef _BlockFix_PeriodicSurfaceModifier_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl deleted file mode 100644 index da614611b..000000000 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl +++ /dev/null @@ -1,139 +0,0 @@ --- Copyright (C) 2007-2012 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 --- - --- File: BlockFix_SphereSpaceModifier.cdl --- Created: Tue Dec 7 12:01:49 2004 --- Author: Pavel Durandin --- -class SphereSpaceModifier from BlockFix inherits Modification from BRepTools - - ---Purpose: Rotation of the parametric space of the sphere in order - -- to avoid the seam and degenerared edge within it - -uses - Vertex from TopoDS, - Edge from TopoDS, - Face from TopoDS, - Location from TopLoc, - Shape from GeomAbs, - Pnt from gp, - Curve from Geom, - Curve from Geom2d, - Surface from Geom, - IndexedMapOfTransient from TColStd, - DataMapOfShapeInteger from TopTools - -is - - Create returns mutable SphereSpaceModifier from BlockFix; - - SetTolerance(me: mutable; Toler: Real); - ---Purpose: Sets the tolerance for recognition of geometry - - NewSurface(me: mutable; F : Face from TopoDS; - S : out Surface from Geom; - L : out Location from TopLoc; - Tol: out Real from Standard; - RevWires : out Boolean from Standard; - RevFace : out Boolean from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the face has been - -- modified. In this case, is the new geometric - -- support of the face, the new location, - -- the new tolerance. Otherwise, returns - -- Standard_False, and , , are not - -- significant. - - NewCurve(me: mutable; E : Edge from TopoDS; - C : out Curve from Geom; - L : out Location from TopLoc; - Tol: out Real from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the edge has been - -- modified. In this case, is the new geometric - -- support of the edge, the new location, - -- the new tolerance. Otherwise, returns - -- Standard_False, and , , are not - -- significant. - - NewPoint(me: mutable; V : Vertex from TopoDS; - P : out Pnt from gp; - Tol: out Real from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the vertex has been - -- modified. In this case,

    is the new geometric - -- support of the vertex, the new tolerance. - -- Otherwise, returns Standard_False, and

    , - -- are not significant. - - NewCurve2d(me: mutable; E : Edge from TopoDS; - F : Face from TopoDS; - NewE : Edge from TopoDS; - NewF : Face from TopoDS; - C : out Curve from Geom2d; - Tol : out Real from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the edge has a new - -- curve on surface on the face .In this case, - -- is the new geometric support of the edge, the - -- new location, the new tolerance. - -- - -- Otherwise, returns Standard_False, and , , - -- are not significant. - -- - -- is the new edge created from . - -- is the new face created from . They may be usefull. - - NewParameter(me: mutable; V : Vertex from TopoDS; - E : Edge from TopoDS; - P : out Real from Standard; - Tol: out Real from Standard) - returns Boolean from Standard; - ---Purpose: Returns Standard_True if the Vertex has a new - -- parameter on the edge . In this case,

    is - -- the parameter, the new tolerance. - -- Otherwise, returns Standard_False, and

    , - -- are not significant. - - Continuity(me: mutable; E : Edge from TopoDS; - F1,F2 : Face from TopoDS; - NewE : Edge from TopoDS; - NewF1,NewF2: Face from TopoDS) - returns Shape from GeomAbs; - ---Purpose: Returns the continuity of between - -- and . - -- - -- is the new edge created from . - -- (resp. ) is the new face created from - -- (resp. ). - - ForRotation(me: mutable; F: Face from TopoDS) returns Boolean; - -fields - - myTolerance : Real; - myMapOfFaces : DataMapOfShapeInteger from TopTools; - myMapOfSpheres: IndexedMapOfTransient from TColStd; - --myMapOfGeom: MapOfShapeTransient from TColStd; - -end SphereSpaceModifier; - diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx deleted file mode 100644 index fb11fdbae..000000000 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (C) 2007-2012 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 _BlockFix_SphereSpaceModifier_HeaderFile -#define _BlockFix_SphereSpaceModifier_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_BlockFix_SphereSpaceModifier_HeaderFile -#include -#endif - -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _TColStd_IndexedMapOfTransient_HeaderFile -#include -#endif -#ifndef _BRepTools_Modification_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_Geom_Surface_HeaderFile -#include -#endif -#ifndef _Handle_Geom_Curve_HeaderFile -#include -#endif -#ifndef _Handle_Geom2d_Curve_HeaderFile -#include -#endif -#ifndef _GeomAbs_Shape_HeaderFile -#include -#endif -class TopoDS_Face; -class Geom_Surface; -class TopLoc_Location; -class TopoDS_Edge; -class Geom_Curve; -class TopoDS_Vertex; -class gp_Pnt; -class Geom2d_Curve; - - -class BlockFix_SphereSpaceModifier : public BRepTools_Modification { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT BlockFix_SphereSpaceModifier(); -Standard_EXPORT void SetTolerance(const Standard_Real Toler) ; -Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ; -Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ; -Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ; -Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ; -Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ; -Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ; -Standard_EXPORT Standard_Boolean ForRotation(const TopoDS_Face& F) ; -Standard_EXPORT ~BlockFix_SphereSpaceModifier(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myTolerance; -TopTools_DataMapOfShapeInteger myMapOfFaces; -TColStd_IndexedMapOfTransient myMapOfSpheres; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx deleted file mode 100644 index 482241f6d..000000000 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2007-2012 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -BlockFix_SphereSpaceModifier::~BlockFix_SphereSpaceModifier() {} - - - -Standard_EXPORT Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification); - 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("BlockFix_SphereSpaceModifier", - sizeof(BlockFix_SphereSpaceModifier), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(BlockFix_SphereSpaceModifier) Handle(BlockFix_SphereSpaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(BlockFix_SphereSpaceModifier) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(BlockFix_SphereSpaceModifier))) { - _anOtherObject = Handle(BlockFix_SphereSpaceModifier)((Handle(BlockFix_SphereSpaceModifier)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& BlockFix_SphereSpaceModifier::DynamicType() const -{ - return STANDARD_TYPE(BlockFix_SphereSpaceModifier) ; -} -Standard_Boolean BlockFix_SphereSpaceModifier::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(BlockFix_SphereSpaceModifier) == AType || BRepTools_Modification::IsKind(AType)); -} -Handle_BlockFix_SphereSpaceModifier::~Handle_BlockFix_SphereSpaceModifier() {} - diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx deleted file mode 100644 index 050734179..000000000 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2012 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 _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _Geom_Surface_HeaderFile -#include -#endif -#ifndef _TopLoc_Location_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _Geom_Curve_HeaderFile -#include -#endif -#ifndef _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _Geom2d_Curve_HeaderFile -#include -#endif -#ifndef _BlockFix_SphereSpaceModifier_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.cdl b/src/GEOMAlgo/BlockFix_UnionEdges.cdl deleted file mode 100644 index 05a9f3870..000000000 --- a/src/GEOMAlgo/BlockFix_UnionEdges.cdl +++ /dev/null @@ -1,49 +0,0 @@ --- Copyright (C) 2007-2012 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 --- - --- File: BlockFix_UnionEdges.cdl --- Created: Tue Dec 7 15:24:51 2004 --- Author: Sergey KUUL --- -class UnionEdges from BlockFix - - ---Purpose: - -uses - - Shape from TopoDS, - ReShape from ShapeBuild - -is - - Create returns UnionEdges from BlockFix; - - Perform(me: in out; Shape: Shape from TopoDS; - Tol : Real) - returns Shape from TopoDS; - -fields - - myTolerance : Real; - myContext : ReShape from ShapeBuild; - -end UnionEdges; diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.hxx b/src/GEOMAlgo/BlockFix_UnionEdges.hxx deleted file mode 100644 index b38e941fb..000000000 --- a/src/GEOMAlgo/BlockFix_UnionEdges.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2012 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 _BlockFix_UnionEdges_HeaderFile -#define _BlockFix_UnionEdges_HeaderFile - -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_ShapeBuild_ReShape_HeaderFile -#include -#endif -class ShapeBuild_ReShape; -class TopoDS_Shape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class BlockFix_UnionEdges { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT BlockFix_UnionEdges(); -Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape,const Standard_Real Tol) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myTolerance; -Handle_ShapeBuild_ReShape myContext; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.ixx b/src/GEOMAlgo/BlockFix_UnionEdges.ixx deleted file mode 100644 index 27e87ac6c..000000000 --- a/src/GEOMAlgo/BlockFix_UnionEdges.ixx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2012 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 - - - - diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.cdl b/src/GEOMAlgo/BlockFix_UnionFaces.cdl deleted file mode 100644 index 371cb25ea..000000000 --- a/src/GEOMAlgo/BlockFix_UnionFaces.cdl +++ /dev/null @@ -1,65 +0,0 @@ --- Copyright (C) 2007-2012 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 --- - --- File: BlockFix_UnionFaces.cdl --- Created: Tue Dec 7 17:15:42 2004 --- Author: Pavel Durandin --- -class UnionFaces from BlockFix - -uses - - Face from TopoDS, - Shape from TopoDS - -is - - Create returns UnionFaces from BlockFix; - ---Purpose: Empty constructor - - GetTolerance(me: in out) returns Real; - ---Purpose: Returns modifiable tolerance - ---C++: return& - - Perform (me: in out; Shape: Shape from TopoDS) returns Shape from TopoDS; - ---Purpose: Performs the unification of the fsces - -- whith the same geometry - - IsSameDomain(me; aFace : Face from TopoDS; - aChekedFace: Face from TopoDS) - returns Boolean is virtual; - ---Purpose: Returns true is surfaces have same geometrically domain - -- with given tolerance - - MovePCurves(me; aTarget: in out Face from TopoDS; - aSource: Face from TopoDS) - is virtual; - ---Purpose: Creates pcurves on aTarget face for each edge from - -- aSource one. - -fields - - myTolerance: Real; - -end; - - diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.ixx b/src/GEOMAlgo/BlockFix_UnionFaces.ixx deleted file mode 100644 index c5299ca40..000000000 --- a/src/GEOMAlgo/BlockFix_UnionFaces.ixx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2012 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 - - - - diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.jxx b/src/GEOMAlgo/BlockFix_UnionFaces.jxx deleted file mode 100644 index c89fc31fb..000000000 --- a/src/GEOMAlgo/BlockFix_UnionFaces.jxx +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2007-2012 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _BlockFix_UnionFaces_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/FILES b/src/GEOMAlgo/FILES index 44aeb0c17..102101794 100644 --- a/src/GEOMAlgo/FILES +++ b/src/GEOMAlgo/FILES @@ -140,30 +140,3 @@ GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx GEOMAlgo_IndexedDataMapOfShapeState.hxx GEOMAlgo_IndexedDataMapOfIntegerShape.hxx GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/GEOMAlgo/Handle_BlockFix_BlockFixAPI.hxx b/src/GEOMAlgo/Handle_BlockFix_BlockFixAPI.hxx deleted file mode 100644 index 3fce5be46..000000000 --- a/src/GEOMAlgo/Handle_BlockFix_BlockFixAPI.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (C) 2007-2012 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 _Handle_BlockFix_BlockFixAPI_HeaderFile -#define _Handle_BlockFix_BlockFixAPI_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_MMgt_TShared_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(MMgt_TShared); -class BlockFix_BlockFixAPI; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_BlockFixAPI); - -class Handle(BlockFix_BlockFixAPI) : public Handle(MMgt_TShared) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(BlockFix_BlockFixAPI)():Handle(MMgt_TShared)() {} - Handle(BlockFix_BlockFixAPI)(const Handle(BlockFix_BlockFixAPI)& aHandle) : Handle(MMgt_TShared)(aHandle) - { - } - - Handle(BlockFix_BlockFixAPI)(const BlockFix_BlockFixAPI* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) - { - } - - Handle(BlockFix_BlockFixAPI)& operator=(const Handle(BlockFix_BlockFixAPI)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(BlockFix_BlockFixAPI)& operator=(const BlockFix_BlockFixAPI* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - BlockFix_BlockFixAPI* operator->() - { - return (BlockFix_BlockFixAPI *)ControlAccess(); - } - - BlockFix_BlockFixAPI* operator->() const - { - return (BlockFix_BlockFixAPI *)ControlAccess(); - } - - Standard_EXPORT ~Handle(BlockFix_BlockFixAPI)(); - - Standard_EXPORT static const Handle(BlockFix_BlockFixAPI) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_BlockFix_PeriodicSurfaceModifier.hxx b/src/GEOMAlgo/Handle_BlockFix_PeriodicSurfaceModifier.hxx deleted file mode 100644 index 1cb29e022..000000000 --- a/src/GEOMAlgo/Handle_BlockFix_PeriodicSurfaceModifier.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (C) 2007-2012 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 _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile -#define _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_BRepTools_Modification_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(BRepTools_Modification); -class BlockFix_PeriodicSurfaceModifier; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier); - -class Handle(BlockFix_PeriodicSurfaceModifier) : public Handle(BRepTools_Modification) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(BlockFix_PeriodicSurfaceModifier)():Handle(BRepTools_Modification)() {} - Handle(BlockFix_PeriodicSurfaceModifier)(const Handle(BlockFix_PeriodicSurfaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle) - { - } - - Handle(BlockFix_PeriodicSurfaceModifier)(const BlockFix_PeriodicSurfaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem) - { - } - - Handle(BlockFix_PeriodicSurfaceModifier)& operator=(const Handle(BlockFix_PeriodicSurfaceModifier)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(BlockFix_PeriodicSurfaceModifier)& operator=(const BlockFix_PeriodicSurfaceModifier* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - BlockFix_PeriodicSurfaceModifier* operator->() - { - return (BlockFix_PeriodicSurfaceModifier *)ControlAccess(); - } - - BlockFix_PeriodicSurfaceModifier* operator->() const - { - return (BlockFix_PeriodicSurfaceModifier *)ControlAccess(); - } - - Standard_EXPORT ~Handle(BlockFix_PeriodicSurfaceModifier)(); - - Standard_EXPORT static const Handle(BlockFix_PeriodicSurfaceModifier) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_BlockFix_SphereSpaceModifier.hxx b/src/GEOMAlgo/Handle_BlockFix_SphereSpaceModifier.hxx deleted file mode 100644 index 33dc8a198..000000000 --- a/src/GEOMAlgo/Handle_BlockFix_SphereSpaceModifier.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (C) 2007-2012 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 _Handle_BlockFix_SphereSpaceModifier_HeaderFile -#define _Handle_BlockFix_SphereSpaceModifier_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_BRepTools_Modification_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(BRepTools_Modification); -class BlockFix_SphereSpaceModifier; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_SphereSpaceModifier); - -class Handle(BlockFix_SphereSpaceModifier) : public Handle(BRepTools_Modification) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(BlockFix_SphereSpaceModifier)():Handle(BRepTools_Modification)() {} - Handle(BlockFix_SphereSpaceModifier)(const Handle(BlockFix_SphereSpaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle) - { - } - - Handle(BlockFix_SphereSpaceModifier)(const BlockFix_SphereSpaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem) - { - } - - Handle(BlockFix_SphereSpaceModifier)& operator=(const Handle(BlockFix_SphereSpaceModifier)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(BlockFix_SphereSpaceModifier)& operator=(const BlockFix_SphereSpaceModifier* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - BlockFix_SphereSpaceModifier* operator->() - { - return (BlockFix_SphereSpaceModifier *)ControlAccess(); - } - - BlockFix_SphereSpaceModifier* operator->() const - { - return (BlockFix_SphereSpaceModifier *)ControlAccess(); - } - - Standard_EXPORT ~Handle(BlockFix_SphereSpaceModifier)(); - - Standard_EXPORT static const Handle(BlockFix_SphereSpaceModifier) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Makefile.am b/src/GEOMAlgo/Makefile.am index dacba0542..f54398d11 100644 --- a/src/GEOMAlgo/Makefile.am +++ b/src/GEOMAlgo/Makefile.am @@ -15,7 +15,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# # GEOM GEOMAlgo : tools for Glue Faces algorithm # File : Makefile.am @@ -28,13 +27,6 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am lib_LTLIBRARIES = libGEOMAlgo.la dist_libGEOMAlgo_la_SOURCES = \ - BlockFix_BlockFixAPI.cxx \ - BlockFix_CheckTool.cxx \ - BlockFix.cxx \ - BlockFix_PeriodicSurfaceModifier.cxx \ - BlockFix_SphereSpaceModifier.cxx \ - BlockFix_UnionEdges.cxx \ - BlockFix_UnionFaces.cxx \ GEOMAlgo_Algo.cxx \ GEOMAlgo_Builder_0.cxx \ GEOMAlgo_Builder_1.cxx \ @@ -96,31 +88,6 @@ dist_libGEOMAlgo_la_SOURCES = \ # header files salomeinclude_HEADERS = \ - BlockFix.hxx \ - BlockFix.ixx \ - BlockFix.jxx \ - BlockFix_BlockFixAPI.hxx \ - BlockFix_BlockFixAPI.ixx \ - BlockFix_BlockFixAPI.jxx \ - BlockFix_BlockFixAPI.lxx \ - BlockFix_CheckTool.hxx \ - BlockFix_CheckTool.ixx \ - BlockFix_CheckTool.jxx \ - BlockFix_PeriodicSurfaceModifier.hxx \ - BlockFix_PeriodicSurfaceModifier.ixx \ - BlockFix_PeriodicSurfaceModifier.jxx \ - BlockFix_SphereSpaceModifier.hxx \ - BlockFix_SphereSpaceModifier.ixx \ - BlockFix_SphereSpaceModifier.jxx \ - BlockFix_UnionEdges.hxx \ - BlockFix_UnionEdges.ixx \ - BlockFix_UnionEdges.jxx \ - BlockFix_UnionFaces.hxx \ - BlockFix_UnionFaces.ixx \ - BlockFix_UnionFaces.jxx \ - Handle_BlockFix_BlockFixAPI.hxx \ - Handle_BlockFix_SphereSpaceModifier.hxx \ - Handle_BlockFix_PeriodicSurfaceModifier.hxx \ GEOMAlgo_Algo.hxx \ GEOMAlgo_BuilderArea.hxx \ GEOMAlgo_BuilderFace.hxx \ @@ -211,15 +178,7 @@ libGEOMAlgo_la_LDFLAGS = \ $(KERNEL_LDFLAGS) -lSALOMELocalTrace # extra distributed files -CDL_FILES = \ - BlockFix.cdl \ - BlockFix_BlockFixAPI.cdl \ - BlockFix_CheckTool.cdl \ - BlockFix_PeriodicSurfaceModifier.cdl \ - BlockFix_SphereSpaceModifier.cdl \ - BlockFix_UnionEdges.cdl \ - BlockFix_UnionFaces.cdl \ - GEOMAlgo.cdl +CDL_FILES = GEOMAlgo.cdl EXTRA_DIST += \ $(CDL_FILES) \ diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index ed57921e0..4b0d81c5c 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -4871,6 +4871,22 @@ be specified in meters). GEOM_IS_REORDER Reorder vertices taking into account distances + + GEOM_INTERPOL_TANGENTS + Tangents + + + GEOM_INTERPOL_FIRST_VEC + First tangent vector + + + GEOM_INTERPOL_LAST_VEC + Last tangent vector + + + GEOM_BOTH_TANGENTS_REQUIRED + Both tangent vectors must be defined + GEOM_CURVE_CRMODE Creation Mode diff --git a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx index b26507e88..e0c33a478 100644 --- a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx @@ -18,17 +18,19 @@ // 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 +#include + #include #include + #include #include #include @@ -48,29 +50,29 @@ //======================================================================= //function : GetID //purpose : -//======================================================================= +//======================================================================= const Standard_GUID& GEOMImpl_CircleDriver::GetID() { static Standard_GUID aCircleDriver("FF1BBB32-5D14-4df2-980B-3A668264EA16"); - return aCircleDriver; + return aCircleDriver; } //======================================================================= //function : GEOMImpl_CircleDriver -//purpose : +//purpose : //======================================================================= -GEOMImpl_CircleDriver::GEOMImpl_CircleDriver() +GEOMImpl_CircleDriver::GEOMImpl_CircleDriver() { } //======================================================================= //function : Execute //purpose : -//======================================================================= +//======================================================================= Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const { - if (Label().IsNull()) return 0; + if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); GEOMImpl_ICircle aCI (aFunction); @@ -95,20 +97,7 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const Handle(GEOM_Function) aRefVector = aCI.GetVector(); if (!aRefVector.IsNull()) { TopoDS_Shape aShapeVec = aRefVector->GetValue(); - if (aShapeVec.ShapeType() != TopAbs_EDGE) { - Standard_ConstructionError::Raise - ("Circle creation aborted: invalid vector argument, must be a vector or an edge"); - } - TopoDS_Edge anE = TopoDS::Edge(aShapeVec); - TopoDS_Vertex V1, V2; - TopExp::Vertices(anE, V1, V2, Standard_True); - if (!V1.IsNull() && !V2.IsNull()) { - aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); - if (aV.Magnitude() < gp::Resolution()) { - Standard_ConstructionError::Raise - ("Circle creation aborted: vector of zero length is given"); - } - } + aV = GEOMUtils::GetVector(aShapeVec); } // Axes gp_Ax2 anAxes (aP, aV); @@ -163,7 +152,7 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const //Make Circle gp_Ax2 anAxes (aP1, aDir); gp_Circ aCirc (anAxes, aRadius); - aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge(); + aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge(); } } else if (aType == CIRCLE_THREE_PNT) { @@ -187,7 +176,7 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line"); Handle(Geom_Circle) aCirc = GC_MakeCircle(aP1, aP2, aP3).Value(); aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge(); - } + } } else { } @@ -196,26 +185,26 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const aFunction->SetValue(aShape); - log.SetTouched(Label()); + log.SetTouched(Label()); - return 1; + return 1; } //======================================================================= //function : GEOMImpl_CircleDriver_Type_ //purpose : -//======================================================================= +//======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_CircleDriver_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); + 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_CircleDriver", @@ -230,7 +219,7 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_CircleDriver_Type_() //======================================================================= //function : DownCast //purpose : -//======================================================================= +//======================================================================= const Handle(GEOMImpl_CircleDriver) Handle(GEOMImpl_CircleDriver)::DownCast(const Handle(Standard_Transient)& AnObject) { Handle(GEOMImpl_CircleDriver) _anOtherObject; diff --git a/src/GEOMImpl/GEOMImpl_FaceDriver.cxx b/src/GEOMImpl/GEOMImpl_FaceDriver.cxx index 4aafb7114..708f8f450 100755 --- a/src/GEOMImpl/GEOMImpl_FaceDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FaceDriver.cxx @@ -15,16 +15,15 @@ // 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 -#include +#include #include #include @@ -89,7 +88,7 @@ Standard_Integer GEOMImpl_FaceDriver::Execute(TFunction_Logbook& log) const } else if (aRefShape.ShapeType() == TopAbs_FACE) { double aH = aFI.GetH() / 2.0; double aW = aFI.GetW() / 2.0; - gp_Ax3 anAx = GEOMImpl_IMeasureOperations::GetPosition(aRefShape); + gp_Ax3 anAx = GEOMUtils::GetPosition(aRefShape); gp_Pln aPln (anAx); aShape = BRepBuilderAPI_MakeFace(aPln, -aH, +aH, -aW, +aW).Shape(); } diff --git a/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx index f781f228e..38a0ba318 100644 --- a/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx @@ -23,10 +23,12 @@ #include #include #include -#include #include + #include +#include + #include #include #include @@ -352,7 +354,7 @@ bool GEOMImpl_Fillet1dDriver::MakeFillet(const TopoDS_Wire& aWire, aListOfNewEdge.Append(anEdgeToEdgeMap.Find(anEdge)); } - GEOMImpl_IShapesOperations::SortShapes(aListOfNewEdge); + GEOMUtils::SortShapes(aListOfNewEdge); BRepBuilderAPI_MakeWire aWireTool; aWireTool.Add(aListOfNewEdge); diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx index efb69f42c..65b2ea018 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx @@ -34,7 +34,8 @@ #include #include #include -#include + +#include #include #include @@ -3492,13 +3493,13 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate } // while (listPrevEdges.Extent() > 0) // Sort shapes in current chain (Mantis issue 21053) - GEOMImpl_IShapesOperations::SortShapes(currentChain, Standard_False); + GEOMUtils::SortShapes(currentChain, Standard_False); aFirstInChains.Append(currentChain.First()); aMapChains.Bind(currentChain.First(), currentChain); } // Sort chains (Mantis issue 21053) - GEOMImpl_IShapesOperations::SortShapes(aFirstInChains, Standard_False); + GEOMUtils::SortShapes(aFirstInChains, Standard_False); // Store sorted chains in the document TopTools_ListIteratorOfListOfShape aChainsIt (aFirstInChains); diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx index 22237b786..60983a177 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -736,19 +736,19 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier GEOMImpl_ISpline aCI (aFunction); - int aLen = thePoints.size(); - aCI.SetLength(aLen); aCI.SetConstructorType(POINT_CONSTRUCTOR); - int ind = 1; + Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient; std::list::iterator it = thePoints.begin(); - for (; it != thePoints.end(); it++, ind++) { + for (; it != thePoints.end(); it++) { Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); - - if (aRefPnt.IsNull()) return NULL; - - aCI.SetPoint(ind, aRefPnt); + if (aRefPnt.IsNull()) { + SetErrorCode("NULL point for Besier curve"); + return NULL; + } + aPoints->Append(aRefPnt); } + aCI.SetPoints(aPoints); aCI.SetIsClosed(theIsClosed); @@ -798,7 +798,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation //Add a new Spline object Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE); - //Add a new Spline function for creation a bezier curve relatively to points set + //Add a new Spline function for interpolation type Handle(GEOM_Function) aFunction = aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION); if (aFunction.IsNull()) return NULL; @@ -808,19 +808,18 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation GEOMImpl_ISpline aCI (aFunction); - int aLen = thePoints.size(); aCI.SetConstructorType(POINT_CONSTRUCTOR); - aCI.SetLength(aLen); - int ind = 1; + Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient; std::list::iterator it = thePoints.begin(); - for (; it != thePoints.end(); it++, ind++) { + for (; it != thePoints.end(); it++) { Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); - - if (aRefPnt.IsNull()) return NULL; - - aCI.SetPoint(ind, aRefPnt); + if (aRefPnt.IsNull()) { + return NULL; + } + aPoints->Append(aRefPnt); } + aCI.SetPoints(aPoints); aCI.SetIsClosed(theIsClosed); aCI.SetDoReordering(theDoReordering); @@ -856,6 +855,85 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation return aSpline; } + +//============================================================================= +/*! + * MakeSplineInterpolWithTangents + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolWithTangents + (std::list thePoints, + Handle(GEOM_Object) theFirstVec, + Handle(GEOM_Object) theLastVec) +{ + SetErrorCode(KO); + + //Add a new Spline object + Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE); + + //Add a new Spline function for interpolation type + Handle(GEOM_Function) aFunction = + aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOL_TANGENTS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL; + + GEOMImpl_ISpline aCI (aFunction); + + aCI.SetConstructorType(POINT_CONSTRUCTOR); + + Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient; + std::list::iterator it = thePoints.begin(); + for (; it != thePoints.end(); it++) { + Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); + if (aRefPnt.IsNull()) { + SetErrorCode("NULL point for Interpolation"); + return NULL; + } + aPoints->Append(aRefPnt); + } + aCI.SetPoints(aPoints); + + Handle(GEOM_Function) aVec1 = theFirstVec->GetLastFunction(); + Handle(GEOM_Function) aVec2 = theLastVec->GetLastFunction(); + + if (aVec1.IsNull() || aVec2.IsNull()) return NULL; + + aCI.SetFirstVector(aVec1); + aCI.SetLastVector(aVec2); + + //Compute the Spline value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Spline driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aSpline << " = geompy.MakeInterpolWithTangents(["; + + it = thePoints.begin(); + pd << (*it++); + while (it != thePoints.end()) { + pd << ", " << (*it++); + } + pd << "], " << theFirstVec << ", " << theLastVec << ")"; + + SetErrorCode(OK); + return aSpline; +} + //============================================================================= /*! * MakeCurveParametric @@ -864,7 +942,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric (const char* thexExpr, const char* theyExpr, const char* thezExpr, double theParamMin, double theParamMax, double theParamStep, - CurveType theCurveType, + CurveType theCurveType, int theParamNbStep, bool theNewMethod) { TCollection_AsciiString aPyScript; @@ -958,7 +1036,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric coords = PyObject_CallFunction(func,(char*)"(d, d, i)", theParamMin, theParamMax, theParamNbStep ); else coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep ); - + PyObject* new_stderr = NULL; if (coords == NULL){ @@ -1038,7 +1116,6 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric GEOMImpl_ISpline aCI (aFunction); - aCI.SetLength(lsize); aCI.SetConstructorType(COORD_CONSTRUCTOR); aCI.SetIsClosed(false); aCI.SetCoordinates(aCoordsArray); @@ -1058,7 +1135,6 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric GEOMImpl_ISpline aCI (aFunction); aCI.SetConstructorType(COORD_CONSTRUCTOR); - aCI.SetLength(lsize); aCI.SetIsClosed(false); aCI.SetDoReordering(false); aCI.SetCoordinates(aCoordsArray); diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx index 829f9cc5d..f3e93170d 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx @@ -32,11 +32,11 @@ class GEOM_Engine; class Handle(GEOM_Object); class GEOMImpl_ICurvesOperations : public GEOM_IOperations { - + public: enum CurveType { Polyline, Bezier, Interpolation }; - + Standard_EXPORT GEOMImpl_ICurvesOperations(GEOM_Engine* theEngine, int theDocID); Standard_EXPORT ~GEOMImpl_ICurvesOperations(); @@ -57,7 +57,7 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeArc (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2, Handle(GEOM_Object) thePnt3); - + Standard_EXPORT Handle(GEOM_Object) MakeArcCenter (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2, Handle(GEOM_Object) thePnt3, @@ -77,9 +77,14 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations { bool theIsClosed = false, bool theDoReordering = false); + Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolWithTangents + (std::list thePoints, + Handle(GEOM_Object) theFirstVec, + Handle(GEOM_Object) theLastVec); + Standard_EXPORT Handle(GEOM_Object) MakeCurveParametric - (const char* thexExpr, const char* theyExpr, const char* thezExpr, - double theParamMin, double theParamMax, double theParamStep, + (const char* thexExpr, const char* theyExpr, const char* thezExpr, + double theParamMin, double theParamMax, double theParamStep, CurveType theCurveType, int theParamNbStep=0, bool theNewMethod=false); Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand, diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index df3a87a49..0d08e6dcd 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -28,6 +28,8 @@ #include #include +#include + #include #include @@ -765,69 +767,6 @@ GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape return aKind; } -//============================================================================= -/*! Get LCS, corresponding to the given shape. - * Origin of the LCS is situated at the shape's center of mass. - * Axes of the LCS are obtained from shape's location or, - * if the shape is a planar face, from position of its plane. - */ -//============================================================================= -gp_Ax3 GEOMImpl_IMeasureOperations::GetPosition (const TopoDS_Shape& theShape) -{ - gp_Ax3 aResult; - - if (theShape.IsNull()) - return aResult; - - // Axes - aResult.Transform(theShape.Location().Transformation()); - if (theShape.ShapeType() == TopAbs_FACE) { - Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(theShape)); - if (!aGS.IsNull() && aGS->IsKind(STANDARD_TYPE(Geom_Plane))) { - Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS); - gp_Pln aPln = aGPlane->Pln(); - aResult = aPln.Position(); - // In case of reverse orinetation of the face invert the plane normal - // (the face's normal does not mathc the plane's normal in this case) - if(theShape.Orientation() == TopAbs_REVERSED) - { - gp_Dir Vx = aResult.XDirection(); - gp_Dir N = aResult.Direction().Mirrored(Vx); - gp_Pnt P = aResult.Location(); - aResult = gp_Ax3(P, N, Vx); - } - } - } - - // Origin - gp_Pnt aPnt; - - TopAbs_ShapeEnum aShType = theShape.ShapeType(); - - if (aShType == TopAbs_VERTEX) { - aPnt = BRep_Tool::Pnt(TopoDS::Vertex(theShape)); - } - else { - if (aShType == TopAbs_COMPOUND) { - aShType = GEOMImpl_IShapesOperations::GetTypeOfSimplePart(theShape); - } - - GProp_GProps aSystem; - if (aShType == TopAbs_EDGE || aShType == TopAbs_WIRE) - BRepGProp::LinearProperties(theShape, aSystem); - else if (aShType == TopAbs_FACE || aShType == TopAbs_SHELL) - BRepGProp::SurfaceProperties(theShape, aSystem); - else - BRepGProp::VolumeProperties(theShape, aSystem); - - aPnt = aSystem.CentreOfMass(); - } - - aResult.SetLocation(aPnt); - - return aResult; -} - //============================================================================= /*! * GetPosition @@ -861,7 +800,7 @@ void GEOMImpl_IMeasureOperations::GetPosition OCC_CATCH_SIGNALS; #endif - gp_Ax3 anAx3 = GetPosition(aShape); + gp_Ax3 anAx3 = GEOMUtils::GetPosition(aShape); gp_Pnt anOri = anAx3.Location(); gp_Dir aDirZ = anAx3.Direction(); diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx index d84b8743c..fbcdcfa9e 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx @@ -18,7 +18,6 @@ // 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_IMeasureOperations_HXX_ #define _GEOMImpl_IMeasureOperations_HXX_ @@ -168,9 +167,6 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { Standard_EXPORT Standard_Real MinSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf, Handle(GEOM_Object) thePoint); - public: - Standard_EXPORT static gp_Ax3 GetPosition (const TopoDS_Shape& theShape); - private: void StructuralDump (const BRepCheck_Analyzer& theAna, const TopoDS_Shape& theShape, diff --git a/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx b/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx index dbdb52601..393e65a47 100644 --- a/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx @@ -18,15 +18,16 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// //NOTE: This is an intreface to a function for the Pipe creation. -// + #ifndef _GEOMImpl_IPIPEDIFFSECT_HXX_ #define _GEOMImpl_IPIPEDIFFSECT_HXX_ #include "GEOM_Function.hxx" +#include + #ifndef _GEOMImpl_IPIPE_HXX_ #include "GEOMImpl_IPipe.hxx" #endif diff --git a/src/GEOMImpl/GEOMImpl_IPipePath.hxx b/src/GEOMImpl/GEOMImpl_IPipePath.hxx index 028ab2f53..7b2ccd40a 100644 --- a/src/GEOMImpl/GEOMImpl_IPipePath.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipePath.hxx @@ -23,6 +23,8 @@ #include "GEOM_Function.hxx" +#include + class GEOMImpl_IPipePath { public: diff --git a/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx b/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx index 0b3f35fd4..3061153f0 100644 --- a/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx @@ -15,10 +15,9 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// //NOTE: This is an intreface to a function for the Pipe creation. -// + #ifndef _GEOMImpl_IPIPESHELLSECT_HXX_ #define _GEOMImpl_IPIPESHELLSECT_HXX_ @@ -28,6 +27,8 @@ #include "GEOMImpl_IPipeDiffSect.hxx" #endif +#include + #define PIPEDS_LIST_SUBBASES 6 diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 682311302..eb8ec50fc 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -48,6 +48,8 @@ #include "GEOM_ISubShape.hxx" #include "GEOM_PythonDump.hxx" +#include "GEOMUtils.hxx" + #include "GEOMAlgo_ClsfBox.hxx" #include "GEOMAlgo_ClsfSolid.hxx" #include "GEOMAlgo_CoupleOfShapes.hxx" @@ -141,8 +143,6 @@ #include #include -#define STD_SORT_ALGO 1 - //============================================================================= /*! * constructor: @@ -1023,7 +1023,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes } // for stable order of returned entities - GEOMImpl_IShapesOperations::SortShapes(listOnePerSet, Standard_False); + GEOMUtils::SortShapes(listOnePerSet, Standard_False); TopTools_ListIteratorOfListOfShape aListIt (listOnePerSet); for (; aListIt.More(); aListIt.Next()) { @@ -1267,7 +1267,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode bool isOldSorting = false; if (theExplodeType == EXPLODE_OLD_INCLUDE_MAIN) isOldSorting = true; - SortShapes(listShape, isOldSorting); + GEOMUtils::SortShapes(listShape, isOldSorting); } TopTools_IndexedMapOfShape anIndices; @@ -1391,7 +1391,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs bool isOldSorting = false; if (theExplodeType == EXPLODE_OLD_INCLUDE_MAIN) isOldSorting = true; - SortShapes(listShape, isOldSorting); + GEOMUtils::SortShapes(listShape, isOldSorting); } TopTools_IndexedMapOfShape anIndices; @@ -2217,7 +2217,7 @@ Handle(TColStd_HSequenceOfInteger) TopoDS_Shape aShape = theShape->GetValue(); // Check presence of triangulation, build if need - if (!CheckTriangulation(aShape)) { + if (!GEOMUtils::CheckTriangulation(aShape)) { SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; } @@ -2384,7 +2384,7 @@ Handle(TColStd_HSequenceOfInteger) TopTools_ListOfShape res; // Check presence of triangulation, build if need - if (!CheckTriangulation(aShape)) { + if (!GEOMUtils::CheckTriangulation(aShape)) { SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; } @@ -2604,7 +2604,7 @@ Handle(TColStd_HSequenceOfInteger) Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; // Check presence of triangulation, build if need - if (!CheckTriangulation(theShape)) { + if (!GEOMUtils::CheckTriangulation(theShape)) { SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; } @@ -3385,7 +3385,7 @@ Handle(TColStd_HSequenceOfInteger) Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; // Check presence of triangulation, build if need - if (!CheckTriangulation(aShape)) { + if (!GEOMUtils::CheckTriangulation(aShape)) { SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; } @@ -3776,28 +3776,6 @@ namespace { } } -//================================================================================ -/*! - * \brief Return type of shape for explode. In case of compound it will be a type of sub-shape. - */ -//================================================================================ -TopAbs_ShapeEnum GEOMImpl_IShapesOperations::GetTypeOfSimplePart (const TopoDS_Shape& theShape) -{ - TopAbs_ShapeEnum aType = theShape.ShapeType(); - if (aType == TopAbs_VERTEX) return TopAbs_VERTEX; - else if (aType == TopAbs_EDGE || aType == TopAbs_WIRE) return TopAbs_EDGE; - else if (aType == TopAbs_FACE || aType == TopAbs_SHELL) return TopAbs_FACE; - else if (aType == TopAbs_SOLID || aType == TopAbs_COMPSOLID) return TopAbs_SOLID; - else if (aType == TopAbs_COMPOUND) { - // Only the iType of the first shape in the compound is taken into account - TopoDS_Iterator It (theShape, Standard_False, Standard_False); - if (It.More()) { - return GetTypeOfSimplePart(It.Value()); - } - } - return TopAbs_SHAPE; -} - //============================================================================= /*! * case GetInPlace: @@ -3839,7 +3817,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) GProp_GProps aProps; // Find the iType of the aWhat shape - iType = GetTypeOfSimplePart(aWhat); + iType = GEOMUtils::GetTypeOfSimplePart(aWhat); if (iType == TopAbs_SHAPE) { SetErrorCode("Error: An attempt to extract a shape of not supported type."); return NULL; @@ -4041,7 +4019,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceOld (Handle(GEOM_Objec return NULL; } */ - iType = GetTypeOfSimplePart(aWhat); + iType = GEOMUtils::GetTypeOfSimplePart(aWhat); if (iType == TopAbs_SHAPE) { SetErrorCode("Error: An attempt to extract a shape of not supported type."); return NULL; @@ -4266,321 +4244,6 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory return aResult; } -//======================================================================= -//function : ShapeToDouble -//purpose : used by CompareShapes::operator() -//======================================================================= -std::pair ShapeToDouble (const TopoDS_Shape& S, bool isOldSorting) -{ - // Computing of CentreOfMass - gp_Pnt GPoint; - double Len; - - if (S.ShapeType() == TopAbs_VERTEX) { - GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S)); - Len = (double)S.Orientation(); - } - else { - GProp_GProps GPr; - // BEGIN: fix for Mantis issue 0020842 - if (isOldSorting) { - BRepGProp::LinearProperties(S, GPr); - } - else { - if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) { - BRepGProp::LinearProperties(S, GPr); - } - else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) { - BRepGProp::SurfaceProperties(S, GPr); - } - else { - BRepGProp::VolumeProperties(S, GPr); - } - } - // END: fix for Mantis issue 0020842 - GPoint = GPr.CentreOfMass(); - Len = GPr.Mass(); - } - - double dMidXYZ = GPoint.X() * 999.0 + GPoint.Y() * 99.0 + GPoint.Z() * 0.9; - return std::make_pair(dMidXYZ, Len); -} - -//======================================================================= -//function : CompareShapes::operator() -//purpose : used by std::sort(), called from SortShapes() -//======================================================================= -bool GEOMImpl_IShapesOperations::CompareShapes::operator()(const TopoDS_Shape& theShape1, - const TopoDS_Shape& theShape2) -{ - if (!myMap.IsBound(theShape1)) { - myMap.Bind(theShape1, ShapeToDouble(theShape1, myIsOldSorting)); - } - - if (!myMap.IsBound(theShape2)) { - myMap.Bind(theShape2, ShapeToDouble(theShape2, myIsOldSorting)); - } - - std::pair val1 = myMap.Find(theShape1); - std::pair val2 = myMap.Find(theShape2); - - double tol = Precision::Confusion(); - bool exchange = Standard_False; - - double dMidXYZ = val1.first - val2.first; - if (dMidXYZ >= tol) { - exchange = Standard_True; - } - else if (Abs(dMidXYZ) < tol) { - double dLength = val1.second - val2.second; - if (dLength >= tol) { - exchange = Standard_True; - } - else if (Abs(dLength) < tol && theShape1.ShapeType() <= TopAbs_FACE) { - // PAL17233 - // equal values possible on shapes such as two halves of a sphere and - // a membrane inside the sphere - Bnd_Box box1,box2; - BRepBndLib::Add(theShape1, box1); - if (!box1.IsVoid()) { - BRepBndLib::Add(theShape2, box2); - Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent(); - if (dSquareExtent >= tol) { - exchange = Standard_True; - } - else if (Abs(dSquareExtent) < tol) { - Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, val1, val2; - box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - val1 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9; - box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - val2 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9; - if ((val1 - val2) >= tol) { - exchange = Standard_True; - } - } - } - } - } - - //return val1 < val2; - return !exchange; -} - -//======================================================================= -//function : SortShapes -//purpose : -//======================================================================= -void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL, - const Standard_Boolean isOldSorting) -{ -#ifdef STD_SORT_ALGO - std::vector aShapesVec; - aShapesVec.reserve(SL.Extent()); - - TopTools_ListIteratorOfListOfShape it (SL); - for (; it.More(); it.Next()) { - aShapesVec.push_back(it.Value()); - } - SL.Clear(); - - CompareShapes shComp (isOldSorting); - std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp); - //std::sort(aShapesVec.begin(), aShapesVec.end(), shComp); - - std::vector::const_iterator anIter = aShapesVec.begin(); - for (; anIter != aShapesVec.end(); ++anIter) { - SL.Append(*anIter); - } -#else - // old implementation - Standard_Integer MaxShapes = SL.Extent(); - TopTools_Array1OfShape aShapes (1,MaxShapes); - TColStd_Array1OfInteger OrderInd(1,MaxShapes); - TColStd_Array1OfReal MidXYZ (1,MaxShapes); //X,Y,Z; - TColStd_Array1OfReal Length (1,MaxShapes); //X,Y,Z; - - // Computing of CentreOfMass - Standard_Integer Index; - GProp_GProps GPr; - gp_Pnt GPoint; - TopTools_ListIteratorOfListOfShape it(SL); - for (Index=1; it.More(); Index++) - { - TopoDS_Shape S = it.Value(); - SL.Remove( it ); // == it.Next() - aShapes(Index) = S; - OrderInd.SetValue (Index, Index); - if (S.ShapeType() == TopAbs_VERTEX) { - GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S )); - Length.SetValue( Index, (Standard_Real) S.Orientation()); - } - else { - // BEGIN: fix for Mantis issue 0020842 - if (isOldSorting) { - BRepGProp::LinearProperties (S, GPr); - } - else { - if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) { - BRepGProp::LinearProperties (S, GPr); - } - else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) { - BRepGProp::SurfaceProperties(S, GPr); - } - else { - BRepGProp::VolumeProperties(S, GPr); - } - } - // END: fix for Mantis issue 0020842 - GPoint = GPr.CentreOfMass(); - Length.SetValue(Index, GPr.Mass()); - } - MidXYZ.SetValue(Index, GPoint.X()*999.0 + GPoint.Y()*99.0 + GPoint.Z()*0.9); - //cout << Index << " L: " << Length(Index) << "CG: " << MidXYZ(Index) << endl; - } - - // Sorting - Standard_Integer aTemp; - Standard_Boolean exchange, Sort = Standard_True; - Standard_Real tol = Precision::Confusion(); - while (Sort) - { - Sort = Standard_False; - for (Index=1; Index < MaxShapes; Index++) - { - exchange = Standard_False; - Standard_Real dMidXYZ = MidXYZ(OrderInd(Index)) - MidXYZ(OrderInd(Index+1)); - Standard_Real dLength = Length(OrderInd(Index)) - Length(OrderInd(Index+1)); - if ( dMidXYZ >= tol ) { -// cout << "MidXYZ: " << MidXYZ(OrderInd(Index))<< " > " <= tol ) { -// cout << "Length: " << Length(OrderInd(Index))<< " > " <= tol ) { -// cout << "SquareExtent: " << box1.SquareExtent()<<" > "< val2; - if ((val1 - val2) >= tol) { - exchange = Standard_True; - } - //cout << "box: " << val1<<" > "< - { - CompareShapes (bool isOldSorting) - : myIsOldSorting(isOldSorting) {} - - bool operator()(const TopoDS_Shape& lhs, const TopoDS_Shape& rhs); - - typedef NCollection_DataMap > NCollection_DataMapOfShapeDouble; - NCollection_DataMapOfShapeDouble myMap; - bool myIsOldSorting; - }; - - Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL, - const Standard_Boolean isOldSorting = Standard_True); - - /*! - * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND. - * - * If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is. - * - * \param theCompsolid The compsolid to be converted. - * \retval TopoDS_Shape Returns the resulting compound. - */ - Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid); - - /*! - * \brief Build a triangulation on \a theShape if it is absent. - * \param theShape The shape to check/build triangulation on. - * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation. - */ - Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape); - - /*! - * \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape. - * \param theShape The shape to get type of. - * \retval TopAbs_ShapeEnum Return type of shape for explode. - */ - Standard_EXPORT static TopAbs_ShapeEnum GetTypeOfSimplePart (const TopoDS_Shape& theShape); - private: Handle(GEOM_Object) MakeShape (std::list theShapes, const Standard_Integer theObjectType, diff --git a/src/GEOMImpl/GEOMImpl_ISpline.hxx b/src/GEOMImpl/GEOMImpl_ISpline.hxx index b20a7e6dc..e7f8b076a 100644 --- a/src/GEOMImpl/GEOMImpl_ISpline.hxx +++ b/src/GEOMImpl/GEOMImpl_ISpline.hxx @@ -18,13 +18,61 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // NOTE: This is an interface to a function for the Spline creation. -#include "GEOM_Function.hxx" +#include + +#include #include +class GEOMImpl_ISpline +{ + public: + + enum { + ARG_POINTS = 1, + ARG_CLOSED = 2, + ARG_REORDER = 3, + CONSTRUCTOR = 4, + ARG_ARRAY = 5, + ARG_VEC_1 = 6, + ARG_VEC_2 = 7 + }; + + GEOMImpl_ISpline(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + // Set + + void SetPoints (const Handle(TColStd_HSequenceOfTransient)& thePoints) + { _func->SetReferenceList(ARG_POINTS, thePoints); } + + void SetIsClosed (bool theIsClosed) { _func->SetInteger(ARG_CLOSED, (int)theIsClosed); } + void SetDoReordering (bool theDoReordering) { _func->SetInteger(ARG_REORDER, (int)theDoReordering); } + + void SetConstructorType (int theConstructor) { _func->SetInteger(CONSTRUCTOR, theConstructor); } + + void SetCoordinates (const Handle(TColStd_HArray1OfReal)& theValue) + { _func->SetRealArray(ARG_ARRAY, theValue); } + + void SetFirstVector (Handle(GEOM_Function) theVec) { _func->SetReference(ARG_VEC_1, theVec); } + void SetLastVector (Handle(GEOM_Function) theVec) { _func->SetReference(ARG_VEC_2, theVec); } + + // Get + + Handle(TColStd_HSequenceOfTransient) GetPoints() { return _func->GetReferenceList(ARG_POINTS); } + + bool GetIsClosed() { return (bool)_func->GetInteger(ARG_CLOSED); } + bool GetDoReordering() { return (bool)_func->GetInteger(ARG_REORDER); } + + int GetConstructorType() { return _func->GetInteger(CONSTRUCTOR); } + + Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(ARG_ARRAY); } + + Handle(GEOM_Function) GetFirstVector () { return _func->GetReference(ARG_VEC_1); } + Handle(GEOM_Function) GetLastVector () { return _func->GetReference(ARG_VEC_2); } + + /* Old implementation (Salome 6.6.0 and earlier) #define SPL_ARG_LENG 1 #define SPL_ARG_CLOS 2 #define SPL_ARG_REOR 3 @@ -33,38 +81,21 @@ #define SPL_CONSTRUCTOR 4 #define SPL_ARG_ARRAY 5 -class GEOMImpl_ISpline -{ - public: - - GEOMImpl_ISpline(Handle(GEOM_Function) theFunction): _func(theFunction) {} - void SetLength(int theLen) { _func->SetInteger(SPL_ARG_LENG, theLen); } - void SetIsClosed(bool theIsClosed) { _func->SetInteger(SPL_ARG_CLOS, (int)theIsClosed); } - void SetDoReordering(bool theDoReordering) { _func->SetInteger(SPL_ARG_REOR, (int)theDoReordering); } - - void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SPL_ARG_LAST + theId, theP); } - - int GetLength() { return _func->GetInteger(SPL_ARG_LENG); } - - bool GetIsClosed() { return (bool)_func->GetInteger(SPL_ARG_CLOS); } - - bool GetDoReordering() { return (bool)_func->GetInteger(SPL_ARG_REOR); } - - Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SPL_ARG_LAST + theId); } - - void SetConstructorType(int theConstructor) {_func->SetInteger(SPL_CONSTRUCTOR,theConstructor); } - - int GetConstructorType() { return _func->GetInteger(SPL_CONSTRUCTOR); } - + void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SPL_ARG_LAST + theId, theP); } void SetCoordinates(const Handle(TColStd_HArray1OfReal)& theValue) { _func->SetRealArray(SPL_ARG_ARRAY, theValue); } - + int GetLength() { return _func->GetInteger(SPL_ARG_LENG); } + bool GetIsClosed() { return (bool)_func->GetInteger(SPL_ARG_CLOS); } + bool GetDoReordering() { return (bool)_func->GetInteger(SPL_ARG_REOR); } + int GetConstructorType() { return _func->GetInteger(SPL_CONSTRUCTOR); } + Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SPL_ARG_LAST + theId); } Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(SPL_ARG_ARRAY); } + */ private: diff --git a/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx b/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx index 25f22d214..604d65da1 100644 --- a/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx @@ -18,15 +18,16 @@ // 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 -#include + +#include #include #include @@ -109,7 +110,7 @@ Standard_Integer GEOMImpl_MarkerDriver::Execute(TFunction_Logbook& log) const } else if (aType == MARKER_SHAPE) { Handle(GEOM_Function) aRefShape = aPI.GetShape(); TopoDS_Shape aSh = aRefShape->GetValue(); - gp_Ax3 anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aSh); + gp_Ax3 anAx3 = GEOMUtils::GetPosition(aSh); gp_Pln aPln (anAx3); double aTrimSize = 100.0; diff --git a/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx b/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx index 5e014b4eb..7aa6fb5f8 100644 --- a/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx @@ -18,16 +18,17 @@ // 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 + #include +#include + #include #include #include @@ -96,7 +97,7 @@ Standard_Integer GEOMImpl_MeasureDriver::Execute(TFunction_Logbook& log) const Standard_NullObject::Raise("Shape for centre of mass calculation is null"); } - gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(aShapeBase); + gp_Ax3 aPos = GEOMUtils::GetPosition(aShapeBase); gp_Pnt aCenterMass = aPos.Location(); aShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape(); } @@ -189,7 +190,7 @@ Standard_Integer GEOMImpl_MeasureDriver::Execute(TFunction_Logbook& log) const } else { - gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(aFace); + gp_Ax3 aPos = GEOMUtils::GetPosition(aFace); p1 = aPos.Location(); } diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 400c2a03c..530d38012 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -19,11 +19,8 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -#include - #include -#include #include #include #include @@ -31,8 +28,11 @@ #include #include #include + #include +#include + #include #include #include @@ -2491,7 +2491,7 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True); } - TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); + TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape); aFunction->SetValue(aRes); log.SetTouched(Label()); diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx index 025042282..f28ff1f27 100644 --- a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx @@ -15,20 +15,20 @@ // 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 -#include -#include -#include "GEOMAlgo_FinderShapeOn1.hxx" -#include "GEOMAlgo_FinderShapeOn2.hxx" +#include +#include + +#include + +#include +#include #include #include @@ -106,7 +106,7 @@ GEOMImpl_PipeTShapeDriver::GetShapesOnBoxIDs(const TopoDS_Shape& aBox, Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; // Check presence of triangulation, build if need - if (!GEOMImpl_IShapesOperations::CheckTriangulation(aShape)) { + if (!GEOMUtils::CheckTriangulation(aShape)) { StdFail_NotDone::Raise("Cannot build triangulation on the shape"); return aSeqOfIDs; } @@ -179,7 +179,7 @@ Handle(TColStd_HSequenceOfInteger) Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; // Check presence of triangulation, build if need - if (!GEOMImpl_IShapesOperations::CheckTriangulation(theShape)) { + if (!GEOMUtils::CheckTriangulation(theShape)) { StdFail_NotDone::Raise("Cannot build triangulation on the shape"); return aSeqOfIDs; } diff --git a/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx index e1968567b..8fc83e24e 100644 --- a/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx @@ -18,7 +18,6 @@ // 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 @@ -27,7 +26,7 @@ #include #include -#include +#include #include @@ -142,7 +141,7 @@ Standard_Integer GEOMImpl_PlaneDriver::Execute(TFunction_Logbook& log) const // Standard_TypeMismatch::Raise("Plane creation aborted: non-planar face given as argument"); //} //aShape = BRepBuilderAPI_MakeFace(aGS, -aSize, +aSize, -aSize, +aSize).Shape(); - gp_Ax3 anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aRefShape); + gp_Ax3 anAx3 = GEOMUtils::GetPosition(aRefShape); gp_Pln aPln (anAx3); aShape = BRepBuilderAPI_MakeFace(aPln, -aSize, +aSize, -aSize, +aSize).Shape(); } @@ -223,7 +222,7 @@ Standard_Integer GEOMImpl_PlaneDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aRefShape = aRef->GetValue(); if (aRefShape.ShapeType() != TopAbs_FACE) return 0; - anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aRefShape); + anAx3 = GEOMUtils::GetPosition(aRefShape); } if ( anOrientation == 2) diff --git a/src/GEOMImpl/GEOMImpl_PositionDriver.cxx b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx index be11e7dbb..73aed0fa2 100644 --- a/src/GEOMImpl/GEOMImpl_PositionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx @@ -18,16 +18,15 @@ // 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 -#include +#include // OCCT Includes #include @@ -117,10 +116,10 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const gp_Ax3 aStartAx3, aDestAx3; // End LCS - aDestAx3 = GEOMImpl_IMeasureOperations::GetPosition(aShapeEndLCS); + aDestAx3 = GEOMUtils::GetPosition(aShapeEndLCS); // Start LCS - aStartAx3 = GEOMImpl_IMeasureOperations::GetPosition(aShapeStartLCS); + aStartAx3 = GEOMUtils::GetPosition(aShapeStartLCS); // Set transformation aTrsf.SetDisplacement(aStartAx3, aDestAx3); @@ -145,7 +144,7 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const gp_Ax3 aStartAx3, aDestAx3; // End LCS - aDestAx3 = GEOMImpl_IMeasureOperations::GetPosition(aShapeEndLCS); + aDestAx3 = GEOMUtils::GetPosition(aShapeEndLCS); // Set transformation aTrsf.SetDisplacement(aStartAx3, aDestAx3); diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx index 87b18275d..ae25ae0b8 100644 --- a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx @@ -18,17 +18,18 @@ // 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 #include #include + #include +#include + +#include #include #include @@ -249,7 +250,7 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const } else { - TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); + TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape); aFunction->SetValue(aRes); } @@ -275,7 +276,7 @@ TopoDS_Shape GEOMImpl_PrismDriver::MakeScaledPrism (const TopoDS_Shape& theShape // 1. aCDG = geompy.MakeCDG(theBase) gp_Pnt aCDG = theCDG; if (!isCDG) { - gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(theShapeBase); + gp_Ax3 aPos = GEOMUtils::GetPosition(theShapeBase); aCDG = aPos.Location(); } TopoDS_Shape aShapeCDG_1 = BRepBuilderAPI_MakeVertex(aCDG).Shape(); diff --git a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx index ea72dd7c3..44e68d973 100644 --- a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx @@ -18,17 +18,18 @@ // 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 + #include +#include + #include #include #include @@ -128,7 +129,7 @@ Standard_Integer GEOMImpl_RevolutionDriver::Execute(TFunction_Logbook& log) cons if (aShape.IsNull()) return 0; - TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); + TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape); aFunction->SetValue(aRes); log.SetTouched(Label()); diff --git a/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx index 70e627719..0ebe757d0 100644 --- a/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx @@ -18,7 +18,6 @@ // 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 @@ -27,7 +26,7 @@ #include #include -#include +#include #include @@ -117,7 +116,7 @@ Standard_Integer GEOMImpl_SketcherDriver::Execute(TFunction_Logbook& log) const // return 0; //Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast( aGS ); //aWPlane = aGPlane->Pln().Position(); - aWPlane = GEOMImpl_IMeasureOperations::GetPosition(aShape); + aWPlane = GEOMUtils::GetPosition(aShape); } gp_Trsf aTrans; aTrans.SetTransformation(aWPlane); diff --git a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx index c87cdbc09..a94f0a279 100644 --- a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx @@ -18,14 +18,14 @@ // 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 +#include #include #include @@ -49,6 +49,10 @@ #include #include +#include + +#include + //======================================================================= //function : GetID //purpose : @@ -82,54 +86,73 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; - if (aType == SPLINE_BEZIER || aType == SPLINE_INTERPOLATION) { + if (aType == SPLINE_BEZIER || + aType == SPLINE_INTERPOLATION || + aType == SPLINE_INTERPOL_TANGENTS) { bool useCoords = aCI.GetConstructorType() == COORD_CONSTRUCTOR; - TColgp_Array1OfPnt points(1, (useCoords ? aCI.GetLength() : 1) ); - if(useCoords) { - Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates(); + + Handle(TColStd_HArray1OfReal) aCoordsArray; // parametric case + Handle(TColStd_HSequenceOfTransient) aPoints; // points case + + int aLen = 0; + if (useCoords) { + aCoordsArray = aCI.GetCoordinates(); + aLen = aCoordsArray->Length() / 3; + } + else { + aPoints = aCI.GetPoints(); + aLen = aPoints->Length(); + } + + if (aLen < 2) return 0; + + TColgp_Array1OfPnt points (1, (useCoords ? aLen : 1)); + if (useCoords) { int anArrayLength = aCoordsArray->Length(); for (int i = 0, j = 1; i <= (anArrayLength-3); i += 3) { gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3)); - points.SetValue(j,aPnt); + points.SetValue(j, aPnt); j++; - } + } } - - int ind, aLen = aCI.GetLength(); - if (aLen < 2) return 0; - Standard_Boolean isSeveral = Standard_False; - gp_Pnt aPrevP; int aRealLen = aLen; + if (aType == SPLINE_BEZIER && aCI.GetIsClosed()) { TopoDS_Vertex aV1; - if(useCoords) { + if (useCoords) { aV1 = BRepBuilderAPI_MakeVertex(points.Value(1)); - } else { - Handle(GEOM_Function) aFPoint = aCI.GetPoint(1); + } + else { + Handle(GEOM_Function) aFPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(1)); TopoDS_Shape aFirstPnt = aFPoint->GetValue(); aV1 = TopoDS::Vertex(aFirstPnt); } TopoDS_Vertex aV2; - if(useCoords) { + if (useCoords) { aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen)); - } else { - Handle(GEOM_Function) aLPoint = aCI.GetPoint(aLen); + } + else { + Handle(GEOM_Function) aLPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(aLen)); TopoDS_Shape aLastPnt = aLPoint->GetValue(); aV2 = TopoDS::Vertex(aLastPnt); } - + if (!aV1.IsNull() && !aV2.IsNull() && !aV1.IsSame(aV2)) { aRealLen++; } } - + + int ind; + Standard_Boolean isSeveral = Standard_False; + gp_Pnt aPrevP; + TColgp_Array1OfPnt CurvePoints (1, aRealLen); for (ind = 1; ind <= aLen; ind++) { gp_Pnt aP; - if( useCoords ) { + if (useCoords) { aP = points.Value(ind); if (!isSeveral && ind > 1) { if (aP.Distance(aPrevP) > Precision::Confusion()) { @@ -138,8 +161,9 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const } CurvePoints.SetValue(ind, aP); aPrevP = aP; - } else { - Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind); + } + else { + Handle(GEOM_Function) aRefPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(ind)); TopoDS_Shape aShapePnt = aRefPoint->GetValue(); if (aShapePnt.ShapeType() == TopAbs_VERTEX) { aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); @@ -153,6 +177,7 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const } } } + if (aType == SPLINE_BEZIER) { if (!isSeveral) { Standard_ConstructionError::Raise("Points for Bezier Curve are too close"); @@ -160,13 +185,12 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const if (aRealLen > aLen) { // set last point equal to first for the closed curve CurvePoints.SetValue(aRealLen, CurvePoints.Value(1)); } - Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(CurvePoints); + Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve (CurvePoints); aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); - } else { + } + else { //GeomAPI_PointsToBSpline GBC (CurvePoints); //aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); - - Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt(1, aLen); if (aCI.GetDoReordering()) { for (int curInd = 1; curInd < aLen - 1; curInd++) { @@ -194,18 +218,35 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const CurvePoints.SetValue(curInd + 1, nearPnt); } } - for (ind = 1; ind <= aLen; ind++) { - aHCurvePoints->SetValue(ind, CurvePoints.Value(ind)); - } } - else { - for (ind = 1; ind <= aLen; ind++) { - aHCurvePoints->SetValue(ind, CurvePoints.Value(ind)); - } + + Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt (1, aLen); + for (ind = 1; ind <= aLen; ind++) { + aHCurvePoints->SetValue(ind, CurvePoints.Value(ind)); } - - bool isClosed = aCI.GetIsClosed(); + + bool isClosed = Standard_False; + if (aType == SPLINE_INTERPOLATION) + isClosed = aCI.GetIsClosed(); + GeomAPI_Interpolate GBC (aHCurvePoints, isClosed, gp::Resolution()); + + if (aType == SPLINE_INTERPOL_TANGENTS) { + Handle(GEOM_Function) aVec1Ref = aCI.GetFirstVector(); + Handle(GEOM_Function) aVec2Ref = aCI.GetLastVector(); + + if (aVec1Ref.IsNull() || aVec2Ref.IsNull()) + Standard_NullObject::Raise("Null object is given for a vector"); + + TopoDS_Shape aVec1Sh = aVec1Ref->GetValue(); + TopoDS_Shape aVec2Sh = aVec2Ref->GetValue(); + + gp_Vec aV1 = GEOMUtils::GetVector(aVec1Sh); + gp_Vec aV2 = GEOMUtils::GetVector(aVec2Sh); + + GBC.Load(aV1, aV2, /*Scale*/Standard_True); + } + GBC.Perform(); if (GBC.IsDone()) aShape = BRepBuilderAPI_MakeEdge(GBC.Curve()).Edge(); @@ -215,13 +256,13 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const } else { } - + if (aShape.IsNull()) return 0; - + aFunction->SetValue(aShape); - + log.SetTouched(Label()); - + return 1; } diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 4aeed6398..659158e28 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -234,8 +234,9 @@ #define POLYLINE_POINTS 1 -#define SPLINE_BEZIER 1 -#define SPLINE_INTERPOLATION 2 +#define SPLINE_BEZIER 1 +#define SPLINE_INTERPOLATION 2 +#define SPLINE_INTERPOL_TANGENTS 3 #define CIRCLE_THREE_PNT 1 #define CIRCLE_PNT_VEC_R 2 diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am index 8ce12ca2e..f456551ce 100644 --- a/src/GEOMImpl/Makefile.am +++ b/src/GEOMImpl/Makefile.am @@ -238,14 +238,18 @@ libGEOMimpl_la_CPPFLAGS = \ -I$(srcdir)/../NMTDS \ -I$(srcdir)/../NMTTools \ -I$(srcdir)/../GEOM \ + -I$(srcdir)/../BlockFix \ -I$(srcdir)/../GEOMAlgo \ + -I$(srcdir)/../GEOMUtils \ -I$(srcdir)/../SKETCHER \ -I$(srcdir)/../ARCHIMEDE \ -I$(top_builddir)/idl libGEOMimpl_la_LDFLAGS = \ ../GEOM/libGEOMbasic.la \ + ../BlockFix/libBlockFix.la \ ../GEOMAlgo/libGEOMAlgo.la \ + ../GEOMUtils/libGEOMUtils.la \ ../ShHealOper/libShHealOper.la \ ../ARCHIMEDE/libGEOMArchimede.la \ ../SKETCHER/libGEOMSketcher.la \ diff --git a/src/GEOMUtils/GEOMUtils.cxx b/src/GEOMUtils/GEOMUtils.cxx new file mode 100644 index 000000000..292ab5c44 --- /dev/null +++ b/src/GEOMUtils/GEOMUtils.cxx @@ -0,0 +1,499 @@ +// Copyright (C) 2007-2012 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 +#include + +// OCCT Includes +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +#define STD_SORT_ALGO 1 + +//======================================================================= +//function : GetPosition +//purpose : +//======================================================================= +gp_Ax3 GEOMUtils::GetPosition (const TopoDS_Shape& theShape) +{ + gp_Ax3 aResult; + + if (theShape.IsNull()) + return aResult; + + // Axes + aResult.Transform(theShape.Location().Transformation()); + if (theShape.ShapeType() == TopAbs_FACE) { + Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(theShape)); + if (!aGS.IsNull() && aGS->IsKind(STANDARD_TYPE(Geom_Plane))) { + Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS); + gp_Pln aPln = aGPlane->Pln(); + aResult = aPln.Position(); + // In case of reverse orinetation of the face invert the plane normal + // (the face's normal does not mathc the plane's normal in this case) + if(theShape.Orientation() == TopAbs_REVERSED) + { + gp_Dir Vx = aResult.XDirection(); + gp_Dir N = aResult.Direction().Mirrored(Vx); + gp_Pnt P = aResult.Location(); + aResult = gp_Ax3(P, N, Vx); + } + } + } + + // Origin + gp_Pnt aPnt; + + TopAbs_ShapeEnum aShType = theShape.ShapeType(); + + if (aShType == TopAbs_VERTEX) { + aPnt = BRep_Tool::Pnt(TopoDS::Vertex(theShape)); + } + else { + if (aShType == TopAbs_COMPOUND) { + aShType = GetTypeOfSimplePart(theShape); + } + + GProp_GProps aSystem; + if (aShType == TopAbs_EDGE || aShType == TopAbs_WIRE) + BRepGProp::LinearProperties(theShape, aSystem); + else if (aShType == TopAbs_FACE || aShType == TopAbs_SHELL) + BRepGProp::SurfaceProperties(theShape, aSystem); + else + BRepGProp::VolumeProperties(theShape, aSystem); + + aPnt = aSystem.CentreOfMass(); + } + + aResult.SetLocation(aPnt); + + return aResult; +} + +//======================================================================= +//function : GetVector +//purpose : +//======================================================================= +gp_Vec GEOMUtils::GetVector (const TopoDS_Shape& theShape) +{ + if (theShape.IsNull()) + Standard_NullObject::Raise("Null shape is given for a vector"); + + if (theShape.ShapeType() != TopAbs_EDGE) + Standard_TypeMismatch::Raise("Invalid shape is given, must be a vector or an edge"); + + TopoDS_Edge anE = TopoDS::Edge(theShape); + + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + + if (V1.IsNull() || V2.IsNull()) + Standard_NullObject::Raise("Invalid edge is given, it must have two points"); + + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + if (aV.Magnitude() < gp::Resolution()) { + Standard_ConstructionError::Raise("Vector of zero length is given"); + } + + return aV; +} + +//======================================================================= +//function : ShapeToDouble +//purpose : used by CompareShapes::operator() +//======================================================================= +std::pair ShapeToDouble (const TopoDS_Shape& S, bool isOldSorting) +{ + // Computing of CentreOfMass + gp_Pnt GPoint; + double Len; + + if (S.ShapeType() == TopAbs_VERTEX) { + GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S)); + Len = (double)S.Orientation(); + } + else { + GProp_GProps GPr; + // BEGIN: fix for Mantis issue 0020842 + if (isOldSorting) { + BRepGProp::LinearProperties(S, GPr); + } + else { + if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) { + BRepGProp::LinearProperties(S, GPr); + } + else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(S, GPr); + } + else { + BRepGProp::VolumeProperties(S, GPr); + } + } + // END: fix for Mantis issue 0020842 + GPoint = GPr.CentreOfMass(); + Len = GPr.Mass(); + } + + double dMidXYZ = GPoint.X() * 999.0 + GPoint.Y() * 99.0 + GPoint.Z() * 0.9; + return std::make_pair(dMidXYZ, Len); +} + +//======================================================================= +//function : CompareShapes::operator() +//purpose : used by std::sort(), called from SortShapes() +//======================================================================= +bool GEOMUtils::CompareShapes::operator() (const TopoDS_Shape& theShape1, + const TopoDS_Shape& theShape2) +{ + if (!myMap.IsBound(theShape1)) { + myMap.Bind(theShape1, ShapeToDouble(theShape1, myIsOldSorting)); + } + + if (!myMap.IsBound(theShape2)) { + myMap.Bind(theShape2, ShapeToDouble(theShape2, myIsOldSorting)); + } + + std::pair val1 = myMap.Find(theShape1); + std::pair val2 = myMap.Find(theShape2); + + double tol = Precision::Confusion(); + bool exchange = Standard_False; + + double dMidXYZ = val1.first - val2.first; + if (dMidXYZ >= tol) { + exchange = Standard_True; + } + else if (Abs(dMidXYZ) < tol) { + double dLength = val1.second - val2.second; + if (dLength >= tol) { + exchange = Standard_True; + } + else if (Abs(dLength) < tol && theShape1.ShapeType() <= TopAbs_FACE) { + // PAL17233 + // equal values possible on shapes such as two halves of a sphere and + // a membrane inside the sphere + Bnd_Box box1,box2; + BRepBndLib::Add(theShape1, box1); + if (!box1.IsVoid()) { + BRepBndLib::Add(theShape2, box2); + Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent(); + if (dSquareExtent >= tol) { + exchange = Standard_True; + } + else if (Abs(dSquareExtent) < tol) { + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, val1, val2; + box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + val1 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9; + box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + val2 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9; + if ((val1 - val2) >= tol) { + exchange = Standard_True; + } + } + } + } + } + + //return val1 < val2; + return !exchange; +} + +//======================================================================= +//function : SortShapes +//purpose : +//======================================================================= +void GEOMUtils::SortShapes (TopTools_ListOfShape& SL, + const Standard_Boolean isOldSorting) +{ +#ifdef STD_SORT_ALGO + std::vector aShapesVec; + aShapesVec.reserve(SL.Extent()); + + TopTools_ListIteratorOfListOfShape it (SL); + for (; it.More(); it.Next()) { + aShapesVec.push_back(it.Value()); + } + SL.Clear(); + + CompareShapes shComp (isOldSorting); + std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp); + //std::sort(aShapesVec.begin(), aShapesVec.end(), shComp); + + std::vector::const_iterator anIter = aShapesVec.begin(); + for (; anIter != aShapesVec.end(); ++anIter) { + SL.Append(*anIter); + } +#else + // old implementation + Standard_Integer MaxShapes = SL.Extent(); + TopTools_Array1OfShape aShapes (1,MaxShapes); + TColStd_Array1OfInteger OrderInd(1,MaxShapes); + TColStd_Array1OfReal MidXYZ (1,MaxShapes); //X,Y,Z; + TColStd_Array1OfReal Length (1,MaxShapes); //X,Y,Z; + + // Computing of CentreOfMass + Standard_Integer Index; + GProp_GProps GPr; + gp_Pnt GPoint; + TopTools_ListIteratorOfListOfShape it(SL); + for (Index=1; it.More(); Index++) + { + TopoDS_Shape S = it.Value(); + SL.Remove( it ); // == it.Next() + aShapes(Index) = S; + OrderInd.SetValue (Index, Index); + if (S.ShapeType() == TopAbs_VERTEX) { + GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S )); + Length.SetValue( Index, (Standard_Real) S.Orientation()); + } + else { + // BEGIN: fix for Mantis issue 0020842 + if (isOldSorting) { + BRepGProp::LinearProperties (S, GPr); + } + else { + if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) { + BRepGProp::LinearProperties (S, GPr); + } + else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(S, GPr); + } + else { + BRepGProp::VolumeProperties(S, GPr); + } + } + // END: fix for Mantis issue 0020842 + GPoint = GPr.CentreOfMass(); + Length.SetValue(Index, GPr.Mass()); + } + MidXYZ.SetValue(Index, GPoint.X()*999.0 + GPoint.Y()*99.0 + GPoint.Z()*0.9); + //cout << Index << " L: " << Length(Index) << "CG: " << MidXYZ(Index) << endl; + } + + // Sorting + Standard_Integer aTemp; + Standard_Boolean exchange, Sort = Standard_True; + Standard_Real tol = Precision::Confusion(); + while (Sort) + { + Sort = Standard_False; + for (Index=1; Index < MaxShapes; Index++) + { + exchange = Standard_False; + Standard_Real dMidXYZ = MidXYZ(OrderInd(Index)) - MidXYZ(OrderInd(Index+1)); + Standard_Real dLength = Length(OrderInd(Index)) - Length(OrderInd(Index+1)); + if ( dMidXYZ >= tol ) { +// cout << "MidXYZ: " << MidXYZ(OrderInd(Index))<< " > " <= tol ) { +// cout << "Length: " << Length(OrderInd(Index))<< " > " <= tol ) { +// cout << "SquareExtent: " << box1.SquareExtent()<<" > "< val2; + if ((val1 - val2) >= tol) { + exchange = Standard_True; + } + //cout << "box: " << val1<<" > "< + +#include + +#include + +#include +#include + +#include + +inline Standard_Boolean IsEqual (const TopoDS_Shape& S1, const TopoDS_Shape& S2) +{ + return S1.IsSame(S2); +} + +class GEOMUtils { + + public: + /*! + * \brief Get Local Coordinate System, corresponding to the given shape. + * + * Origin of the LCS is situated at the shape's center of mass. + * Axes of the LCS are obtained from shape's location or, + * if the shape is a planar face, from position of its plane. + */ + Standard_EXPORT static gp_Ax3 GetPosition (const TopoDS_Shape& theShape); + + /*! + * \brief Get vector, defined by the given edge. + */ + Standard_EXPORT static gp_Vec GetVector (const TopoDS_Shape& theShape); + + /*! + * \brief Sort shapes in the list by their coordinates. + * \param SL The list of shapes to sort. + */ + struct CompareShapes : public std::binary_function + { + CompareShapes (bool isOldSorting) + : myIsOldSorting(isOldSorting) {} + + bool operator() (const TopoDS_Shape& lhs, const TopoDS_Shape& rhs); + + typedef NCollection_DataMap > GEOMUtils_DataMapOfShapeDouble; + GEOMUtils_DataMapOfShapeDouble myMap; + bool myIsOldSorting; + }; + + /*! + * \brief Sort shapes by their centers of mass, using formula X*999 + Y*99 + Z*0.9 + */ + Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL, + const Standard_Boolean isOldSorting = Standard_True); + + /*! + * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND. + * + * If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is. + * + * \param theCompsolid The compsolid to be converted. + * \retval TopoDS_Shape Returns the resulting compound. + */ + Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid); + + /*! + * \brief Build a triangulation on \a theShape if it is absent. + * \param theShape The shape to check/build triangulation on. + * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation. + */ + Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape); + + /*! + * \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape. + * \param theShape The shape to get type of. + * \retval TopAbs_ShapeEnum Return type of shape for explode. + */ + Standard_EXPORT static TopAbs_ShapeEnum GetTypeOfSimplePart (const TopoDS_Shape& theShape); + +}; + +#endif diff --git a/src/GEOMUtils/Makefile.am b/src/GEOMUtils/Makefile.am new file mode 100644 index 000000000..844ac94f2 --- /dev/null +++ b/src/GEOMUtils/Makefile.am @@ -0,0 +1,57 @@ +# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +# +# 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 + +# GEOMUtils : implementaion of some common methods for GEOMImpl package +# File : Makefile.am +# Author : Julia DOROVSKIKH + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# Libraries targets +lib_LTLIBRARIES = libGEOMUtils.la + +# header files +salomeinclude_HEADERS = \ + GEOMUtils.hxx + +dist_libGEOMUtils_la_SOURCES = \ + GEOMUtils.cxx + +# additional information to compile and link file + +libGEOMUtils_la_CPPFLAGS = \ + $(CAS_CPPFLAGS) \ + $(KERNEL_CXXFLAGS) \ + $(BOOST_CPPFLAGS) \ + -I$(srcdir)/../ShHealOper \ + -I$(srcdir)/../NMTDS \ + -I$(srcdir)/../NMTTools \ + -I$(srcdir)/../BlockFix \ + -I$(srcdir)/../GEOMAlgo \ + -I$(srcdir)/../SKETCHER \ + -I$(srcdir)/../ARCHIMEDE + +libGEOMUtils_la_LDFLAGS = \ + ../BlockFix/libBlockFix.la \ + ../GEOMAlgo/libGEOMAlgo.la \ + ../ShHealOper/libShHealOper.la \ + ../ARCHIMEDE/libGEOMArchimede.la \ + ../SKETCHER/libGEOMSketcher.la \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \ + $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lTKFeat \ + $(STDLIB) diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc index 3f1a67800..88e381681 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc @@ -427,6 +427,46 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation return GetObject(anObject); } +//============================================================================= +/*! + * MakeSplineInterpolWithTangents + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolWithTangents + (const GEOM::ListOfGO& thePoints, + GEOM::GEOM_Object_ptr theFirstVec, + GEOM::GEOM_Object_ptr theLastVec) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference points + int ind = 0; + int aLen = thePoints.length(); + std::list aPoints; + for (; ind < aLen; ind++) { + Handle(GEOM_Object) aPnt = GetObjectImpl(thePoints[ind]); + if (aPnt.IsNull()) return aGEOMObject._retn(); + aPoints.push_back(aPnt); + } + + //Get the reference vectors + Handle(GEOM_Object) aVec1 = GetObjectImpl(theFirstVec); + Handle(GEOM_Object) aVec2 = GetObjectImpl(theLastVec); + + if (aVec1.IsNull() || aVec2.IsNull()) return aGEOMObject._retn(); + + // Make Polyline + Handle(GEOM_Object) anObject = + GetOperations()->MakeSplineInterpolWithTangents(aPoints, aVec1, aVec2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeCurveParametric diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.hh b/src/GEOM_I/GEOM_ICurvesOperations_i.hh index e50ab2111..07f4ce2a0 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.hh +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.hh @@ -85,6 +85,10 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i : CORBA::Boolean theIsClosed, CORBA::Boolean theDoReordering); + GEOM::GEOM_Object_ptr MakeSplineInterpolWithTangents (const GEOM::ListOfGO& thePoints, + GEOM::GEOM_Object_ptr theFirstVec, + GEOM::GEOM_Object_ptr theLastVec); + GEOM::GEOM_Object_ptr MakeCurveParametric (const char* thexExpr, const char* theyExpr, const char* thezExpr, double theParamMin, double theParamMax, double theParamStep, diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py index 3b9381772..4eb309e4c 100644 --- a/src/GEOM_SWIG/GEOM_TestAll.py +++ b/src/GEOM_SWIG/GEOM_TestAll.py @@ -102,6 +102,8 @@ def TestAll (geompy, math): Polyline = geompy.MakePolyline([p0, pz, py, p200]) #(List of GEOM_Object)->GEOM_Object Bezier = geompy.MakeBezier([p0, pz, p200, px]) #(List of GEOM_Object)->GEOM_Object Interpol = geompy.MakeInterpol([px, py, p200, pxyz], True) #(List of GEOM_Object,Boolean)->GEOM_Object + InterpT1 = geompy.MakeInterpolWithTangents([px, py, pxyz], vx, vz) #(List of GO, GO, GO)->GEOM_Object + InterpT2 = geompy.MakeInterpolWithTangents([px, py, pxyz], vxy, vxyz) #(List of GO, GO, GO)->GEOM_Object Sketcher = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW", [100,0,0, 1,1,1, -1,1,0]) #(String, List of Doubles)->GEOM_Object @@ -343,6 +345,8 @@ def TestAll (geompy, math): id_Polyline = geompy.addToStudy(Polyline, "Polyline") id_Bezier = geompy.addToStudy(Bezier, "Bezier") id_Interpol = geompy.addToStudy(Interpol, "Interpol") + id_InterpT1 = geompy.addToStudy(InterpT1, "InterpT1") + id_InterpT2 = geompy.addToStudy(InterpT2, "InterpT2") id_Sketcher = geompy.addToStudy(Sketcher, "Sketcher") id_Sketcher3d_1 = geompy.addToStudy(Sketcher3d_1, "Sketcher 3D by interface") diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 40a7dd53a..f5ad127fc 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -1579,9 +1579,32 @@ class geompyDC(GEOM._objref_GEOM_Gen): """ # Example: see GEOM_TestAll.py anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering) - RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp) + RaiseIfFailed("MakeInterpol", self.CurvesOp) return anObj + ## Create B-Spline curve on the set of points. + # @param thePoints Sequence of points for the B-Spline curve. + # @param theFirstVec Vector object, defining the curve direction at its first point. + # @param theLastVec Vector object, defining the curve direction at its last point. + # @return New GEOM.GEOM_Object, containing the created B-Spline curve. + # + # @ref tui_creation_curve "Example" + def MakeInterpolWithTangents(self, thePoints, theFirstVec, theLastVec): + """ + Create B-Spline curve on the set of points. + + Parameters: + thePoints Sequence of points for the B-Spline curve. + theFirstVec Vector object, defining the curve direction at its first point. + theLastVec Vector object, defining the curve direction at its last point. + + Returns: + New GEOM.GEOM_Object, containing the created B-Spline curve. + """ + # Example: see GEOM_TestAll.py + anObj = self.CurvesOp.MakeSplineInterpolWithTangents(thePoints, theFirstVec, theLastVec) + RaiseIfFailed("MakeInterpolWithTangents", self.CurvesOp) + return anObj ## Creates a curve using the parametric definition of the basic points. # @param thexExpr parametric equation of the coordinates X. @@ -1622,8 +1645,6 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp) anObj.SetParameters(Parameters) return anObj - - # end of l4_curves ## @} diff --git a/src/Makefile.am b/src/Makefile.am index 862b90287..e81e3bfd9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,15 +15,14 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : src (source files directory) -SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER OCC2VTK GEOM \ - BREPExport BREPImport IGESExport IGESImport STEPExport \ - STEPImport STLExport VTKExport ShHealOper GEOMImpl GEOM_I \ +SUBDIRS = ARCHIMEDE NMTDS NMTTools BlockFix GEOMAlgo SKETCHER OCC2VTK GEOM \ + BREPExport BREPImport IGESExport IGESImport STEPExport STEPImport \ + STLExport VTKExport ShHealOper GEOMUtils GEOMImpl GEOM_I \ GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY if WITH_OPENCV @@ -31,18 +30,18 @@ if WITH_OPENCV endif if GEOM_ENABLE_GUI - SUBDIRS += OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase GEOMToolsGUI \ - DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI \ - BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI \ - GroupGUI BlocksGUI AdvancedGUI GEOM_SWIG_WITHIHM + SUBDIRS += OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase \ + GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \ + EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \ + RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI GEOM_SWIG_WITHIHM endif -DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo \ - SKETCHER OCC2VTK GEOM BREPExport \ - BREPImport IGESExport IGESImport STEPExport STEPImport STLExport \ - VTKExport ShHealOper GEOMImpl GEOM_I GEOMClient GEOM_I_Superv \ - GEOM_SWIG OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase \ +DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools BlockFix GEOMAlgo SKETCHER \ + OCC2VTK GEOM BREPExport BREPImport IGESExport IGESImport \ + STEPExport STEPImport STLExport VTKExport ShHealOper GEOMUtils \ + GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG OBJECT \ + DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase \ GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \ EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \ - RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI \ + RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI \ GEOM_SWIG_WITHIHM GEOM_PY ShapeRecognition