mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Plot of the Mean Deph
The mean depth now is plotted correctly. I wanted to do more stuff on this commit, but since it required that a few things on profile.c got moved to profile.h, commited to not have a huge blob for review. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
1b1ea35fac
commit
09597cd2d8
3 changed files with 35 additions and 31 deletions
25
profile.c
25
profile.c
|
@ -11,6 +11,7 @@
|
|||
#endif
|
||||
#include "divelist.h"
|
||||
|
||||
#include "profile.h"
|
||||
#include "libdivecomputer/parser.h"
|
||||
#include "libdivecomputer/version.h"
|
||||
|
||||
|
@ -24,31 +25,7 @@ static struct plot_data *last_pi_entry = NULL;
|
|||
#define cairo_set_line_width_scaled(cr, w) \
|
||||
cairo_set_line_width((cr), (w) * plot_scale);
|
||||
|
||||
typedef enum { STABLE, SLOW, MODERATE, FAST, CRAZY } velocity_t;
|
||||
|
||||
struct plot_data {
|
||||
unsigned int in_deco:1;
|
||||
unsigned int cylinderindex;
|
||||
int sec;
|
||||
/* pressure[0] is sensor pressure
|
||||
* pressure[1] is interpolated pressure */
|
||||
int pressure[2];
|
||||
int temperature;
|
||||
/* Depth info */
|
||||
int depth;
|
||||
int ceiling;
|
||||
int ndl;
|
||||
int stoptime;
|
||||
int stopdepth;
|
||||
int cns;
|
||||
int smoothed;
|
||||
double po2, pn2, phe;
|
||||
double mod, ead, end, eadd;
|
||||
velocity_t velocity;
|
||||
struct plot_data *min[3];
|
||||
struct plot_data *max[3];
|
||||
int avg[3];
|
||||
};
|
||||
|
||||
#define SENSOR_PR 0
|
||||
#define INTERPOLATED_PR 1
|
||||
|
|
28
profile.h
28
profile.h
|
@ -11,10 +11,36 @@ typedef int bool;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
struct dive;
|
||||
#include "dive.h"
|
||||
|
||||
typedef enum { STABLE, SLOW, MODERATE, FAST, CRAZY } velocity_t;
|
||||
|
||||
struct divecomputer;
|
||||
struct graphics_context;
|
||||
struct plot_info;
|
||||
struct plot_data {
|
||||
unsigned int in_deco:1;
|
||||
unsigned int cylinderindex;
|
||||
int sec;
|
||||
/* pressure[0] is sensor pressure
|
||||
* pressure[1] is interpolated pressure */
|
||||
int pressure[2];
|
||||
int temperature;
|
||||
/* Depth info */
|
||||
int depth;
|
||||
int ceiling;
|
||||
int ndl;
|
||||
int stoptime;
|
||||
int stopdepth;
|
||||
int cns;
|
||||
int smoothed;
|
||||
double po2, pn2, phe;
|
||||
double mod, ead, end, eadd;
|
||||
velocity_t velocity;
|
||||
struct plot_data *min[3];
|
||||
struct plot_data *max[3];
|
||||
int avg[3];
|
||||
};
|
||||
|
||||
void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc);
|
||||
struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc);
|
||||
|
|
|
@ -309,7 +309,7 @@ void ProfileGraphicsView::plot_depth_profile(struct graphics_context *gc, struct
|
|||
}
|
||||
maxline = MAX(pi->maxdepth + marker, maxdepth * 2 / 3);
|
||||
|
||||
color = profile_color[TIME_GRID].at(0);
|
||||
color = profile_color[DEPTH_GRID].at(0);
|
||||
|
||||
for (i = marker; i < maxline; i += marker) {
|
||||
QGraphicsLineItem *line = new QGraphicsLineItem(SCALE(gc, 0, i), SCALE(gc, 1, i));
|
||||
|
@ -317,17 +317,18 @@ void ProfileGraphicsView::plot_depth_profile(struct graphics_context *gc, struct
|
|||
scene()->addItem(line);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
gc->leftx = 0; gc->rightx = maxtime;
|
||||
color = profile_color[MEAN_DEPTH].at(0);
|
||||
|
||||
/* Show mean depth */
|
||||
if (! gc->printer) {
|
||||
set_source_rgba(gc, MEAN_DEPTH);
|
||||
move_to(gc, 0, pi->meandepth);
|
||||
line_to(gc, pi->entry[pi->nr - 1].sec, pi->meandepth);
|
||||
cairo_stroke(cr);
|
||||
QGraphicsLineItem *line = new QGraphicsLineItem(SCALE(gc, 0, pi->meandepth), SCALE(gc, pi->entry[pi->nr - 1].sec, pi->meandepth));
|
||||
line->setPen(QPen(color));
|
||||
scene()->addItem(line);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* These are good for debugging text placement etc,
|
||||
* but not for actual display..
|
||||
|
|
Loading…
Add table
Reference in a new issue