本文整理汇总了C++中GeoPoint::normalize方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoPoint::normalize方法的具体用法?C++ GeoPoint::normalize怎么用?C++ GeoPoint::normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoPoint
的用法示例。
在下文中一共展示了GeoPoint::normalize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new_waypoint
bool
WaypointReaderZander::ParseLine(const TCHAR* line, const unsigned linenum,
Waypoints &way_points)
{
// If (end-of-file or comment)
if (line[0] == '\0' || line[0] == 0x1a ||
_tcsstr(line, _T("**")) == line ||
_tcsstr(line, _T("*")) == line)
// -> return without error condition
return true;
// Determine the length of the line
size_t len = _tcslen(line);
// If less then 34 characters -> something is wrong -> cancel
if (len < 34)
return false;
GeoPoint location;
// Latitude (Characters 13-20 // DDMMSS(N/S))
if (!parseAngle(line + 13, location.Latitude, true))
return false;
// Longitude (Characters 21-29 // DDDMMSS(E/W))
if (!parseAngle(line + 21, location.Longitude, false))
return false;
location.normalize(); // ensure longitude is within -180:180
Waypoint new_waypoint(location);
new_waypoint.file_num = file_num;
new_waypoint.original_id = 0;
// Name (Characters 0-12)
if (!parseString(line, new_waypoint.name, 12))
return false;
// Altitude (Characters 30-34 // e.g. 1561 (in meters))
/// @todo configurable behaviour
if (!parseAltitude(line + 30, new_waypoint.altitude))
CheckAltitude(new_waypoint);
// Description (Characters 35-44)
if (len > 35)
parseString(line + 35, new_waypoint.comment, 9);
// Flags (Characters 45-49)
if (len < 46 || !parseFlags(line + 45, new_waypoint))
if (len < 36 || !parseFlagsFromDescription(line + 35, new_waypoint))
new_waypoint.flags.turn_point = true;
way_points.append(new_waypoint);
return true;
}
示例2: labs
static bool
ParseCoordsTNP(const TCHAR *Text, GeoPoint &point)
{
// Format: N542500 E0105000
bool negative = false;
long deg = 0, min = 0, sec = 0;
TCHAR *ptr;
if (Text[0] == _T('S') || Text[0] == _T('s'))
negative = true;
sec = _tcstol(&Text[1], &ptr, 10);
deg = labs(sec / 10000);
min = labs((sec - deg * 10000) / 100);
sec = sec - min * 100 - deg * 10000;
point.Latitude = Angle::dms(fixed(deg), fixed(min), fixed(sec));
if (negative)
point.Latitude.flip();
negative = false;
if (ptr[0] == _T(' '))
ptr++;
if (ptr[0] == _T('W') || ptr[0] == _T('w'))
negative = true;
sec = _tcstol(&ptr[1], &ptr, 10);
deg = labs(sec / 10000);
min = labs((sec - deg * 10000) / 100);
sec = sec - min * 100 - deg * 10000;
point.Longitude = Angle::dms(fixed(deg), fixed(min), fixed(sec));
if (negative)
point.Longitude.flip();
point.normalize(); // ensure longitude is within -180:180
return true;
}
示例3: if
static bool
ReadCoords(const TCHAR *Text, GeoPoint &point)
{
// Format: 53:20:41 N 010:24:41 E
// Alternative Format: 53:20.68 N 010:24.68 E
TCHAR *Stop;
// ToDo, add more error checking and making it more tolerant/robust
long deg = _tcstol(Text, &Stop, 10);
if ((Text == Stop) || (*Stop == '\0'))
return false;
Stop++;
long min = _tcstol(Stop, &Stop, 10);
if (*Stop == '\0')
return false;
long sec = 0;
if (*Stop == ':') {
Stop++;
if (*Stop == '\0')
return false;
sec = _tcstol(Stop, &Stop, 10);
} else if (*Stop == '.') {
Stop++;
if (*Stop == '\0')
return false;
sec = (_tcstol(Stop, &Stop, 10) * 60) / 100;
}
point.Latitude = Angle::dms(fixed(deg), fixed(min), fixed(sec));
if (*Stop == ' ')
Stop++;
if (*Stop == '\0')
return false;
if ((*Stop == 'S') || (*Stop == 's'))
point.Latitude.flip();
Stop++;
if (*Stop == '\0')
return false;
deg = _tcstol(Stop, &Stop, 10);
Stop++;
min = _tcstol(Stop, &Stop, 10);
if (*Stop == ':') {
Stop++;
if (*Stop == '\0')
return false;
sec = _tcstol(Stop, &Stop, 10);
} else if (*Stop == '.') {
Stop++;
if (*Stop == '\0')
return false;
sec = (_tcstol(Stop, &Stop, 10) * 60) / 100;
}
point.Longitude = Angle::dms(fixed(deg), fixed(min), fixed(sec));
if (*Stop == ' ')
Stop++;
if (*Stop == '\0')
return false;
if ((*Stop == 'W') || (*Stop == 'w'))
point.Longitude.flip();
point.normalize(); // ensure longitude is within -180:180
return true;
}