importLandmarks method
- required String filePath,
- required LandmarkFileFormat format,
- required Img image,
- required void onCompleteCallback(
- GemError error
- required int categoryId,
Asynchronously import landmarks from given file format
Parameters
- IN filePath The file path
- IN format The file format, see LandmarkFileFormat.
- IN image The landmark map image. If left empty, a default image is assigned
- IN onCompleteCallback The listener object that implements the notification events associated with this operation.
- IN categoryId The category for the new imported landmarks. The category must exist or use uncategorizedLandmarkCategId to set the landmark as uncategorized
Returns
- The associated ProgressListener if the request can be started, null otherwise.
Throws
- An exception if it fails to initialize.
Implementation
ProgressListener? importLandmarks({
required String filePath,
required LandmarkFileFormat format,
required Img image,
required final void Function(GemError error)? onCompleteCallback,
required int categoryId,
}) {
final EventDrivenProgressListener progressListener = EventDrivenProgressListener();
if (onCompleteCallback != null) {
progressListener.registerOnCompleteWithDataCallback(
(final int err, final String hint, final Map<dynamic, dynamic> json) =>
onCompleteCallback(GemErrorExtension.fromCode(err)),
);
}
GemKitPlatform.instance.registerEventHandler(
progressListener.id,
progressListener,
);
final OperationResult resultString = objectMethod(
_pointerId,
'LandmarkStore',
'importLandmarks',
args: <String, dynamic>{
'filePath': filePath,
'fileFormat': format.id,
'image': image.pointerId,
'categoryId': categoryId,
'listener': progressListener.id,
},
);
final GemError errorCode = GemErrorExtension.fromCode(
resultString['result'],
);
if (errorCode != GemError.success) {
onCompleteCallback?.call(errorCode);
return null;
}
return progressListener;
}