Argumentconvert("convert","c","Converts the given coordinate or location to the specified output form.");
convert.setRequiredValueCount(1);
convert.appendValueName("coordinate/location");
Argumentdistance("distance","d","Computes the approximate distance in meters between two locations.");
distance.setRequiredValueCount(2);
distance.appendValueName("location 1");
distance.appendValueName("location 2");
ArgumenttrackLength("track-length","t","Computes the approximate length in meters of a track given by a file containing trackpoints separated by new lines.");
trackLength.setRequiredValueCount(1);
trackLength.appendValueName("path");
Argumentcircle("circle","","If present the distance between the first and the last trackpoints will be added to the total track length.");
trackLength.setSecondaryArguments({&circle});
Argumentbearing("bearing","b","Computes the approximate initial bearing East of true North when traveling along the shortest path between the given locations.");
bearing.setRequiredValueCount(2);
bearing.appendValueName("location 1");
bearing.appendValueName("location 2");
Argumentfbearing("final-bearing",string(),"Computes the approximate final bearing East of true North when traveling along the shortest path between the given locations.");
fbearing.setRequiredValueCount(2);
fbearing.appendValueName("location 1");
fbearing.appendValueName("location 2");
Argumentmidpoint("midpoint","m","Computes the approximate midpoint between the given locations.");
midpoint.setRequiredValueCount(2);
midpoint.appendValueName("location 1");
midpoint.appendValueName("location 2");
Argumentdestination("destination",string(),"Calculates destination point given distance and bearing from start point.");
destination.setRequiredValueCount(3);
destination.appendValueName("start");
destination.appendValueName("distance");
destination.appendValueName("bearing");
ArgumentgmapsLink("gmaps-link","","Generates a Google Maps link for all locations given by a file containing locations separated by new lines.");
gmapsLink.setRequiredValueCount(1);
gmapsLink.appendValueName("path");
ArgumentinputAngularMeasureArg("input-angular-measure","i","Use this option to specify the angular measure you use to provide angles (degree or radian; default is degree).");
ArgumentoutputFormForAnglesArg("output-angle-form","o","Use this option to specify the output form for angles (degrees, minutes, seconds or radians; default is degrees).");
outputFormForAnglesArg.setRequiredValueCount(1);
outputFormForAnglesArg.appendValueName("form");
outputFormForAnglesArg.setCombinable(true);
ArgumentinputSystemForLocationsArg("input-location-system",string(),"Use this option to specify the geographic system you use to provide locations (latitude&longitue or UTM-WGS84).");
ArgumentoutputSystemForLocationsArg("output-location-system",string(),"Use this option to specify which geographic system is used to display locations (latitude&longitue or UTM-WGS84).");
throwios_base::failure("Unable to open the file \""+path+"\".");
file.exceptions(ios_base::badbit);
stringline;
vector<Location>locations;
while(getline(file,line)){
if(line.empty()||line.at(0)=='#')
continue;// skip empty lines and comments
locations.push_back(locationFromString(line));
}
returnlocations;
}
voidprintAngleFormatInfo(ostream&os)
{
os<<"To provide a location/trackpoint, use the following form:\n";
os<<"latitude,longitude\n";
os<<"\nUse one of the following forms to specify angles, if you use --input-angle-measure degree:\n";
os<<"[+-]DDD.DDDDD\n";
os<<"[+-]DDD:MM.MMMMM\n";
os<<"[+-]DDD:MM:SS.SSSSS\n";
os<<"D indicates degrees, M indicates minutes of arc, and S indicates seconds of arc (1 minute = 1/60th of a degree, 1 second = 1/3600th of a degree).\n";
os<<"You can use the following form where R indicates radians, if you use --input-angle-measure radian:\n";