Skip to main content

class ARDeviceMap

(Niantic.Lightship.AR.Mapping.ARDeviceMap)

Overview​

ARDeviceMap encapsulates device map data generated from mapping process, and provides to serialize/deserialize device map for persistent or sharing purpose.

class ARDeviceMap {
public:

struct SerializableDeviceMap;
struct SerializeableDeviceMapGraph;
struct SerializeableDeviceMapNode;

// properties

List<SerializeableDeviceMapNode> DeviceMapNodes;
SerializeableDeviceMapGraph DeviceMapGraph;
int DefaultAnchorIndex;

// methods

ARDeviceMap();

void AddDeviceMapNode(
ulong subId1,
ulong subId2,
byte[] mapData,
byte[] anchorPayload,
string mapType
);

bool HasMapNode(TrackableId mapId);
void SetDeviceMapGraph(byte[] graphData);
virtual byte[] Serialize();
byte[] GetAnchorPayload();
bool HasValidMap();
static ARDeviceMap CreateFromSerializedData(byte[] serializedDeviceMap);

protected:
// fields

List<SerializeableDeviceMapNode> _deviceMapNodes = new();
SerializeableDeviceMapGraph _deviceMapGraph = new();
int _defaultAnchorIndex = 0;
HashSet<TrackableId> _addedMapIds = new HashSet<TrackableId>();
};

Detailed Documentation​

ARDeviceMap encapsulates device map data generated from mapping process, and provides to serialize/deserialize device map for persistent or sharing purpose.

.. note::

This is an experimental feature, and is subject to breaking changes or deprecation without notice

Properties​

DeviceMapNodes​

List<SerializeableDeviceMapNode> DeviceMapNodes

Get a list of SerializeableDeviceMapNode, either mapped on the device or deserialized

.. note::

This is an experimental feature, and is subject to breaking changes or deprecation without notice

DeviceMapGraph​

SerializeableDeviceMapGraph DeviceMapGraph

Get a SerializeableDeviceMapGraph in this device map

.. note::

This is an experimental feature, and is subject to breaking changes or deprecation without notice

Methods​

AddDeviceMapNode​

void AddDeviceMapNode(
ulong subId1,
ulong subId2,
byte[] mapData,
byte[] anchorPayload,
string mapType
)

Add a device map node. This method is meant to be called by ARDeviceMappingManager when a device map is generated.

.. note::

This is an experimental feature, and is subject to breaking changes or deprecation without notice

    Parameters:

    subId1 -

    subId2 -

    mapData -

    anchorPayload -

HasMapNode​

bool HasMapNode(TrackableId mapId)

Checks if map has node by id

.. note::

This is an experimental feature, and is subject to breaking changes or deprecation without notice

    Parameters:

    mapId -

SetDeviceMapGraph​

void SetDeviceMapGraph(byte[] graphData)

Set graph blob data. This method is meant to be called by ARDeviceMappingManager when a device map and graph is generated.

.. note::

This is an experimental feature, and is subject to breaking changes or deprecation without notice

    Parameters:

    graphData -

Serialize​

virtual byte[] Serialize()

Get serialized device map

.. note::

This is an experimental feature, and is subject to breaking changes or deprecation without notice

    Returns:

    Serailized device map as byte array

GetAnchorPayload​

byte[] GetAnchorPayload()

Get the anchor payload of this device map

.. note::

This is an experimental feature, and is subject to breaking changes or deprecation without notice

    Returns:

    Persistent anchor payload as byte array

HasValidMap​

bool HasValidMap()

Check if this ARDeviceMap has valid device map data. In case not having valid map data, this ARDviceMap should not be used for serialization

    Returns:

    True if it has valid device map data. Otherwise false.

CreateFromSerializedData​

static ARDeviceMap CreateFromSerializedData(byte[] serializedDeviceMap)

Create an instance of ARDeviceMap from serialized device map data

.. note::

This is an experimental feature, and is subject to breaking changes or deprecation without notice

    Parameters:

    serializedDeviceMap - Serialized device map as byte array

    Returns:

    An instance of ARDeviceMap