mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-26 17:20:34 +05:00
Changes for 0020673 - Implementation of "Auto-correct edges orientation".
This commit is contained in:
parent
2fa6df2c26
commit
04e48a4907
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
@ -18,9 +18,13 @@ created surface and the reference edge;
|
||||
Iterations</b> - defines the maximum number of iterations. The
|
||||
iterations are repeated until the required tolerance is reached. So, a
|
||||
greater number of iterations allows producing a better surface.
|
||||
\n <b>Use orientation</b> - if checked, orientation of edges are used:
|
||||
if edge is reversed curve from this edge is reversed before using in
|
||||
filling algorithm.
|
||||
\n <b>Method</b> - Kind of method to perform filling operation
|
||||
1. Default - standard behaviour
|
||||
2. Use edges orientation - orientation of edges are used: if edge is
|
||||
reversed curve from this edge is reversed before using in filling
|
||||
algorithm.
|
||||
3. Auto-correct edges orientation - change orientation of curves using
|
||||
minimization of sum of distances between ends points of edges.
|
||||
\n <b>Approximation</b> - if checked, BSpline curves are generated in
|
||||
the process of surface construction (using
|
||||
GeomAPI_PointsToBSplineSurface functionality). By default the surface
|
||||
|
@ -114,6 +114,22 @@ module GEOM
|
||||
FSM_GetInPlaceByHistory
|
||||
};
|
||||
|
||||
/*!
|
||||
* Kind of method to perform filling operation
|
||||
* Is used in functions GEOM_Gen.MakeFilling<xxx>()
|
||||
*/
|
||||
enum filling_oper_method
|
||||
{
|
||||
/*! Default (standard behaviour) */
|
||||
FOM_Default,
|
||||
|
||||
/*! Use edges orientation */
|
||||
FOM_UseOri,
|
||||
|
||||
/*! Auto-correct edges orientation */
|
||||
FOM_AutoCorrect
|
||||
};
|
||||
|
||||
|
||||
typedef sequence<string> string_array;
|
||||
typedef sequence<short> short_array;
|
||||
@ -1180,12 +1196,14 @@ module GEOM
|
||||
* \param theTol2D a 2d tolerance to be reached
|
||||
* \param theTol3D a 3d tolerance to be reached
|
||||
* \param theNbIter a number of iteration of approximation algorithm
|
||||
* \param theMethod Kind of method to perform filling operation.
|
||||
* \return New GEOM_Object, containing the created filling surface.
|
||||
*/
|
||||
GEOM_Object MakeFilling (in GEOM_Object theShape,
|
||||
in long theMinDeg, in long theMaxDeg,
|
||||
in double theTol2D, in double theTol3D,
|
||||
in long theNbIter, in boolean theUseOri,
|
||||
in long theNbIter,
|
||||
in filling_oper_method theMethod,
|
||||
in boolean theApprox);
|
||||
|
||||
/*!
|
||||
|
@ -200,7 +200,8 @@ module GEOM
|
||||
GEOM_Object MakeFilling (in GEOM_Object theShape,
|
||||
in long theMinDeg, in long theMaxDeg,
|
||||
in double theTol2D, in double theTol3D,
|
||||
in long theNbIter, in boolean theUseOri,
|
||||
in long theNbIter,
|
||||
in filling_oper_method theMethod,
|
||||
in boolean theApprox) ;
|
||||
GEOM_Object MakeThruSections(in ListOfGO theSeqSections,
|
||||
in boolean theModeSolid,
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>200</width>
|
||||
<height>153</height>
|
||||
<height>162</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -59,13 +59,25 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="CheckBox2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="TextLabel7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>TL7</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="ComboBox1"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
@ -187,7 +199,7 @@
|
||||
<tabstops>
|
||||
<tabstop>PushButton1</tabstop>
|
||||
<tabstop>LineEdit1</tabstop>
|
||||
<tabstop>CheckBox2</tabstop>
|
||||
<tabstop>ComboBox1</tabstop>
|
||||
<tabstop>SpinBox1</tabstop>
|
||||
<tabstop>SpinBox2</tabstop>
|
||||
<tabstop>SpinBox4</tabstop>
|
||||
|
@ -3787,9 +3787,21 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>GEOM_FILLING_APPROX</source>
|
||||
<translation>Approximation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FILLING_METHOD</source>
|
||||
<translation>Method</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FILLING_DEFAULT</source>
|
||||
<translation>Default (standard behaviour)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FILLING_USEORI</source>
|
||||
<translation>Use orientation</translation>
|
||||
<translation>Use edges orientation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FILLING_AUTO</source>
|
||||
<translation>Auto-correct edges orientation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_WRN_NO_APPROPRIATE_SELECTION</source>
|
||||
|
@ -110,7 +110,7 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_Real tol2d = IF.GetTol3D();
|
||||
Standard_Integer nbiter = IF.GetNbIter();
|
||||
Standard_Boolean isApprox = IF.GetApprox();
|
||||
Standard_Boolean isUseOri = IF.GetUseOri();
|
||||
Standard_Integer aMethod = IF.GetMethod();
|
||||
|
||||
if (mindeg > maxdeg) {
|
||||
Standard_RangeError::Raise("Minimal degree can not be more than maximal degree");
|
||||
@ -224,6 +224,8 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
// make filling as in old version of SALOME (before 4.1.1)
|
||||
GeomFill_SectionGenerator Section;
|
||||
Standard_Integer i = 0;
|
||||
Handle(Geom_Curve) aLastC;
|
||||
gp_Pnt PL1,PL2;
|
||||
for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) {
|
||||
Scurrent = Ex.Current();
|
||||
if (Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return 0;
|
||||
@ -235,9 +237,33 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
//else
|
||||
// C = new Geom_TrimmedCurve(C, First, Last);
|
||||
C = new Geom_TrimmedCurve(C, First, Last);
|
||||
if( isUseOri && Scurrent.Orientation() == TopAbs_REVERSED ) {
|
||||
gp_Pnt P1,P2;
|
||||
C->D0(First,P1);
|
||||
C->D0(Last,P2);
|
||||
|
||||
if( aMethod==1 && Scurrent.Orientation() == TopAbs_REVERSED ) {
|
||||
C->Reverse();
|
||||
}
|
||||
else if( aMethod==2 ) {
|
||||
if( i==0 ) {
|
||||
PL1 = P1;
|
||||
PL2 = P2;
|
||||
}
|
||||
else {
|
||||
double d1 = PL1.Distance(P1) + PL2.Distance(P2);
|
||||
double d2 = PL1.Distance(P2) + PL2.Distance(P1);
|
||||
if(d2<d1) {
|
||||
C->Reverse();
|
||||
PL1 = P2;
|
||||
PL2 = P1;
|
||||
}
|
||||
else {
|
||||
PL1 = P1;
|
||||
PL2 = P2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section.AddCurve(C);
|
||||
i++;
|
||||
}
|
||||
|
@ -1454,7 +1454,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
|
||||
(Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
|
||||
double theTol2D, double theTol3D, int theNbIter,
|
||||
bool isUseOri, bool isApprox)
|
||||
int theMethod, bool isApprox)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
@ -1483,7 +1483,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
|
||||
aFI.SetTol3D(theTol3D);
|
||||
aFI.SetNbIter(theNbIter);
|
||||
aFI.SetApprox(isApprox);
|
||||
aFI.SetUseOri(isUseOri);
|
||||
aFI.SetMethod(theMethod);
|
||||
|
||||
//Compute the Solid value
|
||||
try {
|
||||
|
@ -100,7 +100,7 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape,
|
||||
int theMinDeg, int theMaxDeg,
|
||||
double theTol2D, double theTol3D,
|
||||
int theNbIter, bool isUseOri,
|
||||
int theNbIter, int theMethod,
|
||||
bool isApprox);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeThruSections
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define FILL_ARG_SHAPE 5
|
||||
#define FILL_ARG_NBITER 6
|
||||
#define FILL_ARG_APPROX 7
|
||||
#define FILL_ARG_USEORI 8
|
||||
#define FILL_ARG_METHOD 8
|
||||
|
||||
class GEOMImpl_IFilling
|
||||
{
|
||||
@ -53,8 +53,8 @@ class GEOMImpl_IFilling
|
||||
void SetApprox(bool theApprox) { _func->SetInteger(FILL_ARG_APPROX, theApprox); }
|
||||
bool GetApprox() { return _func->GetInteger(FILL_ARG_APPROX); }
|
||||
|
||||
void SetUseOri(bool theUseOri) { _func->SetInteger(FILL_ARG_USEORI, theUseOri); }
|
||||
bool GetUseOri() { return _func->GetInteger(FILL_ARG_USEORI); }
|
||||
void SetMethod(int theMethod) { _func->SetInteger(FILL_ARG_METHOD, theMethod); }
|
||||
int GetMethod() { return _func->GetInteger(FILL_ARG_METHOD); }
|
||||
|
||||
void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(FILL_ARG_SHAPE, theShape); }
|
||||
Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); }
|
||||
|
@ -704,14 +704,15 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
|
||||
* MakeFilling
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Long theMinDeg,
|
||||
CORBA::Long theMaxDeg,
|
||||
CORBA::Double theTol2D,
|
||||
CORBA::Double theTol3D,
|
||||
CORBA::Long theNbIter,
|
||||
CORBA::Boolean theUseOri,
|
||||
CORBA::Boolean theApprox)
|
||||
GEOM::GEOM_Object_ptr
|
||||
GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Long theMinDeg,
|
||||
CORBA::Long theMaxDeg,
|
||||
CORBA::Double theTol2D,
|
||||
CORBA::Double theTol3D,
|
||||
CORBA::Long theNbIter,
|
||||
GEOM::filling_oper_method theMethod,
|
||||
CORBA::Boolean theApprox)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
@ -723,10 +724,34 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_pt
|
||||
|
||||
if (aShape.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
int aMethod = 0;
|
||||
switch (theMethod) {
|
||||
case GEOM::FOM_Default:
|
||||
{
|
||||
// Default (standard behaviour)
|
||||
aMethod = 0;
|
||||
}
|
||||
break;
|
||||
case GEOM::FOM_UseOri:
|
||||
{
|
||||
// Use edges orientation
|
||||
aMethod = 1;
|
||||
}
|
||||
break;
|
||||
case GEOM::FOM_AutoCorrect:
|
||||
{
|
||||
// Auto-correct edges orientation
|
||||
aMethod = 2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{}
|
||||
}
|
||||
|
||||
//Create the Solid
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
|
||||
(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter,
|
||||
theUseOri, theApprox);
|
||||
aMethod, theApprox);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
|
@ -137,7 +137,8 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
|
||||
GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Long theMinDeg, CORBA::Long theMaxDeg,
|
||||
CORBA::Double theTol2D, CORBA::Double theTol3D,
|
||||
CORBA::Long theNbIter, CORBA::Boolean theUseOri,
|
||||
CORBA::Long theNbIter,
|
||||
GEOM::filling_oper_method theMethod,
|
||||
CORBA::Boolean theApprox);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections,
|
||||
|
@ -1247,7 +1247,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape
|
||||
CORBA::Double theTol2D,
|
||||
CORBA::Double theTol3D,
|
||||
CORBA::Long theNbIter,
|
||||
CORBA::Boolean theUseOri,
|
||||
GEOM::filling_oper_method theMethod,
|
||||
CORBA::Boolean theApprox)
|
||||
{
|
||||
beginService( " GEOM_Superv_i::MakeFilling" );
|
||||
@ -1255,7 +1255,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape
|
||||
get3DPrimOp();
|
||||
GEOM::GEOM_Object_ptr anObj =
|
||||
my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D,
|
||||
theNbIter, theUseOri, theApprox);
|
||||
theNbIter, theMethod, theApprox);
|
||||
endService( " GEOM_Superv_i::MakeFilling" );
|
||||
return anObj;
|
||||
}
|
||||
|
@ -288,7 +288,8 @@ public:
|
||||
GEOM::GEOM_Object_ptr MakeFilling (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Long theMinDeg, CORBA::Long theMaxDeg,
|
||||
CORBA::Double theTol2D, CORBA::Double theTol3D,
|
||||
CORBA::Long theNbIter, CORBA::Boolean theUseOri,
|
||||
CORBA::Long theNbIter,
|
||||
GEOM::filling_oper_method theMethod,
|
||||
CORBA::Boolean theApprox);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections,
|
||||
|
@ -70,7 +70,7 @@ GenerationGUI_FillingDlg::GenerationGUI_FillingDlg( GeometryGUI* theGeometryGUI,
|
||||
GroupPoints->TextLabel5->setText( tr( "GEOM_FILLING_MAX_DEG" ) );
|
||||
GroupPoints->TextLabel6->setText( tr( "GEOM_FILLING_TOL_3D" ) );
|
||||
GroupPoints->CheckBox1->setText( tr( "GEOM_FILLING_APPROX" ) );
|
||||
GroupPoints->CheckBox2->setText( tr( "GEOM_FILLING_USEORI" ) );
|
||||
GroupPoints->TextLabel7->setText( tr( "GEOM_FILLING_METHOD" ) );
|
||||
GroupPoints->PushButton1->setIcon( image1 );
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
|
||||
@ -109,7 +109,7 @@ void GenerationGUI_FillingDlg::Init()
|
||||
myTol3D = 0.0001;
|
||||
myTol2D = 0.0001;
|
||||
myNbIter = 0;
|
||||
myIsUseOri = false;
|
||||
myMethod = 0;
|
||||
myIsApprox = false;
|
||||
myOkCompound = false;
|
||||
|
||||
@ -130,6 +130,10 @@ void GenerationGUI_FillingDlg::Init()
|
||||
GroupPoints->SpinBox4->setValue( myMaxDeg );
|
||||
GroupPoints->SpinBox5->setValue( myTol3D );
|
||||
|
||||
GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_DEFAULT"));
|
||||
GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_USEORI"));
|
||||
GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_AUTO"));
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
@ -137,6 +141,8 @@ void GenerationGUI_FillingDlg::Init()
|
||||
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
|
||||
connect( GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(MethodChanged()));
|
||||
|
||||
connect( GroupPoints->SpinBox1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupPoints->SpinBox2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupPoints->SpinBox3, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
@ -146,9 +152,6 @@ void GenerationGUI_FillingDlg::Init()
|
||||
connect( GroupPoints->CheckBox1, SIGNAL( stateChanged( int ) ),
|
||||
this, SLOT( ApproxChanged() ) );
|
||||
|
||||
connect( GroupPoints->CheckBox2, SIGNAL( stateChanged( int ) ),
|
||||
this, SLOT( UseOriChanged() ) );
|
||||
|
||||
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
|
||||
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
@ -322,12 +325,12 @@ void GenerationGUI_FillingDlg::ValueChangedInSpinBox( double newValue )
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : UseOriChanged()
|
||||
// function : MethodChanged
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GenerationGUI_FillingDlg::UseOriChanged()
|
||||
void GenerationGUI_FillingDlg::MethodChanged()
|
||||
{
|
||||
myIsUseOri = GroupPoints->CheckBox2->isChecked();
|
||||
myMethod = GroupPoints->ComboBox1->currentIndex();
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
@ -375,9 +378,19 @@ bool GenerationGUI_FillingDlg::execute( ObjectList& objects )
|
||||
{
|
||||
GEOM::GEOM_I3DPrimOperations_var anOper =
|
||||
GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
|
||||
|
||||
GEOM::filling_oper_method aMethod;
|
||||
switch (GroupPoints->ComboBox1->currentIndex())
|
||||
{
|
||||
case 0: aMethod = GEOM::FOM_Default; break;
|
||||
case 1: aMethod = GEOM::FOM_UseOri; break;
|
||||
case 2: aMethod = GEOM::FOM_AutoCorrect; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
GEOM::GEOM_Object_var anObj =
|
||||
anOper->MakeFilling( myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D,
|
||||
myNbIter, myIsUseOri, myIsApprox );
|
||||
myNbIter, aMethod, myIsApprox );
|
||||
if ( !anObj->_is_nil() )
|
||||
{
|
||||
if ( !IsPreview() )
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
Standard_Real myTol2D;
|
||||
Standard_Integer myNbIter;
|
||||
bool myIsApprox;
|
||||
bool myIsUseOri;
|
||||
int myMethod;
|
||||
bool myOkCompound; /* to check when curv. compound is defined */
|
||||
|
||||
DlgRef_1Sel5Spin1Check* GroupPoints;
|
||||
@ -73,7 +73,7 @@ private slots:
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ValueChangedInSpinBox( double );
|
||||
void UseOriChanged();
|
||||
void MethodChanged();
|
||||
void ApproxChanged();
|
||||
void SetDoubleSpinBoxStep( double );
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user