Commit c78081e0 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

Merge branch 'release/2.8.0'

parents d36d175e 2723e1b7
......@@ -19,7 +19,7 @@
## ###################################################################
build
build*
build-*
## ###################################################################
## Install tree
......
# Change Log:
# 2.8.0 25-Mar-2019
- add dtkVisualizationViewVideoPlayer based on QtMultimedia
- major rearchitectore of VTK based classes:
- add dtkVisualizationCanvas
- add dtkVisualizationDecorator and child classes
# 2.7.2 20-Feb-2019
- move toggle button of 2D plots to left using new overlaypane
- add tool tip to toggle button
# 2.7.1 13-Feb-2019
- add method to set range in plot2d
......
......@@ -23,8 +23,8 @@ project(dtkVisualization)
## ###################################################################
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 7)
set(${PROJECT_NAME}_VERSION_PATCH 2)
set(${PROJECT_NAME}_VERSION_MINOR 8)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......@@ -59,7 +59,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
## Build setup
## #################################################################
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(UNIX)
......@@ -79,9 +79,11 @@ include(GenerateExportHeader)
find_package(VTK REQUIRED)
find_package(Qt5 COMPONENTS Core Widgets OpenGL Xml Multimedia MultimediaWidgets WebSockets REQUIRED)
include_directories(${Qt5Multimedia_PRIVATE_INCLUDE_DIRS})
find_package(dtkCore 2.3.0 REQUIRED)
find_package(dtkFonts 2.0.0 REQUIRED)
find_package(dtkWidgets 2.1.0 REQUIRED)
find_package(dtkWidgets 2.7.0 REQUIRED)
find_package(dtkLog 2.1.0 REQUIRED)
if(WIN32)
......@@ -94,6 +96,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
include(${VTK_USE_FILE})
include_directories(${dtkCore_INCLUDE_DIRS})
include_directories(${dtkLog_INCLUDE_DIRS})
include_directories(${dtkFonts_INCLUDE_DIRS})
include_directories(${dtkWidgets_INCLUDE_DIRS})
......
......@@ -16,11 +16,29 @@
#include "dtkVisualizationViewerSidePane.h"
#include "dtkVisualizationViewerStack.h"
#include <dtkCore>
#include <dtkVisualization/dtkVisualizationDecoratorClutEditor>
#include <dtkVisualization/dtkVisualizationDecoratorScalarColorMap>
#include <dtkVisualization/dtkVisualizationDecoratorScalarGlyphs>
#include <dtkVisualization/dtkVisualizationDecoratorScalarIsolines>
#include <dtkVisualization/dtkVisualizationView3D>
#include <dtkVisualization/dtkVisualizationVTKReader>
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsClutEditor>
#include <dtkWidgets/dtkWidgetsLayout>
#include <dtkWidgets/dtkWidgetsLayoutItem>
#include <dtkWidgets/dtkWidgetsOverlayRope>
#include <dtkWidgets/dtkWidgetsOverlayPane>
#include <dtkWidgets/dtkWidgetsOverlayPaneItem>
#include <vtkDataSet.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
#include <vtkUnstructuredGrid.h>
#include <vtkXMLUnstructuredGridReader.h>
// ///////////////////////////////////////////////////////////////////
// Helper functions
......@@ -35,15 +53,15 @@ QString dtkReadFile(const QString& path);
class dtkVisualizationViewerPrivate
{
public:
dtkVisualizationViewerSidePane *side;
dtkVisualizationViewerStack *stack;
dtkVisualizationViewerSidePane *side = nullptr;
dtkVisualizationViewerStack *stack = nullptr;
public:
dtkWidgetsOverlayRope *rope;
dtkWidgetsOverlayRope *rope = nullptr;
public:
QWidget *source = Q_NULLPTR;
QWidget *target = Q_NULLPTR;
QWidget *source = nullptr;
QWidget *target = nullptr;
};
// ///////////////////////////////////////////////////////////////////
......@@ -130,50 +148,28 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
settings.setValue("last_import_dir", info.absoluteDir().path());
settings.endGroup();
if (path.endsWith(".vti")) {
if (d->stack->layout()->current()) {
if (d->stack->layout()->current()->view()) {
if (d->stack->layout()->current()->view()->widget())
dynamic_cast<dtkVisualizationView3D *>(d->stack->layout()->current()->view()->widget())->importVTI(path);
}
}
dtkVisualizationView3D *view_3d = dynamic_cast<dtkVisualizationView3D *>(d->stack->layout()->current()->view());
if(!view_3d) {
return;
}
if (path.endsWith(".vtp")) {
if (d->stack->layout()->current()) {
if (d->stack->layout()->current()->view()) {
if (d->stack->layout()->current()->view()->widget())
dynamic_cast<dtkVisualizationView3D *>(d->stack->layout()->current()->view()->widget())->importVTP(path);
}
}
}
vtkDataSet *dataset = dtkVisualizationVTKReader(path);
QVariant data = dtk::variantFromValue(dataset);
if (path.endsWith(".vtr")) {
if (d->stack->layout()->current()) {
if (d->stack->layout()->current()->view()) {
if (d->stack->layout()->current()->view()->widget())
dynamic_cast<dtkVisualizationView3D *>(d->stack->layout()->current()->view()->widget())->importVTR(path);
}
}
}
if (path.endsWith(".vts")) {
if (d->stack->layout()->current()) {
if (d->stack->layout()->current()->view()) {
if (d->stack->layout()->current()->view()->widget())
dynamic_cast<dtkVisualizationView3D *>(d->stack->layout()->current()->view()->widget())->importVTS(path);
}
}
}
dtkVisualizationDecoratorClutEditor *decorator_clut_editor = new dtkVisualizationDecoratorClutEditor;
dtkVisualizationDecoratorScalarColorMap *decorator_scalar_color_map = new dtkVisualizationDecoratorScalarColorMap;
dtkVisualizationDecoratorScalarIsolines *decorator_scalar_isolines = new dtkVisualizationDecoratorScalarIsolines;
dtkVisualizationDecoratorScalarGlyphs *decorator_scalar_glyphs = new dtkVisualizationDecoratorScalarGlyphs;
if (path.endsWith(".vtu")) {
if (d->stack->layout()->current()) {
if (d->stack->layout()->current()->view()) {
if (d->stack->layout()->current()->view()->widget())
dynamic_cast<dtkVisualizationView3D *>(d->stack->layout()->current()->view()->widget())->importVTU(path);
}
}
}
//chain all decorators
*decorator_clut_editor << *decorator_scalar_isolines << *decorator_scalar_glyphs << *decorator_scalar_color_map ;
//setCanvas and setData on the first decorator
decorator_clut_editor->setCanvas(view_3d);
decorator_clut_editor->setData(data);
decorator_scalar_color_map->render();
}
void dtkVisualizationViewer::setRopeSource(QWidget *source)
......@@ -189,7 +185,7 @@ void dtkVisualizationViewer::setRopeTarget(QWidget *target)
if(dtkVisualizationView3D *source_view = dynamic_cast<dtkVisualizationView3D *>(d->source->parentWidget()->parentWidget())) {
target_view->link(source_view);
target_view->link(static_cast<dtkVisualizationCanvas *>(source_view));
}
}
}
......
......@@ -53,12 +53,12 @@ QSplitter::handle {
}
QToolTip {
color: #bebfbf;
color: yellow;
border: 1px solid #242728;
border-radius: 4px;
background-color: #242728;
padding: 5px;
font: 14px;
padding: 2px;
font: bold 14px;
}
QScrollArea {
......
......@@ -14,18 +14,20 @@
#include "dtkVisualizationViewerStack.h"
#include <dtkVisualization/dtkVisualizationPlot2D>
#include <dtkVisualization/dtkVisualizationPlot3D>
#include <dtkVisualization/dtkVisualizationView2D>
#include <dtkVisualization/dtkVisualizationView3D>
#include <dtkVisualization/dtkVisualizationViewVideoPlayer>
#include <dtkWidgets/dtkWidgetsLayout>
#include <dtkWidgets/dtkWidgetsLayoutItem>
#include <dtkWidgets/dtkWidgetsController>
#include <dtkWidgets/dtkWidgetsSettings>
class dtkVisualizationViewerStackPrivate
{
public:
dtkWidgetsLayout *layout;
dtkWidgetsSettings *settings;
};
dtkVisualizationViewerStack::dtkVisualizationViewerStack(QWidget *parent) : QStackedWidget(parent)
......@@ -35,10 +37,7 @@ dtkVisualizationViewerStack::dtkVisualizationViewerStack(QWidget *parent) : QSta
d->layout = new dtkWidgetsLayout(this);
d->layout->setCreator(create);
d->settings = new dtkWidgetsSettings(this);
this->addWidget(d->layout);
this->addWidget(d->settings);
}
dtkVisualizationViewerStack::~dtkVisualizationViewerStack(void)
......@@ -51,11 +50,22 @@ dtkWidgetsLayout *dtkVisualizationViewerStack::layout(void)
return d->layout;
}
dtkWidgetsWidget *dtkVisualizationViewerStack::create(const QString& name)
dtkWidgetsWidget *dtkVisualizationViewerStack::create(const QString& type)
{
Q_UNUSED(name);
return new dtkVisualizationView3D;
dtkWidgetsWidget *view = Q_NULLPTR;
if (type == "Plot2D")
view = new dtkVisualizationPlot2D;
else if (type == "Plot3D")
view = new dtkVisualizationPlot3D;
else if (type == "View2D")
view = new dtkVisualizationView3D;
else if (type == "View3D")
view = new dtkVisualizationView3D;
else if (type == "ViewVideoPlayer")
view = new dtkVisualizationViewVideoPlayer;
return view;
}
void dtkVisualizationViewerStack::keyPressEvent(QKeyEvent *event)
......
......@@ -21,17 +21,24 @@
#include <dtkFonts>
#include <dtkWidgets/dtkWidgetsController>
#include <dtkWidgets/dtkWidgetsLayoutItem>
#include "dtkVisualizationViewer.h"
#include "dtkVisualizationViewerStyle.h"
#include <vtkUnstructuredGrid.h>
#include <dtkVisualization/dtkVisualizationDecorator>
int main(int argc, char **argv)
{
QMetaType::registerConverter<vtkUnstructuredGrid *, vtkDataSet *>();
#if defined(Q_OS_UNIX) and !defined(Q_OS_MAC)
qputenv("XDG_CURRENT_DESKTOP", "GNOME");
#endif
QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication application(argc, argv);
application.setApplicationName("dtkVisualizationViewer");
......@@ -39,6 +46,15 @@ int main(int argc, char **argv)
application.setOrganizationDomain("fr");
application.setApplicationVersion("2.5.0");
dtkWidgetsLayoutItem::Actions actions;
actions.insert("Plot2D", "Plot 2D");
actions.insert("Plot3D", "Plot 3D");
actions.insert("View2D", "View 2D");
actions.insert("View3D", "View 3D");
actions.insert("ViewVideoPlayer", "Video player");
dtkWidgetsLayoutItem::setActions(actions);
dtkVisualizationViewer *viewer = new dtkVisualizationViewer;
viewer->show();
viewer->raise();
......
......@@ -23,7 +23,6 @@ int main(int argc, char **argv)
application.setApplicationName("dtkVisualizationOverlayPaneItem");
application.setOrganizationName("inria");
application.setOrganizationDomain("fr");
application.setApplicationVersion("2.2.1");
QFormLayout *layout_1 = new QFormLayout;
layout_1->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
......
......@@ -22,7 +22,6 @@ int main(int argc, char **argv)
application.setApplicationName("dtkVisualizationOverlayRope");
application.setOrganizationName("inria");
application.setOrganizationDomain("fr");
application.setApplicationVersion("2.2.1");
dtkWidgetsOverlayRope *window = new dtkWidgetsOverlayRope;
window->setWindowTitle("dtkVisualizationOverlayRope");
......
......@@ -33,7 +33,6 @@ int main(int argc, char **argv)
application.setApplicationName("dtkVisualizationPlot2D");
application.setOrganizationName("inria");
application.setOrganizationDomain("fr");
application.setApplicationVersion("2.2.1");
// ///////////////////////////////////////////////////////////////////
// Field data
......
......@@ -32,7 +32,6 @@ int main(int argc, char **argv)
application.setApplicationName("dtkVisualizationViewHybrid");
application.setOrganizationName("inria");
application.setOrganizationDomain("fr");
application.setApplicationVersion("2.2.1");
// ///////////////////////////////////////////////////////////////////
// Hybrid View example
......
# Version: $Id$
#
#
# Commentary:
#
#
# Change Log:
#
#
# Code:
name: dtk-visualization
channels:
- dtk
dependencies:
- qt >=5.9.0
- vtk=8.2.0
- dtk-fonts
- dtk-log
- dtk-widgets >=2.7.0
#
# dtk-visualization.yaml ends here
@echo off
mkdir build
cd build
set BUILD_CONFIG=Release
cmake .. -G "Visual Studio 14 2015 Win64" ^
-Wno-dev ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-DCMAKE_INSTALL_RPATH:STRING=%LIBRARY_LIB% ^
-DCMAKE_INSTALL_NAME_DIR=%LIBRARY_LIB%
if errorlevel 1 exit 1
cmake --build . --config %BUILD_CONFIG% --target install
if errorlevel 1 exit 1
#!/bin/bash
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR=lib
make -j${CPU_COUNT}
make install
package:
name: dtk-visualization
version: {{ GIT_DESCRIBE_TAG }}
source:
git_url: ../..
build:
number: 0
requirements:
build:
- cmake >=3.2.0
- binutils_impl_linux-64<2.31.0 # [linux]
- {{ compiler('cxx') }}
- {{ cdt('xorg-x11-proto-devel') }} # [linux]
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-libegl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libx11-devel') }} # [linux]
- {{ cdt('libXt-devel') }} # [linux]
- {{ cdt('libICE-devel') }} # [linux]
- {{ cdt('libuuid-devel') }} # [linux]
- {{ cdt('libSM-devel') }} # [linux]
- {{ cdt('libxext-devel') }} # [linux]
- {{ cdt('libxcb') }} # [linux]
- {{ cdt('libxrender-devel') }} # [linux]
- {{ cdt('libxau-devel') }} # [linux]
- {{ cdt('libdrm-devel') }} # [linux]
- {{ cdt('libxcomposite-devel') }} # [linux]
- {{ cdt('libxcursor-devel') }} # [linux]
- {{ cdt('libxi-devel') }} # [linux]
- {{ cdt('libxrandr-devel') }} # [linux]
- {{ cdt('pciutils-devel') }} # [linux]
- {{ cdt('libxscrnsaver-devel') }} # [linux]
- {{ cdt('libxtst-devel') }} # [linux]
- {{ cdt('libselinux-devel') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxdamage-devel') }} # [linux]
- {{ cdt('libxfixes') }} # [linux]
- {{ cdt('libxfixes-devel') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
host:
- qt >=5.9.0
- dtk-fonts
- dtk-widgets >=2.7.0,<2.8
- vtk >=8.1.0
run:
- vtk >=8.1.0
- qt >=5.9.0
- dtk-fonts
- dtk-widgets >=2.7.0,<2.8
- gst-plugins-good # [linux]
- gst-libav # [linux]
about:
home: http://dtk.inria.fr/
license: BSD
summary: dtk-visualization is a bridge between Qt and VTK and requires no additional dependency.
......@@ -20,12 +20,24 @@ project(dtkVisualization VERSION ${dtkVisualization_VERSION})
set(${PROJECT_NAME}_HEADERS
dtkVisualization
dtkVisualizationActor
dtkVisualizationActor.h
dtkVisualizationCanvas
dtkVisualizationCanvas.h
dtkVisualizationDecorator
dtkVisualizationDecorator.h
dtkVisualizationDecoratorClutEditor
dtkVisualizationDecoratorClutEditor.h
dtkVisualizationDecoratorScalarColorMap
dtkVisualizationDecoratorScalarColorMap.h
dtkVisualizationDecoratorScalarGlyphs
dtkVisualizationDecoratorScalarGlyphs.h
dtkVisualizationDecoratorScalarIsolines
dtkVisualizationDecoratorScalarIsolines.h
dtkVisualizationPlot2D
dtkVisualizationPlot2D.h
dtkVisualizationPlot3D
dtkVisualizationPlot3D.h
dtkVisualizationVTKReader
dtkVisualizationVTKReader.h
dtkVisualizationViewHybrid
dtkVisualizationViewHybrid.h
dtkVisualizationViewOverlay
......@@ -38,20 +50,31 @@ set(${PROJECT_NAME}_HEADERS
dtkVisualizationViewVideo.h
dtkVisualizationViewVideoGL
dtkVisualizationViewVideoGL.h
dtkVisualizationViewVideoPlayer
dtkVisualizationViewVideoPlayer.h
dtkVisualizationViewVideoRaster
dtkVisualizationViewVideoRaster.h)
dtkVisualizationViewVideoRaster.h
)
set(${PROJECT_NAME}_SOURCES
dtkVisualizationActor.cpp
dtkVisualizationCanvas.cpp
dtkVisualizationDecorator.cpp
dtkVisualizationDecoratorClutEditor.cpp
dtkVisualizationDecoratorScalarColorMap.cpp
dtkVisualizationDecoratorScalarGlyphs.cpp
dtkVisualizationDecoratorScalarIsolines.cpp
dtkVisualizationPlot2D.cpp
dtkVisualizationPlot3D.cpp
dtkVisualizationVTKReader.cpp
dtkVisualizationViewHybrid.cpp
dtkVisualizationViewOverlay.cpp
dtkVisualizationView2D.cpp
dtkVisualizationView3D.cpp
dtkVisualizationViewVideo.cpp
dtkVisualizationViewVideoGL.cpp
dtkVisualizationViewVideoRaster.cpp)
dtkVisualizationViewVideoPlayer.cpp
dtkVisualizationViewVideoRaster.cpp
)
set(${PROJECT_NAME}_SOURCES_QRC dtkVisualization.qrc)
......@@ -69,8 +92,10 @@ add_library(${PROJECT_NAME} SHARED
${${PROJECT_NAME}_HEADERS})
target_link_libraries(${PROJECT_NAME} Qt5::Core)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} Qt5::Multimedia)
target_link_libraries(${PROJECT_NAME} Qt5::MultimediaWidgets)
target_link_libraries(${PROJECT_NAME} Qt5::OpenGL)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} dtkFonts)
target_link_libraries(${PROJECT_NAME} dtkWidgets)
......
#include "dtkVisualizationActor.h"
#include "dtkVisualizationCanvas.h"
#include "dtkVisualizationDecoratorClutEditor.h"
#include "dtkVisualizationDecorator.h"
#include "dtkVisualizationDecoratorScalarColorMap.h"
#include "dtkVisualizationDecoratorScalarIsolines.h"
#include "dtkVisualizationDecoratorScalarGlyphs.h"
#include "dtkVisualizationPlot2D.h"
#include "dtkVisualizationPlot3D.h"
#include "dtkVisualizationVTKReader.h"
#include "dtkVisualizationView2D.h"
#include "dtkVisualizationView3D.h"
#include "dtkVisualizationViewHybrid.h"
......
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="">
<file>dtkVisualizationViewVideoGL.vert</file>
<file>dtkVisualizationViewVideoGL.frag</file>
<file>dtkVisualizationViewVideoGL.120.vert</file>
<file>dtkVisualizationViewVideoGL.120.frag</file>
<file>dtkVisualizationViewVideoGL.150.vert</file>
<file>dtkVisualizationViewVideoGL.150.frag</file>
</qresource>
</RCC>
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkVisualizationActor.h"
dtkVisualizationActor::~dtkVisualizationActor(void)
{
this->SetReferenceCount(0);
}
bool dtkVisualizationActor::isVisible(void)
{
return (bool)(this->GetVisibility());
}
void dtkVisualizationActor::hide(void)
{
this->VisibilityOff();
}
void dtkVisualizationActor::show(void)
{
this->VisibilityOn();
}
//
// dtkVisualizationActor.cpp ends here
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
#include <QtCore>
#include <dtkVisualizationExport.h>
#include <vtkAssembly.h>
class DTKVISUALIZATION_EXPORT dtkVisualizationActor : public QObject, public vtkAssembly
{
public:
virtual ~dtkVisualizationActor(void);
public:
virtual bool isVisible(void);
public:
virtual void setInteractor(void *interactor) = 0;
public slots:
virtual void hide(void);
virtual void show(void);
public slots:
virtual void update(void) = 0;
};
//
// dtkVisualizationActor.h ends here
#include "dtkVisualizationCanvas.h"
\ No newline at end of file