mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-24 16:30:35 +05:00
Mantis issue 0022227: Integration request: Building a surface from a cloud of points
This commit is contained in:
parent
5d641e7cef
commit
5f4c43d53a
1
doc/salome/gui/GEOM/input/creating_adv_obj.doc
Normal file
1
doc/salome/gui/GEOM/input/creating_adv_obj.doc
Normal file
@ -0,0 +1 @@
|
||||
<li>\subpage create_smoothingsurface_page</li>
|
26
doc/salome/gui/GEOM/input/creating_smoothingsurface.doc
Normal file
26
doc/salome/gui/GEOM/input/creating_smoothingsurface.doc
Normal file
@ -0,0 +1,26 @@
|
||||
/*!
|
||||
|
||||
\page create_smoothingsurface_page SmoothingSurface
|
||||
|
||||
To create a \b SmoothingSurface in the <b>Main Menu</b> select <b>New Entity - >
|
||||
Advanced - > SmoothingSurface </b>
|
||||
|
||||
Specify the parameters of the SmoothingSurface object creation in the opened dialog
|
||||
box and press "Apply" or "Apply & Close" button.
|
||||
Result of each operation will be a GEOM_Object.
|
||||
|
||||
<b>TUI Command:</b> <em>geompy.MakeSmoothingSurface(lPoints)</em>
|
||||
|
||||
<b>Arguments:</b>
|
||||
- \b lPoints - list of points
|
||||
|
||||
\image html smoothingsurface_dlg.png
|
||||
|
||||
Example:
|
||||
|
||||
\image html smoothingsurface.png
|
||||
|
||||
Our <b>TUI Scripts</b> provide you with useful examples of creation of
|
||||
\ref tui_creation_smoothingsurface "Advanced objects".
|
||||
|
||||
*/
|
@ -14,5 +14,23 @@
|
||||
<br><h2>Creation of DividedCylinder</h2>
|
||||
\tui_script{advanced_geom_objs_ex03.py}
|
||||
|
||||
\anchor tui_creation_smoothingsurface
|
||||
<br><h2>Creation of SmoothingSurface</h2>
|
||||
|
||||
\code
|
||||
import geompy
|
||||
import salome
|
||||
gg = salome.ImportComponentGUI("GEOM")
|
||||
|
||||
# create SmoothingSurface object
|
||||
smoothingsurface = geompy.MakeSmoothingSurface([value])
|
||||
|
||||
# add object in the study
|
||||
id_smoothingsurface = geompy.addToStudy(smoothingsurface,"SmoothingSurface")
|
||||
|
||||
# display smoothingsurface
|
||||
gg.createAndDisplayGO(id_smoothingsurface)
|
||||
\endcode
|
||||
|
||||
<!--@@ insert new functions before this line @@ do not remove this line @@-->
|
||||
*/
|
||||
|
@ -4395,6 +4395,14 @@ module GEOM
|
||||
in double theH,
|
||||
in pattern thePattern );
|
||||
|
||||
/*!
|
||||
*
|
||||
* Create a smoothing surface from a set of points
|
||||
* \param thelPoints list of points
|
||||
* \return New GEOM_Object, containing the created shape.
|
||||
*/
|
||||
GEOM_Object MakeSmoothingSurface (in ListOfGO thelPoints);
|
||||
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@*/
|
||||
};
|
||||
|
||||
|
@ -623,6 +623,8 @@ module GEOM
|
||||
GEOM_Object MakeDividedCylinder (in double theR, in double theH,
|
||||
in pattern thePattern);
|
||||
|
||||
GEOM_Object MakeSmoothingSurface (in GEOM_List thelPoints);
|
||||
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@*/
|
||||
};
|
||||
};
|
||||
|
@ -5279,6 +5279,28 @@
|
||||
</outParameter-list>
|
||||
<DataStream-list></DataStream-list>
|
||||
</component-service>
|
||||
<component-service>
|
||||
<service-name>MakeSmoothingSurface</service-name>
|
||||
<service-author></service-author>
|
||||
<service-version></service-version>
|
||||
<service-comment>unknown</service-comment>
|
||||
<service-by-default>0</service-by-default>
|
||||
<inParameter-list>
|
||||
<inParameter>
|
||||
<inParameter-name>thelPoints</inParameter-name>
|
||||
<inParameter-type>double</inParameter-type>
|
||||
<inParameter-comment>list of points</inParameter-comment>
|
||||
</inParameter>
|
||||
</inParameter-list>
|
||||
<outParameter-list>
|
||||
<outParameter>
|
||||
<outParameter-name>return</outParameter-name>
|
||||
<outParameter-type>GEOM_Object</outParameter-type>
|
||||
<outParameter-comment>Result object</outParameter-comment>
|
||||
</outParameter>
|
||||
</outParameter-list>
|
||||
<DataStream-list></DataStream-list>
|
||||
</component-service>
|
||||
<!-- @@ insert new functions before this line @@ do not remove this line @@ -->
|
||||
</component-service-list>
|
||||
</component-interface-list>
|
||||
|
@ -258,6 +258,7 @@ ADVANCED_RESOURCES += dlg_pipetshapefilletrf.png
|
||||
# ADVANCED_RESOURCES += divideddisk.png divideddisk_r_ratio.png tree_divideddisk.png
|
||||
ADVANCED_RESOURCES += dividedcylinder.png dividedcylinder_r_h.png
|
||||
# tree_dividedcylinder.png
|
||||
ADVANCED_RESOURCES += smoothingsurface.png smoothingsurface_lpoints.png tree_smoothingsurface.png
|
||||
##@@ insert new functions before this line @@ do not remove this line @@##
|
||||
|
||||
dist_salomeres_DATA += $(ADVANCED_RESOURCES)
|
||||
|
BIN
resources/smoothingsurface.png
Normal file
BIN
resources/smoothingsurface.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/smoothingsurface_lpoints.png
Normal file
BIN
resources/smoothingsurface_lpoints.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
resources/tree_smoothingsurface.png
Normal file
BIN
resources/tree_smoothingsurface.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -31,6 +31,7 @@
|
||||
#include "AdvancedGUI_PipeTShapeDlg.h"
|
||||
#include "AdvancedGUI_DividedDiskDlg.h"
|
||||
#include "AdvancedGUI_DividedCylinderDlg.h"
|
||||
#include "AdvancedGUI_SmoothingSurfaceDlg.h"
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
|
||||
|
||||
#include <QDialog>
|
||||
@ -77,6 +78,9 @@ bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
||||
case GEOMOp::OpDividedCylinder:
|
||||
aDlg = new AdvancedGUI_DividedCylinderDlg( getGeometryGUI(), parent );
|
||||
break;
|
||||
case GEOMOp::OpSmoothingSurface:
|
||||
aDlg = new AdvancedGUI_SmoothingSurfaceDlg( getGeometryGUI(), parent );
|
||||
break;
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
|
||||
default:
|
||||
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
|
||||
|
264
src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx
Normal file
264
src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx
Normal file
@ -0,0 +1,264 @@
|
||||
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
|
||||
#include "AdvancedGUI_SmoothingSurfaceDlg.h"
|
||||
|
||||
#include <DlgRef.h>
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
//=================================================================================
|
||||
// Constructor
|
||||
//=================================================================================
|
||||
AdvancedGUI_SmoothingSurfaceDlg::AdvancedGUI_SmoothingSurfaceDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, false)
|
||||
{
|
||||
QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SMOOTHINGSURFACE_LPOINTS")));
|
||||
QPixmap imageSel (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
|
||||
setWindowTitle(tr("GEOM_SMOOTHINGSURFACE_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_SMOOTHINGSURFACE"));
|
||||
mainFrame()->RadioButton1->setIcon(imageOp);
|
||||
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton2->close();
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
GroupPoints = new DlgRef_1Sel( centralWidget() );
|
||||
|
||||
GroupPoints->GroupBox1->setTitle( tr( "GEOM_SMOOTHINGSURFACE_ARG" ) );
|
||||
GroupPoints->TextLabel1->setText( tr( "GEOM_SMOOTHINGSURFACE_ARG_POINTS" ) );
|
||||
GroupPoints->PushButton1->setIcon( image1 );
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupPoints);
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName("create_smoothingsurface_page.html");
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// Destructor
|
||||
//=================================================================================
|
||||
AdvancedGUI_SmoothingSurfaceDlg::~AdvancedGUI_SmoothingSurfaceDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void AdvancedGUI_SmoothingSurfaceDlg::Init()
|
||||
{
|
||||
// Get setting of step value from file configuration
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
||||
|
||||
//@@ initialize dialog box widgets here @@//
|
||||
|
||||
// Signal/slot connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
|
||||
this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
initName(tr("GEOM_SMOOTHINGSURFACE"));
|
||||
//displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void AdvancedGUI_SmoothingSurfaceDlg::ClickOnOk()
|
||||
{
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool AdvancedGUI_SmoothingSurfaceDlg::ClickOnApply()
|
||||
{
|
||||
if (!onAccept())
|
||||
return false;
|
||||
|
||||
initName();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void AdvancedGUI_SmoothingSurfaceDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
//displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent [REDEFINED]
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void AdvancedGUI_SmoothingSurfaceDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr AdvancedGUI_SmoothingSurfaceDlg::createOperation()
|
||||
{
|
||||
return getGeomEngine()->GetIAdvancedOperations(getStudyId());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool AdvancedGUI_SmoothingSurfaceDlg::isValid (QString& msg)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
//@@ add custom validation actions here @@//
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool AdvancedGUI_SmoothingSurfaceDlg::execute (ObjectList& objects)
|
||||
{
|
||||
bool res = false;
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
|
||||
|
||||
//@@ retrieve input values from the widgets here @@//
|
||||
GEOM::ListOfGO_var points = new GEOM::ListOfGO();
|
||||
points->length( myPoints.count() );
|
||||
for ( int i = 0; i < myPoints.count(); i++ )
|
||||
points[i] = myPoints[i].copy();
|
||||
|
||||
|
||||
// call engine function
|
||||
anObj = anOper->MakeSmoothingSurface(points);
|
||||
res = !anObj->_is_nil();
|
||||
if (res && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
//@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
|
||||
if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
|
||||
if (res)
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
//=================================================================================
|
||||
void AdvancedGUI_SmoothingSurfaceDlg::SelectionIntoArgument()
|
||||
{
|
||||
QList<GEOM::GeomObjPtr> 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( "" );
|
||||
processPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void AdvancedGUI_SmoothingSurfaceDlg::SetEditCurrentArgument()
|
||||
{
|
||||
if ( sender() == GroupPoints->PushButton1 )
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
void AdvancedGUI_SmoothingSurfaceDlg::synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right )
|
||||
{
|
||||
// 1. remove items from the "left" list that are not in the "right" list
|
||||
QMutableListIterator<GEOM::GeomObjPtr> it1( left );
|
||||
while ( it1.hasNext() ) {
|
||||
GEOM::GeomObjPtr o1 = it1.next();
|
||||
bool found = false;
|
||||
QMutableListIterator<GEOM::GeomObjPtr> it2( right );
|
||||
while ( it2.hasNext() && !found )
|
||||
found = o1 == it2.next();
|
||||
if ( !found )
|
||||
it1.remove();
|
||||
}
|
||||
// 2. add items from the "right" list that are not in the "left" list (to keep selection order)
|
||||
it1 = right;
|
||||
while ( it1.hasNext() ) {
|
||||
GEOM::GeomObjPtr o1 = it1.next();
|
||||
bool found = false;
|
||||
QMutableListIterator<GEOM::GeomObjPtr> it2( left );
|
||||
while ( it2.hasNext() && !found )
|
||||
found = o1 == it2.next();
|
||||
if ( !found )
|
||||
left << o1;
|
||||
}
|
||||
}
|
||||
|
73
src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h
Normal file
73
src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h
Normal file
@ -0,0 +1,73 @@
|
||||
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
|
||||
#ifndef ADVANCEDGUI_SMOOTHINGSURFACEDLG_H
|
||||
#define ADVANCEDGUI_SMOOTHINGSURFACEDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
class DlgRef_1Sel;
|
||||
|
||||
//=================================================================================
|
||||
// class : AdvancedGUI_SmoothingSurfaceDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class AdvancedGUI_SmoothingSurfaceDlg : public GEOMBase_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AdvancedGUI_SmoothingSurfaceDlg( GeometryGUI*, QWidget* = 0 );
|
||||
~AdvancedGUI_SmoothingSurfaceDlg();
|
||||
|
||||
protected:
|
||||
// redefined from GEOMBase_Helper
|
||||
virtual GEOM::GEOM_IOperations_ptr createOperation();
|
||||
virtual bool isValid( QString& );
|
||||
virtual bool execute( ObjectList& );
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent( QEvent* );
|
||||
void synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right );
|
||||
|
||||
private:
|
||||
DlgRef_1Sel* GroupPoints;
|
||||
QList<GEOM::GeomObjPtr> myPoints;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
|
||||
void ActivateThisDialog();
|
||||
void DeactivateActiveDialog();
|
||||
|
||||
void CheckButtonToggled();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
//void ValueChangedInSpinBox();
|
||||
//void SetDoubleSpinBoxStep( double );
|
||||
};
|
||||
|
||||
#endif // ADVANCEDGUI_SMOOTHINGSURFACEDLG_H
|
@ -30,6 +30,7 @@ ADVANCED_INCLUDES =
|
||||
ADVANCED_INCLUDES += AdvancedGUI_PipeTShapeDlg.h
|
||||
ADVANCED_INCLUDES += AdvancedGUI_DividedDiskDlg.h
|
||||
ADVANCED_INCLUDES += AdvancedGUI_DividedCylinderDlg.h
|
||||
ADVANCED_INCLUDES += AdvancedGUI_SmoothingSurfaceDlg.h
|
||||
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
|
||||
|
||||
salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
|
||||
@ -45,6 +46,7 @@ ADVANCED_SOURCES =
|
||||
ADVANCED_SOURCES += AdvancedGUI_PipeTShapeDlg.h AdvancedGUI_PipeTShapeDlg.cxx
|
||||
ADVANCED_SOURCES += AdvancedGUI_DividedDiskDlg.h AdvancedGUI_DividedDiskDlg.cxx
|
||||
ADVANCED_SOURCES += AdvancedGUI_DividedCylinderDlg.h AdvancedGUI_DividedCylinderDlg.cxx
|
||||
ADVANCED_SOURCES += AdvancedGUI_SmoothingSurfaceDlg.h AdvancedGUI_SmoothingSurfaceDlg.cxx
|
||||
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
|
||||
|
||||
dist_libAdvancedGUI_la_SOURCES += $(ADVANCED_SOURCES)
|
||||
@ -55,6 +57,7 @@ ADVANCED_MOC_FILES =
|
||||
ADVANCED_MOC_FILES += AdvancedGUI_PipeTShapeDlg_moc.cxx
|
||||
ADVANCED_MOC_FILES += AdvancedGUI_DividedDiskDlg_moc.cxx
|
||||
ADVANCED_MOC_FILES += AdvancedGUI_DividedCylinderDlg_moc.cxx
|
||||
ADVANCED_MOC_FILES += AdvancedGUI_SmoothingSurfaceDlg_moc.cxx
|
||||
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
|
||||
|
||||
MOC_FILES += $(ADVANCED_MOC_FILES)
|
||||
@ -86,4 +89,7 @@ libAdvancedGUI_la_CPPFLAGS = \
|
||||
|
||||
libAdvancedGUI_la_LDFLAGS = \
|
||||
../GEOMFiltersSelection/libGEOMFiltersSelection.la \
|
||||
../GEOMBase/libGEOMBase.la
|
||||
../GEOMBase/libGEOMBase.la \
|
||||
../GEOMGUI/libGEOM.la \
|
||||
$(CAS_LDFLAGS) -lTKGeomBase \
|
||||
$(GUI_LDFLAGS) -lsuit
|
||||
|
@ -1352,6 +1352,18 @@
|
||||
<source>ICON_OBJBROWSER_ADVANCED_203</source>
|
||||
<translation>dividedcylinder.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_SMOOTHINGSURFACE_LPOINTS</source>
|
||||
<translation>smoothingsurface_lpoints.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_SMOOTHINGSURFACE</source>
|
||||
<translation>smoothingsurface.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_OBJBROWSER_ADVANCED_204</source>
|
||||
<translation>tree_smoothingsurface.png</translation>
|
||||
</message>
|
||||
<!-- @@ insert new functions before this line @@ do not remove this line @@ -->
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -583,6 +583,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
|
||||
// case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
|
||||
case GEOMOp::OpDividedDisk: // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
|
||||
case GEOMOp::OpDividedCylinder: // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
|
||||
case GEOMOp::OpSmoothingSurface: // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
|
||||
libName = "AdvancedGUI";
|
||||
break;
|
||||
@ -908,6 +909,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
|
||||
createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" );
|
||||
createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" );
|
||||
createGeomAction( GEOMOp::OpSmoothingSurface, "SMOOTHINGSURFACE" );
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
|
||||
|
||||
// ---- create menus --------------------------
|
||||
@ -957,9 +959,9 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createMenu( GEOMOp::OpPipePath, genId, -1 );
|
||||
#endif
|
||||
|
||||
// int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
|
||||
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
|
||||
int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
|
||||
createMenu( GEOMOp::OpSmoothingSurface, advId, -1 );
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
|
||||
|
||||
createMenu( separator(), newEntId, -1 );
|
||||
|
||||
@ -1234,8 +1236,8 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createTool( GEOMOp::OpFeatureDetect, picturesTbId );
|
||||
#endif
|
||||
|
||||
// int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
|
||||
|
||||
int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
|
||||
createTool( GEOMOp::OpSmoothingSurface, advancedTbId );
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
|
||||
|
||||
// ---- create popup menus --------------------------
|
||||
|
@ -196,6 +196,7 @@ namespace GEOMOp {
|
||||
//OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
|
||||
OpDividedDisk = 10003, // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
|
||||
OpDividedCylinder = 10004, // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
|
||||
OpSmoothingSurface = 10005, // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE
|
||||
//@@ insert new functions before this line @@ do not remove this line @@//
|
||||
};
|
||||
}
|
||||
|
@ -86,6 +86,7 @@
|
||||
#include <GEOMImpl_PipeTShapeDriver.hxx>
|
||||
#include <GEOMImpl_DividedDiskDriver.hxx>
|
||||
// #include <GEOMImpl_DividedCylinderDriver.hxx>
|
||||
#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
|
||||
|
||||
//=============================================================================
|
||||
@ -172,6 +173,7 @@ GEOMImpl_Gen::GEOMImpl_Gen()
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), new GEOMImpl_PipeTShapeDriver());
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedDiskDriver::GetID(), new GEOMImpl_DividedDiskDriver());
|
||||
// TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedCylinderDriver::GetID(), new GEOMImpl_DividedCylinderDriver());
|
||||
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SmoothingSurfaceDriver::GetID(), new GEOMImpl_SmoothingSurfaceDriver());
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
|
||||
|
||||
SetEngine(this);
|
||||
|
@ -53,6 +53,8 @@
|
||||
#include "GEOMImpl_IDividedDisk.hxx"
|
||||
// #include "GEOMImpl_DividedCylinderDriver.hxx"
|
||||
// #include "GEOMImpl_IDividedCylinder.hxx"
|
||||
#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
|
||||
#include <GEOMImpl_ISmoothingSurface.hxx>
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
|
||||
|
||||
#include <TDF_Tool.hxx>
|
||||
@ -3400,4 +3402,71 @@ Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedCylinder (double th
|
||||
|
||||
return aShape;
|
||||
}
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Create a smoothing surface from a set of points
|
||||
* \param thelPoints list of points
|
||||
* \return New GEOM_Object, containing the created shape.
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
//Add a new object
|
||||
Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_SMOOTHINGSURFACE);
|
||||
|
||||
//Add a new shape function with parameters
|
||||
Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_SmoothingSurfaceDriver::GetID(), SMOOTHINGSURFACE_LPOINTS);
|
||||
if (aFunction.IsNull()) return NULL;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_SmoothingSurfaceDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_ISmoothingSurface aData (aFunction);
|
||||
|
||||
int aLen = thelPoints.size();
|
||||
aData.SetLength(aLen);
|
||||
int ind = 1;
|
||||
std::list<Handle(GEOM_Object)>::iterator it = thelPoints.begin();
|
||||
for (; it != thelPoints.end(); it++, ind++) {
|
||||
Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
|
||||
if (aRefPnt.IsNull()) {
|
||||
SetErrorCode("NULL point for bSplineFaceShape");
|
||||
return NULL;
|
||||
}
|
||||
aData.SetPoint(ind, aRefPnt);
|
||||
}
|
||||
|
||||
|
||||
//Compute the resulting value
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("SmoothingSurface 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 << aShape << " = geompy.MakeSmoothingSurface([";
|
||||
it = thelPoints.begin();
|
||||
pd << (*it++);
|
||||
while (it != thelPoints.end()) {
|
||||
pd << ", " << (*it++);
|
||||
}
|
||||
pd << "])";
|
||||
|
||||
SetErrorCode(OK);
|
||||
|
||||
return aShape;
|
||||
}
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "GEOM_Engine.hxx"
|
||||
#include "GEOM_Object.hxx"
|
||||
|
||||
#include <list>
|
||||
#include <gp_Ax2.hxx>
|
||||
|
||||
class GEOMImpl_IBasicOperations;
|
||||
@ -235,6 +236,7 @@ public:
|
||||
double theH,
|
||||
int thePattern);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints);
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@*/
|
||||
};
|
||||
#endif
|
||||
|
45
src/GEOMImpl/GEOMImpl_ISmoothingSurface.hxx
Normal file
45
src/GEOMImpl/GEOMImpl_ISmoothingSurface.hxx
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
|
||||
#ifndef _GEOMImpl_ISmoothingSurface_HXX_
|
||||
#define _GEOMImpl_ISmoothingSurface_HXX_
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#define SMOOTHINGSURFACE_ARG_LENG 1
|
||||
#define SMOOTHINGSURFACE_ARG_LAST 2
|
||||
|
||||
class GEOMImpl_ISmoothingSurface
|
||||
{
|
||||
public:
|
||||
GEOMImpl_ISmoothingSurface(Handle(GEOM_Function) theFunction): _func(theFunction) {}
|
||||
|
||||
void SetLength(int theLen) { _func->SetInteger(SMOOTHINGSURFACE_ARG_LENG, theLen); }
|
||||
int GetLength() { return _func->GetInteger(SMOOTHINGSURFACE_ARG_LENG); }
|
||||
|
||||
void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SMOOTHINGSURFACE_ARG_LAST + theId, theP); }
|
||||
Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SMOOTHINGSURFACE_ARG_LAST + theId); }
|
||||
|
||||
private:
|
||||
Handle(GEOM_Function) _func;
|
||||
};
|
||||
|
||||
#endif // _GEOMImpl_ISmoothingSurface_HXX_
|
233
src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx
Normal file
233
src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx
Normal file
@ -0,0 +1,233 @@
|
||||
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
|
||||
#include <GEOMImpl_ISmoothingSurface.hxx>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
#include <GEOM_Function.hxx>
|
||||
|
||||
#include <TFunction_Logbook.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
//@@ include required header files here @@//
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <TColgp_SequenceOfXY.hxx>
|
||||
#include <TColgp_SequenceOfXYZ.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
|
||||
#include <BRepAdaptor_HSurface.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepPrimAPI_MakeSphere.hxx>
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepAlgoAPI_Cut.hxx>
|
||||
|
||||
#include <GeomPlate_Surface.hxx>
|
||||
#include <GeomPlate_BuildPlateSurface.hxx>
|
||||
#include <GeomPlate_PointConstraint.hxx>
|
||||
#include <GeomPlate_MakeApprox.hxx>
|
||||
#include <GeomPlate_PlateG0Criterion.hxx>
|
||||
#include <GeomPlate_BuildAveragePlane.hxx>
|
||||
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
#include <GC_MakePlane.hxx>
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& GEOMImpl_SmoothingSurfaceDriver::GetID()
|
||||
{
|
||||
static Standard_GUID aGUID("1C3A0F30-729D-4E83-8232-78E74FC5637C");
|
||||
return aGUID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMImpl_SmoothingSurfaceDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMImpl_SmoothingSurfaceDriver::GEOMImpl_SmoothingSurfaceDriver()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeSmoothingSurfaceUnClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape GEOMImpl_SmoothingSurfaceDriver::MakeSmoothingSurfaceUnClosed(Handle_TColgp_HArray1OfPnt myListOfPoints) const
|
||||
{
|
||||
TopoDS_Face aInitShape;
|
||||
|
||||
// Create an average Plane
|
||||
//Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,myListOfPoints.Length())
|
||||
GeomPlate_BuildAveragePlane gpbap(myListOfPoints,myListOfPoints->Length(),Precision::Confusion(),1,1);
|
||||
Handle(Geom_Plane) plane(gpbap.Plane());
|
||||
Standard_Real Umin, Umax, Vmin, Vmax;
|
||||
gpbap.MinMaxBox(Umin,Umax,Vmin,Vmax);
|
||||
cout << "Vals : " << Umin << ", " << Umax << ", " << Vmin << ", " << Vmax << endl;
|
||||
BRepBuilderAPI_MakeFace mf(plane,Umin,Umax,Vmin,Vmax,Precision::Confusion());
|
||||
aInitShape = mf.Face();
|
||||
//return aInitShape;
|
||||
|
||||
GeomPlate_BuildPlateSurface aBuilder(3,10);
|
||||
// ** Initialization of surface
|
||||
Handle(BRepAdaptor_HSurface) HSI = new BRepAdaptor_HSurface();
|
||||
HSI->ChangeSurface().Initialize(aInitShape);
|
||||
aBuilder.LoadInitSurface( BRep_Tool::Surface(HSI->ChangeSurface().Face()));
|
||||
|
||||
Standard_Integer j, j1, j2;
|
||||
cout << "Init surface" << endl;
|
||||
j1 = myListOfPoints->Lower();
|
||||
j2 = myListOfPoints->Upper();
|
||||
for (j=j1; j<=j2 ; j++)
|
||||
{
|
||||
gp_Pnt aPnt = myListOfPoints->Value(j);
|
||||
Handle(GeomPlate_PointConstraint) PCont = new GeomPlate_PointConstraint(aPnt,0);
|
||||
aBuilder.Add(PCont);
|
||||
}
|
||||
cout << "avant Perform surface" << endl;
|
||||
aBuilder.Perform();
|
||||
cout << "Perform surface" << endl;
|
||||
|
||||
// A ce niveau : surface algo
|
||||
Handle(GeomPlate_Surface) gpPlate = aBuilder.Surface();
|
||||
|
||||
Standard_Integer nbcarreau=2;
|
||||
Standard_Integer degmax=8;
|
||||
Standard_Real seuil;
|
||||
seuil = Max(0.0001,10*aBuilder.G0Error());
|
||||
GeomPlate_MakeApprox Mapp(gpPlate,0.0001,nbcarreau,degmax,seuil);
|
||||
cout << "Approx surface" << endl;
|
||||
|
||||
Handle (Geom_Surface) Surf (Mapp.Surface());
|
||||
|
||||
aBuilder.Surface()->Bounds( Umin, Umax, Vmin, Vmax);
|
||||
|
||||
BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax, Precision::Confusion());
|
||||
TopoDS_Shape aShape = MF.Shape();
|
||||
|
||||
return aShape;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Execute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log) const
|
||||
{
|
||||
if (Label().IsNull()) return 0;
|
||||
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
||||
if (aFunction.IsNull()) return 0;
|
||||
|
||||
Standard_Integer aType = aFunction->GetType();
|
||||
|
||||
if (aType != SMOOTHINGSURFACE_LPOINTS) return 0;
|
||||
cout << "Youhou : " << aType << endl;
|
||||
|
||||
GEOMImpl_ISmoothingSurface aData (aFunction);
|
||||
|
||||
Standard_Integer nbPoints = aData.GetLength();
|
||||
|
||||
Handle(TColgp_HArray1OfPnt) anArrayofPnt = new TColgp_HArray1OfPnt(1,nbPoints);
|
||||
for (int ind=1;ind<=nbPoints;ind++)
|
||||
{
|
||||
Handle(GEOM_Function) aPoint = aData.GetPoint(ind);
|
||||
TopoDS_Shape aShapePnt = aPoint->GetValue();
|
||||
TopoDS_Vertex dsPoint;
|
||||
dsPoint = TopoDS::Vertex( aShapePnt );
|
||||
gp_Pnt aPnt = BRep_Tool::Pnt( dsPoint );
|
||||
anArrayofPnt->SetValue(ind,aPnt);
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape;
|
||||
aShape = GEOMImpl_SmoothingSurfaceDriver::MakeSmoothingSurfaceUnClosed(anArrayofPnt);
|
||||
|
||||
if (aShape.IsNull()) return 0;
|
||||
|
||||
aFunction->SetValue(aShape);
|
||||
|
||||
log.SetTouched(Label());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMImpl_SmoothingSurfaceDriver_Type_
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_EXPORT Handle_Standard_Type& GEOMImpl_SmoothingSurfaceDriver_Type_()
|
||||
{
|
||||
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
|
||||
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
|
||||
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
|
||||
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
|
||||
|
||||
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
|
||||
static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SmoothingSurfaceDriver",
|
||||
sizeof(GEOMImpl_SmoothingSurfaceDriver),
|
||||
1,
|
||||
(Standard_Address)_Ancestors,
|
||||
(Standard_Address)NULL);
|
||||
return _aType;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DownCast
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(GEOMImpl_SmoothingSurfaceDriver) Handle(GEOMImpl_SmoothingSurfaceDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
|
||||
{
|
||||
Handle(GEOMImpl_SmoothingSurfaceDriver) _anOtherObject;
|
||||
|
||||
if (!AnObject.IsNull()) {
|
||||
if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver))) {
|
||||
_anOtherObject = Handle(GEOMImpl_SmoothingSurfaceDriver)((Handle(GEOMImpl_SmoothingSurfaceDriver)&)AnObject);
|
||||
}
|
||||
}
|
||||
|
||||
return _anOtherObject;
|
||||
}
|
133
src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx
Normal file
133
src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx
Normal file
@ -0,0 +1,133 @@
|
||||
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
|
||||
#ifndef _GEOMImpl_SmoothingSurfaceDriver_HXX
|
||||
#define _GEOMImpl_SmoothingSurfaceDriver_HXX
|
||||
|
||||
#ifndef _TFunction_Driver_HeaderFile
|
||||
#include <TFunction_Driver.hxx>
|
||||
#endif
|
||||
#ifndef _TFunction_Logbook_HeaderFile
|
||||
#include <TFunction_Logbook.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_CString_HeaderFile
|
||||
#include <Standard_CString.hxx>
|
||||
#endif
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
class Handle_Standard_Type;
|
||||
class GEOMImpl_SmoothingSurfaceDriver;
|
||||
|
||||
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver);
|
||||
|
||||
class Handle(GEOMImpl_SmoothingSurfaceDriver) : public Handle(TFunction_Driver) {
|
||||
public:
|
||||
inline void* operator new(size_t,void* anAddress)
|
||||
{
|
||||
return anAddress;
|
||||
}
|
||||
inline void* operator new(size_t size)
|
||||
{
|
||||
return Standard::Allocate(size);
|
||||
}
|
||||
inline void operator delete(void *anAddress)
|
||||
{
|
||||
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||
}
|
||||
|
||||
Handle(GEOMImpl_SmoothingSurfaceDriver)():Handle(TFunction_Driver)() {}
|
||||
Handle(GEOMImpl_SmoothingSurfaceDriver)(const Handle(GEOMImpl_SmoothingSurfaceDriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
|
||||
{}
|
||||
|
||||
Handle(GEOMImpl_SmoothingSurfaceDriver)(const GEOMImpl_SmoothingSurfaceDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
|
||||
{}
|
||||
|
||||
Handle(GEOMImpl_SmoothingSurfaceDriver)& operator=(const Handle(GEOMImpl_SmoothingSurfaceDriver)& aHandle)
|
||||
{
|
||||
Assign(aHandle.Access());
|
||||
return *this;
|
||||
}
|
||||
|
||||
Handle(GEOMImpl_SmoothingSurfaceDriver)& operator=(const GEOMImpl_SmoothingSurfaceDriver* anItem)
|
||||
{
|
||||
Assign((Standard_Transient *)anItem);
|
||||
return *this;
|
||||
}
|
||||
|
||||
GEOMImpl_SmoothingSurfaceDriver* operator->()
|
||||
{
|
||||
return (GEOMImpl_SmoothingSurfaceDriver *)ControlAccess();
|
||||
}
|
||||
|
||||
GEOMImpl_SmoothingSurfaceDriver* operator->() const
|
||||
{
|
||||
return (GEOMImpl_SmoothingSurfaceDriver *)ControlAccess();
|
||||
}
|
||||
|
||||
Standard_EXPORT ~Handle(GEOMImpl_SmoothingSurfaceDriver)() {};
|
||||
|
||||
Standard_EXPORT static const Handle(GEOMImpl_SmoothingSurfaceDriver) DownCast(const Handle(Standard_Transient)& AnObject);
|
||||
};
|
||||
|
||||
class GEOMImpl_SmoothingSurfaceDriver : public TFunction_Driver {
|
||||
public:
|
||||
inline void* operator new(size_t,void* anAddress)
|
||||
{
|
||||
return anAddress;
|
||||
}
|
||||
inline void* operator new(size_t size)
|
||||
{
|
||||
return Standard::Allocate(size);
|
||||
}
|
||||
inline void operator delete(void *anAddress)
|
||||
{
|
||||
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||
}
|
||||
|
||||
// Methods PUBLIC
|
||||
//
|
||||
Standard_EXPORT GEOMImpl_SmoothingSurfaceDriver();
|
||||
Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
|
||||
Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
|
||||
Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
Standard_EXPORT ~GEOMImpl_SmoothingSurfaceDriver() {};
|
||||
|
||||
// Type management
|
||||
//
|
||||
Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_SmoothingSurfaceDriver_Type_();
|
||||
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
|
||||
{
|
||||
return STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver);
|
||||
}
|
||||
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
|
||||
{
|
||||
return (STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver) == AType || TFunction_Driver::IsKind(AType));
|
||||
}
|
||||
private:
|
||||
TopoDS_Shape MakeSmoothingSurfaceUnClosed(Handle_TColgp_HArray1OfPnt myListOfPoints) const;
|
||||
};
|
||||
|
||||
#endif // _GEOMImpl_SmoothingSurfaceDriver_HXX
|
@ -355,6 +355,7 @@
|
||||
#define GEOM_TSHAPE 201
|
||||
#define GEOM_DIVIDEDDISK 202
|
||||
#define GEOM_DIVIDEDCYLINDER 203
|
||||
#define GEOM_SMOOTHINGSURFACE 204
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
|
||||
// Advanced functions sub-operations codes
|
||||
#define TSHAPE_BASIC 1
|
||||
@ -363,4 +364,5 @@
|
||||
#define DIVIDEDDISK_R_RATIO 1
|
||||
#define DIVIDEDDISK_R_VECTOR_PNT 2
|
||||
#define DIVIDEDCYLINDER_R_H 1
|
||||
#define SMOOTHINGSURFACE_LPOINTS 1
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
|
||||
|
@ -72,3 +72,4 @@ FF1BBB69-5D14-4df2-980B-3A668264EA16 // Modify the Location
|
||||
FF1BBB70-5D14-4df2-980B-3A668264EA16 // Projection
|
||||
|
||||
1C3A0F3F-729D-4E83-8232-78E74FC5637C // Pipe T-Shape
|
||||
1C3A0F30-729D-4E83-8232-78E74FC5637C // Smoothing Surface
|
||||
|
@ -149,6 +149,7 @@ ADVANCED_INCLUDES =
|
||||
ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx
|
||||
ADVANCED_INCLUDES += GEOMImpl_IDividedDisk.hxx GEOMImpl_DividedDiskDriver.hxx
|
||||
##ADVANCED_INCLUDES += GEOMImpl_IDividedCylinder.hxx GEOMImpl_DividedCylinderDriver.hxx
|
||||
ADVANCED_INCLUDES += GEOMImpl_ISmoothingSurface.hxx GEOMImpl_SmoothingSurfaceDriver.hxx
|
||||
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
|
||||
|
||||
salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
|
||||
@ -222,6 +223,7 @@ ADVANCED_SOURCES =
|
||||
ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx
|
||||
ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx
|
||||
##ADVANCED_SOURCES += GEOMImpl_DividedCylinderDriver.cxx
|
||||
ADVANCED_SOURCES += GEOMImpl_SmoothingSurfaceDriver.cxx
|
||||
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
|
||||
|
||||
dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES)
|
||||
|
@ -751,4 +751,35 @@ GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedCylinder (CORBA::Do
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
* \param thelPoints list of points
|
||||
* \return New GEOM_Object, containing the created shape.
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference point
|
||||
int ind = 0;
|
||||
int aLen = thelPoints.length();
|
||||
std::list<Handle(GEOM_Object)> aPoints;
|
||||
for (; ind < aLen; ind++) {
|
||||
Handle(GEOM_Object) aPnt = GetObjectImpl(thelPoints[ind]);
|
||||
if (aPnt.IsNull()) return aGEOMObject._retn();
|
||||
aPoints.push_back(aPnt);
|
||||
}
|
||||
//Create the SmoothingSurface
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakeSmoothingSurface(aPoints);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@*/
|
||||
|
@ -126,6 +126,7 @@ class GEOM_I_EXPORT GEOM_IAdvancedOperations_i :
|
||||
GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR,
|
||||
CORBA::Double theH,
|
||||
GEOM::pattern thePattern);
|
||||
GEOM::GEOM_Object_ptr MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints);
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@*/
|
||||
|
||||
::GEOMImpl_IAdvancedOperations* GetOperations()
|
||||
|
@ -3433,6 +3433,25 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedCylinder (CORBA::Double theR,
|
||||
return anObj;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// MakeSmoothingSurface
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSmoothingSurface (GEOM::GEOM_List_ptr thelPoints)
|
||||
{
|
||||
beginService( " GEOM_Superv_i::MakeSmoothingSurface" );
|
||||
MESSAGE("GEOM_Superv_i::MakeSmoothingSurface");
|
||||
getAdvancedOp();
|
||||
if (GEOM_List_i<GEOM::ListOfGO>* aListImplP =
|
||||
dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(thelPoints, myPOA).in())) {
|
||||
getCurvesOp();
|
||||
GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeSmoothingSurface(aListImplP->GetList());
|
||||
endService( " GEOM_Superv_i::MakeSmoothingSurface" );
|
||||
return anObj;
|
||||
}
|
||||
endService( " GEOM_Superv_i::MakeSmoothingSurface" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@*/
|
||||
|
||||
//=====================================================================================
|
||||
|
@ -711,6 +711,7 @@ public:
|
||||
GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR,
|
||||
CORBA::Double theH,
|
||||
GEOM::pattern thePattern);
|
||||
GEOM::GEOM_Object_ptr MakeSmoothingSurface (GEOM::GEOM_List_ptr thelPoints);
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@*/
|
||||
|
||||
private:
|
||||
|
@ -12190,6 +12190,18 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
self._autoPublish(anObj, theName, "dividedCylinder")
|
||||
return anObj
|
||||
|
||||
##
|
||||
# @param thelPoints list of points
|
||||
# @return New GEOM_Object, containing the created shape.
|
||||
#
|
||||
# @ref tui_creation_smoothingsurface "Example"
|
||||
def MakeSmoothingSurface(self, thelPoints):
|
||||
thelPoints, Parameters = ParseParameters(thelPoints)
|
||||
anObj = self.AdvOp.MakeSmoothingSurface(thelPoints)
|
||||
RaiseIfFailed("MakeSmoothingSurface", self.AdvOp)
|
||||
if Parameters: anObj.SetParameters(Parameters)
|
||||
return anObj
|
||||
|
||||
#@@ insert new functions before this line @@ do not remove this line @@#
|
||||
|
||||
# end of l4_advanced
|
||||
|
Loading…
Reference in New Issue
Block a user