Skip to content

Commit dcf57c1

Browse files
committed
【update】mapboxgl getfeaturebygeometry queryBygeometry支持Mapboxgl.LngLatbounds类型,更新vue组件 //todo UT
1 parent 6d9669c commit dcf57c1

File tree

12 files changed

+204
-159
lines changed

12 files changed

+204
-159
lines changed

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"tabWidth":4,
55
"semi":true,
66
"trailingComma":"none",
7-
"bracketSpacing":true
7+
"bracketSpacing":true,
8+
"singleQuote": true
89
}

build/jsdocs/template/typeLinkExt.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ var typeLinks = {
6262
//mapboxgl
6363
"mapboxgl.Evented": mbglapi + '#Evented',
6464
"mapboxgl.Map": mbglapi + '#map',
65+
"mapboxgl.LngLatbounds": mbglapi + '#lnglatbounds',
6566
//mapv
6667
"Mapv.DataSet": mapv + 'data/DataSet.md',
6768
"Mapv.BaiduMapLayer": mapv + 'map/baidu-map/Layer.md',

dist/mapboxgl/iclient9-mapboxgl-es6.js

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -65351,11 +65351,11 @@ external_mapboxgl_default.a.supermap.LogoControl = Logo_Logo;
6535165351
* @classdesc 工具类。
6535265352
*/
6535365353
class core_Util_Util {
65354-
6535565354
/**
6535665355
* @function mapboxgl.supermap.Util.toSuperMapGeometry
6535765356
* @description 将 GeoJSON 对象转为 SuperMap 几何图形。
6535865357
* @param {GeoJSONObject} geoJSON - GeoJSON 对象。
65358+
* @returns {SuperMap.Geometry}
6535965359
*/
6536065360
static toSuperMapGeometry(geoJSON) {
6536165361
if (geoJSON && geoJSON.type) {
@@ -65368,19 +65368,9 @@ class core_Util_Util {
6536865368
static toSuperMapBounds(bounds) {
6536965369
if (this.isArray(bounds)) {
6537065370
//左下右上
65371-
return new Bounds_Bounds(
65372-
bounds[0],
65373-
bounds[1],
65374-
bounds[2],
65375-
bounds[3]
65376-
);
65371+
return new Bounds_Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
6537765372
}
65378-
return new Bounds_Bounds(
65379-
bounds.getWest(),
65380-
bounds.getSouth(),
65381-
bounds.getEast(),
65382-
bounds.getNorth()
65383-
);
65373+
return new Bounds_Bounds(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth());
6538465374
}
6538565375

6538665376
static toSuperMapPoint(lnglat) {
@@ -65392,6 +65382,26 @@ class core_Util_Util {
6539265382
}
6539365383
return new Point_Point(lnglat.geometry.coordinates[0], lnglat.geometry.coordinates[1]);
6539465384
}
65385+
/**
65386+
* @function mapboxgl.supermap.Util.toSuperMapPolygon
65387+
* @description 将 Mapbox GL LngLatbounds 对象转为 SuperMap 几何图形。
65388+
* @param {Mapboxgl.LngLatbounds} lnglatBounds - Mapbox GL LngLatbounds对象。
65389+
* @returns {SuperMap.Geometry.Polygon}
65390+
*/
65391+
static toSuperMapPolygon(lnglatBounds) {
65392+
const west = lnglatBounds.getWest();
65393+
const east = lnglatBounds.getEast();
65394+
const sourth = lnglatBounds.getSouth();
65395+
const north = lnglatBounds.getNorth();
65396+
return new Polygon_Polygon([
65397+
new LinearRing_LinearRing([
65398+
new Point_Point(west, sourth),
65399+
new Point_Point(east, sourth),
65400+
new Point_Point(east, north),
65401+
new Point_Point(west, north)
65402+
])
65403+
]);
65404+
}
6539565405

6539665406
/**
6539765407
* @function mapboxgl.supermap.Util.isArray
@@ -65400,10 +65410,9 @@ class core_Util_Util {
6540065410
* @returns {boolean} 是否是数组。
6540165411
*/
6540265412
static isArray(obj) {
65403-
return Object.prototype.toString.call(obj) == '[object Array]'
65413+
return Object.prototype.toString.call(obj) == "[object Array]";
6540465414
}
6540565415

65406-
6540765416
/**
6540865417
* @function mapboxgl.supermap.Util.toGeoJSON
6540965418
* @description 将传入对象转为 GeoJSON 格式。
@@ -65467,14 +65476,13 @@ class core_Util_Util {
6546765476
return dest;
6546865477
}
6546965478

65470-
6547165479
/**
6547265480
* 检测数据是否为number
6547365481
* @param value 值,未知数据类型
6547465482
* @returns {boolean}
6547565483
*/
6547665484
static isNumber(value) {
65477-
if (value === '') {
65485+
if (value === "") {
6547865486
return false;
6547965487
}
6548065488
let mdata = Number(value);
@@ -65484,7 +65492,7 @@ class core_Util_Util {
6548465492
return !isNaN(mdata);
6548565493
}
6548665494

65487-
/**
65495+
/**
6548865496
* 随机生成id
6548965497
* @param attr
6549065498
* @returns {string}
@@ -65505,7 +65513,8 @@ class core_Util_Util {
6550565513
* @returns {string} 生成的 RGBA 格式。
6550665514
*/
6550765515
static hexToRgba(hex, opacity) {
65508-
var color = [], rgba = [];
65516+
var color = [],
65517+
rgba = [];
6550965518
hex = hex.replace(/#/, "");
6551065519
if (hex.length == 3) {
6551165520
var tmp = [];
@@ -65524,6 +65533,7 @@ class core_Util_Util {
6552465533
}
6552565534

6552665535
external_mapboxgl_default.a.supermap.Util = core_Util_Util;
65536+
6552765537
// CONCATENATED MODULE: ./src/mapboxgl/core/index.js
6552865538
/* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved.
6552965539
* This program are made available under the terms of the Apache License, Version 2.0
@@ -73201,7 +73211,7 @@ class FeatureService_FeatureService extends ServiceBase_ServiceBase {
7320173211
return {};
7320273212
}
7320373213
var me = this;
73204-
params.returnContent = (params.returnContent == null) ? true : params.returnContent;
73214+
params.returnContent = params.returnContent == null ? true : params.returnContent;
7320573215
params.fromIndex = params.fromIndex ? params.fromIndex : 0;
7320673216
params.toIndex = params.toIndex ? params.toIndex : -1;
7320773217
if (params.bounds) {
@@ -73213,13 +73223,17 @@ class FeatureService_FeatureService extends ServiceBase_ServiceBase {
7321373223

7321473224
//mapboxgl geojson要素对象转 SuperMap Geometry 对象
7321573225
if (params.geometry) {
73216-
params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
73226+
if (params.geometry instanceof external_mapboxgl_default.a.LngLatBounds) {
73227+
params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
73228+
} else {
73229+
params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
73230+
}
7321773231
}
7321873232
//editFeature服务参数转换,传入单独得对象或对象数组
7321973233
if (params.features) {
7322073234
var features = [];
7322173235
if (core_Util_Util.isArray(params.features)) {
73222-
params.features.map(function (feature) {
73236+
params.features.map(function(feature) {
7322373237
features.push(me._createServerFeature(feature));
7322473238
return features;
7322573239
});
@@ -73233,7 +73247,9 @@ class FeatureService_FeatureService extends ServiceBase_ServiceBase {
7323373247

7323473248
//geoFeature严格按照 mapboxgl geojson的结构
7323573249
_createServerFeature(geoFeature) {
73236-
var feature = {}, fieldNames = [], fieldValues = [];
73250+
var feature = {},
73251+
fieldNames = [],
73252+
fieldValues = [];
7323773253
var properties = geoFeature.properties;
7323873254
for (var key in properties) {
7323973255
fieldNames.push(key);
@@ -73249,11 +73265,12 @@ class FeatureService_FeatureService extends ServiceBase_ServiceBase {
7324973265
}
7325073266

7325173267
_processFormat(resultFormat) {
73252-
return (resultFormat) ? resultFormat : REST_DataFormat.GEOJSON;
73268+
return resultFormat ? resultFormat : REST_DataFormat.GEOJSON;
7325373269
}
7325473270
}
7325573271

7325673272
external_mapboxgl_default.a.supermap.FeatureService = FeatureService_FeatureService;
73273+
7325773274
// CONCATENATED MODULE: ./src/mapboxgl/services/FieldService.js
7325873275
/* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved.
7325973276
* This program are made available under the terms of the Apache License, Version 2.0
@@ -75138,8 +75155,8 @@ external_mapboxgl_default.a.supermap.ProcessingService = ProcessingService_Proce
7513875155
* @classdesc 地图查询服务类。
7513975156
* 提供:范围查询,SQL 查询,几何查询,距离查询。
7514075157
* @extends {mapboxgl.supermap.ServiceBase}
75141-
* @param {string} url - 地图查询服务访问地址。
75142-
* @param {Object} options - 服务交互时所需的可选参数。
75158+
* @param {string} url - 地图查询服务访问地址。
75159+
* @param {Object} options - 服务交互时所需的可选参数。
7514375160
* @param {string} [options.proxy] - 服务代理地址。
7514475161
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
7514575162
* @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
@@ -75151,7 +75168,6 @@ external_mapboxgl_default.a.supermap.ProcessingService = ProcessingService_Proce
7515175168
* })
7515275169
*/
7515375170
class services_QueryService_QueryService extends ServiceBase_ServiceBase {
75154-
7515575171
constructor(url, options) {
7515675172
super(url, options);
7515775173
}
@@ -75257,24 +75273,17 @@ class services_QueryService_QueryService extends ServiceBase_ServiceBase {
7525775273
queryByGeometryService.processAsync(me._processParams(params));
7525875274
}
7525975275

75260-
7526175276
_processParams(params) {
75262-
7526375277
if (!params) {
7526475278
return {};
7526575279
}
75266-
params.returnContent = (params.returnContent == null) ? true : params.returnContent;
75280+
params.returnContent = params.returnContent == null ? true : params.returnContent;
7526775281
if (params.queryParams && !core_Util_Util.isArray(params.queryParams)) {
7526875282
params.queryParams = [params.queryParams];
7526975283
}
7527075284
if (params.bounds) {
7527175285
if (params.bounds instanceof Array) {
75272-
params.bounds = new Bounds_Bounds(
75273-
params.bounds[0],
75274-
params.bounds[1],
75275-
params.bounds[2],
75276-
params.bounds[3]
75277-
);
75286+
params.bounds = new Bounds_Bounds(params.bounds[0], params.bounds[1], params.bounds[2], params.bounds[3]);
7527875287
}
7527975288
if (params.bounds instanceof external_mapboxgl_default.a.LngLatBounds) {
7528075289
params.bounds = new Bounds_Bounds(
@@ -75284,11 +75293,9 @@ class services_QueryService_QueryService extends ServiceBase_ServiceBase {
7528475293
params.bounds.getNorthEast().lat
7528575294
);
7528675295
}
75287-
7528875296
}
7528975297

7529075298
if (params.geometry) {
75291-
7529275299
if (params.geometry instanceof external_mapboxgl_default.a.LngLat) {
7529375300
params.geometry = new Point_Point(params.geometry.lng, params.geometry.lat);
7529475301
}
@@ -75297,20 +75304,24 @@ class services_QueryService_QueryService extends ServiceBase_ServiceBase {
7529775304
params.geometry = new Point_Point(params.geometry.x, params.geometry.y);
7529875305
}
7529975306

75300-
if (!(params.geometry instanceof Geometry_Geometry)) {
75307+
if (params.geometry instanceof external_mapboxgl_default.a.LngLatBounds) {
75308+
params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
75309+
}
7530175310

75311+
if (!(params.geometry instanceof Geometry_Geometry)) {
7530275312
params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
7530375313
}
7530475314
}
7530575315
return params;
7530675316
}
7530775317

7530875318
_processFormat(resultFormat) {
75309-
return (resultFormat) ? resultFormat : REST_DataFormat.GEOJSON;
75319+
return resultFormat ? resultFormat : REST_DataFormat.GEOJSON;
7531075320
}
7531175321
}
7531275322

7531375323
external_mapboxgl_default.a.supermap.QueryService = services_QueryService_QueryService;
75324+
7531475325
// CONCATENATED MODULE: ./src/mapboxgl/services/SpatialAnalystService.js
7531575326
/* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved.
7531675327
* This program are made available under the terms of the Apache License, Version 2.0

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy