mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
0022289: EDF 2623 GEOM: Make "MakePipeWithDifferentsSections" available from GUI
Additional fixes
This commit is contained in:
parent
ed9f4e67b5
commit
c6a9f0c74a
@ -217,7 +217,7 @@ bool AdvancedGUI_SmoothingSurfaceDlg::execute (ObjectList& objects)
|
|||||||
void AdvancedGUI_SmoothingSurfaceDlg::SelectionIntoArgument()
|
void AdvancedGUI_SmoothingSurfaceDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
QList<GEOM::GeomObjPtr> points = getSelected( TopAbs_VERTEX, -1 );
|
QList<GEOM::GeomObjPtr> points = getSelected( TopAbs_VERTEX, -1 );
|
||||||
synchronize( myPoints, points );
|
GEOMBase::Synchronize( myPoints, points );
|
||||||
if ( !myPoints.isEmpty() )
|
if ( !myPoints.isEmpty() )
|
||||||
GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
|
GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
|
||||||
else
|
else
|
||||||
@ -236,30 +236,3 @@ void AdvancedGUI_SmoothingSurfaceDlg::SetEditCurrentArgument()
|
|||||||
myEditCurrentArgument->setFocus();
|
myEditCurrentArgument->setFocus();
|
||||||
SelectionIntoArgument();
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent( QEvent* );
|
void enterEvent( QEvent* );
|
||||||
void synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DlgRef_1Sel* GroupPoints;
|
DlgRef_1Sel* GroupPoints;
|
||||||
|
@ -347,43 +347,13 @@ bool BasicGUI_CurveDlg::ClickOnApply()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : SelectionIntoArgument()
|
|
||||||
// purpose : Called when selection as changed or other case
|
|
||||||
//=================================================================================
|
|
||||||
static void 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BasicGUI_CurveDlg::SelectionIntoArgument()
|
void BasicGUI_CurveDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
|
|
||||||
if (myEditCurrentArgument == myGroupPoints->LineEdit1) {
|
if (myEditCurrentArgument == myGroupPoints->LineEdit1) {
|
||||||
QList<GEOM::GeomObjPtr> points = getSelected(TopAbs_VERTEX, -1);
|
QList<GEOM::GeomObjPtr> points = getSelected(TopAbs_VERTEX, -1);
|
||||||
synchronize(myPoints, points);
|
GEOMBase::Synchronize(myPoints, points);
|
||||||
if (!myPoints.isEmpty())
|
if (!myPoints.isEmpty())
|
||||||
myGroupPoints->LineEdit1->setText(QString::number(myPoints.count()) + "_" +
|
myGroupPoints->LineEdit1->setText(QString::number(myPoints.count()) + "_" +
|
||||||
tr("GEOM_POINT") + tr("_S_"));
|
tr("GEOM_POINT") + tr("_S_"));
|
||||||
|
@ -876,3 +876,33 @@ void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
// Function : synchronize
|
||||||
|
// Purpose :
|
||||||
|
//================================================================
|
||||||
|
void GEOMBase::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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
// SALOME Includes
|
// SALOME Includes
|
||||||
#include <GEOM_AISShape.hxx>
|
#include <GEOM_AISShape.hxx>
|
||||||
|
#include "GEOM_GenericObjPtr.h"
|
||||||
|
|
||||||
// IDL Headers
|
// IDL Headers
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
@ -133,6 +134,8 @@ public :
|
|||||||
|
|
||||||
/* Publish sub-shape under the main object */
|
/* Publish sub-shape under the main object */
|
||||||
static void PublishSubObject( GEOM::GEOM_Object_ptr object );
|
static void PublishSubObject( GEOM::GEOM_Object_ptr object );
|
||||||
|
|
||||||
|
static void Synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GEOMBASE_H
|
#endif // GEOMBASE_H
|
||||||
|
@ -858,14 +858,17 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
|
|||||||
// and seguences of shapes, perform pipe for each
|
// and seguences of shapes, perform pipe for each
|
||||||
// and make sewing after that
|
// and make sewing after that
|
||||||
double fp,lp;
|
double fp,lp;
|
||||||
Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp);
|
|
||||||
gp_Pnt P1,P2;
|
gp_Pnt P1,P2;
|
||||||
gp_Vec Vec1,Vec2;
|
gp_Vec Vec1,Vec2;
|
||||||
C->D1(fp,P1,Vec1);
|
double SumAng = 0;
|
||||||
C->D1(lp,P2,Vec2);
|
if ( Edges.Length() > 0 ) {
|
||||||
double SumAng = fabs(Vec1.Angle(Vec2));
|
Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp);
|
||||||
Vec1 = Vec2;
|
C->D1(fp,P1,Vec1);
|
||||||
P1 = P2;
|
C->D1(lp,P2,Vec2);
|
||||||
|
SumAng = fabs(Vec1.Angle(Vec2));
|
||||||
|
Vec1 = Vec2;
|
||||||
|
P1 = P2;
|
||||||
|
}
|
||||||
TColStd_SequenceOfInteger SplitEdgeNums,SplitLocNums;
|
TColStd_SequenceOfInteger SplitEdgeNums,SplitLocNums;
|
||||||
int LastLoc = 1;
|
int LastLoc = 1;
|
||||||
//cout<<"Edges.Length()="<<Edges.Length()<<endl;
|
//cout<<"Edges.Length()="<<Edges.Length()<<endl;
|
||||||
|
@ -322,13 +322,10 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
else if ( myEditCurrentArgument == GroupMakePoints->LineEdit1 ) {
|
else if ( myEditCurrentArgument == GroupMakePoints->LineEdit1 ) {
|
||||||
myBaseObjects.clear();
|
myBaseObjects.clear();
|
||||||
QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
|
QList<TopAbs_ShapeEnum> types;
|
||||||
for ( int i = 0; i < objects.count(); i++ ) {
|
types << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL;
|
||||||
GEOM::shape_type stype = objects[i]->GetMaxShapeType();
|
QList<GEOM::GeomObjPtr> objects = getSelected( types, -1 );
|
||||||
if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
|
GEOMBase::Synchronize( myBaseObjects, objects );
|
||||||
continue;
|
|
||||||
myBaseObjects << objects[i];
|
|
||||||
}
|
|
||||||
if ( !myBaseObjects.isEmpty() ) {
|
if ( !myBaseObjects.isEmpty() ) {
|
||||||
QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
|
QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
|
||||||
myEditCurrentArgument->setText( aName );
|
myEditCurrentArgument->setText( aName );
|
||||||
@ -336,13 +333,9 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
else if ( myEditCurrentArgument == GroupMakePoints->LineEdit2 ) {
|
else if ( myEditCurrentArgument == GroupMakePoints->LineEdit2 ) {
|
||||||
myLocations.clear();
|
myLocations.clear();
|
||||||
QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
|
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||||
for ( int i = 0; i < objects.count(); i++ ) {
|
QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_VERTEX, -1 );
|
||||||
GEOM::shape_type stype = objects[i]->GetMaxShapeType();
|
GEOMBase::Synchronize( myLocations, objects );
|
||||||
if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
|
|
||||||
continue;
|
|
||||||
myLocations << objects[i];
|
|
||||||
}
|
|
||||||
if ( !myLocations.isEmpty() ) {
|
if ( !myLocations.isEmpty() ) {
|
||||||
QString aName = myLocations.count() > 1 ? QString( "%1_objects").arg( myLocations.count() ) : GEOMBase::GetName( myLocations[0].get() );
|
QString aName = myLocations.count() > 1 ? QString( "%1_objects").arg( myLocations.count() ) : GEOMBase::GetName( myLocations[0].get() );
|
||||||
myEditCurrentArgument->setText( aName );
|
myEditCurrentArgument->setText( aName );
|
||||||
|
Loading…
Reference in New Issue
Block a user