-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// GEOM GEOMGUI : GUI for Geometry component
// File : GeometryGUI.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
+#include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
+#include "Python.h"
#include "GeometryGUI.h"
#include "GeometryGUI_Operations.h"
#include "GEOMGUI_OCCSelector.h"
libName = "BlocksGUI";
break;
case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base)
- //@@ insert new functions before this line @@//
+ case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
+// case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
+ //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
libName = "AdvancedGUI";
break;
default:
createGeomAction( GEOMOp::OpHideChildren, "POP_HIDE_CHILDREN" );
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
- //@@ insert new functions before this line @@//
+ createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
+// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
+ //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create menus --------------------------
createMenu( GEOMOp::OpPipe, genId, -1 );
int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
- //@@ insert new functions before this line @@//
+ createMenu( GEOMOp::OpPipeTShape, advId, -1 );
+// createMenu( GEOMOp::OpPipeTShapeGroups, advId, -1 );
+ //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
createMenu( separator(), newEntId, -1 );
createTool( GEOMOp::OpSolid, buildTbId );
createTool( GEOMOp::OpCompound, buildTbId );
+ int measureTbId = createTool( tr( "TOOL_MEASURES" ) );
+ createTool( GEOMOp::OpPointCoordinates, measureTbId );
+ createTool( GEOMOp::OpProperties, measureTbId );
+ createTool( GEOMOp::OpCenterMass, measureTbId );
+ createTool( GEOMOp::OpInertia, measureTbId );
+ createTool( GEOMOp::OpNormale, measureTbId );
+ createTool( separator(), measureTbId );
+ createTool( GEOMOp::OpBoundingBox, measureTbId );
+ createTool( GEOMOp::OpMinDistance, measureTbId );
+ createTool( GEOMOp::OpAngle, measureTbId );
+ createTool( GEOMOp::OpTolerance , measureTbId );
+ createTool( separator(), measureTbId );
+ createTool( GEOMOp::OpFreeBoundaries, measureTbId );
+ createTool( GEOMOp::OpFreeFaces, measureTbId );
+ createTool( separator(), measureTbId );
+ createTool( GEOMOp::OpWhatIs, measureTbId );
+ createTool( GEOMOp::OpCheckShape, measureTbId );
+ createTool( GEOMOp::OpCheckCompound, measureTbId );
+
int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
- //@@ insert new functions before this line @@//
+ createTool( GEOMOp::OpPipeTShape, advancedTbId );
+ //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create popup menus --------------------------
mgr->insert( action( GEOMOp::OpIsos ), -1, -1 ); // isos
mgr->setRule( action( GEOMOp::OpIsos ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpDeflection ), -1, -1 ); // deflection
- mgr->setRule( action( GEOMOp::OpDeflection ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpDeflection ), "selcount>0 and isVisible and client='OCCViewer'", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker
mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg( GEOM_POINT ), QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
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(GEOMOp::OpSelectVertex), selectolnyId, -1); //Vertex
+ int selectonlyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu
+ mgr->insert( action(GEOMOp::OpSelectVertex), selectonlyId, -1); //Vertex
mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly + " and selectionmode='VERTEX'", QtxPopupMgr::ToggleRule);
- mgr->insert( action(GEOMOp::OpSelectEdge), selectolnyId, -1); //Edge
+ mgr->insert( action(GEOMOp::OpSelectEdge), selectonlyId, -1); //Edge
mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly + " and selectionmode='EDGE'", QtxPopupMgr::ToggleRule);
- mgr->insert( action(GEOMOp::OpSelectWire), selectolnyId, -1); //Wire
+ mgr->insert( action(GEOMOp::OpSelectWire), selectonlyId, -1); //Wire
mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly + " and selectionmode='WIRE'", QtxPopupMgr::ToggleRule);
- mgr->insert( action(GEOMOp::OpSelectFace), selectolnyId, -1); //Face
+ mgr->insert( action(GEOMOp::OpSelectFace), selectonlyId, -1); //Face
mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly + " and selectionmode='FACE'", QtxPopupMgr::ToggleRule);
- mgr->insert( action(GEOMOp::OpSelectShell), selectolnyId, -1); //Shell
+ mgr->insert( action(GEOMOp::OpSelectShell), selectonlyId, -1); //Shell
mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly + " and selectionmode='SHELL'", QtxPopupMgr::ToggleRule);
- mgr->insert( action(GEOMOp::OpSelectSolid), selectolnyId, -1); //Solid
+ mgr->insert( action(GEOMOp::OpSelectSolid), selectonlyId, -1); //Solid
mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly + " and selectionmode='SOLID'", QtxPopupMgr::ToggleRule);
- mgr->insert( action(GEOMOp::OpSelectCompound), selectolnyId, -1); //Compound
+ mgr->insert( action(GEOMOp::OpSelectCompound), selectonlyId, -1); //Compound
mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly + " and selectionmode='COMPOUND'", QtxPopupMgr::ToggleRule);
- mgr->insert( separator(), selectolnyId, -1);
- mgr->insert( action(GEOMOp::OpSelectAll), selectolnyId, -1); //Clear selection filter
+ mgr->insert( separator(), selectonlyId, -1);
+ mgr->insert( action(GEOMOp::OpSelectAll), selectonlyId, -1); //Clear selection filter
mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only
setMenuShown( true );
setToolShown( true );
+ // import Python module that manages GEOM plugins (need to be here because SalomePyQt API uses active module)
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* pluginsmanager=PyImport_ImportModule((char*)"salome_pluginsmanager");
+ if(pluginsmanager==NULL)
+ PyErr_Print();
+ else
+ {
+ PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"geom","New Entity","Other");
+ if(result==NULL)
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+ PyGILState_Release(gstate);
+ // end of GEOM plugins loading
+
connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )
{
- if ( vm->getType() == OCCViewer_Viewer::Type() )
+ if ( vm && vm->getType() == OCCViewer_Viewer::Type() )
{
qDebug( "connect" );
connect( vm, SIGNAL( keyPress ( SUIT_ViewWindow*, QKeyEvent* ) ),
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
+
+ // Quantities with individual precision settings
+ int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId );
+ setPreferenceProperty( precGroup, "columns", 2 );
+
+ const int nbQuantities = 8;
+ int prec[nbQuantities], ii = 0;
+ prec[ii++] = addPreference( tr( "GEOM_PREF_length_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "length_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_angle_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "angle_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_len_tol_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_ang_tol_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_weight_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "weight_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_density_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "density_precision" );
+ prec[ii++] = addPreference( tr( "GEOM_PREF_parametric_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" );
+ prec[ii ] = addPreference( tr( "GEOM_PREF_param_tol_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" );
+
+ // Set property for precision value for spinboxes
+ for ( ii = 0; ii < nbQuantities; ii++ ){
+ setPreferenceProperty( prec[ii], "min", -14 );
+ setPreferenceProperty( prec[ii], "max", 14 );
+ setPreferenceProperty( prec[ii], "precision", 2 );
+ }
int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId );
setPreferenceProperty( VertexGroup, "columns", 2 );
QList<QVariant> aMarkerScaleIndicesList;
QStringList aMarkerScaleValuesList;
- for ( int i = GEOM::MS_10; i <= GEOM::MS_70; i++ ) {
- aMarkerScaleIndicesList << i;
- aMarkerScaleValuesList << QString::number( (i-(int)GEOM::MS_10)*0.5 + 1.0 );
+ for ( int iii = GEOM::MS_10; iii <= GEOM::MS_70; iii++ ) {
+ aMarkerScaleIndicesList << iii;
+ aMarkerScaleValuesList << QString::number( (iii-(int)GEOM::MS_10)*0.5 + 1.0 );
}
setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );