Skip to content

Commit 8f7b912

Browse files
committed
Clean up code
1 parent c7454fa commit 8f7b912

2 files changed

Lines changed: 2 additions & 26 deletions

File tree

src/geotools.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4242
#include "main.h"
4343
#include "geotools.h"
4444

45-
/*
46-
static wxString MyGet(const wxString& url)
47-
{
48-
wxEasyCurl curl;
49-
curl.AddHttpHeader("Content-type: text/plain");
50-
curl.AddHttpHeader("Cache-Control: no-cache");
51-
curl.Get(url);
52-
return curl.GetDataAsString();
53-
}
54-
*/
55-
5645
bool GeoTools::coordinates_to_lat_lon(wxString& coord, wxString& lat, wxString& lon) {
5746

5847
wxString err, str;
5948
int n, i, x;
60-
6149
bool is_numeric = true;
6250
std::locale loc{ "" };
6351
wchar_t decimal_symbol = std::use_facet< std::numpunct<wchar_t> >(loc).decimal_point();
@@ -68,15 +56,7 @@ bool GeoTools::coordinates_to_lat_lon(wxString& coord, wxString& lat, wxString&
6856
str.Replace("east", "e");
6957
str.Replace("west", "w");
7058

71-
/*
72-
for (int i = 0; i < str.Length(); i++) {
73-
if (str[i] == 'n' || str[i] == 's' ) {
74-
x=size_t(i);
75-
n++;
76-
}
77-
}*/
78-
i = 0;
79-
n = 0;
59+
i = n = 0;
8060
x = -1;
8161
for (wxString::const_iterator it = str.begin(); it != str.end(); ++it) {
8262
wxUniChar c = *it;
@@ -91,10 +71,9 @@ bool GeoTools::coordinates_to_lat_lon(wxString& coord, wxString& lat, wxString&
9171
}
9272

9373
err = "";
94-
if (x == -1) { // cpg TO DO how would x ever be -1?
74+
if (x == -1) {
9575
if (is_numeric) {
9676
wxStringTokenizer tk(str, ',');
97-
//wxArrayString arr = wxSplit(str, ',');
9877
if (tk.CountTokens() == 2) {
9978
lat = tk.GetNextToken();
10079
lon = tk.GetNextToken();
@@ -127,7 +106,6 @@ bool GeoTools::coordinates_to_lat_lon(wxString& coord, wxString& lat, wxString&
127106
bool GeoTools::dms_to_dd(double& d, double& m, double& s, double* dd) {
128107

129108
int sign = 1;
130-
131109
wxString err = "";
132110

133111
if (m < 0 || s < 0) {
@@ -163,7 +141,6 @@ bool GeoTools::dms_to_dd(double& d, double& m, double& s, double* dd) {
163141

164142
bool GeoTools::coordinate_to_dms(wxString& coord, double* d, double* m, double* s)
165143
{
166-
167144
std::locale loc{ "" };
168145
wchar_t decimal_symbol = std::use_facet< std::numpunct<wchar_t> >(loc).decimal_point();
169146

src/invoke.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3900,7 +3900,6 @@ void fcall_geocode(lk::invoke_t& cxt)
39003900
wxString lat_str, lon_str;
39013901
ok = GeoTools::coordinates_to_lat_lon(coordinates, lat_str, lon_str);
39023902
if (ok) {
3903-
// cpg TO DO this works, but unneccessarily parses coordinates when they are already in lat/lon DD format like 45.5,-122
39043903
// degree, minute, seconds
39053904
double lat_d, lat_m, lat_s;
39063905
lat_d = lat_m = lat_s = std::numeric_limits<double>::quiet_NaN();

0 commit comments

Comments
 (0)