Fix for bug NPAL18339 (RemoveExtraEdges function in GUI).

This commit is contained in:
mzn 2007-12-29 10:47:24 +00:00
parent 467687ca23
commit 868e2eb895
16 changed files with 420 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -104,6 +104,7 @@
<li>\ref check_free_boundaries_operation_page</li>
<li>\ref check_free_faces_operation_page</li>
<li>\ref change_orientation_operation_page</li>
<li>\ref remove_extra_edges_operation_page</li>
</ul>
</ul>
<li>\subpage using_measurement_tools_page</li>

View File

@ -0,0 +1,24 @@
/*!
\page remove_extra_edges_operation_page Remove Extra Edges
\n To <b>Remove extra edges</b> in the <b>Main Menu</b> select
<b>Repair - > Remove extra edges</b>.
\n This operation removes all seam and degenerated edges from a given
shape and unites faces and edges, sharing one surface.
\n <b>TUI Command:</b> <em>geompy.RemoveExtraEdges(theShape)</em>,
there <em>theShape</em> is a compound or a single solid to remove irregular edges from.
\n <b>Arguments:</b> Name + one shape.
\image html remove_extra_edges.png
\n <b>Example:</b>
\image html remove_extra_edges1.png
<center><em>Shape with extra edges</em></center>
\image html remove_extra_edges2.png
<center><em>Improved shape</em></center>
*/

View File

@ -12,6 +12,7 @@
<li>\subpage glue_faces_operation_page</li>
<li>\subpage add_point_on_edge_operation_page</li>
<li>\subpage change_orientation_operation_page</li>
<li>\subpage remove_extra_edges_operation_page</li>
</ul>
*/

View File

@ -48,6 +48,7 @@
<li>\ref check_free_boundaries_operation_page</li>
<li>\ref check_free_faces_operation_page</li>
<li>\ref change_orientation_operation_page</li>
<li>\ref remove_extra_edges_operation_page</li>
</ul>
</ul>

View File

@ -195,6 +195,7 @@ propagate.png \
redo.png \
undo.png \
arccenter.png \
glue2.png
glue2.png \
remove_extra_edges.png
nodist_salomeres_DATA = GEOMCatalog.xml

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

View File

@ -331,6 +331,10 @@ msgstr "sewing.png"
msgid "ICON_DLG_CHANGE_ORIENTATION"
msgstr "change_orientation.png"
#ChangeOrientationDlg
msgid "ICON_DLG_REMOVE_EXTRA_EDGES"
msgstr "remove_extra_edges.png"
#PipeDlg
msgid "ICON_DLG_PIPE"
msgstr "pipe.png"
@ -736,6 +740,9 @@ msgstr "free_faces.png"
msgid "ICO_CHANGE_ORIENTATION"
msgstr "change_orientation.png"
msgid "ICO_REMOVE_EXTRA_EDGES"
msgstr "remove_extra_edges.png"
msgid "ICO_POINT_COORDS"
msgstr "point_coord.png"

View File

@ -1717,6 +1717,12 @@ msgstr "Change orientation"
msgid "GEOM_CHANGE_ORIENTATION"
msgstr "Objects to change orientation"
msgid "GEOM_REMOVE_EXTRA_EDGES_TITLE"
msgstr "Remove extra edges"
msgid "GEOM_REMOVE_EXTRA_EDGES"
msgstr "Object to remove extra edges"
msgid "GEOM_BY_PARAMETER"
msgstr "By parameter"
@ -2078,6 +2084,9 @@ msgstr "SupressFaces"
msgid "CHANGE_ORIENTATION_NEW_OBJ_NAME"
msgstr "Invert"
msgid "REMOVE_EXTRA_EDGES_NEW_OBJ_NAME"
msgstr "NoExtraEdges"
msgid "NON_GEOM_OBJECTS_SELECTED"
msgstr "There are objects selected which do not belong to %1 component."
@ -2712,6 +2721,15 @@ msgstr "Change orientation"
msgid "STB_CHANGE_ORIENTATION"
msgstr "Change orientation"
msgid "TOP_REMOVE_EXTRA_EDGES"
msgstr "Remove extra edges"
msgid "MEN_REMOVE_EXTRA_EDGES"
msgstr "Remove extra edges"
msgid "STB_REMOVE_EXTRA_EDGES"
msgstr "Remove extra edges"
msgid "MEN_MEASURES"
msgstr "Measures"

View File

@ -516,7 +516,8 @@ void GeometryGUI::OnGUIEvent( int id )
id == 609 || // MENU MEASURE - FREE BOUNDARIES
id == 610 || // MENU MEASURE - FREE FACES
id == 611 || // MENU REPAIR - CHANGE ORIENTATION
id == 602 ) { // MENU REPAIR - GLUE FACES
id == 602 || // MENU REPAIR - GLUE FACES
id == 612 ) { // MENU REPAIR - REMOVE EXTRA EDGES
#ifndef WNT
library = getLibrary( "libRepairGUI.so" );
#else
@ -845,6 +846,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( 609, "CHECK_FREE_BNDS" );
createGeomAction( 610, "CHECK_FREE_FACES" );
createGeomAction( 611, "CHANGE_ORIENTATION" );
createGeomAction( 612, "REMOVE_EXTRA_EDGES" );
createGeomAction( 708, "POINT_COORDS" );
createGeomAction( 701, "BASIC_PROPS" );
@ -1001,6 +1003,7 @@ void GeometryGUI::initialize( CAM_Application* app )
//createMenu( 609, repairId, -1 );
//createMenu( 610, repairId, -1 );
createMenu( 611, repairId, -1 );
createMenu( 612, repairId, -1 );
int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 );
createMenu( 708, measurId, -1 );

View File

