本文整理汇总了C++中AbstractAirspace::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractAirspace::GetName方法的具体用法?C++ AbstractAirspace::GetName怎么用?C++ AbstractAirspace::GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractAirspace
的用法示例。
在下文中一共展示了AbstractAirspace::GetName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Visit
void Visit(const AbstractAirspace &as) {
if (do_report) {
*fout << as;
*fout << "# Name: " << as.GetName()
<< "Base: " << as.GetBase()
<< " Top: " << as.GetTop()
<< "\n";
}
}
示例2: PixelScalar
void
AirspaceListRenderer::Draw(Canvas &canvas, const PixelRect rc,
const AbstractAirspace &airspace,
const TCHAR *comment, const DialogLook &dialog_look,
const AirspaceLook &look,
const AirspaceRendererSettings &renderer_settings)
{
const PixelScalar line_height = rc.bottom - rc.top;
const Font &name_font = *dialog_look.list.font;
const Font &small_font = *dialog_look.small_font;
PixelScalar left = rc.left + line_height + Layout::FastScale(2);
canvas.Select(name_font);
canvas.text_clipped(left, rc.top + Layout::FastScale(2), rc,
airspace.GetName());
canvas.Select(small_font);
canvas.text_clipped(left,
rc.top + name_font.GetHeight() + Layout::FastScale(4),
rc, comment);
tstring top = AirspaceFormatter::GetTopShort(airspace);
PixelScalar altitude_width =
canvas.CalcTextWidth(top.c_str());
canvas.text_clipped(rc.right - altitude_width - Layout::FastScale(4),
rc.top + name_font.GetHeight() -
small_font.GetHeight() + Layout::FastScale(2), rc,
top.c_str());
tstring base = AirspaceFormatter::GetBaseShort(airspace);
altitude_width = canvas.CalcTextWidth(base.c_str());
canvas.text_clipped(rc.right - altitude_width - Layout::FastScale(4),
rc.top + name_font.GetHeight() + Layout::FastScale(4),
rc, base.c_str());
RasterPoint pt = { PixelScalar(rc.left + line_height / 2),
PixelScalar(rc.top + line_height / 2) };
PixelScalar radius = std::min(PixelScalar(line_height / 2
- Layout::FastScale(4)),
Layout::FastScale(10));
AirspacePreviewRenderer::Draw(canvas, airspace, pt, radius,
renderer_settings, look);
}
示例3: tstring
tstring
AirspaceFormatter::GetNameAndClass(const AbstractAirspace &airspace)
{
return tstring(airspace.GetName()) + _T(" ") + GetClass(airspace.GetType());
}
示例4: RenderBox
inline void
AirspaceIntersectionVisitorSlice::Render(const AbstractAirspace &as) const
{
AirspaceClass type = as.GetType();
// No intersections for this airspace
if (intersections.empty())
return;
PixelRect rcd;
// Calculate top and bottom coordinate
rcd.top = chart.ScreenY(as.GetTopAltitude(state));
if (as.IsBaseTerrain())
rcd.bottom = chart.ScreenY(fixed(0));
else
rcd.bottom = chart.ScreenY(as.GetBaseAltitude(state));
int min_x = 1024, max_x = 0;
// Iterate through the intersections
for (const auto &i : intersections) {
const GeoPoint &p_start = i.first;
const GeoPoint &p_end = i.second;
rcd.left = chart.ScreenX(start.Distance(p_start));
// only one edge found, next edge must be beyond screen
if (p_start == p_end)
rcd.right = chart.ScreenX(chart.GetXMax());
else
rcd.right = chart.ScreenX(start.Distance(p_end));
if (rcd.left < min_x)
min_x = rcd.left;
if (rcd.right > max_x)
max_x = rcd.right;
// Draw the airspace
RenderBox(rcd, type);
}
min_x += Layout::GetTextPadding();
max_x -= Layout::GetTextPadding();
/* draw the airspace name */
const TCHAR *name = as.GetName();
if (name != nullptr && !StringIsEmpty(name) && min_x < max_x) {
canvas.SetBackgroundTransparent();
canvas.SetTextColor(COLOR_BLACK);
const unsigned max_width = max_x - min_x;
const PixelSize name_size = canvas.CalcTextSize(name);
const int x = unsigned(name_size.cx) >= max_width
? min_x
: (min_x + max_x - name_size.cx) / 2;
const int y = (rcd.top + rcd.bottom - name_size.cy) / 2;
canvas.DrawClippedText(x, y, max_x - x, name);
}
}