本文整理汇总了C++中MapWindowProjection::GetScreenWidthMeters方法的典型用法代码示例。如果您正苦于以下问题:C++ MapWindowProjection::GetScreenWidthMeters方法的具体用法?C++ MapWindowProjection::GetScreenWidthMeters怎么用?C++ MapWindowProjection::GetScreenWidthMeters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapWindowProjection
的用法示例。
在下文中一共展示了MapWindowProjection::GetScreenWidthMeters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: if
void
GlueMapWindow::DrawMapScale(Canvas &canvas, const PixelRect &rc,
const MapWindowProjection &projection) const
{
TCHAR buffer[80];
fixed MapWidth = projection.GetScreenWidthMeters();
canvas.select(Fonts::MapBold);
Units::FormatUserMapScale(MapWidth, buffer,
sizeof(buffer) / sizeof(TCHAR), true);
PixelSize TextSize = canvas.text_size(buffer);
int Height = Fonts::MapBold.get_capital_height() + Layout::Scale(2);
// 2: add 1pix border
canvas.fill_rectangle(Layout::Scale(4), rc.bottom - Height,
TextSize.cx + Layout::Scale(11), rc.bottom,
COLOR_WHITE);
canvas.background_transparent();
canvas.set_text_color(COLOR_BLACK);
canvas.text(Layout::Scale(7),
rc.bottom - Fonts::MapBold.get_ascent_height() - Layout::Scale(1),
buffer);
Graphics::hBmpMapScaleLeft.draw(canvas, 0, rc.bottom - Height);
Graphics::hBmpMapScaleRight.draw(canvas, Layout::Scale(9) + TextSize.cx,
rc.bottom - Height);
buffer[0] = '\0';
if (SettingsMap().AutoZoom)
_tcscat(buffer, _T("AUTO "));
switch (follow_mode) {
case FOLLOW_SELF:
break;
case FOLLOW_PAN:
_tcscat(buffer, _T("PAN "));
break;
}
const UIState &ui_state = CommonInterface::GetUIState();
if (ui_state.auxiliary_enabled) {
_tcscat(buffer, InfoBoxManager::GetCurrentPanelName());
_tcscat(buffer, _T(" "));
}
if (Basic().gps.replay)
_tcscat(buffer, _T("REPLAY "));
else if (Basic().gps.simulator) {
_tcscat(buffer, _("Simulator"));
_tcscat(buffer, _T(" "));
}
if (SettingsComputer().BallastTimerActive) {
TCHAR TEMP[20];
_stprintf(TEMP, _T("BALLAST %d LITERS "),
(int)SettingsComputer().glide_polar_task.GetBallastLitres());
_tcscat(buffer, TEMP);
}
if (weather != NULL && weather->GetParameter() > 0) {
const TCHAR *label = weather->ItemLabel(weather->GetParameter());
if (label != NULL)
_tcscat(buffer, label);
}
if (buffer[0]) {
int y = rc.bottom - Height;
canvas.select(Fonts::Title);
canvas.background_opaque();
canvas.set_background_color(COLOR_WHITE);
canvas.text(0, y - canvas.text_size(buffer).cy, buffer);
}
}
示例3: if
void
GlueMapWindow::DrawMapScale(Canvas &canvas, const PixelRect &rc,
const MapWindowProjection &projection) const
{
StaticString<80> buffer;
fixed map_width = projection.GetScreenWidthMeters();
canvas.Select(Fonts::map_bold);
FormatUserMapScale(map_width, buffer.buffer(), true);
PixelSize text_size = canvas.CalcTextSize(buffer);
const PixelScalar text_padding_x = Layout::Scale(2);
const PixelScalar height = Fonts::map_bold.GetCapitalHeight() + Layout::Scale(2);
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.text(x, rc.bottom - Fonts::map_bold.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 != NULL && weather->GetParameter() > 0) {
const TCHAR *label = weather->ItemLabel(weather->GetParameter());
if (label != NULL)
buffer += label;
}
if (!buffer.empty()) {
int y = rc.bottom - height;
canvas.Select(Fonts::title);
canvas.SetBackgroundOpaque();
canvas.SetBackgroundColor(COLOR_WHITE);
canvas.text(0, y - canvas.CalcTextSize(buffer).cy, buffer);
}
}