@ -47,7 +47,8 @@ dist_libRepairGUI_la_SOURCES = \
RepairGUI_FreeBoundDlg.cxx \
RepairGUI_FreeFacesDlg.cxx \
RepairGUI_ChangeOrientationDlg.cxx \
RepairGUI_GlueDlg.cxx
RepairGUI_GlueDlg.cxx \
RepairGUI_RemoveExtraEdgesDlg.cxx
MOC_FILES = \
RepairGUI_SewingDlg_moc.cxx \
@ -60,7 +61,8 @@ MOC_FILES = \
RepairGUI_FreeBoundDlg_moc.cxx \
RepairGUI_FreeFacesDlg_moc.cxx \
RepairGUI_ChangeOrientationDlg_moc.cxx \
RepairGUI_GlueDlg_moc.cxx
RepairGUI_GlueDlg_moc.cxx \
RepairGUI_RemoveExtraEdgesDlg_moc.cxx
nodist_libRepairGUI_la_SOURCES= \
$(MOC_FILES)

View File

@ -44,6 +44,7 @@
#include "RepairGUI_FreeFacesDlg.h" // Method FREE FACES
#include "RepairGUI_GlueDlg.h" // Method GLUE FACES
#include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION
#include "RepairGUI_RemoveExtraEdgesDlg.h" // Method REMOVE EXTRA EDGES
#include "utilities.h"
@ -90,6 +91,7 @@ bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
case 609: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent, ""); break;
case 610: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent, ""); break;
case 611: aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent, ""); break;
case 612: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent, ""); break;
default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;

View File

@ -0,0 +1,279 @@
//
// 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 : RepairGUI_RemoveExtraEdgesDlg.cxx
// Author : Michael Zorin
// Module : GEOM
// $Header:
#include "RepairGUI_RemoveExtraEdgesDlg.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_Session.h"
#include "GEOMImpl_Types.hxx"
#include <TColStd_MapOfInteger.hxx>
#include <qlabel.h>
using namespace std;
//=================================================================================
// class : RepairGUI_RemoveExtraEdgesDlg()
// purpose : Constructs a RepairGUI_RemoveExtraEdgesDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_RemoveExtraEdgesDlg::RepairGUI_RemoveExtraEdgesDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_REMOVE_EXTRA_EDGES")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_REMOVE_EXTRA_EDGES_TITLE"));
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_REMOVE_EXTRA_EDGES_TITLE"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_REMOVE_EXTRA_EDGES"));
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints->LineEdit1->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/
setHelpFileName("remove_extra_edges_operation_page.html");
Init();
}
//=================================================================================
// function : ~RepairGUI_RemoveExtraEdgesDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
RepairGUI_RemoveExtraEdgesDlg::~RepairGUI_RemoveExtraEdgesDlg()
{
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::Init()
{
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
myOkObject = false;
activateSelection();
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "REMOVE_EXTRA_EDGES_NEW_OBJ_NAME" ) );
}
//=================================================================================
// function : ClickOnOk()
// purpose : Same than click on apply but close this dialog.
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::ClickOnOk()
{
if ( ClickOnApply() )
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool RepairGUI_RemoveExtraEdgesDlg::ClickOnApply()
{
if ( !onAccept() )
return false;
initName();
myEditCurrentArgument->setText("");
myObject = GEOM::GEOM_Object::_nil();
activateSelection();
return true;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
// : used only by SelectButtonC1A1 (LineEditC1A1)
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
if (IObjectCount() != 1) {
if (myEditCurrentArgument == GroupPoints->LineEdit1)
myOkObject = false;
return;
}
}
// nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if (!testResult)
return;
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myObject = aSelectedObject;
myOkObject = true;
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::SetEditCurrentArgument()
{
if( sender() == GroupPoints->PushButton1 )
{
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
}
SelectionIntoArgument();
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::LineEditReturnPressed()
{
if( sender() == GroupPoints->LineEdit1 )
{
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
activateSelection();
}
//=================================================================================
// function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::enterEvent(QEvent* e)
{
if ( !GroupConstructors->isEnabled() )
ActivateThisDialog();
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::closeEvent(QCloseEvent* e)
{
GEOMBase_Skeleton::closeEvent( e );
}
//=================================================================================
// function : activateSelection
// purpose : activate selection of solids and compounds
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::activateSelection()
{
TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_SOLID );
aTypes.Add( GEOM_COMPOUND );
globalSelection( aTypes );
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr RepairGUI_RemoveExtraEdgesDlg::createOperation()
{
return getGeomEngine()->GetIBlocksOperations( getStudyId() );
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_RemoveExtraEdgesDlg::isValid( QString& msg )
{
return myOkObject;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool RepairGUI_RemoveExtraEdgesDlg::execute( ObjectList& objects )
{
GEOM::GEOM_Object_var anObj;
anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->RemoveExtraEdges(myObject);
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
return true;
}

View File

@ -0,0 +1,77 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 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 : RepairGUI_RemoveExtraEdgesDlg.h
// Author : Michael ZORIN
// Module : GEOM
#ifndef DIALOGBOX_REMOVEEXTRAEDGES_H
#define DIALOGBOX_REMOVEEXTRAEDGES_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel_QTD.h"
//=================================================================================
// class : RepairGUI_RemoveExtraEdgesDlg
// purpose : Remove all seam and degenerated edges from a given shape.
//=================================================================================
class RepairGUI_RemoveExtraEdgesDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
RepairGUI_RemoveExtraEdgesDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_RemoveExtraEdgesDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
private :
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void activateSelection();
GEOM::GEOM_Object_var myObject;
bool myOkObject;
DlgRef_1Sel_QTD* GroupPoints;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
};
#endif // DIALOGBOX_REMOVEEXTRAEDGES_H