From: ouv Date: Mon, 21 Jun 2010 12:43:03 +0000 (+0000) Subject: Issue 0020836: EDF 1364 GEOM : Basic vectors and origin X-Git-Tag: translate_resources_09Jul10~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=784f3578cebe61adbbab60fb69cba3749fa94299;p=modules%2Fgeom.git Issue 0020836: EDF 1364 GEOM : Basic vectors and origin --- diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 26adbc5ec..081aeac31 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -49,6 +49,8 @@ + + diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index ade11bc38..2d85a1c99 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -2655,6 +2655,10 @@ Please, select face, shell or solid and try again PREF_FREE_BOUND_COLOR Color of free boundaries + + PREF_GROUP_AUTO_CREATED_OBJECTS + Automatically created objects + PREF_GROUP_GENERAL General @@ -2703,6 +2707,10 @@ Please, select face, shell or solid and try again PREF_TYPE_OF_MARKER Type + + PREF_VECTORS_LENGTH + Length of vectors + PREF_WIREFRAME_COLOR Default wireframe color diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 6f9d09bde..f3ec1ccf2 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -1195,6 +1195,37 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) if ( viewMenu ) connect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( onViewAboutToShow() ) ); + // 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() ) ) { + 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 ); + } + } + } + } + } + return true; } @@ -1450,6 +1481,13 @@ 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 );