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 ==
## =====================================
INCLUDE(cmake/BaseConfig.cmake)
-INCLUDE(cmake/Options.cmake)
+INCLUDE(cmake/KitwareTools.cmake)
INCLUDE(cmake/QtTools.cmake)
-#INCLUDE(cmake/KitwareTools.cmake)
INCLUDE(cmake/Functions.cmake)
## ===========================
## ==================================================
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})
## =================================================
# ======================
FIND_PACKAGE(ITK REQUIRED)
-FIND_PACKAGE(VTK REQUIRED)
-
INCLUDE(${ITK_USE_FILE})
+
+FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
# ===================================================
+++ /dev/null
-## ===============================
-## == Some configurable options ==
-## ===============================
-
-## eof - $RCSfile$
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$
{
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 );
}
// -------------------------------------------------------------------------
} // fi
painter->drawPath( this->path( ) );
-
}
// eof - $RCSfile$
QWidget* widget
) override;
- private:
+ protected:
QColor m_SelectedColor;
QColor m_NotSelectedColor;
};
// @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>
{
}
+// -------------------------------------------------------------------------
+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 )
// 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
}
namespace cpPipelineEditor
{
+ class Block;
+
/**
*/
class Canvas
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;
--- /dev/null
+#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$
--- /dev/null
+#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$
--- /dev/null
+#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$
--- /dev/null
+#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$
--- /dev/null
+#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$
--- /dev/null
+#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$