Skip to content

Commit

Permalink
eliminate errors caused by extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasbats committed May 16, 2020
1 parent 536f67e commit 65fb581
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/RTZassistPanelMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ int RTZassistPanelMain::ExportGPX() {
vector<waypoint> myVectorWaypoints;
// end of placeholders

wxString isRefpoint;
wxString isExtension = "";

string readFile = "dom_out.txt"; // intermediate file - make temporary?
vector<string> myVector;
Expand All @@ -486,6 +486,10 @@ int RTZassistPanelMain::ExportGPX() {
int c = myVector.size();

for (int z = 0; z < c; z++) {

if (myVector[z] == "tag:extensions") {
break;
}

wxStringTokenizer tokenizer(myVector[z], ":");
while (tokenizer.HasMoreTokens())
Expand All @@ -497,12 +501,10 @@ int RTZassistPanelMain::ExportGPX() {
myRoute.routeName = tokenizer.GetNextToken();
}

myWaypoint.b_isRefpoint = false;

if (token == "tag") {
isRefpoint = tokenizer.GetNextToken();
if (isRefpoint == "refpoint") {
myWaypoint.b_isRefpoint = true;
isExtension = tokenizer.GetNextToken();
if (isExtension == "extension") {
break; // this eliminates RTZ refpoints, which have lat/lon and could be misinterpreted as waypoints.
}
}

Expand All @@ -516,13 +518,13 @@ int RTZassistPanelMain::ExportGPX() {

if (token == "lat") {
myWaypoint.lat = tokenizer.GetNextToken();
}
}

if (token == "lon") {

myWaypoint.lon = tokenizer.GetNextToken();
//
if(!myWaypoint.b_isRefpoint) myRoute.waypoints.push_back(myWaypoint); // this eliminates RTZ refpoints, which have lat/lon and could be misinterpreted as waypoints.
myRoute.waypoints.push_back(myWaypoint);
//
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/RTZassistPanelMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class waypoint
wxString id;
wxString name;
wxString lat, lon;
bool b_isRefpoint;

};

class route
Expand Down

0 comments on commit 65fb581

Please sign in to comment.