VMWalkingPathOverlayUtil

@interface VMWalkingPathOverlayUtil : NSObject

This is a utility class that performs various calculations for walking path related objects.

Since

1.1
  • Figure out the closest mapped waypoint to a user-tapped location

    Declaration

    Swift

    + (VMMSWaypoint *)findClosestWaypointAtLocation:(CLLocationCoordinate2D)location
                                            onFloor:(NSString *)floorKey
                                              inMap:(VMMSMap *)map;

    Parameters

    location

    the location

    floorKey

    the floor to search on

    Return Value

    the closest waypoint

  • Determines the geographic boudaries that encapsulates the part of a waypath on a given floor

    Declaration

    Swift

    + (VMMSCoordinateBounds *)boundsForWaypath:(VMMSWaypath *)waypath
                                       onFloor:(NSString *)floorKey;

    Parameters

    waypath

    the waypath

    floorKey

    the floor uid

    Return Value

    a VMMSCoordinateBounds object

  • Determines the geographic boundaries that encapsulates the given waypath segment

    Declaration

    Swift

    + (VMMSCoordinateBounds *)boundsForSegment:(VMMSWaypathSegment *)segment;

    Parameters

    segment

    the segment

    Return Value

    a VMMSCoordinateBounds object

  • Determines the geographic boundaries that encapsulates the given floor

    Since

    1.2

    Declaration

    Swift

    + (VMMSCoordinateBounds *)boundsForFloor:(VMMSBaseFloor *)floor;

    Parameters

    floor

    the floor to calculate the boundary for

  • Determine the geographic boundaries that encapsulates the given building

    Since

    1.2

    Declaration

    Swift

    + (VMMSCoordinateBounds *)boundsForBuilding:(VMMSBaseBuilding *)building;

    Parameters

    building

    the building to calculate the boundary for

  • Determine geographic boundaries of a list of coordinates

    Since

    1.2

    Declaration

    Swift

    + (VMMSCoordinateBounds *)boundsForCoordinates:
        (NSArray<NSValue *> *)coordinates;

    Parameters

    coordinates

    the list of coordintes to calculate the boundary for

  • Combine multiple coordinate bounds into a single one.

    Since

    1.2

    Declaration

    Swift

    + (VMMSCoordinateBounds *)unionOfCoordinateBounds:
        (NSArray<VMMSCoordinateBounds *> *)bounds;

    Parameters

    bounds

    a list of bounds to merge

  • Calculates the zoom needed to display the entire bounds on google maps.

    Declaration

    Swift

    + (float)getBoundsZoomLevel:(VMMSCoordinateBounds *)bounds
                       mapWidth:(NSInteger)mapWidthPx
                      mapHeight:(NSInteger)mapHeightPx;

    Parameters

    bounds

    the bounds of the area to zoom

    mapWidthPx

    the width of the map in pixels

    mapHeightPx

    the height of the map in pixels

    Return Value

    the zoom level required to fit the specified bounds into specified width/height, limited to the default maximum zoom

  • Calculates the zoom needed to display the entire bounds on a map.

    Since

    Since 1.2

    Declaration

    Swift

    + (float)getBoundsZoomLevel:(VMMSCoordinateBounds *)bounds
                       mapWidth:(NSInteger)mapWidthPx
                      mapHeight:(NSInteger)mapHeightPx
                        maxZoom:(float)maxZoom;

    Parameters

    bounds

    the bounds of the area to zoom

    mapWidthPx

    the width of the map in pixels

    mapHeightPx

    the height of the map in pixels

    maxZoom

    the max allowable zoom level

    Return Value

    the zoom level required to fit the specified bounds into specified width/height, limited to the specified maximum zoom

  • Rotates a coordinate around a center point

    Declaration

    Swift

    + (CLLocationCoordinate2D)rotateCoordinate:(CLLocationCoordinate2D)coordinate
                                    withCenter:(CLLocationCoordinate2D)center
                                    andBearing:(double)bearing;

    Parameters

    coordinate

    the coordinate to rotate

    center

    the point to rotate around

    bearing

    the amount to rotate (in DEGREES)

    Return Value

    a new coordinate that is the result of the rotation

  • Useful for debugging. This method maps a fill color depending on the waypoint’s type, so it is possible to visually inspect that all waypoints were loaded as intended.

    Declaration

    Swift

    + (id)colorForWaypoint:(VMMSWaypoint *)wp;

    Parameters

    wp

    the waypoint

    Return Value

    the color

  • Useful for debugging. This method maps a stroke color depending on whether the waypoint is classified as indoor or outdoor.

    Declaration

    Swift

    + (id)strokeColorForWaypoint:(VMMSWaypoint *)wp;

    Parameters

    wp

    the waypoint

    Return Value

    the color

  • Locate the closest waypoint to a target from a list

    Declaration

    Swift

    + (VMMSWaypoint *)
        findClosestDestinationWaypointInList:(CLLocationCoordinate2D)location
                                      inList:(NSArray<VMMSWaypoint *> *)list;

    Parameters

    location

    the target location

    list

    a list of waypoints (hopefully nearby)

    Return Value

    the closest waypoint by distances