m2::PointF LayerCacher::CacheRuler(Position const & position, ref_ptr<LayerRenderer> renderer, ref_ptr<dp::TextureManager> textures) { m2::PointF rulerSize; renderer->AddShapeRenderer(WIDGET_RULER, Ruler(position).Draw(rulerSize, textures)); return rulerSize; }
m2::PointF LayerCacher::CacheCopyright(Position const & position, ref_ptr<LayerRenderer> renderer, ref_ptr<dp::TextureManager> textures) { m2::PointF size; renderer->AddShapeRenderer(WIDGET_COPYRIGHT, CopyrightLabel(position).Draw(size, textures)); return size; }
m2::PointF LayerCacher::CacheCompass(Position const & position, ref_ptr<LayerRenderer> renderer, ref_ptr<dp::TextureManager> textures) { m2::PointF compassSize; Compass compass = Compass(position); drape_ptr<ShapeRenderer> shape = compass.Draw(compassSize, textures, bind(&DrapeGui::CallOnCompassTappedHandler, &DrapeGui::Instance())); renderer->AddShapeRenderer(WIDGET_COMPASS, move(shape)); return compassSize; }
m2::PointF LayerCacher::CacheScaleLabel(Position const & position, ref_ptr<LayerRenderer> renderer, ref_ptr<dp::TextureManager> textures) { MutableLabelDrawer::Params params; params.m_alphabet = "Scale: 1234567890"; params.m_maxLength = 10; params.m_anchor = position.m_anchor; params.m_font = DrapeGui::GetGuiTextFont(); params.m_pivot = position.m_pixelPivot; params.m_handleCreator = [textures](dp::Anchor, m2::PointF const &) { return make_unique_dp<ScaleLabelHandle>(EGuiHandle::GuiHandleScaleLabel, textures); }; drape_ptr<ShapeRenderer> scaleRenderer = make_unique_dp<ShapeRenderer>(); m2::PointF size = MutableLabelDrawer::Draw(params, textures, bind(&ShapeRenderer::AddShape, scaleRenderer.get(), _1, _2)); renderer->AddShapeRenderer(WIDGET_SCALE_LABEL, move(scaleRenderer)); return size; }