FUIMapFloorplanViewController

open class FUIMapFloorplanViewController<InnerView, EditingGeometryWrapper, EditingTypes> : FUIBaseDrawingViewController<InnerView>, FUIMapFloorplanComponent where InnerView : FUIMapFloorplanContentView, EditingGeometryWrapper : FUIManageRepresentation, EditingTypes : FUIGeometryTypeWrapper

A generic map floorplan view controller that supports creating new geometry, editing geometry and save geometry. In general, you do not subclass this class directly. Use FUIMKMapFloorplanViewController(MapKit).

Views Available in FUIMapFloorplanViewController:

  • detailPanel: Displays a resizing panel that holds the search controller, content controller, and edit controller. The panel resizes based on the presented controller preferredContentSize.

  • toolbar: A view that contains toolbar buttons for easy access to common map functionalities. Default toolbar buttons are provided.

  • legend: A view that shows mapAnnotations and their title.

  • settingsController: A controller presented as a formSheet over the map allowing for customization of the map.

  • createGeometryResultsController: A controller presented when a geometry is saved. Allows for additional configuration before committing the geometry.

Variables Available in FUIMapFloorplanViewController:

  • isEditable: A Bool that prepares the floorplan for editing.

  • createGeometryItems: An array that displays work orders to create in editing mode. The contents are displayed in a table and on cell selection displays the editing panel.

  • isCreatePointEnabled: A Bool that enables editing of point geometries.

  • isCreatePolylineEnabled: A Bool that enables editing of polyline geometries.

  • isCreatePolygonEnabled: A Bool that enables editing of polygon geometries.

Usage

override func viewDidLoad() {
    detailPanel.search.tableView.dataSource = dataSource
    detailPanel.content.tableView.dataSource = dataSource
    legend.items = items
    settingsController = controller
    createGeometryResultsController = controller
}

Editing Interaction:

The floorplan supports editing to allow users to add geometries (points, polylines, and polygons) by drawing directly on the map.

A floorplan subclass can become editable by setting isEditable. The view controller will transition to an editing state by setting all other annotations to disabled, showing editing toolbar buttons, and presenting the editing panel. The + right bar button presents a popover allowing the user to select a geometry.

Once the panel is presented, a user can toggle between geometry types (points, polylines, and polygons) to edit. The user can draw directly on the map by tapping on screen. The editing tool bar buttons show how the user can interact with the map. When the add Button is selected, the user can tap to add points. When the delete button is selected, a user can tap a point to delete. Actions can be undone and redone with the undo and redo buttons. Lastly the branch button can extend a polyline or polygon. To edit existing points the user can use the long press gesture to drag points to new locations.

Alternatively, A user can edit existing points using the panel. The user can input directly an address and a list of suggestions will be presented. Tapping on a suggestion will add the point to the map. To delete, tap the red circle to show the red delete button. Tap delete to remove the point. Reordering points is done by dragging cells among each other.

To save, tap the save button. This will launch the developer’s createGeometryResultsController where the user can make additional changes to the work order. Tapping the save right bar button dismisses the controller and exits the editing state. It is up to the developer to update his/her model with the saved geometry.

  • Bool property that prepares the floorplan for editing. When editable, floorplan displays a + to begin creating a geometry.

    Declaration

    Swift

    open var isEditable: Bool { get set }
  • A property value determines the color scheme for map components.

    The styling theme of map controls and geometries are controlled by this value. By default the .light color scheme is applied. If this value is set to .dark, the dark color scheme will be applied to corresponding components.

    Declaration

    Swift

    open var colorScheme: FUIBackgroundColorScheme { get set }
  • A property value indicates the display mode for the create geometry results view controller.

    Declaration

    Swift

    open var editingGeometryResultsDisplayMode: FUICreateGeometryResultsDisplayMode
  • A boolean value indicates if the user is editing existing geometry object

    Declaration

    Swift

    open var isEditingExistingObject: Bool
  • A property to cache and set the map legend item for editing panel

    Declaration

    Swift

    open var editingGeometryMapLegendItem: FUIMapLegendItem? { get set }
  • Reload all geometries from the data source.

    Those geometries added using MKMapView‘s api(that is, addAnnotation(_:) and addOverlay(_:)) will not be affected.

    Declaration

    Swift

    open func reloadData()
  • A view controller contained in a formSheet. Provides interface to update settings on the map floorplan.

    Declaration

    Swift

    public var settingsController: UIViewController?
  • A dynamic UI control constrained to the top left corner of the map. The detailPanel displays the searchResults and content. Its size is determined by the presented controller’s preferredContentSize.

    Declaration

    Swift

    public var detailPanel: FUIMapDetailPanel! { get }
  • A view that displays an array of FUIMapToolbarButton. The toolbar provides easy access to common map functionalities. The view is constrained to the top right corner of the map and resizes to fit the number of FUIMapToolbarButton items.

    Declaration

    Swift

    public var toolbar: FUIMapToolbar! { get }
  • A view controller that displays map annotation information. It displays an array of FUIMapLegendItem and is presented in a UIPopoverPresentationController

    Declaration

    Swift

    public var legend: FUIMapLegend