]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Feature #228: Import of polylines from GEOM.
authormzn <mzn@opencascade.com>
Wed, 18 Dec 2013 12:57:07 +0000 (12:57 +0000)
committermzn <mzn@opencascade.com>
Wed, 18 Dec 2013 12:57:07 +0000 (12:57 +0000)
Implementation of GUI part.

src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx
src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.h
src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_Tool.cxx
src/HYDROGUI/HYDROGUI_Tool.h
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index e7adb3cd452c2689e96d166d56fed1c03e9686ce..95163188aec5d43ccbf66608903c2c774b392956 100644 (file)
@@ -73,7 +73,7 @@ set(PROJECT_HEADERS
     HYDROGUI_ImportGeomObjectOp.h
     HYDROGUI_ImportObstacleFromFileOp.h
     HYDROGUI_ExportCalculationOp.h
-    HYDROGUI_ObstacleDlg.h
+    HYDROGUI_GeomObjectDlg.h
     HYDROGUI_SetColorOp.h
     HYDROGUI_ColorDlg.h
     HYDROGUI_ImportProfilesOp.h
@@ -153,7 +153,7 @@ set(PROJECT_SOURCES
     HYDROGUI_ImportGeomObjectOp.cxx
     HYDROGUI_ImportObstacleFromFileOp.cxx
     HYDROGUI_ExportCalculationOp.cxx
-    HYDROGUI_ObstacleDlg.cxx
+    HYDROGUI_GeomObjectDlg.cxx
     HYDROGUI_SetColorOp.cxx
     HYDROGUI_ColorDlg.cxx
     HYDROGUI_ImportProfilesOp.cxx
index b993882982b09c8c9e9a4700130d93561a9999a5..344f8cad83345a0d3efadd30b5214e1418ac8919 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "HYDROGUI_ImportGeomObjectOp.h"
 
-#include "HYDROGUI_ObstacleDlg.h"
+#include "HYDROGUI_GeomObjectDlg.h"
 
 #include "HYDROGUI_DataModel.h"
 #include "HYDROGUI_Module.h"
@@ -30,6 +30,7 @@
 #include "HYDROGUI_UpdateFlags.h"
 
 #include <HYDROData_Obstacle.h>
+#include <HYDROData_PolylineXY.h>
 #include <HYDROData_Iterator.h>
 
 #include <GEOMBase.h>
@@ -46,7 +47,11 @@ HYDROGUI_ImportGeomObjectOp::HYDROGUI_ImportGeomObjectOp( HYDROGUI_Module* theMo
   myOpType ( theOpType ),
   myIsToShowPanel ( theIsToShowPanel )
 {
-  setName( tr( "IMPORT_GEOM_OBJECT" ) );
+  if ( myOpType == ImportSelectedAsPolyline ) {
+    setName( tr( "IMPORT_GEOM_OBJECT_AS_POLYLINE" ) );
+  } else {
+    setName( tr( "IMPORT_GEOM_OBJECT_AS_OBSTACLE" ) );
+  }
 }
 
 HYDROGUI_ImportGeomObjectOp::~HYDROGUI_ImportGeomObjectOp()
@@ -59,17 +64,21 @@ void HYDROGUI_ImportGeomObjectOp::startOperation()
 
   // Get GEOM objects to import
   myGeomObjects.clear();
-  if ( myOpType == ImportCreated ) {
+  if ( myOpType == ImportCreatedAsObstacle ) {
     myGeomObjects = module()->GetGeomObjectsToImport();
-  } else if ( myOpType == ImportSelected ) {
-    myGeomObjects = HYDROGUI_Tool::GetSelectedGeomObjects( module() );
+  } else if ( myOpType == ImportSelectedAsObstacle ) {
+    myGeomObjects = 
+      HYDROGUI_Tool::GetSelectedGeomObjects( module(), getObstacleTypes() );
+  } else if ( myOpType == ImportSelectedAsPolyline ) {
+    myGeomObjects = 
+      HYDROGUI_Tool::GetSelectedGeomObjects( module(), getPolylineTypes() );
   }
 
-  HYDROGUI_ObstacleDlg* aPanel = 0;
+  HYDROGUI_GeomObjectDlg* aPanel = 0;
 
   if ( myGeomObjects.count() == 1 ) {
     // Get panel
-    aPanel = ::qobject_cast<HYDROGUI_ObstacleDlg*>( inputPanel() );
+    aPanel = ::qobject_cast<HYDROGUI_GeomObjectDlg*>( inputPanel() );
 
     if ( aPanel ) {
       // Reset the panel state
@@ -86,11 +95,16 @@ void HYDROGUI_ImportGeomObjectOp::startOperation()
         }
       }
 
-      // Pass the existing obstacle names to the panel
-      QStringList anObstacles = 
-        HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_OBSTACLE );
+      // Pass the existing object names to the panel
+      QStringList anExistingNames;
+      if ( myOpType == ImportCreatedAsObstacle || 
+           myOpType == ImportSelectedAsObstacle ) {
+        anExistingNames = HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_OBSTACLE );
+      } else if ( myOpType == ImportSelectedAsPolyline ) {
+        anExistingNames = HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_POLYLINEXY );
+      }
 
-      aPanel->setObstacleNames( anObstacles );
+      aPanel->setObjectNames( anExistingNames );
     }
   }
 
