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


C++ RectD::minX方法代码示例

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


在下文中一共展示了RectD::minX方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

string ToString<m2::RectD>(m2::RectD const & rect)
{
  ostringstream stream;
  stream.precision(12);
  stream << rect.minX() << " " << rect.minY() << " " << rect.maxX() << " " << rect.maxY();
  return stream.str();
}
开发者ID:milchakov,项目名称:omim,代码行数:7,代码来源:settings.cpp

示例2: drawRectangle

  void ShapeRenderer::drawRectangle(m2::RectD const & r, graphics::Color const & c, double depth)
  {
    uint32_t id = base_t::mapInfo(Brush::Info(c));
    Resource const * res = base_t::fromID(id);

    if (res == 0)
    {
      LOG(LDEBUG, ("cannot map color"));
      return;
    }

    m2::PointF rectPts[4] = {
      m2::PointF(r.minX(), r.minY()),
      m2::PointF(r.maxX(), r.minY()),
      m2::PointF(r.minX(), r.maxY()),
      m2::PointF(r.maxX(), r.maxY())
    };

    GeometryPipeline & p = pipeline(res->m_pipelineID);

    shared_ptr<gl::BaseTexture> texture = p.texture();

    if (!texture)
    {
      LOG(LDEBUG, ("returning as no texture is reserved"));
      return;
    }

    m2::PointF texPt = texture->mapPixel(m2::RectF(res->m_texRect).Center());

    m2::PointF normal(0, 0);

    addTexturedStripStrided(
          rectPts,
          sizeof(m2::PointF),
          &normal,
          0,
          &texPt,
          0,
          4,
          depth,
          res->m_pipelineID
          );
  }
开发者ID:morsya,项目名称:omim,代码行数:44,代码来源:shape_renderer.cpp

示例3: ScaleInto

ScreenBase const ScaleInto(ScreenBase const & screen, m2::RectD boundRect)
{
  ReduceRectHack(boundRect);

  ScreenBase res = screen;

  double scale = 1;

  m2::RectD clipRect = res.ClipRect();

  ASSERT(boundRect.IsPointInside(clipRect.Center()), ("center point should be inside boundRect"));

  if (clipRect.minX() < boundRect.minX())
  {
    double k = (boundRect.minX() - clipRect.Center().x) / (clipRect.minX() - clipRect.Center().x);
    scale /= k;
    clipRect.Scale(k);
  }
  if (clipRect.maxX() > boundRect.maxX())
  {
    double k = (boundRect.maxX() - clipRect.Center().x) / (clipRect.maxX() - clipRect.Center().x);
    scale /= k;
    clipRect.Scale(k);
  }
  if (clipRect.minY() < boundRect.minY())
  {
    double k = (boundRect.minY() - clipRect.Center().y) / (clipRect.minY() - clipRect.Center().y);
    scale /= k;
    clipRect.Scale(k);
  }
  if (clipRect.maxY() > boundRect.maxY())
  {
    double k = (boundRect.maxY() - clipRect.Center().y) / (clipRect.maxY() - clipRect.Center().y);
    scale /= k;
    clipRect.Scale(k);
  }

  res.Scale(scale);
  res.SetOrg(clipRect.Center());

  return res;
}
开发者ID:Mapotempo,项目名称:omim,代码行数:42,代码来源:screen_operations.cpp

示例4: ShrinkInto

ScreenBase const ShrinkInto(ScreenBase const & screen, m2::RectD boundRect)
{
  ReduceRectHack(boundRect);

  ScreenBase res = screen;

  m2::RectD clipRect = res.ClipRect();
  if (clipRect.minX() < boundRect.minX())
    clipRect.Offset(boundRect.minX() - clipRect.minX(), 0);
  if (clipRect.maxX() > boundRect.maxX())
    clipRect.Offset(boundRect.maxX() - clipRect.maxX(), 0);
  if (clipRect.minY() < boundRect.minY())
    clipRect.Offset(0, boundRect.minY() - clipRect.minY());
  if (clipRect.maxY() > boundRect.maxY())
    clipRect.Offset(0, boundRect.maxY() - clipRect.maxY());

  res.SetOrg(clipRect.Center());

  // This assert fails near x = 180 (Philipines).
  //ASSERT ( boundRect.IsRectInside(res.ClipRect()), (clipRect, res.ClipRect()) );
  return res;
}
开发者ID:Mapotempo,项目名称:omim,代码行数:22,代码来源:screen_operations.cpp

