/**
 * A hash that contains 2 lists of queryable data sources: `wfs` and `wms`.
 * The same data source can only be in one of the two lists. The `wfs` list
 * has priority, i.e. if the data source supports WFS, it's put in the
 * `wfs` list.
 *
 * @typedef {Object} QueryableDataSources
 * @property {gmfDatasourceOGC[]} wms List of queryable data sources that support WMS.
 * @property {gmfDatasourceOGC[]} wfs List of queryable data sources that support WFS.
 */
/**
 * @typedef {Object} QuerentResultItem
 * @property {import('ol/Feature').default<import('ol/geom/Geometry').default>[]} features
 * @property {number} limit
 * @property {boolean} [tooManyFeatures]
 * @property {number} [totalFeatureCount]
 * @property {string []} [requestPartners] All datasources requested in the same request
 */
/**
 * Hash of features by data source ids.
 *
 * @typedef {Object<number, QuerentResultItem>} QuerentResult
 */
/**
 * The options to use when sending GetFeature/GetFeatureInfo requests using
 * the querent or map query service.
 *
 * @typedef {Object} IssueGetFeaturesOptions
 * @property {string} [action='replace'] The action the MapQuerent should take regarding the queried
 *    features. Possible values are:
 *
 *    - `replace`: newly queried features are used as result
 *    - `add`:     newly queried features are added to the existing ones
 *    - `remove`:  newly queried features are removed from the existing ones
 * @property {import('ol/coordinate').Coordinate} [coordinate] The coordinate to issue the requests with,
 *    which can end up with either WMS or WFS requests.
 * @property {import('ngeo/datasource/DataSource').default[]} [dataSources] list of data sources to
 *    query. Only those that meet the requirements will actually be queried. The querent service requires
 *    either the `dataSources` or `queryableDataSources` property to be set.
 * @property {import('ol/extent').Extent} [extent] The extent to issue the requests with, which can end up
 *    with WFS requests only.
 * @property {import('ol/format/filter/Filter').default} [filter] A filter to additionally use with the
 *    query. Only used by WFS requests.
 *    If a filter is defined, then it is used instead of the data source's filter rules.
 * @property {import('ol/geom/Geometry').default} [geometry] The geometry to use as filter for the
 *    requests, which can end up with WFS requests only.
 * @property {number} [limit] The maximum number of features to get per request.
 * @property {import('ol/Map').default} map The ol3 map object. Used to fill some parameters of the
 *    queries, such as 'srs' and filter the queryable layers within the data sources.
 * @property {QueryableDataSources} [queryableDataSources] A hash of queryable data sources, which must meet
 *    all requirements. The querent service requires either the `dataSources` or `queryableDataSources`
 *    property to be set.
 * @property {number} [tolerance] A minimal buffer value in pixels to ensure a minimal bbox around a
 *    coordinate to issue WFS requests.
 * @property {boolean} [bboxAsGETParam=false] Pass the queried bbox as a parameter of the GET query on WFS
 *    requests.
 * @property {boolean} [queryCountFirst=true] Do a requested with `resultType=hits` before.
 */
/**
 * @hidden
 */
