• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ m2::RectD类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了RectD类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: ToRotated

m2::AnyRectD ToRotated(m2::RectD const & rect, Navigator const & navigator)
{
  double const dx = rect.SizeX();
  double const dy = rect.SizeY();

  return m2::AnyRectD(rect.Center(),
                      navigator.Screen().GetAngle(),
                      m2::RectD(-dx/2, -dy/2, dx/2, dy/2));
}
开发者ID:morsya,项目名称:omim,代码行数:9,代码来源:navigator_utils.cpp


示例3: ClipSplineByRect

vector<m2::SharedSpline> ClipSplineByRect(m2::RectD const & rect, m2::SharedSpline const & spline)
{
  vector<m2::SharedSpline> result;

  vector<m2::PointD> const & path = spline->GetPath();
  if (path.size() < 2)
    return result;

  m2::RectD splineRect;
  for (m2::PointD const & p : path)
    splineRect.Add(p);

  // Check for spline is inside.
  if (rect.IsRectInside(splineRect))
  {
    result.push_back(spline);
    return result;
  }

  // Check for spline is outside.
  if (!rect.IsIntersect(splineRect))
    return result;

  // Divide spline into parts.
  result.reserve(2);
  m2::PointD p1, p2;
  int code1 = 0;
  int code2 = 0;
  m2::SharedSpline s;
  s.Reset(new m2::Spline(path.size()));

  for (size_t i = 0; i < path.size() - 1; i++)
  {
    p1 = path[i];
    p2 = path[i + 1];
    if (m2::Intersect(rect, p1, p2, code1, code2))
    {
      if ((p1 - p2).IsAlmostZero())
        continue;

      if (s.IsNull())
        s.Reset(new m2::Spline(path.size() - i));

      s->AddPoint(p1);
      if (code2 != 0 || i + 2 == path.size())
      {
        s->AddPoint(p2);
        result.push_back(s);
        s.Reset(nullptr);
      }
    }
  }
  return result;
}
开发者ID:65apps,项目名称:omim,代码行数:54,代码来源:clipping.cpp


示例4: SetFromRects

void ScreenBase::SetFromRects(m2::AnyRectD const & glbRect, m2::RectD const & pxRect)
{
  double hScale = glbRect.GetLocalRect().SizeX() / pxRect.SizeX();
  double vScale = glbRect.GetLocalRect().SizeY() / pxRect.SizeY();

  m_Scale = max(hScale, vScale);
  m_Angle = glbRect.Angle();
  m_Org = glbRect.GlobalCenter();

  UpdateDependentParameters();
}
开发者ID:MasoudAjorlo,项目名称:omim,代码行数:11,代码来源:screenbase.cpp


示例5: CalcLimitRect

void Framework::ShowNode(TCountryId const & idx, bool zoomToDownloadButton)
{
  if (zoomToDownloadButton)
  {
    m2::RectD const rect = CalcLimitRect(idx, m_work.GetStorage(), m_work.GetCountryInfoGetter());
    m_work.SetViewportCenter(rect.Center(), 10);
  }
  else
  {
    m_work.ShowNode(idx);
  }
}
开发者ID:bykoianko,项目名称:omim,代码行数:12,代码来源:Framework.cpp


示例6: Init

  void Init()
  {
    m_depthLayer = m_f.GetLayer();
    if (m_depthLayer == feature::LAYER_TRANSPARENT_TUNNEL)
      m_depthLayer = feature::LAYER_EMPTY;

    if (m_geomType == feature::GEOM_POINT)
      m_priorityModifier = (double)m_f.GetPopulation() / 7E9;
    else
    {
      m2::RectD const r = m_f.GetLimitRect(m_zoomLevel);
      m_priorityModifier = min(1.0, r.SizeX() * r.SizeY() * 10000.0);
    }
  }
开发者ID:morsya,项目名称:omim,代码行数:14,代码来源:stylist.cpp


