]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Additional fix for issue 0020836.
authorouv <ouv@opencascade.com>
Tue, 22 Jun 2010 11:12:50 +0000 (11:12 +0000)
committerouv <ouv@opencascade.com>
Tue, 22 Jun 2010 11:12:50 +0000 (11:12 +0000)
resources/Makefile.am
resources/SalomeApp.xml
resources/origin_and_vectors.png [new file with mode: 0755]
src/GEOMGUI/GEOM_images.ts
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI.h
src/GEOMGUI/GeometryGUI_Operations.h

index 5212a40b96eeb31fd0ee0e388ece9ca568d88bf8..3ba2946e012b9f214ae732cbf27bfc964a424feb 100644 (file)
@@ -109,6 +109,7 @@ multitranslationdouble.png  \
 multitranslationsimple.png     \
 normale.png                    \
 offset.png                     \
+origin_and_vectors.png         \
 partition.png                  \
 partitionkeep.png              \
 partitionplane.png             \
index 081aeac31de4086acd7bae2ab1a20a61b701a7a6..e57d0cf32da2b48b080fc88068fbd7c7bf1cf742 100644 (file)
@@ -49,8 +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="auto_create_base_objects" value="false"  />
+    <parameter name="base_vectors_length" value="1"  />
     <parameter name="marker_scale"        value="1"  />
     <!-- Input field precisions -->
     <parameter name="def_precision"       value="3"  />
diff --git a/resources/origin_and_vectors.png b/resources/origin_and_vectors.png
new file mode 100755 (executable)
index 0000000..0c5fa9f
Binary files /dev/null and b/resources/origin_and_vectors.png differ
index 96696220c2047ed7335568491c2ee7d45ea81fd5..3dab5a40488426d1810e1c6b698834d88e541754 100644 (file)
             <source>ICO_OFFSET</source>
             <translation>offset.png</translation>
         </message>
+        <message>
+            <source>ICO_ORIGIN_AND_VECTORS</source>
+            <translation>origin_and_vectors.png</translation>
+        </message>
         <message>
             <source>ICO_PARTITION</source>
             <translation>partition.png</translation>
index 2d85a1c997d98d848ca8618c78ef5e2c92f0ac3d..aac0da797f0ddb53b165ba2f8e82dd6e491993d8 100644 (file)
@@ -2359,6 +2359,10 @@ Please, select face, shell or solid and try again</translation>
             <source>MEN_OPERATIONS</source>
             <translation>Operations</translation>
         </message>
+        <message>
+            <source>MEN_ORIGIN_AND_VECTORS</source>
+            <translation>Origin and Base Vectors</translation>
+        </message>
         <message>
             <source>MEN_PARTITION</source>
             <translation>Partition</translation>
@@ -2647,6 +2651,10 @@ Please, select face, shell or solid and try again</translation>
             <source>GEOM_PREF_param_tol_precision</source>
             <translation>Parametric tolerance precision</translation>
         </message>
+        <message>
+            <source>PREF_AUTO_CREATE</source>
+            <translation>Auto create</translation>
+        </message>
         <message>
             <source>PREF_DISPLAY_MODE</source>
             <translation>Default display mode</translation>
@@ -2656,8 +2664,8 @@ Please, select face, shell or solid and try again</translation>
             <translation>Color of free boundaries</translation>
         </message>
         <message>
-            <source>PREF_GROUP_AUTO_CREATED_OBJECTS</source>
-            <translation>Automatically created objects</translation>
+            <source>PREF_GROUP_ORIGIN_AND_BASE_VECTORS</source>
+            <translation>Origin and base vectors</translation>
         </message>
         <message>
             <source>PREF_GROUP_GENERAL</source>
@@ -2708,8 +2716,8 @@ Please, select face, shell or solid and try again</translation>
             <translation>Type</translation>
         </message>
         <message>
-            <source>PREF_VECTORS_LENGTH</source>
-            <translation>Length of vectors</translation>
+            <source>PREF_BASE_VECTORS_LENGTH</source>
+            <translation>Length of base vectors</translation>
         </message>
         <message>
             <source>PREF_WIREFRAME_COLOR</source>
@@ -2983,6 +2991,10 @@ Please, select face, shell or solid and try again</translation>
             <source>STB_OFFSET</source>
             <translation>Offset surface</translation>
         </message>
+        <message>
+            <source>STB_ORIGIN_AND_VECTORS</source>
+            <translation>Create an origin and base Vectors</translation>
+        </message>
         <message>
             <source>STB_PARTITION</source>
             <translation>Make a partition</translation>
@@ -3503,6 +3515,10 @@ Please, select face, shell or solid and try again</translation>
             <source>TOP_OFFSET</source>
             <translation>Offset surface</translation>
         </message>
+        <message>
+            <source>TOP_ORIGIN_AND_VECTORS</source>
+            <translation>Create an origin and base Vectors</translation>
+        </message>
         <message>
             <source>TOP_PARTITION</source>
             <translation>Partition</translation>
index f3ec1ccf2acf21e129b9fe3fb44064e9dfc5c89c..31fb62af827ee06fade91daf255c3c839b8d2ee6 100644 (file)
@@ -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<SalomeApp_Study*>( 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<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 );
-          }
-        }
+        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 )
index 87e0086b6671655261bbf6c97f9309149196f91e..69cd94753c1dd1a0f5f6c9fdab04eba24f7a4e70 100644 (file)
@@ -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!!!
 
index 5b0be0dfa5fe9724edf3b94d78267c2267a74616..311dbbe76e4c4a48bd8bf22a75d15573e75523b2 100644 (file)
@@ -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