From: ouv Date: Tue, 22 Jun 2010 11:12:50 +0000 (+0000) Subject: Additional fix for issue 0020836. X-Git-Tag: translate_resources_09Jul10~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ad2e1f88faa914216e72e8b6e6f4e13e33a0f24b;p=modules%2Fgeom.git Additional fix for issue 0020836. --- diff --git a/resources/Makefile.am b/resources/Makefile.am index 5212a40b9..3ba2946e0 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -109,6 +109,7 @@ multitranslationdouble.png \ multitranslationsimple.png \ normale.png \ offset.png \ +origin_and_vectors.png \ partition.png \ partitionkeep.png \ partitionplane.png \ diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 081aeac31..e57d0cf32 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -49,8 +49,8 @@ - - + + diff --git a/resources/origin_and_vectors.png b/resources/origin_and_vectors.png new file mode 100755 index 000000000..0c5fa9f72 Binary files /dev/null and b/resources/origin_and_vectors.png differ diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 96696220c..3dab5a404 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -905,6 +905,10 @@ ICO_OFFSET offset.png + + ICO_ORIGIN_AND_VECTORS + origin_and_vectors.png + ICO_PARTITION partition.png diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 2d85a1c99..aac0da797 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -2359,6 +2359,10 @@ Please, select face, shell or solid and try again MEN_OPERATIONS Operations + + MEN_ORIGIN_AND_VECTORS + Origin and Base Vectors + MEN_PARTITION Partition @@ -2647,6 +2651,10 @@ Please, select face, shell or solid and try again GEOM_PREF_param_tol_precision Parametric tolerance precision + + PREF_AUTO_CREATE + Auto create + PREF_DISPLAY_MODE Default display mode @@ -2656,8 +2664,8 @@ Please, select face, shell or solid and try again Color of free boundaries - PREF_GROUP_AUTO_CREATED_OBJECTS - Automatically created objects + PREF_GROUP_ORIGIN_AND_BASE_VECTORS + Origin and base vectors PREF_GROUP_GENERAL @@ -2708,8 +2716,8 @@ Please, select face, shell or solid and try again Type - PREF_VECTORS_LENGTH - Length of vectors + PREF_BASE_VECTORS_LENGTH + Length of base vectors PREF_WIREFRAME_COLOR @@ -2983,6 +2991,10 @@ Please, select face, shell or solid and try again STB_OFFSET Offset surface + + STB_ORIGIN_AND_VECTORS + Create an origin and base Vectors + STB_PARTITION Make a partition @@ -3503,6 +3515,10 @@ Please, select face, shell or solid and try again TOP_OFFSET Offset surface + + TOP_ORIGIN_AND_VECTORS + Create an origin and base Vectors + TOP_PARTITION Partition diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index f3ec1ccf2..31fb62af8 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -360,6 +360,9 @@ void GeometryGUI::OnGUIEvent( int id ) QString libName; // find corresponding GUI library switch ( id ) { + case GEOMOp::OpOriginAndVectors: // MENU BASIC - ORIGIN AND BASE VECTORS + createOriginAndBaseVectors(); // internal operation + return; case GEOMOp::OpImport: // MENU FILE - IMPORT case GEOMOp::OpExport: // MENU FILE - EXPORT case GEOMOp::OpSelectVertex: // POPUP MENU - SELECT ONLY - VERTEX @@ -404,7 +407,7 @@ void GeometryGUI::OnGUIEvent( int id ) case GEOMOp::OpVector: // MENU BASIC - VECTOR case GEOMOp::OpPlane: // MENU BASIC - PLANE case GEOMOp::OpCurve: // MENU BASIC - CURVE - case GEOMOp::OpLCS: // MENU BASIC - REPAIR + case GEOMOp::OpLCS: // MENU BASIC - LOCAL COORDINATE SYSTEM libName = "BasicGUI"; break; case GEOMOp::OpBox: // MENU PRIMITIVE - BOX @@ -585,7 +588,36 @@ void GeometryGUI::createGeomAction( const int id, const QString& label, const QS this, SLOT( OnGUIEvent() ) ); } - +//======================================================================= +// function : createGeomAction +// purpose : +//======================================================================= +void GeometryGUI::createOriginAndBaseVectors() +{ + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + if( appStudy ) { + _PTR(Study) studyDS = appStudy->studyDS(); + if( studyDS && !CORBA::is_nil( GetGeomGen() ) ) { + GEOM::GEOM_IBasicOperations_var aBasicOperations = GetGeomGen()->GetIBasicOperations( studyDS->StudyId() ); + if( !aBasicOperations->_is_nil() ) { + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + double aLength = aResourceMgr->doubleValue( "Geometry", "base_vectors_length", 1.0 ); + GEOM::GEOM_Object_var anOrigin = aBasicOperations->MakePointXYZ( 0.0, 0.0, 0.0 ); + GEOM::GEOM_Object_var anOX = aBasicOperations->MakeVectorDXDYDZ( aLength, 0.0, 0.0 ); + GEOM::GEOM_Object_var anOY = aBasicOperations->MakeVectorDXDYDZ( 0.0, aLength, 0.0 ); + GEOM::GEOM_Object_var anOZ = aBasicOperations->MakeVectorDXDYDZ( 0.0, 0.0, aLength ); + + SALOMEDS::Study_var aDSStudy = ClientStudyToStudy( studyDS ); + GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOrigin, "O" ); + GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOX, "OX" ); + GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOY, "OY" ); + GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOZ, "OZ" ); + + getApp()->updateObjectBrowser( false ); + } + } + } +} //======================================================================= // function : GeometryGUI::initialize() @@ -611,6 +643,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpVector, "VECTOR" ); createGeomAction( GEOMOp::OpPlane, "PLANE" ); createGeomAction( GEOMOp::OpLCS, "LOCAL_CS" ); + createGeomAction( GEOMOp::OpOriginAndVectors, "ORIGIN_AND_VECTORS" ); createGeomAction( GEOMOp::OpBox, "BOX" ); createGeomAction( GEOMOp::OpCylinder, "CYLINDER" ); @@ -761,6 +794,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( GEOMOp::OpVector, basicId, -1 ); createMenu( GEOMOp::OpPlane, basicId, -1 ); createMenu( GEOMOp::OpLCS, basicId, -1 ); + createMenu( GEOMOp::OpOriginAndVectors, basicId, -1 ); int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 ); createMenu( GEOMOp::OpBox, primId, -1 ); @@ -928,6 +962,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createTool( GEOMOp::OpVector, basicTbId ); createTool( GEOMOp::OpPlane, basicTbId ); createTool( GEOMOp::OpLCS, basicTbId ); + createTool( GEOMOp::OpOriginAndVectors, basicTbId ); int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) ); createTool( GEOMOp::OpBox, primTbId ); @@ -1197,31 +1232,14 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) // 0020836 (Basic vectors and origin) SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - bool isAutoCreatedObjects = aResourceMgr->booleanValue( "Geometry", "auto_created_objects", false ); - if( isAutoCreatedObjects && !CORBA::is_nil( GetGeomGen() ) ) { + if( aResourceMgr->booleanValue( "Geometry", "auto_create_base_objects", false ) ) { SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); if( appStudy ) { _PTR(Study) studyDS = appStudy->studyDS(); if( studyDS ) { _PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM"); - if( !aSComponent ) { - GEOM::GEOM_IBasicOperations_var aBasicOperations = GetGeomGen()->GetIBasicOperations( studyDS->StudyId() ); - if( !aBasicOperations->_is_nil() ) { - double aLength = aResourceMgr->doubleValue( "Geometry", "auto_vectors_length", 1.0 ); - GEOM::GEOM_Object_var anOrigin = aBasicOperations->MakePointXYZ( 0.0, 0.0, 0.0 ); - GEOM::GEOM_Object_var anOX = aBasicOperations->MakeVectorDXDYDZ( aLength, 0.0, 0.0 ); - GEOM::GEOM_Object_var anOY = aBasicOperations->MakeVectorDXDYDZ( 0.0, aLength, 0.0 ); - GEOM::GEOM_Object_var anOZ = aBasicOperations->MakeVectorDXDYDZ( 0.0, 0.0, aLength ); - - SALOMEDS::Study_var aDSStudy = ClientStudyToStudy( studyDS ); - GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOrigin, "O" ); - GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOX, "OX" ); - GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOY, "OY" ); - GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOZ, "OZ" ); - - getApp()->updateObjectBrowser( false ); - } - } + if( !aSComponent ) // create objects automatically only if there is no GEOM component + createOriginAndBaseVectors(); } } } @@ -1481,13 +1499,6 @@ void GeometryGUI::createPreferences() int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup, LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" ); - int autoGroup = addPreference( tr( "PREF_GROUP_AUTO_CREATED_OBJECTS" ), tabId, - LightApp_Preferences::Auto, "Geometry", "auto_created_objects" ); - int autoVectorsLength = addPreference( tr( "PREF_VECTORS_LENGTH" ), autoGroup, - LightApp_Preferences::DblSpin, "Geometry", "auto_vectors_length" ); - setPreferenceProperty( autoVectorsLength, "min", 0.01 ); - setPreferenceProperty( autoVectorsLength, "max", 1000 ); - // Quantities with individual precision settings int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId ); setPreferenceProperty( precGroup, "columns", 2 ); @@ -1576,6 +1587,18 @@ void GeometryGUI::createPreferences() setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList ); setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList ); + + int originGroup = addPreference( tr( "PREF_GROUP_ORIGIN_AND_BASE_VECTORS" ), tabId ); + setPreferenceProperty( originGroup, "columns", 2 ); + + int baseVectorsLength = addPreference( tr( "PREF_BASE_VECTORS_LENGTH" ), originGroup, + LightApp_Preferences::DblSpin, "Geometry", "base_vectors_length" ); + setPreferenceProperty( baseVectorsLength, "min", 0.01 ); + setPreferenceProperty( baseVectorsLength, "max", 1000 ); + + addPreference( tr( "PREF_AUTO_CREATE" ), originGroup, + LightApp_Preferences::Bool, "Geometry", "auto_create_base_objects" ); + } void GeometryGUI::preferencesChanged( const QString& section, const QString& param ) diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 87e0086b6..69cd94753 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -153,6 +153,8 @@ private: const bool isExpandAll = false, const bool isOCC = false, const int parentId = -1 ); + void createOriginAndBaseVectors(); + public: static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!! diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index 5b0be0dfa..311dbbe76 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -69,6 +69,7 @@ namespace GEOMOp { OpPlane = 3006, // MENU NEW ENTITY - BASIC - PLANE OpCurve = 3007, // MENU NEW ENTITY - BASIC - CURVE OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM + OpOriginAndVectors = 3009, // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS // PrimitiveGUI --------------//-------------------------------- OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER