LibPlacenote

public class LibPlacenote

Swift wrapper of LibPlacenote C API

  • Alias for the callback closure protocol that subscribes to the Placenote pose and its corresponding ARKit pose.

    Declaration

    Swift

    public typealias PoseCallback = (_ outputPose: matrix_float4x4, _ arkitPose: matrix_float4x4) -> Void
  • Alias for the callback closure protocol that subscribes to the map ID of the saveMap operation, could return nil in the case of failure.

    Declaration

    Swift

    public typealias SaveMapCallback = (_ mapId: String?) -> Void
  • Alias for the callback closure protocol that subscribes to the progress of a file transfer operation to/from the placenote cloud.

    Declaration

    Swift

    public typealias FileTransferCallback = (_ completed: Bool, _ faulted: Bool, _ percentage: Float) -> Void
  • Alias for the callback closure protocol that subscribes to the success/failure of a deleteMap operation.

    Declaration

    Swift

    public typealias DeleteMapCallback = (_ deleted: Bool) -> Void
  • Alias for the callback closure protocol that subscribes to the success/failure of a saveMetaData operation.

    Declaration

    Swift

    public typealias MetadataSavedCallback = (_ success: Bool) -> Void
  • Alias for the callback closure protocol that subscribes to the success/failure of a gaveMetaData operation and the metadata it returns.

    Declaration

    Swift

    public typealias GetMetadataCallback = (_ success: Bool, _ metadata: MapMetadata) -> Void
  • Alias for the callback closure protocol that subscribes to the success/failure of a listMaps operation and the map list it returns.

    Declaration

    Swift

    public typealias ListMapCallback = (_ success: Bool, _ mapList: [String : MapMetadata]) -> Void
  • Alias for the callback closure protocol that subscribe to the success/failure status of the initialization process.

    Declaration

    Swift

    public typealias OnInitializedCallback = (_ success: Bool) -> Void
  • Enums that indicates the status of the LibPlacenote mapping module

    See more

    Declaration

    Swift

    public enum MappingStatus : Int
  • Enum that indicates the mapping quality of the current area in the map. Correlates with the the likelihood of localization at that point in the map.

    See more

    Declaration

    Swift

    public enum MappingQuality : Int
  • Enums that indicates the mode of the LibPlacenote mapping module

    See more

    Declaration

    Swift

    public enum MappingMode : Int
  • Struct that contains location data for the map. All fields are required.

    See more

    Declaration

    Swift

    public class MapLocation : Codable
  • Structure used for searching your maps. All fields are optional. When multiple fields are set the search condition is logically ANDed, returning a smaller list of maps.

    See more

    Declaration

    Swift

    public class MapSearch : Codable
  • Struct for searching maps by location. All fields are required.

    See more

    Declaration

    Swift

    public class MapLocationSearch : Codable
  • Struct for setting map metadata. All fields are optional.

    See more

    Declaration

    Swift

    public class MapMetadataSettable
  • Struct for getting map metatada. See more

    Declaration

    Swift

    public class MapMetadata : MapMetadataSettable
  • Accessor to static instance of the LibPlacenote singleton

    Declaration

    Swift

    public static var instance: LibPlacenote { get }
  • A multicast delegate developers can append to in order to subscribe to the pose and status events from LibPlacenote

    Declaration

    Swift

    public var multiDelegate: MulticastPNDelegate
  • Function to initialize the LibPlacenote SDK, must be called before any other function is invoked

    Declaration

    Swift

    public func initialize(apiKey: String, onInitialized: (OnInitializedCallback)? = nil)
  • Accessor function that returns initialization status of LibPlacenote

    Declaration

    Swift

    public func initialized() -> Bool

    Return Value

    A Bool that indicates whether LibPlacenote SDK is initialized

  • Function to shutdown all LibPlacenote SDK functions, creates a cleaner exit and shutdown of critical mapper threads

    Declaration

    Swift

    public func shutdown()
  • Function to start a mapping/localization session in LibPlacenote. If a map is loaded before startSession is called, libPlacenote will localize against the loaded map without mapping. If not, it will start mapping the environment.

    Declaration

    Swift

    public func startSession(extend: Bool = false)

    Return Value

    A Bool that indicates whether LibPlacenote SDK is initialized

  • Gets the mode of the running session which indicates (mapping versus localizing mode)

    Declaration

    Swift

    public func getMode() -> MappingMode

    Return Value

    A MappingStatus that indicates the current status of LibPlacenote mapping engine

  • Return the current status of the mapping engine

    Declaration

    Swift

    public func getStatus() -> MappingStatus

    Return Value

    A MappingStatus that indicates the current status of LibPlacenote mapping engine

  • Return the current mapping quality of a mapping session

    Declaration

    Swift

    public func getMappingQuality() -> MappingQuality

    Return Value

    A MappingQuality that indicates the mapping quality of current frames

  • Return the current 6DoF inertial pose of the LibPlacenote pose tracker against its map

    Declaration

    Swift

    public func getPose() -> matrix_float4x4

    Return Value

    A matrix_float4x4 that describes the inertial pose

  • Return the current 6DoF inertial pose of the LibPlacenote pose tracker against its map

    Declaration

    Swift

    public func getCurrentFrame() -> CVImageBuffer?

    Return Value

    A matrix_float4x4 that describes the inertial pose

  • Return a position vector3 in the current ARKit frame transformed into the inertial frame w.r.t the current Placenote Map

    Declaration

    Swift

    public func processPosition(position: SCNVector3) -> SCNVector3

    Parameters

    position

    ARKit position to be converted to Placenote inertial map frame

    Return Value

    A SCNVector3 that describes the position of an object in the inertial map frame.

  • Return a transform in the current ARKit frame transformed into the inertial frame w.r.t the current Placenote Map

    Declaration

    Swift

    public func processPose(pose: SCNMatrix4) -> SCNMatrix4

    Parameters

    pose

    ARKit pose to be converted to Placenote inertial map frame

    Return Value

    A matrix_float4x4 that describes the position and orientation of an object in the inertial map frame.

  • Return a transform in the current ARKit frame transformed into the inertial frame w.r.t the current Placenote Map

    Declaration

    Swift

    public func processPose(pose: matrix_float4x4) -> matrix_float4x4

    Parameters

    pose

    ARKit pose to be converted to Placenote inertial map frame

    Return Value

    A matrix_float4x4 that describes the position and orientation of an object in the inertial map frame.

  • Return an array of 3d points in the inertial map frame that LibPlacenote is currently measuring

    Declaration

    Swift

    public func getTrackedFeatures(measCountThreshold: Int = 2) -> Array<PNFeaturePoint>

    Return Value

    A Array that contains a set of feature points in the inertial map frame that LibPlacenote is currently tracking

  • Return the entire map that LibPlacenote has generated over the current session

    Declaration

    Swift

    public func getMap(measCountThreshold: Int = 2) -> Array<PNFeaturePoint>

    Parameters

    measCountThreshold

    minimum measurement count threshold to filter the return list of map points, default 0 means returning all points

    Return Value

    A Array that contains a set of feature points in the inertial map frame that LibPlacenote generated within this mapping session

  • Function that sent the latest ARFrame to the Placenote Mapping SDK

    Declaration

    Swift

    public func setARFrame(frame: ARFrame)

    Parameters

    frame

    latest frame from ARSession to be sent to Placenote Mapping SDK

  • Function to stop a running mapping session, and upload it to the LibPlacenote Map Cloud upon saving succesfully. Note that this will reset the generated map, therefore saveMap should be called before you call this function

    Declaration

    Swift

    public func stopSession()
  • Function to set the current frame as the localization thumbnail

    Declaration

    Swift

    public func setLocalizationThumbnail()
  • Function to set the current frame as the localization thumbnail

    Declaration

    Swift

    public func getLocalizationThumbnail(thumbnailCb: @escaping (_ thumbnail: UIImage?)-> Void)

    Parameters

    thumbnailCb

    async callback to return the thumbnail image

  • Save the map that LibPlacenote is generating in its current mapping session

    Declaration

    Swift

    public func saveMap(savedCb: @escaping SaveMapCallback, uploadProgressCb: @escaping FileTransferCallback) -> Void

    Parameters

    savedCb

    an asynchronous callback that indicates whether a map has been saved and what the unique mapId is

    uploadProgressCb

    progress of the automatic synchronization with Placenote Map Cloud

  • Delete a map given its mapId from the filesystem and LibPlacenote Map Cloud

    Declaration

    Swift

    public func deleteMap(mapId: String, deletedCb : @escaping DeleteMapCallback)

    Parameters

    mapId

    ID of the map to be deleted from the filesystem and the Map Cloud

    deletedCb

    async callback to indicate whether the map is successfully deleted

  • Load a map given its mapId. If the map does not exist in the filesystem, tries to download from the Placenote Map Cloud

    Declaration

    Swift

    public func loadMap(mapId: String, downloadProgressCb : @escaping FileTransferCallback)

    Parameters

    mapId

    ID of the map to be deleted from the filesystem and the Map Cloud

    deletedCb

    async callback to indicate whether the map is successfully deleted

  • Fetch a list of maps filtered with name identifier.

    Declaration

    Swift

    public func searchMaps(name: String, listCb: @escaping ListMapCallback)

    Parameters

    name

    name of the map you’re looking for.

    listCb

    async callback that returns the map list for based on parameters specified in search.

  • Fetch a list of maps filtered with Date range limits.

    Declaration

    Swift

    public func searchMaps(newerThan: Date, olderThan: Date, listCb: @escaping ListMapCallback)

    Parameters

    newerThan

    limit the list of returned maps to be newer than this Date.

    olderThan

    limit the list of returned maps to be older than this Date.

    listCb

    async callback that returns the map list for based on parameters specified in search.

  • Fetch a list of maps filtered within the radius of a circle around the GPS location passed in.

    Declaration

    Swift

    public func searchMaps(latitude: Double, longitude: Double, radius: Double, listCb: @escaping ListMapCallback)

    Parameters

    latitude

    latitude of the neighbourhood center for the map search.

    longitude

    longitude of the neighbourhood center for the map search.

    radius

    radius of the neighbourhood center for the map search.

    listCb

    async callback that returns the map list for based on parameters specified in search

  • Fetch a list of maps filtered within the radius of a circle around the GPS location passed in.

    Declaration

    Swift

    public func searchMapsByUserData(userDataQuery: String, listCb: @escaping ListMapCallback)

    Parameters

    userdataQuery

    see MapSearch.userdataQuery for details.

  • Fetch a list of maps filtered by some search parameters.

    Declaration

    Swift

    public func searchMaps(searchParams: MapSearch, listCb: @escaping ListMapCallback)

    Parameters

    search

    parameters to constrain the map search. See MapSearch for details.

    listCb

    async callback that returns the map list for based on parameters specified in search.

  • Fetch of list of map IDs that is associated with the given API Key

    Declaration

    Swift

    public func listMaps(listCb: @escaping ListMapCallback)

    Parameters

    listCb

    async callback that returns the map list for a API Key

  • Get the metadata for the given map, which will be returned as Libplacenote.metadata with metadata

    Declaration

    Swift

    public func getMetadata (mapId: String, getMetadataCb: @escaping GetMetadataCallback) -> Void

    Parameters

    mapId

    ID of the map

    getMetadataCb

    async callback that returns meta in the form of Libplacenote.metadata. Metadata is empty if the mapid is incorrect or does not exist

  • Set the metadata for the given map, which will be returned as the value of the dictionary of ListMapCallback. The metadata must be a valid JSON value, object, or array a serialized string.

    Declaration

    Swift

    public func setMetadata(mapId: String, metadata: MapMetadataSettable) -> Bool

    Parameters

    mapId

    ID of the map

    metadataJson

    Serialized JSON metadata

    Return Value

    False if the SDK was not initialized, or metadataJson was invalid. True otherwise.

  • Set the metadata for the given map, which will be returned as the value of the dictionary of ListMapCallback. The metadata must be a valid JSON value, object, or array a serialized string.

    Declaration

    Swift

    public func setMetadata(mapId: String, metadata: MapMetadataSettable, metadataSavedCb: @escaping MetadataSavedCallback) -> Bool

    Parameters

    mapId

    ID of the map

    metadataJson

    Serialized JSON metadata

    metadataSavedCb

    Callback to indicate the success/failure of the setMapMetadata result

    Return Value

    False if the SDK was not initialized, or metadataJson was invalid. True otherwise.

  • Start recording a dataset to be reported to the Placenote team. Recording is automatically stopped when stopSession() is called.

    Declaration

    Swift

    public func startRecordDataset(uploadProgressCb: @escaping FileTransferCallback) -> Void

    Parameters

    uploadProgressCb

    callback to monitor upload progress of the dataset