当前位置: 首页>>代码示例>>C++>>正文


C++ GeoBounds::GetSouthEast方法代码示例

本文整理汇总了C++中GeoBounds::GetSouthEast方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoBounds::GetSouthEast方法的具体用法?C++ GeoBounds::GetSouthEast怎么用?C++ GeoBounds::GetSouthEast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeoBounds的用法示例。


在下文中一共展示了GeoBounds::GetSouthEast方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:56,代码来源:GeoBitmapRenderer.cpp

示例2: FlatBoundingBox

FlatBoundingBox 
OrderedTask::GetBoundingBox(const GeoBounds &bounds) const
{
  if (!TaskSize()) {
    // undefined!
    return FlatBoundingBox(FlatGeoPoint(0,0),FlatGeoPoint(0,0));
  }

  FlatGeoPoint ll = task_projection.ProjectInteger(bounds.GetSouthWest());
  FlatGeoPoint lr = task_projection.ProjectInteger(bounds.GetSouthEast());
  FlatGeoPoint ul = task_projection.ProjectInteger(bounds.GetNorthWest());
  FlatGeoPoint ur = task_projection.ProjectInteger(bounds.GetNorthEast());
  FlatGeoPoint fmin(std::min(ll.longitude, ul.longitude),
                    std::min(ll.latitude, lr.latitude));
  FlatGeoPoint fmax(std::max(lr.longitude, ur.longitude),
                    std::max(ul.latitude, ur.latitude));
  // note +/- 1 to ensure rounding keeps bb valid 
  fmin.longitude -= 1; fmin.latitude -= 1;
  fmax.longitude += 1; fmax.latitude += 1;
  return FlatBoundingBox (fmin, fmax);
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:21,代码来源:OrderedTask.cpp


注:本文中的GeoBounds::GetSouthEast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。