diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 8a7d2f43a3..9e735b2d6d 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -40,7 +40,7 @@ LOCAL_CPP_FEATURES += exceptions rtti LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../ LOCAL_MODULE := mapswithme -LOCAL_STATIC_LIBRARIES := map render gui routing search storage indexer graphics platform anim geometry coding base expat freetype fribidi minizip jansson tomcrypt protobuf osrm stats_client succinct opening_hours +LOCAL_STATIC_LIBRARIES := map drape_frontend routing search storage indexer drape platform anim geometry coding base expat freetype fribidi minizip jansson tomcrypt protobuf osrm stats_client succinct opening_hours LOCAL_CFLAGS := -ffunction-sections -fdata-sections -Wno-extern-c-compat ifneq ($(NDK_DEBUG),1) diff --git a/drape_head/testing_engine.cpp b/drape_head/testing_engine.cpp index 17e89f10c5..d680ceca88 100644 --- a/drape_head/testing_engine.cpp +++ b/drape_head/testing_engine.cpp @@ -251,12 +251,13 @@ private: TestingEngine::TestingEngine(dp::RefPointer oglcontextfactory, Viewport const & viewport, - MapDataProvider const & model) + MapDataProvider const & model, + double vs) : m_contextFactory(oglcontextfactory) , m_viewport(viewport) { GLFunctions::Init(); - df::VisualParams::Init(viewport.GetPixelRatio(), df::CalculateTileSize(viewport.GetWidth(), viewport.GetHeight())); + df::VisualParams::Init(vs, df::CalculateTileSize(viewport.GetWidth(), viewport.GetHeight())); m_contextFactory->getDrawContext()->makeCurrent(); dp::TextureManager::Params params; diff --git a/drape_head/testing_engine.hpp b/drape_head/testing_engine.hpp index 7593dfd12f..5d046cb7ec 100644 --- a/drape_head/testing_engine.hpp +++ b/drape_head/testing_engine.hpp @@ -23,7 +23,8 @@ class TestingEngine : public QObject public: TestingEngine(dp::RefPointer oglcontextfactory, Viewport const & viewport, - MapDataProvider const & model); + MapDataProvider const & model, + double vs); ~TestingEngine(); void Draw(); diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index c882518c73..0369e1a5d6 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -414,7 +414,7 @@ void BookmarkManager::UserMarksReleaseController(UserMarksController & controlle FindUserMarksContainer(controller.GetType())->ReleaseController(); } -void BookmarkManager::SetRouteTrack(Track & track) +void BookmarkManager::SetRouteTrack(RouteTrack & track) { m_routeTrack.reset(); m_routeTrack.reset(track.CreatePersistent()); diff --git a/map/bookmark_manager.hpp b/map/bookmark_manager.hpp index 83783a0057..b3f3b8dd75 100644 --- a/map/bookmark_manager.hpp +++ b/map/bookmark_manager.hpp @@ -1,7 +1,9 @@ #pragma once + #include "map/bookmark.hpp" #include "map/route_track.hpp" #include "map/user_mark_container.hpp" +#include "map/route_track.hpp" #include "std/function.hpp" #include "std/unique_ptr.hpp" diff --git a/map/route_track.cpp b/map/route_track.cpp index b34f670ac8..1030186d45 100644 --- a/map/route_track.cpp +++ b/map/route_track.cpp @@ -1,9 +1,6 @@ #include "map/route_track.hpp" -#include "graphics/screen.hpp" -#include "graphics/display_list.hpp" -#include "graphics/depth_constants.hpp" -#include "graphics/pen.hpp" +#include "map/location_state.hpp" #include "indexer/scales.hpp" @@ -17,15 +14,15 @@ namespace arrowDirection.first); } - void DrawArrowTriangle(graphics::Screen * dlScreen, pair const & arrowDirection, - double arrowWidth, double arrowLength, graphics::Color arrowColor, double arrowDepth) - { - ASSERT(dlScreen, ()); +// void DrawArrowTriangle(graphics::Screen * dlScreen, pair const & arrowDirection, +// double arrowWidth, double arrowLength, graphics::Color arrowColor, double arrowDepth) +// { +// ASSERT(dlScreen, ()); - array arrow; - m2::GetArrowPoints(arrowDirection.first, arrowDirection.second, arrowWidth, arrowLength, arrow); - dlScreen->drawConvexPolygon(&arrow[0], arrow.size(), arrowColor, arrowDepth); - } +// array arrow; +// m2::GetArrowPoints(arrowDirection.first, arrowDirection.second, arrowWidth, arrowLength, arrow); +// dlScreen->drawConvexPolygon(&arrow[0], arrow.size(), arrowColor, arrowDepth); +// } } bool ClipArrowBodyAndGetArrowDirection(vector & ptsTurn, pair & arrowDirection, @@ -177,6 +174,7 @@ RouteTrack::~RouteTrack() DeleteClosestSegmentDisplayList(); } +/* void RouteTrack::CreateDisplayListArrows(graphics::Screen * dlScreen, MatrixT const & matrix, double visualScale) const { double const beforeTurn = 13. * visualScale; @@ -218,78 +216,80 @@ void RouteTrack::CreateDisplayListArrows(graphics::Screen * dlScreen, MatrixT co ptsNextTurn = ptsTurn; } } +*/ + /// @todo there are some ways to optimize the code bellow. /// 1. Call CreateDisplayListArrows only after passing the next arrow while driving /// 2. Use several closest segments intead of one to recreate Display List for the most part of the track /// -void RouteTrack::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matrix, bool isScaleChanged, - int drawScale, double visualScale, - location::RouteMatchingInfo const & matchingInfo) const -{ - if (HasDisplayLists() && !isScaleChanged && - m_relevantMatchedInfo.GetPosition() == matchingInfo.GetPosition()) - return; +//void RouteTrack::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matrix, bool isScaleChanged, +// int drawScale, double visualScale, +// location::RouteMatchingInfo const & matchingInfo) const +//{ +// if (HasDisplayLists() && !isScaleChanged && +// m_relevantMatchedInfo.GetPosition() == matchingInfo.GetPosition()) +// return; - PolylineD const & fullPoly = GetPolyline(); - size_t const formerIndex = m_relevantMatchedInfo.GetIndexInRoute(); +// PolylineD const & fullPoly = GetPolyline(); +// size_t const formerIndex = m_relevantMatchedInfo.GetIndexInRoute(); - if (matchingInfo.IsMatched()) - m_relevantMatchedInfo = matchingInfo; - size_t const currentIndex = m_relevantMatchedInfo.GetIndexInRoute(); +// if (matchingInfo.IsMatched()) +// m_relevantMatchedInfo = matchingInfo; +// size_t const currentIndex = m_relevantMatchedInfo.GetIndexInRoute(); - size_t const fullPolySz = fullPoly.GetSize(); - if (currentIndex + 2 >= fullPolySz || fullPolySz < 2) - { - DeleteDisplayList(); - DeleteClosestSegmentDisplayList(); - return; - } - DeleteClosestSegmentDisplayList(); - auto const curSegIter = fullPoly.Begin() + currentIndex; +// size_t const fullPolySz = fullPoly.GetSize(); +// if (currentIndex + 2 >= fullPolySz || fullPolySz < 2) +// { +// DeleteDisplayList(); +// DeleteClosestSegmentDisplayList(); +// return; +// } +// DeleteClosestSegmentDisplayList(); +// auto const curSegIter = fullPoly.Begin() + currentIndex; - //the most part of the route and symbols - if (formerIndex != currentIndex || - !HasDisplayLists() || isScaleChanged) - { - DeleteDisplayList(); - dlScreen->beginFrame(); +// //the most part of the route and symbols +// if (formerIndex != currentIndex || +// !HasDisplayLists() || isScaleChanged) +// { +// DeleteDisplayList(); +// dlScreen->beginFrame(); - graphics::DisplayList * dList = dlScreen->createDisplayList(); - dlScreen->setDisplayList(dList); - SetDisplayList(dList); +// graphics::DisplayList * dList = dlScreen->createDisplayList(); +// dlScreen->setDisplayList(dList); +// SetDisplayList(dList); - PolylineD mostPartPoly(curSegIter + 1, fullPoly.End()); - PointContainerT ptsMostPart; - ptsMostPart.reserve(mostPartPoly.GetSize()); - TransformAndSymplifyPolyline(mostPartPoly, matrix, GetMainWidth(), ptsMostPart); - CreateDisplayListPolyline(dlScreen, ptsMostPart); +// PolylineD mostPartPoly(curSegIter + 1, fullPoly.End()); +// PointContainerT ptsMostPart; +// ptsMostPart.reserve(mostPartPoly.GetSize()); +// TransformAndSymplifyPolyline(mostPartPoly, matrix, GetMainWidth(), ptsMostPart); +// CreateDisplayListPolyline(dlScreen, ptsMostPart); - PolylineD sym(vector({fullPoly.Front(), fullPoly.Back()})); - PointContainerT ptsSym; - TransformPolyline(sym, matrix, ptsSym); - CreateDisplayListSymbols(dlScreen, ptsSym); +// PolylineD sym(vector({fullPoly.Front(), fullPoly.Back()})); +// PointContainerT ptsSym; +// TransformPolyline(sym, matrix, ptsSym); +// CreateDisplayListSymbols(dlScreen, ptsSym); - //arrows on the route - if (drawScale >= scales::GetNavigationScale()) - CreateDisplayListArrows(dlScreen, matrix, visualScale); - } - else - dlScreen->beginFrame(); +// //arrows on the route +// if (drawScale >= scales::GetNavigationScale()) +// CreateDisplayListArrows(dlScreen, matrix, visualScale); +// } +// else +// dlScreen->beginFrame(); - //closest route segment - m_closestSegmentDL = dlScreen->createDisplayList(); - dlScreen->setDisplayList(m_closestSegmentDL); - PolylineD closestPoly(m_relevantMatchedInfo.IsMatched() ? - vector({m_relevantMatchedInfo.GetPosition(), fullPoly.GetPoint(currentIndex + 1)}) : - vector({fullPoly.GetPoint(currentIndex), fullPoly.GetPoint(currentIndex + 1)})); - PointContainerT pts; - pts.reserve(closestPoly.GetSize()); - TransformPolyline(closestPoly, matrix, pts); - CreateDisplayListPolyline(dlScreen, pts); +// //closest route segment +// m_closestSegmentDL = dlScreen->createDisplayList(); +// dlScreen->setDisplayList(m_closestSegmentDL); +// PolylineD closestPoly(m_relevantMatchedInfo.IsMatched() ? +// vector({m_relevantMatchedInfo.GetPosition(), fullPoly.GetPoint(currentIndex + 1)}) : +// vector({fullPoly.GetPoint(currentIndex), fullPoly.GetPoint(currentIndex + 1)})); +// PointContainerT pts; +// pts.reserve(closestPoly.GetSize()); +// TransformPolyline(closestPoly, matrix, pts); +// CreateDisplayListPolyline(dlScreen, pts); - dlScreen->setDisplayList(0); - dlScreen->endFrame(); -} +// dlScreen->setDisplayList(0); +// dlScreen->endFrame(); +//} RouteTrack * RouteTrack::CreatePersistent() { @@ -300,17 +300,17 @@ RouteTrack * RouteTrack::CreatePersistent() void RouteTrack::DeleteClosestSegmentDisplayList() const { - delete m_closestSegmentDL; - m_closestSegmentDL = nullptr; +// delete m_closestSegmentDL; +// m_closestSegmentDL = nullptr; } -void RouteTrack::Draw(graphics::Screen * pScreen, MatrixT const & matrix) const -{ - Track::Draw(pScreen, matrix); - pScreen->drawDisplayList(m_closestSegmentDL, matrix); -} +//void RouteTrack::Draw(graphics::Screen * pScreen, MatrixT const & matrix) const +//{ +// Track::Draw(pScreen, matrix); +// pScreen->drawDisplayList(m_closestSegmentDL, matrix); +//} -void RouteTrack::AddClosingSymbol(bool isBeginSymbol, string const & symbolName, graphics::EPosition pos, double depth) +void RouteTrack::AddClosingSymbol(bool isBeginSymbol, string const & symbolName, dp::Anchor pos, double depth) { if (isBeginSymbol) m_beginSymbols.push_back(ClosingSymbol(symbolName, pos, depth)); @@ -318,44 +318,42 @@ void RouteTrack::AddClosingSymbol(bool isBeginSymbol, string const & symbolName, m_endSymbols.push_back(ClosingSymbol(symbolName, pos, depth)); } -void RouteTrack::CreateDisplayListSymbols(graphics::Screen * dlScreen, PointContainerT const & pts) const -{ - ASSERT(!pts.empty(), ()); - if (!m_beginSymbols.empty() || !m_endSymbols.empty()) - { - m2::PointD pivot = pts.front(); - auto symDrawer = [&dlScreen, &pivot] (ClosingSymbol const & symbol) - { - dlScreen->drawSymbol(pivot, symbol.m_iconName, symbol.m_position, symbol.m_depth); - }; +//void RouteTrack::CreateDisplayListSymbols(graphics::Screen * dlScreen, PointContainerT const & pts) const +//{ +// ASSERT(!pts.empty(), ()); +// if (!m_beginSymbols.empty() || !m_endSymbols.empty()) +// { +// m2::PointD pivot = pts.front(); +// auto symDrawer = [&dlScreen, &pivot] (ClosingSymbol const & symbol) +// { +// dlScreen->drawSymbol(pivot, symbol.m_iconName, symbol.m_position, symbol.m_depth); +// }; - for_each(m_beginSymbols.begin(), m_beginSymbols.end(), symDrawer); +// for_each(m_beginSymbols.begin(), m_beginSymbols.end(), symDrawer); - pivot = pts.back(); - for_each(m_endSymbols.begin(), m_endSymbols.end(), symDrawer); - } -} +// pivot = pts.back(); +// for_each(m_endSymbols.begin(), m_endSymbols.end(), symDrawer); +// } +//} void RouteTrack::Swap(RouteTrack & rhs) { - Track::Swap(rhs); - swap(m_beginSymbols, rhs.m_beginSymbols); - swap(m_endSymbols, rhs.m_endSymbols); - m_turnsGeom.swap(rhs.m_turnsGeom); +// Track::Swap(rhs); +// swap(m_beginSymbols, rhs.m_beginSymbols); +// swap(m_endSymbols, rhs.m_endSymbols); +// m_turnsGeom.swap(rhs.m_turnsGeom); - rhs.m_relevantMatchedInfo.Reset(); - m_relevantMatchedInfo.Reset(); - - swap(m_arrowColor, rhs.m_arrowColor); +// rhs.m_relevantMatchedInfo.Reset(); +// m_relevantMatchedInfo.Reset(); } -void RouteTrack::CleanUp() const -{ - Track::CleanUp(); - DeleteClosestSegmentDisplayList(); -} +//void RouteTrack::CleanUp() const +//{ +// Track::CleanUp(); +// DeleteClosestSegmentDisplayList(); +//} -bool RouteTrack::HasDisplayLists() const -{ - return Track::HasDisplayLists() && m_closestSegmentDL != nullptr; -} +//bool RouteTrack::HasDisplayLists() const +//{ +// return Track::HasDisplayLists() && m_closestSegmentDL != nullptr; +//} diff --git a/map/route_track.hpp b/map/route_track.hpp index e7301992bc..ba4fe9a222 100644 --- a/map/route_track.hpp +++ b/map/route_track.hpp @@ -3,6 +3,7 @@ #include "map/track.hpp" #include "routing/turns.hpp" +#include "drape/drape_global.hpp" #include "platform/location.hpp" @@ -14,34 +15,34 @@ public: RouteTrack() {} explicit RouteTrack(PolylineD const & polyline) : Track(polyline) {} virtual ~RouteTrack(); - virtual void CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matrix, bool isScaleChanged, - int drawScale, double visualScale, - location::RouteMatchingInfo const & matchingInfo) const; - virtual void Draw(graphics::Screen * pScreen, MatrixT const & matrix) const; +// virtual void CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matrix, bool isScaleChanged, +// int drawScale, double visualScale, +// location::RouteMatchingInfo const & matchingInfo) const; +// virtual void Draw(graphics::Screen * pScreen, MatrixT const & matrix) const; virtual RouteTrack * CreatePersistent(); - virtual void CleanUp() const; - virtual bool HasDisplayLists() const; +// virtual void CleanUp() const; +// virtual bool HasDisplayLists() const; void AddClosingSymbol(bool isBeginSymbol, string const & symbolName, - graphics::EPosition pos, double depth); + dp::Anchor pos, double depth); void SetArrowColor(graphics::Color color) { m_arrowColor = color; } private: - void CreateDisplayListSymbols(graphics::Screen * dlScreen, PointContainerT const & pts) const; + //void CreateDisplayListSymbols(graphics::Screen * dlScreen, PointContainerT const & pts) const; - void CreateDisplayListArrows(graphics::Screen * dlScreen, MatrixT const & matrix, double visualScale) const; + //void CreateDisplayListArrows(graphics::Screen * dlScreen, MatrixT const & matrix, double visualScale) const; void DeleteClosestSegmentDisplayList() const; - bool HasClosestSegmentDisplayList() const { return m_closestSegmentDL != nullptr; } - void SetClosestSegmentDisplayList(graphics::DisplayList * dl) const { m_closestSegmentDL = dl; } + //bool HasClosestSegmentDisplayList() const { return m_closestSegmentDL != nullptr; } + //void SetClosestSegmentDisplayList(graphics::DisplayList * dl) const { m_closestSegmentDL = dl; } void Swap(RouteTrack & rhs); struct ClosingSymbol { - ClosingSymbol(string const & iconName, graphics::EPosition pos, double depth) + ClosingSymbol(string const & iconName, dp::Anchor pos, double depth) : m_iconName(iconName), m_position(pos), m_depth(depth) {} string m_iconName; - graphics::EPosition m_position; + dp::Anchor m_position; double m_depth; }; @@ -49,9 +50,8 @@ private: vector m_endSymbols; mutable location::RouteMatchingInfo m_relevantMatchedInfo; - mutable graphics::DisplayList * m_closestSegmentDL = nullptr; - - graphics::Color m_arrowColor; + /// @TODO UVR + //mutable graphics::DisplayList * m_closestSegmentDL = nullptr; }; bool ClipArrowBodyAndGetArrowDirection(vector & ptsTurn, pair & arrowDirection, diff --git a/map/track.cpp b/map/track.cpp index b2ded1d4a2..8ca8096a91 100644 --- a/map/track.cpp +++ b/map/track.cpp @@ -66,24 +66,25 @@ void Track::AddOutline(TrackOutline const * outline, size_t arraySize) // pScreen->drawDisplayList(m_dList, matrix); //} -void Track::CreateDisplayListPolyline(graphics::Screen * dlScreen, PointContainerT const & pts) const -{ - double baseDepthTrack = graphics::tracksDepth - 10 * m_outlines.size(); - for (TrackOutline const & outline : m_outlines) - { - graphics::Pen::Info const outlineInfo(outline.m_color, outline.m_lineWidth); - uint32_t const outlineId = dlScreen->mapInfo(outlineInfo); - dlScreen->drawPath(pts.data(), pts.size(), 0, outlineId, baseDepthTrack); - baseDepthTrack += 10; - } -} +///@TODO UVR +//void Track::CreateDisplayListPolyline(graphics::Screen * dlScreen, PointContainerT const & pts) const +//{ +// double baseDepthTrack = graphics::tracksDepth - 10 * m_outlines.size(); +// for (TrackOutline const & outline : m_outlines) +// { +// graphics::Pen::Info const outlineInfo(outline.m_color, outline.m_lineWidth); +// uint32_t const outlineId = dlScreen->mapInfo(outlineInfo); +// dlScreen->drawPath(pts.data(), pts.size(), 0, outlineId, baseDepthTrack); +// baseDepthTrack += 10; +// } +//} ///@TODO UVR -void Track::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matrix, bool isScaleChanged, - int, double, location::RouteMatchingInfo const &) const -{ - if (HasDisplayLists() && !isScaleChanged) - return; +//void Track::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matrix, bool isScaleChanged, +// int, double, location::RouteMatchingInfo const &) const +//{ +// if (HasDisplayLists() && !isScaleChanged) +// return; // DeleteDisplayList(); @@ -98,7 +99,7 @@ void Track::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matri // dlScreen->setDisplayList(0); // dlScreen->endFrame(); -} +//} double Track::GetLengthMeters() const { @@ -131,15 +132,16 @@ void Track::Swap(Track & rhs) //rhs.DeleteDisplayList(); } -void Track::CleanUp() const -{ - DeleteDisplayList(); -} +///@TODO UVR +//void Track::CleanUp() const +//{ +// DeleteDisplayList(); +//} -bool Track::HasDisplayLists() const -{ - return m_dList != nullptr; -} +//bool Track::HasDisplayLists() const +//{ +// return m_dList != nullptr; +//} void TransformPolyline(Track::PolylineD const & polyline, MatrixT const & matrix, PointContainerT & pts) { diff --git a/map/track.hpp b/map/track.hpp index e9429af82d..3ebd0865ef 100644 --- a/map/track.hpp +++ b/map/track.hpp @@ -53,7 +53,7 @@ public: /// @TODO UVR //virtual void Draw(graphics::Screen * pScreen, MatrixT const & matrix) const; //virtual void CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matrix, bool isScaleChanged, - int, double, location::RouteMatchingInfo const &) const; + // int, double, location::RouteMatchingInfo const &) const; //virtual void CleanUp() const; //virtual bool HasDisplayLists() const; @@ -77,11 +77,12 @@ public: double GetLengthMeters() const; protected: - graphics::DisplayList * GetDisplayList() const { return m_dList; } - void SetDisplayList(graphics::DisplayList * dl) const { m_dList = dl; } - void CreateDisplayListPolyline(graphics::Screen * dlScreen, PointContainerT const & pts2) const; +/// @TODO UVR +// graphics::DisplayList * GetDisplayList() const { return m_dList; } +// void SetDisplayList(graphics::DisplayList * dl) const { m_dList = dl; } +// void CreateDisplayListPolyline(graphics::Screen * dlScreen, PointContainerT const & pts2) const; void Swap(Track & rhs); - void DeleteDisplayList() const; +// void DeleteDisplayList() const; private: string m_name;