Support dctype/divemode on UDDF import

This will grab the divemode information from the first waypoint within
the dive that includes this info and uses it for dctype.

Note that our dive type is not as fine grained as the one in UDDF. The
latter allows one to switch divemode during the dive when we do not.
However, one could argue that i.e. a rebreather dive should be a
rebreather dive even if one switches to bailout gas at some point...

Fixes #922

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2017-12-10 08:18:53 +02:00 committed by mturkia
parent 5c8ad329f5
commit 38cc8bdc40

View file

@ -359,6 +359,27 @@
</xsl:choose>
</xsl:attribute>
<!-- Divemode -->
<xsl:if test="samples/waypoint/divemode/@type|u:samples/u:waypoint/u:divemode/@type|u1:samples/u1:waypoint/u1:divemode/@type != ''">
<xsl:attribute name='dctype'>
<xsl:choose>
<xsl:when test="samples/waypoint/divemode/@type|u:samples/u:waypoint/u:divemode/@type|u1:samples/u1:waypoint/u1:divemode/@type = 'apnoe'
or samples/waypoint/divemode/@type|u:samples/u:waypoint/u:divemode/@type|u1:samples/u1:waypoint/u1:divemode/@type = 'apnea'">
<xsl:text>Freedive</xsl:text>
</xsl:when>
<xsl:when test="samples/waypoint/divemode/@type|u:samples/u:waypoint/u:divemode/@type|u1:samples/u1:waypoint/u1:divemode/@type = 'closedcircuit'">
<xsl:text>CCR</xsl:text>
</xsl:when>
<xsl:when test="samples/waypoint/divemode/@type|u:samples/u:waypoint/u:divemode/@type|u1:samples/u1:waypoint/u1:divemode/@type = 'semiclosedcircuit'">
<xsl:text>PSCR</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>OC</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<depth>
<xsl:for-each select="greatestdepth|informationafterdive/greatestdepth|u:greatestdepth|u:informationafterdive/u:greatestdepth|u1:greatestdepth|u1:informationafterdive/u1:greatestdepth|max_depth">
<xsl:attribute name="max">