From 003da931a66f403fcae85164b6b77ec8e82fcafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=BCller?= <j.mueller@vr.rwth-aachen.de> Date: Fri, 7 Sep 2018 01:12:24 -0700 Subject: [PATCH] make qvtk demo runnable #2 --- demos/CMakeLists.txt | 9 ++- demos/QVTK-Demo/CMakeLists.txt | 4 +- demos/QVTK-Demo/qvtk-app/CMakeLists.txt | 71 +++++++++++++++++++ .../qvtk-app/include/qvtk_app/application.hpp | 49 +++++++++++++ demos/QVTK-Demo/qvtk-app/src/application.cpp | 35 +++++++++ demos/QVTK-Demo/qvtk-app/src/main.cpp | 32 +++++++++ demos/QVTK-Demo/qvtk-lib/CMakeLists.txt | 71 ++++++++++--------- .../qvtk-lib/include/qvtk-lib/animate.hpp | 10 +-- .../qvtk-lib/include/qvtk-lib/data_stream.hpp | 29 ++++---- .../qvtk-lib/include/qvtk-lib/interaction.hpp | 8 +-- .../qvtk-lib/include/qvtk-lib/main_widget.hpp | 12 ++-- .../qvtk-lib/include/qvtk-lib/main_window.hpp | 14 ++-- .../qvtk-lib/include/qvtk-lib/point_data.hpp | 8 +-- .../qvtk-lib/include/qvtk-lib/visualize.hpp | 12 ++-- demos/QVTK-Demo/qvtk-lib/src/animate.cpp | 4 +- demos/QVTK-Demo/qvtk-lib/src/data_stream.cpp | 26 +++---- demos/QVTK-Demo/qvtk-lib/src/interaction.cpp | 4 +- demos/QVTK-Demo/qvtk-lib/src/main_widget.cpp | 4 +- demos/QVTK-Demo/qvtk-lib/src/main_window.cpp | 17 +++-- demos/QVTK-Demo/qvtk-lib/src/point_data.cpp | 11 +-- demos/QVTK-Demo/qvtk-lib/src/visualize.cpp | 17 +++-- 21 files changed, 324 insertions(+), 123 deletions(-) create mode 100644 demos/QVTK-Demo/qvtk-app/CMakeLists.txt create mode 100644 demos/QVTK-Demo/qvtk-app/include/qvtk_app/application.hpp create mode 100644 demos/QVTK-Demo/qvtk-app/src/application.cpp create mode 100644 demos/QVTK-Demo/qvtk-app/src/main.cpp diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index 9427f70..974fc37 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -22,7 +22,14 @@ # add_subdirectory(QVTK-Demo) option(BUILD_BRUNEL_SIMULATION "Build the brunel simulation" ON) +option(BUILD_QVTK_DEMO "Build the QVTK visualization demo" OFF) if (${BUILD_BRUNEL_SIMULATION}) add_subdirectory(brunel_simulation) -endif (${BUILD_BRUNEL_SIMULATION}) \ No newline at end of file +endif (${BUILD_BRUNEL_SIMULATION}) + +if (${BUILD_QVTK_DEMO}) + add_subdirectory(QVTK-Demo) +endif (${BUILD_QVTK_DEMO}) + + diff --git a/demos/QVTK-Demo/CMakeLists.txt b/demos/QVTK-Demo/CMakeLists.txt index fa221e4..64ab48d 100644 --- a/demos/QVTK-Demo/CMakeLists.txt +++ b/demos/QVTK-Demo/CMakeLists.txt @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------- -# nest-streaming-module +# QVTK-Demo # # Copyright (c) 2018 RWTH Aachen University, Germany, # Virtual Reality & Immersive Visualization Group. @@ -19,6 +19,6 @@ # limitations under the License. #------------------------------------------------------------------------------- -#add_subdirectory(qvtk-app) +add_subdirectory(qvtk-app) add_subdirectory(qvtk-lib) diff --git a/demos/QVTK-Demo/qvtk-app/CMakeLists.txt b/demos/QVTK-Demo/qvtk-app/CMakeLists.txt new file mode 100644 index 0000000..00d7cbc --- /dev/null +++ b/demos/QVTK-Demo/qvtk-app/CMakeLists.txt @@ -0,0 +1,71 @@ +#------------------------------------------------------------------------------- +# QVTK-Demo +# +# Copyright (c) 2017-2018 RWTH Aachen University, Germany, +# Virtual Reality & Immersive Visualisation Group. +#------------------------------------------------------------------------------- +# License +# +# This framework is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# In the future, we may decide to add a commercial license +# at our own discretion without further notice. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesse r General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------------------- + +set(CMAKE_AUTOMOC ON) +set(QVTK_APP_API_HEADER_DIR include/qvtk_app) + +file(GLOB QVTK_APP_SOURCES src/*.cpp) +file(GLOB QVTK_APP_HEADERS include/qvtk_app/*.hpp) +file(GLOB QVTK_APP_API_HEADERS ${QVTK_APP_API_HEADER_DIR}/*.hpp) +file(GLOB QVTK_APP_SUPPRESS_WARNING_HEADERS include/qvtk_app/suppress_warnings/Qt *.hpp) + +add_executable(qvtk_app + ${QVTK_APP_SOURCES} + ${QVTK_APP_HEADERS} + ${QVTK_APP_API_HEADERS} + ${QVTK_APP_SUPPRESS_WARNING_HEADERS} +) + +target_include_directories( + qvtk_app PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR} +) + +#add_test_cpplint(NAME "qt_app--cpplint" +# ${QP_APP_SOURCES} +# ${QP_APP_HEADERS} +# ${QP_APP_API_HEADERS} +# ${QP_APP_SUPPRESS_WARNING_HEADERS} +#) + +set_warning_levels_RWTH(qvtk_app + SUPPRESS_WARNINGS_HEADER ${CMAKE_CURRENT_BINARY_DIR}/include/qt_app/suppress_warnings.hpp +) + +include_directories(include) + +# --- dependencies --- + +# VTK +find_package(VTK REQUIRED) +include(${VTK_USE_FILE}) +target_include_directories(qvtk_app PUBLIC ${VTK_INCLUDE_DIR}) + +#vtkexperiment +target_include_directories(qvtk_app PUBLIC ${QVTK_LIB_INCLUDE_DIRS}) + +target_link_libraries(qvtk_app PUBLIC qvtk-lib debug ${VTK_LIBRARIES} optimized ${VTK_LIBRARIES}) + diff --git a/demos/QVTK-Demo/qvtk-app/include/qvtk_app/application.hpp b/demos/QVTK-Demo/qvtk-app/include/qvtk_app/application.hpp new file mode 100644 index 0000000..b2beda8 --- /dev/null +++ b/demos/QVTK-Demo/qvtk-app/include/qvtk_app/application.hpp @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// QVTK-Demo +// +// Copyright (c) 2017-2018 RWTH Aachen University, Germany, +// Virtual Reality & Immersive Visualisation Group. +//------------------------------------------------------------------------------ +// License +// +// This framework is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In the future, we may decide to add a commercial license +// at our own discretion without further notice. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +//------------------------------------------------------------------------------ + +#ifndef QVTK_APP_INCLUDE_QVTK_APP_APPLICATION_HPP_ +#define QVTK_APP_INCLUDE_QVTK_APP_APPLICATION_HPP_ + +#include "QApplication" + +#include "qvtk-lib/main_window.hpp" +#include "qvtk-lib/point_data.hpp" + +class Application +{ +public: + Application(int *argc, char **argv); + ~Application() {} + + int Run(); + +private: + QApplication qt_app_; + + vtkexp::PointData points_; + vtkexp::MainWindow window_; +}; + +#endif // QVTK_APP_INCLUDE_QVTK_APP_APPLICATION_HPP_ diff --git a/demos/QVTK-Demo/qvtk-app/src/application.cpp b/demos/QVTK-Demo/qvtk-app/src/application.cpp new file mode 100644 index 0000000..3b5fd95 --- /dev/null +++ b/demos/QVTK-Demo/qvtk-app/src/application.cpp @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// QVTK-Demo +// +// Copyright (c) 2017-2018 RWTH Aachen University, Germany, +// Virtual Reality & Immersive Visualisation Group. +//------------------------------------------------------------------------------ +// License +// +// This framework is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In the future, we may decide to add a commercial license +// at our own discretion without further notice. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +//------------------------------------------------------------------------------ + +#include "qvtk_app/application.hpp" + +Application::Application(int *argc, char **argv) + : qt_app_{*argc, argv}, points_(6, 6, 1), window_{&points_} {} + +int Application::Run() +{ + window_.show(); + return qt_app_.exec(); +} diff --git a/demos/QVTK-Demo/qvtk-app/src/main.cpp b/demos/QVTK-Demo/qvtk-app/src/main.cpp new file mode 100644 index 0000000..1fc8d50 --- /dev/null +++ b/demos/QVTK-Demo/qvtk-app/src/main.cpp @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// QVTK-Demo +// +// Copyright (c) 2017-2018 RWTH Aachen University, Germany, +// Virtual Reality & Immersive Visualisation Group. +//------------------------------------------------------------------------------ +// License +// +// This framework is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In the future, we may decide to add a commercial license +// at our own discretion without further notice. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +//------------------------------------------------------------------------------ + +#include "qvtk_app/application.hpp" + +int main(int argc, char **argv) +{ + Application app(&argc, argv); + return app.Run(); +} diff --git a/demos/QVTK-Demo/qvtk-lib/CMakeLists.txt b/demos/QVTK-Demo/qvtk-lib/CMakeLists.txt index 984e636..32ce237 100644 --- a/demos/QVTK-Demo/qvtk-lib/CMakeLists.txt +++ b/demos/QVTK-Demo/qvtk-lib/CMakeLists.txt @@ -1,42 +1,45 @@ #------------------------------------------------------------------------------- # QVTK-Demo # -# Copyright (c) 2018 RWTH Aachen University, Germany, -# Virtual Reality & Immersive Visualization Group. +# Copyright (c) 2017-2018 RWTH Aachen University, Germany, +# Virtual Reality & Immersive Visualisation Group. #------------------------------------------------------------------------------- -# License +# License # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# This framework is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# http://www.apache.org/licenses/LICENSE-2.0 +# In the future, we may decide to add a commercial license +# at our own discretion without further notice. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesse r General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. #------------------------------------------------------------------------------- set(CMAKE_AUTOMOC ON) -set(QVTK_DEMO_API_HEADER_DIR include/qvtk-lib) +set(QVTK_LIB_API_HEADER_DIR include/qvtk-lib) -file(GLOB QVTK_DEMO_SOURCES src/*.cpp) -file(GLOB QVTK_DEMO_HEADERS include/qvtk-lib/*.hpp) -file(GLOB QVTK_DEMO_API_HEADERS ${QVTK_DEMO_API_HEADER_DIR}/*.hpp) +file(GLOB QVTK_LIB_SOURCES src/*.cpp) +file(GLOB QVTK_LIB_HEADERS include/qvtk-lib/*.hpp) +file(GLOB QVTK_LIB_API_HEADERS ${QVTK_LIB_API_HEADER_DIR}/*.hpp) -set(QVTK_DEMO_INCLUDE_DIRS +set(QVTK_LIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}qvtk-lib/include ${PROJECT_BINARY_DIR} CACHE PATH "Path to public headers in vtk's source tree." ) -rwthvr_add_library(NAME qvtk-lib - SOURCES ${QVTK_DEMO_SOURCES} - HEADERS ${QVTK_DEMO_HEADERS} - SUPPRESS_WARNINGS_HEADER "${CMAKE_CURRENT_BINARY_DIR}/include/contra/qvtk-lib/suppress_warnings.hpp" +add_library(qvtk-lib + ${QVTK_LIB_SOURCES} + ${QVTK_LIB_HEADERS} ) target_include_directories(qvtk-lib @@ -48,33 +51,33 @@ generate_export_header(qvtk-lib EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/qvtk-lib/export.hpp ) -add_test_cpplint(NAME "qvtk-lib--cpplint" - ${QVTK_DEMO_SOURCES} - ${QVTK_DEMO_HEADERS} +set_warning_levels_RWTH(qvtk-lib + SUPPRESS_WARNINGS_HEADER ${CMAKE_CURRENT_BINARY_DIR}/include/qvtk-lib/suppress_warnings.hpp ) -#generate_configure_files(qvtk-lib) +#add_test_cpplint(NAME "vtkexperiment--cpplint" +# ${VTKEXPERIMENT_SOURCES} +# ${VTKEXPERIMENT_HEADERS} +#) include_directories(include) # --- dependencies --- - - # VTK find_package(VTK REQUIRED) include(${VTK_USE_FILE}) target_include_directories(qvtk-lib PUBLIC ${VTK_INCLUDE_DIR}) -target_link_libraries(qvtk-lib debug ${VTK_LIBRARIES} optimized ${VTK_LIBRARIES}) target_include_directories(qvtk-lib PUBLIC ${CONAN_INCLUDE_DIRS} ) target_link_libraries(qvtk-lib - PUBLIC ${CONAN_OR_CMAKE_conduit} - PUBLIC ${CONAN_OR_CMAKE_Qt} - PUBLIC ${CONAN_OR_CMAKE_nesci} - PUBLIC ${CONAN_OR_CMAKE_contra} + PUBLIC ${CONAN_OR_CMAKE_contra} + PUBLIC ${CONAN_OR_CMAKE_nesci} + PUBLIC ${CONAN_OR_CMAKE_conduit} + PUBLIC ${CONAN_OR_CMAKE_Qt} + PUBLIC ${CONAN_OR_CMAKE_VTK} + debug ${VTK_LIBRARIES} + optimized ${VTK_LIBRARIES} ) - - diff --git a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/animate.hpp b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/animate.hpp index cd46082..bdedbbb 100644 --- a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/animate.hpp +++ b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/animate.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,15 +23,15 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_ANIMATE_HPP_ -#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_ANIMATE_HPP_ +#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_ANIMATE_HPP_ +#define QVTK_LIB_INCLUDE_QVTK_LIB_ANIMATE_HPP_ #include "QObject" #include "QTimer" #include "include/qvtk-lib/suppress_warnings.hpp" SUPPRESS_WARNINGS_BEGIN -#include "include/qvtk-lib/point_data.hpp" +#include "qvtk-lib/point_data.hpp" SUPPRESS_WARNINGS_END namespace vtkexp @@ -73,4 +73,4 @@ private: } // namespace vtkexp -#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_ANIMATE_HPP_ +#endif // QVTK_LIB_INCLUDE_QVTK_LIB_ANIMATE_HPP_ diff --git a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/data_stream.hpp b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/data_stream.hpp index bc9e58d..7254ccf 100644 --- a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/data_stream.hpp +++ b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/data_stream.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,39 +23,42 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_DATA_STREAM_HPP_ -#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_DATA_STREAM_HPP_ +#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_DATA_STREAM_HPP_ +#define QVTK_LIB_INCLUDE_QVTK_LIB_DATA_STREAM_HPP_ #include <vector> #include "conduit/conduit_node.hpp" +//#include "contra/boost-shmem/shared_memory_transport.hpp" #include "contra/relay.hpp" -#include "contra/shared_memory_transport.hpp" +#include "contra/zmq/zeromq_transport.hpp" + #include "nesci/consumer/nest_multimeter.hpp" -namespace vtkexp { +namespace vtkexp +{ -class DataStream { - public: +class DataStream +{ +public: DataStream(); ~DataStream() {} std::vector<double> GetMultValuesAt(int time_step); std::vector<double> GetTimeSteps(); - private: +private: void SetUpStream(); void Update(int time_step); std::vector<double> mult_values_; - contra::Relay<contra::SharedMemoryTransport>* relay_; - nesci::consumer::NestMultimeter* multimeter_; + contra::Relay<contra::ZMQTransport> *relay_; + nesci::consumer::NestMultimeter *multimeter_; conduit::Node node_; - std::vector<conduit::Node> node_vec_; }; -} // namespace vtkexp +} // namespace vtkexp -#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_DATA_STREAM_HPP_ +#endif // QVTK_LIB_INCLUDE_QVTK_LIB_DATA_STREAM_HPP_ diff --git a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/interaction.hpp b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/interaction.hpp index b110ddd..cfc6b51 100644 --- a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/interaction.hpp +++ b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/interaction.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,8 +23,8 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_INTERACTION_HPP_ -#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_INTERACTION_HPP_ +#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_INTERACTION_HPP_ +#define QVTK_LIB_INCLUDE_QVTK_LIB_INTERACTION_HPP_ #include <string> @@ -84,4 +84,4 @@ class Interaction : public vtkInteractorStyleTrackballCamera } // namespace vtkexp -#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_INTERACTION_HPP_ +#endif // QVTK_LIB_INCLUDE_QVTK_LIB_INTERACTION_HPP_ diff --git a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/main_widget.hpp b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/main_widget.hpp index a2e7e51..fd0ec97 100644 --- a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/main_widget.hpp +++ b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/main_widget.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,12 +23,12 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_MAIN_WIDGET_HPP_ -#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_MAIN_WIDGET_HPP_ +#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WIDGET_HPP_ +#define QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WIDGET_HPP_ -#include "include/qvtk-lib/visualize.hpp" +#include "qvtk-lib/visualize.hpp" -#include "include/qvtk-lib/interaction.hpp" +#include "qvtk-lib/interaction.hpp" #include "QObject" @@ -68,4 +68,4 @@ private: } // namespace vtkexp -#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_MAIN_WIDGET_HPP_ +#endif // QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WIDGET_HPP_ diff --git a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/main_window.hpp b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/main_window.hpp index 9c889c8..a9bf282 100644 --- a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/main_window.hpp +++ b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/main_window.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,15 +23,15 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_MAIN_WINDOW_HPP_ -#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_MAIN_WINDOW_HPP_ +#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WINDOW_HPP_ +#define QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WINDOW_HPP_ #include "include/qvtk-lib/suppress_warnings.hpp" -#include "include/qvtk-lib/animate.hpp" -#include "include/qvtk-lib/main_widget.hpp" +#include "qvtk-lib/animate.hpp" +#include "qvtk-lib/main_widget.hpp" SUPPRESS_WARNINGS_BEGIN -#include "include/qvtk-lib/point_data.hpp" +#include "qvtk-lib/point_data.hpp" SUPPRESS_WARNINGS_END #include "QComboBox" @@ -96,4 +96,4 @@ private: } // namespace vtkexp -#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_MAIN_WINDOW_HPP_ +#endif // QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WINDOW_HPP_ diff --git a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/point_data.hpp b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/point_data.hpp index 6f75a6f..934ccb6 100644 --- a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/point_data.hpp +++ b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/point_data.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,8 +23,8 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_POINT_DATA_HPP_ -#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_POINT_DATA_HPP_ +#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_POINT_DATA_HPP_ +#define QVTK_LIB_INCLUDE_QVTK_LIB_POINT_DATA_HPP_ #include <vector> @@ -70,4 +70,4 @@ private: } // namespace vtkexp -#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_POINT_DATA_HPP_ +#endif // QVTK_LIB_INCLUDE_QVTK_LIB_POINT_DATA_HPP_ diff --git a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/visualize.hpp b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/visualize.hpp index 23fb764..9b0fc75 100644 --- a/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/visualize.hpp +++ b/demos/QVTK-Demo/qvtk-lib/include/qvtk-lib/visualize.hpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,8 +23,8 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#ifndef VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_VISUALIZE_HPP_ -#define VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_VISUALIZE_HPP_ +#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_VISUALIZE_HPP_ +#define QVTK_LIB_INCLUDE_QVTK_LIB_VISUALIZE_HPP_ #include <string> @@ -32,8 +32,8 @@ SUPPRESS_WARNINGS_BEGIN #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" -#include "include/qvtk-lib/interaction.hpp" -#include "include/qvtk-lib/point_data.hpp" +#include "qvtk-lib/interaction.hpp" +#include "qvtk-lib/point_data.hpp" #include "vtkActor.h" #include "vtkAxesActor.h" @@ -95,4 +95,4 @@ private: } // namespace vtkexp -#endif // VTKEXPERIMENT_INCLUDE_VTKEXPERIMENT_VISUALIZE_HPP_ +#endif // QVTK_LIB_INCLUDE_QVTK_LIB_VISUALIZE_HPP_ diff --git a/demos/QVTK-Demo/qvtk-lib/src/animate.cpp b/demos/QVTK-Demo/qvtk-lib/src/animate.cpp index 76ca602..fb73646 100644 --- a/demos/QVTK-Demo/qvtk-lib/src/animate.cpp +++ b/demos/QVTK-Demo/qvtk-lib/src/animate.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,7 +23,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#include "include/qvtk-lib/animate.hpp" +#include "qvtk-lib/animate.hpp" namespace vtkexp { diff --git a/demos/QVTK-Demo/qvtk-lib/src/data_stream.cpp b/demos/QVTK-Demo/qvtk-lib/src/data_stream.cpp index f19a58a..16d39ab 100644 --- a/demos/QVTK-Demo/qvtk-lib/src/data_stream.cpp +++ b/demos/QVTK-Demo/qvtk-lib/src/data_stream.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,7 +23,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#include "include/qvtk-lib/data_stream.hpp" +#include "qvtk-lib/data_stream.hpp" #include <vector> @@ -34,8 +34,8 @@ DataStream::DataStream() { SetUpStream(); } void DataStream::SetUpStream() { - relay_ = new contra::Relay<contra::SharedMemoryTransport>(); - relay_->SetNode(&node_); + relay_ = new contra::Relay<contra::ZMQTransport>( + contra::ZMQTransport::Type::CLIENT, "tcp://localhost:5555"); multimeter_ = new nesci::consumer::NestMultimeter("recordingNode51"); multimeter_->SetNode(&node_); @@ -43,24 +43,20 @@ void DataStream::SetUpStream() void DataStream::Update(int time_step) { - time_step = time_step + 1; - auto time_step_string = std::to_string(time_step); + auto time_step_string = std::to_string(static_cast<double>(time_step)); const auto received_nodes = relay_->Receive(); for (auto node : received_nodes) { - node_vec_.push_back(node); + node_.update(node); } - if (!node_vec_.empty()) + if (time_step == -1 && !multimeter_->GetTimesteps().empty()) { - node_ = node_vec_.back(); - if (time_step == -1 && !multimeter_->GetTimesteps().empty()) - { - time_step_string = multimeter_->GetTimesteps().back(); - } - mult_values_ = multimeter_->GetTimestepData(0, "V_m"); + time_step_string = multimeter_->GetTimesteps().back(); } + + mult_values_ = multimeter_->GetTimestepData(time_step_string, "V_m"); } std::vector<double> DataStream::GetMultValuesAt(int time_step) @@ -72,12 +68,10 @@ std::vector<double> DataStream::GetMultValuesAt(int time_step) std::vector<double> DataStream::GetTimeSteps() { std::vector<double> ret; - for (auto value : multimeter_->GetTimesteps()) { ret.push_back(std::stod(value)); } - return ret; } diff --git a/demos/QVTK-Demo/qvtk-lib/src/interaction.cpp b/demos/QVTK-Demo/qvtk-lib/src/interaction.cpp index 227039c..d655481 100644 --- a/demos/QVTK-Demo/qvtk-lib/src/interaction.cpp +++ b/demos/QVTK-Demo/qvtk-lib/src/interaction.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,7 +23,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#include "include/qvtk-lib/interaction.hpp" +#include "qvtk-lib/interaction.hpp" #include <string> diff --git a/demos/QVTK-Demo/qvtk-lib/src/main_widget.cpp b/demos/QVTK-Demo/qvtk-lib/src/main_widget.cpp index a2d9f20..dcc6f6c 100644 --- a/demos/QVTK-Demo/qvtk-lib/src/main_widget.cpp +++ b/demos/QVTK-Demo/qvtk-lib/src/main_widget.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,7 +23,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------ -#include "include/qvtk-lib/main_widget.hpp" +#include "qvtk-lib/main_widget.hpp" #include "vtkGenericOpenGLRenderWindow.h" diff --git a/demos/QVTK-Demo/qvtk-lib/src/main_window.cpp b/demos/QVTK-Demo/qvtk-lib/src/main_window.cpp index fedfdbc..980eb8a 100644 --- a/demos/QVTK-Demo/qvtk-lib/src/main_window.cpp +++ b/demos/QVTK-Demo/qvtk-lib/src/main_window.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,9 +23,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#include "include/qvtk-lib/main_window.hpp" - -#include <algorithm> +#include "qvtk-lib/main_window.hpp" namespace vtkexp { @@ -135,7 +133,16 @@ void MainWindow::Rerender() { mainwidget_->Rerender(); } void MainWindow::IncrementSlider() { - int newval = std::min(time_slider_->value() + 1, time_slider_->maximum()); + int newval; + if (time_slider_->value() + 1 < time_slider_->maximum()) + { + newval = time_slider_->value() + 1; + } + else + { + newval = time_slider_->maximum(); + } + time_slider_->setValue(newval); slider_line_edit_->setText(std::to_string(newval).c_str()); } diff --git a/demos/QVTK-Demo/qvtk-lib/src/point_data.cpp b/demos/QVTK-Demo/qvtk-lib/src/point_data.cpp index 2a49cba..263c7bc 100644 --- a/demos/QVTK-Demo/qvtk-lib/src/point_data.cpp +++ b/demos/QVTK-Demo/qvtk-lib/src/point_data.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -27,7 +27,7 @@ #include "include/qvtk-lib/suppress_warnings.hpp" SUPPRESS_WARNINGS_BEGIN -#include "include/qvtk-lib/point_data.hpp" +#include "qvtk-lib/point_data.hpp" #include "vtkCellArray.h" #pragma GCC diagnostic push @@ -89,7 +89,8 @@ void PointData::AttachColorsToPoints(const std::vector<double> &scalars) { for (int i = 0; i < num_points_; ++i) { - pointcolors_->SetValue(i, scalars.at(static_cast<int>(i))); + pointcolors_->SetValue( + i, static_cast<float>(scalars.at(static_cast<int>(i)))); } points_polydata_->GetPointData()->SetScalars(pointcolors_); } @@ -115,7 +116,7 @@ int PointData::GetStartTime() const { if (!stream_->GetTimeSteps().empty()) { - return stream_->GetTimeSteps().front(); + return static_cast<int>(stream_->GetTimeSteps().front()); } return 0; } @@ -124,7 +125,7 @@ int PointData::GetEndTime() const { if (!stream_->GetTimeSteps().empty()) { - return stream_->GetTimeSteps().back(); + return static_cast<int>(stream_->GetTimeSteps().back()); } return 100; } diff --git a/demos/QVTK-Demo/qvtk-lib/src/visualize.cpp b/demos/QVTK-Demo/qvtk-lib/src/visualize.cpp index 53e3363..614c74b 100644 --- a/demos/QVTK-Demo/qvtk-lib/src/visualize.cpp +++ b/demos/QVTK-Demo/qvtk-lib/src/visualize.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// vtkexperiment +// QVTK-Demo // // Copyright (c) 2017-2018 RWTH Aachen University, Germany, // Virtual Reality & Immersive Visualisation Group. @@ -23,7 +23,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ -#include "include/qvtk-lib/visualize.hpp" +#include "qvtk-lib/visualize.hpp" #include <string> @@ -45,7 +45,7 @@ void Visualize::Initialize( SetUpScene(); SetUpRenderer(); SetUpAxes(); - // SetUpLegend(); + SetUpLegend(); } void Visualize::SetUpLegend() @@ -55,14 +55,13 @@ void Visualize::SetUpLegend() scalar_bar_widget_->SetEnabled(true); scalar_bar_ = scalar_bar_widget_->GetScalarBarActor(); - scalar_bar_->SetTitle("Legend"); + // scalar_bar_->SetTitle("Legend"); scalar_bar_->SetLookupTable(transfer_function_); scalar_bar_->SetOrientationToVertical(); - scalar_bar_->SetNumberOfLabels(4); + scalar_bar_->SetNumberOfLabels(0); - scalar_bar_widget_->EnabledOn(); - - interactor_->Initialize(); + scalar_bar_->SetPosition2(0, 0); + scalar_bar_->SetBarRatio(0.6); } void Visualize::SetUpAxes() @@ -73,7 +72,7 @@ void Visualize::SetUpAxes() axes_widget_->SetOutlineColor(0.9300, 0.5700, 0.1300); axes_widget_->SetOrientationMarker(axes_); axes_widget_->SetInteractor(interactor_); - axes_widget_->SetViewport(0., 0.0, 0.2, 0.2); + axes_widget_->SetViewport(0.0, 0.0, 0.2, 0.2); axes_widget_->SetEnabled(1); axes_widget_->InteractiveOn(); -- GitLab