summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--profile.c51
-rw-r--r--qt-ui/profilegraphics.cpp57
-rw-r--r--qt-ui/profilegraphics.h4
3 files changed, 60 insertions, 52 deletions
diff --git a/profile.c b/profile.c
index 3905a029c..67f83f0a6 100644
--- a/profile.c
+++ b/profile.c
@@ -221,57 +221,6 @@ int setup_temperature_limits(struct graphics_context *gc)
}
#if 0
-static void render_depth_sample(struct graphics_context *gc, struct plot_data *entry, const text_render_options_t *tro)
-{
- int sec = entry->sec, decimals;
- double d;
-
- d = get_depth_units(entry->depth, &decimals, NULL);
-
- plot_text(gc, tro, sec, entry->depth, "%.*f", decimals, d);
-}
-
-static void plot_text_samples(struct graphics_context *gc, struct plot_info *pi)
-{
- static const text_render_options_t deep = {14, SAMPLE_DEEP, CENTER, TOP};
- static const text_render_options_t shallow = {14, SAMPLE_SHALLOW, CENTER, BOTTOM};
- int i;
- int last = -1;
-
- for (i = 0; i < pi->nr; i++) {
- struct plot_data *entry = pi->entry + i;
-
- if (entry->depth < 2000)
- continue;
-
- if ((entry == entry->max[2]) && entry->depth != last) {
- render_depth_sample(gc, entry, &deep);
- last = entry->depth;
- }
-
- if ((entry == entry->min[2]) && entry->depth != last) {
- render_depth_sample(gc, entry, &shallow);
- last = entry->depth;
- }
-
- if (entry->depth != last)
- last = -1;
- }
-}
-
-static void plot_depth_text(struct graphics_context *gc, struct plot_info *pi)
-{
- int maxtime, maxdepth;
-
- /* Get plot scaling limits */
- maxtime = get_maxtime(pi);
- maxdepth = get_maxdepth(pi);
-
- gc->leftx = 0; gc->rightx = maxtime;
- gc->topy = 0; gc->bottomy = maxdepth;
-
- plot_text_samples(gc, pi);
-}
static void plot_smoothed_profile(struct graphics_context *gc, struct plot_info *pi)
{
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 53d943e09..158cec286 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -246,7 +246,7 @@ void ProfileGraphicsView::plot(struct dive *dive)
/* Text on top of all graphs.. */
plot_temperature_text();
- plot_depth_text(gc, pi);
+ plot_depth_text();
#if 0
plot_cylinder_pressure_text(gc, pi);
@@ -292,6 +292,61 @@ void ProfileGraphicsView::plot(struct dive *dive)
#endif
}
+void ProfileGraphicsView::plot_depth_text()
+{
+ int maxtime, maxdepth;
+
+ /* Get plot scaling limits */
+ maxtime = get_maxtime(&gc.pi);
+ maxdepth = get_maxdepth(&gc.pi);
+
+ gc.leftx = 0; gc.rightx = maxtime;
+ gc.topy = 0; gc.bottomy = maxdepth;
+
+ plot_text_samples();
+}
+
+void ProfileGraphicsView::plot_text_samples()
+{
+ static text_render_options_t deep = {14, SAMPLE_DEEP, CENTER, TOP};
+ static text_render_options_t shallow = {14, SAMPLE_SHALLOW, CENTER, BOTTOM};
+ int i;
+ int last = -1;
+
+ struct plot_info* pi = &gc.pi;
+
+ for (i = 0; i < pi->nr; i++) {
+ struct plot_data *entry = pi->entry + i;
+
+ if (entry->depth < 2000)
+ continue;
+
+ if ((entry == entry->max[2]) && entry->depth != last) {
+ plot_depth_sample(entry, &deep);
+ last = entry->depth;
+ }
+
+ if ((entry == entry->min[2]) && entry->depth != last) {
+ plot_depth_sample(entry, &shallow);
+ last = entry->depth;
+ }
+
+ if (entry->depth != last)
+ last = -1;
+ }
+}
+
+void ProfileGraphicsView::plot_depth_sample(struct plot_data *entry,text_render_options_t *tro)
+{
+ int sec = entry->sec, decimals;
+ double d;
+
+ d = get_depth_units(entry->depth, &decimals, NULL);
+
+ plot_text(tro, sec, entry->depth, QString("%1").arg(d)); // , decimals, d);
+}
+
+
void ProfileGraphicsView::plot_temperature_text()
{
int i;
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index d6c30dda2..c1c3c2837 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -99,6 +99,10 @@ private:
void plot_cylinder_pressure(struct dive *dive, struct divecomputer *dc);
void plot_temperature_text();
void plot_single_temp_text(int sec, int mkelvin);
+ void plot_depth_text();
+ void plot_text_samples();
+ void plot_depth_sample(struct plot_data *entry, text_render_options_t *tro);
+
QColor get_sac_color(int sac, int avg_sac);
QPen defaultPen;