mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Plot the vertical ruler on the left of the profile.
Plot the numbers on the left of the profile. It seems that everythign is being plotted - But I can see that there are coordinate-errors on the code. ( the GTK one plots some curves below of the dive, but the Qt one is overlapping - probably the way that I'm using the gc information) Need to investigate a bit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b794c23099
commit
cb8198b524
3 changed files with 37 additions and 31 deletions
25
profile.c
25
profile.c
|
@ -281,31 +281,6 @@ static void plot_minmax_profile(struct graphics_context *gc, struct plot_info *p
|
||||||
plot_minmax_profile_minute(gc, pi, 0);
|
plot_minmax_profile_minute(gc, pi, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void plot_depth_scale(struct graphics_context *gc, struct plot_info *pi)
|
|
||||||
{
|
|
||||||
int i, maxdepth, marker;
|
|
||||||
static const text_render_options_t tro = {DEPTH_TEXT_SIZE, SAMPLE_DEEP, RIGHT, MIDDLE};
|
|
||||||
|
|
||||||
/* Depth markers: every 30 ft or 10 m*/
|
|
||||||
maxdepth = get_maxdepth(pi);
|
|
||||||
gc->topy = 0; gc->bottomy = maxdepth;
|
|
||||||
|
|
||||||
switch (prefs.units.length) {
|
|
||||||
case METERS: marker = 10000; break;
|
|
||||||
case FEET: marker = 9144; break; /* 30 ft */
|
|
||||||
}
|
|
||||||
set_source_rgba(gc, DEPTH_GRID);
|
|
||||||
/* don't write depth labels all the way to the bottom as
|
|
||||||
* there may be other graphs below the depth plot (like
|
|
||||||
* partial pressure graphs) where this would look out
|
|
||||||
* of place - so we only make sure that we print the next
|
|
||||||
* marker below the actual maxdepth of the dive */
|
|
||||||
for (i = marker; i <= pi->maxdepth + marker; i += marker) {
|
|
||||||
double d = get_depth_units(i, NULL, NULL);
|
|
||||||
plot_text(gc, &tro, -0.002, i, "%.0f", d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void plot_pp_text(struct graphics_context *gc, struct plot_info *pi)
|
static void plot_pp_text(struct graphics_context *gc, struct plot_info *pi)
|
||||||
{
|
{
|
||||||
double pp, dpp, m;
|
double pp, dpp, m;
|
||||||
|
|
|
@ -276,16 +276,18 @@ void ProfileGraphicsView::plot(struct dive *dive)
|
||||||
plot_pp_text();
|
plot_pp_text();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* now shift the translation back by half the margin;
|
/* now shift the translation back by half the margin;
|
||||||
* this way we can draw the vertical scales on both sides */
|
* this way we can draw the vertical scales on both sides */
|
||||||
cairo_translate(gc->cr, -drawing_area->x / 2.0, 0);
|
//cairo_translate(gc->cr, -drawing_area->x / 2.0, 0);
|
||||||
gc->maxx += drawing_area->x;
|
|
||||||
gc->leftx = -(drawing_area->x / drawing_area->width) / 2.0;
|
|
||||||
gc->rightx = 1.0 - gc->leftx;
|
|
||||||
|
|
||||||
plot_depth_scale(gc, pi);
|
//gc->maxx += drawing_area->x;
|
||||||
|
//gc->leftx = -(drawing_area->x / drawing_area->width) / 2.0;
|
||||||
|
//gc->rightx = 1.0 - gc->leftx;
|
||||||
|
|
||||||
|
plot_depth_scale();
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (gc->printer) {
|
if (gc->printer) {
|
||||||
free(pi->entry);
|
free(pi->entry);
|
||||||
last_pi_entry = pi->entry = NULL;
|
last_pi_entry = pi->entry = NULL;
|
||||||
|
@ -294,6 +296,33 @@ void ProfileGraphicsView::plot(struct dive *dive)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileGraphicsView::plot_depth_scale()
|
||||||
|
{
|
||||||
|
int i, maxdepth, marker;
|
||||||
|
static text_render_options_t tro = {DEPTH_TEXT_SIZE, SAMPLE_DEEP, RIGHT, MIDDLE};
|
||||||
|
|
||||||
|
/* Depth markers: every 30 ft or 10 m*/
|
||||||
|
maxdepth = get_maxdepth(&gc.pi);
|
||||||
|
gc.topy = 0; gc.bottomy = maxdepth;
|
||||||
|
|
||||||
|
switch (prefs.units.length) {
|
||||||
|
case units::METERS: marker = 10000; break;
|
||||||
|
case units::FEET: marker = 9144; break; /* 30 ft */
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor c(profile_color[DEPTH_GRID].first());
|
||||||
|
|
||||||
|
/* don't write depth labels all the way to the bottom as
|
||||||
|
* there may be other graphs below the depth plot (like
|
||||||
|
* partial pressure graphs) where this would look out
|
||||||
|
* of place - so we only make sure that we print the next
|
||||||
|
* marker below the actual maxdepth of the dive */
|
||||||
|
for (i = marker; i <= gc.pi.maxdepth + marker; i += marker) {
|
||||||
|
double d = get_depth_units(i, NULL, NULL);
|
||||||
|
plot_text(&tro, -0.002, i, QString::number(d));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileGraphicsView::plot_pp_text()
|
void ProfileGraphicsView::plot_pp_text()
|
||||||
{
|
{
|
||||||
double pp, dpp, m;
|
double pp, dpp, m;
|
||||||
|
|
|
@ -107,6 +107,8 @@ private:
|
||||||
void plot_deco_text();
|
void plot_deco_text();
|
||||||
void plot_pp_gas_profile();
|
void plot_pp_gas_profile();
|
||||||
void plot_pp_text();
|
void plot_pp_text();
|
||||||
|
void plot_depth_scale();
|
||||||
|
|
||||||
QColor get_sac_color(int sac, int avg_sac);
|
QColor get_sac_color(int sac, int avg_sac);
|
||||||
|
|
||||||
QPen defaultPen;
|
QPen defaultPen;
|
||||||
|
|
Loading…
Add table
Reference in a new issue