Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RouteManagerViewModel.swift « RouteManager « RoutePreview « Views « NavigationDashboard « CustomViews « Classes « Maps « iphone - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c4c60f4545c1896b8b9708931c4a8d82088ebfd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@objc(MWMRouteManagerViewModel)
final class RouteManagerViewModel: NSObject, RouteManagerViewModelProtocol {
  var routePoints: [MWMRoutePoint] { return MWMRouter.points() }
  var refreshControlsCallback: (() -> Void)!

  func startTransaction() { MWMRouter.openRouteManagerTransaction() }

  func finishTransaction() {
    MWMRouter.applyRouteManagerTransaction()
    MWMRouter.rebuild(withBestRouter: false)
  }

  func cancelTransaction() { MWMRouter.cancelRouteManagerTransaction() }

  func addLocationPoint() {
    MWMRouter.addPoint(MWMRoutePoint(lastLocationAndType: .start, intermediateIndex: 0))
    refreshControlsCallback()
  }
  func movePoint(at index: Int, to newIndex: Int) {
    MWMRouter.movePoint(at: index, to: newIndex)
    refreshControlsCallback()
  }
  func deletePoint(at index: Int) {
    MWMRouter.removePoint(routePoints[index])
    refreshControlsCallback()
  }
}