FUIMKRoutingFloorplanViewController
@MainActor
open class FUIMKRoutingFloorplanViewController : FUIMKMapFloorplanViewController
A subclass of FUIMKMapFloorplanViewController designed to be used with MapKit framework. It adds additional functionality to map floorplan controller to support routes display.
Usage
Create a FUIRoute instance for each route you want to display. Make sure your route stop geometry type extends MKPointAnnotation and FUIAnnotation, and route segment geometry type extends MKPolyline and FUIOverlay.
- Implement
FUIMKRoutingMapViewDataSourcemethods.
In the routing floorplan controller viewDidLoad() set the datasource.
self.dataSource = dataSource
func numberOfRoutes(in mapView: MKMapView) -> Int { return 1 }
func mapView(_ mapView: MKMapView, routeAt index: Int) -> FUIRoute<MKPolyline, MKPointAnnotation> { return fuiRoute }
FUIMKRoutingMapViewDelegateprovides more functionalities that you can make your app more powerful.
In the floorplan controller viewDidLoad() set the delegate.
self.delegate = delegate
Determine how annotation view/overlay renderer should appear. You can customize the view/render provided with fiori default styles.
func mapView(_ mapView: MKMapView, willRender annotationView: MKAnnotationView, forVertexAtIndex vertexIndex: Int, inRouteAt routeIndex: Int, in state: FUIMapFloorplan.State) {
switch annotationView {
case is FUICircleAnnotationView:
(annotationView as! FUICircleAnnotationView).innerColor = .red
case is FUIMarkerAnnotationView:
(annotationView as! FUIMarkerAnnotationView).markerTintColor = .blue
default:
break
}
}
Respond to route select/deselect action
func mapView(_ mapView: MKMapView, didSelectRouteAt index: Int)
func mapView(_ mapView: MKMapView, didSelectVertexAt vertexIndex: Int, inRouteAt routeIndex: Int)
func mapView(_ mapView: MKMapView, didDeselectRouteAt index: Int)
func mapView(_ mapView: MKMapView, didDeselectVertexAt vertexIndex: Int, inRouteAt routeIndex: Int)
Theming
-
Route stop annotations from all routes.
Declaration
Swift
@MainActor open var routeAnnotations: [FUIAnnotation] { get } -
Route segment overlays from all routes.
Declaration
Swift
@MainActor open var routeOverlays: [FUIOverlay] { get } -
Route callout annotations from all routes.
Declaration
Swift
@MainActor open var calloutAnnotations: [FUICalloutAnnotation] { get } -
Select a route at a specific index.
Declaration
Swift
@MainActor open func selectRoute(at index: Int)Parameters
indexThe index of the route to be selected.
-
Select a route stop identified by its index path.
Declaration
Swift
@MainActor open func selectStop(at indexPath: IndexPath)Parameters
indexPathThe index path of the route stop to be selected. Passing in nil will deselect all annotations.
-
Deselect the route which is currently selected.
Declaration
Swift
@MainActor open func deselectRoute() -
Deselect the route stop which is currently selected.
Declaration
Swift
@MainActor open func deselectStop()