本文整理汇总了C++中ocpnDC::GetDC方法的典型用法代码示例。如果您正苦于以下问题:C++ ocpnDC::GetDC方法的具体用法?C++ ocpnDC::GetDC怎么用?C++ ocpnDC::GetDC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ocpnDC
的用法示例。
在下文中一共展示了ocpnDC::GetDC方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void WeatherRouting::Render(ocpnDC &dc, PlugIn_ViewPort &vp)
{
if(!dc.GetDC())
{
glPushAttrib(GL_LINE_BIT | GL_ENABLE_BIT | GL_HINT_BIT ); //Save state
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
}
wxDateTime time = m_ConfigurationDialog.m_GribTimelineTime;
if(!time.IsValid())
time = wxDateTime::Now();
RouteMapOverlay *routemapoverlay = CurrentRouteMap();
for(int i=0; i<m_lWeatherRoutes->GetItemCount(); i++)
{
WeatherRoute *weatherroute =
reinterpret_cast<WeatherRoute*>(wxUIntToPtr(m_lWeatherRoutes->GetItemData(i)));
if(weatherroute->routemapoverlay->m_bEndRouteVisible)
weatherroute->routemapoverlay->Render(time, m_SettingsDialog, dc, vp, true);
}
if(routemapoverlay)
routemapoverlay->Render(time, m_SettingsDialog, dc, vp, false);
m_ConfigurationBatchDialog.Render(dc, vp);
if(!dc.GetDC())
glPopAttrib();
}
示例2: Draw
void Track::Draw( ocpnDC& dc, ViewPort &VP, const LLBBox &box )
{
std::list< std::list<wxPoint> > pointlists;
GetPointLists(pointlists, VP, box);
if(!pointlists.size())
return;
unsigned short int FromSegNo = 1;
// Establish basic colour
wxColour basic_colour;
if( IsRunning() )
basic_colour = GetGlobalColor( _T ( "URED" ) );
else
basic_colour = GetDimColor(g_colourTrackLineColour);
wxPenStyle style = wxPENSTYLE_SOLID;
int width = g_pRouteMan->GetTrackPen()->GetWidth();
wxColour col;
if( m_style != wxPENSTYLE_INVALID )
style = m_style;
if( m_width != WIDTH_UNDEFINED )
width = m_width;
if( m_Colour == wxEmptyString ) {
col = basic_colour;
} else {
for( unsigned int i = 0; i < sizeof( ::GpxxColorNames ) / sizeof(wxString); i++ ) {
if( m_Colour == ::GpxxColorNames[i] ) {
col = ::GpxxColors[i];
break;
}
}
}
double radius = 0.;
if( g_bHighliteTracks ) {
double radius_meters = 20; //Current_Ch->GetNativeScale() * .0015; // 1.5 mm at original scale
radius = radius_meters * VP.view_scale_ppm;
if(radius < 1.0)
radius = 0;
}
if( dc.GetDC() || radius ) {
dc.SetPen( *wxThePenList->FindOrCreatePen( col, width, style ) );
dc.SetBrush( *wxTheBrushList->FindOrCreateBrush( col, wxBRUSHSTYLE_SOLID ) );
for(std::list< std::list<wxPoint> >::iterator lines = pointlists.begin();
lines != pointlists.end(); lines++) {
// convert from linked list to array
wxPoint *points = new wxPoint[lines->size()];
int i = 0;
for(std::list<wxPoint>::iterator line = lines->begin();
line != lines->end(); line++) {
points[i] = *line;
i++;
}
int hilite_width = radius;
if( hilite_width ) {
wxPen psave = dc.GetPen();
dc.StrokeLines( i, points );
wxColor trackLine_dim_colour = GetDimColor(g_colourTrackLineColour);
wxColour hilt( trackLine_dim_colour.Red(), trackLine_dim_colour.Green(), trackLine_dim_colour.Blue(), 128 );
wxPen HiPen( hilt, hilite_width, wxPENSTYLE_SOLID );
dc.SetPen( HiPen );
dc.StrokeLines( i, points );
dc.SetPen( psave );
} else
dc.StrokeLines( i, points );
delete [] points;
}
}
#ifdef ocpnUSE_GL
else { // opengl version
glColor3ub(col.Red(), col.Green(), col.Blue());
glLineWidth( wxMax( g_GLMinSymbolLineWidth, width ) );
if( g_GLOptions.m_GLLineSmoothing )
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
int size = 0;
// convert from linked list to array, allocate array just once
for(std::list< std::list<wxPoint> >::iterator lines = pointlists.begin();
lines != pointlists.end(); lines++)
size = wxMax(size, lines->size());
int *points = new int[2*size];
glVertexPointer(2, GL_INT, 0, points);
glEnableClientState(GL_VERTEX_ARRAY);
for(std::list< std::list<wxPoint> >::iterator lines = pointlists.begin();
lines != pointlists.end(); lines++) {
// convert from linked list to array
int i = 0;
//.........这里部分代码省略.........