Merge pull request #6231 from rokuz/routing-manager-fixes
Fixed routing manager integration
|
@ -909,7 +909,7 @@ Java_com_mapswithme_maps_Framework_nativeIsRouteBuilt(JNIEnv * env, jclass)
|
|||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeCloseRouting(JNIEnv * env, jclass)
|
||||
{
|
||||
frm()->GetRoutingManager().CloseRouting();
|
||||
frm()->GetRoutingManager().CloseRouting(true /* remove route points */);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
|
|
Before Width: | Height: | Size: 767 KiB After Width: | Height: | Size: 758 KiB |
Before Width: | Height: | Size: 760 KiB After Width: | Height: | Size: 759 KiB |
Before Width: | Height: | Size: 368 KiB After Width: | Height: | Size: 371 KiB |
Before Width: | Height: | Size: 364 KiB After Width: | Height: | Size: 369 KiB |
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 214 KiB |
Before Width: | Height: | Size: 212 KiB After Width: | Height: | Size: 213 KiB |
Before Width: | Height: | Size: 479 KiB After Width: | Height: | Size: 512 KiB |
Before Width: | Height: | Size: 474 KiB After Width: | Height: | Size: 517 KiB |
Before Width: | Height: | Size: 781 KiB After Width: | Height: | Size: 783 KiB |
Before Width: | Height: | Size: 776 KiB After Width: | Height: | Size: 782 KiB |
BIN
data/styles/clear/style-clear/6plus/route-point-a.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
data/styles/clear/style-clear/6plus/route-point-b.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
data/styles/clear/style-clear/6plus/route-point-c.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
data/styles/clear/style-clear/6plus/route-point-finish.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
data/styles/clear/style-clear/6plus/route-point-start.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 2.6 KiB |
BIN
data/styles/clear/style-clear/hdpi/route-point-a.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
data/styles/clear/style-clear/hdpi/route-point-b.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
data/styles/clear/style-clear/hdpi/route-point-c.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
data/styles/clear/style-clear/hdpi/route-point-finish.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
data/styles/clear/style-clear/hdpi/route-point-start.png
Normal file
After Width: | Height: | Size: 980 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
BIN
data/styles/clear/style-clear/mdpi/route-point-a.png
Normal file
After Width: | Height: | Size: 852 B |
BIN
data/styles/clear/style-clear/mdpi/route-point-b.png
Normal file
After Width: | Height: | Size: 842 B |
BIN
data/styles/clear/style-clear/mdpi/route-point-c.png
Normal file
After Width: | Height: | Size: 870 B |
BIN
data/styles/clear/style-clear/mdpi/route-point-finish.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
data/styles/clear/style-clear/mdpi/route-point-start.png
Normal file
After Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1 KiB |
BIN
data/styles/clear/style-clear/xhdpi/route-point-a.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
data/styles/clear/style-clear/xhdpi/route-point-b.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
data/styles/clear/style-clear/xhdpi/route-point-c.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
data/styles/clear/style-clear/xhdpi/route-point-finish.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
data/styles/clear/style-clear/xhdpi/route-point-start.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 2.1 KiB |
BIN
data/styles/clear/style-clear/xxhdpi/route-point-a.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
data/styles/clear/style-clear/xxhdpi/route-point-b.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
data/styles/clear/style-clear/xxhdpi/route-point-c.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
data/styles/clear/style-clear/xxhdpi/route-point-finish.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
data/styles/clear/style-clear/xxhdpi/route-point-start.png
Normal file
After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 3.2 KiB |
BIN
data/styles/clear/style-night/6plus/route-point-a.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
data/styles/clear/style-night/6plus/route-point-b.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
data/styles/clear/style-night/6plus/route-point-c.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
data/styles/clear/style-night/6plus/route-point-finish.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
data/styles/clear/style-night/6plus/route-point-start.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 2.6 KiB |
BIN
data/styles/clear/style-night/hdpi/route-point-a.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
data/styles/clear/style-night/hdpi/route-point-b.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
data/styles/clear/style-night/hdpi/route-point-c.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
data/styles/clear/style-night/hdpi/route-point-finish.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
data/styles/clear/style-night/hdpi/route-point-start.png
Normal file
After Width: | Height: | Size: 980 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
BIN
data/styles/clear/style-night/mdpi/route-point-a.png
Normal file
After Width: | Height: | Size: 852 B |
BIN
data/styles/clear/style-night/mdpi/route-point-b.png
Normal file
After Width: | Height: | Size: 842 B |
BIN
data/styles/clear/style-night/mdpi/route-point-c.png
Normal file
After Width: | Height: | Size: 870 B |
BIN
data/styles/clear/style-night/mdpi/route-point-finish.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
data/styles/clear/style-night/mdpi/route-point-start.png
Normal file
After Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1 KiB |
BIN
data/styles/clear/style-night/xhdpi/route-point-a.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
data/styles/clear/style-night/xhdpi/route-point-b.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
data/styles/clear/style-night/xhdpi/route-point-c.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
data/styles/clear/style-night/xhdpi/route-point-finish.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
data/styles/clear/style-night/xhdpi/route-point-start.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 2 KiB |
BIN
data/styles/clear/style-night/xxhdpi/route-point-a.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
data/styles/clear/style-night/xxhdpi/route-point-b.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
data/styles/clear/style-night/xxhdpi/route-point-c.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
data/styles/clear/style-night/xxhdpi/route-point-finish.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
data/styles/clear/style-night/xxhdpi/route-point-start.png
Normal file
After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 3.2 KiB |
|
@ -144,7 +144,7 @@ FrontendRenderer::FrontendRenderer(Params && params)
|
|||
ASSERT(m_tapEventInfoFn, ());
|
||||
ASSERT(m_userPositionChangedFn, ());
|
||||
|
||||
m_gpsTrackRenderer = make_unique_dp<GpsTrackRenderer>([this](size_t pointsCount)
|
||||
m_gpsTrackRenderer = make_unique_dp<GpsTrackRenderer>([this](uint32_t pointsCount)
|
||||
{
|
||||
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<CacheCirclesPackMessage>(
|
||||
|
@ -152,7 +152,7 @@ FrontendRenderer::FrontendRenderer(Params && params)
|
|||
MessagePriority::Normal);
|
||||
});
|
||||
|
||||
m_routeRenderer = make_unique_dp<RouteRenderer>([this](size_t pointsCount)
|
||||
m_routeRenderer = make_unique_dp<RouteRenderer>([this](uint32_t pointsCount)
|
||||
{
|
||||
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<CacheCirclesPackMessage>(
|
||||
|
|
|
@ -28,7 +28,7 @@ df::ColorConstant const kTrackHumanSpeedColor = "TrackHumanSpeed";
|
|||
|
||||
int const kMinVisibleZoomLevel = 5;
|
||||
|
||||
size_t const kAveragePointsCount = 512;
|
||||
uint32_t const kAveragePointsCount = 512;
|
||||
|
||||
// Radius of circles depending on zoom levels.
|
||||
std::vector<float> const kRadiusInPixel =
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace df
|
|||
class GpsTrackRenderer final
|
||||
{
|
||||
public:
|
||||
using TRenderDataRequestFn = std::function<void(size_t)>;
|
||||
using TRenderDataRequestFn = std::function<void(uint32_t)>;
|
||||
explicit GpsTrackRenderer(TRenderDataRequestFn const & dataRequestFn);
|
||||
|
||||
void AddRenderData(ref_ptr<dp::GpuProgramManager> mng,
|
||||
|
|
|
@ -52,7 +52,7 @@ std::vector<float> const kPreviewPointRadiusInPixel =
|
|||
int const kArrowAppearingZoomLevel = 14;
|
||||
int const kInvalidGroup = -1;
|
||||
|
||||
size_t const kPreviewPointsCount = 512;
|
||||
uint32_t const kPreviewPointsCount = 512;
|
||||
double const kPreviewAnimationSpeed = 3.0;
|
||||
double const kPreviewAnimationScale = 0.3;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class RouteRenderer final
|
|||
{
|
||||
public:
|
||||
using CacheRouteArrowsCallback = std::function<void(dp::DrapeID, std::vector<ArrowBorders> const &)>;
|
||||
using PreviewPointsRequestCallback = std::function<void(size_t)>;
|
||||
using PreviewPointsRequestCallback = std::function<void(uint32_t)>;
|
||||
|
||||
struct PreviewInfo
|
||||
{
|
||||
|
|
|
@ -17,6 +17,10 @@ typedef void (^MWMImageHeightBlock)(UIImage *, NSString *);
|
|||
@property(nonatomic) MWMRouterType type;
|
||||
|
||||
- (void)swapPointsAndRebuild;
|
||||
- (void)removeStartPointAndRebuild:(int)intermediateIndex;
|
||||
- (void)removeFinishPointAndRebuild:(int)intermediateIndex;
|
||||
- (void)addIntermediatePointAndRebuild:(MWMRoutePoint *)point intermediateIndex:(int)intermediateIndex;
|
||||
- (void)removeIntermediatePointAndRebuild:(int)intermediateIndex;
|
||||
- (void)buildFromPoint:(MWMRoutePoint *)start bestRouter:(BOOL)bestRouter;
|
||||
- (void)buildToPoint:(MWMRoutePoint *)finish bestRouter:(BOOL)bestRouter;
|
||||
- (void)buildFromPoint:(MWMRoutePoint *)start
|
||||
|
|
|
@ -38,7 +38,12 @@ MWMRoutePoint * lastLocationPoint()
|
|||
return lastLocation ? routePoint(lastLocation.mercator) : zeroRoutePoint();
|
||||
}
|
||||
|
||||
bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyPosition; }
|
||||
m2::PointD getMercator(MWMRoutePoint * p)
|
||||
{
|
||||
if (p.isMyPosition)
|
||||
return mercatorMWMRoutePoint(lastLocationPoint());
|
||||
return mercatorMWMRoutePoint(p);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@interface MWMRouter ()<MWMLocationObserver, MWMFrameworkRouteBuilderObserver>
|
||||
|
@ -101,6 +106,7 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
}
|
||||
|
||||
+ (BOOL)isRoutingActive { return GetFramework().GetRoutingManager().IsRoutingActive(); }
|
||||
|
||||
- (instancetype)initRouter
|
||||
{
|
||||
self = [super init];
|
||||
|
@ -126,34 +132,95 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
{
|
||||
if (type == self.type)
|
||||
return;
|
||||
[self doStop];
|
||||
[self doStop:NO];
|
||||
GetFramework().GetRoutingManager().SetRouter(coreRouterType(type));
|
||||
}
|
||||
|
||||
- (MWMRouterType)type { return routerType(GetFramework().GetRoutingManager().GetRouter()); }
|
||||
|
||||
- (BOOL)arePointsValidForRouting
|
||||
{
|
||||
return self.startPoint.isValid && self.finishPoint.isValid && self.startPoint != self.finishPoint;
|
||||
}
|
||||
|
||||
- (void)applyRoutePoints
|
||||
{
|
||||
auto & rm = GetFramework().GetRoutingManager();
|
||||
if (self.startPoint.isValid)
|
||||
{
|
||||
rm.AddRoutePoint(getMercator(self.startPoint), self.startPoint.isMyPosition,
|
||||
RouteMarkType::Start);
|
||||
}
|
||||
if (self.finishPoint.isValid)
|
||||
{
|
||||
rm.AddRoutePoint(getMercator(self.finishPoint), self.finishPoint.isMyPosition,
|
||||
RouteMarkType::Finish);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeRoutePoint:(RouteMarkType)type intermediateIndex:(int)intermediateIndex
|
||||
{
|
||||
auto & rm = GetFramework().GetRoutingManager();
|
||||
rm.RemoveRoutePoint(type, intermediateIndex);
|
||||
auto points = rm.GetRoutePoints();
|
||||
if (points.empty())
|
||||
{
|
||||
if (type == RouteMarkType::Start)
|
||||
self.startPoint = zeroRoutePoint();
|
||||
else if (type == RouteMarkType::Finish)
|
||||
self.finishPoint = zeroRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
self.startPoint = routePoint(points.front());
|
||||
self.finishPoint = routePoint(points.back());
|
||||
}
|
||||
}
|
||||
|
||||
- (void)swapPointsAndRebuild
|
||||
{
|
||||
[Statistics logEvent:kStatEventName(kStatPointToPoint, kStatSwapRoutingPoints)];
|
||||
swap(_startPoint, _finishPoint);
|
||||
std::swap(_startPoint, _finishPoint);
|
||||
[self applyRoutePoints];
|
||||
[self rebuildWithBestRouter:NO];
|
||||
}
|
||||
|
||||
- (void)removeStartPointAndRebuild:(int)intermediateIndex
|
||||
{
|
||||
[self removeRoutePoint:RouteMarkType::Start intermediateIndex:intermediateIndex];
|
||||
[self rebuildWithBestRouter:NO];
|
||||
}
|
||||
|
||||
- (void)removeFinishPointAndRebuild:(int)intermediateIndex
|
||||
{
|
||||
[self removeRoutePoint:RouteMarkType::Finish intermediateIndex:intermediateIndex];
|
||||
[self rebuildWithBestRouter:NO];
|
||||
}
|
||||
|
||||
- (void)addIntermediatePointAndRebuild:(MWMRoutePoint *)point intermediateIndex:(int)intermediateIndex
|
||||
{
|
||||
GetFramework().GetRoutingManager().AddRoutePoint(getMercator(point), point.isMyPosition,
|
||||
RouteMarkType::Intermediate, intermediateIndex);
|
||||
[self rebuildWithBestRouter:NO];
|
||||
}
|
||||
|
||||
- (void)removeIntermediatePointAndRebuild:(int)intermediateIndex
|
||||
{
|
||||
[self removeRoutePoint:RouteMarkType::Intermediate intermediateIndex:intermediateIndex];
|
||||
[self rebuildWithBestRouter:NO];
|
||||
}
|
||||
|
||||
- (void)buildFromPoint:(MWMRoutePoint *)startPoint bestRouter:(BOOL)bestRouter
|
||||
{
|
||||
self.startPoint = startPoint;
|
||||
[self applyRoutePoints];
|
||||
[self rebuildWithBestRouter:bestRouter];
|
||||
}
|
||||
|
||||
- (void)buildToPoint:(MWMRoutePoint *)finishPoint bestRouter:(BOOL)bestRouter
|
||||
{
|
||||
if (!self.startPoint.isValid && !finishPoint.isMyPosition)
|
||||
self.startPoint = lastLocationPoint();
|
||||
self.finishPoint = finishPoint;
|
||||
[self applyRoutePoints];
|
||||
[self rebuildWithBestRouter:bestRouter];
|
||||
}
|
||||
|
||||
|
@ -163,6 +230,7 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
{
|
||||
self.startPoint = start;
|
||||
self.finishPoint = finish;
|
||||
[self applyRoutePoints];
|
||||
[self rebuildWithBestRouter:bestRouter];
|
||||
}
|
||||
|
||||
|
@ -175,13 +243,11 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
{
|
||||
[Statistics logEvent:kStatPointToPoint
|
||||
withParameters:@{kStatAction : kStatBuildRoute, kStatValue : kStatFromMyPosition}];
|
||||
self.startPoint = lastLocationPoint();
|
||||
}
|
||||
else if (self.finishPoint.isMyPosition)
|
||||
{
|
||||
[Statistics logEvent:kStatPointToPoint
|
||||
withParameters:@{kStatAction : kStatBuildRoute, kStatValue : kStatToMyPosition}];
|
||||
self.finishPoint = lastLocationPoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -192,20 +258,20 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
|
||||
MWMMapViewControlsManager * mapViewControlsManager = [MWMMapViewControlsManager manager];
|
||||
[mapViewControlsManager onRoutePrepare];
|
||||
if (![self arePointsValidForRouting])
|
||||
|
||||
auto & rm = GetFramework().GetRoutingManager();
|
||||
auto points = rm.GetRoutePoints();
|
||||
if (points.size() < 2 || ![self arePointsValidForRouting])
|
||||
{
|
||||
rm.CloseRouting(false /* remove route points */);
|
||||
return;
|
||||
auto & f = GetFramework();
|
||||
auto startPoint = mercatorMWMRoutePoint(self.startPoint);
|
||||
auto finishPoint = mercatorMWMRoutePoint(self.finishPoint);
|
||||
}
|
||||
|
||||
// Taxi can't be used as best router.
|
||||
if (bestRouter && ![[self class] isTaxi])
|
||||
self.type =
|
||||
routerType(GetFramework().GetRoutingManager().GetBestRouter(startPoint, finishPoint));
|
||||
f.GetRoutingManager().BuildRoute(startPoint, finishPoint, isP2P, 0 /* timeoutSec */);
|
||||
if (self.startPoint.isValid)
|
||||
f.GetRoutingManager().AddRoutePoint(startPoint, self.startPoint.isMyPosition, RouteMarkType::Start);
|
||||
if (self.finishPoint.isValid)
|
||||
f.GetRoutingManager().AddRoutePoint(finishPoint, self.finishPoint.isMyPosition, RouteMarkType::Finish);
|
||||
self.type = routerType(rm.GetBestRouter(points.front(), points.back()));
|
||||
|
||||
rm.BuildRoute(points.front(), points.back(), isP2P, 0 /* timeoutSec */);
|
||||
[mapViewControlsManager onRouteRebuild];
|
||||
}
|
||||
|
||||
|
@ -263,18 +329,18 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
[Statistics logEvent:kStatEventName(kStatPointToPoint, kStatClose)];
|
||||
[MWMSearch clear];
|
||||
[self resetPoints];
|
||||
[self doStop];
|
||||
[self doStop:YES];
|
||||
[[MWMMapViewControlsManager manager] onRouteStop];
|
||||
}
|
||||
|
||||
- (void)doStop
|
||||
- (void)doStop:(BOOL)removeRoutePoints
|
||||
{
|
||||
// Don't save taxi routing type as default.
|
||||
if ([[self class] isTaxi])
|
||||
GetFramework().GetRoutingManager().SetRouter(routing::RouterType::Vehicle);
|
||||
|
||||
[self clearAltitudeImagesData];
|
||||
GetFramework().GetRoutingManager().CloseRouting();
|
||||
GetFramework().GetRoutingManager().CloseRouting(removeRoutePoints);
|
||||
MapsAppDelegate * app = [MapsAppDelegate theApp];
|
||||
app.routingPlaneMode = MWMRoutingPlaneModeNone;
|
||||
[MWMRouterSavedState remove];
|
||||
|
|
|
@ -276,14 +276,26 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
|
|||
|
||||
- (void)addStop
|
||||
{
|
||||
GetFramework().GetRoutingManager().AddRoutePoint(self.data.mercator, false /* isMyPosition */,
|
||||
RouteMarkType::Intermediate, 0);
|
||||
[[MWMRouter router] addIntermediatePointAndRebuild:self.target
|
||||
intermediateIndex:0];
|
||||
[self shouldClose];
|
||||
}
|
||||
|
||||
- (void)removeStop
|
||||
{
|
||||
GetFramework().GetRoutingManager().RemoveRoutePoint(self.data.routeMarkType, self.data.intermediateIndex);
|
||||
auto router = [MWMRouter router];
|
||||
switch (self.data.routeMarkType)
|
||||
{
|
||||
case RouteMarkType::Start:
|
||||
[router removeStartPointAndRebuild:self.data.intermediateIndex];
|
||||
break;
|
||||
case RouteMarkType::Finish:
|
||||
[router removeFinishPointAndRebuild:self.data.intermediateIndex];
|
||||
break;
|
||||
case RouteMarkType::Intermediate:
|
||||
[router removeIntermediatePointAndRebuild:self.data.intermediateIndex];
|
||||
break;
|
||||
}
|
||||
[self shouldClose];
|
||||
}
|
||||
|
||||
|
|
|
@ -381,16 +381,7 @@ Framework::Framework(FrameworkParams const & params)
|
|||
, m_bmManager(*this)
|
||||
, m_isRenderingEnabled(true)
|
||||
, m_routingManager(RoutingManager::Callbacks([this]() -> Index & { return m_model.GetIndex(); },
|
||||
bind(&Framework::GetCountryInfoGetter, this),
|
||||
[this](m2::PointD const & pt) {
|
||||
#ifdef DEBUG
|
||||
UserMarkControllerGuard guard(
|
||||
m_bmManager, UserMarkType::DEBUG_MARK);
|
||||
guard.m_controller.SetIsVisible(true);
|
||||
guard.m_controller.SetIsDrawable(true);
|
||||
guard.m_controller.CreateUserMark(pt);
|
||||
#endif
|
||||
}),
|
||||
std::bind(&Framework::GetCountryInfoGetter, this)),
|
||||
static_cast<RoutingManager::Delegate &>(*this))
|
||||
, m_trafficManager(bind(&Framework::GetMwmsByRect, this, _1, false /* rough */),
|
||||
kMaxTrafficCacheSizeBytes, m_routingManager.RoutingSession())
|
||||
|
@ -934,13 +925,22 @@ void Framework::FillSearchResultInfo(SearchMarkPoint const & smp, place_page::In
|
|||
FillPointInfo(smp.GetPivot(), smp.GetMatchedName(), info);
|
||||
}
|
||||
|
||||
void Framework::FillMyPositionInfo(place_page::Info & info) const
|
||||
void Framework::FillMyPositionInfo(place_page::Info & info, m2::PointD const & pt) const
|
||||
{
|
||||
double lat, lon;
|
||||
VERIFY(GetCurrentPosition(lat, lon), ());
|
||||
info.SetMercator(MercatorBounds::FromLatLon(lat, lon));
|
||||
info.m_isMyPosition = true;
|
||||
info.m_customName = m_stringsBundle.GetString("my_position");
|
||||
|
||||
UserMark const * mark = FindUserMarkInTapPosition(pt);
|
||||
if (mark != nullptr && mark->GetMarkType() == UserMark::Type::ROUTING)
|
||||
{
|
||||
RouteMarkPoint const * routingMark = static_cast<RouteMarkPoint const *>(mark);
|
||||
info.m_isRoutePoint = true;
|
||||
info.m_routeMarkType = routingMark->GetRoutePointType();
|
||||
info.m_intermediateIndex = routingMark->GetIntermediateIndex();
|
||||
}
|
||||
}
|
||||
|
||||
void Framework::FillRouteMarkInfo(RouteMarkPoint const & rmp, place_page::Info & info) const
|
||||
|
@ -2283,7 +2283,8 @@ void Framework::InvalidateUserMarks()
|
|||
{
|
||||
m_bmManager.InitBookmarks();
|
||||
|
||||
vector<UserMarkType> const types = { UserMarkType::SEARCH_MARK, UserMarkType::API_MARK, UserMarkType::DEBUG_MARK };
|
||||
std::vector<UserMarkType> const types = {UserMarkType::SEARCH_MARK, UserMarkType::API_MARK,
|
||||
UserMarkType::DEBUG_MARK, UserMarkType::ROUTING_MARK};
|
||||
for (size_t typeIndex = 0; typeIndex < types.size(); typeIndex++)
|
||||
{
|
||||
UserMarkControllerGuard guard(m_bmManager, types[typeIndex]);
|
||||
|
@ -2389,30 +2390,13 @@ df::SelectionShape::ESelectedObject Framework::OnTapEventImpl(TapEvent const & t
|
|||
|
||||
if (tapInfo.m_isMyPositionTapped)
|
||||
{
|
||||
FillMyPositionInfo(outInfo);
|
||||
FillMyPositionInfo(outInfo, pxPoint2d);
|
||||
return df::SelectionShape::OBJECT_MY_POSITION;
|
||||
}
|
||||
|
||||
outInfo.m_adsEngine = m_adsEngine.get();
|
||||
|
||||
df::VisualParams const & vp = df::VisualParams::Instance();
|
||||
|
||||
m2::AnyRectD rect;
|
||||
uint32_t const touchRadius = vp.GetTouchRectRadius();
|
||||
m_currentModelView.GetTouchRect(pxPoint2d, touchRadius, rect);
|
||||
|
||||
m2::AnyRectD bmSearchRect;
|
||||
double const bmAddition = BM_TOUCH_PIXEL_INCREASE * vp.GetVisualScale();
|
||||
double const pxWidth = touchRadius;
|
||||
double const pxHeight = touchRadius + bmAddition;
|
||||
m_currentModelView.GetTouchRect(pxPoint2d + m2::PointD(0, bmAddition),
|
||||
pxWidth, pxHeight, bmSearchRect);
|
||||
UserMark const * mark = m_bmManager.FindNearestUserMark(
|
||||
[&rect, &bmSearchRect](UserMarkType type) -> m2::AnyRectD const &
|
||||
{
|
||||
return (type == UserMarkType::BOOKMARK_MARK ? bmSearchRect : rect);
|
||||
});
|
||||
|
||||
UserMark const * mark = FindUserMarkInTapPosition(pxPoint2d);
|
||||
if (mark)
|
||||
{
|
||||
switch (mark->GetMarkType())
|
||||
|
@ -2461,6 +2445,28 @@ df::SelectionShape::ESelectedObject Framework::OnTapEventImpl(TapEvent const & t
|
|||
return df::SelectionShape::OBJECT_EMPTY;
|
||||
}
|
||||
|
||||
UserMark const * Framework::FindUserMarkInTapPosition(m2::PointD const & pt) const
|
||||
{
|
||||
df::VisualParams const & vp = df::VisualParams::Instance();
|
||||
|
||||
m2::AnyRectD rect;
|
||||
uint32_t const touchRadius = vp.GetTouchRectRadius();
|
||||
m_currentModelView.GetTouchRect(pt, touchRadius, rect);
|
||||
|
||||
m2::AnyRectD bmSearchRect;
|
||||
double const bmAddition = BM_TOUCH_PIXEL_INCREASE * vp.GetVisualScale();
|
||||
double const pxWidth = touchRadius;
|
||||
double const pxHeight = touchRadius + bmAddition;
|
||||
m_currentModelView.GetTouchRect(pt + m2::PointD(0, bmAddition),
|
||||
pxWidth, pxHeight, bmSearchRect);
|
||||
UserMark const * mark = m_bmManager.FindNearestUserMark(
|
||||
[&rect, &bmSearchRect](UserMarkType type) -> m2::AnyRectD const &
|
||||
{
|
||||
return (type == UserMarkType::BOOKMARK_MARK ? bmSearchRect : rect);
|
||||
});
|
||||
return mark;
|
||||
}
|
||||
|
||||
unique_ptr<Framework::TapEvent> Framework::MakeTapEvent(m2::PointD const & center,
|
||||
FeatureID const & fid,
|
||||
TapEvent::Source source) const
|
||||
|
|