export class Querent {
    /**
     * The ngeo Querent is a service that issues all sorts of queries using
     * ngeo data sources. It does not store the result. Instead, it returns it
     * using promises. Any component that inject this service can use it to
     * make it issue its own queries and do whatever it wants with the result.
     *
     * It supports sending OGC requests and parse the response, such as:
     * - WFS DescribeFeatureType
     * - WFS GetFeature
     * - WMS GetCapabilites
     * - WMS GetFeatureInfo
     * - WMTS GetCapabilities
     *
     * @param {angular.IHttpService} $http Angular $http service.
     * @param {angular.IQService} $q The Angular $q service.
     * @param {import('ngeo/filter/RuleHelper').RuleHelper} ngeoRuleHelper Ngeo rule helper service.
     * @param {import('ngeo/misc/WMSTime').WMSTime} ngeoWMSTime wms time service.
     * @ngdoc service
     * @ngname ngeoQuerent
     */
    constructor($http: angular.IHttpService, $q: angular.IQService, ngeoRuleHelper: import("ngeo/filter/RuleHelper").RuleHelper, ngeoWMSTime: import("ngeo/misc/WMSTime").WMSTime);
    /**
     * @type {angular.IHttpService}
     * @private
     */
    private http_;
    /**
     * @type {angular.IQService}
     * @private
     */
    private q_;
    /**
     * @type {import('ngeo/filter/RuleHelper').RuleHelper}
     * @private
     */
    private ngeoRuleHelper_;
    /**
     * @type {import('ngeo/misc/WMSTime').WMSTime}
     * @private
     */
    private ngeoWMSTime_;
    /**
     * Promises that can be resolved to cancel started requests.
     *
     * @type {angular.IDeferred<Document | Element | string>[]}
     * @private
     */
    private requestCancelers_;
    /**
     * Cache of promises for WMS GetCapabilities requests. They key is the
     * online resource base url that is used to do the query.
     *
     * @type {Object<string, angular.IPromise<Document|Element|string>>}
     * @private
     */
    private wmsGetCapabilitiesPromises_;
    /**
     * Cache of promises for WMST GetCapabilities requests. They key is the
     * url that is used to do the query.
     *
     * @type {Object<string, angular.IPromise<Document|Element|string>>}
     * @private
     */
    private wmtsGetCapabilitiesPromises_;
    /**
     * Issue WMS GetFeatureInfo and/or WFS GetFeature requests using the given
     * data sources, map and optional filters.
     *
     * @param {IssueGetFeaturesOptions} options Options.
     * @returns {angular.IPromise<QuerentResult>} Promise.
     */
    issue(options: IssueGetFeaturesOptions): angular.IPromise<QuerentResult>;
    /**
     * Browse a given list of data sources. Return 2 lists of data sources that
     * are queryable, the first one being those that support WFS and the other
     * WMS only. This means that WFS is always favored first, then WMS.
     *
     * The map view resolution determines if the inner ogc layers are in range.
     *
     * @param {import('ngeo/datasource/DataSource').default[]} dataSources Data sources
     * @param {import('ol/Map').default} map Map.
     * @returns {QueryableDataSources} Queryable data sources.
     */
    getQueryableDataSources(dataSources: import("ngeo/datasource/DataSource").default[], map: import("ol/Map").default): QueryableDataSources;
    /**
     * @param {gmfDatasourceOGC} dataSource Data source.
     * @returns {angular.IPromise<Document|Element|string>} Promise.
     */
    wfsDescribeFeatureType(dataSource: gmfDatasourceOGC): angular.IPromise<Document | Element | string>;
    /**
     * @param {Object<string, *>[]} layerCapabilities List of WMS layer capabilities
     * @param {string} layerName Name of the WMS layer
     * @returns {?Object<string, *>} Found WMS layer capability
     */
    wmsFindLayerCapability(layerCapabilities: {
        [x: string]: any;
    }[], layerName: string): {
        [x: string]: any;
    } | null;
    /**
     * @param {string} baseUrl Base url of the WMS server.
     * @param {boolean} [opt_cache] Whether to use the cached capability, if
     *     available. Enabling this will also store the capability when required
     *     for the first time. Defaults to: `true`.
     * @returns {angular.IPromise<void>} Promise.
     */
    wmsGetCapabilities(baseUrl: string, opt_cache?: boolean): angular.IPromise<void>;
    /**
     * @param {Object<string, *>[]} layerCapabilities List of WMTS layer capabilities
     * @param {string} layerName Name of the WMTS layer, a.k.a. the identifier.
     * @returns {?Object<string, *>} Found WTMS layer capability
     */
    wmtsFindLayerCapability(layerCapabilities: {
        [x: string]: any;
    }[], layerName: string): {
        [x: string]: any;
    } | null;
    /**
     * @param {string} url URL of the WMTS server. Note that it must contain
     *     all required arguments.
     * @param {boolean} [opt_cache] Whether to use the cached capability, if
     *     available. Enabling this will also store the capability when required
     *     for the first time. Defaults to: `true`.
     * @returns {angular.IPromise<void>} Promise.
     */
    wmtsGetCapabilities(url: string, opt_cache?: boolean): angular.IPromise<void>;
    /**
     * Handles the result of a single WFS GetFeature
     * request. Read features from the response and return them.
     *
     * @param {gmfDatasourceOGC[]} dataSources List of
     *     queryable data sources that were used to do the query.
     * @param {number} maxFeatures The maximum number of features to get with the query.
     * @param {number} totalFeatureCount Count of features of the query.
     * @param {boolean} wfs Whether the query was WFS or WMS.
     * @param {angular.IHttpResponse<Document|Element|string>} response Response.
     * @returns {QuerentResult} Hash of features by data source ids.
     * @private
     */
    private handleWFSQueryResult_;
    /**
     * Handles the result of a single WMS GetFeatureInfo or WFS GetFeature
     * request. Read features from the response and return them.
     *
     * @param {gmfDatasourceOGC[]} dataSources List of
     *     queryable data sources that were used to do the query.
     * @param {number} limit The maximum number of features to get with the query.
     * @param {boolean} wfs Whether the query was WFS or WMS.
     * @param {angular.IHttpResponse<Document|Element|string>|number} response Response.
     * @returns {QuerentResult} Hash of features by data source ids.
     * @private
     */
    private handleQueryResult_;
    /**
     * Read and assign the type of the feature to each feature in the data.
     * The type will be stocked in the properties of the features as
     * "ngeo_feature_type_".
     *
     * @param {gmfDatasourceOGC} dataSource used to read the features.
     * @param {Document|Element|string} data the response data.
     * @param {boolean} wfs Whether the query was WFS or WMS.
     * @returns {import('ol/Feature').default<import('ol/geom/Geometry').default>[]} returned features with a type in each features.
     * @private
     */
    private readAndTypeFeatures_;
    /**
     * Return the types defined in the format of the datasource. Can set the
     * types if one is given.
     *
     * @param {gmfDatasourceOGC} dataSource that contains the format object.
     * @param {boolean} wfs Whether the query was WFS or WMS.
     * @param {string[]} [opt_types] An array of type if you want to set the
     *     type of the format object.
     * @returns {string[]} The types defined in the format.
     * @private
     */
    private getSetOlFormatTypes_;
    /**
     * Issue WFS GetFeature requests using the given combined data sources, map
     * and optional filters.
     *
     * @param {CombinedDataSources} combinedDataSources Combined data sources.
     * @param {IssueGetFeaturesOptions} options Options.
     * @returns {angular.IPromise<QuerentResult>} Promise.
     * @private
     */
    private issueCombinedWFS_;
    /**
     * Create and add a buffer around the given coordinate.
     * The buffer is built with the flipped (horizontally and vertically) values of the queryIconPosition.
     *
     * @param {!number[]} queryIconPosition The values in px to buffer the bbox (1 to 4 values, css system).
     * @param {!number} resolution The map view resolution to define the px size correctly.
     * @param {!import('ol/coordinate').Coordinate} coordinate The bbox to buffer.
     * @returns {!import('ol/extent').Extent} The new bbox or null if the queryIconPosition param
     * is not valid.
     * @private
     */
    private makeBboxWithQueryIconPosition_;
    /**
     * Issue WMS GetFeatureInfo requests using the given combined data sources,
     * map and optional filters.
     *
     * @param {CombinedDataSources} combinedDataSources Combined data sources.
     * @param {IssueGetFeaturesOptions} options Options.
     * @returns {angular.IPromise<QuerentResult>} Promise.
     * @private
     */
    private issueCombinedWMS_;
    /**
     * @param {gmfDatasourceOGC[]} dataSources List of
     *     queryable data sources that supports WFS.
     * @returns {CombinedDataSources} Combined lists of data sources.
     * @private
     */
    private getCombinableWFSDataSources_;
    /**
     * @param {gmfDatasourceOGC[]} dataSources List of
     *     queryable data sources that supports WMS.
     * @returns {CombinedDataSources} Combined lists of data sources.
     * @private
     */
    private getCombinableWMSDataSources_;
    /**
     * Checks if a data source can be queried, which requires it to be:
     * - visible
     * - in range
     * - queryable (using the native getter)
     * - have at least one OGC layer in range of current map view resolution.
     *
     * @param {import('ngeo/datasource/DataSource').default} ds Data source
     * @param {number} res Resolution.
     * @returns {boolean} Whether the data source is queryable
     * @private
     */
    private isDataSourceQueryable_;
    /**
     * Make sure that feature ids are unique, because the same features might
     * be returned for different layers.
     *
     * @param {import('ol/Feature').default<import('ol/geom/Geometry').default>[]} features Features
     * @param {number} dataSourceId Data source id.
     * @private
     */
    private setUniqueIds_;
    /**
     * @returns {angular.IDeferred<*>} A deferred that can be resolved to cancel a HTTP request.
     * @private
     */
    private registerCanceler_;
    /**
     * @private
     */
    private cancelStillRunningRequests_;
}
export namespace Querent {
    let $inject: string[];
}
export default myModule;
/**
 * A hash that contains 2 lists of queryable data sources: `wfs` and `wms`.
 * The same data source can only be in one of the two lists. The `wfs` list
 * has priority, i.e. if the data source supports WFS, it's put in the
 * `wfs` list.
 */
