mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Improve UDDF import
Some improvements on importing different versions of UDDF logs. Also include rating, gps coordinates and gas mixture in the import. Signed-off-by: Miika Turkia <miika.turkia@nixu.fi> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									995192c5fb
								
							
						
					
					
						commit
						5b0162d9d4
					
				
					 1 changed files with 53 additions and 14 deletions
				
			
		|  | @ -126,19 +126,19 @@ | |||
|         </xsl:attribute> | ||||
|       </xsl:if> | ||||
| 
 | ||||
|       <xsl:if test="condition/visibility != '' and condition/visibility != 0"> | ||||
|       <xsl:if test="condition/visibility|informationafterdive/visibility != '' and condition/visibility|informationafterdive/visibility != 0"> | ||||
|         <xsl:attribute name="visibility"> | ||||
|           <xsl:choose> | ||||
|             <xsl:when test="condition/visibility < 1"> | ||||
|             <xsl:when test="condition/visibility|informationafterdive/visibility < 1"> | ||||
|               <xsl:value-of select="1"/> | ||||
|             </xsl:when> | ||||
|             <xsl:when test="condition/visibility <= 3"> | ||||
|             <xsl:when test="condition/visibility|informationafterdive/visibility <= 3"> | ||||
|               <xsl:value-of select="2"/> | ||||
|             </xsl:when> | ||||
|             <xsl:when test="condition/visibility <= 5"> | ||||
|             <xsl:when test="condition/visibility|informationafterdive/visibility <= 5"> | ||||
|               <xsl:value-of select="3"/> | ||||
|             </xsl:when> | ||||
|             <xsl:when test="condition/visibility <= 10"> | ||||
|             <xsl:when test="condition/visibility|informationafterdive/visibility <= 10"> | ||||
|               <xsl:value-of select="4"/> | ||||
|             </xsl:when> | ||||
|             <xsl:otherwise> | ||||
|  | @ -148,41 +148,71 @@ | |||
|         </xsl:attribute> | ||||
|       </xsl:if> | ||||
| 
 | ||||
|       <xsl:if test="condition/air_temp != ''"> | ||||
|       <xsl:if test="informationafterdive/rating/ratingvalue != '' and informationafterdive/rating/ratingvalue != 0"> | ||||
|         <xsl:attribute name="rating"> | ||||
|           <xsl:choose> | ||||
|             <xsl:when test="informationafterdive/rating/ratingvalue < 2"> | ||||
|               <xsl:value-of select="0"/> | ||||
|             </xsl:when> | ||||
|             <xsl:when test="informationafterdive/rating/ratingvalue <= 2"> | ||||
|               <xsl:value-of select="1"/> | ||||
|             </xsl:when> | ||||
|             <xsl:when test="informationafterdive/rating/ratingvalue <= 4"> | ||||
|               <xsl:value-of select="2"/> | ||||
|             </xsl:when> | ||||
|             <xsl:when test="informationafterdive/rating/ratingvalue <= 6"> | ||||
|               <xsl:value-of select="3"/> | ||||
|             </xsl:when> | ||||
|             <xsl:when test="informationafterdive/rating/ratingvalue <= 8"> | ||||
|               <xsl:value-of select="4"/> | ||||
|             </xsl:when> | ||||
|             <xsl:otherwise> | ||||
|               <xsl:value-of select="5"/> | ||||
|             </xsl:otherwise> | ||||
|           </xsl:choose> | ||||
|         </xsl:attribute> | ||||
|       </xsl:if> | ||||
| 
 | ||||
|       <xsl:if test="condition/air_temp|informationbeforedive/airtemperature != ''"> | ||||
|         <divetemperature> | ||||
|           <xsl:attribute name="air"> | ||||
|             <xsl:value-of select="concat(format-number(condition/air_temp - 273.15, '0.0'), ' C')"/> | ||||
|             <xsl:value-of select="concat(format-number(condition/air_temp|informationbeforedive/airtemperature - 273.15, '0.0'), ' C')"/> | ||||
|           </xsl:attribute> | ||||
|         </divetemperature> | ||||
|       </xsl:if> | ||||
| 
 | ||||
