コード例 #1
0
ファイル: screen_animations.cpp プロジェクト: rokuz/omim
drape_ptr<SequenceAnimation> GetPrettyMoveAnimation(ScreenBase const & screen, double startScale, double endScale,
                                                    m2::PointD const & startPt, m2::PointD const & endPt)
{
  double const moveDuration = PositionInterpolator::GetMoveDuration(startPt, endPt, screen.PixelRectIn3d(), startScale);
  ASSERT_GREATER(moveDuration, 0.0, ());

  double const scaleFactor = moveDuration / kMaxAnimationTimeSec * 2.0;

  auto sequenceAnim = make_unique_dp<SequenceAnimation>();
  sequenceAnim->SetCustomType(kPrettyMoveAnim);

  auto zoomOutAnim = make_unique_dp<MapLinearAnimation>();
  zoomOutAnim->SetScale(startScale, startScale * scaleFactor);
  zoomOutAnim->SetMaxDuration(kMaxAnimationTimeSec * 0.5);

  //TODO (in future): Pass fixed duration instead of screen.
  auto moveAnim = make_unique_dp<MapLinearAnimation>();
  moveAnim->SetMove(startPt, endPt, screen);
  moveAnim->SetMaxDuration(kMaxAnimationTimeSec);

  auto zoomInAnim = make_unique_dp<MapLinearAnimation>();
  zoomInAnim->SetScale(startScale * scaleFactor, endScale);
  zoomInAnim->SetMaxDuration(kMaxAnimationTimeSec * 0.5);

  sequenceAnim->AddAnimation(move(zoomOutAnim));
  sequenceAnim->AddAnimation(move(moveAnim));
  sequenceAnim->AddAnimation(move(zoomInAnim));
  return sequenceAnim;
}
コード例 #2
0
ファイル: screenbase.cpp プロジェクト: MasoudAjorlo/omim
bool IsPanningAndRotate(ScreenBase const & s1, ScreenBase const & s2)
{
  m2::RectD const & r1 = s1.GlobalRect().GetLocalRect();
  m2::RectD const & r2 = s2.GlobalRect().GetLocalRect();

  m2::PointD c1 = r1.Center();
  m2::PointD c2 = r2.Center();

  m2::PointD globPt(c1.x - r1.minX(),
                    c1.y - r1.minY());

  m2::PointD p1 = s1.GtoP(s1.GlobalRect().ConvertFrom(c1)) - s1.GtoP(s1.GlobalRect().ConvertFrom(c1 + globPt));
  m2::PointD p2 = s2.GtoP(s2.GlobalRect().ConvertFrom(c2)) - s2.GtoP(s2.GlobalRect().ConvertFrom(c2 + globPt));

  return p1.EqualDxDy(p2, 0.00001);
}
コード例 #3
0
ファイル: screen_operations.cpp プロジェクト: Mapotempo/omim
bool CheckMinScale(ScreenBase const & screen)
{
  m2::RectD const & r = screen.ClipRect();
  m2::RectD const & worldR = df::GetWorldRect();

  return (r.SizeX() <= worldR.SizeX() || r.SizeY() <= worldR.SizeY());
}
コード例 #4
0
ファイル: arrow3d.cpp プロジェクト: trashkalmar/omim
void Arrow3d::Render(ScreenBase const & screen, int zoomLevel, ref_ptr<dp::GpuProgramManager> mng)
{
    // Unbind current VAO, because glVertexAttributePointer and glEnableVertexAttribute can affect it.
    if (dp::GLExtensionsList::Instance().IsSupported(dp::GLExtensionsList::VertexArrayObject))
        GLFunctions::glBindVertexArray(0);

    if (!m_isInitialized)
    {
        Build();
        m_isInitialized = true;
    }

    // Render shadow.
    if (screen.isPerspective())
    {
        ref_ptr<dp::GpuProgram> shadowProgram = mng->GetProgram(gpu::ARROW_3D_SHADOW_PROGRAM);
        RenderArrow(screen, shadowProgram, dp::Color(60, 60, 60, 60), 0.05f, false /* hasNormals */);
    }

    // Render arrow.
    ref_ptr<dp::GpuProgram> arrowProgram = mng->GetProgram(gpu::ARROW_3D_PROGRAM);
    dp::Color const color = df::GetColorConstant(GetStyleReader().GetCurrentStyle(),
                            m_obsoletePosition ? df::Arrow3DObsolete : df::Arrow3D);
    RenderArrow(screen, arrowProgram, color, 0.0f, true /* hasNormals */);

    arrowProgram->Unbind();
    GLFunctions::glBindBuffer(0, gl_const::GLArrayBuffer);
}
コード例 #5
0
ファイル: screen_operations.cpp プロジェクト: Mapotempo/omim
bool CheckBorders(ScreenBase const & screen)
{
  m2::RectD const & r = screen.ClipRect();
  m2::RectD const & worldR = df::GetWorldRect();

  return (r.IsRectInside(worldR) || worldR.IsRectInside(r));
}
コード例 #6
0
ファイル: navigator.cpp プロジェクト: morsya/omim
bool Navigator::CheckBorders(ScreenBase const & screen) const
{
  m2::RectD const & r = screen.ClipRect();
  m2::RectD const & worldR = m_scales.GetWorldRect();

  return (r.IsRectInside(worldR) || worldR.IsRectInside(r));
}
コード例 #7
0
ファイル: navigator.cpp プロジェクト: morsya/omim
bool Navigator::CheckMinScale(ScreenBase const & screen) const
{
  m2::RectD const & r = screen.ClipRect();
  m2::RectD const & worldR = m_scales.GetWorldRect();

  return (r.SizeX() <= worldR.SizeX() || r.SizeY() <= worldR.SizeY());
}
コード例 #8
0
ファイル: ImageArea.cpp プロジェクト: miabrahams/MPhoto
void ImageArea::onTimer( void )
{
    ScreenBase * w = getCurrentViewer();
    if ( w ) w->onTimer();
    if ( _hide_cursor_timer > 0 )
    {
        _hide_cursor_timer -= g_config.timer_duration;
        if ( _hide_cursor_timer <= 0 )
        {
            _hide_cursor_timer = 0;
            emit hideCursor();
        }
    }

    _cleanOldViewers();
}
コード例 #9
0
ファイル: navigator.cpp プロジェクト: 65apps/omim
void Navigator::SetFromRect(m2::AnyRectD const & r, uint32_t tileSize, double visualScale)
{
  m2::RectD const & worldR = df::GetWorldRect();

  ScreenBase tmp = m_Screen;

  tmp.SetFromRect(r);
  tmp = ScaleInto(tmp, worldR);
  if (!CheckMaxScale(tmp, tileSize, visualScale))
  {
    int const scale = scales::GetUpperStyleScale() - 1;
    m2::RectD newRect = df::GetRectForDrawScale(scale, r.Center());
    CheckMinMaxVisibleScale(newRect, scale);
    tmp = m_Screen;
    tmp.SetFromRect(m2::AnyRectD(newRect));
    ASSERT(CheckMaxScale(tmp, tileSize, visualScale), ());
  }
コード例 #10
0
ファイル: my_position.cpp プロジェクト: rokuz/omim
void MyPosition::RenderAccuracy(ScreenBase const & screen, int zoomLevel,
                                ref_ptr<dp::GpuProgramManager> mng,
                                dp::UniformValuesStorage const & commonUniforms)
{
  dp::UniformValuesStorage uniforms = commonUniforms;
  m2::PointD accuracyPoint(m_position.x + m_accuracy, m_position.y);
  float pixelAccuracy = (screen.GtoP(accuracyPoint) - screen.GtoP(m_position)).Length();

  TileKey const key = GetTileKeyByPoint(m_position, ClipTileZoomByMaxDataZoom(zoomLevel));
  math::Matrix<float, 4, 4> mv = key.GetTileBasedModelView(screen);
  uniforms.SetMatrix4x4Value("modelView", mv.m_data);

  m2::PointD const pos = MapShape::ConvertToLocal(m_position, key.GetGlobalRect().Center(), kShapeCoordScalar);
  uniforms.SetFloatValue("u_position", pos.x, pos.y, 0.0f);
  uniforms.SetFloatValue("u_accuracy", pixelAccuracy);
  uniforms.SetFloatValue("u_opacity", 1.0f);
  RenderPart(mng, uniforms, MY_POSITION_ACCURACY);
}
コード例 #11
0
ファイル: render_group.cpp プロジェクト: ElderOrb/omim
void BaseRenderGroup::Render(const ScreenBase & screen)
{
  ref_ptr<dp::GpuProgram> shader = screen.isPerspective() ? m_shader3d : m_shader;
  ASSERT(shader != nullptr, ());
  ASSERT(m_generalUniforms != nullptr, ());

  shader->Bind();
  dp::ApplyState(m_state, shader);
  dp::ApplyUniforms(*(m_generalUniforms.get()), shader);
}
コード例 #12
0
ファイル: ImageArea.cpp プロジェクト: miabrahams/MPhoto
void ImageArea::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);

    if( !_enlarge_timer.isActive() && !_reduce_timer.isActive() )
    {
        if ( g_config.smooth_images )
        {
            painter.setRenderHint(QPainter::SmoothPixmapTransform);
            painter.setRenderHint(QPainter::Antialiasing);
        }
    }

    const QRect rect = event->rect();
    painter.fillRect( rect, g_config.background_color );
    double fitZoom = _image_viewer.computeCurrentFitZoom();
    double zoom = _image_viewer.getZoom();
    double zoomRatio = zoom/fitZoom;
    if(!_front_viewer && !_dir_view && zoomRatio < 0.70 &&
       (_enlarge_timer.isActive() || _reduce_timer.isActive() || _image_viewer.isBeingPinchZoomed() )  )
    {
        double transparency = (zoomRatio-_thumb_zoom/fitZoom)/(0.70-_thumb_zoom/fitZoom);
        QTransform transform;
        double zoom = 1.0+0.2*transparency;
        transform.scale(zoom,zoom);
        transform.translate(this->width()*(1.0-zoom)/2.0,this->height()*(1.0-zoom)/2.0);
        painter.setTransform(transform);
        _dir_viewer.onPaint( painter );
        painter.resetTransform();
        QColor c = g_config.background_color;
        if(transparency > 0.01)
        {
            c.setAlphaF(transparency);
            painter.fillRect( rect, c );
            //painter.setOpacity(transparency);
            _image_viewer.onPaint( painter );
        }
    } else {
        ScreenBase * w = getCurrentViewer();
        if ( w ) w->onPaint( painter );
    }
}
コード例 #13
0
ファイル: screen_operations.cpp プロジェクト: Mapotempo/omim
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;
}
コード例 #14
0
m2::PointD OverlayHandle::GetPivot(ScreenBase const & screen, bool perspective) const
{
  m2::RectD r = GetPixelRect(screen, false);
  m2::PointD size(0.5 * r.SizeX(), 0.5 * r.SizeY());
  m2::PointD result = r.Center();

  if (m_anchor & dp::Left)
    result.x -= size.x;
  else if (m_anchor & dp::Right)
    result.x += size.x;

  if (m_anchor & dp::Top)
    result.y -= size.y;
  else if (m_anchor & dp::Bottom)
    result.y += size.y;

  if (perspective)
    result = screen.PtoP3d(result, -m_pivotZ / screen.GetScale());

  return result;
}
コード例 #15
0
ファイル: screen_operations.cpp プロジェクト: Mapotempo/omim
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;
}
コード例 #16
0
ファイル: my_position.cpp プロジェクト: 65apps/omim
void MyPosition::RenderMyPosition(ScreenBase const & screen,
                                  ref_ptr<dp::GpuProgramManager> mng,
                                  dp::UniformValuesStorage const & commonUniforms)
{
  if (screen.isPerspective() && m_isRoutingMode && m_showAzimuth)
  {
    m_arrow3d.SetPosition(m_position);
    m_arrow3d.SetAzimuth(m_azimuth);

    m_arrow3d.Render(screen, mng);
  }
  else
  {
    dp::UniformValuesStorage uniforms = commonUniforms;
    uniforms.SetFloatValue("u_position", m_position.x, m_position.y, dp::depth::MY_POSITION_MARK);
    uniforms.SetFloatValue("u_azimut", -(m_azimuth + screen.GetAngle()));
    uniforms.SetFloatValue("u_opacity", 1.0);
    RenderPart(mng, uniforms, (m_showAzimuth == true) ?
                              (m_obsoletePosition ? MY_POSITION_ARROW_GRAY : MY_POSITION_ARROW) :
                              MY_POSITION_POINT);
  }
}
コード例 #17
0
ファイル: selection_shape.cpp プロジェクト: AndrOrt/omim
void SelectionShape::Render(ScreenBase const & screen, ref_ptr<dp::GpuProgramManager> mng,
                            dp::UniformValuesStorage const & commonUniforms)
{
  ShowHideAnimation::EState state = m_animation.GetState();
  if (state == ShowHideAnimation::STATE_VISIBLE ||
      state == ShowHideAnimation::STATE_SHOW_DIRECTION)
  {
    dp::UniformValuesStorage uniforms = commonUniforms;
    uniforms.SetFloatValue("u_position", m_position.x, m_position.y, -m_positionZ);

    float accuracy = m_mapping.GetValue(m_animation.GetT());
    if (screen.isPerspective())
    {
      m2::PointD const pt1 = screen.GtoP(m_position);
      m2::PointD const pt2(pt1.x + 1, pt1.y);
      float const scale = screen.PtoP3d(pt2).x - screen.PtoP3d(pt1).x;
      accuracy /= scale;
    }
    uniforms.SetFloatValue("u_accuracy", accuracy);
    uniforms.SetFloatValue("u_opacity", 1.0f);
    m_renderNode->Render(mng, uniforms);
  }
}
コード例 #18
0
ファイル: animation.cpp プロジェクト: milchakov/omim
// static
void Animation::GetCurrentScreen(TPropertyCache const & properties, ScreenBase const & screen, ScreenBase & currentScreen)
{
  currentScreen = screen;

  if (!properties.empty())
  {
    double scale = currentScreen.GetScale();
    double angle = currentScreen.GetAngle();
    m2::PointD pos = currentScreen.GlobalRect().GlobalZero();

    PropertyValue value;
    if (GetCachedProperty(properties, Object::MapPlane, ObjectProperty::Scale, value))
      scale = value.m_valueD;

    if (GetCachedProperty(properties, Object::MapPlane, ObjectProperty::Angle, value))
      angle = value.m_valueD;

    if (GetCachedProperty(properties, Object::MapPlane, ObjectProperty::Position, value))
      pos = value.m_valuePointD;

    currentScreen.SetFromParams(pos, angle, scale);
  }
}
コード例 #19
0
ファイル: navigator.cpp プロジェクト: morsya/omim
bool Navigator::ScaleImpl(m2::PointD const & newPt1, m2::PointD const & newPt2,
                          m2::PointD const & oldPt1, m2::PointD const & oldPt2,
                          bool skipMinScaleAndBordersCheck,
                          bool doRotateScreen)
{
  math::Matrix<double, 3, 3> newM = m_Screen.GtoPMatrix() * ScreenBase::CalcTransform(oldPt1, oldPt2, newPt1, newPt2);

  double oldAngle = m_Screen.GetAngle();
  ScreenBase tmp = m_Screen;
  tmp.SetGtoPMatrix(newM);
  if (!doRotateScreen)
    tmp.Rotate(-(tmp.GetAngle() - oldAngle));

  if (!skipMinScaleAndBordersCheck && !CheckMinScale(tmp))
    return false;

  m2::RectD const & worldR = m_scales.GetWorldRect();

  if (!skipMinScaleAndBordersCheck && !CheckBorders(tmp))
  {
    if (CanShrinkInto(tmp, worldR))
      tmp = ShrinkInto(tmp, worldR);
    else
      return false;
  }

  if (!CheckMaxScale(tmp))
    return false;

  // re-checking the borders, as we might violate them a bit (don't know why).
  if (!CheckBorders(tmp))
    tmp = ScaleInto(tmp, worldR);

  m_Screen = tmp;
  return true;
}
コード例 #20
0
ファイル: my_position.cpp プロジェクト: rokuz/omim
void MyPosition::RenderMyPosition(ScreenBase const & screen, int zoomLevel,
                                  ref_ptr<dp::GpuProgramManager> mng,
                                  dp::UniformValuesStorage const & commonUniforms)
{
  if (m_showAzimuth)
  {
    m_arrow3d.SetPosition(m_position);
    m_arrow3d.SetAzimuth(m_azimuth);
    m_arrow3d.Render(screen, zoomLevel, mng);
  }
  else
  {
    dp::UniformValuesStorage uniforms = commonUniforms;
    TileKey const key = GetTileKeyByPoint(m_position, ClipTileZoomByMaxDataZoom(zoomLevel));
    math::Matrix<float, 4, 4> mv = key.GetTileBasedModelView(screen);
    uniforms.SetMatrix4x4Value("modelView", mv.m_data);

    m2::PointD const pos = MapShape::ConvertToLocal(m_position, key.GetGlobalRect().Center(), kShapeCoordScalar);
    uniforms.SetFloatValue("u_position", pos.x, pos.y, dp::depth::MY_POSITION_MARK);
    uniforms.SetFloatValue("u_azimut", -(m_azimuth + screen.GetAngle()));
    uniforms.SetFloatValue("u_opacity", 1.0);
    RenderPart(mng, uniforms, MY_POSITION_POINT);
  }
}
コード例 #21
0
bool MapFollowAnimation::GetProperty(TObject object, TProperty property, bool targetValue, PropertyValue & value) const
{
  if (property == Animation::Position)
  {
    ScreenBase tmp = AnimationSystem::Instance().GetLastScreen();
    if (targetValue)
    {
      tmp.SetFromParams(m_globalPosition, m_angleInterpolator.GetTargetAngle(), m_isAutoZoom ? m_scaleInterpolator.GetScale()
                                                                                             : m_scaleInterpolator.GetTargetScale());
      tmp.MatchGandP3d(m_globalPosition, m_endPixelPosition);
    }
    else
    {
      double const scale = m_scaleInterpolator.GetScale() / m_scaleInterpolator.GetStartScale();
      double const angle = m_angleInterpolator.GetAngle() - m_angleInterpolator.GetStartAngle();
      m2::PointD offset = m_offsetInterpolator.GetPosition() * scale;
      offset.Rotate(angle);
      m2::PointD pos = m_globalPosition + offset;

      tmp.SetFromParams(m_globalPosition, m_angleInterpolator.GetAngle(), m_scaleInterpolator.GetScale());
      tmp.MatchGandP3d(pos, m_endPixelPosition);
    }
    value = PropertyValue(tmp.GetOrg());
    return true;
  }
  if (property == Animation::Angle)
  {
    value = PropertyValue(targetValue ? m_angleInterpolator.GetTargetAngle() : m_angleInterpolator.GetAngle());
    return true;
  }
  if (property == Animation::Scale)
  {
    value = PropertyValue((targetValue && !m_isAutoZoom) ? m_scaleInterpolator.GetTargetScale()
                                                         : m_scaleInterpolator.GetScale());
    return true;
  }
  ASSERT(false, ("Wrong property:", property));
  return false;
}
コード例 #22
0
ファイル: ImageArea.cpp プロジェクト: miabrahams/MPhoto
void ImageArea::onKeyPress( QKeyEvent * event )
{
    ScreenBase * w = getCurrentViewer();
    if ( w ) w->onKeyPress( event );
}
コード例 #23
0
ファイル: screen_animations.cpp プロジェクト: milchakov/omim
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,
                                                       targetScale, targetAngle,
                                                       false /* isAutoZoom */);
  followAnim->SetMaxDuration(kMaxAnimationTimeSec * 0.5);
  sequenceAnim->AddAnimation(move(followAnim));
  return sequenceAnim;
}
コード例 #24
0
ファイル: framework.hpp プロジェクト: NoraBunch/omim
 inline m2::PointD GtoP(m2::PointD const & p) const { return m_currentModelView.GtoP(p); }
