waypoint alt not saved if not different from default alt

This commit is contained in:
Pascal Brisset
2006-11-08 06:52:23 +00:00
parent 6843872f34
commit b28b05ea8c
+5 -1
View File
@@ -84,13 +84,17 @@ let waypoints_node = fun xml_tree ->
let update_xml = fun xml_tree utm0 wp id ->
let xml_wpts = XmlEdit.children (waypoints_node xml_tree) in
let node = List.find (fun w -> XmlEdit.id w = id) xml_wpts in
let default_alt = float_of_string (XmlEdit.attrib (XmlEdit.root xml_tree) "alt") in
if wp#deleted then begin
XmlEdit.delete node
end else
let utm = utm_of WGS84 wp#pos in
try
let (dx, dy) = utm_sub utm utm0 in
XmlEdit.set_attribs node ["name",wp#name; "x",sof dx; "y",sof dy; "alt", sof wp#alt]
let attribs = ["name",wp#name; "x",sof dx; "y",sof dy] in
let attribs = attribs @
if abs_float (wp#alt -. default_alt) < 1. then [] else ["alt", sof wp#alt] in
XmlEdit.set_attribs node attribs
with
_ ->
prerr_endline "MapFP.update_xml: waypoint too far from ref (FIXME)"