Commit graph

28 commits

Author SHA1 Message Date
Tomaz Canabrava
779c1b6738 Create a version of create_graph_info that doesn't depend on GC.
This version of the create plot info is the same as before, with the
difference that it doesn't depends on the gc.
Also fixed a crash.

The Pressure Index, Information and interpolated seems wrong,
I'm getting only zeroes.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17 14:04:47 -08:00
Tomaz Canabrava
dd64f1792d Reworked the calculate_max_limits and plotted the dive.
Created a new version of calculate_max_limits that doesn't have a
graphics_context and returns a plot_info. The code is basically the same
as the old calculate_max_limits, so there's not much to talk about.

The rest of the code is just boilerplate to plug the Profile
code with the axis and model stuff, to be plotted on screen.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 10:12:31 +07:00
Tomaz Canabrava
7d5cf32501 Added a Model that should handle the Dive Profile
This model encapsulates the plot_info struct and provides
a consistent way to show it using the Qt Model view system
in the C++ and QML way. For a QGraphicsItem that should show
a Profile, this is the start.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 10:12:30 +07:00
Rodrigo Severo
eec5dba1c2 Reinstating SURFACE_THRESHOLD test in pressure_time function
The small straight parts at the end of tank pressure lines are more of a
aesthetic issue, not causing real harm so it is no reason to remove the
SURFACE_THRESHOLD test from pressure_time function only because of this.

Also improved interpolate data debuging, rearranged
get_pr_interpolate_data and removed an unused variable from
get_pr_interpolate_data. No real change here, just trying to make the code
clearer.

[Dirk Hohndel: clean up whitespace damage from this and the previous
               commit]

Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08 20:38:17 +08:00
Rodrigo Severo
8f0c8be245 Discontinuity and stall on tank pressure interpolated lines
Interpolated lines for tank pressures were presenting discontinuities
(sudden drops) and stalls (horizontal lines) with certain dive profiles.

The main reason seems to be that the discrete interpolation of tank
pressure was adding small pressure increments that could be rounded down
or up repeatedly generating cumulative rounding errors that would mean
either a delay on pressure drop that would be drawn as a sudden drop or as
a premature pressure drop that would result in a flat line.

This patch changes the way the discrete interpolation is done, so that we
don't have cumulative rounding errors distorting tank pressure lines.

To calculate accumulated pressure_time values the get_pr_interpolate_data
function was created. The fact that get_pr_interpolate_data transverses
the beginning of the plot_info entry list for each entry that needs
interpolated tank pressure isn't optimal at all. There might be a way to
properly track the data necessary to interpolate tank pressures from
inside the main pi->entry loop in fill_missing_tank_pressures.
Unfortunately I didn't manage to do it inside fill_missing_tank_pressures
so we have get_pr_interpolate_data.

The SURFACE_THRESHOLD test from pressure_time function was also removed as
no matter how shallow the diver is, if he is using the cylinder to breathe
the cylinders tank pressure should be affected.

Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08 20:35:07 +08:00
Anton Lundin
04bbfe2ab1 Disable calc_ndl_tts for print
NDL and TTS doesn't show up in the printed profiles, and it takes
significant time to calculate, so just don't do it.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 15:22:49 -08:00
Anton Lundin
39a4e38eea Break calculated deco info to separate vars
Store the calculated values in separate variables in the plot_data
struct, and display them separate. This makes sure we don't confuse the
calculated values with the ones from a dc, and now we can compare the
two.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 07:08:57 +09:00
Anton Lundin
437246d3ed Move sac-calculation to profile.c
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 14:54:11 -07:00
Lubomir I. Ivanov
d347ef5336 profile.h: Adjust text sizes (*_TEXT_SIZE)
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 04:23:35 -07:00
Dirk Hohndel
f8ba3c7ab6 Minor include file unwinding
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 12:45:42 -07:00
Maximilian Güntner
248f1b86d1 Added a ruler which can be dragged along the profile
This patch adds a ruler QGraphicsItem which can be dragged
along the profile. The ruler displays minimum, maximum and
average for depth and speed (ascent/descent rate). Also, all used
gas will be displayed.

This also adds a new attribute to struct plot_data to store the
speed (not just as velocity_t).

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-09-27 18:42:19 +02:00
Anton Lundin
0c9e6f9acc Remove o2/he from plot_data and fix gas plot text
plot_data.o2 and plot_data.he was wrong for all dives, due to that
cylinderindex was set right first in populate_pressure_information, and
thus those two contained bogus information.
This makes the plot-text use cylinderindex-lookup as everything else.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-23 21:05:35 -07:00
Anton Lundin
35356e364d Calculate deco stops, TTS and NDL
Calculate TTS and NDL, and Deco stops when they don't already exist in
the samle and show them in the mouse-over.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-05 22:29:36 -07:00
Dirk Hohndel
6f7467de7a Show the gas with the pressure diagram
This is a feature that had been requested a few times in the past and when
debugging my "show only used gases" commit I realized that this would have
been extremely useful to have...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 17:31:53 +10:00
Robert Helling
344a429e48 Show ceilings for individual tissues
I think that displaying tissue loadings either as pressure or as
percentages is not very intuitive but that it makes much more sense when
translated to ceiling depths.

This change enables just that for the 16 tissues in our calculated ceiling
and visualizes this in the profile graph.

There is a checkbox in the preferences to turn this on. If enabled, all
tissues having non-trivial ceilings are also shown in the info box.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 05:18:25 +09:00
Dirk Hohndel
8394828806 Fix the positioning of text in the dive profile
This had been bugging me for a while - the label texts were all not
quite where I expected them to be. I think this looks much better now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-28 09:57:49 -07:00
Dirk Hohndel
c129902793 Fix some compiler warnings
Passing the alignment as int instead of float or double was actually a bug
as CENTER is defined as (-0.5) ...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10 10:47:37 -07:00
Tomaz Canabrava
25d65ab97d Plotting deco text.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
c62e8e5baa Plotting temperature text.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
9554cb5767 Plot of the Cylinder Pressure over time.
a few code was moved around, a macro that contained
the form of x ? : y; had to be rewritten to x ? x : y
since c++ doesn't allow ternarys without the middle operator.

The color-choosing for the Cylinder Pressure broke
on the Qt port - but it's a small issue.
I'm painting everyone as 'dark green' now, will
fix that later.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 00:24:03 -03:00
Dirk Hohndel
6f06c31d0b Stop passing around gc and pi
Make the graphics_context part of the ProfileGraphicsView and remember
that the plot info is already a part of the graphics_context (we kept
passing around both of them in the Gtk code... pointless but a leftover
from before adding the pi to the gc...)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 15:01:49 -07:00
Tomaz Canabrava
ef7ace9926 Plot the temperature Graph
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 14:19:10 -07:00
Tomaz Canabrava
867435442b Plotting the Events done
There are subtle differences, the Cairo version looks
prettier - but that's fixable. I did a small triangle
and a exclamation mark on it. maybe a gradient would
make a good difference there.

this item has a ItemIgnoresTransformation tag, so
scalling, rotating or zooming will not change it's
size.

The tooltips are not yet ported.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 20:30:22 -07:00
Tomaz Canabrava
1b392b35bc Port the plot text method to Qt, also test it by actually plotting something
The plot_text function from the cairo-methods are now ported
on the qt version. this patch moves around some code since
quite defines are already used and I didn't want to reinvent
the whell.

Original code used varargs, but I prefered to change it
, so now it receives just a reference to a QString object
and the string must be constructed before sending,
using the .arg methods.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 13:55:06 -07:00
Henrik Brautaset Aronsen
484c10ba5a Avoid redefinition of typedef ‘bool’
The compiler on MacOSX wouldn't build Subsurface when bool
was redefined.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 06:10:08 -07:00
Tomaz Canabrava
f269f86496 Plot of the Mean Deph
The mean depth now is plotted correctly.
I wanted to do more stuff on this commit, but since
it required that a few things on profile.c got moved
to profile.h, commited to not have a huge blob for review.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:55:16 -07:00
Tomaz Canabrava
19048b98e5 Start plotting something.
The first plotting method was removed from profile.c
to profilegraphics.cpp and some conversion ( almost 1 to 1 )
was made so that the code could work.

Since the code is big - this commit has just a part of it
working - it plots the grid. but already works for testing
the resizing of the window and Zooming ( unimplemented )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04 19:55:12 -07:00
Tomaz Canabrava
fa82ba6079 Moved the plot from the cairo version to the Qt version
Started working on the Qt version of the Plot, initially
nothing is printed - but this is not a bad thing,
the program doesn't explodes too. :)

some work had to be done about the 'bool/gboolean' stuff
so I removed all gbooleans in the code that I'v encountered.

A new file was created ( profile.h ) so I could put the
signatures of helper methods that cairo used to call.

till now the code computes the max limits.
Next patch the first drawing will be made.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:51:33 -07:00