示例5: drawRoundedRectangle

  void ShapeRenderer::drawRoundedRectangle(m2::RectD const & r, double rad, graphics::Color const & c, double depth)
  {
    uint32_t id = base_t::mapInfo(Brush::Info(c));
    Resource const * res = base_t::fromID(id);

    if (res == 0)
    {
      LOG(LDEBUG, ("cannot map color"));
      return;
    }

    GeometryPipeline & p = pipeline(res->m_pipelineID);

    shared_ptr<gl::BaseTexture> texture = p.texture();

    if (!texture)
    {
      LOG(LDEBUG, ("returning as no texture is reserved"));
      return;
    }

    m2::PointF texPt = texture->mapPixel(m2::RectF(res->m_texRect).Center());

    vector<m2::PointD> seg00;
    vector<m2::PointD> seg10;
    vector<m2::PointD> seg11;
    vector<m2::PointD> seg01;

    approximateArc(m2::PointD(r.minX() + rad, r.minY() + rad),
                   math::pi,
                   3 * math::pi / 2,
                   rad,
                   seg00);

    approximateArc(m2::PointD(r.minX() + rad, r.maxY() - rad),
                   math::pi / 2,
                   math::pi,
                   rad,
                   seg01);

    approximateArc(m2::PointD(r.maxX() - rad, r.maxY() - rad),
                   0,
                   math::pi / 2,
                   rad,
                   seg11);

    approximateArc(m2::PointD(r.maxX() - rad, r.minY() + rad),
                   3 * math::pi / 2,
                   math::pi * 2,
                   rad,
                   seg10);

    vector<m2::PointF> pts;

    for (unsigned i = 0; i < seg11.size(); ++i)
      pts.push_back(m2::PointF(seg11[i]));

    for (unsigned i = 0; i < seg01.size(); ++i)
      pts.push_back(m2::PointF(seg01[i]));

    for (unsigned i = 0; i < seg00.size(); ++i)
      pts.push_back(m2::PointF(seg00[i]));

    for (unsigned i = 0; i < seg10.size(); ++i)
      pts.push_back(m2::PointF(seg10[i]));

    m2::PointF normal(0, 0);

    addTexturedFanStrided(
          &pts[0],
          sizeof(m2::PointF),
          &normal,
          0,
          &texPt,
          0,
          pts.size(),
          depth,
          res->m_pipelineID
          );
  }
开发者ID:morsya,项目名称:omim,代码行数:80,代码来源:shape_renderer.cpp

示例6: ShrinkAndScaleInto

ScreenBase const ShrinkAndScaleInto(ScreenBase const & screen, m2::RectD boundRect)
{
  ReduceRectHack(boundRect);

  ScreenBase res = screen;

  m2::RectD globalRect = res.ClipRect();

  m2::PointD newOrg = res.GetOrg();
  double scale = 1;
  double offs = 0;

  if (globalRect.minX() < boundRect.minX())
  {
    offs = boundRect.minX() - globalRect.minX();
    globalRect.Offset(offs, 0);
    newOrg.x += offs;

    if (globalRect.maxX() > boundRect.maxX())
    {
      double k = boundRect.SizeX() / globalRect.SizeX();
      scale /= k;
      /// scaling always occur pinpointed to the rect center...
      globalRect.Scale(k);
      /// ...so we should shift a rect after scale
      globalRect.Offset(boundRect.minX() - globalRect.minX(), 0);
    }
  }

  if (globalRect.maxX() > boundRect.maxX())
  {
    offs = boundRect.maxX() - globalRect.maxX();
    globalRect.Offset(offs, 0);
    newOrg.x += offs;

    if (globalRect.minX() < boundRect.minX())
    {
      double k = boundRect.SizeX() / globalRect.SizeX();
      scale /= k;
      globalRect.Scale(k);
      globalRect.Offset(boundRect.maxX() - globalRect.maxX(), 0);
    }
  }

  if (globalRect.minY() < boundRect.minY())
  {
    offs = boundRect.minY() - globalRect.minY();
    globalRect.Offset(0, offs);
    newOrg.y += offs;

    if (globalRect.maxY() > boundRect.maxY())
    {
      double k = boundRect.SizeY() / globalRect.SizeY();
      scale /= k;
      globalRect.Scale(k);
      globalRect.Offset(0, boundRect.minY() - globalRect.minY());
    }
  }

  if (globalRect.maxY() > boundRect.maxY())
  {
    offs = boundRect.maxY() - globalRect.maxY();
    globalRect.Offset(0, offs);
    newOrg.y += offs;

    if (globalRect.minY() < boundRect.minY())
    {
      double k = boundRect.SizeY() / globalRect.SizeY();
      scale /= k;
      globalRect.Scale(k);
      globalRect.Offset(0, boundRect.maxY() - globalRect.maxY());
    }
  }

  res.SetOrg(globalRect.Center());
  res.Scale(scale);

  return res;
}
开发者ID:Mapotempo,项目名称:omim,代码行数:79,代码来源:screen_operations.cpp


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