コード例 #25
0
ファイル: framework.hpp プロジェクト: NoraBunch/omim
 /// @name Manipulating with model view
 //@{
 inline m2::PointD PtoG(m2::PointD const & p) const { return m_currentModelView.PtoG(p); }
コード例 #26
0
ファイル: read_manager.cpp プロジェクト: alexz89ua/omim
bool ReadManager::MustDropAllTiles(ScreenBase const & screen) const
{
  int const oldScale = df::GetDrawTileScale(m_currentViewport);
  int const newScale = df::GetDrawTileScale(screen);
  return (oldScale != newScale) || !m_currentViewport.GlobalRect().IsIntersect(screen.GlobalRect());
}
コード例 #27
0
ファイル: user_event_stream.cpp プロジェクト: 65apps/omim
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());
}
コード例 #28
0
ファイル: ScreenConfig.cpp プロジェクト: mrogowski/calvr
bool ScreenConfig::makeScreens()
{
    // make screens
    for(int i = 0; i < _screenInfoList.size(); i++)
    {
        ScreenBase * screen = NULL;

        if(_screenInfoList[i]->myChannel->stereoMode == "MONO")
        {
            screen = new ScreenMono();
            screen->_myInfo = _screenInfoList[i];
            screen->init(ScreenMono::CENTER);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "LEFT")
        {
            //screen = new ScreenMono();
            screen = new ScreenStereo();
            screen->_myInfo = _screenInfoList[i];
            //screen->init(ScreenMono::LEFT);
            screen->init(osg::DisplaySettings::LEFT_EYE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "RIGHT")
        {
            //screen = new ScreenMono();
            screen = new ScreenStereo();
            screen->_myInfo = _screenInfoList[i];
            //screen->init(ScreenMono::RIGHT);
            screen->init(osg::DisplaySettings::RIGHT_EYE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode
                == "HORIZONTAL_INTERLACE")
        {
            screen = new ScreenStereo();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::HORIZONTAL_INTERLACE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode
                == "VERTICAL_INTERLACE")
        {
            screen = new ScreenStereo();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::VERTICAL_INTERLACE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "VERTICAL_SPLIT")
        {
            screen = new ScreenStereo();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::VERTICAL_SPLIT);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "HORIZONTAL_SPLIT")
        {
            screen = new ScreenStereo();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::HORIZONTAL_SPLIT);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "ANAGLYPHIC")
        {
            screen = new ScreenStereo();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::ANAGLYPHIC);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "CHECKERBOARD")
        {
            screen = new ScreenStereo();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::CHECKERBOARD);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "QUAD_BUFFER")
        {
            screen = new ScreenStereo();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::QUAD_BUFFER);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "MULTI_VIEWER")
        {
            screen = new ScreenMVStencil();
            screen->_myInfo = _screenInfoList[i];
            screen->init();
        }
        else if(_screenInfoList[i]->myChannel->stereoMode
                == "MULTI_VIEWER_LEFT")
        {
            screen = new ScreenMVStencil();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::LEFT_EYE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode
                == "MULTI_VIEWER_RIGHT")
        {
            screen = new ScreenMVStencil();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::RIGHT_EYE);
        }
