#include "HYDROGUI_AbstractDisplayer.h"
#include "HYDROGUI_PolylineOp.h"
#include "HYDROGUI_SetColorOp.h"
+#include "HYDROGUI_ImportGeomObjectOp.h"
#include <HYDROData_Image.h>
#include <HYDROData_Profile.h>
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