@@ -119,34 +133,35 @@ bool HYDROGUI_ImportGeomObjectOp::processApply( int& theUpdateFlags,
     return false;
   }
 
-  QString anObstacleName;
-  Handle(HYDROData_Obstacle) anObstacleToEdit;  
+  QString anObjectName;
+  Handle(HYDROData_Entity) anObjectToEdit;  
+  ObjectKind anObjectKind = 
+    myOpType == ImportSelectedAsPolyline ? KIND_POLYLINEXY : KIND_OBSTACLE;
 
   if ( myGeomObjects.count() == 1 ) {
     // Get panel
-    HYDROGUI_ObstacleDlg* aPanel = ::qobject_cast<HYDROGUI_ObstacleDlg*>( inputPanel() );
+    HYDROGUI_GeomObjectDlg* aPanel = ::qobject_cast<HYDROGUI_GeomObjectDlg*>( inputPanel() );
     if ( aPanel ) {
-      // Check obstacle name
-      anObstacleName = aPanel->getObstacleName().simplified();
-      if ( anObstacleName.isEmpty() ) {
+      // Check object name
+      anObjectName = aPanel->getObjectName().simplified();
+      if ( anObjectName.isEmpty() ) {
         theErrorMsg = tr( "INCORRECT_OBJECT_NAME" );
         return false;
       }
 
-      // Get obstacle to edit
-      QString anEditedName = aPanel->getEditedObstacleName().simplified();
+      // Get object to edit
+      QString anEditedName = aPanel->getEditedObjectName().simplified();
 
       if ( !anEditedName.isEmpty() ) {
-        anObstacleToEdit = Handle(HYDROData_Obstacle)::DownCast(
-          HYDROGUI_Tool::FindObjectByName( module(), anEditedName, KIND_OBSTACLE ) );
+        anObjectToEdit = HYDROGUI_Tool::FindObjectByName( module(), anEditedName, anObjectKind );
       }
     }
 
-    if( anObstacleToEdit.IsNull() || anObstacleToEdit->GetName() != anObstacleName ) {
+    if( anObjectToEdit.IsNull() || anObjectToEdit->GetName() != anObjectName ) {
       // check that there are no other objects with the same name in the document
-      Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObstacleName );
+      Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName/*, anObjectKind*/ );
       if( !anObject.IsNull() ) {
-        theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObstacleName );
+        theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName );
         return false;
       }
     }
