#include <SALOMEDSClient.hxx>
+#include <SVTK_ViewModel.h>
+
#include <QDir>
#include <QFileInfo>
#include <QDockWidget>
// encoding instead of default 'System'
#define USE_LATIN1_ENCODING
+// #define DEB_GROUPS 1
+
QString HYDROGUI_Tool::ToQString( const TCollection_AsciiString& src )
{
#ifdef USE_LATIN1_ENCODING
aWorkstack->setActiveWindow( aViewWindow );
}
+bool HYDROGUI_Tool::IsObjectHasPresentation( const Handle(HYDROData_Entity)& theObject,
+ const QString& theViewerType )
+{
+
+ if ( theObject.IsNull() )
+ return false;
+
+ ObjectKind anObjectKind = theObject->GetKind();
+ if ( theViewerType.isEmpty() || theViewerType == OCCViewer_Viewer::Type() )
+ {
+ if ( anObjectKind == KIND_IMAGE ||
+ anObjectKind == KIND_POLYLINEXY ||
+ anObjectKind == KIND_POLYLINE ||
+ anObjectKind == KIND_IMMERSIBLE_ZONE ||
+ anObjectKind == KIND_REGION ||
+ anObjectKind == KIND_ZONE ||
+ anObjectKind == KIND_OBSTACLE ||
+ anObjectKind == KIND_PROFILE ||
+ anObjectKind == KIND_STREAM ||
+ anObjectKind == KIND_CHANNEL ||
+ anObjectKind == KIND_DIGUE ||
+ anObjectKind == KIND_DUMMY_3D
+#ifdef DEB_GROUPS
+ || anObjectKind == KIND_SHAPES_GROUP ||
+ anObjectKind == KIND_SPLITTED_GROUP
+#endif
+ )
+ {
+ return true;
+ }
+ }
+
+ if ( theViewerType.isEmpty() || theViewerType == SVTK_Viewer::Type() )
+ {
+ if ( anObjectKind == KIND_BATHYMETRY )
+ return true;
+ }
+
+ if ( theViewerType.isEmpty() || theViewerType == GraphicsView_Viewer::Type() )
+ {
+ if ( anObjectKind == KIND_IMAGE ||
+ anObjectKind == KIND_POLYLINEXY )
+ return true;
+ }
+
+ return false;
+}
+
void HYDROGUI_Tool::GetPrsSubObjects( HYDROGUI_Module* theModule,
HYDROData_SequenceOfObjects& theSeq )
{
for( ; anIterator.More(); anIterator.Next() )
{
Handle(HYDROData_Entity) anObject = anIterator.Current();
- if( !anObject.IsNull() && (
- ( anObject->GetKind() == KIND_IMAGE ) ||
- ( anObject->GetKind() == KIND_POLYLINEXY ) ||
- ( anObject->GetKind() == KIND_IMMERSIBLE_ZONE ) ||
- ( anObject->GetKind() == KIND_REGION ) ||
- ( anObject->GetKind() == KIND_BATHYMETRY ) ||
- ( anObject->GetKind() == KIND_ZONE ) ||
- ( anObject->GetKind() == KIND_OBSTACLE ) ||
- ( anObject->GetKind() == KIND_PROFILE ) ||
- ( anObject->GetKind() == KIND_STREAM ) ||
- ( anObject->GetKind() == KIND_CHANNEL ) ) )
- {
- theSeq.Append( anObject );
- }
+ if ( !IsObjectHasPresentation( anObject ) )
+ continue;
+
+ theSeq.Append( anObject );
}
}
}
return KIND_UNKNOWN;
}
-QStringList HYDROGUI_Tool::GetSelectedGeomObjects( HYDROGUI_Module* theModule )
+QStringList HYDROGUI_Tool::GetSelectedGeomObjects( HYDROGUI_Module* theModule,
+ QList<GEOM::shape_type> theTypes )
{
QStringList anEntryList;
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;
}
}