本文整理汇总了C++中Track::GetBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::GetBounds方法的具体用法?C++ Track::GetBounds怎么用?C++ Track::GetBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::GetBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestTrack
void TestTrack(ufLogger *pLog)
{
*pLog << "Testing track." << std::endl;
Track track;
track.SetName("Test Track");
TrackSegment seg;
Waypoint pt;
Waypoint se, nw;
std::istringstream is("-33.405437 150.783916 209.70 2009-04-18T06:29:16Z");
is >> pt;
seg.GetSegment()->push_back(pt);
is.str("-33.405609 150.784008 208.74 2009-04-18T06:29:17Z");
is >> pt;
seg.GetSegment()->push_back(pt);
is.str("-33.405785 150.784078 206.34 2009-04-18T06:29:18Z");
is >> pt;
seg.GetSegment()->push_back(pt);
is.str("-33.405964 150.784127 205.86 2009-04-18T06:29:19Z");
is >> pt;
seg.GetSegment()->push_back(pt);
seg.GetBounds(se,nw);
*pLog << "South east bound: \n" << se.ToXML() << std::endl;
*pLog << "North west bound: \n" << nw.ToXML() << std::endl;
track.GetTrack()->push_back(seg);
seg.GetSegment()->clear();
is.str("");
is.str("-33.711351 150.570990 341.41 2009-04-18T07:27:35Z");
is >> pt;
seg.GetSegment()->push_back(pt);
is.str("-33.711348 150.570990 342.85 2009-04-18T07:28:58Z");
is >> pt;
seg.GetSegment()->push_back(pt);
is.str("-33.711348 150.570990 341.41 2009-04-18T07:29:00Z");
is >> pt;
seg.GetSegment()->push_back(pt);
is.str("-33.711347 150.570992 340.44 2009-04-18T07:29:21Z");
is >> pt;
seg.GetSegment()->push_back(pt);
is.str("-33.711344 150.570983 339.96 2009-04-18T07:29:22Z");
is >> pt;
seg.GetSegment()->push_back(pt);
seg.GetBounds(se,nw);
*pLog << "South east bound: \n" << se.ToXML() << std::endl;
*pLog << "North west bound: \n" << nw.ToXML() << std::endl;
track.GetTrack()->push_back(seg);
*pLog << track.ToXML(2) << std::endl;
track.GetBounds(se,nw);
*pLog << "South east bound: \n" << se.ToXML() << std::endl;
*pLog << "North west bound: \n" << nw.ToXML() << std::endl;
GreatCircle *gc = GreatCircle::Instance();
Track::TTrack *tracks = track.GetTrack();
int trk_num = 0;
for ( Track::TTrackIt p = tracks->begin(); p != tracks->end(); ++p)
{
Waypoint pt1;
Waypoint pt2;
double totalDistance = 0;
double totalSeconds = 0;
trk_num++;
*pLog << "Track: " << trk_num << std::endl;
*pLog << "Index\tTime\tElevation\tLeg Length(m)\tLeg Time(s)\tLeg Speed(km/h)\tLeg Course\tLatitude\tLongitude" << std::endl;
int idx = 0;
for ( TrackSegment::TTrackSegmentCIt q = p->GetSegment()->begin(); q != p->GetSegment()->end(); ++q)
{
if ( q == p->GetSegment()->begin() )
{
pt1 = *q;
continue;
}
pt2 = *q;
double course = gc->Course(pt1.GetLatitude(),pt1.GetLongitude(),pt2.GetLatitude(),pt2.GetLongitude());
double distance = gc->Distance(pt1.GetLatitude(),pt1.GetLongitude(),pt2.GetLatitude(),pt2.GetLongitude());
//double distanceH = gc->DistanceH(pt1.GetLat(),pt1.GetLongitude(),pt2.GetLat(),pt2.GetLongitude());
//double delta = (distance - distanceH);
//std::cout << distance * 1852 << " haversine: " << distanceH * 1852 << " delta: " << delta << std::endl;
totalDistance += distance;
UF::Time::ISODateTime dt1(pt1.GetTime());
UF::Time::ISODateTime dt2(pt2.GetTime());
double deltaSecs = 0;
if ( dt1.IsValidDateTime() && dt2.IsValidDateTime() )
{
deltaSecs = (dt2.GetJDN() - dt1.GetJDN())*dt2.GetSecondsInDay() +
(dt2.GetFoD() - dt1.GetFoD())*dt2.GetSecondsInDay();
totalSeconds += deltaSecs;
}
idx++;
*pLog << idx << "\t"
<< pt1.GetTime() << "\t"
<< std::fixed << std::setprecision(1) << pt1.GetElevation() << "\t"
<< std::fixed << std::setprecision(3) << distance*1852.0 << "\t"
<< std::fixed << std::setprecision(0) << deltaSecs << "\t"
<< std::fixed << std::setprecision(1) << ((deltaSecs > 0)?distance*1.8520 * 3600 / deltaSecs:'-') << "\t"
//.........这里部分代码省略.........