ITerraExplorerAsync80

This interface, returned by most of TerraExplorer's asynchronous methods such as ConnectAsync, CreateFeatureLayerAsync and ExecuteQueryAsync, provides a callback-based mechanism similar to the JavaScript promise and the C# Task. It allows for handling the various stages of an asynchronous operation, from tracking progress to managing rejection/error, and finally resolving the operation.

ITerraExplorerAsync80 allows for efficient management of asynchronous operations through its support for method chaining. Methods that return an instance of ITerraExplorerAsync80 support subsequent calls to methods on the returned object directly, ensuring a cleaner and more streamlined code structure, and making asynchronous operations more intuitive to handle.

E.g.,

g_asyncObj = layer.ExecuteQueryAsync(attributeFilter, -1, "", geometryFilter)

    .OnResolve(function (features) {

        // Handle features

    });

After calling the ExecuteQueryAsync method on the layer object, the returned ITerraExplorerAsync80 instance is immediately chained with the OnResolve method. If a corresponding synchronous method has a return value, it's passed as a parameter to the OnResolve method's callback function. For example, calling ExecuteQueryAsync would pass an IFeatures80, containing all the features returned by the attribute and spatial query, to the OnResolve callback.

See "Asynchronous Requests" in the "Overview" chapter for C# and JavaScript examples.

 

 

Properties

 

State

Returns the current state of the asynchronous operation (pending, fulfilled, rejected), allowing you to check its status.

 

Methods

 

Abort

Aborts or cancels the ongoing asynchronous operation.

OnProgress

Reports on the progress of the asynchronous operation, providing updates on the ongoing task. This function is currently only implemented for the ExecuteQueryAsync and QueryElevationBufferAsync methods.

OnReject

This function is called when the asynchronous operation encounters an error or is rejected, allowing you to handle any failures or exceptions. It also returns an error message.

OnResolve

This function is called when the asynchronous operation is successfully resolved, and it returns the output generated by the parent asynchronous function.