#ifdef WITH_SCREEN_MULTI_VIEWER
        else if(_screenInfoList[i]->myChannel->stereoMode == "MULTI_VIEWER_AP")
        {
            screen = new ScreenMVShader();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::LEFT_EYE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "MULTI_VIEWER_AP_LEFT")
        {
            screen = new ScreenMVShader();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::LEFT_EYE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "MULTI_VIEWER_AP_RIGHT")
        {
            screen = new ScreenMVShader();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::RIGHT_EYE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "MULTI_VIEWER_AP_HORIZONTAL_INTERLACE")
        {
            screen = new ScreenMVShader();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::HORIZONTAL_INTERLACE);
        }
#endif
        else if(_screenInfoList[i]->myChannel->stereoMode
                == "MULTI_VIEWER_2_LEFT")
        {
            screen = new ScreenMVZones();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::LEFT_EYE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode
                == "MULTI_VIEWER_2_RIGHT")
        {
            screen = new ScreenMVZones();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::RIGHT_EYE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode
                == "MULTI_VIEWER_2_HORIZONTAL_INTERLACE")
        {
            screen = new ScreenMVZones();
            screen->_myInfo = _screenInfoList[i];
            screen->init(osg::DisplaySettings::HORIZONTAL_INTERLACE);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode
                == "MULTI_VIEWER_MASTER")
        {
            screen = new ScreenMVMaster();
            screen->_myInfo = _screenInfoList[i];
            screen->init();
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "FIXED_VIEWER")
        {
            screen = new ScreenFixedViewer();
            screen->_myInfo = _screenInfoList[i];
            screen->init();
        }
        else if(_screenInfoList[i]->myChannel->stereoMode == "HMD")
        {
            screen = new ScreenHMD();
            screen->_myInfo = _screenInfoList[i];
            screen->init(-1);
        }
        else if(_screenInfoList[i]->myChannel->stereoMode
                == "INTERLACED_TOP_BOTTOM")
        {
            screen = new ScreenInterlacedTopBottom();
            screen->_myInfo = _screenInfoList[i];
            screen->init();
        }
#ifdef WITH_INTERLEAVER
        else if(_screenInfoList[i]->myChannel->stereoMode == "LENTICULAR")
        {
            screen = new ScreenLenticular();
            screen->_myInfo = _screenInfoList[i];
            screen->init();
        }
#endif

        if(screen)
        {
            _screenList.push_back(screen);
        }
        else
        {
            std::cerr << "No Screen type matching stereo mode: "
                    << _screenInfoList[i]->myChannel->stereoMode << std::endl;
            return false;
        }
    }
    return true;
}
コード例 #29
0
ファイル: tile_key.cpp プロジェクト: Mapotempo/omim
math::Matrix<float, 4, 4> TileKey::GetTileBasedModelView(ScreenBase const & screen) const
{
  return screen.GetModelView(GetGlobalRect().Center(), kShapeCoordScalar);
}
コード例 #30
0
ファイル: ImageArea.cpp プロジェクト: miabrahams/MPhoto
void ImageArea::onWheel( QWheelEvent * event )
{
    ScreenBase * w = getCurrentViewer();
    if ( w ) w->onWheel( event );
}