]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Fri, 7 Apr 2017 02:11:07 +0000 (21:11 -0500)
committerLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Fri, 7 Apr 2017 02:11:07 +0000 (21:11 -0500)
15 files changed:
CMakeLists.txt
cmake/BaseConfig.cmake
cmake/KitwareTools.cmake
cmake/Options.cmake [deleted file]
cmake/QtTools.cmake
libs/cpPipelineEditor/Block.cxx
libs/cpPipelineEditor/Block.h
libs/cpPipelineEditor/Canvas.cxx
libs/cpPipelineEditor/Canvas.h
libs/cpPipelineEditor/FilterBlock.cxx [new file with mode: 0644]
libs/cpPipelineEditor/FilterBlock.h [new file with mode: 0644]
libs/cpPipelineEditor/FunctorBlock.cxx [new file with mode: 0644]
libs/cpPipelineEditor/FunctorBlock.h [new file with mode: 0644]
libs/cpPipelineEditor/WidgetBlock.cxx [new file with mode: 0644]
libs/cpPipelineEditor/WidgetBlock.h [new file with mode: 0644]

index 0f910161de4a1f986dfbe405235adcd1e9751dfa..c0d3111f9d64da445da1d08143bffaae4239adea 100644 (file)
@@ -8,12 +8,8 @@ SET(prj_NAME cpPlugins)
 SET(prj_MAJ_VERSION 1)
 SET(prj_MIN_VERSION 0)
 SET(prj_REL_VERSION 0)
+SET(_subdirs applis libs)
 SET(_policies CMP0015 CMP0020 CMP0042)
-SET(
-  _subdirs
-  applis
-  libs
-  )
 
 ## ==========================
 ## == Some useful policies ==
@@ -38,9 +34,8 @@ SET(prj_SHORT_VERSION "${prj_MAJ_VERSION}")
 ## =====================================
 
 INCLUDE(cmake/BaseConfig.cmake)
-INCLUDE(cmake/Options.cmake)
+INCLUDE(cmake/KitwareTools.cmake)
 INCLUDE(cmake/QtTools.cmake)
-#INCLUDE(cmake/KitwareTools.cmake)
 INCLUDE(cmake/Functions.cmake)
 
 ## ===========================
index d177604781fdd748042fb7dffe15eeef77b7a537..515820db9e03eaacfeee695d205c4dc60344e651 100644 (file)
@@ -33,7 +33,10 @@ INCLUDE(GenerateExportHeader)
 ## ==================================================
 
 IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
-  MESSAGE(FATAL_ERROR "Building in the source tree is not allowed.")
+  MESSAGE(
+    FATAL_ERROR
+    "Building in the source tree is not allowed."
+    )
 ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
 
 ## =================================================
index b4493d2951ee5a7ed629b51a02589e07c1bd038c..a120bb210298a03c947e3f64dbc630502be56a1a 100644 (file)
@@ -3,9 +3,9 @@
 # ======================
 
 FIND_PACKAGE(ITK REQUIRED)
-FIND_PACKAGE(VTK REQUIRED)
-
 INCLUDE(${ITK_USE_FILE})
+
+FIND_PACKAGE(VTK REQUIRED)
 INCLUDE(${VTK_USE_FILE})
 
 # ===================================================
diff --git a/cmake/Options.cmake b/cmake/Options.cmake
deleted file mode 100644 (file)
index f2cc242..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-## ===============================
-## == Some configurable options ==
-## ===============================
-
-## eof - $RCSfile$
index 47a3dd44f420be5ab94276bf35c6ffcc0ba69739..35421440ec61fbaf8dc1ab6aff68a9bbd7be7fb0 100644 (file)
@@ -6,22 +6,16 @@ OPTION(BUILD_QT4_COMPONENTS "Build Qt4-based code" OFF)
 IF(BUILD_QT4_COMPONENTS)
   FIND_PACKAGE(Qt4 REQUIRED)
   INCLUDE(${QT_USE_FILE})
-  #  SET(
-  #    _modules
-  #    vtkGUISupportQt
-  #    )
-  #  FOREACH(_m ${_modules})
-  #    IF(NOT ${_m}_LOADED)
-  #      MESSAGE(FATAL_ERROR "${_m} module is required but not available.")
-  #      BREAK()
-  #    ENDIF(NOT ${_m}_LOADED)
-  #  ENDFOREACH(_m)
-  #  SET(
-  #    cpPlugins_Qt4_VTKWidget
-  #    QVTKWidget
-  #    CACHE STRING "Base Qt4-based vtkRenderWindow"
-  #    )
-  #  MARK_AS_ADVANCED(CLEAR cpPlugins_Qt4_VTKWidget)
+  SET(
+    _modules
+    vtkGUISupportQt
+    )
+  FOREACH(_m ${_modules})
+    IF(NOT ${_m}_LOADED)
+      MESSAGE(FATAL_ERROR "${_m} module is required but not available.")
+      BREAK()
+    ENDIF(NOT ${_m}_LOADED)
+  ENDFOREACH(_m)
 ENDIF(BUILD_QT4_COMPONENTS)
 
 ## eof - $RCSfile$
