本文整理汇总了C++中ChartRenderer::ToScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ ChartRenderer::ToScreen方法的具体用法?C++ ChartRenderer::ToScreen怎么用?C++ ChartRenderer::ToScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChartRenderer
的用法示例。
在下文中一共展示了ChartRenderer::ToScreen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
CrossSectionRenderer::PaintAircraft(Canvas &canvas, const ChartRenderer &chart,
const PixelRect rc) const
{
if (!gps_info.NavAltitudeAvailable())
return;
canvas.Select(look.aircraft_brush);
canvas.SelectNullPen();
RasterPoint line[4];
line[0] = chart.ToScreen(fixed(0), gps_info.nav_altitude);
line[1].x = rc.left;
line[1].y = line[0].y;
line[2].x = line[1].x;
line[2].y = line[0].y - (line[0].x - line[1].x) / 2;
line[3].x = (line[1].x + line[0].x) / 2;
line[3].y = line[0].y;
canvas.DrawTriangleFan(line, 4);
}
示例2: fixed
void
TerrainXSRenderer::Draw(Canvas &canvas, const ChartRenderer &chart, const short *elevations) const
{
const fixed max_distance = chart.GetXMax();
StaticArray<RasterPoint, CrossSectionRenderer::NUM_SLICES + 2> points;
canvas.SelectNullPen();
RasterBuffer::TerrainType last_type = RasterBuffer::TerrainType::UNKNOWN;
fixed last_distance = fixed(0);
for (unsigned j = 0; j < CrossSectionRenderer::NUM_SLICES; ++j) {
const fixed distance_factor =
fixed(j) / (CrossSectionRenderer::NUM_SLICES - 1);
const fixed distance = distance_factor * max_distance;
short h = elevations[j];
RasterBuffer::TerrainType type = RasterBuffer::GetTerrainType(h);
if (type == RasterBuffer::TerrainType::WATER)
h = 0;
// Close and paint polygon
if (j != 0 &&
type != last_type &&
last_type != RasterBuffer::TerrainType::UNKNOWN) {
const fixed center_distance = (distance + last_distance) / 2;
points.append() = chart.ToScreen(center_distance, fixed(0));
points.append() = chart.ToScreen(center_distance, fixed(-500));
DrawPolygon(canvas, last_type, points.begin(), points.size());
}
if (type != RasterBuffer::TerrainType::UNKNOWN) {
if (j == 0) {
// Start first polygon
points.append() = chart.ToScreen(distance, fixed(-500));
points.append() = chart.ToScreen(distance, fixed(h));
} else if (type != last_type) {
// Start new polygon
points.clear();
const fixed center_distance = (distance + last_distance) / 2;
points.append() = chart.ToScreen(center_distance, fixed(-500));
points.append() = chart.ToScreen(center_distance, fixed(0));
}
if (j + 1 == CrossSectionRenderer::NUM_SLICES) {
// Close and paint last polygon
points.append() = chart.ToScreen(distance, fixed(h));
points.append() = chart.ToScreen(distance, fixed(-500));
DrawPolygon(canvas, type, points.begin(), points.size());
} else if (type == last_type && j != 0) {
// Add single point to polygon
points.append() = chart.ToScreen(distance, fixed(h));
}
}
last_type = type;
last_distance = distance;
}
}