Commit graph

431 commits

Author SHA1 Message Date
Dirk Hohndel
d78e6a4876 Change event symbol to bigger yellow triangle with exclamation point
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-04 15:14:54 -07:00
Dirk Hohndel
53f809ccca Replace event text with small red triangle and tooltip
We draw a little red triangle (of hardcoded size - not sure if this SHOULD
scale with the size of the plot... I like it better if it doesn't) to the
left of an event.

We then maintain an array of rectangles that each circumscribe one of
those event triangles and if the mouse pointer enters one of these
rectangles then we display (after a short delay) a tooltip with the event
text.

Manually creating these rectangles, maintaining the coordinate offset,
checking if we are inside one of these rectangles and then showing a
tooltip... this all seems like there should be gtk functions to do this by
default... but if there are then I failed to find them. So instead I
manually implemented the necessary logic.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-04 12:27:55 -07:00
Dirk Hohndel
b72ade0e78 Change plot routine to take a drawing_area as argument
Previously we passed in width and height and the routine itself decided to
keep 5% margin around each edge - oddly doing this with double precision,
even though this is all integer coordinates.

Instead we are now passing in a drawing_area. We are kind of abusing the
cairo_rectangle_int_t data type here - but it seemed silly to redefine a
new data type for this.
Width and height give the size of the TOTAL drawing area (as before).
x and y give the offset from the edges - so the EFFECTIVE drawing area is
width-2x and height-2y
This is in preparation for adding tooltips - those need to know the
coordinate offsets from the edges - so having this hard coded inside the
plot function didn't make sense anymore.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-04 12:14:26 -07:00
Dirk Hohndel
c487ea055d Distinguish internally between min pressure and end pressure
And don't artificially end dives on min pressure

This may be a problem for dive computers like Linus' Suunto Vyper Air
where the failure mode seems to be _high_ pressure readings (that's scary,
btw). If the transmitter fails at the end of the dive the pressure plot
ends with incorrect high pressure. But that's simply a bug with the dive
computer and not something that subsurface should hack around. Maybe we
should offer a way to edit the incorrect data points instead.

Always ending on the minimum pressure is definitely wrong as it causes
bogus plots when you do a valve shutdown during the dive (which means that
valid data gets plotted incorrectly).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-30 06:49:24 -07:00
Dirk Hohndel
ab3c6731be Fix the profile coloring
We were missing the last sample (which is usually a fast ascent).
Also, reduced the velocity smoothing to 15 seconds as the 30 seconds were
hiding too much valid information

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-29 22:53:03 -07:00
Dirk Hohndel
912ce7941f Remove average depth from print
It looks confusing in black and white

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-28 15:53:16 -07:00
Linus Torvalds
bd0f274771 Show events on the dive profile
This is *really* ugly.  We really should just create some kind of widget
that when moused over will show the event.  Or something.  Rather than
putting text on top of other text: the events - when they happen - are
usually bunched together (PO2 warnings, max depth, fast ascent leading
to mandatory safety stop, you name it).

But at least this way we see that the data is there, even if we see it
in ugly ways.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 21:15:36 -07:00
Linus Torvalds
515a917152 Add helper function for doing depth unit calculations
.. and use it for printing too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 12:12:54 -07:00
Linus Torvalds
fcc7a01c6e Fix array underrun when calculating velocity
That code is messy. And it was buggy. Noticed by valgrind.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 08:29:08 -07:00
Linus Torvalds
6eefcf40e6 Fix 'struct plot_info' memory leak
The plot_info was never freed, so every time you'd plot something, we'd
leak memory.

I'm running valgrind to see if there's anything bad going on.  So far it
all looks fairly benign.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 22:47:12 -07:00
Linus Torvalds
957aaf619f Fix up printing some more
Use the actual degree sign for temperatures (°F and °C), and make sure
everything uses the proper "set_source_rgb[a]()" wrappers to set the
colors.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 17:56:56 -07:00
Linus Torvalds
368623113c Print out only simplified depth profile
None of the colors, nothing like that.  Just a gray fill and a plain
black depth line.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 17:24:10 -07:00
Linus Torvalds
9cfe9aa8cd Clean up and simplify depth plot
Dirk wrote this before we have the 'plot_info' structure with the
cleaned-up dive info.  No need to maintain that separate array of depths
and seconds.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 17:17:30 -07:00
Linus Torvalds
e276b0602b Don't show the smoothed dive profile or the min/max info
It was good for debugging, it's not something we really want to show people.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 16:45:33 -07:00
Dirk Hohndel
682135838f Separate out the UI from the program logic
The following are UI toolkit specific:
gtk-gui.c   - overall layout, main window of the UI
divelist.c  - list of dives subsurface maintains
equipment.c - equipment / tank information for each dive
info.c      - detailed dive info
print.c     - printing

The rest is independent of the UI:
main.c i    - program frame
dive.c i    - creates and maintaines the internal dive list structure
libdivecomputer.c
uemis.c
parse-xml.c
save-xml.c  - interface with dive computers and the XML files
profile.c   - creates the data for the profile and draws it using cairo

This commit should contain NO functional changes, just moving code around
and a couple of minor abstractions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-20 12:48:56 -07:00
Dirk Hohndel
e1171a57a7 Attempt to smooth out the velocity readings
If the velocity is slower than FAST then we look back up to 30 seconds and
calculate the velocity for the past 30 seconds instead.

For the first version I'm not doing the average of the changes but simply
the change from beginning to end.

The alternative would be to do another triangle smoothing or something
like that - but as we don't know how many samples we have in the 30 second
window, it's a little harder here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 21:45:32 -07:00
Dirk Hohndel
d5b102bdf3 Flip tank pressure graph to show the RIGHT way
This annoyed me from the first moment Linus added the tank pressure graph.
As the pressure goes down, the graph needs to go down. Seriously.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:53:05 -07:00
Dirk Hohndel
bbf5f960e1 Stop plotting the gas / consumption information into the profile
And move the code into info.c where it now belongs

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:44:40 -07:00
Dirk Hohndel
6911229278 Make handling of empty airconsumption string consistent
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:20:28 -07:00
Dirk Hohndel
1937df188a Stop tank / gas / consumption info from changing info_frame size
Simply set it to an empty string with TWO lines when there is nothing to
display

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 16:29:43 -07:00
Dirk Hohndel
c58da2ee0c Indicate vertical velocity through color
So far Linus has hated all of my attempts to visualize vertical velocity
through color. This time I'm trying something dramatically new: there is
no PURPLE involved. Maybe that will convince him of the value.

We simply calculate the vertical velocity for the current plot segment
(last sample point to this sample point - in this version even without
divisions by zero) and assign a label based on the rate of change. These
labels are translated through a predefined table into colors:

Dark green is +/- 5ft/min (stable)
Light green is descents up to 30ft/min and ascents up to 15ft/min
Yellow is descents up to 60ft/min and ascents up to 30ft/min
Orange is descents up to 100ft/min and ascents up to 60ft/min
Red is outside of those ranges - you are most likely in danger

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 16:22:00 -07:00
Dirk Hohndel
89fe2c723f Show tank / nitrox / air consumption information in the info_frame
Even though we go down to an 8pt font the info_frame changes size when the
air info is added. I don't like this but want to see how Linus would like
this resolved before going overboard.

Minor tweaks to the formating (we don't need two decimals when printing
the liters of air consumed).

This patch does NOT remove the plot of the air information in the profile
graph. I think we want to remove that once we like the text where it is,
but I wanted to do one thing at a time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 15:45:14 -07:00
Dirk Hohndel
40b123f63a Tweak temperature plot to look better for small fluctuations
If the temperature is in a very narrow range the existing code visually
exaggerated the fluctuations. This tries to dampen that effect a bit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 11:35:04 -07:00
Linus Torvalds
f3e70c5496 Tweak plot scaling a bit
Change the duration max rounding as noted by Dirk, and move the air
consumption down further towards the bottom right corner.  In
particular, I make the text positions not scale with the window size,
purely by the size of the text.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 10:49:49 -07:00
Dirk Hohndel
60a62cf843 Minor corrections to printing of the last temperature
- the time stamp where we printed the last temp was wrong
 - we really shouldn't check mK for being identical - especially on dive
   computers that store a lot of samples

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 09:51:38 -07:00
Linus Torvalds
ec97a62f34 Use plot_info for final remaining temperature and pressure data plots too
Ok, this is pretty much it now.  Instead of having various random checks
for "is the time of the sample past the end of the dive" hacks, we not
plot all graphs from the cleaned-up plot_info structure instead of the
raw samples.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 09:23:54 -07:00
Linus Torvalds
82f143d229 Plot pressure data based on 'struct plot_info' rather than raw dive data
Further movement to using the sanitized and cleaned-up plot info rather
than the raw data.

The raw dive data contains samples from the end of the dive that we
don't want to drop, but that we also don't want to actually use for
plotting the dive.  So the eventual end goal here is to not ever use the
raw dive samples directly for plotting, but use the diveplot data that
we have analyzed for min/max (properly ignoring final entries) etc.

There's still some data that we take from the samples when plotting, but
it's getting rarer.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 09:10:13 -07:00
Linus Torvalds
7c5c9e2024 Do min/max pressure and temperature based on the non-surface data
Do the min/max calculations only *after* we have removed the extra
surface events at the end.

The Uemis data in particular has a lot of surface events after the dive,
and we don't really want to take them into account since we won't be
plotting them anyway.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 08:53:12 -07:00
Linus Torvalds
adda1c6e86 Plot temperature info using 'struct plot_info' rather than the raw dive samples
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 08:42:27 -07:00
Linus Torvalds
33fed10d66 Start using 'plot_info' more for dive-time limits
.. I'll want to move pressure limit calculations into the 'plot_info',
so that we can do several passes of analysis and change dive limits etc
without having to actually modify the dive data itself (or add new
fields to 'struct dive' just for plotting).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 08:20:06 -07:00
Dirk Hohndel
efb1fa44b8 Print the end temperature of the dive
Currently we print the temperature every five minutes. Especially with
dive computers that keep rather frequent temperature samples that means
that we have one more interesting data point that we don't label: the
surface temperature at the end of the dive.

This patch adds some logic to try to print the last temperature sample
that was recorded before the dive ended - unless that same value has
already been printed (to avoid silly duplications on dive computers with
less frequent sampling)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 09:33:13 -07:00
Dirk Hohndel
b49c878a74 Don't draw temperature plot past the end of the dive
Just like we end depth and tank pressure plots once we are on the surface
(this is relevant for dive computers like the uemis Zurich that keep
recording samples after the end of the dive)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 09:33:13 -07:00
Linus Torvalds
b4c84c1a2e I'm trying to figure something out that prints reasonably..
I'll get there.  Shrink it down a bit, start adding notes and location,
and maybe put three per page. That might work.

.. or maybe I should just take a look at how others have done this.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 20:39:43 -07:00
Linus Torvalds
a0096f3a6b Make the printout look different
Not *better* mint you. Just different.

I suck at graphs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 19:49:48 -07:00
Linus Torvalds
ce86289eed Add the capability to print a dive profile
Ok, this is the ugliest f*&$ing printout I have ever seen in my life,
but think of it as a "the concept of printing works" commit, and you'll
be able to hold your lunch down and not gouge out your eyeballs with a
spoon.  Maybe.

I'm just doing the cairo display as-is for the printout, which is a
seriously bad idea.  I need to not try to do colors etc, and instead of
having white lines on a black background I just need to make thelines be
black on white paper.

But that would involve actually changing the current "plot()" routine,
which is against the point of the exercise right now.  This really is
just a demonstration of how to add printing capabilities.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 16:02:42 -07:00
Linus Torvalds
0a13d287e5 Use round line noins and caps
It doesn't really make much of a difference, but it can be visible
especially with lots of tight samples.  Miter joins really look horrible
for acute angles.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 08:25:54 -07:00
Linus Torvalds
55156e63c3 Label the temperature graph
Oooh, pretty.

Or not.  The temperature graph is usually ugly as hell, but Dirk has the
cool dive computer with lots and lots of temperature readings.  Which
makes the graph a pretty graph, rather than a butt-ugly staircase like
mine.

Next time: get a dive computer with an OLED screen, and that can draw
pretty temperature graphs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 08:16:29 -07:00
Linus Torvalds
f4559ba9fa Plot a sick kind of temperature curve
.. without the actual text, because I'm a "random plots that cannot
actually be interpreted" kind of guy.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 20:37:32 -07:00
Linus Torvalds
15474135b1 Accept a smaller profile window
I'm trying to make sure that we can shrink the main window and still get
a useful experience.  Sometimes you have small bad netbooks when diving..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 16:21:21 -07:00
Linus Torvalds
41bce9e5f4 Show tank type and O2 mix for air usage
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-09 11:09:34 -07:00
Linus Torvalds
86e48bfe10 Use the analyzed local minima/maxima for depth text plotting
Instead of relying on our ad-hoc minmax finder, just use the local
minima/maxima information directly.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-08 16:01:41 -07:00
Linus Torvalds
28cadad144 Use an indirect pointer to min/max entry rather than value
This way we can always find the actual min/max entry that generated the
local minima/maxima.  Which is useful for visualization.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-08 15:59:04 -07:00
Linus Torvalds
91439f3aff Show the min/max data in funky purple shading
Dirk likes purple. I mean - Dirk REALLY likes purple.

And what's better than "purple"? You got it: "funky purple".

So this shows the one- two- and three-minute min/max information in some
seriously funky purple fringing.  It's not really necessarily meant to
be serious, but it's a quick hack to visualize the data until we figure
out what to *really* do with it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-08 09:32:08 -07:00
Linus Torvalds
2d9ac73e38 Start analyzing depth profile: smoothing and time-based min/max/avg
This turns the depth profile into a generic "plot_info" and calculates
minima, maxima and averages over 1-, 2- and 3-minute intervals for each
point.  It also creates a smoothed version.

We currently don't actually show the results, but that's the next step..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-08 09:26:54 -07:00
Dirk Hohndel
30d228f104 Remove unused variable
This fixes a compile warning

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 21:36:52 -07:00
Linus Torvalds
bd315a4804 Show the shallow points of the dive too
.. unless they are so shallow that they are basically at the surface.

These show up automatically in out min/max logic, so just go ahead and
show them.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 21:11:26 -07:00
Linus Torvalds
77b2df664d Move text rendering function upwards
No change in semantics, I'm just contemplating doing some text renderign
from within the "minmax" function itself.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 18:57:04 -07:00
Linus Torvalds
75f7842675 Add font size to the text_render_options structure
Ok, so it's really a 'double', but for now we're only using integer font
sizes, so let's see if we ever want to do anything but that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 18:33:14 -07:00
Dirk Hohndel
06399d7d2f Add vertical alignment setting to text output
Add new valign enum to text_render_options_t and update all callers to
plot_text

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[ Fixed spelling, updated to newer base - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 18:26:59 -07:00
Linus Torvalds
11641095ae Turn tail recursion back into a loop
I still think there should be some way to partition the space
automatically, but the algorithm that worked best was the simple
tail-recursive one.

Which might as well be expressed as a loop.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 16:38:22 -07:00
Linus Torvalds
95a051e164 Get rid of timelimit code and corner cases
The recursive minmax is now robust without them.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 16:21:35 -07:00
Linus Torvalds
76af28fee6 Clean up plot_text_samples() further
We don't actually use the 'dive' structure any more, since we now always
have the sample pointers directly.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 16:03:16 -07:00
Linus Torvalds
cfcc811efe Simplify/clean up depth min/max finder
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 15:50:07 -07:00
Linus Torvalds
d4a1dfb3d9 Fix up horribly broken cairo scaling
The way cairo does scaling is really really inconvenient, and one of the
things in cairo that is fundamentally mis-designed.

Cairo scaling always affects both coordinates and object sizes, and the
two can apparently never be split apart.  Which is very much not what we
want: we want just coordinate scaling.

So we cannot use 'cairo_scale()' to scale our canvas, because that
screws up lines and text size too.  And no, you cannot "fix" that by
de-scaling the line size etc - because line size is one-dimensional, so
you can't undo the (different) scaling in X/Y.

Sad.  I realize that often you do want to scale object size with
coordinate transformation, but quite often you *don't* want to.

Yeah, we could do random context save/restore in odd places etc, but
that's just a sign of the bad design of cairo scaling.

Work around it by introducing our own graphics context with scaling,
which does it right.  I don't like this, but it seems to be better than
the alternatives.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 14:37:47 -07:00
Linus Torvalds
96f5bea1ac Use a recursive (instead of iterative) minmax depth finder
This is a bit more natural, and makes it much easier to do scale
independence.  In particular, I want to make it possible to grow and
shrink the graph, and this should make it particularly simple to react
by giving more or fewer minmax points.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 13:51:35 -07:00
Linus Torvalds
d1ce430878 Tweak depth next_minmax() interface
Use start/end sample pointers to make a recursive algorithm possible.

Also, clean up the end condition - we don't want to return an
uninteresting minmax result just because we ran out of samples.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 13:35:59 -07:00
Linus Torvalds
fdbd80a3a2 Honor depth unit settings when plotting the depth profile
This shows the depth properly in meter or feet depending on unit
selection.

It also changes the horizontal depth rulers to be at 10m/30ft intervals
rather than the previous 15ft.  With the textual depth markers, the
horizontal lines aren't as important any more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 09:21:26 -07:00
Linus Torvalds
7bbdea19ed Add radio buttons for temperature and volume
.. and clean up some of the conversions.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 08:37:50 -07:00
Linus Torvalds
a06d93217f Start doing gas management using output units
Ok, it's an odd place to start, but this now shows the pressure curve
details and the air usage in the proper units.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 19:28:31 -07:00
Linus Torvalds
75cb94f067 Clean up type handling of cylinder pressure plot
Soon we'll show things in psi or bar depending on user choice.  Let's
not get confused about units before we do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 19:14:56 -07:00
Dirk Hohndel
a5a3cba574 Fix drawing artifacts with dives that have samples past the dive duration
The UEMIS Zurich SDA keeps recording samples for quite a while after the
dive ended.  These provide no additional information, but confuse our
drawing algorithm as they can cause us to draw both the depth and tank
pressure plots beyond the right edge of our canvas.

Stop drawing if sample->time.seconds is larger than dive->duration.seconds.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 18:37:57 -07:00
Linus Torvalds
0e3bbd4102 Use 'cairo_translate()' instead of manual translation
I'd like to do 'cairo_scale()' too, but that messes up line sizes.  I'll
think about it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 15:41:02 -07:00
Linus Torvalds
dbfce3035e Merge branch 'dirk'
* dirk:
  Print starting and ending pressures

Fix up conflicts in profile.c due to different ways to set the text
formatting.  Dirk's 'text_format_options' thing is prettier than mine.
Use it.
2011-09-06 15:17:24 -07:00
Dirk Hohndel
dfe5133b57 Print starting and ending pressures
This is very simplistic as far as placement of the text goes.
It makes the plot_text function somewhat more generic.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 15:13:00 -07:00
Linus Torvalds
93c21a4dbc Add some air usage statistics to the dive plot
Show "absolute volume" used, and SAC/m (surface-equivalent per minute).

I'm not going to guarantee the calculations.  And I show the result in
cubic feet.  Sue me.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 14:46:46 -07:00
Linus Torvalds
e88695ff72 Do cylinder pressure plot first, then depth, then text notes
Text notes need to be last, so that they don't get stepped on by the
other graph elements.

Also, separate the depth text plot out into a function of its own.
Tidier that way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 12:36:52 -07:00
Linus Torvalds
c0a429457a Tweak the "show depth in text" heuristic a bit
Use a 10-minute window *or* when the depth has reversed sufficiently to
make the max we've found interesting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 12:16:39 -07:00
Linus Torvalds
3b67a3ecb4 Plot some numerical depth markers
Add some actual numbers to the depth plot too.  Do it by finding the
deepest points (within a five-minute rolling window), and show the
depths of those points.

Sure, we could have just labeled the depth markers, but this seems
nicer. But what do I know - I'm not exactly famous for my GUI design.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 10:25:01 -07:00
Dirk Hohndel
d4db3e938b Fix drawing artifact with UEMIS xml data
Only draw the pressure line to the final data point
(duration / end.mbar) if we haven't already drawn samples
past that point (as the UEMIS records pressure data for a
number of additional samples after the actual dive has ended)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[ Changed to use 'last actual drawn sample time that had pressure
  data' instead of 'last sample time'  - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 07:30:48 -07:00
Nathan Samson
21204926df Open File works. I refactored the code and introduced a new type. I never used it as a pointer (their was no real reason), but I'm not really satisfied.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05 21:12:58 +02:00
Linus Torvalds
5f79a804b9 Sanitize and fix cylinder pressure overview
Doing per-dive cylinder start/end pressures is insane, when we can have
up to eight cylinders.  The cylinder start/end pressure cannot be per
dive, it needs to be per cylinder.

This makes the save format cleaner too, we have all the cylinder data in
just one place.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 09:12:54 -07:00
Nathan Samson
6138d151e9 Remove the redundant frames in the notebook. Closes #9
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 19:01:30 +02:00
Linus Torvalds
b176daf6d6 Do better cylinder information management
Instead of just tracking gasmix, track the size and workng pressure of
the cylinder too.

And use "cylinder" instead of "tank" throughout.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 20:31:18 -07:00
Linus Torvalds
c1bed52a77 Add 'mean depth' marker on dive plot
Just because I can.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 13:55:36 -07:00
Linus Torvalds
1e75ceac0d Add various dive fixups, and show pressure (if any) in the plot
Now the dive profile plot *really* needs some units.  The pressure is
just a random line otherwise.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 13:19:26 -07:00
Linus Torvalds
968aa28155 Do something half-way sane (no SIGSEGV) when there are no dives
It just leaves ugly blank areas, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 16:40:22 -07:00
Linus Torvalds
ee56021dfb dive profile plot: use saner minimum limits
The time minimum was in seconds, not minutes, and we really do want to
show at least to 90ft to make shallow dives look shallow rather than
scaled to some full depth.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 14:35:31 -07:00
Linus Torvalds
059f047788 plot a fancier 'filled' depth profile
Now I'm just dicking around with cairo.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 14:23:35 -07:00
Linus Torvalds
eed9538101 Plot dive profile slightly more intelligently.
This actually creates a bounding box and some scale markers.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 14:15:50 -07:00
Linus Torvalds
2044dabc81 Teach the thing to actually track the currently selected dive
.. and repaint the profile when the selection changes.

Now, if it just wasn't so ugly, it might even be useful.  Except it
obviously needs to also show all the other dive information.  And allow
the user to fill in details.  And save the end results.

So no, it's not useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 11:07:31 -07:00
Linus Torvalds
8e95ded57b Split up profile frame generation into its own file.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 10:20:46 -07:00