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>
Most developers on GitHub are not used to projects that use the Signed-off-by convention.
They do, however, tend to read the READMEs to see which conventions the author prefers
to follow. If you are explicit about what you prefer in the README with easy to follow
instructions, it is more likely people will follow those conventions.
Signed-off-by: Scott Chacon <schacon@gmail.com>
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>
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>
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>
Each caller ends up needing it, and I missed another one. So rather
than update the other caller, just do it in dive_list_update_dives() and
we can stop worrying about it.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Looks like Linus misinterpreted the first UEMIS xml files I sent him.
The date_time appears to be in local time - so the time zone info can be
ignored (that seems strange, but it worked for the dives I tested it
with)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
We did this when loading from the command line, but not when loading
through the file load menu item.
Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* 'open-files' of git://github.com/nathansamson/diveclog:
Report errors when opening files
Make it possible to load multiple files at once.
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.
This is just a very rough draft. It imports all the main stuff I
noticed, but I'm sure it drops a ton of other stuff.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Instead of having each import source recognition routine set a separate
flag for that import source, just enumerate them and set them in one
variable.
I'm adding yet another xml importer - divinglog.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
There's a big comment there now about what is going on. It took me a
while to understand how the crazy seven-tank uemis dive computer
information actually works.
So the Uemis computer has 4 different "tank profiles":
- single tank air (0)
- single tank nitrox (1)
- two-tank nitrox (2)
- three-tank nitrox (3)
and the computer always lists all seven tank cases (because that's how
you fill them in).
Depending on the "gas.template" you are supposed to then *use* just one
particular profile. Why the computer doesn't just give you the tanks
for that one profile, who knows? It seems to be more of the same "Uemis
dive data isn't so much about the dive, it's about dive computer state"
mentality.
So we first get the profile information, and then based on that we need
to pick the right tanks from the set of seven that we're presented with.
All clear?
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This makes the xml save-file look way nicer: it's both smaller and
better organized. Using individual xml nodes for random small details
is silly.
The duration even parses exactly the same, because it still ends up
being '.depth.duration' (now it's the 'duration' attribute of the dive
node, it used to be the 'duration' child node of the dive node).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
..as suggested by Nathan:
"I also wanted to "zebra" color the divelist by setting the rules-hint
to TRUE. but I noticed it was already set explicitly to FALSE (even
if this is the default).
If this is just an accidental copy paste from some tutorial you can
experiment (set it to TRUE) and see what you like most."
It was indeed just copy-paste from some tutorial, and the zebra-coloring
does look nicer, doesn't it?
Suggested-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Instead of always using three decimal digits, use 1-3 digits. But do
use at least one, even for integer numbers, just because it makes it so
much clearer that we're dealing with potential fractional values.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I don't necessarily want to show three decimal digits when one or two
would do. So prepare for that by using a helper. This doesn't actually
change the printout yet.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is some seriously crazy stuff. Instead of making sense as a
divelog, the uemis xml makes more sense as a "dive computer settings
dump".
And I guess I can see why they'd do that. But it makes parsing it just
incredibly annoying. The thing is more of a "these are the
configurations I support as a dive computer thing" than a "this was the
tank you were diving with".
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>