本文整理汇总了C++中RoutePoint类的典型用法代码示例。如果您正苦于以下问题:C++ RoutePoint类的具体用法?C++ RoutePoint怎么用?C++ RoutePoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RoutePoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RootElement
bool NavObjectCollection::LoadAllGPXObjects()
{
//FIXME: unite with MyConfig::ImportGPX
TiXmlNode *root = RootElement();
wxString RootName = wxString::FromUTF8( root->Value() );
if( RootName == _T ( "gpx" ) ) {
TiXmlNode *child;
for( child = root->FirstChild(); child != 0; child = child->NextSibling() ) {
wxString ChildName = wxString::FromUTF8( child->Value() );
if( ChildName == _T ( "trk" ) ) ::GPXLoadTrack( (GpxTrkElement *) child );
else
if( ChildName == _T ( "rte" ) ) {
int m_NextRouteNum = 0; //FIXME: we do not need it for GPX
::GPXLoadRoute( (GpxRteElement *) child, m_NextRouteNum );
} else
if( ChildName == _T ( "wpt" ) ) {
int m_NextWPNum = 0; //FIXME: we do not need it for GPX
RoutePoint *pWp = ::LoadGPXWaypoint( (GpxWptElement *) child,
_T("circle") );
RoutePoint *pExisting = WaypointExists( pWp->GetName(), pWp->m_lat,
pWp->m_lon );
if( !pExisting ) {
if( NULL != pWayPointMan ) pWayPointMan->m_pWayPointList->Append( pWp );
pWp->m_bIsolatedMark = true; // This is an isolated mark
pSelect->AddSelectableRoutePoint( pWp->m_lat, pWp->m_lon, pWp );
pWp->m_ConfigWPNum = m_NextWPNum;
m_NextWPNum++;
}
}
}
}
return true;
}
示例2: RoutePoint
RoutePoint *Route::InsertPointAfter( RoutePoint *pRP, double rlat, double rlon,
bool bRenamePoints )
{
int nRP = pRoutePointList->IndexOf( pRP );
if( nRP >= GetnPoints() - 1 )
return NULL;
nRP++;
RoutePoint *newpoint = new RoutePoint( rlat, rlon, wxString( _T ( "diamond" ) ),
GetNewMarkSequenced(), GPX_EMPTY_STRING );
newpoint->m_bIsInRoute = true;
newpoint->m_bDynamicName = true;
newpoint->SetNameShown( false );
pRoutePointList->Insert( nRP, newpoint );
RoutePointGUIDList.Insert( pRP->m_GUID, nRP );
if( bRenamePoints ) RenameRoutePoints();
FinalizeForRendering();
UpdateSegmentDistances();
return ( newpoint );
}
示例3: while
bool TrackPropDlg::IsThisTrackExtendable()
{
m_pExtendRoute = NULL;
m_pExtendPoint = NULL;
if( m_pRoute == g_pActiveTrack || m_pRoute->m_bIsInLayer ) return false;
RoutePoint *pLastPoint = m_pRoute->GetPoint( 1 );
if( !pLastPoint->GetCreateTime().IsValid() ) return false;
wxRouteListNode *route_node = pRouteList->GetFirst();
while( route_node ) {
Route *proute = route_node->GetData();
if( proute->m_bIsTrack && proute->IsVisible() && ( proute->m_GUID != m_pRoute->m_GUID ) ) {
RoutePoint *track_node = proute->GetLastPoint();
if( track_node->GetCreateTime().IsValid() ) {
if( track_node->GetCreateTime() <= pLastPoint->GetCreateTime() )
if( !m_pExtendPoint || track_node->GetCreateTime() > m_pExtendPoint->GetCreateTime() ) {
m_pExtendPoint = track_node;
m_pExtendRoute = proute;
}
}
}
route_node = route_node->GetNext(); // next route
}
if( m_pExtendRoute ) return ( !m_pExtendRoute->m_bIsInLayer );
else
return false;
}
示例4: while
// Is this route equal to another, meaning,
// Do all routepoint positions and names match?
bool Route::IsEqualTo( Route *ptargetroute )
{
wxRoutePointListNode *pthisnode = ( this->pRoutePointList )->GetFirst();
wxRoutePointListNode *pthatnode = ( ptargetroute->pRoutePointList )->GetFirst();
if( NULL == pthisnode ) return false;
if( this->m_bIsInLayer || ptargetroute->m_bIsInLayer ) return false;
if( this->GetnPoints() != ptargetroute->GetnPoints() ) return false;
while( pthisnode ) {
if( NULL == pthatnode ) return false;
RoutePoint *pthisrp = pthisnode->GetData();
RoutePoint *pthatrp = pthatnode->GetData();
if( ( fabs( pthisrp->m_lat - pthatrp->m_lat ) > 1.0e-6 )
|| ( fabs( pthisrp->m_lon - pthatrp->m_lon ) > 1.0e-6 ) ) return false;
if( !pthisrp->GetName().IsSameAs( pthatrp->GetName() ) ) return false;
pthisnode = pthisnode->GetNext();
pthatnode = pthatnode->GetNext();
}
return true; // success, they are the same
}
示例5: RoutePoint
// The following is used only for route splitting, assumes just created, empty route
//
void Route::CloneRoute( Route *psourceroute, int start_nPoint, int end_nPoint, const wxString & suffix)
{
m_bIsTrack = psourceroute->m_bIsTrack;
m_RouteNameString = psourceroute->m_RouteNameString + suffix;
m_RouteStartString = psourceroute->m_RouteStartString;
m_RouteEndString = psourceroute->m_RouteEndString;
int i;
for( i = start_nPoint; i <= end_nPoint; i++ ) {
if( !psourceroute->m_bIsInLayer ) AddPoint( psourceroute->GetPoint( i ), false );
else {
RoutePoint *psourcepoint = psourceroute->GetPoint( i );
RoutePoint *ptargetpoint = new RoutePoint( psourcepoint->m_lat, psourcepoint->m_lon,
psourcepoint->m_IconName, psourcepoint->GetName(), GPX_EMPTY_STRING, false );
AddPoint( ptargetpoint, false );
CloneAddedRoutePoint( m_pLastAddedPoint, psourcepoint );
}
}
CalculateBBox();
}
示例6: ReloadRoutePointIcons
void Route::ReloadRoutePointIcons()
{
wxRoutePointListNode *node = pRoutePointList->GetFirst();
RoutePoint *rp;
while( node ) {
rp = node->GetData();
rp->ReLoadIcon();
node = node->GetNext();
}
}
示例7: ProcessIcons
void WayPointman::SetColorScheme( ColorScheme cs )
{
ProcessIcons( g_StyleManager->GetCurrentStyle() );
// Iterate on the RoutePoint list, requiring each to reload icon
wxRoutePointListNode *node = m_pWayPointList->GetFirst();
while( node ) {
RoutePoint *pr = node->GetData();
pr->ReLoadIcon();
node = node->GetNext();
}
}
示例8: GetnPoints
void Route::CloneTrack( Route *psourceroute, int start_nPoint, int end_nPoint, const wxString & suffix)
{
if( psourceroute->m_bIsInLayer ) return;
m_bIsTrack = psourceroute->m_bIsTrack;
m_RouteNameString = psourceroute->m_RouteNameString + suffix;
m_RouteStartString = psourceroute->m_RouteStartString;
m_RouteEndString = psourceroute->m_RouteEndString;
bool b_splitting = GetnPoints() == 0;
int startTrkSegNo;
if( b_splitting ) startTrkSegNo = psourceroute->GetPoint( start_nPoint )->m_GPXTrkSegNo;
else
startTrkSegNo = this->GetLastPoint()->m_GPXTrkSegNo;
int i;
for( i = start_nPoint; i <= end_nPoint; i++ ) {
RoutePoint *psourcepoint = psourceroute->GetPoint( i );
RoutePoint *ptargetpoint = new RoutePoint( psourcepoint->m_lat, psourcepoint->m_lon,
psourcepoint->GetIconName(), psourcepoint->GetName(), GPX_EMPTY_STRING, false );
AddPoint( ptargetpoint, false );
// This is a hack, need to undo the action of Route::AddPoint
ptargetpoint->m_bIsInRoute = false;
ptargetpoint->m_bIsInTrack = true;
CloneAddedTrackPoint( m_pLastAddedPoint, psourcepoint );
int segment_shift = psourcepoint->m_GPXTrkSegNo;
if( start_nPoint == 2 )
segment_shift = psourcepoint->m_GPXTrkSegNo - 1; // continue first segment if tracks share the first point
if( b_splitting )
m_pLastAddedPoint->m_GPXTrkSegNo = ( psourcepoint->m_GPXTrkSegNo - startTrkSegNo ) + 1;
else
m_pLastAddedPoint->m_GPXTrkSegNo = startTrkSegNo + segment_shift;
}
FinalizeForRendering();
}
示例9: DrawGLRouteLines
void Route::DrawGL( ViewPort &vp )
{
#ifdef ocpnUSE_GL
if( pRoutePointList->empty() || !m_bVisible ) return;
if(!vp.GetBBox().IntersectOut(GetBBox()))
DrawGLRouteLines(vp);
/* Route points */
for(wxRoutePointListNode *node = pRoutePointList->GetFirst(); node; node = node->GetNext()) {
RoutePoint *prp = node->GetData();
if ( !m_bVisible && prp->m_bKeepXRoute )
prp->DrawGL( vp );
else if (m_bVisible)
prp->DrawGL( vp );
}
#endif
}
示例10: SetVisible
void Route::SetVisible( bool visible, bool includeWpts )
{
m_bVisible = visible;
if ( !includeWpts )
return;
wxRoutePointListNode *node = pRoutePointList->GetFirst();
RoutePoint *rp;
while( node ) {
rp = node->GetData();
if ( rp->m_bKeepXRoute )
{
rp->SetVisible( visible );
//pConfig->UpdateWayPoint( rp );
}
node = node->GetNext();
}
}
示例11: OnExtendBtnClick
void TrackPropDlg::OnExtendBtnClick( wxCommandEvent& event )
{
RoutePoint *pLastPoint = m_pRoute->GetPoint( 1 );
if( IsThisTrackExtendable() ) {
int begin = 1;
if( pLastPoint->GetCreateTime() == m_pExtendPoint->GetCreateTime() ) begin = 2;
pSelect->DeleteAllSelectableTrackSegments( m_pExtendRoute );
m_pExtendRoute->CloneTrack( m_pRoute, begin, m_pRoute->GetnPoints(), _("_plus") );
pSelect->AddAllSelectableTrackSegments( m_pExtendRoute );
pSelect->DeleteAllSelectableTrackSegments( m_pRoute );
m_pRoute->ClearHighlights();
g_pRouteMan->DeleteTrack( m_pRoute );
SetTrackAndUpdate( m_pExtendRoute );
UpdateProperties();
if( pRouteManagerDialog && pRouteManagerDialog->IsShown() )
pRouteManagerDialog->UpdateTrkListCtrl();
}
}
示例12: setRoutePointSpeed
void Traffic::setRoutePointSpeed(const int index, UnitVelocity speed) {
RoutePoint point = routePoints[index];
point.setSpeed(speed);
routePoints[index] = point;
}
示例13: Garmin_GPS_Init
//.........这里部分代码省略.........
wxLogMessage(msg);
ret_bool = false;
goto ret_point;
}
else
ret_bool = true;
ret_point:
// Release the Mutex
m_brequest_thread_pause = false;
m_pPortMutex->Unlock();
if ( pProgress )
{
pProgress->SetValue ( 100 );
pProgress->Refresh();
pProgress->Update();
}
wxMilliSleep ( 500 );
return ret_bool;
}
else
#endif //USE_GARMINHOST
*/
{
{ // Standard NMEA mode
SENTENCE snt;
NMEA0183 oNMEA0183;
oNMEA0183.TalkerID = _T ( "EC" );
int nProg = pr->pRoutePointList->GetCount() + 1;
if ( pProgress )
pProgress->SetRange ( 100 );
int progress_stall = 500;
if(pr->pRoutePointList->GetCount() > 10)
progress_stall = 500;
// Send out the waypoints, in order
if ( bsend_waypoints )
{
wxRoutePointListNode *node = pr->pRoutePointList->GetFirst();
int ip = 1;
while ( node )
{
RoutePoint *prp = node->GetData();
if(g_GPS_Ident == _T("Generic"))
{
if ( prp->m_lat < 0. )
oNMEA0183.Wpl.Position.Latitude.Set ( -prp->m_lat, _T ( "S" ) );
else
oNMEA0183.Wpl.Position.Latitude.Set ( prp->m_lat, _T ( "N" ) );
if ( prp->m_lon < 0. )
oNMEA0183.Wpl.Position.Longitude.Set ( -prp->m_lon, _T ( "W" ) );
else
oNMEA0183.Wpl.Position.Longitude.Set ( prp->m_lon, _T ( "E" ) );
oNMEA0183.Wpl.To = prp->GetName().Truncate ( 6 );
oNMEA0183.Wpl.Write ( snt );
示例14: GetGlobalColor
void Route::DrawGL( ViewPort &VP, OCPNRegion ®ion )
{
#ifdef ocpnUSE_GL
if( m_nPoints < 1 || !m_bVisible ) return;
if(m_hiliteWidth) {
wxColour y = GetGlobalColor( _T ( "YELO1" ) );
wxColour hilt( y.Red(), y.Green(), y.Blue(), 128 );
wxPen HiPen( hilt, m_hiliteWidth, wxPENSTYLE_SOLID );
ocpnDC dc;
dc.SetPen( HiPen );
DrawGLLines(VP, &dc);
}
/* determine color and width */
wxColour col;
int width = g_pRouteMan->GetRoutePen()->GetWidth(); //g_route_line_width;
if( m_width != wxPENSTYLE_INVALID )
width = m_width;
if(m_bIsTrack)
width = g_pRouteMan->GetTrackPen()->GetWidth();
if( m_bRtIsActive )
{
col = g_pRouteMan->GetActiveRoutePen()->GetColour();
} else if( m_bRtIsSelected ) {
col = g_pRouteMan->GetSelectedRoutePen()->GetColour();
} else {
if( m_Colour == wxEmptyString ) {
col = g_pRouteMan->GetRoutePen()->GetColour();
// For tracks, establish colour based on first icon name
if(m_bIsTrack){
wxRoutePointListNode *node = pRoutePointList->GetFirst();
RoutePoint *prp = node->GetData();
if( prp->GetIconName().StartsWith( _T("xmred") ) )
col = GetGlobalColor( _T ( "URED" ) );
else if( prp->GetIconName().StartsWith( _T("xmblue") ) )
col = GetGlobalColor( _T ( "BLUE3" ) );
else if( prp->GetIconName().StartsWith( _T("xmgreen") ) )
col = GetGlobalColor( _T ( "UGREN" ) );
else
col = GetGlobalColor( _T ( "CHMGD" ) );
}
} else {
for( unsigned int i = 0; i < sizeof( ::GpxxColorNames ) / sizeof(wxString); i++ ) {
if( m_Colour == ::GpxxColorNames[i] ) {
col = ::GpxxColors[i];
break;
}
}
}
}
glColor3ub(col.Red(), col.Green(), col.Blue());
glLineWidth(wxMax( g_GLMinSymbolLineWidth, width ));
#ifndef ocpnUSE_GLES // linestipple is emulated poorly
if( m_style != wxPENSTYLE_INVALID )
glEnable( GL_LINE_STIPPLE );
switch( m_style ) {
case wxDOT: glLineStipple( 1, 0x3333 ); break;
case wxLONG_DASH: glLineStipple( 1, 0xFFF8 ); break;
case wxSHORT_DASH: glLineStipple( 1, 0x3F3F ); break;
case wxDOT_DASH: glLineStipple( 1, 0x8FF1 ); break;
default: break;
}
#endif
DrawGLLines(VP, NULL);
glDisable (GL_LINE_STIPPLE);
/* direction arrows.. could probably be further optimized for opengl */
if( !m_bIsTrack ) {
wxRoutePointListNode *node = pRoutePointList->GetFirst();
wxPoint2DDouble rpt1, rpt2;
while(node) {
RoutePoint *prp = node->GetData();
// cc1->GetDoubleCanvasPointPix( prp->m_lat, prp->m_lon, &rpt2 );
rpt2 = prp->m_screen_pos;
if(node != pRoutePointList->GetFirst() && prp->m_pos_on_screen)
RenderSegmentArrowsGL( rpt1.m_x, rpt1.m_y, rpt2.m_x, rpt2.m_y, cc1->GetVP() );
rpt1 = rpt2;
node = node->GetNext();
}
}
/* Route points */
for(wxRoutePointListNode *node = pRoutePointList->GetFirst(); node; node = node->GetNext()) {
RoutePoint *prp = node->GetData();
if ( m_bVisible || prp->m_bKeepXRoute )
prp->DrawGL( VP, region, true );
}
#endif
//.........这里部分代码省略.........
示例15: MyPrintout
MyRoutePrintout::MyRoutePrintout( std::vector<bool> _toPrintOut,
Route* route,
const wxChar* title
) : MyPrintout( title ),
myRoute( route ),
toPrintOut( _toPrintOut )
{
// Let's have at least some device units margin
marginX = 5;
marginY = 5;
// Offset text from the edge of the cell (Needed on Linux)
textOffsetX = 5;
textOffsetY = 8;
table.StartFillHeader();
// setup widths for columns
if ( toPrintOut[ PRINT_WP_NAME ] ) {
table << (const char *)wxString(_("Name")).mb_str();
}
if ( toPrintOut[ PRINT_WP_POSITION ] ) {
table << (const char *)wxString(_("Position")).mb_str();
}
if ( toPrintOut[ PRINT_WP_COURSE ] ) {
table << (const char *)wxString(_("Course")).mb_str();
}
if ( toPrintOut[ PRINT_WP_DISTANCE ] ) {
table << (const char *)wxString(_("Distance")).mb_str();
}
if ( toPrintOut[ PRINT_WP_DESCRIPTION ] ) {
table << (const char *)wxString(_("Description")).mb_str();
}
table.StartFillWidths();
// setup widths for columns
if ( toPrintOut[ PRINT_WP_NAME ] ) {
table << 23;
}
if ( toPrintOut[ PRINT_WP_POSITION ] ) {
table << 40;
}
if ( toPrintOut[ PRINT_WP_COURSE ] ) {
table << 30;
}
if ( toPrintOut[ PRINT_WP_DISTANCE ] ) {
table << 38;
}
if ( toPrintOut[ PRINT_WP_DESCRIPTION ] ) {
table << 100;
}
table.StartFillData();
for ( int n = 1; n <= myRoute->GetnPoints(); n++ ) {
RoutePoint* point = myRoute->GetPoint( n );
if ( toPrintOut[ PRINT_WP_NAME ] ) {
string cell( point->GetName().mb_str() );
table << cell;
}
if ( toPrintOut[ PRINT_WP_POSITION ] ) {
wxString point_position = toSDMM( 1, point->m_lat, point->m_bIsInTrack ) + _T( "\n" ) + toSDMM( 2, point->m_lon, point->m_bIsInTrack );
string cell( point_position.mb_str() );
table << cell;
}
if ( toPrintOut[ PRINT_WP_COURSE ] ) {
wxString point_course;
point_course.Printf( _T( "%03.0f Deg" ), point->GetCourse() );
string cell( point_course.mb_str() );
table << cell;
}
if ( toPrintOut[ PRINT_WP_DISTANCE ] ) {
wxString point_distance;
point_distance.Printf( _T( "%6.2f" + getUsrDistanceUnit() ), toUsrDistance( point->GetDistance() ) );
string cell( point_distance.mb_str() );
table << cell;
}
if ( toPrintOut[ PRINT_WP_DESCRIPTION ] ) {
string cell( point->GetDescription().mb_str() );
table << cell;
}
table << "\n";
}
}