示例7: SetRankPivot

void Engine::SetRankPivot(SearchParams const & params, m2::RectD const & viewport,
                          bool viewportSearch, Query & processor)
{
  if (!viewportSearch && params.IsValidPosition())
  {
    m2::PointD const pos = MercatorBounds::FromLatLon(params.m_lat, params.m_lon);
    if (m2::Inflate(viewport, viewport.SizeX() / 4.0, viewport.SizeY() / 4.0).IsPointInside(pos))
    {
      processor.SetRankPivot(pos);
      return;
    }
  }

  processor.SetRankPivot(viewport.Center());
}
开发者ID:65apps,项目名称:omim,代码行数:15,代码来源:search_engine.cpp


示例8: IsIntersectedByRegionImpl

vector<TCountryId> CountryInfoGetter::GetRegionsCountryIdByRect(m2::RectD const & rect) const
{
  size_t constexpr kAverageSize = 10;

  vector<TCountryId> result;
  result.reserve(kAverageSize);
  for (size_t id = 0; id < m_countries.size(); ++id)
  {
    if (rect.IsRectInside(m_countries[id].m_rect) ||
        (rect.IsIntersect(m_countries[id].m_rect) && IsIntersectedByRegionImpl(id, rect)))
    {
      result.push_back(m_countries[id].m_countryId);
    }
  }
  return result;
}
开发者ID:Mapotempo,项目名称:omim,代码行数:16,代码来源:country_info_getter.cpp


示例9: CalculateCenter

m2::PointD CalculateCenter(double scale, m2::RectD const & pixelRect,
                           m2::PointD const & userPos, m2::PointD const & pixelPos,
                           double azimuth)
{
  m2::PointD formingVector = (pixelRect.Center() - pixelPos) * scale;
  formingVector.y = -formingVector.y;
  formingVector.Rotate(azimuth);
  return userPos + formingVector;
}
开发者ID:Mapotempo,项目名称:omim,代码行数:9,代码来源:screen_operations.cpp


示例10: GetPrettyFollowAnimation

drape_ptr<SequenceAnimation> GetPrettyFollowAnimation(ScreenBase const & startScreen, m2::PointD const & userPos, double targetScale,
                                                      double targetAngle, m2::PointD const & endPixelPos)
{
  auto sequenceAnim = make_unique_dp<SequenceAnimation>();
  sequenceAnim->SetCustomType(kPrettyFollowAnim);

  m2::RectD const viewportRect = startScreen.PixelRectIn3d();

  ScreenBase tmp = startScreen;
  tmp.SetAngle(targetAngle);
  tmp.MatchGandP3d(userPos, viewportRect.Center());

  double const moveDuration = PositionInterpolator::GetMoveDuration(startScreen.GetOrg(), tmp.GetOrg(), startScreen);
  ASSERT_GREATER(moveDuration, 0.0, ());

  double const scaleFactor = moveDuration / kMaxAnimationTimeSec * 2.0;

  tmp = startScreen;

  if (moveDuration > 0.0)
  {
    tmp.SetScale(startScreen.GetScale() * scaleFactor);

    auto zoomOutAnim = make_unique_dp<MapLinearAnimation>();
    zoomOutAnim->SetScale(startScreen.GetScale(), tmp.GetScale());
    zoomOutAnim->SetMaxDuration(kMaxAnimationTimeSec * 0.5);
    sequenceAnim->AddAnimation(move(zoomOutAnim));

    tmp.MatchGandP3d(userPos, viewportRect.Center());

    auto moveAnim = make_unique_dp<MapLinearAnimation>();
    moveAnim->SetMove(startScreen.GetOrg(), tmp.GetOrg(), viewportRect, tmp.GetScale());
    moveAnim->SetMaxDuration(kMaxAnimationTimeSec);
    sequenceAnim->AddAnimation(move(moveAnim));
  }

  auto followAnim = make_unique_dp<MapFollowAnimation>(tmp, userPos, endPixelPos,
                                                       tmp.GetScale(), targetScale,
                                                       tmp.GetAngle(), targetAngle,
                                                       false /* isAutoZoom */);
  followAnim->SetMaxDuration(kMaxAnimationTimeSec * 0.5);
  sequenceAnim->AddAnimation(move(followAnim));
  return sequenceAnim;
}
开发者ID:rokuz,项目名称:omim,代码行数:44,代码来源:screen_animations.cpp