export type QueryableDataSources = {
    /**
     * List of queryable data sources that support WMS.
     */
    wms: gmfDatasourceOGC[];
    /**
     * List of queryable data sources that support WFS.
     */
    wfs: gmfDatasourceOGC[];
};
export type QuerentResultItem = {
    features: import("ol/Feature").default<import("ol/geom/Geometry").default>[];
    limit: number;
    tooManyFeatures?: boolean;
    totalFeatureCount?: number;
    /**
     * All datasources requested in the same request
     */
    requestPartners?: string[];
};
/**
 * Hash of features by data source ids.
 */
export type QuerentResult = {
    [x: number]: QuerentResultItem;
};
/**
 * The options to use when sending GetFeature/GetFeatureInfo requests using
 * the querent or map query service.
 */
export type IssueGetFeaturesOptions = {
    /**
     * The action the MapQuerent should take regarding the queried
     * features. Possible values are:
     *
     * - `replace`: newly queried features are used as result
     * - `add`:     newly queried features are added to the existing ones
     * - `remove`:  newly queried features are removed from the existing ones
     */
    action?: string;
    /**
     * The coordinate to issue the requests with,
     * which can end up with either WMS or WFS requests.
     */
    coordinate?: import("ol/coordinate").Coordinate;
    /**
     * list of data sources to
     * query. Only those that meet the requirements will actually be queried. The querent service requires
     * either the `dataSources` or `queryableDataSources` property to be set.
     */
    dataSources?: import("ngeo/datasource/DataSource").default[];
    /**
     * The extent to issue the requests with, which can end up
     * with WFS requests only.
     */
    extent?: import("ol/extent").Extent;
    /**
     * A filter to additionally use with the
     * query. Only used by WFS requests.
     * If a filter is defined, then it is used instead of the data source's filter rules.
     */
    filter?: import("ol/format/filter/Filter").default;
    /**
     * The geometry to use as filter for the
     * requests, which can end up with WFS requests only.
     */
    geometry?: import("ol/geom/Geometry").default;
    /**
     * The maximum number of features to get per request.
     */
    limit?: number;
    /**
     * The ol3 map object. Used to fill some parameters of the
     * queries, such as 'srs' and filter the queryable layers within the data sources.
     */
    map: import("ol/Map").default;
    /**
     * A hash of queryable data sources, which must meet
     * all requirements. The querent service requires either the `dataSources` or `queryableDataSources`
     * property to be set.
     */
    queryableDataSources?: QueryableDataSources;
    /**
     * A minimal buffer value in pixels to ensure a minimal bbox around a
     * coordinate to issue WFS requests.
     */
    tolerance?: number;
    /**
     * Pass the queried bbox as a parameter of the GET query on WFS
     * requests.
     */
    bboxAsGETParam?: boolean;
    /**
     * Do a requested with `resultType=hits` before.
     */
    queryCountFirst?: boolean;
};
export type CombinedDataSources = gmfDatasourceOGC[][];
import angular from 'angular';
import gmfDatasourceOGC from 'gmf/datasource/OGC';
/**
 * @typedef {gmfDatasourceOGC[][]} CombinedDataSources
 */
/**
 * @type {angular.IModule}
 * @hidden
 */
declare const myModule: angular.IModule;
