import { Point, Polygon } from 'ol/geom';
import { boundingExtent } from 'ol/extent';
export const openlayersQueryConfig = [
    {
        name: 'ID查询',
        url: 'https://iserver.supermap.io/iserver/services/data-world/rest/data',
        type: 'ID',
        data: {
            IDs: [246, 247],
            datasetNames: ['World:Countries']
        }
    },
    {
        name: 'SQL查询',
        url: 'https://iserver.supermap.io/iserver/services/data-world/rest/data',
        type: 'SQL',
        data: {
            queryParameter: {
                name: 'Countries@World',
                attributeFilter: 'SMID = 247'
            },
            datasetNames: ['World:Countries']
        }
    },
    {
        name: '范围查询',
        url: 'https://iserver.supermap.io/iserver/services/data-world/rest/data',
        type: 'Bounds',
        data: {
            datasetNames: ['World:Capitals'],
            bounds: boundingExtent([
                [-20, 20],
                [-20, -20],
                [20, -20],
                [20, 20],
                [-20, 20]
            ])
        }
    },
    {
        name: 'Geometry查询',
        url: 'https://iserver.supermap.io/iserver/services/data-world/rest/data',
        type: 'Geometry',
        data: {
            datasetNames: ['World:Countries'],
            geometry: new Polygon([
                [
                    [0, 0],
                    [-10, 30],
                    [-30, 0],
                    [0, 0]
                ]
            ]),
            spatialQueryMode: 'INTERSECT' // 相交空间查询模式
        }
    },
    // {
    //   name: '距离查询',
    //   url: 'https://iserver.supermap.io/iserver/services/map-world/rest/maps/World',
    //   type: 'Distance',
    //   data: {
    //     queryParams: { name: 'Capitals@World.1' },
    //     distance: 10, // distance的单位跟地物的坐标系单位一致，此处为度
    //     geometry: new Point([104, 30])
    //   }
    // },
    {
        name: '缓冲区查询',
        url: 'https://iserver.supermap.io/iserver/services/data-world/rest/data',
        type: 'Buffer',
        data: {
            datasetNames: ['World:Capitals'],
            bufferDistance: 10,
            fields: ['POP'],
            attributeFilter: 'POP > 1020.0',
            geometry: new Point([95, 34])
            // geometry: new Polygon([
            //   [
            //     [0, 0],
            //     [-10, 30],
            //     [-30, 0],
            //     [0, 0]
            //   ]
            // ])
        }
    },
    {
        name: '栅格属性查询',
        url: 'https://iserver.supermap.io/iserver/services/data-world/rest/data',
        type: 'GridCellInfo',
        data: {
            dataSourceName: 'World',
            datasetName: 'WorldEarth',
            X: 13.457178106306543,
            Y: 8.602545892897325
        }
    },
    {
        name: '字段查询',
        url: 'https://iserver.supermap.io/iserver/services/data-world/rest/data',
        type: 'Fields',
        data: {
            datasource: 'World',
            dataset: 'continent_T'
        }
    },
    {
        name: '字段统计信息查询',
        url: 'https://iserver.supermap.io/iserver/services/data-world/rest/data',
        type: 'FieldStatisticsInfo',
        data: {
            datasource: 'currentData.dataSourceName',
            dataset: 'currentData.dataSetName',
            fieldName: 'fieldName'
        }
    }
];
export const cesiumQueryConfig = [
    {
        name: '点查询',
        url: 'http://www.supermapol.com/realspace/services/data-dynamicDTH/rest/data/featureResults.rjson?returnContent=true',
        type: 'Geometry',
        data: {
            getFeatureMode: 'SPATIAL',
            spatialQueryMode: 'INTERSECT',
            datasetNames: ['铁岭矢量面:New_Region3D_1'],
            geometry: {
                id: 0,
                parts: [1],
                points: [{ x: 123.7372610538448, y: 42.235890595648364 }],
                type: 'POINT'
            }
        }
    },
    {
        name: '多点查询',
        url: 'http://www.supermapol.com/realspace/services/data-cbd/rest/data/featureResults.rjson?returnContent=true',
        type: 'Geometry',
        data: {
            getFeatureMode: 'SPATIAL',
            spatialQueryMode: 'CONTAIN',
            datasetNames: ['二维数据:Building'],
            geometry: {
                points: [
                    { x: 116.45481555106637, y: 39.910707214806244 },
                    { x: 116.45494468305948, y: 39.913070060825824 },
                    { x: 116.45069793330752, y: 39.9132799357124 }
                ],
                type: 'REGION'
            }
        }
    },
    {
        name: 'SQL查询',
        url: 'http://www.supermapol.com/realspace/services/data-cbd/rest/data/featureResults.rjson?returnContent=true',
        type: 'SQL',
        data: {
            datasetNames: ['二维数据:Building'],
            getFeatureMode: 'SQL',
            queryParameter: {
                attributeFilter: 'SMAREA>500'
            }
        }
    }
];
