Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
* This program are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
import mapboxgl from 'mapbox-gl';
mapboxgl.supermap = mapboxgl.supermap || {};
mapboxgl.supermap.map = mapboxgl.supermap.map || {};
export var getDefaultVectorTileStyle = function (urlTemplate, options) {
options = options || {};
var defaultOptions = {};
defaultOptions.version = options.version || 8;
defaultOptions.layers = options.layers || [];
defaultOptions.light = options.light || {
"anchor": "viewport",
"color": "#fcf6ef",
"intensity": 0.5,
"position": [1.15, 201, 20]
};
var style = {
"version": defaultOptions.version,
it('bufferAnalysis_test', function (done) {
var bufferAnalystParameters = new SuperMap.DatasetBufferAnalystParameters({
dataset: "Road_L@Jingjin",
//设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析
filterQueryParameter: new SuperMap.FilterParameter({attributeFilter: "NAME='莲花池东路'"}),
bufferSetting: new SuperMap.BufferSetting({
endType: SuperMap.BufferEndType.ROUND,
leftDistance: {value: 200},
rightDistance: {value: 200},
semicircleLineSegment: 10
})
});
var service = new mapboxgl.supermap.SpatialAnalystService(url1, options);
service.bufferAnalysis(bufferAnalystParameters, function (result) {
serviceResult = result;
});
setTimeout(function () {
try {
expect(service).not.toBeNull();
expect(serviceResult).not.toBeNull();
expect(serviceResult.type).toEqual("processCompleted");
expect(serviceResult.object.mode).toEqual("datasets");
var result = serviceResult.result;
expect(result).not.toBeNull();
expect(result.succeed).toBe(true);
expect(result.recordset.features.type).toEqual("FeatureCollection");
var features = result.recordset.features.features[0];
expect(features.id).toEqual(1);
expect(features.type).toEqual("Feature");
/**
* SuperMap mapboxgl基类
* 定义命名空间
*/
/**
* @namespace mapboxgl
* @category BaseTypes Namespace
*/
/**
* @namespace mapboxgl.supermap
* @category BaseTypes Namespace
*/
import mapboxgl from 'mapbox-gl';
import './MapExtend';
mapboxgl.supermap = mapboxgl.supermap || {};
var points = [];
if (this.geometry instanceof mapboxgl.LngLat) {
points = [this.geometry.lng, this.geometry.lat];
} else if (this.geometry instanceof mapboxgl.Point) {
points = [this.geometry.x, this.geometry.y];
} else if (this.geometry.length === 3) {
geometry = new GeoText(this.geometry[0], this.geometry[1], this.geometry[2]);
}
if (points.length > 1) {
geometry = new Point(points[0], points[1]);
}
return new Vector(geometry, this.attributes);
}
}
mapboxgl.supermap.ThemeFeature = ThemeFeature;
//feature.style = CommonUtil.copyAttributes(feature.style, this.defaultStyle);
var sty1 = Gro[i].style;
style = CommonUtil.copyAttributesWithClip(style, sty1);
}
}
}
}
if (feature.style && this.isAllowFeatureStyle === true) {
style = CommonUtil.copyAttributesWithClip(feature.style);
}
return style;
}
}
mapboxgl.supermap.RangeThemeLayer = Range;
var obj = arguments[arg];
if (obj) {
for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
var key = Object.getOwnPropertyNames(obj)[j];
if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
continue;
}
dest[key] = obj[key];
}
}
}
return dest;
}
}
mapboxgl.supermap.LogoControl = Logo;
return this.transform(pt, this.projection.getResolution(zoom));
},
locate: function (lngLat, dx, dy) {
return this.projection.locate(lngLat, dx, dy);
},
transform: function (point, scale) {
return {
x: this.matrix[0] * (point.x - this.matrix[2]) / scale,
y: this.matrix[1] * (point.y - this.matrix[3]) / scale
};
}
};
mapboxgl.supermap.Transform = Transform;
proxy: me.options.proxy,
withCredentials: me.options.withCredentials,
crossOrigin: me.options.crossOrigin,
headers: me.options.headers,
serverType: me.options.serverType,
eventListeners: {
scope: me,
processCompleted: callback,
processFailed: callback
}
});
themeService.processAsync(params);
}
}
mapboxgl.supermap.ThemeService = ThemeService;
params.geometry = Util.toSuperMapPolygon(params.geometry);
}
if (!(params.geometry instanceof Geometry)) {
params.geometry = Util.toSuperMapGeometry(params.geometry);
}
}
return params;
}
_processFormat(resultFormat) {
return resultFormat ? resultFormat : DataFormat.GEOJSON;
}
}
mapboxgl.supermap.QueryService = QueryService;
}
//这里只允许传端的bounds
if (params.query) {
params.query = Util.toSuperMapBounds(params.query);
}
if (params.geometryQuery) {
params.geometryQuery = Util.toProcessingParam(params.geometryQuery);
}
if (params.geometryClip) {
params.geometryClip = Util.toProcessingParam(params.geometryClip);
}
return params;
}
}
mapboxgl.supermap.ProcessingService = ProcessingService;