This adds a few more predefined cylinder types to the static list, but
perhaps more importantly, if we try to show a cylinder description that
we haven't seen before, we automatically add that description to the
list as well.
This way, if people have their own cylinder types, our cylinder
management will automatically figure them out and make it easy to enter
them.
NOTE! It might be best to add the new cylinder description at dive log
load time, rather than at 'show' time.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
We also need to actually fill the model store with the cylinder models
we have in our dive lists to begin with.
This makes it all *trivial* to add a new cylinder model: just use a new
description, fill in the size and working pressure, and you're done.
The type automatically gets filled in, unless that description already
existed (in which case we leave it alone).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
If the output units are set to cuft and psi, then we should show the
cylinder size and pressure properly.
NOTE! In the absense of pressure data, we *always* show the cylinder
volume in liter. There's no way to convert it to imperial units, since
the imperial units are not in physical size, but in air volume
normalized to surface pressure..
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
We used to have the heuristic that if we saw a cylinder working
pressure, then the cylinder size would be in cuft. Which meant that we
couldn't export our working pressures, because it would mess things up
on import.
But working pressure is actually nice to know, if you ever work with
cylinders in imperial units. So now that the import is fixed, add the
working pressure to the export.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
That just screws up the good xml files that have everything in
well-defined units and chose the sane metric units.
So do the cuft -> liter conversion only if the input units are
explicitly CUFT, or known ambiguous input (SUUNTO).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It seems to be sufficiently useful to be worth updating the dive
information now.
This still doesn't handle multiple cylinders in any way. I need to
think about the interface for that.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This doesn't actually change the cylinder type info in the dive, because
it's too broken for that. Instead it prints out what it would change
things to.
The gtk2 notion of text input focus is *really* odd. Why is the
cylinder type sometimes selected, and sometimes not?
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Make it about general equipment management, and start hooking up
functions to show new equipment information when changing dives (and to
flush changes to equipment information for the previously active dive).
Nothing is hooked up yet, and it's now showing just one (really big)
cylinder choice, so this is all broken. But it should make it possible
to at least get somewhere some day.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Ok, so it's not connected to anything yet, and the tank choices (that
don't do anything) are some random hardcoded collection, but maybe it
will do something some day.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
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>
That seems to be the gtk2 way. Whatever. diveclog ends up defaulting
to metric units, because we all know that's the right thing to do.
However, I learnt to dive in the US, so I'm used to seeing psi and feet.
So despite the sane defaults, I want diveclog to use the broken imperial
units for me.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
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>
.. 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>
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>
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>
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>
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>
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>
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>
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>
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>
Just iterate over the dive list entries, updating them one by one.
This avoids the "selection destroyed" when the dive units are changed.
And it's cleaner anyway.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This should take care of it all, unless I missed some case.
Now we should just save the default units somewhere, and I should do the
divelist update much cleaner (instead of re-doing the divelist entirely,
it should just repaint it - now we lose the highlited dive etc).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
Set the output units to feet/meter or psi/bar.
Of course, we only actually react to the psi/bar one right now, but it's
all coming some day.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
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>
This doesn't actually *do* anything yet, but it introduces the notion of
output units, and allows you to pick metric or imperial.
Of course, since the output doesn't currently care, the units you pick
are irrelevant. But just wait..
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
There are several sample UDDF files around on the net, so we might as
well start importing some of it.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* 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.
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>
It does seem like a lot of github users are not used to good commit
message rules, and may never have used git for a project that actually
cares about good logs and nice summary lines.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
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>