示例11: 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


示例12: OnResize

void FrontendRenderer::OnResize(ScreenBase const & screen)
{
  m2::RectD const viewportRect = screen.isPerspective() ? screen.PixelRectIn3d() : screen.PixelRect();

  m_myPositionController->UpdatePixelPosition(screen);
  m_myPositionController->OnNewPixelRect();

  m_viewport.SetViewport(0, 0, viewportRect.SizeX(), viewportRect.SizeY());
  m_contextFactory->getDrawContext()->resize(viewportRect.SizeX(), viewportRect.SizeY());
  RefreshProjection(screen);
  RefreshPivotTransform(screen);

  m_framebuffer->SetSize(viewportRect.SizeX(), viewportRect.SizeY());
}
开发者ID:vmatelsky,项目名称:omim,代码行数:14,代码来源:frontend_renderer.cpp


示例13: ForEachFeatureInMwmRectAndScale

void Editor::ForEachFeatureInMwmRectAndScale(MwmSet::MwmId const & id,
        TFeatureTypeFunctor const & f,
        m2::RectD const & rect,
        uint32_t /*scale*/)
{
    auto mwmFound = m_features.find(id);
    if (mwmFound == m_features.end())
        return;

    // TODO(AlexZ): Check that features are visible at this scale.
    // Process only new (created) features.
    for (auto & index : mwmFound->second)
    {
        FeatureTypeInfo & ftInfo = index.second;
        if (ftInfo.m_status == FeatureStatus::Created &&
                rect.IsPointInside(ftInfo.m_feature.GetCenter()))
            f(ftInfo.m_feature);
    }
}
开发者ID:rokuz,项目名称:omim,代码行数:19,代码来源:osm_editor.cpp


示例14: 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


示例15: 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


示例16: CalculateScale

double CalculateScale(ScreenBase const & screen, m2::RectD const & localRect)
{
  m2::RectD const pixelRect = screen.PixelRect();
  return max(localRect.SizeX() / pixelRect.SizeX(), localRect.SizeY() / pixelRect.SizeY());
}
开发者ID:65apps,项目名称:omim,代码行数:5,代码来源:user_event_stream.cpp


示例17: Move

void Navigator::Move(double azDir, double factor)
{
  m2::RectD const r = m_Screen.ClipRect();
  m_Screen.MoveG(m2::PointD(r.SizeX() * factor * cos(azDir), r.SizeY() * factor * sin(azDir)));
}
开发者ID:morsya,项目名称:omim,代码行数:5,代码来源:navigator.cpp


示例18: 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


示例19: GetTileScaleBase

int GetTileScaleBase(m2::RectD const & r)
{
  double const sz = max(r.SizeX(), r.SizeY());
  return max(1, my::rounds(log((MercatorBounds::maxX - MercatorBounds::minX) / sz) / log(2.0)));
}
开发者ID:nteplov,项目名称:omim,代码行数:5,代码来源:visual_params.cpp


示例20: CalculateScale

double CalculateScale(m2::RectD const & pixelRect, m2::RectD const & localRect)
{
  return max(localRect.SizeX() / pixelRect.SizeX(), localRect.SizeY() / pixelRect.SizeY());
}
开发者ID:Mapotempo,项目名称:omim,代码行数:4,代码来源:screen_operations.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ machinebasicblock::const_instr_iterator类代码示例发布时间:2022-05-31
下一篇:
C++ luaplus::LuaObject类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap