diff options
-rw-r--r-- | dive.h | 2 | ||||
-rw-r--r-- | dives/test9a.xml | 42 | ||||
-rw-r--r-- | qt-ui/profile/divecartesianaxis.cpp | 3 |
3 files changed, 46 insertions, 1 deletions
@@ -20,6 +20,8 @@ (void) (&_max1 == &_max2); \ _max1 > _max2 ? _max1 : _max2; }) +#define IS_FP_SAME(_a,_b) (abs((_a) - (_b)) < 0.000001) + #include <libxml/tree.h> #include <libxslt/transform.h> diff --git a/dives/test9a.xml b/dives/test9a.xml new file mode 100644 index 000000000..ac9fa8582 --- /dev/null +++ b/dives/test9a.xml @@ -0,0 +1,42 @@ +<dives> +<program name='subsurface' version='1'></program> +<dive number='9' date='2011-01-01' time='17:00:00' duration='30:00 min'> + <depth max='30.0 m' mean='15.0 m' /> + <temperature air='27.0 C' water='26.0 C' /> + <location>9Ath test dive, with temperature in single sample</location> + <notes>Test collapse of temperature axis due to max_temp == min_temp.</notes> + <cylinder o2='33.0%' size='9.987 l' workpressure='206.843 bar' description='AL72' start='200.0 bar' end='100.0 bar' /> + <cylinder o2='50.0%' size='9.987 l' workpressure='206.843 bar' description='AL72' start='200.0 bar' end='100.0 bar' /> + <event time='15:00 min' name='gaschange' value='50' /> + <sample time='1:00 min' depth='5 m' /> + <sample time='2:00 min' depth='10 m' /> + <sample time='3:00 min' depth='15 m' /> + <sample time='4:00 min' depth='20 m' /> + <sample time='5:00 min' depth='25 m' /> + <sample time='6:00 min' depth='30 m' /> + <sample time='7:00 min' depth='30 m' /> + <sample time='8:00 min' depth='30 m' /> + <sample time='9:00 min' depth='30 m' /> + <sample time='10:00 min' depth='30 m' /> + <sample time='11:00 min' depth='30 m' /> + <sample time='12:00 min' depth='30 m' /> + <sample time='13:00 min' depth='30 m' /> + <sample time='14:00 min' temp='26.0 C' depth='10 m' /> + <sample time='15:00 min' depth='15 m' /> + <sample time='16:00 min' depth='5 m' /> + <sample time='17:00 min' depth='10 m' /> + <sample time='18:00 min' depth='10 m' /> + <sample time='19:00 min' depth='10 m' /> + <sample time='20:00 min' depth='10 m' /> + <sample time='21:00 min' depth='10 m' /> + <sample time='22:00 min' depth='5 m' /> + <sample time='23:00 min' depth='5 m' /> + <sample time='24:00 min' depth='5 m' /> + <sample time='25:00 min' depth='5 m' /> + <sample time='26:00 min' depth='5 m' /> + <sample time='27:00 min' depth='5 m' /> + <sample time='28:00 min' depth='5 m' /> + <sample time='29:00 min' depth='2.5 m' /> + <sample time='30:00 min' depth='0 m' /> +</dive> +</dives> diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp index fdcfff3c6..505b60d7e 100644 --- a/qt-ui/profile/divecartesianaxis.cpp +++ b/qt-ui/profile/divecartesianaxis.cpp @@ -184,7 +184,8 @@ qreal DiveCartesianAxis::posAtValue(qreal value) double size = max - min; // unused for now: // double distanceFromOrigin = value - min; - double percent = (value - min) / size; + double percent = IS_FP_SAME(min,max) ? 0.0 : (value - min) / size; + double realSize = orientation == LeftToRight || orientation == RightToLeft? m.x2() - m.x1() : |