|       <xsl:if test="dive_site_ref/@ref != ''"> | ||||
|       <xsl:if test="dive_site_ref/@ref|informationbeforedive/dive_site_ref/@ref != ''"> | ||||
|         <location> | ||||
|           <xsl:variable name="ref"> | ||||
|             <xsl:value-of select="dive_site_ref/@ref"/> | ||||
|             <xsl:value-of select="dive_site_ref/@ref|informationbeforedive/dive_site_ref/@ref"/> | ||||
|           </xsl:variable> | ||||
|           <xsl:if test="//dive_site[@id=$ref]/geography/gps/longitude != ''"> | ||||
|             <xsl:attribute name="gps"> | ||||
|               <xsl:value-of select="concat(//dive_site[@id=$ref]/geography/gps/latitude, ' ', //dive_site[@id=$ref]/geography/gps/longitude)"/> | ||||
|             </xsl:attribute> | ||||
|           <xsl:for-each select="//dive_site[@id=$ref]/geography/location|//dive_site[@id=$ref]/name"> | ||||
|             <xsl:value-of select="."/> | ||||
|             <xsl:if test=". != '' and following-sibling::*[1]/* != ''"> / </xsl:if> | ||||
|           </xsl:for-each> | ||||
|           </xsl:if> | ||||
|         </location> | ||||
|       </xsl:if> | ||||
| 
 | ||||
|       <xsl:if test="buddy_ref/@ref != ''"> | ||||
|       <xsl:if test="buddy_ref/@ref|informationbeforedive/buddy_ref/@ref != ''"> | ||||
|         <buddy> | ||||
|           <xsl:variable name="ref"> | ||||
|             <xsl:value-of select="buddy_ref/@ref"/> | ||||
|             <xsl:value-of select="buddy_ref/@ref|informationbeforedive/buddy_ref/@ref"/> | ||||
|           </xsl:variable> | ||||
|           <xsl:for-each select="//diver[@id=$ref]/personal/first_name|//diver[@id=$ref]/personal/nick_name|//diver[@id=$ref]/personal/family_name"> | ||||
|           <xsl:for-each select="//diver[@id=$ref]/personal/first_name|//diver[@id=$ref]/personal/nick_name|//diver[@id=$ref]/personal/family_name|//diver/buddy[@id=$ref]/personal/first_name|//diver/buddy[@id=$ref]/personal/nick_name|//diver/buddy[@id=$ref]/personal/family_name"> | ||||
|             <xsl:value-of select="."/> | ||||
|             <xsl:if test=". != '' and (following-sibling::*[1] != '' or following-sibling::*[2] != '')"> / </xsl:if> | ||||
|           </xsl:for-each> | ||||
|         </buddy> | ||||
|       </xsl:if> | ||||
| 
 | ||||
|       <xsl:if test="note/text != ''"> | ||||
|       <xsl:if test="note/text|informationafterdive/notes/para != ''"> | ||||
|         <notes> | ||||
|           <xsl:value-of select="note/text"/> | ||||
|           <xsl:value-of select="note/text|informationafterdive/notes/para"/> | ||||
|         </notes> | ||||
|       </xsl:if> | ||||
| 
 | ||||
|  | @ -216,12 +246,21 @@ | |||
|             <xsl:variable name="idx"> | ||||
|               <xsl:value-of select="./tank_ref/@ref"/> | ||||
|             </xsl:variable> | ||||
|             <xsl:variable name="gas"> | ||||
|               <xsl:value-of select="./gas_ref/@ref"/> | ||||
|             </xsl:variable> | ||||
|             <xsl:attribute name="size"> | ||||
|               <xsl:value-of select="//equipment[@id=$idx]/tank/volume"/> | ||||
|             </xsl:attribute> | ||||
|             <xsl:attribute name="description"> | ||||
|               <xsl:value-of select="//equipment[@id=$idx]/general/name"/> | ||||
|             </xsl:attribute> | ||||
|             <xsl:attribute name="o2"> | ||||
|               <xsl:value-of select="//gas_mix[@id=$gas]/o2"/> | ||||
|             </xsl:attribute> | ||||
|             <xsl:attribute name="he"> | ||||
|               <xsl:value-of select="//gas_mix[@id=$gas]/he"/> | ||||
|             </xsl:attribute> | ||||
|             <xsl:attribute name="start"> | ||||
|               <xsl:value-of select="concat(substring-before(./pressure_start, '.') div 100000, ' bar')"/> | ||||
|             </xsl:attribute> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue