Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
7a855d8f
Commit
7a855d8f
authored
Apr 09, 2018
by
LEFEBVREJP email
Browse files
Adding toString helper for UTMCoordinate.
parent
de9e42ba
Pipeline
#12911
failed with stages
in 6 minutes and 15 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixgeo/coordinateconversion.cc
View file @
7a855d8f
...
...
@@ -25,9 +25,8 @@ const std::array<char, 11> UTMZones::pos_letters = {
const
std
::
array
<
short
,
11
>
UTMZones
::
pos_degrees
=
{
{
0
,
8
,
16
,
24
,
32
,
40
,
48
,
56
,
64
,
72
,
84
}};
const
std
::
array
<
char
,
11
>
UTM2LatLon
::
southern_hemisphere
=
{
{
'A'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'J'
,
'L'
,
'L'
,
'M'
}};
const
std
::
array
<
char
,
11
>
UTM2LatLon
::
southern_hemisphere
=
{
{
'A'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'J'
,
'L'
,
'L'
,
'M'
}};
short
UTMZones
::
latZoneDegree
(
char
letter
)
{
auto
itr
=
std
::
find
(
letters
.
begin
(),
letters
.
end
(),
letter
);
...
...
@@ -136,8 +135,7 @@ double LatLon2UTM::easting() const
return
500000.
+
(
m_K4
*
m_p
+
m_K5
*
std
::
pow
(
m_p
,
3.
));
}
UTMCoordinate
LatLon2UTM
::
toUTM
(
double
latitude
,
double
longitude
)
UTMCoordinate
LatLon2UTM
::
toUTM
(
double
latitude
,
double
longitude
)
{
CoordinateConversion
::
validate
(
latitude
,
longitude
);
UTMCoordinate
utm
;
...
...
@@ -212,6 +210,14 @@ void CoordinateConversion::validate(const std::pair<double, double>& point)
CoordinateConversion
::
validate
(
point
.
first
,
point
.
second
);
}
std
::
string
CoordinateConversion
::
toString
(
const
UTMCoordinate
&
utm
)
{
char
buff
[
120
];
sprintf
(
buff
,
"%02d %c %f %f"
,
utm
.
longitude_zone
,
utm
.
lattitude_zone
,
utm
.
easting
,
utm
.
northing
);
return
std
::
string
(
buff
);
}
void
CoordinateConversion
::
validate
(
double
latitude
,
double
longitude
)
{
radix_tagged_line
(
"Validating ("
<<
latitude
<<
","
<<
longitude
<<
")"
);
...
...
@@ -226,8 +232,7 @@ void CoordinateConversion::validate(double latitude, double longitude)
}
}
void
UTM2LatLon
::
init
(
const
UTMCoordinate
&
utm
)
void
UTM2LatLon
::
init
(
const
UTMCoordinate
&
utm
)
{
m_arc
=
utm
.
northing
/
m_k0
;
m_mu
=
m_arc
/
...
...
@@ -289,8 +294,7 @@ char UTM2LatLon::hemisphere(char latitude_zone)
}
}
std
::
pair
<
double
,
double
>
UTM2LatLon
::
toLatLon
(
const
UTMCoordinate
&
c
)
std
::
pair
<
double
,
double
>
UTM2LatLon
::
toLatLon
(
const
UTMCoordinate
&
c
)
{
UTMCoordinate
utm
=
c
;
double
latitude
=
0.
;
...
...
radixgeo/coordinateconversion.hh
View file @
7a855d8f
...
...
@@ -12,6 +12,20 @@
namespace
radix
{
struct
RADIX_PUBLIC
UTMCoordinate
{
// earth radius is ~40million meteres
// int will cover this
double
easting
;
double
northing
;
// 00 -> 60 longitude zones
short
longitude_zone
;
// Not officially part of UTM
// but frequently used with UTM
// C - > X, (A,B,Y,Z) are not used as they cover western and eastern sides
// of the Antarctic and Arctic regions
char
lattitude_zone
;
};
class
RADIX_PUBLIC
CoordinateConversion
{
public:
...
...
@@ -32,21 +46,14 @@ class RADIX_PUBLIC CoordinateConversion
static
void
validate
(
const
std
::
pair
<
double
,
double
>&
point
);
/**
* @brief toString Converts UTM coordinate to string representation
* @param utm
* @return std::string "11 S 400000 5500"
*/
static
std
::
string
toString
(
const
UTMCoordinate
&
utm
);
};
// class CoordinateConversion
struct
RADIX_PUBLIC
UTMCoordinate
{
// earth radius is ~40million meteres
// int will cover this
double
easting
;
double
northing
;
// 00 -> 60 longitude zones
short
longitude_zone
;
// Not officially part of UTM
// but frequently used with UTM
// C - > X, (A,B,Y,Z) are not used as they cover western and eastern sides
// of the Antarctic and Arctic regions
char
lattitude_zone
;
};
class
RADIX_PUBLIC
UTMZones
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment