diff --git a/.clang-format b/.clang-format
index ddb374f..a690220 100644
--- a/.clang-format
+++ b/.clang-format
@@ -13,6 +13,8 @@ AccessModifierOffset: -4 # -IndentWidth
ConstructorInitializerIndentWidth: 8 # 2 * IndentWidth
BreakBeforeBraces: Allman
+SeparateDefinitionBlocks: Always
+EmptyLineBeforeAccessModifier: Always
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakTemplateDeclarations: true
@@ -24,3 +26,7 @@ MaxEmptyLinesToKeep: 2
Standard: Cpp11
UseTab: Never
+ContinuationIndentWidth: 4
+AlignAfterOpenBracket: true
+LambdaBodyIndentation: Signature
+
diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml
index 66e7ee2..b07480f 100644
--- a/.github/workflows/build_wheels.yml
+++ b/.github/workflows/build_wheels.yml
@@ -7,8 +7,8 @@ on:
pull_request:
env:
- PYSIDE_VERSION: 6.7.1
- PIP_EXTRA_INDEX_URL: "https://download.qt.io/official_releases/QtForPython/"
+ PYSIDE_VERSION: 6.8.2
+ #PIP_EXTRA_INDEX_URL: "https://download.qt.io/official_releases/QtForPython/"
jobs:
build_sdist:
@@ -23,7 +23,7 @@ jobs:
aqt install-qt -O "$GITHUB_WORKSPACE"/Qt linux desktop ${{ env.PYSIDE_VERSION }}
PATH="$GITHUB_WORKSPACE"/Qt/${{ env.PYSIDE_VERSION }}/gcc_64/bin:$PATH" LD_LIBRARY_PATH="$GITHUB_WORKSPACE"/Qt/${{ env.PYSIDE_VERSION }}/gcc_64/lib:$LD_LIBRARY_PATH" pipx run build --sdist
- name: Upload artifact
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
@@ -53,16 +53,16 @@ jobs:
run: |
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Build wheels
- uses: pypa/cibuildwheel@v2.18.1
+ uses: pypa/cibuildwheel@v2.22.0
env:
PYSIDE_VERSION: ${{ env.PYSIDE_VERSION }}
PIP_EXTRA_INDEX_URL: ${{ env.PIP_EXTRA_INDEX_URL }}
- CIBW_ENVIRONMENT_WINDOWS: PYSIDE_VERSION=${{ env.PYSIDE_VERSION }} PIP_EXTRA_INDEX_URL=${{ env.PIP_EXTRA_INDEX_URL }} PATH="${GITHUB_WORKSPACE}\\Qt\\${{ env.PYSIDE_VERSION }}\\msvc2019_64\\bin;$PATH"
+ CIBW_ENVIRONMENT_WINDOWS: PYSIDE_VERSION=${{ env.PYSIDE_VERSION }} PIP_EXTRA_INDEX_URL=${{ env.PIP_EXTRA_INDEX_URL }} PATH="${GITHUB_WORKSPACE}\\Qt\\${{ env.PYSIDE_VERSION }}\\msvc2022_64\\bin;$PATH"
CIBW_ENVIRONMENT_MACOS: PYSIDE_VERSION=${{ env.PYSIDE_VERSION }} MACOSX_DEPLOYMENT_TARGET='11.0' PATH=${{ env.GITHUB_WORKSPACE }}/Qt/${{ env.PYSIDE_VERSION }}/macos/bin:$PATH
CIBW_ENVIRONMENT_LINUX: PYSIDE_VERSION=${{ env.PYSIDE_VERSION }} PIP_EXTRA_INDEX_URL=${{ env.PIP_EXTRA_INDEX_URL }} PATH=${{ env.GITHUB_WORKSPACE }}/Qt/${{ env.PYSIDE_VERSION }}/gcc_64/bin:$PATH LD_LIBRARY_PATH=${{ env.GITHUB_WORKSPACE }}/Qt/${{ env.PYSIDE_VERSION }}/gcc_64/lib:$LD_LIBRARY_PATH
CIBW_BEFORE_BUILD_WINDOWS: >
pip install "aqtinstall"
- && aqt install-qt -O ${{ env.GITHUB_WORKSPACE }}\\Qt windows desktop ${{ env.PYSIDE_VERSION }} win64_msvc2019_64
+ && aqt install-qt -O ${{ env.GITHUB_WORKSPACE }}\\Qt windows desktop ${{ env.PYSIDE_VERSION }} win64_msvc2022_64
CIBW_BEFORE_BUILD_MACOS: >
pip install "aqtinstall"
&& aqt install-qt -O "${{ env.GITHUB_WORKSPACE }}/Qt" mac desktop ${{ env.PYSIDE_VERSION }}
@@ -70,7 +70,7 @@ jobs:
dnf install -y /usr/lib64/libxkbcommon.so.0 /usr/lib64/libxslt.so.1 clang /usr/bin/llvm-config
&& pip install "aqtinstall" && aqt install-qt -O "${{ env.GITHUB_WORKSPACE }}/Qt" linux desktop ${{ env.PYSIDE_VERSION }}
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
- auditwheel repair -w {dest_dir} --exclude libpyside6.abi3.so.6.7 --exclude libshiboken6.abi3.so.6.7 --exclude libQt6Core.so.6 --exclude libQt6Widgets.so.6 --exclude libQt6Gui.so.6 --exclude libpyside6qml.abi3.so.6.7 --exclude libGLX.so.0 --exclude libOpenGL.so.0 --exclude libxcb.so.1 --only-plat --plat manylinux_2_28_x86_64 {wheel}
+ auditwheel repair -w {dest_dir} --exclude libpyside6.abi3.so.6.8 --exclude libshiboken6.abi3.so.6.8 --exclude libQt6Core.so.6 --exclude libQt6Widgets.so.6 --exclude libQt6Gui.so.6 --exclude libpyside6qml.abi3.so.6.8 --exclude libGLX.so.0 --exclude libOpenGL.so.0 --exclude libxcb.so.1 --only-plat --plat manylinux_2_28_x86_64 {wheel}
CIBW_REPAIR_WHEEL_COMMAND_MACOS:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_SKIP: "*-win32 *i686 *38-* pp* *musllinux*"
diff --git a/README.md b/README.md
index 4c627fb..69e1f03 100644
--- a/README.md
+++ b/README.md
@@ -3,5 +3,42 @@
[](https://pypi.python.org/pypi/sciqlopplots)
[](https://codecov.io/gh/SciQLop/SciQLopPlots/branch/main)
-# SciQLopPlots
+# SciQLopPlots - A High-Performance Plotting Library for Scientific Data
+
+SciQLopPlots is a powerful and efficient plotting library designed for the [SciQLop](https://github.com/SciQLop/SciQLop) scientific data analysis platform. It provides interactive visualization capabilities optimized for handling large-scale scientific datasets with seamless integration into SciQLop's ecosystem.
+
+
+## Key Features
+
+- **High-Performance Rendering**: Optimized for smooth interaction with large non uniform 1D, 2D datasets.
+- **Interactive Visualization**: Pan, zoom, and inspect data points in real time.
+- **Multiple Plot Types**: Supports time series, spectrograms, parametric curves.
+- **Customizable Styling**: Adjust colors, labels, axes, and plot layouts programmatically or via GUI.
+- **Cross-Platform**: Works on Windows, Linux, and macOS.
+
+## Installation
+
+SciQLopPlots can be installed as a stadalone Python package with pip.
+
+```bash
+python -m pip install SciQLopPlots
+```
+
+# How to contribute
+
+Just fork the repository, make your changes and submit a pull request. We will be happy to review and merge your
+changes.
+Reports of bugs and feature requests are also welcome. Do not forget to star the project if you like it!
+
+# Credits
+
+The development of SciQLop is supported by the [CDPP](http://www.cdpp.eu/).
+We acknowledge support from the federation [Plas@Par](https://www.plasapar.sorbonne-universite.fr)
+
+# Thanks
+
+We would like to thank the developers of the following libraries that SciQLop depends on:
+
+- [PySide6](https://doc.qt.io/qtforpython-6/index.html) for the GUI framework and Qt bindings.
+- [QCustomPlot](https://www.qcustomplot.com/) for providing the plotting library.
diff --git a/SciQLopPlots/__init__.py b/SciQLopPlots/__init__.py
index 671d5f7..987e3ee 100644
--- a/SciQLopPlots/__init__.py
+++ b/SciQLopPlots/__init__.py
@@ -1,10 +1,22 @@
from PySide6 import QtCore, QtGui, QtWidgets, QtOpenGL, QtPrintSupport, QtSvg
-from .SciQLopPlotsBindings import GraphType, SciQLopPlot, SciQLopTimeSeriesPlot, SciQLopMultiPlotPanel, SciQLopGraphInterface, AxisType, SciQLopPlotRange
+from . import SciQLopPlotsBindings
+from .SciQLopPlotsBindings import (GraphType, SciQLopPlot, SciQLopTimeSeriesPlot, SciQLopMultiPlotPanel,
+ SciQLopGraphInterface, AxisType, SciQLopPlotRange, SciQLopNDProjectionPlot)
from .SciQLopPlotsBindings import *
+from datetime import datetime, timezone
+from dateutil.parser import parse as dateparse
+import sys
+
+sys.modules["SciQLopPlotsBindings"] = SciQLopPlotsBindings
__version__ = '0.9.0'
+def _merge_kwargs(kwargs, **kwargs2):
+ for k, v in kwargs2.items():
+ if k not in kwargs and v is not None:
+ kwargs[k] = v
+ return kwargs
def _patch_sciqlop_plot(cls):
def plot_func(self, callback, graph_type=None, **kwargs):
@@ -20,17 +32,17 @@ def plot_func(self, callback, graph_type=None, **kwargs):
def plot(self, *args, name=None, labels=None, colors=None, graph_type=None, **kwargs):
graph_type = graph_type or GraphType.Line
+ kwargs = _merge_kwargs(kwargs, name=name, labels=labels, colors=colors)
+ if graph_type == GraphType.ParametricCurve and len(args) in (1, 2, 4):
+ return cls.parametric_curve(self, *args, **kwargs)
if len(args) == 1:
- return plot_func(self, *args, name=name, labels=labels,
- colors=colors, graph_type=graph_type,
- **kwargs)
+ return plot_func(self, *args, graph_type=graph_type, **kwargs)
if len(args) == 2:
- if graph_type == GraphType.ParametricCurve:
- return cls.parametric_curve(self, *args, labels=labels, colors=colors, **kwargs)
if graph_type == GraphType.Line:
- return cls.line(self, *args, labels=labels, colors=colors, **kwargs)
+ return cls.line(self, *args, **kwargs)
if len(args) == 3:
- return cls.colormap(self, *args, name=name, **kwargs)
+ return cls.colormap(self, *args, **kwargs)
+
print(f"only 1, 2 or 3 arguments are supported, got {len(args)}")
return None
@@ -38,15 +50,9 @@ def plot(self, *args, name=None, labels=None, colors=None, graph_type=None, **kw
return cls
-def _patch_sciqlopplotrange_iter(cls):
- def __iter__(self):
- return iter((self[0], self[1]))
- cls.__iter__ = __iter__
- return cls
-
SciQLopPlot = _patch_sciqlop_plot(SciQLopPlot)
SciQLopTimeSeriesPlot = _patch_sciqlop_plot(SciQLopTimeSeriesPlot)
SciQLopMultiPlotPanel = _patch_sciqlop_plot(SciQLopMultiPlotPanel)
+SciQLopNDProjectionPlot = _patch_sciqlop_plot(SciQLopNDProjectionPlot)
-SciQLopPlotRange = _patch_sciqlopplotrange_iter(SciQLopPlotRange)
diff --git a/SciQLopPlots/bindings/SciQLopPlotsBindings/meson.build b/SciQLopPlots/bindings/SciQLopPlotsBindings/meson.build
index fdbbe2f..69eda9f 100644
--- a/SciQLopPlots/bindings/SciQLopPlotsBindings/meson.build
+++ b/SciQLopPlots/bindings/SciQLopPlotsBindings/meson.build
@@ -4,13 +4,14 @@ shiboken_generator_out = custom_target('sciqlopplots_bindings',
output:generated_srcs,
input:'../bindings.xml',
depend_files:sciqlopplots_bindings_src+['../snippets.cpp'],
- command:[python3, meson.current_source_dir()+'/../helper_scripts/shiboken-gen.py',
- '--input-header', meson.current_source_dir()+'/../bindings.h',
- '--input-xml', meson.current_source_dir()+'/../bindings.xml',
- '--shiboken', shiboken.full_path(),
- '--typesystem-paths', shiboken_typesystem,
- '--build-directory', meson.project_build_root(),
- '--ref-build-target', 'SciQLopPlotsBindings',
- '--output-directory',meson.current_build_dir()+'/../'
+ command:[
+ python3, meson.current_source_dir()+'/../helper_scripts/shiboken-gen.py',
+ '--input-header', meson.current_source_dir()+'/../bindings.h',
+ '--input-xml', meson.current_source_dir()+'/../bindings.xml',
+ '--shiboken', shiboken.full_path(),
+ '--typesystem-paths', shiboken_typesystem,
+ '--build-directory', meson.project_build_root(),
+ '--ref-build-target', 'SciQLopPlotsBindings',
+ '--output-directory',meson.current_build_dir()+'/../'
]
)
diff --git a/SciQLopPlots/bindings/bindings.h b/SciQLopPlots/bindings/bindings.h
index faae2b8..8b30405 100644
--- a/SciQLopPlots/bindings/bindings.h
+++ b/SciQLopPlots/bindings/bindings.h
@@ -10,7 +10,17 @@
#include "_QCustomPlot.hpp"
#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#include
+#include
#include
#include
#include
@@ -20,13 +30,25 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
#include
#include
#include
+#include
+#include
+#include
#include
+
+#include
+#include
+#include
+
+#include
+
#include
#endif // SCIQLOPPLOTS_BINDINGS_H
diff --git a/SciQLopPlots/bindings/bindings.xml b/SciQLopPlots/bindings/bindings.xml
index 985b567..77d66b2 100644
--- a/SciQLopPlots/bindings/bindings.xml
+++ b/SciQLopPlots/bindings/bindings.xml
@@ -14,6 +14,15 @@
+
+
+
+
+
+
+
+
+
@@ -58,6 +67,27 @@
+
+
+
+
+
+ if (!PyDateTimeAPI)
+ PyDateTime_IMPORT;
+ PyObject *floatObj = PyFloat_FromDouble(%CPPSELF->start());
+ PyObject *timeTuple = Py_BuildValue("(O)", floatObj);
+ return PyDateTime_FromTimestamp(timeTuple);
+
+
+
+
+ if (!PyDateTimeAPI)
+ PyDateTime_IMPORT;
+ PyObject *floatObj = PyFloat_FromDouble(%CPPSELF->stop());
+ PyObject *timeTuple = Py_BuildValue("(O)", floatObj);
+ return PyDateTime_FromTimestamp(timeTuple);
+
+
return PyLong_AsSsize_t(PyLong_FromLong(2));
@@ -82,110 +112,330 @@
}
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
@@ -202,9 +452,25 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -228,6 +494,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SciQLopPlots/bindings/helper_scripts/shiboken-gen.py b/SciQLopPlots/bindings/helper_scripts/shiboken-gen.py
index 610a448..1789cf8 100644
--- a/SciQLopPlots/bindings/helper_scripts/shiboken-gen.py
+++ b/SciQLopPlots/bindings/helper_scripts/shiboken-gen.py
@@ -37,7 +37,7 @@ def cpp_flags(build_dir, ref_build_target):
'--avoid-protected-hack',
'--enable-pyside-extensions',
#'--debug-level=full',
- '-std=c++17',
+ '-std=c++20',
'--generator-set=shiboken']
if 'linux' in platform.system().lower():
@@ -68,9 +68,19 @@ def cpp_flags(build_dir, ref_build_target):
cmd = [args.shiboken, args.input_header, args.input_xml ] + shiboken_constant_args + cpp_flags(args.build_directory, args.ref_build_target) + [ f'--typesystem-paths={args.typesystem_paths}', f'--output-directory={args.output_directory}']
-subprocess.run(
- cmd,
- check=True,
- env=env
-)
+try:
+ r = subprocess.run(
+ cmd,
+ check=True,
+ env=env,
+ capture_output=True
+ )
+except subprocess.CalledProcessError as e:
+ print(e)
+ print(e.stdout.decode())
+ print(e.stderr.decode())
+ sys.exit(e.returncode)
+print(r.stdout.decode())
+print(r.stderr.decode())
+sys.exit(r.returncode)
diff --git a/SciQLopPlots/bindings/helper_scripts/src_list.py b/SciQLopPlots/bindings/helper_scripts/src_list.py
index 264b6e4..a503bef 100755
--- a/SciQLopPlots/bindings/helper_scripts/src_list.py
+++ b/SciQLopPlots/bindings/helper_scripts/src_list.py
@@ -28,6 +28,7 @@ def find_all_objects(node, found=None):
for sp in smart_ptrs:
classes = sp.attrib.get('instantiations', '').split(',')
for c in classes:
+ c = c.split('=')[0].strip()
found.append(f"{sp.attrib['name']}_{c}")
for item in node.findall('namespace-type'):
if item.attrib.get('visible', 'true') in ['true', 'auto']:
diff --git a/SciQLopPlots/meson.build b/SciQLopPlots/meson.build
index d132856..09d91ae 100644
--- a/SciQLopPlots/meson.build
+++ b/SciQLopPlots/meson.build
@@ -5,6 +5,7 @@ cpp_utils_dep = dependency('cpp_utils', fallback : ['cpp_utils', 'cpp_utils_dep'
hedley_dep = dependency('hedley', main : true, fallback : ['hedley', 'hedley_dep'])
fmt_dep = dependency('fmt', static:true)
gl_dep = dependency('gl')
+QCustomPlot_dep = dependency('qcustomplot')
qmake_possible_names = ['qmake-qt6','qmake6','qmake']
pyside_version = '6'
@@ -17,10 +18,12 @@ src_list = find_program('bindings/helper_scripts/src_list.py')
shiboken_helper = find_program('bindings/helper_scripts/shiboken-helper.py')
shiboken_gen = find_program('bindings/helper_scripts/shiboken-gen.py')
-
shiboken = find_program(f'shiboken@pyside_version@')
qmake = find_program(qmake_possible_names)
+message(find_program('python3', required:true).full_path())
+
+
pymod = import('python')
python3 = pymod.find_installation('python3', modules:[f'PySide@pyside_version@',
f'shiboken@pyside_version@',
@@ -53,11 +56,17 @@ shiboken_dep = declare_dependency(compile_args: shiboken_build_flags, link_args:
moc_headers = [
'bindings/_QCustomPlot.hpp',
+ project_source_root + '/include/SciQLopPlots/Debug.hpp',
+ project_source_root + '/include/SciQLopPlots/Profiling.hpp',
+ project_source_root + '/include/SciQLopPlots/unique_names_factory.hpp',
project_source_root + '/include/SciQLopPlots/enums.hpp',
project_source_root + '/include/SciQLopPlots/SciQLopPlotRange.hpp',
project_source_root + '/include/SciQLopPlots/SciQLopPlotInterface.hpp',
+ project_source_root + '/include/SciQLopPlots/SciQLopPlotLegendInterface.hpp',
+ project_source_root + '/include/SciQLopPlots/SciQLopPlotLegend.hpp',
project_source_root + '/include/SciQLopPlots/SciQLopPlot.hpp',
project_source_root + '/include/SciQLopPlots/SciQLopTimeSeriesPlot.hpp',
+ project_source_root + '/include/SciQLopPlots/SciQLopNDProjectionPlot.hpp',
project_source_root + '/include/SciQLopPlots/SciQLopPlotAxis.hpp',
project_source_root + '/include/SciQLopPlots/MultiPlots/SciQLopPlotCollection.hpp',
project_source_root + '/include/SciQLopPlots/MultiPlots/SciQLopMultiPlotObject.hpp',
@@ -69,41 +78,86 @@ moc_headers = [
project_source_root + '/include/SciQLopPlots/MultiPlots/TimeAxisSynchronizer.hpp',
project_source_root + '/include/SciQLopPlots/MultiPlots/VPlotsAlign.hpp',
project_source_root + '/include/SciQLopPlots/Plotables/SciQLopGraphInterface.hpp',
+ project_source_root + '/include/SciQLopPlots/Plotables/SciQLopGraphComponentInterface.hpp',
+ project_source_root + '/include/SciQLopPlots/Plotables/SciQLopGraphComponent.hpp',
project_source_root + '/include/SciQLopPlots/Plotables/QCPAbstractPlottableWrapper.hpp',
project_source_root + '/include/SciQLopPlots/Plotables/SciQLopCurve.hpp',
+ project_source_root + '/include/SciQLopPlots/Plotables/SciQLopNDProjectionCurves.hpp',
project_source_root + '/include/SciQLopPlots/Plotables/SciQLopLineGraph.hpp',
project_source_root + '/include/SciQLopPlots/Plotables/SciQLopColorMap.hpp',
- project_source_root + '/include/SciQLopPlots/Plotables/SciQLopLineGraphResampler.hpp',
- project_source_root + '/include/SciQLopPlots/Plotables/SciQLopCurveResampler.hpp',
- project_source_root + '/include/SciQLopPlots/Plotables/SciQLopColorMapResampler.hpp',
+ project_source_root + '/include/SciQLopPlots/Plotables/Resamplers/AbstractResampler.hpp',
+ project_source_root + '/include/SciQLopPlots/Plotables/Resamplers/SciQLopLineGraphResampler.hpp',
+ project_source_root + '/include/SciQLopPlots/Plotables/Resamplers/SciQLopCurveResampler.hpp',
+ project_source_root + '/include/SciQLopPlots/Plotables/Resamplers/SciQLopColorMapResampler.hpp',
project_source_root + '/include/SciQLopPlots/Items/SciQLopVerticalSpan.hpp',
project_source_root + '/include/SciQLopPlots/Items/SciQLopPlotItem.hpp',
project_source_root + '/include/SciQLopPlots/Items/SciQLopTracer.hpp',
project_source_root + '/include/SciQLopPlots/Items/QCPItemRichText.hpp',
+ project_source_root + '/include/SciQLopPlots/Items/SciQLopPixmapItem.hpp',
project_source_root + '/include/SciQLopPlots/DataProducer/DataProducer.hpp',
- project_source_root + '/qcustomplot-source/qcustomplot.h'
+ project_source_root + '/include/SciQLopPlots/DragNDrop/PlotDragNDropCallback.hpp',
+ project_source_root + '/include/SciQLopPlots/DragNDrop/PlaceHolderManager.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/InspectorBase.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Inspectors.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Model/Model.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Model/Node.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Inspectors/SciQLopMultiPlotPanelInspector.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Inspectors/SciQLopPlotInspector.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Inspectors/SciQLopNDProjectionPlotInspector.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Inspectors/SciQLopNDProjectionCurvesInspector.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Inspectors/SciQLopGraphInterfaceInspector.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Inspectors/SciQLopGraphComponentInspector.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/Inspectors/SciQLopColorMapInspector.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/View/TreeView.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/View/InspectorView.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertyDelegateBase.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertyDelegates.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopMultiPlotPanelDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/View/PropertiesPanel.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/View/PropertiesView.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/BooleanDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/ColorDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/LineDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/LegendDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/ColorGradientDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopPlotAxisDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopPlotDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopGraphDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopColorMapDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopGraphComponentDelegate.hpp',
+ project_source_root + '/include/SciQLopPlots/Products/ProductsModel.hpp',
+ project_source_root + '/include/SciQLopPlots/Products/ProductsNode.hpp',
+ project_source_root + '/include/SciQLopPlots/Products/ProductsView.hpp',
+ project_source_root + '/include/SciQLopPlots/Icons/icons.hpp'
]
moc_sources = []
headers = moc_headers + \
[project_source_root+'/include/SciQLopPlots/Python/PythonInterface.hpp',
+ project_source_root+'/include/SciQLopPlots/Python/Views.hpp',
project_source_root+'/include/SciQLopPlots/constants.hpp']
includes = include_directories(['../include', '../qcustomplot-source'])
-moc_files = qtmod.preprocess(
- moc_headers : moc_headers,
- moc_sources : moc_sources,
+moc_files = qtmod.compile_moc(
+ headers : moc_headers,
+ sources : moc_sources,
include_directories : includes)
+resources_files = qtmod.compile_resources(sources : ['../resources/resources.qrc'])
sources = moc_files \
+ + resources_files \
+ sciqlopplots_bindings_src \
+ shiboken_generator_out \
+ [
+ '../src/Profiling.cpp',
'../src/PythonInterface.cpp',
+ '../src/SciQLopPlotInterface.cpp',
'../src/SciQLopPlot.cpp',
+ '../src/SciQLopPlotLegend.cpp',
'../src/SciQLopTimeSeriesPlot.cpp',
+ '../src/SciQLopNDProjectionPlot.cpp',
'../src/SciQLopPlotAxis.cpp',
'../src/SciQLopPlotCollection.cpp',
'../src/AxisSynchronizer.cpp',
@@ -114,35 +168,81 @@ sources = moc_files \
'../src/SciQLopMultiPlotPanel.cpp',
'../src/SciQLopPlotContainer.cpp',
'../src/MultiPlotsVSpan.cpp',
+ '../src/SciQLopPixmapItem.cpp',
'../src/SciQLopGraphInterface.cpp',
+ '../src/SciQLopGraphComponentInterface.cpp',
+ '../src/SciQLopGraphComponent.cpp',
'../src/QCPAbstractPlottableWrapper.cpp',
'../src/SciQLopPlotItem.cpp',
'../src/SciQLopVerticalSpan.cpp',
'../src/SciQLopLineGraph.cpp',
- '../src/SciQLopLineGraphResampler.cpp',
'../src/SciQLopCurve.cpp',
- '../src/SciQLopCurveResampler.cpp',
+ '../src/SciQLopNDProjectionCurves.cpp',
'../src/SciQLopColorMap.cpp',
+ '../src/AbstractResampler.cpp',
+ '../src/SciQLopLineGraphResampler.cpp',
+ '../src/SciQLopCurveResampler.cpp',
'../src/SciQLopColorMapResampler.cpp',
'../src/SciQLopTracer.cpp',
'../src/QCPItemRichText.cpp',
'../src/DataProducer.cpp',
- '../qcustomplot-source/qcustomplot.cpp'
+ '../src/InspectorBase.cpp',
+ '../src/Inspectors.cpp',
+ '../src/Model.cpp',
+ '../src/Node.cpp',
+ '../src/SciQLopMultiPlotPanelInspector.cpp',
+ '../src/SciQLopPlotInspector.cpp',
+ '../src/SciQLopNDProjectionPlotInspector.cpp',
+ '../src/SciQLopNDProjectionCurvesInspector.cpp',
+ '../src/SciQLopGraphInterfaceInspector.cpp',
+ '../src/SciQLopGraphComponentInspector.cpp',
+ '../src/SciQLopColorMapInspector.cpp',
+ '../src/TreeView.cpp',
+ '../src/InspectorView.cpp',
+ '../src/PropertyDelegateBase.cpp',
+ '../src/SciQLopMultiPlotPanelDelegate.cpp',
+ '../src/PropertiesPanel.cpp',
+ '../src/PropertiesView.cpp',
+ '../src/BooleanDelegate.cpp',
+ '../src/SciQLopPlotDelegate.cpp',
+ '../src/LegendDelegate.cpp',
+ '../src/SciQLopGraphDelegate.cpp',
+ '../src/SciQLopColorMapDelegate.cpp',
+ '../src/SciQLopGraphComponentDelegate.cpp',
+ '../src/SciQLopPlotAxisDelegate.cpp',
+ '../src/ColorDelegate.cpp',
+ '../src/LineDelegate.cpp',
+ '../src/ColorGradientDelegate.cpp',
+ '../src/ProductsModel.cpp',
+ '../src/ProductsNode.cpp',
+ '../src/ProductsView.cpp',
+ '../src/icons.cpp'
+ # '../qcustomplot-source/qcustomplot.cpp'
]
cpp_args = []
-if target_machine.system() != 'darwin'
- cpp_args += ['-DQCUSTOMPLOT_USE_OPENGL']
-endif
+#if target_machine.system() != 'darwin'
+# cpp_args += ['-DQCUSTOMPLOT_USE_OPENGL']
+#endif
if get_option('trace_refcount') == true
cpp_args += ['-D_TRACE_REF_COUNT']
endif
+optional_deps = []
+
+if get_option ( 'tracy_enable')
+ if get_option ( 'buildtype') != 'debugoptimized'
+ warning ( 'Profiling builds should set -- buildtype = debugoptimized')
+ endif
+ tracy = dependency ( 'tracy', static : true )
+ optional_deps += [ tracy ]
+endif
+
sciqlopplots_bindings = python3.extension_module('SciQLopPlotsBindings',
sources,
- dependencies : [ python3_dep, shiboken_dep, qtdeps, cpp_utils_dep, gl_dep, fmt_dep],
+ dependencies : [ python3_dep, shiboken_dep, qtdeps, QCustomPlot_dep, cpp_utils_dep, gl_dep, fmt_dep] + optional_deps,
cpp_args: cpp_args,
subdir : 'SciQLopPlots',
install: true,
diff --git a/include/SciQLopPlots/DataProducer/DataProducer.hpp b/include/SciQLopPlots/DataProducer/DataProducer.hpp
index 18f3330..6972794 100644
--- a/include/SciQLopPlots/DataProducer/DataProducer.hpp
+++ b/include/SciQLopPlots/DataProducer/DataProducer.hpp
@@ -43,11 +43,13 @@ struct _3D_data
PyBuffer z;
};
+using _NDdata = QList;
+
class DataProviderInterface : public QObject
{
Q_OBJECT
- std::variant m_next_state;
- std::variant m_current_state;
+ std::variant m_next_state;
+ std::variant m_current_state;
QTimer* m_rate_limit_timer;
QMutex m_mutex;
bool m_has_pending_change = false;
@@ -57,9 +59,12 @@ class DataProviderInterface : public QObject
#endif
Q_SLOT void _threaded_update();
+ void _notify_new_data(const QList& data);
+
void _range_based_update(const SciQLopPlotRange& new_range);
void _data_based_update(const _2D_data& new_data);
void _data_based_update(const _3D_data& new_data);
+ void _data_based_update(const _NDdata& new_data);
inline Q_SLOT void _start_timer()
@@ -77,17 +82,20 @@ class DataProviderInterface : public QObject
virtual QList get_data(double lower, double upper);
virtual QList get_data(PyBuffer x, PyBuffer y);
virtual QList get_data(PyBuffer x, PyBuffer y, PyBuffer z);
+ virtual QList get_data(QList values);
#ifndef BINDINGS_H
Q_SIGNAL void new_data_3d(PyBuffer x, PyBuffer y, PyBuffer z);
Q_SIGNAL void new_data_2d(PyBuffer x, PyBuffer y);
+ Q_SIGNAL void new_data_nd(QList values);
#endif
protected:
void set_range(SciQLopPlotRange new_range) noexcept;
void set_data(_2D_data new_data) noexcept;
void set_data(_3D_data new_data) noexcept;
+ void set_data(_NDdata new_data) noexcept;
friend class DataProviderWorker;
};
@@ -122,6 +130,11 @@ class DataProviderWorker : public QObject
{
m_data_provider->set_data(_3D_data { x, y, z });
}
+
+ inline Q_SLOT virtual void set_data(QList values)
+ {
+ m_data_provider->set_data(values);
+ }
};
@@ -181,10 +194,13 @@ class SimplePyCallablePipeline : public QObject
inline Q_SLOT void set_range(const SciQLopPlotRange& range) { m_worker->set_range(range); }
inline Q_SLOT void set_data(PyBuffer x, PyBuffer y) { m_worker->set_data(x, y); }
inline Q_SLOT void set_data(PyBuffer x, PyBuffer y, PyBuffer z) { m_worker->set_data(x, y, z); }
+ inline Q_SLOT void set_data(QList values) { m_worker->set_data(values); }
+
#ifndef BINDINGS_H
Q_SIGNAL void new_data_3d(PyBuffer x, PyBuffer y, PyBuffer z);
Q_SIGNAL void new_data_2d(PyBuffer x, PyBuffer y);
+ Q_SIGNAL void new_data_nd(QList values);
#endif
};
diff --git a/include/SciQLopPlots/Debug.hpp b/include/SciQLopPlots/Debug.hpp
new file mode 100644
index 0000000..2d10c0f
--- /dev/null
+++ b/include/SciQLopPlots/Debug.hpp
@@ -0,0 +1,48 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include
+
+#ifdef DEBUG
+
+#define WARN_ABSTRACT_METHOD \
+ { \
+ std::cout << "Abstract method called:" << __PRETTY_FUNCTION__ << std::endl; \
+ }
+
+#define DEBUG_MESSAGE(message) \
+ { \
+ std::cout << message << std::endl; \
+ }
+
+#define WARN_UNSUPPORTED_FUNCTIONALITY \
+ { \
+ std::cout << "Unsupported functionality:" << __PRETTY_FUNCTION__ << std::endl; \
+ }
+
+#else
+
+#define WARN_ABSTRACT_METHOD
+#define DEBUG_MESSAGE(message)
+#define WARN_UNSUPPORTED_FUNCTIONALITY
+
+#endif
diff --git a/include/SciQLopPlots/DragNDrop/PlaceHolderManager.hpp b/include/SciQLopPlots/DragNDrop/PlaceHolderManager.hpp
new file mode 100644
index 0000000..f512f19
--- /dev/null
+++ b/include/SciQLopPlots/DragNDrop/PlaceHolderManager.hpp
@@ -0,0 +1,184 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/MultiPlots/SciQLopPlotCollection.hpp"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+enum class DropLocation
+{
+ NewPlot,
+ ExistingPlot,
+};
+
+struct DropResult
+{
+ DropLocation location;
+ int index;
+};
+
+class PlaceHolder : public SciQLopPlotInterface
+{
+ Q_OBJECT
+
+public:
+ PlaceHolder(QWidget* parent = nullptr) : SciQLopPlotInterface(parent, "PlaceHolder")
+ {
+ setStyleSheet("background-color: #BBD5EE; border: 1px solid #2A7FD4");
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ }
+};
+
+class PlaceHolderManager : public QObject
+{
+ Q_OBJECT
+
+ enum class PlaceHolderLocation
+ {
+ None,
+ Top,
+ Bottom
+ };
+
+ PlaceHolder* _place_holder = nullptr;
+ QWidget* _parent = nullptr;
+
+ PlaceHolderLocation _compute_location(const QPointF& pos) const
+ {
+ if (auto index = _interface()->index(pos); index != -1)
+ {
+ auto plot = _interface()->plot_at(index);
+ auto plot_top = plot->geometry().top();
+ auto plot_bottom = plot->geometry().bottom();
+ auto upper_30_percent = plot_top + 0.3 * plot->geometry().height();
+ auto lower_30_percent = plot_bottom - 0.3 * plot->geometry().height();
+ if (pos.y() < upper_30_percent)
+ {
+ return PlaceHolderLocation::Top;
+ }
+ if (pos.y() > lower_30_percent)
+ {
+ return PlaceHolderLocation::Bottom;
+ }
+ }
+ return PlaceHolderLocation::None;
+ }
+
+ SciQLopPlotInterface* _plot_at(const QPointF& pos) const
+ {
+ if (auto index = _interface()->index(pos); index != -1)
+ {
+ return _interface()->plot_at(index);
+ }
+ return nullptr;
+ }
+
+ inline PlaceHolder* _create_place_holder(int index)
+ {
+ auto place_holder = new PlaceHolder();
+ place_holder->setMinimumHeight(0.9 * _parent->height() / (1 + _interface()->size()));
+ _interface()->insert_plot(index, place_holder);
+ return place_holder;
+ }
+
+ inline void _remove_place_holder()
+ {
+ _interface()->remove_plot(_place_holder);
+ _place_holder = nullptr;
+ }
+
+ inline PlaceHolder* _create_place_holder_if_needed(const QPointF& pos)
+ {
+ if (_interface()->empty())
+ {
+ return _create_place_holder(0);
+ }
+ auto location = _compute_location(pos);
+ switch (location)
+ {
+ case PlaceHolderLocation::Top:
+ return _create_place_holder(std::max(0, _interface()->index(pos) - 1));
+ case PlaceHolderLocation::Bottom:
+ return _create_place_holder(_interface()->index(pos) + 1);
+ default:
+ break;
+ }
+
+ return nullptr;
+ }
+
+ inline SciQLopPlotCollectionInterface* _interface() const
+ {
+ return dynamic_cast(_parent);
+ }
+
+
+public:
+ PlaceHolderManager(QWidget* parent = nullptr) : QObject(parent), _parent { parent } { }
+
+ inline void dragEnterEvent(QDragEnterEvent* event)
+ {
+ _place_holder = _create_place_holder_if_needed(event->position());
+ }
+
+ inline void dragMoveEvent(QDragMoveEvent* event)
+ {
+ if (_place_holder)
+ {
+ if (_plot_at(event->position()) != _place_holder)
+ {
+ _remove_place_holder();
+ return;
+ }
+ }
+ else
+ {
+ _place_holder = _create_place_holder_if_needed(event->position());
+ }
+ }
+
+ inline void dragLeaveEvent(QDragLeaveEvent* event)
+ {
+ if (_place_holder)
+ {
+ _remove_place_holder();
+ }
+ }
+
+ inline DropResult dropEvent(QDropEvent* event)
+ {
+ if (_place_holder)
+ {
+ int index = _interface()->index(_place_holder);
+ _remove_place_holder();
+ return { DropLocation::NewPlot, index };
+ }
+ return { DropLocation::ExistingPlot,
+ _interface()->index_from_global_position(QCursor::pos()) };
+ }
+};
diff --git a/include/SciQLopPlots/DragNDrop/PlotDragNDropCallback.hpp b/include/SciQLopPlots/DragNDrop/PlotDragNDropCallback.hpp
new file mode 100644
index 0000000..ee31835
--- /dev/null
+++ b/include/SciQLopPlots/DragNDrop/PlotDragNDropCallback.hpp
@@ -0,0 +1,48 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include "SciQLopPlots/SciQLopPlotInterface.hpp"
+#include
+#include
+
+class PlotDragNDropCallback : public QObject
+{
+ Q_OBJECT
+ QString _mime_type;
+ bool _create_placeholder = false;
+
+public:
+ PlotDragNDropCallback(
+ const QString& mime_type, bool create_placeholder = false, QObject* parent = nullptr)
+ : QObject(parent), _mime_type(mime_type), _create_placeholder(create_placeholder)
+ {
+ }
+
+ inline const QString& mime_type() const { return _mime_type; }
+
+ virtual ~PlotDragNDropCallback() = default;
+
+ inline virtual void call(SciQLopPlotInterface* plot, const QMimeData* mimeData) { }
+
+ inline bool create_placeholder() const { return _create_placeholder; }
+};
diff --git a/include/SciQLopPlots/Icons/icons.hpp b/include/SciQLopPlots/Icons/icons.hpp
new file mode 100644
index 0000000..4ae8688
--- /dev/null
+++ b/include/SciQLopPlots/Icons/icons.hpp
@@ -0,0 +1,44 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include
+#include
+#include
+
+class Icons : public QObject
+{
+ Q_OBJECT
+
+ QMap m_icons;
+
+
+public:
+ Icons(QObject* parent = nullptr);
+ virtual ~Icons() = default;
+
+ static const QIcon& get_icon(const QString& name);
+ static void add_icon(const QString& name, const QIcon& icon, const QStringList& aliases = {});
+
+ inline static QStringList icons() { return instance()->m_icons.keys(); }
+
+ static Icons* instance();
+};
diff --git a/include/SciQLopPlots/Inspector/InspectorBase.hpp b/include/SciQLopPlots/Inspector/InspectorBase.hpp
new file mode 100644
index 0000000..320670a
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/InspectorBase.hpp
@@ -0,0 +1,46 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include
+#include
+#include
+
+class PlotsModelNode;
+
+class InspectorBase : public QObject
+{
+ Q_OBJECT
+
+public:
+ using compatible_type = QObject;
+ InspectorBase(QObject* parent = nullptr);
+ virtual ~InspectorBase() = default;
+
+ virtual QList children(QObject* obj);
+ virtual QObject* child(const QString& name, QObject* obj);
+ virtual QIcon icon(const QObject* const obj);
+ virtual QString tooltip(const QObject* const obj);
+ virtual void connect_node(PlotsModelNode* node, QObject* const obj);
+ virtual void set_selected(QObject* obj, bool selected);
+ virtual bool selected(const QObject* obj);
+ virtual bool deletable(const QObject* obj);
+};
diff --git a/include/SciQLopPlots/Inspector/Inspectors.hpp b/include/SciQLopPlots/Inspector/Inspectors.hpp
new file mode 100644
index 0000000..dbe077d
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Inspectors.hpp
@@ -0,0 +1,73 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Debug.hpp"
+#include
+#include
+
+class InspectorBase;
+
+class Inspectors : public QObject
+{
+
+ Q_OBJECT
+
+ QMap m_inspectors;
+
+ Inspectors() { }
+
+public:
+ virtual ~Inspectors() = default;
+
+ inline static Inspectors& instance()
+ {
+ static Inspectors instance;
+ return instance;
+ }
+
+ inline static int registerInspector(const QString& typeName, InspectorBase* inspector)
+ {
+ instance().m_inspectors[typeName] = inspector;
+ return instance().m_inspectors.size();
+ }
+
+ template
+ inline static auto
+ registerInspector(InspectorBase* inspector) -> decltype(T::staticMetaObject.className(), int())
+ {
+ return registerInspector(T::staticMetaObject.className(), inspector);
+ }
+
+ inline static InspectorBase* inspector(const QString& typeName)
+ {
+ DEBUG_MESSAGE("Looking for inspector for type : " << typeName.toStdString());
+ DEBUG_MESSAGE(
+ "Available inspectors : " << instance().m_inspectors.keys().join(", ").toStdString());
+ return instance().m_inspectors.value(typeName, nullptr);
+ }
+
+ static InspectorBase* inspector(const QObject* obj);
+};
+
+#define REGISTER_INSPECTOR(INSPECTOR) \
+ static int _id_##INSPECTOR \
+ = Inspectors::registerInspector(new INSPECTOR());
diff --git a/include/SciQLopPlots/Inspector/Inspectors/SciQLopColorMapInspector.hpp b/include/SciQLopPlots/Inspector/Inspectors/SciQLopColorMapInspector.hpp
new file mode 100644
index 0000000..d0aed58
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Inspectors/SciQLopColorMapInspector.hpp
@@ -0,0 +1,59 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/InspectorBase.hpp"
+#include "SciQLopPlots/Inspector/Inspectors.hpp"
+#include "SciQLopPlots/Plotables/SciQLopColorMap.hpp"
+#include
+#include
+#include
+
+class SciQLopColorMapInspector : public InspectorBase
+{
+ Q_OBJECT
+ inline SciQLopColorMap* _colormap(QObject* obj) { return qobject_cast(obj); }
+
+public:
+ using compatible_type = SciQLopColorMap;
+
+ SciQLopColorMapInspector() : InspectorBase() { }
+
+ virtual QList children(QObject* obj) Q_DECL_OVERRIDE;
+
+ virtual QObject* child(const QString& name, QObject* obj) Q_DECL_OVERRIDE;
+
+ inline virtual QIcon icon(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QIcon();
+ }
+
+ inline virtual QString tooltip(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QString();
+ }
+
+ virtual void connect_node(PlotsModelNode* node, QObject* const obj) Q_DECL_OVERRIDE;
+
+ virtual void set_selected(QObject* obj, bool selected) Q_DECL_OVERRIDE;
+};
diff --git a/include/SciQLopPlots/Inspector/Inspectors/SciQLopGraphComponentInspector.hpp b/include/SciQLopPlots/Inspector/Inspectors/SciQLopGraphComponentInspector.hpp
new file mode 100644
index 0000000..47c827b
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Inspectors/SciQLopGraphComponentInspector.hpp
@@ -0,0 +1,72 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/InspectorBase.hpp"
+#include "SciQLopPlots/Inspector/Inspectors.hpp"
+#include "SciQLopPlots/Plotables/SciQLopGraphInterface.hpp"
+#include
+#include
+#include
+
+class SciQLopGraphComponentInspector : public InspectorBase
+{
+ Q_OBJECT
+
+ inline SciQLopGraphComponentInterface* _component(QObject* obj)
+ {
+ return qobject_cast(obj);
+ }
+
+ inline const SciQLopGraphComponentInterface* _component(const QObject* obj)
+ {
+ return qobject_cast(obj);
+ }
+
+public:
+ using compatible_type = SciQLopGraphComponentInterface;
+
+ SciQLopGraphComponentInspector() : InspectorBase() { }
+
+ virtual QList children(QObject* obj) Q_DECL_OVERRIDE;
+
+ virtual QObject* child(const QString& name, QObject* obj) Q_DECL_OVERRIDE;
+
+ inline virtual QIcon icon(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QIcon();
+ }
+
+ inline virtual QString tooltip(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QString();
+ }
+
+ virtual void connect_node(PlotsModelNode* node, QObject* const obj) Q_DECL_OVERRIDE;
+
+ virtual void set_selected(QObject* obj, bool selected) Q_DECL_OVERRIDE;
+
+ virtual bool selected(const QObject* obj) Q_DECL_OVERRIDE;
+
+ inline virtual bool deletable(const QObject* obj) Q_DECL_OVERRIDE { return false; }
+};
diff --git a/include/SciQLopPlots/Inspector/Inspectors/SciQLopGraphInterfaceInspector.hpp b/include/SciQLopPlots/Inspector/Inspectors/SciQLopGraphInterfaceInspector.hpp
new file mode 100644
index 0000000..a27cd38
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Inspectors/SciQLopGraphInterfaceInspector.hpp
@@ -0,0 +1,69 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/InspectorBase.hpp"
+#include "SciQLopPlots/Inspector/Inspectors.hpp"
+#include "SciQLopPlots/Plotables/SciQLopGraphInterface.hpp"
+#include
+#include
+#include
+
+class SciQLopGraphInterfaceInspector : public InspectorBase
+{
+ Q_OBJECT
+
+ inline SciQLopGraphInterface* _graph(QObject* obj)
+ {
+ return qobject_cast(obj);
+ }
+
+ inline const SciQLopGraphInterface* _graph(const QObject* obj)
+ {
+ return qobject_cast(obj);
+ }
+
+public:
+ using compatible_type = SciQLopGraphInterface;
+
+ SciQLopGraphInterfaceInspector() : InspectorBase() { }
+
+ virtual QList children(QObject* obj) Q_DECL_OVERRIDE;
+
+ virtual QObject* child(const QString& name, QObject* obj) Q_DECL_OVERRIDE;
+
+ inline virtual QIcon icon(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QIcon();
+ }
+
+ inline virtual QString tooltip(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QString();
+ }
+
+ virtual void connect_node(PlotsModelNode* node, QObject* const obj) Q_DECL_OVERRIDE;
+
+ virtual void set_selected(QObject* obj, bool selected) Q_DECL_OVERRIDE;
+ virtual bool selected(const QObject* obj) Q_DECL_OVERRIDE;
+};
diff --git a/include/SciQLopPlots/Inspector/Inspectors/SciQLopMultiPlotPanelInspector.hpp b/include/SciQLopPlots/Inspector/Inspectors/SciQLopMultiPlotPanelInspector.hpp
new file mode 100644
index 0000000..071fd79
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Inspectors/SciQLopMultiPlotPanelInspector.hpp
@@ -0,0 +1,63 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/InspectorBase.hpp"
+#include "SciQLopPlots/Inspector/Inspectors.hpp"
+#include "SciQLopPlots/MultiPlots/SciQLopMultiPlotPanel.hpp"
+#include
+#include
+#include
+
+class SciQLopMultiPlotPanelInspector : public InspectorBase
+{
+ Q_OBJECT
+
+ inline SciQLopMultiPlotPanel* _panel(QObject* obj)
+ {
+ return qobject_cast(obj);
+ }
+
+public:
+ using compatible_type = SciQLopMultiPlotPanel;
+
+ SciQLopMultiPlotPanelInspector() : InspectorBase() { }
+
+ virtual QList children(QObject* obj) Q_DECL_OVERRIDE;
+
+ virtual QObject* child(const QString& name, QObject* obj) Q_DECL_OVERRIDE;
+
+ inline virtual QIcon icon(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QIcon();
+ }
+
+ inline virtual QString tooltip(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QString();
+ }
+
+ virtual void connect_node(PlotsModelNode* node, QObject* const obj) Q_DECL_OVERRIDE;
+
+ virtual void set_selected(QObject* obj, bool selected) Q_DECL_OVERRIDE;
+};
diff --git a/include/SciQLopPlots/Inspector/Inspectors/SciQLopNDProjectionCurvesInspector.hpp b/include/SciQLopPlots/Inspector/Inspectors/SciQLopNDProjectionCurvesInspector.hpp
new file mode 100644
index 0000000..ed0274b
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Inspectors/SciQLopNDProjectionCurvesInspector.hpp
@@ -0,0 +1,69 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2025, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/InspectorBase.hpp"
+#include "SciQLopPlots/Inspector/Inspectors.hpp"
+#include "SciQLopPlots/Plotables/SciQLopNDProjectionCurves.hpp"
+#include
+#include
+#include
+
+class SciQLopNDProjectionCurvesInspector : public InspectorBase
+{
+ Q_OBJECT
+
+ inline SciQLopNDProjectionCurves* _graph(QObject* obj)
+ {
+ return qobject_cast(obj);
+ }
+
+ inline const SciQLopNDProjectionCurves* _graph(const QObject* obj)
+ {
+ return qobject_cast(obj);
+ }
+
+public:
+ using compatible_type = SciQLopNDProjectionCurves;
+
+ SciQLopNDProjectionCurvesInspector() : InspectorBase() { }
+
+ virtual QList children(QObject* obj) Q_DECL_OVERRIDE;
+
+ virtual QObject* child(const QString& name, QObject* obj) Q_DECL_OVERRIDE;
+
+ inline virtual QIcon icon(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QIcon();
+ }
+
+ inline virtual QString tooltip(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QString();
+ }
+
+ virtual void connect_node(PlotsModelNode* node, QObject* const obj) Q_DECL_OVERRIDE;
+
+ virtual void set_selected(QObject* obj, bool selected) Q_DECL_OVERRIDE;
+ virtual bool selected(const QObject* obj) Q_DECL_OVERRIDE;
+};
diff --git a/include/SciQLopPlots/Inspector/Inspectors/SciQLopNDProjectionPlotInspector.hpp b/include/SciQLopPlots/Inspector/Inspectors/SciQLopNDProjectionPlotInspector.hpp
new file mode 100644
index 0000000..1f7baf8
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Inspectors/SciQLopNDProjectionPlotInspector.hpp
@@ -0,0 +1,59 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2025, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/InspectorBase.hpp"
+#include "SciQLopPlots/Inspector/Inspectors.hpp"
+#include "SciQLopPlots/SciQLopNDProjectionPlot.hpp"
+#include
+#include
+#include
+
+class SciQLopNDProjectionPlotInspector : public InspectorBase
+{
+ Q_OBJECT
+ inline SciQLopNDProjectionPlot* _plot(QObject* obj) { return qobject_cast(obj); }
+
+public:
+ using compatible_type = SciQLopNDProjectionPlot;
+
+ SciQLopNDProjectionPlotInspector() : InspectorBase() { }
+
+ virtual QList children(QObject* obj) Q_DECL_OVERRIDE;
+
+ virtual QObject* child(const QString& name, QObject* obj) Q_DECL_OVERRIDE;
+
+ inline virtual QIcon icon(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QIcon();
+ }
+
+ inline virtual QString tooltip(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QString();
+ }
+
+ virtual void connect_node(PlotsModelNode* node, QObject* const obj) Q_DECL_OVERRIDE;
+
+ virtual void set_selected(QObject* obj, bool selected) Q_DECL_OVERRIDE;
+};
diff --git a/include/SciQLopPlots/Inspector/Inspectors/SciQLopPlotInspector.hpp b/include/SciQLopPlots/Inspector/Inspectors/SciQLopPlotInspector.hpp
new file mode 100644
index 0000000..d461f9d
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Inspectors/SciQLopPlotInspector.hpp
@@ -0,0 +1,59 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/InspectorBase.hpp"
+#include "SciQLopPlots/Inspector/Inspectors.hpp"
+#include "SciQLopPlots/SciQLopPlot.hpp"
+#include
+#include
+#include
+
+class SciQLopPlotInspector : public InspectorBase
+{
+ Q_OBJECT
+ inline SciQLopPlot* _plot(QObject* obj) { return qobject_cast(obj); }
+
+public:
+ using compatible_type = SciQLopPlot;
+
+ SciQLopPlotInspector() : InspectorBase() { }
+
+ virtual QList children(QObject* obj) Q_DECL_OVERRIDE;
+
+ virtual QObject* child(const QString& name, QObject* obj) Q_DECL_OVERRIDE;
+
+ inline virtual QIcon icon(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QIcon();
+ }
+
+ inline virtual QString tooltip(const QObject* const obj) Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(obj);
+ return QString();
+ }
+
+ virtual void connect_node(PlotsModelNode* node, QObject* const obj) Q_DECL_OVERRIDE;
+
+ virtual void set_selected(QObject* obj, bool selected) Q_DECL_OVERRIDE;
+};
diff --git a/include/SciQLopPlots/Inspector/Model/Model.hpp b/include/SciQLopPlots/Inspector/Model/Model.hpp
new file mode 100644
index 0000000..8835b66
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Model/Model.hpp
@@ -0,0 +1,63 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/Model/Node.hpp"
+#include
+#include
+
+class PlotsModel : public QAbstractItemModel
+{
+ Q_OBJECT
+ PlotsModelNode* m_rootNode;
+
+ Q_SLOT void node_changed(PlotsModelNode* node);
+ Q_SLOT void node_selection_changed(PlotsModelNode* node, bool selected);
+ Q_SLOT void children_destroyed(PlotsModelNode* parent, int index);
+ QModelIndex make_index(PlotsModelNode* node);
+
+
+public:
+ PlotsModel(QObject* parent = nullptr);
+ ~PlotsModel() = default;
+
+ QModelIndex index(int row, int column,
+ const QModelIndex& parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex& index) const override;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex& parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
+ Qt::ItemFlags flags(const QModelIndex& index) const override;
+
+ bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
+
+ void set_selected(const QList& indexes, bool selected);
+
+ Q_SLOT void addTopLevelNode(QObject* obj);
+
+ static PlotsModel* instance();
+ static QObject* object(const QModelIndex& index);
+
+#ifndef BINDINGS_H
+ Q_SIGNAL void item_selection_changed(const QModelIndex& index, bool selected);
+ Q_SIGNAL void top_level_nodes_list_changed();
+#endif // !BINDINGS_H
+};
diff --git a/include/SciQLopPlots/Inspector/Model/Node.hpp b/include/SciQLopPlots/Inspector/Model/Node.hpp
new file mode 100644
index 0000000..15fd4ea
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/Model/Node.hpp
@@ -0,0 +1,104 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include
+#include
+#include
+#include
+
+class InspectorBase;
+
+class PlotsModelNode : public QObject
+{
+ Q_OBJECT
+ QPointer m_obj;
+ InspectorBase* m_inspector;
+ QList m_children;
+
+ void _child_destroyed(PlotsModelNode* child);
+ PlotsModelNode* _root_node();
+ bool _deletable = true;
+
+public:
+ PlotsModelNode(QObject* obj, QObject* parent = nullptr);
+ ~PlotsModelNode() = default;
+
+ PlotsModelNode* insert_child(QObject* obj, int row = -1);
+
+ inline QString name() { return objectName(); }
+
+ PlotsModelNode* child_node(const QString& name);
+
+ inline QList children_nodes() { return m_children; }
+
+ PlotsModelNode* parent_node() { return qobject_cast(parent()); }
+
+ inline PlotsModelNode* child(int row) { return m_children.value(row, nullptr); }
+
+ inline int child_row(PlotsModelNode* child) { return m_children.indexOf(child); }
+
+ int child_row(QObject* obj);
+
+ inline int children_count() { return m_children.size(); }
+
+ bool remove_child(int row);
+
+ QIcon icon();
+ QString tooltip();
+
+ Q_SLOT void setName(const QString& name);
+ Q_SLOT void update_children();
+
+ inline bool holds(QObject* obj)
+ {
+ if (m_obj)
+ return m_obj == obj && m_obj->objectName() == obj->objectName();
+ return false;
+ }
+
+ inline bool contains(QObject* obj)
+ {
+ for (auto child : m_children)
+ {
+ if (child->holds(obj))
+ return true;
+ }
+ return false;
+ }
+
+ void set_selected(bool selected);
+
+ inline void set_deletable(bool deletable) { _deletable = deletable; }
+
+ inline bool deletable() { return _deletable; }
+
+ void destroy();
+
+ inline QObject* object() { return m_obj; }
+
+#ifndef BINDINGS_H
+ Q_SIGNAL void nameChanged(PlotsModelNode* node);
+ Q_SIGNAL void childrenChanged(PlotsModelNode* node);
+ Q_SIGNAL void childrenDestroyed(PlotsModelNode* parent, int row);
+ Q_SIGNAL void selectionChanged(PlotsModelNode* node, bool selected);
+#endif
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/BooleanDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/BooleanDelegate.hpp
new file mode 100644
index 0000000..f76cdf5
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/BooleanDelegate.hpp
@@ -0,0 +1,44 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2025, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include
+#include
+
+class BooleanDelegate : public QCheckBox
+{
+ Q_OBJECT
+
+public:
+ Q_PROPERTY(bool value READ value WRITE set_value NOTIFY value_changed)
+
+ BooleanDelegate(bool value, QWidget* parent = nullptr);
+ virtual ~BooleanDelegate() = default;
+
+ void set_value(const bool value);
+ bool value() const;
+
+#ifndef BINDINGS_H
+ Q_SIGNAL void value_changed(bool value);
+#endif
+
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/ColorDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/ColorDelegate.hpp
new file mode 100644
index 0000000..34c18b9
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/ColorDelegate.hpp
@@ -0,0 +1,51 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include
+#include
+
+#include
+
+class ColorDelegate : public QPushButton
+{
+ Q_OBJECT
+
+ QColor m_color;
+
+public:
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+
+ ColorDelegate(QColor color, QWidget* parent = nullptr);
+ virtual ~ColorDelegate() = default;
+
+ void setColor(const QColor& color);
+ QColor color() const;
+
+#ifndef BINDINGS_H
+ Q_SIGNAL void colorChanged(const QColor& color);
+#endif
+
+protected:
+ Q_SLOT void pick_color();
+ void paintEvent(QPaintEvent* event) override;
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/ColorGradientDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/ColorGradientDelegate.hpp
new file mode 100644
index 0000000..be28819
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/ColorGradientDelegate.hpp
@@ -0,0 +1,63 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/enums.hpp"
+#include
+#include
+#include
+
+class ColorGradientItemDelegate : public QStyledItemDelegate
+{
+ Q_OBJECT
+
+ QSize _text_size_hint(const QString& text) const;
+ QSize _gradient_size_hint() const;
+ int _h_margin = 5;
+ int _v_margin = 5;
+
+public:
+ ColorGradientItemDelegate(QObject* parent = nullptr);
+ virtual ~ColorGradientItemDelegate() = default;
+
+ virtual void paint(QPainter* painter, const QStyleOptionViewItem& option,
+ const QModelIndex& index) const override;
+ virtual QSize sizeHint(const QStyleOptionViewItem& option,
+ const QModelIndex& index) const override;
+};
+
+class ColorGradientDelegate : public QComboBox
+{
+ Q_OBJECT
+
+ ColorGradient m_gradient;
+
+public:
+ ColorGradientDelegate(ColorGradient gradient, QWidget* parent = nullptr);
+ virtual ~ColorGradientDelegate() = default;
+
+ void setGradient(ColorGradient gradient);
+ ColorGradient gradient() const;
+
+#ifndef BINDINGS_H
+ Q_SIGNAL void gradientChanged(ColorGradient gradient);
+#endif
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/LegendDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/LegendDelegate.hpp
new file mode 100644
index 0000000..3eb08b2
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/LegendDelegate.hpp
@@ -0,0 +1,47 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2025, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include
+#include
+#include
+class BooleanDelegate;
+
+class LegendDelegate : public QWidget
+{
+ Q_OBJECT
+
+ QFormLayout* m_layout;
+ BooleanDelegate* m_visible;
+
+public:
+
+ LegendDelegate(bool visible, QWidget* parent = nullptr);
+ virtual ~LegendDelegate() = default;
+
+ void set_visible(bool visible);
+
+#ifndef BINDINGS_H
+ Q_SIGNAL void visibility_changed(bool value);
+#endif
+
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/LineDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/LineDelegate.hpp
new file mode 100644
index 0000000..50e8222
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/Delegates/LineDelegate.hpp
@@ -0,0 +1,50 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include
+#include
+
+#include "SciQLopPlots/enums.hpp"
+#include
+#include
+#include
+
+class LineDelegate : public QWidget
+{
+ Q_OBJECT
+
+ QPen m_pen;
+ QFormLayout* m_layout;
+ GraphLineStyle m_style;
+
+public:
+ LineDelegate(QPen pen, GraphLineStyle style, QWidget* parent = nullptr);
+ virtual ~LineDelegate() = default;
+
+#ifndef BINDINGS_H
+ Q_SIGNAL void colorChanged(const QColor& color);
+ Q_SIGNAL void widthChanged(int width);
+ Q_SIGNAL void styleChanged(GraphLineStyle style);
+ Q_SIGNAL void penChanged(const QPen& pen);
+#endif
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopColorMapDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopColorMapDelegate.hpp
new file mode 100644
index 0000000..b9b3d6a
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopColorMapDelegate.hpp
@@ -0,0 +1,39 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include "SciQLopPlots/Inspector/PropertyDelegateBase.hpp"
+
+class SciQLopColorMap;
+
+class SciQLopColorMapDelegate : public PropertyDelegateBase
+{
+ Q_OBJECT
+
+ SciQLopColorMap* colorMap() const;
+
+public:
+ using compatible_type = SciQLopColorMap;
+ SciQLopColorMapDelegate(SciQLopColorMap* object, QWidget* parent = nullptr);
+
+ virtual ~SciQLopColorMapDelegate() = default;
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopGraphComponentDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopGraphComponentDelegate.hpp
new file mode 100644
index 0000000..b5ff6d7
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopGraphComponentDelegate.hpp
@@ -0,0 +1,42 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/PropertyDelegateBase.hpp"
+#include
+
+class SciQLopGraphComponentInterface;
+class LineDelegate;
+
+class SciQLopGraphComponentDelegate : public PropertyDelegateBase
+{
+ Q_OBJECT
+
+ SciQLopGraphComponentInterface* component() const;
+ LineDelegate* m_lineDelegate;
+
+public:
+ using compatible_type = SciQLopGraphComponentInterface;
+ SciQLopGraphComponentDelegate(SciQLopGraphComponentInterface* object,
+ QWidget* parent = nullptr);
+
+ virtual ~SciQLopGraphComponentDelegate() = default;
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopGraphDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopGraphDelegate.hpp
new file mode 100644
index 0000000..f88409d
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopGraphDelegate.hpp
@@ -0,0 +1,38 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/PropertyDelegateBase.hpp"
+
+class SciQLopGraphInterface;
+
+class SciQLopGraphDelegate : public PropertyDelegateBase
+{
+ Q_OBJECT
+
+ SciQLopGraphInterface* graph() const;
+
+public:
+ using compatible_type = SciQLopGraphInterface;
+ SciQLopGraphDelegate(SciQLopGraphInterface* object, QWidget* parent = nullptr);
+
+ virtual ~SciQLopGraphDelegate() = default;
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopMultiPlotPanelDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopMultiPlotPanelDelegate.hpp
new file mode 100644
index 0000000..123db0a
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopMultiPlotPanelDelegate.hpp
@@ -0,0 +1,39 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/PropertyDelegateBase.hpp"
+
+class SciQLopMultiPlotPanel;
+
+class SciQLopMultiPlotPanelDelegate : public PropertyDelegateBase
+{
+ Q_OBJECT
+
+ SciQLopMultiPlotPanel* panel() const;
+
+
+public:
+ using compatible_type = SciQLopMultiPlotPanel;
+ SciQLopMultiPlotPanelDelegate(SciQLopMultiPlotPanel* object, QWidget* parent = nullptr);
+
+ virtual ~SciQLopMultiPlotPanelDelegate() = default;
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopPlotAxisDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopPlotAxisDelegate.hpp
new file mode 100644
index 0000000..0e11c20
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopPlotAxisDelegate.hpp
@@ -0,0 +1,39 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/PropertyDelegateBase.hpp"
+
+class SciQLopPlotAxisInterface;
+
+class SciQLopPlotAxisDelegate : public PropertyDelegateBase
+{
+ Q_OBJECT
+
+ SciQLopPlotAxisInterface* plot() const;
+
+
+public:
+ using compatible_type = SciQLopPlotAxisInterface;
+ SciQLopPlotAxisDelegate(SciQLopPlotAxisInterface* object, QWidget* parent = nullptr);
+
+ virtual ~SciQLopPlotAxisDelegate() = default;
+};
diff --git a/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopPlotDelegate.hpp b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopPlotDelegate.hpp
new file mode 100644
index 0000000..5d675af
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertiesDelegates/SciQLopPlotDelegate.hpp
@@ -0,0 +1,39 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include "SciQLopPlots/Inspector/PropertyDelegateBase.hpp"
+
+class SciQLopPlot;
+
+class SciQLopPlotDelegate : public PropertyDelegateBase
+{
+ Q_OBJECT
+
+ SciQLopPlot* plot() const;
+
+
+public:
+ using compatible_type = SciQLopPlot;
+ SciQLopPlotDelegate(SciQLopPlot* object, QWidget* parent = nullptr);
+
+ virtual ~SciQLopPlotDelegate() = default;
+};
diff --git a/include/SciQLopPlots/Inspector/PropertyDelegateBase.hpp b/include/SciQLopPlots/Inspector/PropertyDelegateBase.hpp
new file mode 100644
index 0000000..c2bd84d
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertyDelegateBase.hpp
@@ -0,0 +1,66 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include
+#include
+#include
+#include
+#include
+#include
+
+class PropertyDelegateBase : public QWidget
+{
+ Q_OBJECT
+
+protected:
+ QVBoxLayout* m_layout;
+ QLabel* m_title;
+
+protected:
+ QPointer m_object = nullptr;
+
+ template
+ static T* as_type(QObject* object)
+ {
+ return qobject_cast(object);
+ }
+
+public:
+ PropertyDelegateBase(QObject* object, QWidget* parent = nullptr)
+ : QWidget(parent), m_object { object }
+ {
+ m_layout = new QVBoxLayout();
+ setLayout(m_layout);
+ m_title = new QLabel();
+ m_layout->addWidget(m_title);
+ connect(object, &QObject::objectNameChanged, this,
+ &PropertyDelegateBase::object_name_changed);
+ object_name_changed(object->objectName());
+ }
+
+ Q_SLOT void object_name_changed(const QString& name)
+ {
+ m_title->setText(fmt::format("{} properties", name.toStdString()).c_str());
+ }
+
+ virtual ~PropertyDelegateBase() = default;
+};
diff --git a/include/SciQLopPlots/Inspector/PropertyDelegates.hpp b/include/SciQLopPlots/Inspector/PropertyDelegates.hpp
new file mode 100644
index 0000000..e1c4edf
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/PropertyDelegates.hpp
@@ -0,0 +1,98 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+#include
+#include
+
+class PropertyDelegateBase;
+
+class PropertyDelegateFactoryInterface
+{
+public:
+ virtual ~PropertyDelegateFactoryInterface() = default;
+ virtual PropertyDelegateBase* create(QObject* object, QWidget* parent) = 0;
+};
+
+template
+class PropertyDelegateFactory : public PropertyDelegateFactoryInterface
+{
+ PropertyDelegateBase* create(QObject* object, QWidget* parent) override
+ {
+ return new T(qobject_cast(object), parent);
+ }
+};
+
+class PropertyDelegates : public QObject
+{
+
+ Q_OBJECT
+
+ QMap m_delegates_factories;
+
+ PropertyDelegates() { }
+
+ inline static int registerDelegate(
+ const QString& typeName, PropertyDelegateFactoryInterface* delegate)
+ {
+ instance().m_delegates_factories[typeName] = delegate;
+ return instance().m_delegates_factories.size();
+ }
+
+public:
+ virtual ~PropertyDelegates() = default;
+
+ inline static PropertyDelegates& instance()
+ {
+ static PropertyDelegates instance;
+ return instance;
+ }
+
+ template
+ inline static auto registerDelegate()
+ -> decltype(DelegateType::compatible_type::staticMetaObject.className(), int())
+ {
+ return registerDelegate(DelegateType::compatible_type::staticMetaObject.className(),
+ new PropertyDelegateFactory());
+ }
+
+ inline static PropertyDelegateBase* delegate(
+ const QString& typeName, QObject* object, QWidget* parent = nullptr)
+ {
+ auto factory = instance().m_delegates_factories.value(typeName, nullptr);
+ return factory ? factory->create(object, parent) : nullptr;
+ }
+
+ inline static PropertyDelegateBase* delegate(QObject* obj, QWidget* parent = nullptr)
+ {
+ auto metaObject = obj->metaObject();
+ PropertyDelegateBase* _delegate = nullptr;
+ do
+ {
+ _delegate = delegate(metaObject->className(), obj, parent);
+ metaObject = metaObject->superClass();
+ } while (_delegate == nullptr && metaObject != nullptr);
+ return _delegate;
+ }
+};
+
+#define REGISTER_DELEGATE(DELEGATE) \
+ static int _id_##DELEGATE = PropertyDelegates::registerDelegate();
diff --git a/include/SciQLopPlots/Inspector/View/InspectorView.hpp b/include/SciQLopPlots/Inspector/View/InspectorView.hpp
new file mode 100644
index 0000000..0224037
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/View/InspectorView.hpp
@@ -0,0 +1,42 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include "SciQLopPlots/Inspector/View/TreeView.hpp"
+#include
+
+class InspectorView : public QWidget
+{
+ Q_OBJECT
+ PlotsTreeView* m_treeView;
+ void expand_recursively(const QModelIndex& index);
+
+ Q_SLOT void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
+
+public:
+ InspectorView(QWidget* parent = nullptr);
+ virtual ~InspectorView() = default;
+
+#ifndef BINDINGS_H
+ Q_SIGNAL void objects_selected(const QList& objects);
+#endif
+};
diff --git a/include/SciQLopPlots/Inspector/View/PropertiesPanel.hpp b/include/SciQLopPlots/Inspector/View/PropertiesPanel.hpp
new file mode 100644
index 0000000..9e81652
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/View/PropertiesPanel.hpp
@@ -0,0 +1,37 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include
+class InspectorView;
+class PropertiesView;
+
+class PropertiesPanel : public QWidget
+{
+ Q_OBJECT
+ InspectorView* m_inspectorView;
+ PropertiesView* m_propertiesView;
+
+public:
+ PropertiesPanel(QWidget* parent = nullptr);
+ ~PropertiesPanel() = default;
+};
diff --git a/include/SciQLopPlots/Inspector/View/PropertiesView.hpp b/include/SciQLopPlots/Inspector/View/PropertiesView.hpp
new file mode 100644
index 0000000..c99e713
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/View/PropertiesView.hpp
@@ -0,0 +1,36 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include
+class PropertyDelegateBase;
+
+class PropertiesView : public QWidget
+{
+ Q_OBJECT
+ PropertyDelegateBase* m_delegateWidget = nullptr;
+
+public:
+ Q_SLOT void set_current_objects(const QList& objects);
+ PropertiesView(QWidget* parent = nullptr);
+ virtual ~PropertiesView() = default;
+};
diff --git a/include/SciQLopPlots/Inspector/View/TreeView.hpp b/include/SciQLopPlots/Inspector/View/TreeView.hpp
new file mode 100644
index 0000000..a8d805a
--- /dev/null
+++ b/include/SciQLopPlots/Inspector/View/TreeView.hpp
@@ -0,0 +1,36 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2024, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include
+
+class PlotsTreeView : public QTreeView
+{
+ Q_OBJECT
+
+public:
+ PlotsTreeView(QWidget* parent = nullptr);
+ virtual ~PlotsTreeView() = default;
+
+protected:
+ void keyPressEvent(QKeyEvent* event) override;
+};
diff --git a/include/SciQLopPlots/Items/SciQLopPixmapItem.hpp b/include/SciQLopPlots/Items/SciQLopPixmapItem.hpp
new file mode 100644
index 0000000..5df33d4
--- /dev/null
+++ b/include/SciQLopPlots/Items/SciQLopPixmapItem.hpp
@@ -0,0 +1,87 @@
+/*------------------------------------------------------------------------------
+-- This file is a part of the SciQLop Software
+-- Copyright (C) 2023, Plasma Physics Laboratory - CNRS
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- 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 General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------*/
+/*-- Author : Alexis Jeandet
+-- Mail : alexis.jeandet@member.fsf.org
+----------------------------------------------------------------------------*/
+#pragma once
+
+#include "SciQLopPlotItem.hpp"
+#include "SciQLopPlots/SciQLopPlot.hpp"
+#include "SciQLopPlots/enums.hpp"
+#include
+#include
+#include
+#include
+
+class PixmapItem :public SciQLopPlotItem, public SciQlopItemWithToolTip
+{
+ Q_OBJECT
+
+public:
+#ifndef BINDINGS_H
+ Q_SIGNAL void moved(double new_position);
+#endif // !BINDINGS_H
+
+ inline PixmapItem(QCustomPlot* plot, const QPixmap& pixmap, const QRectF& rect, bool movable = false, Coordinates coordinates = Coordinates::Pixels)
+ : SciQLopPlotItem { plot }
+ {
+ this->setPixmap(pixmap);
+ this->topLeft->setCoords(rect.topLeft());
+ this->bottomRight->setCoords(rect.bottomRight());
+ this->setMovable(movable);
+ if (coordinates == Coordinates::Data)
+ {
+ this->topLeft->setType(QCPItemPosition::ptPlotCoords);
+ this->bottomRight->setType(QCPItemPosition::ptPlotCoords);
+ }
+ else
+ {
+ this->topLeft->setType(QCPItemPosition::ptAbsolute);
+ this->bottomRight->setType(QCPItemPosition::ptAbsolute);
+ }
+ }
+ virtual ~PixmapItem() { }
+
+ virtual void move(double dx, double dy) override;
+
+};
+
+/*!
+ * \brief The SciQLopPixmapItem class
+ */
+class SciQLopPixmapItem : public QObject
+{
+ Q_OBJECT
+
+ QPointer m_item;
+ public:
+ /*!
+ * \brief SciQLopPixmapItem
+ * \param plot The plot to which the item will be added
+ * \param pixmap The pixmap to display
+ * \param rect The rectangle in which to display the pixmap
+ * \param movable If the pixmap can be moved by the user
+ * \param coordinates The coordinates system in which the rectangle is defined (Pixels or Data)
+ */
+ SciQLopPixmapItem(SciQLopPlot* plot, const QPixmap& pixmap, const QRectF& rect, bool movable = false, Coordinates coordinates = Coordinates::Pixels)
+ {
+ m_item = new PixmapItem(plot->qcp_plot(), pixmap, rect, movable, coordinates);
+ }
+};
+
diff --git a/include/SciQLopPlots/Items/SciQLopVerticalSpan.hpp b/include/SciQLopPlots/Items/SciQLopVerticalSpan.hpp
index 6af6c79..300f51f 100644
--- a/include/SciQLopPlots/Items/SciQLopVerticalSpan.hpp
+++ b/include/SciQLopPlots/Items/SciQLopVerticalSpan.hpp
@@ -82,6 +82,7 @@ class VerticalSpanBorder : public SciQLopPlotItem,
}
void move(double dx, double dy) override;
+
inline QCursor cursor(QMouseEvent*) const noexcept override
{
if (movable())
@@ -90,7 +91,6 @@ class VerticalSpanBorder : public SciQLopPlotItem,
}
};
-
class VerticalSpan : public SciQLopPlotItem,
public SciQlopItemWithToolTip,
public SciQLopItemWithKeyInteraction
@@ -123,6 +123,7 @@ class VerticalSpan : public SciQLopPlotItem,
}
return nullptr;
}
+
inline VerticalSpanBorder* _upper_border() const
{
if (!_border1.isNull() && !_border2.isNull())
@@ -177,7 +178,7 @@ class VerticalSpan : public SciQLopPlotItem,
#endif
VerticalSpan(QCustomPlot* plot, SciQLopPlotRange horizontal_range, bool do_not_replot = false,
- bool immediate_replot = false);
+ bool immediate_replot = false);
inline void setMovable(bool movable) noexcept final
{
@@ -189,7 +190,6 @@ class VerticalSpan : public SciQLopPlotItem,
}
}
-
~VerticalSpan()
{
if (parentPlot()->hasItem(this->_border1))
@@ -228,13 +228,13 @@ class VerticalSpan : public SciQLopPlotItem,
[[nodiscard]] inline SciQLopPlotRange range() const noexcept
{
return SciQLopPlotRange { this->_lower_border()->position(),
- this->_upper_border()->position() };
+ this->_upper_border()->position() };
}
void move(double dx, double dy) override;
- double selectTest(
- const QPointF& pos, bool onlySelectable, QVariant* details = nullptr) const override;
+ double selectTest(const QPointF& pos, bool onlySelectable,
+ QVariant* details = nullptr) const override;
inline void set_borders_tool_tip(const QString& tool_tip)
{
@@ -276,6 +276,7 @@ class VerticalSpan : public SciQLopPlotItem,
this->setPen(QPen { Qt::NoPen });
this->setSelectedPen(QPen { Qt::NoPen });
}
+
[[nodiscard]] inline QColor color() const noexcept { return this->brush().color(); }
inline void replot(bool immediate = false) final
@@ -291,7 +292,9 @@ class VerticalSpan : public SciQLopPlotItem,
}
};
-
+/*! \brief Vertical span that can be added to a plot
+ *
+ */
class SciQLopVerticalSpan : public QObject
{
Q_OBJECT
@@ -301,6 +304,7 @@ class SciQLopVerticalSpan : public QObject
protected:
inline void select_lower_border(bool selected) { _impl->select_lower_border(selected); }
+
inline void select_upper_border(bool selected) { _impl->select_upper_border(selected); }
#ifndef BINDINGS_H
@@ -314,11 +318,20 @@ class SciQLopVerticalSpan : public QObject
Q_SIGNAL void selectionChanged(bool);
Q_SIGNAL void delete_requested();
#endif
-
- SciQLopVerticalSpan(SciQLopPlot* plot, SciQLopPlotRange horizontal_range, QColor color,
- bool read_only = false, bool visible = true, const QString& tool_tip = "");
-
- ~SciQLopVerticalSpan()
+ /*! \brief SciQLopVerticalSpan
+ *
+ * \param plot The plot where the vertical span will be added
+ * \param horizontal_range The range of the span
+ * \param color The color of the span
+ * \param read_only If the span is read only
+ * \param visible If the span is visible
+ * \param tool_tip The tool tip of the span
+ */
+ SciQLopVerticalSpan(SciQLopPlot* plot, SciQLopPlotRange horizontal_range,
+ QColor color = QColor(100, 100, 100, 100), bool read_only = false,
+ bool visible = true, const QString& tool_tip = "");
+
+ virtual ~SciQLopVerticalSpan() override
{
if (!this->_impl.isNull())
{
@@ -338,11 +351,20 @@ class SciQLopVerticalSpan : public QObject
return nullptr;
}
+ /*! \brief Set the span as movable
+ *
+ * \param movable
+ */
inline void set_visible(bool visible)
{
if (!_impl.isNull())
_impl->set_visible(visible);
}
+
+ /*! \brief Set the span as movable
+ *
+ * \param movable
+ */
inline bool visible() const noexcept
{
if (!_impl.isNull())
@@ -355,6 +377,7 @@ class SciQLopVerticalSpan : public QObject
if (!_impl.isNull())
this->_impl->set_range(horizontal_range);
}
+
[[nodiscard]] inline SciQLopPlotRange range() const noexcept
{
if (!_impl.isNull())
@@ -367,6 +390,7 @@ class SciQLopVerticalSpan : public QObject
if (!_impl.isNull())
this->_impl->set_color(color);
}
+
[[nodiscard]] inline QColor color() const
{
if (!_impl.isNull())
@@ -379,6 +403,7 @@ class SciQLopVerticalSpan : public QObject
if (!_impl.isNull())
this->_impl->set_borders_color(color);
}
+
[[nodiscard]] inline QColor borders_color() const noexcept
{
if (!_impl.isNull())
@@ -391,6 +416,7 @@ class SciQLopVerticalSpan : public QObject
if (!_impl.isNull())
this->_impl->setSelected(selected);
}
+
[[nodiscard]] inline bool selected() const noexcept
{
if (!_impl.isNull())
@@ -403,6 +429,7 @@ class SciQLopVerticalSpan : public QObject
if (!_impl.isNull())
this->_impl->setMovable(!read_only);
}
+
[[nodiscard]] inline bool read_only() const noexcept
{
if (!_impl.isNull())
@@ -418,6 +445,7 @@ class SciQLopVerticalSpan : public QObject
this->_impl->set_borders_tool_tip(tool_tip);
}
}
+
[[nodiscard]] inline QString tool_tip() const noexcept
{
if (!_impl.isNull())
diff --git a/include/SciQLopPlots/MultiPlots/AxisSynchronizer.hpp b/include/SciQLopPlots/MultiPlots/AxisSynchronizer.hpp
index 3a356e7..d28fca0 100644
--- a/include/SciQLopPlots/MultiPlots/AxisSynchronizer.hpp
+++ b/include/SciQLopPlots/MultiPlots/AxisSynchronizer.hpp
@@ -26,9 +26,9 @@
class AxisSynchronizer : public SciQLopPlotCollectionBehavior
{
Q_OBJECT
+
protected:
- QList _plots;
- std::pair _last_x_range;
+ SciQLopPlotRange _last_range;
AxisType m_sync_axis = AxisType::XAxis;
public:
@@ -37,7 +37,10 @@ class AxisSynchronizer : public SciQLopPlotCollectionBehavior
{
}
- Q_SLOT virtual void updatePlotList(const QList& plots) override;
-
- Q_SLOT virtual void set_axis_range(const SciQLopPlotRange &range);
+ Q_SLOT virtual void updatePlotList(const QList>& plots) override;
+ Q_SLOT virtual void plotAdded(SciQLopPlotInterface* plot) override;
+ Q_SLOT virtual void set_axis_range(const SciQLopPlotRange& range);
+#ifndef BINDINGS_H
+ Q_SIGNAL void range_changed(const SciQLopPlotRange& range);
+#endif
};
diff --git a/include/SciQLopPlots/MultiPlots/MultiPlotsVSpan.hpp b/include/SciQLopPlots/MultiPlots/MultiPlotsVSpan.hpp
index 5fc40e2..c048a40 100644
--- a/include/SciQLopPlots/MultiPlots/MultiPlotsVSpan.hpp
+++ b/include/SciQLopPlots/MultiPlots/MultiPlotsVSpan.hpp
@@ -55,7 +55,8 @@ class MultiPlotsVerticalSpan : public SciQLopMultiPlotObject
#endif
MultiPlotsVerticalSpan(SciQLopMultiPlotPanel* panel, SciQLopPlotRange horizontal_range,
- QColor color, bool read_only = false, bool visible = true, const QString& tool_tip = "")
+ QColor color = QColor(100, 100, 100)
+ , bool read_only = false, bool visible = true, const QString tool_tip = "")
: SciQLopMultiPlotObject(panel)
{
_horizontal_range = horizontal_range;
@@ -66,7 +67,7 @@ class MultiPlotsVerticalSpan : public SciQLopMultiPlotObject
updatePlotList(panel->plots());
}
- ~MultiPlotsVerticalSpan()
+ virtual ~MultiPlotsVerticalSpan() override
{
for (auto span : _spans)
{
@@ -95,7 +96,7 @@ class MultiPlotsVerticalSpan : public SciQLopMultiPlotObject
void set_range(const SciQLopPlotRange horizontal_range);
- [[nodiscard]] inline SciQLopPlotRange get_range() const noexcept { return _horizontal_range; }
+ [[nodiscard]] inline SciQLopPlotRange range() const noexcept { return _horizontal_range; }
inline void set_visible(bool visible)
{
diff --git a/include/SciQLopPlots/MultiPlots/SciQLopMultiPlotObject.hpp b/include/SciQLopPlots/MultiPlots/SciQLopMultiPlotObject.hpp
index e578d36..9fa1e92 100644
--- a/include/SciQLopPlots/MultiPlots/SciQLopMultiPlotObject.hpp
+++ b/include/SciQLopPlots/MultiPlots/SciQLopMultiPlotObject.hpp
@@ -25,12 +25,12 @@
#include
class SciQLopPlot;
-
class SciQLopMultiPlotObject : public QObject
{
Q_OBJECT
+
protected:
- QList m_plots;
+ QList> m_plots;
virtual void addObject(SciQLopPlotInterface* plot);
virtual void removeObject(SciQLopPlotInterface* plot);
@@ -41,5 +41,5 @@ class SciQLopMultiPlotObject : public QObject
virtual ~SciQLopMultiPlotObject() Q_DECL_OVERRIDE;
- Q_SLOT virtual void updatePlotList(const QList& plots);
+ Q_SLOT virtual void updatePlotList(const QList>& plots);
};
diff --git a/include/SciQLopPlots/MultiPlots/SciQLopMultiPlotPanel.hpp b/include/SciQLopPlots/MultiPlots/SciQLopMultiPlotPanel.hpp
index 3a0c75d..9c3dbd2 100644
--- a/include/SciQLopPlots/MultiPlots/SciQLopMultiPlotPanel.hpp
+++ b/include/SciQLopPlots/MultiPlots/SciQLopMultiPlotPanel.hpp
@@ -21,89 +21,127 @@
----------------------------------------------------------------------------*/
#pragma once
#include "SciQLopPlotCollection.hpp"
+#include "SciQLopPlots/DragNDrop/PlotDragNDropCallback.hpp"
+#include "SciQLopPlots/Inspector/InspectorBase.hpp"
#include
#include
+#include
#include
-
-#include "qcustomplot.h"
-
+#include