From ad2e1f88faa914216e72e8b6e6f4e13e33a0f24b Mon Sep 17 00:00:00 2001 From: ouv Date: Tue, 22 Jun 2010 11:12:50 +0000 Subject: [PATCH] Additional fix for issue 0020836. --- resources/Makefile.am | 1 + resources/SalomeApp.xml | 4 +- resources/origin_and_vectors.png | Bin 0 -> 3309 bytes src/GEOMGUI/GEOM_images.ts | 4 ++ src/GEOMGUI/GEOM_msg_en.ts | 24 ++++++-- src/GEOMGUI/GeometryGUI.cxx | 81 +++++++++++++++++---------- src/GEOMGUI/GeometryGUI.h | 2 + src/GEOMGUI/GeometryGUI_Operations.h | 1 + 8 files changed, 82 insertions(+), 35 deletions(-) create mode 100755 resources/origin_and_vectors.png 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 0000000000000000000000000000000000000000..0c5fa9f7259794de4f293d9fb12e2f0d4eadc837 GIT binary patch literal 3309 zcmVKLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&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*a9k^mHoMFH;kzAsk4 zo4_r*YPV;v8a-Vo6eO3+Njx5p+F~SFRIH=bRr#3B_5rJCj%B+Dlx;&eF#c}<)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 -- 2.39.2