本文整理汇总了C++中Projection::GeoToScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ Projection::GeoToScreen方法的具体用法?C++ Projection::GeoToScreen怎么用?C++ Projection::GeoToScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projection
的用法示例。
在下文中一共展示了Projection::GeoToScreen方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vp
void
DrawGeoBitmap(const RawBitmap &bitmap, PixelSize bitmap_size,
const GeoBounds &bounds,
const Projection &projection)
{
assert(bounds.IsValid());
const BulkPixelPoint vertices[] = {
projection.GeoToScreen(bounds.GetNorthWest()),
projection.GeoToScreen(bounds.GetNorthEast()),
projection.GeoToScreen(bounds.GetSouthWest()),
projection.GeoToScreen(bounds.GetSouthEast()),
};
const ScopeVertexPointer vp(vertices);
const GLTexture &texture = bitmap.BindAndGetTexture();
const PixelSize allocated = texture.GetAllocatedSize();
const GLfloat src_x = 0, src_y = 0, src_width = bitmap_size.cx,
src_height = bitmap_size.cy;
GLfloat x0 = src_x / allocated.cx;
GLfloat y0 = src_y / allocated.cy;
GLfloat x1 = (src_x + src_width) / allocated.cx;
GLfloat y1 = (src_y + src_height) / allocated.cy;
const GLfloat coord[] = {
x0, y0,
x1, y0,
x0, y1,
x1, y1,
};
#ifdef USE_GLSL
OpenGL::texture_shader->Use();
glEnableVertexAttribArray(OpenGL::Attribute::TEXCOORD);
glVertexAttribPointer(OpenGL::Attribute::TEXCOORD, 2, GL_FLOAT, GL_FALSE,
0, coord);
#else
const GLEnable<GL_TEXTURE_2D> scope;
OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, coord);
#endif
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
#ifdef USE_GLSL
glDisableVertexAttribArray(OpenGL::Attribute::TEXCOORD);
OpenGL::solid_shader->Use();
#else
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
#endif
}
示例2:
void
MapCanvas::project(const Projection &projection,
const SearchPointVector &points, RasterPoint *screen)
{
for (auto it = points.begin(); it != points.end(); ++it)
*screen++ = projection.GeoToScreen(it->get_location());
}
示例3:
void
MapCanvas::Project(const Projection &projection,
const SearchPointVector &points, BulkPixelPoint *screen)
{
for (auto it = points.begin(); it != points.end(); ++it)
*screen++ = projection.GeoToScreen(it->GetLocation());
}
示例4:
static void
TestGeoScreenCouple(const Projection prj, const GeoPoint geo,
long x, long y)
{
RasterPoint tmp_pt = prj.GeoToScreen(geo);
ok1(tmp_pt.x == x);
ok1(tmp_pt.y == y);
GeoPoint tmp_geo = prj.ScreenToGeo(x, y);
ok1(equals(tmp_geo.latitude, geo.latitude));
ok1(equals(tmp_geo.longitude, geo.longitude));
}
示例5: Prepare
void
TrailRenderer::DrawTraceVector(Canvas &canvas, const Projection &projection,
const TracePointVector &trace)
{
const unsigned n = trace.size();
RasterPoint *p = Prepare(n);
for (const auto &i : trace)
*p++ = projection.GeoToScreen(i.GetLocation());
DrawPreparedPolyline(canvas, n);
}
示例6: assert
void
TrailRenderer::DrawTriangle(Canvas &canvas, const Projection &projection,
const ContestTraceVector &trace)
{
assert(trace.size() == 5);
const unsigned start = 1, n = 3;
RasterPoint *p = Prepare(n);
for (unsigned i = start; i < start + n; ++i)
*p++ = projection.GeoToScreen(trace[i].GetLocation());
DrawPreparedPolygon(canvas, n);
}
示例7: pen
void
OZWindow::OnPaint(Canvas &canvas)
{
canvas.ClearWhite();
if (oz == NULL)
return;
const int offset = 0;
roz.Draw(canvas, OZRenderer::LAYER_SHADE, projection, *oz, offset);
roz.Draw(canvas, OZRenderer::LAYER_INACTIVE, projection, *oz, offset);
roz.Draw(canvas, OZRenderer::LAYER_ACTIVE, projection, *oz, offset);
/* debugging for ObservationZone::GetBoundary() */
Pen pen(1, COLOR_RED);
canvas.Select(pen);
const OZBoundary boundary = oz->GetBoundary();
for (auto i = boundary.begin(), end = boundary.end(); i != end; ++i) {
RasterPoint p = projection.GeoToScreen(*i);
canvas.DrawLine(p.x - 3, p.y - 3, p.x + 3, p.y + 3);
canvas.DrawLine(p.x + 3, p.y - 3, p.x - 3, p.y + 3);
}
}
示例8: switch
void
RenderObservationZone::Draw(Canvas &canvas, const Projection &projection,
const ObservationZonePoint &_oz) const
{
switch (_oz.shape) {
case ObservationZonePoint::LINE:
case ObservationZonePoint::FAI_SECTOR: {
const SectorZone &oz = (const SectorZone &)_oz;
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
if (layer != LAYER_ACTIVE)
canvas.segment(p_center.x, p_center.y,
projection.GeoToScreenDistance(oz.getRadius()),
oz.getStartRadial() - projection.GetScreenAngle(),
oz.getEndRadial() - projection.GetScreenAngle());
else {
RasterPoint p_start = projection.GeoToScreen(oz.get_SectorStart());
RasterPoint p_end = projection.GeoToScreen(oz.get_SectorEnd());
canvas.two_lines(p_start, p_center, p_end);
}
break;
}
case ObservationZonePoint::CYLINDER: {
const CylinderZone &oz = (const CylinderZone &)_oz;
if (layer != LAYER_INACTIVE) {
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
canvas.circle(p_center.x, p_center.y,
projection.GeoToScreenDistance(oz.getRadius()));
}
break;
}
case ObservationZonePoint::BGA_START:
case ObservationZonePoint::SECTOR: {
const SectorZone &oz = (const SectorZone &)_oz;
if (layer != LAYER_INACTIVE) {
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
canvas.segment(p_center.x, p_center.y,
projection.GeoToScreenDistance(oz.getRadius()),
oz.getStartRadial() - projection.GetScreenAngle(),
oz.getEndRadial() - projection.GetScreenAngle());
RasterPoint p_start = projection.GeoToScreen(oz.get_SectorStart());
RasterPoint p_end = projection.GeoToScreen(oz.get_SectorEnd());
canvas.two_lines(p_start, p_center, p_end);
}
break;
}
case ObservationZonePoint::KEYHOLE:
case ObservationZonePoint::BGAFIXEDCOURSE:
case ObservationZonePoint::BGAENHANCEDOPTION: {
const SectorZone &oz = (const SectorZone &)_oz;
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
canvas.keyhole(p_center.x, p_center.y,
projection.GeoToScreenDistance(fixed(500)),
projection.GeoToScreenDistance(oz.getRadius()),
oz.getStartRadial() - projection.GetScreenAngle(),
oz.getEndRadial() - projection.GetScreenAngle());
break;
}
case ObservationZonePoint::ANNULAR_SECTOR: {
const AnnularSectorZone &oz = (const AnnularSectorZone &)_oz;
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
canvas.annulus(p_center.x, p_center.y,
projection.GeoToScreenDistance(oz.getInnerRadius()),
projection.GeoToScreenDistance(oz.getRadius()),
oz.getStartRadial() - projection.GetScreenAngle(),
oz.getEndRadial() - projection.GetScreenAngle());
}
}
}
示例9: Prepare
void
OZRenderer::Draw(Canvas &canvas, Layer layer, const Projection &projection,
const ObservationZonePoint &_oz, int offset)
{
if (layer == LAYER_SHADE && offset < 0)
return;
Prepare(canvas, layer, offset);
switch (_oz.shape) {
case ObservationZonePoint::LINE:
case ObservationZonePoint::FAI_SECTOR: {
const SectorZone &oz = (const SectorZone &)_oz;
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
if (layer != LAYER_ACTIVE)
canvas.DrawSegment(p_center.x, p_center.y,
projection.GeoToScreenDistance(oz.getRadius()),
oz.getStartRadial() - projection.GetScreenAngle(),
oz.getEndRadial() - projection.GetScreenAngle());
else {
RasterPoint p_start = projection.GeoToScreen(oz.get_SectorStart());
RasterPoint p_end = projection.GeoToScreen(oz.get_SectorEnd());
canvas.DrawTwoLines(p_start, p_center, p_end);
}
break;
}
case ObservationZonePoint::CYLINDER: {
const CylinderZone &oz = (const CylinderZone &)_oz;
if (layer != LAYER_INACTIVE) {
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
canvas.circle(p_center.x, p_center.y,
projection.GeoToScreenDistance(oz.getRadius()));
}
break;
}
case ObservationZonePoint::BGA_START:
case ObservationZonePoint::SECTOR: {
const SectorZone &oz = (const SectorZone &)_oz;
if (layer != LAYER_INACTIVE) {
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
canvas.DrawSegment(p_center.x, p_center.y,
projection.GeoToScreenDistance(oz.getRadius()),
oz.getStartRadial() - projection.GetScreenAngle(),
oz.getEndRadial() - projection.GetScreenAngle());
RasterPoint p_start = projection.GeoToScreen(oz.get_SectorStart());
RasterPoint p_end = projection.GeoToScreen(oz.get_SectorEnd());
canvas.DrawTwoLines(p_start, p_center, p_end);
}
break;
}
case ObservationZonePoint::KEYHOLE:
case ObservationZonePoint::BGAFIXEDCOURSE:
case ObservationZonePoint::BGAENHANCEDOPTION: {
const SectorZone &oz = (const SectorZone &)_oz;
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
canvas.DrawKeyhole(p_center.x, p_center.y,
projection.GeoToScreenDistance(fixed(500)),
projection.GeoToScreenDistance(oz.getRadius()),
oz.getStartRadial() - projection.GetScreenAngle(),
oz.getEndRadial() - projection.GetScreenAngle());
break;
}
case ObservationZonePoint::ANNULAR_SECTOR: {
const AnnularSectorZone &oz = (const AnnularSectorZone &)_oz;
RasterPoint p_center = projection.GeoToScreen(oz.get_location());
canvas.DrawAnnulus(p_center.x, p_center.y,
projection.GeoToScreenDistance(oz.getInnerRadius()),
projection.GeoToScreenDistance(oz.getRadius()),
oz.getStartRadial() - projection.GetScreenAngle(),
oz.getEndRadial() - projection.GetScreenAngle());
}
}
Finish(canvas, layer);
}