]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Issue 0020836: EDF 1364 GEOM : Basic vectors and origin
authorouv <ouv@opencascade.com>
Mon, 21 Jun 2010 12:43:03 +0000 (12:43 +0000)
committerouv <ouv@opencascade.com>
Mon, 21 Jun 2010 12:43:03 +0000 (12:43 +0000)
resources/SalomeApp.xml
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GeometryGUI.cxx

index 26adbc5ec82fd21644bae68d64b54fb4bd6e156e..081aeac31de4086acd7bae2ab1a20a61b701a7a6 100644 (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"  />
index ade11bc38b3a708b039c11a8417ed0576bff9718..2d85a1c997d98d848ca8618c78ef5e2c92f0ac3d 100644 (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>
index 6f9d09bde62700925c27aa0f3578a3ae535aa377..f3ec1ccf2acf21e129b9fe3fb44064e9dfc5c89c 100644 (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 );