@@ -154,45 +169,60 @@ bool HYDROGUI_ImportGeomObjectOp::processApply( int& theUpdateFlags,
 
   bool anIsOk = false;
 
-  // Get the created object as SObject
+  // Get the GEOM object as SObject
   foreach ( const QString& anEntry, myGeomObjects ) {
     _PTR(SObject) aSObject( aStudy->studyDS()->FindObjectID( qPrintable(anEntry)) );
-    if (aSObject) {
+    if ( aSObject ) {
       // Get the corresponding TopoDS_Shape
       TopoDS_Shape aShape = GEOMBase::GetShapeFromIOR( aSObject->GetIOR().c_str() );
-      if ( !aShape.IsNull() ) {
-        // Create/edit an obstacle object
-        Handle(HYDROData_Obstacle) anObstacle; 
+      if ( aShape.IsNull() ) {
+        continue;
+      }
+      
+      // Create/edit an object
+      Handle(HYDROData_Entity) anObject; 
 
-        if ( anObstacleToEdit.IsNull() ) {
-          anObstacle = 
+      if ( anObjectToEdit.IsNull() ) {
+        if ( myOpType == ImportCreatedAsObstacle || myOpType == ImportSelectedAsObstacle ) {
+          anObject = 
             Handle(HYDROData_Obstacle)::DownCast( doc()->CreateObject(KIND_OBSTACLE) );
-          
+          Handle(HYDROData_Obstacle) anObstacle = Handle(HYDROData_Obstacle)::DownCast( anObject );
           anObstacle->SetFillingColor( HYDROData_Obstacle::DefaultFillingColor() );
           anObstacle->SetBorderColor( HYDROData_Obstacle::DefaultBorderColor() );
-        } else {
-          anObstacle = anObstacleToEdit;
+        } else if ( myOpType == ImportSelectedAsPolyline ) {
+          anObject = 
+            Handle(HYDROData_PolylineXY)::DownCast( doc()->CreateObject(KIND_POLYLINEXY) );
         }
+      } else {
+        anObject = anObjectToEdit;
+      }
 
-        // Set name
-        if ( anObstacleName.isEmpty() ) {
-          QString aName = QString::fromStdString( aSObject->GetName() );
-          anObstacleName = HYDROGUI_Tool::GenerateObjectName( 
-            module(), aName, QStringList(), true );
-        }
-        if ( anObstacle->GetName() != anObstacleName ) {
-          anObstacle->SetName( anObstacleName );
-        }
+      // Set name
+      if ( anObjectName.isEmpty() ) {
+        QString aName = QString::fromStdString( aSObject->GetName() );
+        anObjectName = HYDROGUI_Tool::GenerateObjectName( 
+          module(), aName, QStringList(), true );
+      }
+      if ( anObject->GetName() != anObjectName ) {
+        anObject->SetName( anObjectName );
+      }
 
-        anObstacleName.clear();
+      anObjectName.clear();
 
-        // Set shape
+      // Set shape
+      if ( myOpType == ImportCreatedAsObstacle || myOpType == ImportSelectedAsObstacle ) {
+        Handle(HYDROData_Obstacle) anObstacle = Handle(HYDROData_Obstacle)::DownCast( anObject );
         anObstacle->SetShape3D( aShape );
-
-        anObstacle->Update();
-
-        // Set operation status
         anIsOk = true;
+      } else if ( myOpType == ImportSelectedAsPolyline ) {
+        Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( anObject );
+        // TODO ISSUE #228: set the shape ("aShape") to the polyline
+        // anIsOk = aPolyline->setShape( aShape );
+      }
+
+      // Check operation status
+      if ( anIsOk ) {
+        anObject->Update();
         theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
       }
     }
@@ -205,8 +235,30 @@ HYDROGUI_InputPanel* HYDROGUI_ImportGeomObjectOp::createInputPanel() const
 {
   HYDROGUI_InputPanel* aPanel = 0;
   if ( myIsToShowPanel ) {
-    aPanel = new HYDROGUI_ObstacleDlg( module(), getName() );
+    QString anObjectTypeName = 
+      myOpType == ImportSelectedAsPolyline ? tr("DEFAULT_POLYLINE_NAME") :
+                  tr("DEFAULT_OBSTACLE_NAME");
+    aPanel = new HYDROGUI_GeomObjectDlg( module(), getName(), anObjectTypeName );
   }
 
   return aPanel;
+}
+
+QList<GEOM::shape_type> HYDROGUI_ImportGeomObjectOp::getObstacleTypes()
+{
+  QList<GEOM::shape_type> aTypes;
+
+  aTypes << GEOM::COMPOUND << GEOM::COMPOUND << GEOM::SOLID << 
+            GEOM::SHELL << GEOM::FACE << GEOM::SHAPE;
+
+  return aTypes;
+}
+
+QList<GEOM::shape_type> HYDROGUI_ImportGeomObjectOp::getPolylineTypes()
+{
+  QList<GEOM::shape_type> aTypes;
+
+  aTypes << GEOM::WIRE << GEOM::EDGE;
+
+  return aTypes;
 }
\ No newline at end of file
index 6888d34a162c0ee97e5f5b1044a63ff6b4b91d61..4b18258499033bb00d8cf399c261eeea88f63130 100644 (file)
 
 #include <QStringList>
 
+// IDL includes
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+
 class HYDROGUI_InputPanel;
 
 class HYDROGUI_ImportGeomObjectOp : public HYDROGUI_Operation
@@ -34,7 +38,9 @@ class HYDROGUI_ImportGeomObjectOp : public HYDROGUI_Operation
   Q_OBJECT
 
 public:
-  enum OperationType { ImportCreated, ImportSelected };
+  enum OperationType { ImportCreatedAsObstacle, 
+                       ImportSelectedAsObstacle,
+                       ImportSelectedAsPolyline };
 
 public:
   HYDROGUI_ImportGeomObjectOp( HYDROGUI_Module* theModule,
@@ -42,6 +48,9 @@ public:
                                const bool theIsToShowPanel = true );
   virtual ~HYDROGUI_ImportGeomObjectOp();
 
+  static QList<GEOM::shape_type> getObstacleTypes();
+  static QList<GEOM::shape_type> getPolylineTypes();
+
 protected:
   virtual void               startOperation();
   virtual void               abortOperation();
index 9735ef8a0261bc08f87e5b03ae3c42ba56e6eb39..d51c0985dee093535a7e33b52be13610d94ecca6 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "HYDROGUI_ImportObstacleFromFileOp.h"
 
-#include "HYDROGUI_ObstacleDlg.h"
+#include "HYDROGUI_GeomObjectDlg.h"
 
 #include "HYDROGUI_DataModel.h"
 #include "HYDROGUI_Module.h"
@@ -61,17 +61,17 @@ void HYDROGUI_ImportObstacleFromFileOp::startOperation()
   HYDROGUI_Operation::startOperation();
 
   // Get panel
-  HYDROGUI_ObstacleDlg* aPanel = ::qobject_cast<HYDROGUI_ObstacleDlg*>( inputPanel() );
+  HYDROGUI_GeomObjectDlg* aPanel = ::qobject_cast<HYDROGUI_GeomObjectDlg*>( inputPanel() );
 
   if ( aPanel ) {
     // Reset the panel state
     aPanel->reset();
 
     // Pass the existing obstacle names to the panel
-    QStringList anObstacles = 
+    QStringList anObstacleNames = 
       HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_OBSTACLE );
 
-    aPanel->setObstacleNames( anObstacles );
+    aPanel->setObjectNames( anObstacleNames );
   } else {
     myFileDlg = new SUIT_FileDlg( module()->getApp()->desktop(), true );
     myFileDlg->setWindowTitle( getName() );
@@ -105,12 +105,12 @@ bool HYDROGUI_ImportObstacleFromFileOp::processApply( int& theUpdateFlags,
   Handle(HYDROData_Obstacle) anObstacle;
 
   // Get panel
-  HYDROGUI_ObstacleDlg* aPanel = ::qobject_cast<HYDROGUI_ObstacleDlg*>( inputPanel() );
+  HYDROGUI_GeomObjectDlg* aPanel = ::qobject_cast<HYDROGUI_GeomObjectDlg*>( inputPanel() );
   if ( aPanel ) {
     // Get file name and obstacle name defined by the user
     aFileName = aPanel->getFileName();
       
-    QString anEditedName = aPanel->getEditedObstacleName().simplified();
+    QString anEditedName = aPanel->getEditedObjectName().simplified();
 
     // Get obstacle to edit
     if ( !anEditedName.isEmpty() ) {
@@ -134,7 +134,7 @@ bool HYDROGUI_ImportObstacleFromFileOp::processApply( int& theUpdateFlags,
   }
 
   // Check obstacle name
-  anObstacleName = aPanel->getObstacleName().simplified();
+  anObstacleName = aPanel->getObjectName().simplified();
   if ( anObstacleName.isEmpty() ) {
     theErrorMsg = tr( "INCORRECT_OBJECT_NAME" );
     return false;
@@ -187,7 +187,8 @@ HYDROGUI_InputPanel* HYDROGUI_ImportObstacleFromFileOp::createInputPanel() const
 {
   HYDROGUI_InputPanel* aPanel = 0;
   if ( myIsToShowPanel ) {
-    aPanel = new HYDROGUI_ObstacleDlg( module(), getName(), true );
+    aPanel = new HYDROGUI_GeomObjectDlg( module(), getName(), 
+                                         tr( "DEFAULT_OBSTACLE_NAME" ), true );
   }
 
   return aPanel;
index 1ffbf5aa90a15565a86bfafa57b422299bbe7711..81eabc1f0c87b4c71c0fdc1c53acac2711aa8099 100644 (file)
@@ -40,6 +40,7 @@
 #include "HYDROGUI_AbstractDisplayer.h"
 #include "HYDROGUI_PolylineOp.h"
 #include "HYDROGUI_SetColorOp.h"
+#include "HYDROGUI_ImportGeomObjectOp.h"
 
 #include <HYDROData_Image.h>
 #include <HYDROData_Profile.h>
@@ -309,10 +310,30 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsDummyObject3D = false;
   bool anIsObjectCanBeColored = false;
 
-  // check the selected GEOM objects
-  if ( anIsObjectBrowser && !HYDROGUI_Tool::GetSelectedGeomObjects( this ).isEmpty() ) {
-    theMenu->addAction( action( ImportGeomObjectId ) );
-    theMenu->addSeparator();
+  // Check the selected GEOM objects (take into account the Object Browser only)
+  if ( anIsObjectBrowser ) {
+    QList<GEOM::shape_type> anObstacleTypes = 
+      HYDROGUI_ImportGeomObjectOp::getObstacleTypes();
+    QList<GEOM::shape_type> aPolylineTypes = 
+      HYDROGUI_ImportGeomObjectOp::getPolylineTypes();
+
+    bool isCanBeImportedAsObstacle = 
+      !HYDROGUI_Tool::GetSelectedGeomObjects( this, anObstacleTypes ).isEmpty();
+    bool isCanBeImportedAsPolyline = 
+      !HYDROGUI_Tool::GetSelectedGeomObjects( this, aPolylineTypes ).isEmpty();
+
+    // Add import as obstacle action
+    if ( isCanBeImportedAsObstacle ) {
+      theMenu->addAction( action( ImportGeomObjectAsObstacleId ) );
+    }
+    // Add import as polyline action
+    if ( isCanBeImportedAsPolyline ) {
+      theMenu->addAction( action( ImportGeomObjectAsPolylineId ) );
+    }
+    // Add separator
+    if ( isCanBeImportedAsObstacle || isCanBeImportedAsPolyline ) {
+      theMenu->addSeparator();
+    }
   }
 
   // check the selected data model objects
index 7d8dba61d98a7e0d1969a6f99ff68b8967b64813..d3a2d04ffb829f096f0e8f862ba440e795eb0983 100644 (file)
@@ -140,7 +140,8 @@ void HYDROGUI_Module::createActions()
   createAction( EditDigueId, "EDIT_DIGUE", "EDIT_DIGUE_ICO" );
 
   createAction( ImportObstacleFromFileId, "IMPORT_OBSTACLE_FROM_FILE", "IMPORT_OBSTACLE_FROM_FILE_ICO" );
-  createAction( ImportGeomObjectId, "IMPORT_GEOM_OBJECT", "IMPORT_GEOM_OBJECT_ICO" );
+  createAction( ImportGeomObjectAsObstacleId, "IMPORT_GEOM_OBJECT_AS_OBSTACLE", "IMPORT_GEOM_OBJECT_ICO" );
+  createAction( ImportGeomObjectAsPolylineId, "IMPORT_GEOM_OBJECT_AS_POLYLINE", "IMPORT_GEOM_OBJECT_ICO" );
   createAction( CreateBoxId, "CREATE_BOX", "CREATE_BOX_ICO" );
   createAction( CreateCylinderId, "CREATE_CYLINDER", "CREATE_CYLINDER_ICO" );
 
@@ -456,10 +457,13 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
     anOp = new HYDROGUI_ImportObstacleFromFileOp( aModule );
     break;
   case ImportCreatedPrimitiveId:
-    anOp = new HYDROGUI_ImportGeomObjectOp( aModule, HYDROGUI_ImportGeomObjectOp::ImportCreated );
+    anOp = new HYDROGUI_ImportGeomObjectOp( aModule, HYDROGUI_ImportGeomObjectOp::ImportCreatedAsObstacle );
     break;
-  case ImportGeomObjectId:
-    anOp = new HYDROGUI_ImportGeomObjectOp( aModule, HYDROGUI_ImportGeomObjectOp::ImportSelected );
+  case ImportGeomObjectAsObstacleId:
+    anOp = new HYDROGUI_ImportGeomObjectOp( aModule, HYDROGUI_ImportGeomObjectOp::ImportSelectedAsObstacle );
+    break;
+  case ImportGeomObjectAsPolylineId:
+    anOp = new HYDROGUI_ImportGeomObjectOp( aModule, HYDROGUI_ImportGeomObjectOp::ImportSelectedAsPolyline );
     break;
   case CreateBoxId:
     application()->activateOperation( "Geometry", GEOMOp::OpBox );
@@ -490,7 +494,8 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
 
 bool HYDROGUI_Module::reusableOperation( const int id )
 {
-  if ( id == ImportGeomObjectId ) {
+  if ( id == ImportGeomObjectAsObstacleId ||
+       id == ImportGeomObjectAsPolylineId ) {
     return false;
   }
 
index e059fda83a021346497c3ab809426346df1e882c..7184340a31d4637b91d1e8a1c193bb41fff52958 100644 (file)
@@ -85,7 +85,8 @@ enum OperationId
   EditSplittedImageId,
 
   ImportObstacleFromFileId,
-  ImportGeomObjectId,
+  ImportGeomObjectAsObstacleId,
+  ImportGeomObjectAsPolylineId,
   ImportCreatedPrimitiveId,
   CreateBoxId,
   CreateCylinderId,
index ccea02da1c095767d823957baa15b069e0dd71d3..4733af2b1f46a4306084e77328098519443b5c38 100644 (file)
@@ -383,7 +383,8 @@ ObjectKind HYDROGUI_Tool::GetSelectedPartition( HYDROGUI_Module* theModule )
   return KIND_UNKNOWN;
 }
 
-QStringList HYDROGUI_Tool::GetSelectedGeomObjects( HYDROGUI_Module* theModule )
+QStringList HYDROGUI_Tool::GetSelectedGeomObjects( HYDROGUI_Module* theModule,
+                                                   QList<GEOM::shape_type> theTypes )
 {
   QStringList anEntryList;
 
@@ -414,7 +415,8 @@ QStringList HYDROGUI_Tool::GetSelectedGeomObjects( HYDROGUI_Module* theModule )
           GEOM::GEOM_Object_var aGeomObj = 
             GEOMBase::GetObjectFromIOR( aSObject->GetIOR().c_str() );
 
-          if ( !aGeomObj->_is_nil() && aGeomObj->IsShape() ) {
+          if ( !aGeomObj->_is_nil() && aGeomObj->IsShape() && 
+               theTypes.contains( aGeomObj->GetShapeType() ) ) {
             anEntryList << anEntry;
           }
         }
index c3d971dad45b74813666fb485354cab02ae026ae..7e0efdd8445f42a26c2ee7994e11170a0c0e6b0e 100644 (file)
 #include <TCollection_HAsciiString.hxx>
 #include <TCollection_HExtendedString.hxx>
 
+// IDL includes
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+
 class SUIT_ViewManager;
 class OCCViewer_ViewFrame;
 
@@ -174,9 +178,11 @@ public:
   /**
    * \brief Get the selected GEOM objects.
    * \param theModule module
+   * \param theTypes the acceptable GEOM object types
    * \return list of GEOM objects entries
    */
-  static QStringList GetSelectedGeomObjects( HYDROGUI_Module* theModule );
+  static QStringList GetSelectedGeomObjects( HYDROGUI_Module* theModule,
+                                             QList<GEOM::shape_type> theTypes );
 
   /**
    * \brief Find the data object with the specified name.
index f0f517f5dfa45abe159c1c0c6d364bd8d51f0234..021ef5948d57cebecd4338271a0acc3a6ae2527b 100644 (file)
       <source>DEFAULT_POLYLINE_NAME</source>
       <translation>Polyline</translation>
     </message>
+    <message>
+      <source>DEFAULT_OBSTACLE_NAME</source>
+      <translation>Obstacle</translation>
+    </message>
     <message>
       <source>DEFAULT_POLYLINE_3D_NAME</source>
       <translation>Polyline3D</translation>
@@ -136,10 +140,6 @@ does not exist or you have not enough permissions to open it.</translation>
       <source>OBJECT_EXISTS_IN_DOCUMENT</source>
       <translation>Object with name '%1' already exists in the document.</translation>
     </message>
-    <message>
-      <source>ZONE_OBJECT_CANNOT_BE_CREATED</source>
-      <translation>Zone can not be created</translation>
-    </message>
     <message>
       <source>SAVE_ERROR</source>
       <translation>Study could not be saved</translation>
@@ -713,8 +713,12 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <translation>Create box obstacle</translation>
     </message>
     <message>
-      <source>DSK_IMPORT_GEOM_OBJECT</source>
-      <translation>Import GEOM object as an obstacle</translation>
+      <source>DSK_IMPORT_GEOM_OBJECT_AS_OBSTACLE</source>
+      <translation>Import GEOM object(s) as obstacle(s)</translation>
+    </message>
+    <message>
+      <source>DSK_IMPORT_GEOM_OBJECT_AS_POLYLINE</source>
+      <translation>Import GEOM object(s) as polyline(s)</translation>
     </message>
     <message>
       <source>DSK_CREATE_CYLINDER</source>
@@ -929,8 +933,12 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <translation>Import obstacle</translation>
     </message>
     <message>
-      <source>MEN_IMPORT_GEOM_OBJECT</source>
-      <translation>Import</translation>
+      <source>MEN_IMPORT_GEOM_OBJECT_AS_OBSTACLE</source>
+      <translation>Import as obstacle</translation>
+    </message>
+    <message>
+      <source>MEN_IMPORT_GEOM_OBJECT_AS_POLYLINE</source>
+      <translation>Import as polyline</translation>
     </message>
     <message>
       <source>MEN_CREATE_BOX</source>
@@ -1125,8 +1133,12 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <translation>Import obstacle from file</translation>
     </message>
     <message>
-      <source>STB_IMPORT_GEOM_OBJECT</source>
-      <translation>Import GEOM object as an obstacle</translation>
+      <source>STB_IMPORT_GEOM_OBJECT_AS_OBSTACLE</source>
+      <translation>Import GEOM object(s) as obstacle(s)</translation>
+    </message>
+    <message>
+      <source>STB_IMPORT_GEOM_OBJECT_AS_POLYLINE</source>
+      <translation>Import GEOM object(s) as polyline(s)</translation>
     </message>
     <message>
       <source>STB_CREATE_BOX</source>
@@ -1441,8 +1453,12 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
   <context>
     <name>HYDROGUI_ImportGeomObjectOp</name>
     <message>
-      <source>IMPORT_GEOM_OBJECT</source>
-      <translation>Import GEOM object</translation>
+      <source>IMPORT_GEOM_OBJECT_AS_OBSTACLE</source>
+      <translation>Import GEOM object as obstacle</translation>
+    </message>
+    <message>
+      <source>IMPORT_GEOM_OBJECT_AS_POLYLINE</source>
+      <translation>Import GEOM object as polyline</translation>
     </message>
   </context>
 
@@ -1500,11 +1516,7 @@ file cannot be correctly imported for an Obstacle definition.</translation>
   </context>
   
   <context>
-    <name>HYDROGUI_ObstacleDlg</name>
-    <message>
-      <source>DEFAULT_OBSTACLE_NAME</source>
-      <translation>Obstacle</translation>
-    </message>
+    <name>HYDROGUI_GeomObjectDlg</name>
     <message>
       <source>GET_SHAPE_FROM_FILE</source>
       <translation>Get shape from file</translation>
@@ -1518,8 +1530,8 @@ file cannot be correctly imported for an Obstacle definition.</translation>
       <translation>File name</translation>
     </message>
     <message>
-      <source>OBSTACLE_NAME</source>
-      <translation>Obstacle name</translation>
+      <source>OBJECT_NAME</source>
+      <translation>%1 name</translation>
     </message>
     <message>
       <source>NAME</source>
@@ -1530,20 +1542,16 @@ file cannot be correctly imported for an Obstacle definition.</translation>
       <translation>Mode</translation>
     </message>
     <message>
-      <source>CREATE_NEW_OBSTACLE</source>
+      <source>CREATE_NEW</source>
       <translation>Create new</translation>
     </message>
     <message>
-      <source>MODIFY_OBSTACLE</source>
+      <source>MODIFY</source>
       <translation>Modify</translation>
     </message>
     <message>
-      <source>OBSTACLE_TO_EDIT</source>
-      <translation>Obstacle to edit</translation>
-    </message>
-    <message>
-      <source>OBSTACLE</source>
-      <translation>Obstacle</translation>
+      <source>OBJECT_TO_EDIT</source>
+      <translation>%1 to edit</translation>
     </message>
   </context>