本文整理汇总了C++中AbstractAirspace::GetBaseAltitude方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractAirspace::GetBaseAltitude方法的具体用法?C++ AbstractAirspace::GetBaseAltitude怎么用?C++ AbstractAirspace::GetBaseAltitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractAirspace
的用法示例。
在下文中一共展示了AbstractAirspace::GetBaseAltitude方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: brush
/**
* Renders the AbstractAirspace on the canvas
* @param as AbstractAirspace to render
*/
void
Render(const AbstractAirspace& as)
{
int type = as.GetType();
if (type <= 0)
return;
// No intersections for this airspace
if (m_intersections.empty())
return;
// Select pens and brushes
#ifndef USE_GDI
Color color = airspace_look.colors[settings.colours[type]];
#ifdef ENABLE_OPENGL
color = color.WithAlpha(48);
#endif
Brush brush(color);
#else
const Brush &brush = airspace_look.brushes[settings.brushes[type]];
canvas.SetTextColor(LightColor(airspace_look.colors[settings.colours[type]]));
#endif
PixelRect rcd;
// Calculate top and bottom coordinate
rcd.top = chart.screenY(as.GetTopAltitude(state));
if (as.IsBaseTerrain())
rcd.bottom = chart.screenY(fixed_zero);
else
rcd.bottom = chart.screenY(as.GetBaseAltitude(state));
// Iterate through the intersections
for (auto it = m_intersections.begin(); it != m_intersections.end(); ++it) {
const GeoPoint p_start = it->first;
const GeoPoint p_end = it->second;
const fixed distance_start = start.Distance(p_start);
const fixed distance_end = start.Distance(p_end);
// Determine left and right coordinate
rcd.left = chart.screenX(distance_start);
rcd.right = chart.screenX(distance_end);
// only one edge found, next edge must be beyond screen
if ((rcd.left == rcd.right) && (p_start == p_end)) {
rcd.right = chart.screenX(chart.getXmax());
}
// Draw the airspace
RenderBox(rcd, brush, settings.black_outline, type);
}
}
示例2: ExcludeAltitude
bool ExcludeAltitude(const AbstractAirspace& airspace) {
if (!positive(max_alt))
return false;
return (airspace.GetBaseAltitude(state) > max_alt);
}
示例3: 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);
}
}