quickplot
Loading...
Searching...
No Matches
axis.h
1// SPDX-License-Identifier: GPL-3.0-or-later
2// Copyright (c) 2024 Team Dissolve and contributors
3
4#pragma once
5
6#include "axisTickLabels.h"
7#include <QQuick3DGeometry>
8#include <QVector3D>
9
11class Axis : public QQuick3DGeometry
12{
13 Q_OBJECT
14 QML_NAMED_ELEMENT(Axis)
15 Q_PROPERTY(double thickness MEMBER thickness_ NOTIFY dataChanged)
16 Q_PROPERTY(double minimum READ minimum WRITE setMinimum NOTIFY dataChanged)
17 Q_PROPERTY(double maximum READ maximum WRITE setMaximum NOTIFY dataChanged)
18 Q_PROPERTY(Direction direction MEMBER direction_ NOTIFY dataChanged)
19 Q_PROPERTY(AxisTickLabels *tickLabels READ tickLabels NOTIFY dataChanged)
20 Q_PROPERTY(int tickCount READ tickCount NOTIFY dataChanged)
21
22 public:
23 Axis();
24
25 enum Direction
26 {
27 Z,
28 Y,
29 X
30 };
31 Q_ENUMS(Direction)
32
33
36 virtual std::vector<float> convert(QList<double> values) const;
37
40
43 Direction direction() const;
45 double minimum() const;
47 void setMinimum(const double value);
49 double maximum() const;
51 void setMaximum(const double value);
53 int tickCount() const;
55 double tick(int index) const;
57 virtual double tickCoord(int index) const;
58
59 Q_SIGNALS:
60 void dataChanged();
61
62 public Q_SLOTS:
64 virtual void nudge(double delta);
65
66 protected:
68 std::vector<double> tics_;
69 double minimum_, maximum_;
70
71 private:
73 virtual void updateTicks_();
75 void updateData();
76 Direction direction_;
78 double thickness_;
79 AxisTickLabels tickLabels_;
80};
Definition axisTickLabels.h:12
Definition axis.h:12
void setMaximum(const double value)
Definition axis.cpp:24
virtual std::vector< float > convert(QList< double > values) const
Definition axis.cpp:92
virtual double tickCoord(int index) const
Definition axis.cpp:104
void setMinimum(const double value)
Definition axis.cpp:22
AxisTickLabels * tickLabels()
virtual void nudge(double delta)
Definition axis.cpp:106
std::vector< double > tics_
Definition axis.h:68
double tick(int index) const
Definition axis.cpp:102