-// 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"
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
-#include <QtxActionMenuMgr.h>
-#include <QtxPopupMgr.h>
-#include <CAM_Module.h>
-
#include <OCCViewer_ViewWindow.h>
#include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_ViewModel.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_VTKSelector.h>
+#include <LightApp_DataObject.h>
#include <SalomeApp_Study.h>
#include <LightApp_Preferences.h>
#include <SALOME_LifeCycleCORBA.hxx>
#include <SALOME_ListIO.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
// External includes
#include <QAction>
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
id == 504 || // MENU OPERATION - ARCHIMEDE
id == 505 || // MENU OPERATION - FILLET
id == 506 || // MENU OPERATION - CHAMFER
- id == 507 ) { // MENU OPERATION - CLIPPING RANGE
+ id == 507 || // MENU OPERATION - CLIPPING RANGE
+ id == 508 ) { // MENU OPERATION - GET SHAPES ON SHAPE
#ifndef WNT
library = getLibrary( "libOperationGUI.so" );
#else
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
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
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
QPixmap pix;
if ( icon_id.length() )
- pix = resMgr->loadPixmap( "GEOM", tr( icon_id.toStdString().c_str() ) );
+ pix = resMgr->loadPixmap( "GEOM", tr( icon_id.toLatin1().constData() ) );
else
- pix = resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+po_id).toStdString().c_str() ), false );
+ pix = resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+po_id).toLatin1().constData() ), false );
if ( !pix.isNull() )
icon = QIcon( pix );
- QString tooltip = tr( (QString( "TOP_" )+po_id).toStdString().c_str() ),
- menu = tr( (QString( "MEN_" )+po_id).toStdString().c_str() ),
- status_bar = tr( (QString( "STB_" )+po_id).toStdString().c_str() );
+ QString tooltip = tr( (QString( "TOP_" )+po_id).toLatin1().constData() ),
+ menu = tr( (QString( "MEN_" )+po_id).toLatin1().constData() ),
+ status_bar = tr( (QString( "STB_" )+po_id).toLatin1().constData() );
createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) );
}
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" );
createGeomAction( 505, "FILLET" );
createGeomAction( 506, "CHAMFER" );
//createGeomAction( 507, "CLIPPING" );
+ createGeomAction( 508, "GET_SHAPES_ON_SHAPES" );
createGeomAction( 9998, "MUL_TRANSFORM" );
createGeomAction( 9995, "EXPLODE_BLOCKS" );
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" );
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)
createMenu( 503, operId, -1 );
createMenu( 504, operId, -1 );
+ createMenu( 508, operId, -1 );
createMenu( separator(), operId, -1 );
createMenu( 505, transId, -1 );
createMenu( 506, transId, -1 );
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 );
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 );
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 );
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
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 ); // -----------
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);
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 );
// Reset actions accelerator keys
//action(111)->setAccel(QKeySequence(CTRL + Key_I)); // Import
//action(121)->setAccel(QKeySequence(CTRL + Key_E)); // Export
- action(111)->setEnabled(true); // Import
- action(121)->setEnabled(true); // Export
+ action(111)->setEnabled( true ); // Import: CTRL + Key_I
+ action(121)->setEnabled( true ); // Export: CTRL + Key_E
+ action( 33)->setEnabled( true ); // Delete: Key_Delete
+ action(901)->setEnabled( true ); // Rename: Key_F2
GUIMap::Iterator it;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
it.value()->activate( application()->desktop() );
LightApp_SelectionMgr* sm = getApp()->selectionMgr();
+
SUIT_ViewManager* vm;
ViewManagerList OCCViewManagers, VTKViewManagers;
while ( itVTK.hasNext() && (vm = itVTK.next()) )
myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast<SVTK_Viewer*>( vm->getViewModel() ), sm ) );
+ //NPAL 19674
+ SALOME_ListIO selected;
+ sm->selectedObjects( selected );
+ sm->clearSelected();
+
// disable OCC selectors
getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() );
QListIterator<GEOMGUI_OCCSelector*> itOCCSel( myOCCSelectors );
while ( itOCCSel.hasNext() )
if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() )
sr->setEnabled(true);
-
+
// disable VTK selectors
getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() );
QListIterator<LightApp_VTKSelector*> itVTKSel( myVTKSelectors );
if ( LightApp_VTKSelector* sr = itVTKSel.next() )
sr->setEnabled(true);
+ sm->setSelectedObjects( selected, true ); //NPAL 19674
+
return true;
}
// Unset actions accelerator keys
//action(111)->setAccel(QKeySequence()); // Import
//action(121)->setAccel(QKeySequence()); // Export
- action(111)->setEnabled(false); // Import
- action(121)->setEnabled(false); // Export
+ action(111)->setEnabled( false ); // Import: CTRL + Key_I
+ action(121)->setEnabled( false ); // Export: CTRL + Key_E
+ action( 33)->setEnabled( false ); // Delete: Key_Delete
+ action(901)->setEnabled( false ); // Rename: Key_F2
+ qDeleteAll(myOCCSelectors);
myOCCSelectors.clear();
getApp()->selectionMgr()->setEnabled( true, OCCViewer_Viewer::Type() );
+ qDeleteAll(myVTKSelectors);
myVTKSelectors.clear();
getApp()->selectionMgr()->setEnabled( true, SVTK_Viewer::Type() );
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
action( 607 )->setEnabled( ViewOCC ); // RemoveInternalWires
action( 608 )->setEnabled( ViewOCC ); // AddPointOnEdge
// action( 609 )->setEnabled( ViewOCC ); // Free boundaries
- action( 413 )->setEnabled( ViewOCC ); // Isos Settings
action( 800 )->setEnabled( ViewOCC ); // Create Group
action( 801 )->setEnabled( ViewOCC ); // Edit Group
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
+LightApp_Selection* GeometryGUI::createSelection() const
{
- return new GEOMGUI_Selection( client, mgr );
+ return new GEOMGUI_Selection();
}
void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
- setPreferenceProperty( genGroup, "columns", 1 );
+ setPreferenceProperty( genGroup, "columns", 2 );
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" );
LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" );
int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId );
+ setPreferenceProperty( VertexGroup, "columns", 2 );
int typeOfMarker = addPreference( tr( "PREF_TYPE_OF_MARKER" ), VertexGroup,
LightApp_Preferences::Selector, "Geometry", "type_of_marker" );
setPreferenceProperty( dispmode, "indexes", anIndexesList );
// Set property for step value for spinboxes
- setPreferenceProperty( step, "min", 0.001 );
+ setPreferenceProperty( step, "min", 1 );
setPreferenceProperty( step, "max", 10000 );
setPreferenceProperty( step, "precision", 3 );