index d750c9c60106aa19b2c09e335b1dd3fed1285550..315b197117ef55fa2de6dff5cb1c606d5fd37368 100644 (file)
@@ -8,6 +8,15 @@ Block( QGraphicsItem* parent, QGraphicsScene* scene )
 {
   this->m_SelectedColor = Qt::darkYellow;
   this->m_NotSelectedColor = Qt::darkGreen;
+
+  QPainterPath p;
+  p.addRoundedRect( -50, -50, 50, 50, 5, 5 );
+
+  this->setPath( p );
+  this->setPen( QPen( this->m_NotSelectedColor ) );
+  this->setBrush( this->m_NotSelectedColor );
+  this->setFlag( QGraphicsItem::ItemIsMovable );
+  this->setFlag( QGraphicsItem::ItemIsSelectable );
 }
 
 // -------------------------------------------------------------------------
@@ -37,7 +46,6 @@ paint(
 
   } // fi
   painter->drawPath( this->path( ) );
-
 }
 
 // eof - $RCSfile$
index a5fb8d085b61e7b380253e236a713d2dfbd10e38..7e6fa2592ae046f445f943f2523534f2c0e4ea8b 100644 (file)
@@ -27,7 +27,7 @@ namespace cpPipelineEditor
       QWidget* widget
       ) override;
 
-  private:
+  protected:
     QColor m_SelectedColor;
     QColor m_NotSelectedColor;
   };
index 27312460d8b060d6a9d15e9fc8ae632db8add566..0015421e15ed281a6c328aa050e61970e857dbc0 100644 (file)
@@ -2,7 +2,17 @@
 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
 // -------------------------------------------------------------------------
 
+
+#include <iostream>
+
+
+
+
+
 #include <cpPipelineEditor/Canvas.h>
+#include <cpPipelineEditor/FilterBlock.h>
+#include <cpPipelineEditor/FunctorBlock.h>
+#include <cpPipelineEditor/WidgetBlock.h>
 
 #include <QDragEnterEvent>
 #include <QTreeWidget>
@@ -24,6 +34,23 @@ cpPipelineEditor::Canvas::
 {
 }
 
+// -------------------------------------------------------------------------
+cpPipelineEditor::Block* cpPipelineEditor::Canvas::
+createBlock( const std::string& name )
+{
+  QString str = name.c_str( );
+  QStringList tokens = str.split( "@" );
+  std::string block_type = tokens.back( ).toStdString( );
+  Block* new_block = NULL;
+  if( block_type == "Filters" )
+    new_block = new FilterBlock( NULL, this->m_Scene );
+  else if( block_type == "Functors" )
+    new_block = new FunctorBlock( NULL, this->m_Scene );
+  else if( block_type == "Widgets" )
+    new_block = new WidgetBlock( NULL, this->m_Scene );
+  return( new_block );
+}
+
 // -------------------------------------------------------------------------
 void cpPipelineEditor::Canvas::
 dragEnterEvent( QDragEnterEvent* event )
@@ -60,21 +87,20 @@ dropEvent( QDropEvent* event )
 
   // Process dropped data
   QList< QTreeWidgetItem* > items = tree->selectedItems( );
-  for(
-    QList< QTreeWidgetItem* >::const_iterator iIt = items.begin( );
-    iIt != items.end( );
-    ++iIt
-    )
+  for( QTreeWidgetItem* item : items )
   {
-    /* TODO
-       auto parent = ( *iIt )->parent( );
-       if( parent != NULL )
-       this->addFilter(
-       parent->text( 0 ).toStdString( ),
-       ( *iIt )->text( 0 ).toStdString( ),
-       p
-       );
-    */
+    std::string name = "";
+    QTreeWidgetItem* p = item;
+    while( p != NULL )
+    {
+      name += p->text( 0 ).toStdString( ) + "@";
+      p = p->parent( );
+
+    } // elihw
+    name.resize( name.size( ) - 1 );
+
+    // Create block
+    Block* b = this->createBlock( name );
 
   } // rof
 }
