Browse Source

Fix bug with kml geometryElements pointed out by Valerio Messina. Don't repeat extrude element, and respect the required sequence for geometryElements.

tags/gpsbabel_1_5_4
tsteven4 3 years ago
parent
commit
110adaff70
1 changed files with 14 additions and 13 deletions
  1. 14
    13
      kml.cc

+ 14
- 13
kml.cc View File

@@ -868,15 +868,21 @@ static void kml_output_lookat(const Waypoint* waypointp)
writer->writeEndElement(); // Close LookAt tag
}

static void kml_output_positioning(void)
static void kml_output_positioning(bool tessellate)
{
// These elements must be output as a sequence, i.e. in order.
if (extrude) {
writer->writeTextElement("extrude", "1");
}

if (tessellate) {
writer->writeTextElement("tessellate", "1");
}

if (floating) {
writer->writeTextElement("altitudeMode", "absolute");
}

if (extrude) {
writer->writeTextElement("extrude", "1");
}
}

/* Output something interesing when we can for route and trackpoints */
@@ -1022,11 +1028,7 @@ static void kml_output_point(const Waypoint* waypointp, kml_point_type pt_type)
}

writer->writeStartElement("Point");
kml_output_positioning();

if (extrude) {
writer->writeTextElement("extrude", "1");
}
kml_output_positioning(false);
kml_write_coordinates(waypointp);
writer->writeEndElement(); // Close Point tag

@@ -1092,8 +1094,7 @@ static void kml_output_tailer(const route_head* header)
writer->writeEndElement(); // Close LineString tag
}
writer->writeStartElement("LineString");
kml_output_positioning();
writer->writeTextElement("tessellate","1");
kml_output_positioning(true);
writer->writeStartElement("coordinates");
writer->writeCharacters("\n");
}
@@ -1625,7 +1626,7 @@ static void kml_waypt_pr(const Waypoint* waypointp)

// Location
writer->writeStartElement("Point");
kml_output_positioning();
kml_output_positioning(false);
kml_write_coordinates(waypointp);
writer->writeEndElement(); // Close Point tag

@@ -1760,7 +1761,7 @@ static void kml_mt_hdr(const route_head* header)
writer->writeOptionalTextElement("name", header->rte_name);
writer->writeTextElement("styleUrl", "#multiTrack");
writer->writeStartElement("gx:Track");
kml_output_positioning();
kml_output_positioning(false);

QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) {
Waypoint* tpt = (Waypoint*)elem;

Loading…
Cancel
Save