mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: replace orientation by inverted flag
There were two somewhat redundant flags for the axes: the position (left, right, bottom) and the orientation (up-down, left-right, etc). Replace the latter by an inverted flag: if true, the axis is up-down or right-left, i.e. the opposite of what one would expect for a normal graph. Set the flag in the constructor and remove the setOrientation() function. Sadly, the code is a bit complex, because screen coordinates are top-to-bottom. Who thought that would be a good idea? Note: this also fixes the placement of the ticks of the time axis. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3a79f3e78a
commit
2f9c0c04b5
3 changed files with 44 additions and 85 deletions
|
@ -23,23 +23,16 @@ class DiveCartesianAxis : public QObject, public QGraphicsLineItem {
|
|||
private:
|
||||
bool printMode;
|
||||
public:
|
||||
enum Orientation {
|
||||
TopToBottom,
|
||||
BottomToTop,
|
||||
LeftToRight,
|
||||
RightToLeft
|
||||
};
|
||||
enum class Position {
|
||||
Left, Right, Bottom
|
||||
};
|
||||
|
||||
DiveCartesianAxis(Position position, int integralDigits, int fractionalDigits, color_index_t gridColor,
|
||||
DiveCartesianAxis(Position position, bool inverted, int integralDigits, int fractionalDigits, color_index_t gridColor,
|
||||
QColor textColor, bool textVisible, bool linesVisible,
|
||||
double dpr, double labelScale, bool printMode, bool isGrayscale, ProfileScene &scene);
|
||||
~DiveCartesianAxis();
|
||||
void setBounds(double min, double max);
|
||||
void setTransform(double a, double b = 0.0);
|
||||
void setOrientation(Orientation orientation);
|
||||
double minimum() const;
|
||||
double maximum() const;
|
||||
std::pair<double, double> screenMinMax() const;
|
||||
|
@ -54,13 +47,13 @@ public:
|
|||
|
||||
private:
|
||||
Position position;
|
||||
bool inverted; // Top-to-bottom or right-to-left axis.
|
||||
int fractionalDigits;
|
||||
QRectF rect; // Rectangle to fill with grid lines
|
||||
QPen gridPen;
|
||||
QColor textColor;
|
||||
ProfileScene &scene;
|
||||
QString textForValue(double value) const;
|
||||
Orientation orientation;
|
||||
QList<DiveTextItem *> labels;
|
||||
QList<DiveLineItem *> lines;
|
||||
double dataMin, dataMax;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue