X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMGUI%2FGeometryGUI.cxx;h=2058d7a2ea2473bc2645adfcdfd1b5068cfb3ad5;hb=04f3d723da1ae9133d108921c8f10338a9656d12;hp=3f462d90d08a8fcecfb42519b9a97aff5dc9c094;hpb=49047f7d298f22733ce9bb55676486c1e7115855;p=modules%2Fgeom.git diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 3f462d90d..2058d7a2e 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -1,30 +1,27 @@ -// GEOM GEOMGUI : GUI for Geometry component +// 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : GeometryGUI.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // -// -// File : GeometryGUI.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ #include "GeometryGUI.h" #include "GEOMGUI_OCCSelector.h" @@ -349,17 +346,17 @@ void GeometryGUI::OnGUIEvent( int id ) id == 2175 || // POPUP VIEWER - SELECT ONLY - SHELL id == 2176 || // POPUP VIEWER - SELECT ONLY - SOLID id == 2177 || // POPUP VIEWER - SELECT ONLY - COMPOUND - id == 2178 || // POPUP VIEWER - SELECT ONLY - SELECT ALL + id == 2178 || // POPUP VIEWER - SELECT ONLY - SELECT ALL id == 31 || // MENU EDIT - COPY id == 33 || // MENU EDIT - DELETE id == 411 || // MENU SETTINGS - ADD IN STUDY id == 412 || // MENU SETTINGS - SHADING COLOR - id == 413 || // MENU SETTINGS - ISOS - id == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES id == 5103 || // MENU TOOLS - CHECK GEOMETRY id == 8032 || // POPUP VIEWER - COLOR id == 8033 || // POPUP VIEWER - TRANSPARENCY id == 8034 || // POPUP VIEWER - ISOS + id == 8035 || // POPUP VIEWER - AUTO COLOR + id == 8036 || // POPUP VIEWER - DISABLE AUTO COLOR id == 804 || // POPUP VIEWER - ADD IN STUDY id == 901 || // OBJECT BROWSER - RENAME id == 9024 ) { // OBJECT BROWSER - OPEN @@ -483,10 +480,11 @@ void GeometryGUI::OnGUIEvent( int id ) id == 606 || // MENU REPAIR - CLOSE CONTOUR id == 607 || // MENU REPAIR - REMOVE INTERNAL WIRES id == 608 || // MENU REPAIR - ADD POINT ON EDGE - id == 609 || // MENU REPAIR - FREE BOUNDARIES - id == 610 || // MENU REPAIR - FREE FACES + 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 @@ -496,8 +494,10 @@ void GeometryGUI::OnGUIEvent( int id ) else if( id == 701 || // MENU MEASURE - PROPERTIES id == 702 || // MENU MEASURE - CDG id == 703 || // MENU MEASURE - INERTIA + id == 704 || // MENU MEASURE - NORMALE id == 7041 || // MENU MEASURE - BOUNDING BOX id == 7042 || // MENU MEASURE - MIN DISTANCE + id == 7043 || // MENU MEASURE - ANGLE id == 705 || // MENU MEASURE - TOLERANCE id == 706 || // MENU MEASURE - WHATIS id == 707 || // MENU MEASURE - CHECK @@ -738,7 +738,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( 111, "IMPORT", "", (CTRL + Key_I) ); createGeomAction( 121, "EXPORT", "", (CTRL + Key_E) ); - createGeomAction( 33, "DELETE" ); + createGeomAction( 33, "DELETE", "", Qt::Key_Delete ); createGeomAction( 4011, "POINT" ); createGeomAction( 4012, "LINE" ); @@ -813,24 +813,26 @@ 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" ); createGeomAction( 702, "MASS_CENTER" ); createGeomAction( 703, "INERTIA" ); + createGeomAction( 704, "NORMALE" ); createGeomAction( 7041, "BND_BOX" ); createGeomAction( 7042, "MIN_DIST" ); + createGeomAction( 7043, "MEASURE_ANGLE" ); createGeomAction( 705, "TOLERANCE" ); createGeomAction( 706, "WHAT_IS" ); createGeomAction( 707, "CHECK" ); createGeomAction( 7072, "CHECK_COMPOUND" ); +#ifdef _DEBUG_ // PAL16821 createGeomAction( 5103, "CHECK_GEOMETRY" ); - +#endif createGeomAction( 412, "SHADING_COLOR" ); - createGeomAction( 413, "ISOS" ); - createGeomAction( 414, "STEP_VALUE" ); createGeomAction( 211, "SHADING" ); createGeomAction( 212, "DISPLAY_ALL" ); @@ -847,12 +849,14 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( 213, "DISPLAY_ONLY" ); createGeomAction( 215, "ERASE" ); - createGeomAction( 901, "POP_RENAME" ); + createGeomAction( 901, "POP_RENAME", "", Qt::Key_F2 ); createGeomAction( 80311, "POP_WIREFRAME", "", 0, true ); createGeomAction( 80312, "POP_SHADING", "", 0, true ); createGeomAction( 8032, "POP_COLOR" ); createGeomAction( 8033, "POP_TRANSPARENCY" ); createGeomAction( 8034, "POP_ISOS" ); + createGeomAction( 8035, "POP_AUTO_COLOR" ); + createGeomAction( 8036, "POP_DISABLE_AUTO_COLOR" ); createGeomAction( 8001, "POP_CREATE_GROUP" ); // make wireframe-shading items to be exclusive (only one at a time is selected) @@ -961,9 +965,10 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( 601, repairId, -1 ); createMenu( 602, repairId, -1 ); createMenu( 608, repairId, -1 ); - createMenu( 609, repairId, -1 ); - createMenu( 610, repairId, -1 ); + //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 ); @@ -971,11 +976,18 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( separator(), measurId, -1 ); createMenu( 702, measurId, -1 ); createMenu( 703, measurId, -1 ); + createMenu( 704, measurId, -1 ); + // NPAL16572: move "Check free boundaries" and "Check free faces" from "Repair" to "Measure" + createMenu( separator(), measurId, -1 ); + createMenu( 609, measurId, -1 ); + createMenu( 610, measurId, -1 ); + // NPAL16572 END createMenu( separator(), measurId, -1 ); int dimId = createMenu( tr( "MEN_DIMENSIONS" ), measurId, -1 ); createMenu( 7041, dimId, -1 ); createMenu( 7042, dimId, -1 ); + createMenu( 7043, dimId, -1 ); createMenu( separator(), measurId, -1 ); createMenu( 705, measurId, -1 ); @@ -984,16 +996,15 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( 707, measurId, -1 ); createMenu( 7072, measurId, -1 ); +#ifdef _DEBUG_ // PAL16821 int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 ); createMenu( separator(), toolsId, -1 ); createMenu( 5103, toolsId, -1 ); - +#endif //int prefId = createMenu( tr( "MEN_PREFERENCES" ), -1, -1, 50 ); //createMenu( separator(), prefId, -1 ); //int geomId = createMenu( tr( "MEN_PREFERENCES_GEOM" ), prefId, -1 ); //createMenu( 412, geomId, -1 ); - //createMenu( 413, geomId, -1 ); - //createMenu( 414, geomId, -1 ); //createMenu( separator(), prefId, -1 ); int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 ); @@ -1066,9 +1077,17 @@ void GeometryGUI::initialize( CAM_Application* app ) QString clientOCCorVTK = "(client='OCCViewer' or client='VTKViewer')"; QString clientOCCorVTK_AndSomeVisible = clientOCCorVTK + " and selcount>0 and isVisible"; + QString clientOCCorVTKorOB = "(client='ObjectBrowser' or client='OCCViewer' or client='VTKViewer')"; + QString clientOCCorVTKorOB_AndSomeVisible = clientOCCorVTKorOB + " and selcount>0 and isVisible"; + + QString autoColorPrefix = + "(client='ObjectBrowser' or client='OCCViewer') and type='Shape' and selcount=1 and isOCC=true"; + QtxPopupMgr* mgr = popupMgr(); mgr->insert( action( 901 ), -1, -1 ); // rename mgr->setRule( action( 901 ), QString("$type in {'Shape' 'Group'} and selcount=1"), QtxPopupMgr::VisibleRule ); + mgr->insert( action( 33 ), -1, -1 ); // delete + mgr->setRule( action( 33 ), QString("$type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule ); mgr->insert( action( 8001 ), -1, -1 ); // create group mgr->setRule( action( 8001 ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule ); mgr->insert( action( 801 ), -1, -1 ); // edit group @@ -1083,11 +1102,16 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->setRule( action( 80312 ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule ); mgr->insert( separator(), -1, -1 ); // ----------- mgr->insert( action( 8032 ), -1, -1 ); // color - mgr->setRule( action( 8032 ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule ); + mgr->setRule( action( 8032 ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule ); mgr->insert( action( 8033 ), -1, -1 ); // transparency mgr->setRule( action( 8033 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); mgr->insert( action( 8034 ), -1, -1 ); // isos - mgr->setRule( action( 8034 ), QString("client='OCCViewer' and selcount>0 and isVisible"), QtxPopupMgr::VisibleRule ); + mgr->setRule( action( 8034 ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule ); + mgr->insert( separator(), -1, -1 ); // ----------- + mgr->insert( action( 8035 ), -1, -1 ); // auto color + mgr->setRule( action( 8035 ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule ); + mgr->insert( action( 8036 ), -1, -1 ); // disable auto color + mgr->setRule( action( 8036 ), autoColorPrefix + " and isAutoColor=true", QtxPopupMgr::VisibleRule ); mgr->insert( separator(), -1, -1 ); // ----------- @@ -1106,7 +1130,7 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->setRule( action( 214 ), clientOCCorVTK, QtxPopupMgr::VisibleRule ); QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)"; - + int selectolnyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu mgr->insert( action(2171), selectolnyId, -1); //Vertex mgr->setRule(action(2171), selectOnly, QtxPopupMgr::VisibleRule); @@ -1133,7 +1157,6 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->insert( action(2178), selectolnyId, -1); //Clear selection filter mgr->setRule(action(2178), selectOnly, QtxPopupMgr::VisibleRule); mgr->setRule(action(2178), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule); - mgr->insert( action( 213 ), -1, -1 ); // display only mgr->setRule( action( 213 ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule ); mgr->insert( separator(), -1, -1 ); @@ -1186,14 +1209,14 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast( vm->getViewModel() ), sm ) ); // disable OCC selectors - getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); + //getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); QListIterator itOCCSel( myOCCSelectors ); while ( itOCCSel.hasNext() ) if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() ) sr->setEnabled(true); - + // disable VTK selectors - getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() ); + //getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() ); QListIterator itVTKSel( myVTKSelectors ); while ( itVTKSel.hasNext() ) if ( LightApp_VTKSelector* sr = itVTKSel.next() ) @@ -1255,7 +1278,7 @@ void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win ) return; const bool ViewOCC = ( win->getViewManager()->getType() == OCCViewer_Viewer::Type() ); -// const bool ViewVTK = ( win->getViewManager()->getType() == SVTK_Viewer::Type() ); + const bool ViewVTK = ( win->getViewManager()->getType() == SVTK_Viewer::Type() ); // disable non-OCC viewframe menu commands // action( 404 )->setEnabled( ViewOCC ); // SKETCHER @@ -1265,7 +1288,7 @@ void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win ) action( 607 )->setEnabled( ViewOCC ); // RemoveInternalWires action( 608 )->setEnabled( ViewOCC ); // AddPointOnEdge // action( 609 )->setEnabled( ViewOCC ); // Free boundaries - action( 413 )->setEnabled( ViewOCC ); // Isos Settings +// action( 413 )->setEnabled( ViewOCC || ViewVTK ); // Isos Settings action( 800 )->setEnabled( ViewOCC ); // Create Group action( 801 )->setEnabled( ViewOCC ); // Edit Group @@ -1350,14 +1373,9 @@ void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm ) QString GeometryGUI::engineIOR() const { - QString anIOR = QString::null; if ( !CORBA::is_nil( GetGeomGen() ) ) - { - CORBA::String_var objStr = getApp()->orb()->object_to_string( GetGeomGen() ); - anIOR = QString( objStr.in() ); -// free( objStr ); ASV : 26.07.06 : commented out because it raises exception and blocks application - } - return anIOR; + return QString( getApp()->orb()->object_to_string( GetGeomGen() ) ); + return ""; } LightApp_Selection* GeometryGUI::createSelection( const QString& client, LightApp_SelectionMgr* mgr ) const @@ -1388,7 +1406,8 @@ void GeometryGUI::createPreferences() setPreferenceProperty( genGroup, "columns", 1 ); int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup, - LightApp_Preferences::Selector, "Geometry", "display_mode" ); + LightApp_Preferences::Selector, + "Geometry", "display_mode" ); addPreference( tr( "PREF_SHADING_COLOR" ), genGroup, LightApp_Preferences::Color, "Geometry", "shading_color" );