本文整理汇总了C++中WindowProjection::ScreenToGeo方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowProjection::ScreenToGeo方法的具体用法?C++ WindowProjection::ScreenToGeo怎么用?C++ WindowProjection::ScreenToGeo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowProjection
的用法示例。
在下文中一共展示了WindowProjection::ScreenToGeo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
RasterRenderer::ScanMap(const RasterMap &map, const WindowProjection &projection)
{
// Coordinates of the MapWindow center
unsigned x = projection.GetScreenWidth() / 2;
unsigned y = projection.GetScreenHeight() / 2;
// GeoPoint corresponding to the MapWindow center
GeoPoint Gmid = projection.ScreenToGeo(x, y);
// GeoPoint "next to" Gmid (depends on terrain resolution)
GeoPoint Gneighbor = projection.ScreenToGeo(x + quantisation_pixels,
y + quantisation_pixels);
// Geographical edge length of pixel in the MapWindow center in meters
pixel_size = fixed_sqrt_half * Gmid.Distance(Gneighbor);
// set resolution
fixed map_pixel_size = map.pixel_distance(Gmid, 1);
fixed q = map_pixel_size / pixel_size;
if (pixel_size < fixed(3000)) {
/* round down to reduce slope shading artefacts (caused by
RasterBuffer interpolation) */
quantisation_effective = std::max(1, (int)q);
if (quantisation_effective > 25)
/* disable slope shading when zoomed in very near (not enough
terrain resolution to make a useful slope calculation) */
quantisation_effective = 0;
} else
/* disable slope shading when zoomed out very far (too tiny) */
quantisation_effective = 0;
height_matrix.Fill(map, projection, quantisation_pixels, true);
}
示例2:
void
RasterRenderer::ScanMap(const RasterMap &map, const WindowProjection &projection)
{
// Coordinates of the MapWindow center
unsigned x = projection.GetScreenWidth() / 2;
unsigned y = projection.GetScreenHeight() / 2;
// GeoPoint corresponding to the MapWindow center
GeoPoint center = projection.ScreenToGeo(x, y);
// GeoPoint "next to" Gmid (depends on terrain resolution)
GeoPoint neighbor = projection.ScreenToGeo(x + quantisation_pixels,
y + quantisation_pixels);
// Geographical edge length of pixel in the MapWindow center in meters
pixel_size = M_SQRT1_2 * center.DistanceS(neighbor);
// set resolution
if (pixel_size < 3000) {
// Data point size of the (terrain) map in meters multiplied by 256
auto map_pixel_size = map.PixelDistance(center, 1);
// How many screen pixels does one data point stretch?
auto q = map_pixel_size / pixel_size;
/* round down to reduce slope shading artefacts (caused by
RasterBuffer interpolation) */
quantisation_effective = std::max(1, (int)q);
/* disable slope shading when zoomed in very near (not enough
terrain resolution to make a useful slope calculation) */
if (quantisation_effective > 25)
quantisation_effective = 0;
} else
/* disable slope shading when zoomed out very far (too tiny) */
quantisation_effective = 0;
#ifdef ENABLE_OPENGL
bounds = projection.GetScreenBounds().Scale(1.5);
bounds.IntersectWith(map.GetBounds());
height_matrix.Fill(map, bounds,
projection.GetScreenWidth() / quantisation_pixels,
projection.GetScreenHeight() / quantisation_pixels,
true);
last_quantisation_pixels = quantisation_pixels;
#else
height_matrix.Fill(map, projection, quantisation_pixels, true);
#endif
}
示例3: Distance
void
RasterRenderer::ScanMap(const RasterMap &map, const WindowProjection &projection)
{
unsigned x = projection.GetScreenWidth() / 2;
unsigned y = projection.GetScreenHeight() / 2;
GeoPoint Gmid = projection.ScreenToGeo(x, y);
pixel_size = fixed_sqrt_half *
Distance(Gmid,
projection.ScreenToGeo(x + quantisation_pixels,
y + quantisation_pixels));
// set resolution
fixed map_pixel_size = map.pixel_distance(Gmid, 1);
quantisation_effective = (int)ceil(map_pixel_size / pixel_size);
height_matrix.Fill(map, projection, quantisation_pixels,
pixel_size * 3 < map_pixel_size * 2);
}
示例4: SetSize
void
HeightMatrix::Fill(const RasterMap &map, const WindowProjection &projection,
unsigned quantisation_pixels, bool interpolate)
{
const unsigned screen_width = projection.GetScreenWidth();
const unsigned screen_height = projection.GetScreenHeight();
SetSize((screen_width + quantisation_pixels - 1) / quantisation_pixels,
(screen_height + quantisation_pixels - 1) / quantisation_pixels);
minimum = 0x7fff;
maximum = 0;
for (unsigned y = 0; y < screen_height; y += quantisation_pixels) {
const FastRowRotation rotation =
projection.GetScreenAngleRotation(y - projection.GetScreenOrigin().y);
short *p = data.begin() + y * width / quantisation_pixels;
for (unsigned x = 0; x < screen_width; x += quantisation_pixels) {
#ifndef SLOW_TERRAIN_STUFF
const FastRowRotation::Pair r =
rotation.Rotate(x - projection.GetScreenOrigin().x);
GeoPoint gp;
gp.Latitude = projection.GetGeoLocation().Latitude
- projection.PixelsToAngle(r.second);
gp.Longitude = projection.GetGeoLocation().Longitude
+ projection.PixelsToAngle(r.first)
* gp.Latitude.invfastcosine();
#else
GeoPoint gp = projection.ScreenToGeo(x, y);
#endif
short h = interpolate ? map.GetFieldInterpolated(gp) : map.GetField(gp);
if (!RasterBuffer::is_special(h)) {
if (h < minimum)
minimum = h;
if (h > maximum)
maximum = h;
}
*p++ = h;
}
assert(p <= data.end());
}
}
示例5:
CompareProjection::FourCorners::FourCorners(const WindowProjection &projection)
:top_left(projection.ScreenToGeo(0, 0)),
top_right(projection.ScreenToGeo(projection.GetScreenWidth(), 0)),
bottom_left(projection.ScreenToGeo(0, projection.GetScreenHeight())),
bottom_right(projection.ScreenToGeo(projection.GetScreenWidth(),
projection.GetScreenHeight())) {}
示例6:
CompareProjection::FourCorners::FourCorners(const WindowProjection &projection)
:GeoQuadrilateral{projection.ScreenToGeo(0, 0),
projection.ScreenToGeo(projection.GetScreenWidth(), 0),
projection.ScreenToGeo(0, projection.GetScreenHeight()),
projection.ScreenToGeo(projection.GetScreenWidth(),
projection.GetScreenHeight())} {}