index 373dcd8b7bdc6edad29ac1ff8d2e20fb33aa6259..512dc2fc920b778cd793f9ad3ad1fd61ba9ff629 100644 (file)
@@ -12,6 +12,8 @@ class QGraphicsScene;
 
 namespace cpPipelineEditor
 {
+  class Block;
+
   /**
    */
   class Canvas
@@ -27,6 +29,8 @@ namespace cpPipelineEditor
     Canvas( QWidget* parent = NULL );
     virtual ~Canvas( );
 
+    Block* createBlock( const std::string& name );
+
   protected:
     virtual void dragEnterEvent( QDragEnterEvent* event ) override;
     virtual void dragLeaveEvent( QDragLeaveEvent* event ) override;
diff --git a/libs/cpPipelineEditor/FilterBlock.cxx b/libs/cpPipelineEditor/FilterBlock.cxx
new file mode 100644 (file)
index 0000000..6ce8a87
--- /dev/null
@@ -0,0 +1,19 @@
+#include <cpPipelineEditor/FilterBlock.h>
+#include <QPainter>
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::FilterBlock::
+FilterBlock( QGraphicsItem* parent, QGraphicsScene* scene )
+  : Superclass( parent, scene )
+{
+  this->m_SelectedColor = Qt::darkYellow;
+  this->m_NotSelectedColor = Qt::darkGreen;
+}
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::FilterBlock::
+~FilterBlock( )
+{
+}
+
+// eof - $RCSfile$
diff --git a/libs/cpPipelineEditor/FilterBlock.h b/libs/cpPipelineEditor/FilterBlock.h
new file mode 100644 (file)
index 0000000..82e089a
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __cpPipelineEditor__FilterBlock__h__
+#define __cpPipelineEditor__FilterBlock__h__
+
+#include <cpPipelineEditor/Block.h>
+
+namespace cpPipelineEditor
+{
+  /**
+   */
+  class cpPipelineEditor_EXPORT FilterBlock
+    : public Block
+  {
+  public:
+    typedef FilterBlock Self;
+    typedef Block       Superclass;
+
+  public:
+    FilterBlock(
+      QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL
+      );
+    virtual ~FilterBlock( );
+  };
+
+} // ecapseman
+
+#endif // __cpPipelineEditor__FilterBlock__h__
+
+// eof - $RCSfile$
diff --git a/libs/cpPipelineEditor/FunctorBlock.cxx b/libs/cpPipelineEditor/FunctorBlock.cxx
new file mode 100644 (file)
index 0000000..407496d
--- /dev/null
@@ -0,0 +1,19 @@
+#include <cpPipelineEditor/FunctorBlock.h>
+#include <QPainter>
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::FunctorBlock::
+FunctorBlock( QGraphicsItem* parent, QGraphicsScene* scene )
+  : Superclass( parent, scene )
+{
+  this->m_SelectedColor = Qt::darkYellow;
+  this->m_NotSelectedColor = Qt::darkMagenta;
+}
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::FunctorBlock::
+~FunctorBlock( )
+{
+}
+
+// eof - $RCSfile$
diff --git a/libs/cpPipelineEditor/FunctorBlock.h b/libs/cpPipelineEditor/FunctorBlock.h
new file mode 100644 (file)
index 0000000..aec5dfd
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __cpPipelineEditor__FunctorBlock__h__
+#define __cpPipelineEditor__FunctorBlock__h__
+
+#include <cpPipelineEditor/Block.h>
+
+namespace cpPipelineEditor
+{
+  /**
+   */
+  class cpPipelineEditor_EXPORT FunctorBlock
+    : public Block
+  {
+  public:
+    typedef FunctorBlock Self;
+    typedef Block        Superclass;
+
+  public:
+    FunctorBlock(
+      QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL
+      );
+    virtual ~FunctorBlock( );
+  };
+
+} // ecapseman
+
+#endif // __cpPipelineEditor__FunctorBlock__h__
+
+// eof - $RCSfile$
diff --git a/libs/cpPipelineEditor/WidgetBlock.cxx b/libs/cpPipelineEditor/WidgetBlock.cxx
new file mode 100644 (file)
index 0000000..da976d3
--- /dev/null
@@ -0,0 +1,19 @@
+#include <cpPipelineEditor/WidgetBlock.h>
+#include <QPainter>
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::WidgetBlock::
+WidgetBlock( QGraphicsItem* parent, QGraphicsScene* scene )
+  : Superclass( parent, scene )
+{
+  this->m_SelectedColor = Qt::darkYellow;
+  this->m_NotSelectedColor = Qt::darkBlue;
+}
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::WidgetBlock::
+~WidgetBlock( )
+{
+}
+
+// eof - $RCSfile$
diff --git a/libs/cpPipelineEditor/WidgetBlock.h b/libs/cpPipelineEditor/WidgetBlock.h
new file mode 100644 (file)
index 0000000..6ccb6ca
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __cpPipelineEditor__WidgetBlock__h__
+#define __cpPipelineEditor__WidgetBlock__h__
+
+#include <cpPipelineEditor/Block.h>
+
+namespace cpPipelineEditor
+{
+  /**
+   */
+  class cpPipelineEditor_EXPORT WidgetBlock
+    : public Block
+  {
+  public:
+    typedef WidgetBlock Self;
+    typedef Block       Superclass;
+
+  public:
+    WidgetBlock(
+      QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL
+      );
+    virtual ~WidgetBlock( );
+  };
+
+} // ecapseman
+
+#endif // __cpPipelineEditor__WidgetBlock__h__
+
+// eof - $RCSfile$