summaryrefslogtreecommitdiffstats
path: root/profile.c
AgeCommit message (Collapse)Author
2011-09-11Accept a smaller profile windowGravatar Linus Torvalds
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-09Show tank type and O2 mix for air usageGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-08Use the analyzed local minima/maxima for depth text plottingGravatar Linus Torvalds
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-08Use an indirect pointer to min/max entry rather than valueGravatar Linus Torvalds
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-08Show the min/max data in funky purple shadingGravatar Linus Torvalds
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-08Start analyzing depth profile: smoothing and time-based min/max/avgGravatar Linus Torvalds
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-07Remove unused variableGravatar Dirk Hohndel
This fixes a compile warning Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07Show the shallow points of the dive tooGravatar Linus Torvalds
.. 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-07Move text rendering function upwardsGravatar Linus Torvalds
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-07Add font size to the text_render_options structureGravatar Linus Torvalds
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-07Add vertical alignment setting to text outputGravatar Dirk Hohndel
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-07Turn tail recursion back into a loopGravatar Linus Torvalds
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-07Get rid of timelimit code and corner casesGravatar Linus Torvalds
The recursive minmax is now robust without them. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07Clean up plot_text_samples() furtherGravatar Linus Torvalds
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-07Simplify/clean up depth min/max finderGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07Fix up horribly broken cairo scalingGravatar Linus Torvalds
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-07Use a recursive (instead of iterative) minmax depth finderGravatar Linus Torvalds
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-07Tweak depth next_minmax() interfaceGravatar Linus Torvalds
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-07Honor depth unit settings when plotting the depth profileGravatar Linus Torvalds
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-07Add radio buttons for temperature and volumeGravatar Linus Torvalds
.. and clean up some of the conversions. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06Start doing gas management using output unitsGravatar Linus Torvalds
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-06Clean up type handling of cylinder pressure plotGravatar Linus Torvalds
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-06Fix drawing artifacts with dives that have samples past the dive durationGravatar Dirk Hohndel
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-06Use 'cairo_translate()' instead of manual translationGravatar Linus Torvalds
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-06Merge branch 'dirk'Gravatar Linus Torvalds
* 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-06Print starting and ending pressuresGravatar Dirk Hohndel
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-06Add some air usage statistics to the dive plotGravatar Linus Torvalds
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-06Do cylinder pressure plot first, then depth, then text notesGravatar Linus Torvalds
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-06Tweak the "show depth in text" heuristic a bitGravatar Linus Torvalds
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-06Plot some numerical depth markersGravatar Linus Torvalds
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-06Fix drawing artifact with UEMIS xml dataGravatar Dirk Hohndel
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-05Open File works. I refactored the code and introduced a new type. I never ↵Gravatar Nathan Samson
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-05Sanitize and fix cylinder pressure overviewGravatar Linus Torvalds
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-04Remove the redundant frames in the notebook. Closes #9Gravatar Nathan Samson
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-03Do better cylinder information managementGravatar Linus Torvalds
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-03Add 'mean depth' marker on dive plotGravatar Linus Torvalds
Just because I can. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03Add various dive fixups, and show pressure (if any) in the plotGravatar Linus Torvalds
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-08-31Do something half-way sane (no SIGSEGV) when there are no divesGravatar Linus Torvalds
It just leaves ugly blank areas, but whatever. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31dive profile plot: use saner minimum limitsGravatar Linus Torvalds
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-31plot a fancier 'filled' depth profileGravatar Linus Torvalds
Now I'm just dicking around with cairo. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Plot dive profile slightly more intelligently.Gravatar Linus Torvalds
This actually creates a bounding box and some scale markers. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Teach the thing to actually track the currently selected diveGravatar Linus Torvalds
.. 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-31Split up profile frame generation into its own file.Gravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>