]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
New filters scheme.
authormzn <mzn@opencascade.com>
Fri, 27 May 2005 13:01:28 +0000 (13:01 +0000)
committermzn <mzn@opencascade.com>
Fri, 27 May 2005 13:01:28 +0000 (13:01 +0000)
src/SalomeApp/Makefile.in
src/SalomeApp/SalomeApp_Filter.cxx [new file with mode: 0644]
src/SalomeApp/SalomeApp_Filter.h [new file with mode: 0644]
src/SalomeApp/SalomeApp_TypeFilter.cxx [new file with mode: 0644]
src/SalomeApp/SalomeApp_TypeFilter.h [new file with mode: 0644]

index ab30ac389e8a2efbdb0ffa6f7da4b24cb84d3831..4a926dfefc38d6ea3b3f07f9bb0230415f8d08a4 100755 (executable)
@@ -33,7 +33,9 @@ EXPORT_HEADERS= SalomeApp.h \
                SalomeApp_NameDlg.h \
                SalomeApp_ImportOperation.h \
                SalomeApp_DataSubOwner.h \
-                SalomeApp_Selection.h
+               SalomeApp_Selection.h \
+               SalomeApp_Filter.h \
+               SalomeApp_TypeFilter.h          
 
 # .po files to transform in .qm
 PO_FILES = SalomeApp_images.po \
@@ -63,7 +65,9 @@ LIB_SRC= SalomeApp_Application.cxx \
         SalomeApp_ImportOperation.cxx \
         SalomeApp_DataSubOwner.cxx \
         SalomeApp_ModuleDlg.cxx \
-         SalomeApp_Selection.cxx
+        SalomeApp_Selection.cxx \
+        SalomeApp_Filter.cxx \
+        SalomeApp_TypeFilter.cxx
 
 LIB_MOC = SalomeApp_Application.h \
          SalomeApp_DataModel.h \
@@ -93,7 +97,7 @@ RESOURCES_FILES = icon_about.png \
 CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
 
 LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS) 
-LIBS+= -L$(GUI_ROOT_DIR)/lib/salome -lsuit -lstd -lCAM -lObjBrowser -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow
+LIBS+= -L$(GUI_ROOT_DIR)/lib/salome -lsuit -lstd -lCAM -lObjBrowser -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole
 
 @CONCLUDE@
 
diff --git a/src/SalomeApp/SalomeApp_Filter.cxx b/src/SalomeApp/SalomeApp_Filter.cxx
new file mode 100644 (file)
index 0000000..6404e5c
--- /dev/null
@@ -0,0 +1,15 @@
+#include "SalomeApp_Filter.h"
+
+SalomeApp_Filter::SalomeApp_Filter( SalomeApp_Study* study )
+{
+  myStudy = study;
+}
+
+SalomeApp_Filter::~SalomeApp_Filter()
+{
+}
+
+SalomeApp_Study* SalomeApp_Filter::getStudy() const
+{
+  return myStudy;
+}
diff --git a/src/SalomeApp/SalomeApp_Filter.h b/src/SalomeApp/SalomeApp_Filter.h
new file mode 100644 (file)
index 0000000..01d3fe2
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef SALOMEAPP_FILTER_H
+#define SALOMEAPP_FILTER_H
+
+#include "SalomeApp.h"
+#include "SUIT_SelectionFilter.h"
+
+class SalomeApp_Study;
+
+class SALOMEAPP_EXPORT SalomeApp_Filter: public SUIT_SelectionFilter
+{
+public:
+  SalomeApp_Filter(SalomeApp_Study* study);
+  ~SalomeApp_Filter();
+
+protected:
+  SalomeApp_Study* getStudy() const;
+
+private:
+  SalomeApp_Study* myStudy;
+};
+
+#endif
diff --git a/src/SalomeApp/SalomeApp_TypeFilter.cxx b/src/SalomeApp/SalomeApp_TypeFilter.cxx
new file mode 100644 (file)
index 0000000..59fdff0
--- /dev/null
@@ -0,0 +1,38 @@
+#include "SalomeApp_TypeFilter.h"
+
+#include "SalomeApp_DataOwner.h"
+#include "SalomeApp_Study.h"
+
+#include <SALOMEDS_SObject.hxx>
+
+SalomeApp_TypeFilter::SalomeApp_TypeFilter( SalomeApp_Study* study, const QString& kind )
+  : SalomeApp_Filter( study ) 
+{
+  myKind = kind;
+}
+
+SalomeApp_TypeFilter::~SalomeApp_TypeFilter()
+{
+}
+
+bool SalomeApp_TypeFilter::isOk( const SUIT_DataOwner* sOwner ) const
+{  
+  const SalomeApp_DataOwner* owner = dynamic_cast<const SalomeApp_DataOwner*> ( sOwner );
+
+  SalomeApp_Study* aDoc =  getStudy();
+  if (owner && aDoc && aDoc->studyDS())
+    {
+      _PTR(Study) aStudy = aDoc->studyDS();
+      QString entry = owner->entry();
+      
+      _PTR(SObject) aSObj( aStudy->FindObjectID( entry.latin1() ) );
+      if (aSObj)
+       {
+         _PTR(SComponent) aComponent(aSObj->GetFatherComponent());
+         if ( aComponent && (aComponent->ComponentDataType() == myKind) )
+           return true;
+       }
+    }
+
+  return false;
+}
diff --git a/src/SalomeApp/SalomeApp_TypeFilter.h b/src/SalomeApp/SalomeApp_TypeFilter.h
new file mode 100644 (file)
index 0000000..59efba9
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef SALOMEAPP_TYPEFILTER_H
+#define SALOMEAPP_TYPEFILTER_H
+
+#include <qstring.h>
+
+#include "SalomeApp_Filter.h"
+
+class SALOMEAPP_EXPORT SalomeApp_TypeFilter: public SalomeApp_Filter
+{
+public:
+  SalomeApp_TypeFilter( SalomeApp_Study* study, const QString& kind );
+  ~SalomeApp_TypeFilter();
+
+  virtual bool isOk( const SUIT_DataOwner* ) const;
+  
+private:
+  QString myKind;
+};
+
+#endif