std::string GeoCoord::GetDisplayText() const { std::ostringstream stream; std::streamsize oldPrecision=stream.precision(5); std::ios_base::fmtflags oldFlags=stream.setf(std::ios::fixed,std::ios::floatfield); stream.imbue(std::locale()); stream << std::abs(GetLat()); if (GetLat()>=0) { stream << " N "; } else { stream << " S "; } stream << std::abs(GetLon()); if (GetLon()>=0) { stream << " E"; } else { stream << " W"; } stream.precision(oldPrecision); stream.setf(oldFlags,std::ios::floatfield); return stream.str(); }
GeoCoord GeoCoord::Add(double bearing, double distance) { if (distance == 0.0) return GeoCoord(GetLat(), GetLon()); double lat = GetLat(); double lon = GetLon(); GetEllipsoidalDistance(GetLat(), GetLon(), bearing, distance, lat, lon); return GeoCoord(lat, lon); }
bool CKmlDlg::WriteToFile2(U08 type) { static U16 last_hh = 0; static U16 last_mm = 0; static F32 last_ss = -1; if(ut == Unknown) { if(IsFixed(msg_gpgga.GPSQualityIndicator)) ut = UsingGGA; if(IsFixed(msg_gprmc.Status)) ut = UsingRMC; } //if(ut == UsingGGA && last_hh == msg_gpgga.Hour && last_mm == msg_gpgga.Min && last_ss == msg_gpgga.Sec) //{ // return false; //} //if(ut == UsingRMC && last_hh == msg_gprmc.Hour && last_mm == msg_gprmc.Min && last_ss == msg_gprmc.Sec) //{ // return false; //} if((type == MSG_GGA || type == MSG_GNS) && IsFixed(msg_gpgga.GPSQualityIndicator)) { CString timeStr; timeStr.Format("%02d:%02d:%05.2f", msg_gpgga.Hour, msg_gpgga.Min, msg_gpgga.Sec); kml.PushOnePoint2(GetLon(msg_gpgga.Longitude, msg_gpgga.Longitude_E_W), GetLat(msg_gpgga.Latitude, msg_gpgga.Latitude_N_S), msg_gpgga.Altitude, NULL, NULL, timeStr, GetGnssQualityMode(msg_gpgga.GPSQualityIndicator, (U08)msg_gpgsa.Mode, (U08)msg_glgsa.Mode, (U08)msg_gagsa.Mode, (U08)msg_bdgsa.Mode, (U08)msg_gigsa.Mode)); last_hh = msg_gpgga.Hour; last_mm = msg_gpgga.Min; last_ss = msg_gpgga.Sec; return true; } else if (type == MSG_RMC && msg_gprmc.Status == 'A') { CString timeStr; timeStr.Format("%02d:%02d:%05.2f", msg_gprmc.Hour, msg_gprmc.Min, msg_gprmc.Sec); kml.PushOnePoint2(GetLon(msg_gprmc.Longitude, msg_gprmc.Longitude_E_W), GetLat(msg_gprmc.Latitude, msg_gprmc.Latitude_N_S), msg_gpgga.Altitude, &msg_gprmc.SpeedKnots, &msg_gprmc.TrueCourse, timeStr, GetGnssQualityMode(msg_gprmc.ModeIndicator)); last_hh = msg_gprmc.Hour; last_mm = msg_gprmc.Min; last_ss = msg_gprmc.Sec; return true; } return false; }
bool MercatorProjection::Move(double horizPixel, double vertPixel) { double x; double y; if (!GeoToPixel(GetLon(),GetLat(), x,y)) { return false; } double lat; double lon; if (!PixelToGeo(x+horizPixel, y-vertPixel, lon,lat)) { return false; } return Set(lon,lat, angle, magnification, dpi, width, height); }
double GeoCoord::GetDistance(GeoCoord target) { return GetEllipsoidalDistance(GetLon(), GetLat(), target.GetLon(), target.GetLat()); }
void CPositionDisplay::GetPos(TInt& aLat, TInt& aLon) const { aLat = GetLat(); aLon = GetLon(); }
TPoint CPositionDisplay::GetPos() const { return TPoint(GetLat(), GetLon()); }