本文整理汇总了C++中MapWindowProjection::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ MapWindowProjection::IsValid方法的具体用法?C++ MapWindowProjection::IsValid怎么用?C++ MapWindowProjection::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapWindowProjection
的用法示例。
在下文中一共展示了MapWindowProjection::IsValid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sun_azimuth
void
TerrainPreviewWindow::OnPaint(Canvas &canvas)
{
const GlueMapWindow *map = UIGlobals::GetMap();
if (map == nullptr)
return;
MapWindowProjection projection = map->VisibleProjection();
if (!projection.IsValid()) {
/* TODO: initialise projection to middle of map instead of bailing
out */
canvas.ClearWhite();
return;
}
projection.SetScreenSize(canvas.GetSize());
projection.SetScreenOrigin(canvas.GetWidth() / 2, canvas.GetHeight() / 2);
Angle sun_azimuth(Angle::Degrees(-45));
if (renderer.GetSettings().slope_shading == SlopeShading::SUN &&
CommonInterface::Calculated().sun_data_available)
sun_azimuth = CommonInterface::Calculated().sun_azimuth;
renderer.Generate(projection, sun_azimuth);
#ifdef ENABLE_OPENGL
/* enable clipping because the OpenGL terrain renderer uses a large
texture that exceeds the window dimensions */
GLCanvasScissor scissor(canvas);
#endif
renderer.Draw(canvas, projection);
}
示例2: if
void
GlueMapWindow::DrawMapScale(Canvas &canvas, const PixelRect &rc,
const MapWindowProjection &projection) const
{
if (!projection.IsValid())
return;
StaticString<80> buffer;
fixed map_width = projection.GetScreenWidthMeters();
const Font &font = *look.overlay_font;
canvas.Select(font);
FormatUserMapScale(map_width, buffer.buffer(), true);
PixelSize text_size = canvas.CalcTextSize(buffer);
const PixelScalar text_padding_x = Layout::GetTextPadding();
const PixelScalar height = font.GetCapitalHeight()
+ Layout::GetTextPadding();
PixelScalar x = 0;
look.map_scale_left_icon.Draw(canvas, 0, rc.bottom - height);
x += look.map_scale_left_icon.GetSize().cx;
canvas.DrawFilledRectangle(x, rc.bottom - height,
x + 2 * text_padding_x + text_size.cx,
rc.bottom, COLOR_WHITE);
canvas.SetBackgroundTransparent();
canvas.SetTextColor(COLOR_BLACK);
x += text_padding_x;
canvas.DrawText(x,
rc.bottom - font.GetAscentHeight() - Layout::Scale(1),
buffer);
x += text_padding_x + text_size.cx;
look.map_scale_right_icon.Draw(canvas, x, rc.bottom - height);
buffer.clear();
if (GetMapSettings().auto_zoom_enabled)
buffer = _T("AUTO ");
switch (follow_mode) {
case FOLLOW_SELF:
break;
case FOLLOW_PAN:
buffer += _T("PAN ");
break;
}
const UIState &ui_state = GetUIState();
if (ui_state.auxiliary_enabled) {
buffer += ui_state.panel_name;
buffer += _T(" ");
}
if (Basic().gps.replay)
buffer += _T("REPLAY ");
else if (Basic().gps.simulator) {
buffer += _("Simulator");
buffer += _T(" ");
}
if (GetComputerSettings().polar.ballast_timer_active)
buffer.AppendFormat(
_T("BALLAST %d LITERS "),
(int)GetComputerSettings().polar.glide_polar_task.GetBallastLitres());
if (weather != nullptr && weather->GetParameter() > 0) {
const TCHAR *label = weather->ItemLabel(weather->GetParameter());
if (label != nullptr)
buffer += label;
}
if (!buffer.empty()) {
int y = rc.bottom - height;
TextInBoxMode mode;
mode.vertical_position = TextInBoxMode::VerticalPosition::ABOVE;
mode.shape = LabelShape::OUTLINED;
TextInBox(canvas, buffer, 0, y, mode, rc, nullptr);
}
}
示例3: GetLocation
gcc_pure
GeoPoint GetLocation() const {
return visible_projection.IsValid()
? visible_projection.GetGeoLocation()
: GeoPoint::Invalid();
}
示例4: if
void
GlueMapWindow::DrawMapScale(Canvas &canvas, const PixelRect &rc,
const MapWindowProjection &projection) const
{
RenderMapScale(canvas, projection, rc, look.overlay);
if (!projection.IsValid())
return;
StaticString<80> buffer;
buffer.clear();
if (GetMapSettings().auto_zoom_enabled)
buffer = _T("AUTO ");
switch (follow_mode) {
case FOLLOW_SELF:
break;
case FOLLOW_PAN:
buffer += _T("PAN ");
break;
}
const UIState &ui_state = GetUIState();
if (ui_state.auxiliary_enabled) {
buffer += ui_state.panel_name;
buffer += _T(" ");
}
if (Basic().gps.replay)
buffer += _T("REPLAY ");
else if (Basic().gps.simulator) {
buffer += _("Simulator");
buffer += _T(" ");
}
if (GetComputerSettings().polar.ballast_timer_active)
buffer.AppendFormat(
_T("BALLAST %d LITERS "),
(int)GetComputerSettings().polar.glide_polar_task.GetBallastLitres());
if (rasp_renderer != nullptr) {
const TCHAR *label = rasp_renderer->GetLabel();
if (label != nullptr)
buffer += gettext(label);
}
if (!buffer.empty()) {
const Font &font = *look.overlay.overlay_font;
canvas.Select(font);
const unsigned height = font.GetCapitalHeight()
+ Layout::GetTextPadding();
int y = rc.bottom - height;
TextInBoxMode mode;
mode.vertical_position = TextInBoxMode::VerticalPosition::ABOVE;
mode.shape = LabelShape::OUTLINED;
TextInBox(canvas, buffer, 0, y, mode, rc, nullptr);
}
}