Reference Source
public class | source

LegendQuery

Legend Query information of the specific layers from the server.

See:

Example:

var legend_query = KQ.Query.LegendQuery.getInstance();
console.log(legend_query);
try {
   var options = {
     url: 'http://172.16.1.157:8699/KQGis/rest/services/zy',
     layerId: 137,
   };

   legend_query.queryAsync(options,
     function query_good () {
       console.log('query_good');

       var data = legend_query.data();
       console.log('legend query data.length:' + data.length);

       data.forEach(function (d) {
         console.log(d.properties);
       })
     },
     function query_error () {
       console.log('query_error');
     });
 }
catch (e) {
   console.log('catch error:' + e);
 }

Static Method Summary

Static Public Methods
public static

Get instance object(Singleton mode)

Method Summary

Public Methods
public

data(): Object[]

Get data

public

Get last error message

public

Whether server return error

public

queryAsync(options: Object, function_good: function(): null, function_error: function(): null): Promise<TResult>

Legend Query information from the server.

Static Public Methods

public static getInstance(): LegendQuery source

Get instance object(Singleton mode)

Return:

LegendQuery

Public Methods

public data(): Object[] source

Get data

Return:

Object[]

public errorMsg(): String source

Get last error message

Return:

String

public isLastError(): Boolean source

Whether server return error

Return:

Boolean

public queryAsync(options: Object, function_good: function(): null, function_error: function(): null): Promise<TResult> source

Legend Query information from the server.

Params:

NameTypeAttributeDescription
options Object

Legend Query options

options.url String

Service url

options.layerId String

Layer id of legend query

options.bbox String

The range of layer for legend query

function_good function(): null

The function will run after querying successfully.

function_error function(): null

The function will run after querying unsuccessfully.

Return:

Promise<TResult>