Skip to content

Map View

FUIMapFloorplanViewController

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

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.


Last update: April 14, 2021