From: mzn Date: Sat, 29 Dec 2007 10:47:24 +0000 (+0000) Subject: Fix for bug NPAL18339 (RemoveExtraEdges function in GUI). X-Git-Tag: for_M2008_07022008~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=868e2eb89595e70f1d1d3428812dc890d6c12d67;p=modules%2Fgeom.git Fix for bug NPAL18339 (RemoveExtraEdges function in GUI). --- diff --git a/doc/salome/gui/GEOM/images/remove_extra_edges.png b/doc/salome/gui/GEOM/images/remove_extra_edges.png new file mode 100644 index 000000000..50538dd4b Binary files /dev/null and b/doc/salome/gui/GEOM/images/remove_extra_edges.png differ diff --git a/doc/salome/gui/GEOM/images/remove_extra_edges1.png b/doc/salome/gui/GEOM/images/remove_extra_edges1.png new file mode 100644 index 000000000..3737f97f4 Binary files /dev/null and b/doc/salome/gui/GEOM/images/remove_extra_edges1.png differ diff --git a/doc/salome/gui/GEOM/images/remove_extra_edges2.png b/doc/salome/gui/GEOM/images/remove_extra_edges2.png new file mode 100644 index 000000000..3302eb1be Binary files /dev/null and b/doc/salome/gui/GEOM/images/remove_extra_edges2.png differ diff --git a/doc/salome/gui/GEOM/input/index.doc b/doc/salome/gui/GEOM/input/index.doc index bf0f67956..3d2d5d102 100644 --- a/doc/salome/gui/GEOM/input/index.doc +++ b/doc/salome/gui/GEOM/input/index.doc @@ -104,6 +104,7 @@
  • \ref check_free_boundaries_operation_page
  • \ref check_free_faces_operation_page
  • \ref change_orientation_operation_page
  • +
  • \ref remove_extra_edges_operation_page
  • \subpage using_measurement_tools_page
  • diff --git a/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc b/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc new file mode 100644 index 000000000..3be4c4d3b --- /dev/null +++ b/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc @@ -0,0 +1,24 @@ +/*! + +\page remove_extra_edges_operation_page Remove Extra Edges + +\n To Remove extra edges in the Main Menu select +Repair - > Remove extra edges. +\n This operation removes all seam and degenerated edges from a given +shape and unites faces and edges, sharing one surface. + +\n TUI Command: geompy.RemoveExtraEdges(theShape), +there theShape is a compound or a single solid to remove irregular edges from. +\n Arguments: Name + one shape. + +\image html remove_extra_edges.png + +\n Example: + +\image html remove_extra_edges1.png +
    Shape with extra edges
    + +\image html remove_extra_edges2.png +
    Improved shape
    + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/repairing_operations.doc b/doc/salome/gui/GEOM/input/repairing_operations.doc index d7ac30e4c..cb41f8102 100644 --- a/doc/salome/gui/GEOM/input/repairing_operations.doc +++ b/doc/salome/gui/GEOM/input/repairing_operations.doc @@ -12,6 +12,7 @@
  • \subpage glue_faces_operation_page
  • \subpage add_point_on_edge_operation_page
  • \subpage change_orientation_operation_page
  • +
  • \subpage remove_extra_edges_operation_page
  • */ diff --git a/doc/salome/gui/GEOM/input/transforming_geom_objs.doc b/doc/salome/gui/GEOM/input/transforming_geom_objs.doc index f60ea193e..487387388 100644 --- a/doc/salome/gui/GEOM/input/transforming_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/transforming_geom_objs.doc @@ -48,6 +48,7 @@
  • \ref check_free_boundaries_operation_page
  • \ref check_free_faces_operation_page
  • \ref change_orientation_operation_page
  • +
  • \ref remove_extra_edges_operation_page
  • diff --git a/resources/Makefile.am b/resources/Makefile.am index 2054b989b..8a7697f8c 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -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 diff --git a/resources/remove_extra_edges.png b/resources/remove_extra_edges.png new file mode 100644 index 000000000..fedd8ae13 Binary files /dev/null and b/resources/remove_extra_edges.png differ diff --git a/src/GEOMGUI/GEOM_images.po b/src/GEOMGUI/GEOM_images.po index 157ec0807..387b20ec3 100644 --- a/src/GEOMGUI/GEOM_images.po +++ b/src/GEOMGUI/GEOM_images.po @@ -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" diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 1bc11877f..fa302d3a0 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -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" diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index ec01947a8..a2ff2d479 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -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 ); diff --git a/src/RepairGUI/Makefile.am b/src/RepairGUI/Makefile.am index f406ab997..8dfb76e6c 100644 --- a/src/RepairGUI/Makefile.am +++ b/src/RepairGUI/Makefile.am @@ -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) diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx index 3631415bc..9ab000be2 100644 --- a/src/RepairGUI/RepairGUI.cxx +++ b/src/RepairGUI/RepairGUI.cxx @@ -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; diff --git a/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx new file mode 100644 index 000000000..930fb95c4 --- /dev/null +++ b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx @@ -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 + +#include + +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; +} diff --git a/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.h b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.h new file mode 100644 index 000000000..41c881eec --- /dev/null +++ b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.h @@ -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