本文整理汇总了C++中WindowProjection::SetGeoLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowProjection::SetGeoLocation方法的具体用法?C++ WindowProjection::SetGeoLocation怎么用?C++ WindowProjection::SetGeoLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowProjection
的用法示例。
在下文中一共展示了WindowProjection::SetGeoLocation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static void
GetPolygonPoints(std::vector<RasterPoint> &pts,
const AirspacePolygon &airspace,
const RasterPoint pt, unsigned radius)
{
GeoBounds bounds = airspace.GetGeoBounds();
GeoPoint center = bounds.GetCenter();
fixed geo_heigth = bounds.GetGeoHeight();
fixed geo_width = bounds.GetGeoWidth();
fixed geo_size = std::max(geo_heigth, geo_width);
WindowProjection projection;
projection.SetScreenSize({radius * 2, radius * 2});
projection.SetScreenOrigin(pt.x, pt.y);
projection.SetGeoLocation(center);
projection.SetScale(fixed(radius * 2) / geo_size);
projection.SetScreenAngle(Angle::Zero());
projection.UpdateScreenBounds();
const SearchPointVector &border = airspace.GetPoints();
pts.reserve(border.size());
for (auto it = border.begin(), it_end = border.end(); it != it_end; ++it)
pts.push_back(projection.GeoToScreen(it->GetLocation()));
}
示例2: OnPaint
virtual void OnPaint(Canvas &canvas) override {
canvas.ClearWhite();
const GeoPoint a(Angle::Degrees(7.70722),
Angle::Degrees(51.052));
const GeoPoint b(Angle::Degrees(11.5228),
Angle::Degrees(50.3972));
WindowProjection projection;
projection.SetScreenOrigin(canvas.GetWidth() / 2, canvas.GetHeight() / 2);
projection.SetGeoLocation(a.Middle(b));
projection.SetScreenSize(canvas.GetSize());
projection.SetScaleFromRadius(fixed(400000));
projection.UpdateScreenBounds();
canvas.SelectBlackPen();
canvas.SelectHollowBrush();
RasterPoint pa = projection.GeoToScreen(a);
canvas.DrawCircle(pa.x, pa.y, 4);
RasterPoint pb = projection.GeoToScreen(b);
canvas.DrawCircle(pb.x, pb.y, 4);
RenderFAISector(canvas, projection, a, b, false, settings);
}
示例3: bounds
void
OZPreviewRenderer::Draw(Canvas &canvas, const ObservationZonePoint &oz,
const RasterPoint pt, unsigned radius,
const TaskLook &look,
const AirspaceRendererSettings &airspace_settings,
const AirspaceLook &airspace_look)
{
fixed scale;
GeoPoint center;
if (IsAncientHardware()) {
scale = fixed(radius) / ((const CylinderZone &)oz).GetRadius();
center = oz.GetReference();
} else {
OZBoundary boundary = oz.GetBoundary();
auto it = boundary.begin();
GeoBounds bounds(*it);
for (auto it_end = boundary.end(); it != it_end; ++it)
bounds.Extend(*it);
center = bounds.GetCenter();
fixed geo_heigth = GeoPoint(center.longitude, bounds.north).Distance(
GeoPoint(center.longitude, bounds.south));
fixed geo_width = GeoPoint(bounds.west, center.latitude).Distance(
GeoPoint(bounds.east, center.latitude));
scale = fixed(radius * 2) / std::max(geo_heigth, geo_width);
}
WindowProjection projection;
projection.SetScreenSize(radius * 2, radius * 2);
projection.SetScreenOrigin(pt.x, pt.y);
projection.SetGeoLocation(center);
projection.SetScale(scale);
projection.SetScreenAngle(Angle::Zero());
projection.UpdateScreenBounds();
OZRenderer ozv(look, airspace_look, airspace_settings);
ozv.Draw(canvas, OZRenderer::LAYER_SHADE, projection, oz, 1);
ozv.Draw(canvas, OZRenderer::LAYER_INACTIVE, projection, oz, 1);
ozv.Draw(canvas, OZRenderer::LAYER_ACTIVE, projection, oz, 1);
}
示例4: main
int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "Usage: %s PATH\n", argv[0]);
return 1;
}
const char *map_path = argv[1];
TCHAR jp2_path[4096];
_tcscpy(jp2_path, PathName(map_path));
_tcscat(jp2_path, _T(DIR_SEPARATOR_S) _T("terrain.jp2"));
TCHAR j2w_path[4096];
_tcscpy(j2w_path, PathName(map_path));
_tcscat(j2w_path, _T(DIR_SEPARATOR_S) _T("terrain.j2w"));
NullOperationEnvironment operation;
RasterMap map(jp2_path, j2w_path, NULL, operation);
if (!map.isMapLoaded()) {
fprintf(stderr, "failed to load map\n");
return EXIT_FAILURE;
}
do {
map.SetViewCenter(map.GetMapCenter(), fixed(50000));
} while (map.IsDirty());
fixed radius = fixed(50000);
WindowProjection projection;
projection.SetScreenSize(640, 480);
projection.SetScaleFromRadius(radius);
projection.SetGeoLocation(map.GetMapCenter());
projection.SetScreenOrigin(320, 240);
projection.UpdateScreenBounds();
HeightMatrix matrix;
matrix.Fill(map, projection, 1, false);
return EXIT_SUCCESS;
}
示例5: ozv
void
OZPreviewRenderer::Draw(Canvas &canvas, const ObservationZonePoint &oz,
const PixelPoint pt, unsigned radius,
const TaskLook &look,
const AirspaceRendererSettings &airspace_settings,
const AirspaceLook &airspace_look)
{
double scale;
GeoPoint center;
if (IsAncientHardware()) {
scale = double(radius) / ((const CylinderZone &)oz).GetRadius();
center = oz.GetReference();
} else {
OZBoundary boundary = oz.GetBoundary();
GeoBounds bounds = GeoBounds::Invalid();
for (auto i = boundary.begin(), end = boundary.end(); i != end; ++i)
bounds.Extend(*i);
center = bounds.GetCenter();
auto geo_width = bounds.GetGeoWidth();
auto geo_heigth = bounds.GetGeoHeight();
scale = double(radius * 2) / std::max(geo_heigth, geo_width);
}
WindowProjection projection;
projection.SetScreenSize({radius * 2, radius * 2});
projection.SetScreenOrigin(pt.x, pt.y);
projection.SetGeoLocation(center);
projection.SetScale(scale);
projection.SetScreenAngle(Angle::Zero());
projection.UpdateScreenBounds();
OZRenderer ozv(look, airspace_look, airspace_settings);
ozv.Draw(canvas, OZRenderer::LAYER_SHADE, projection, oz, 1);
ozv.Draw(canvas, OZRenderer::LAYER_INACTIVE, projection, oz, 1);
ozv.Draw(canvas, OZRenderer::LAYER_ACTIVE, projection, oz, 1);
}
示例6: GeoPoint
static void
DrawPolygon(Canvas &canvas, const AirspacePolygon &airspace,
const RasterPoint pt, unsigned radius)
{
if (IsAncientHardware()) {
canvas.Rectangle(pt.x - radius, pt.y - radius,
pt.x + radius, pt.y + radius);
return;
}
GeoBounds bounds = airspace.GetGeoBounds();
GeoPoint center = bounds.GetCenter();
fixed geo_heigth = GeoPoint(center.longitude, bounds.north).Distance(
GeoPoint(center.longitude, bounds.south));
fixed geo_width = GeoPoint(bounds.west, center.latitude).Distance(
GeoPoint(bounds.east, center.latitude));
fixed geo_size = std::max(geo_heigth, geo_width);
WindowProjection projection;
projection.SetScreenSize(radius * 2, radius * 2);
projection.SetScreenOrigin(pt.x, pt.y);
projection.SetGeoLocation(center);
projection.SetScale(fixed(radius * 2) / geo_size);
projection.SetScreenAngle(Angle::Zero());
projection.UpdateScreenBounds();
const SearchPointVector &border = airspace.GetPoints();
std::vector<RasterPoint> pts;
pts.reserve(border.size());
for (auto it = border.begin(), it_end = border.end(); it != it_end; ++it)
pts.push_back(projection.GeoToScreen(it->get_location()));
canvas.polygon(&pts[0], (unsigned)pts.size());
}