Issue 0020836: EDF 1364 GEOM : Basic vectors and origin

This commit is contained in:
ouv 2010-06-21 12:43:03 +00:00
parent 9388b6fc9a
commit 784f3578ce
3 changed files with 48 additions and 0 deletions

View File

@ -49,6 +49,8 @@
<parameter name="isos_color" value="200, 200, 200" />
<parameter name="type_of_marker" value="1" />
<parameter name="deflection_coeff" value="0.001" />
<parameter name="auto_created_objects" value="false" />
<parameter name="auto_vectors_length" value="1" />
<parameter name="marker_scale" value="1" />
<!-- Input field precisions -->
<parameter name="def_precision" value="3" />

View File

@ -2655,6 +2655,10 @@ Please, select face, shell or solid and try again</translation>
<source>PREF_FREE_BOUND_COLOR</source>
<translation>Color of free boundaries</translation>
</message>
<message>
<source>PREF_GROUP_AUTO_CREATED_OBJECTS</source>
<translation>Automatically created objects</translation>
</message>
<message>
<source>PREF_GROUP_GENERAL</source>
<translation>General</translation>
@ -2703,6 +2707,10 @@ Please, select face, shell or solid and try again</translation>
<source>PREF_TYPE_OF_MARKER</source>
<translation>Type</translation>
</message>
<message>
<source>PREF_VECTORS_LENGTH</source>
<translation>Length of vectors</translation>
</message>
<message>
<source>PREF_WIREFRAME_COLOR</source>
<translation>Default wireframe color</translation>

View File

@ -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<SalomeApp_Study*>( 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 );