Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('addFeatures, removeFeatures, getShapesByFeatureID', () => {
var graphThemeLayer;
var features = [];
for (var i = 0, len = chinaConsumptionLevel.length; i < len; i++) {
// 省居民消费水平(单位:元)信息
var provinceInfo = chinaConsumptionLevel[i];
var geo = new mapboxgl.LngLat(provinceInfo[1], provinceInfo[2]);
var attrs = {};
attrs.NAME = provinceInfo[0];
attrs.CON2009 = provinceInfo[3];
attrs.CON2010 = provinceInfo[4];
attrs.CON2011 = provinceInfo[5];
attrs.CON2012 = provinceInfo[6];
attrs.CON2013 = provinceInfo[7];
var fea = new ThemeFeature(geo, attrs);
features.push(fea);
}
graphThemeLayer = new Graph("GraphThemeLayer", "Bar",
{
map: map,
attributions: " ",
themeFields: ["CON2009", "CON2010", "CON2011", "CON2012", "CON2013"],
opacity: 0.9,
it('GetFeaturesByBoundsParameters:targetPrj', done => {
var sw = new mapboxgl.LngLat(-20, -20);
var ne = new mapboxgl.LngLat(20, 20);
var lngLatBounds = new mapboxgl.LngLatBounds(sw, ne);
var boundsParam = new GetFeaturesByBoundsParameters({
datasetNames: ["World:Capitals"],
bounds: lngLatBounds,
targetPrj: { "epsgCode": 4326 }
});
var service = new FeatureService(url);
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
var paramsObj = JSON.parse(params.replace(/'/g, '"'));
expect(paramsObj.targetPrj.epsgCode).toEqual(4326);
return Promise.resolve(new Response(JSON.stringify(getFeaturesResultJson)));
});
service.getFeaturesByBounds(boundsParam, (result) => {
serviceResult = result;
boundsParam.destroy();
setTimeout(() => {
expect(datavizWebmap.credentialKey).toBeUndefined();
expect(datavizWebmap.credentialValue).toBeUndefined();
var map = datavizWebmap.map;
expect(map.getZoom()).toBe(8);
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(116.46675928388001, 40.15816517545865));
expect(datavizWebmap.mapParams.title).toBe('RestMap');
expect(datavizWebmap.mapParams.description).toBe('');
done();
}, 1000)
});
proto.project = function(v) {
return this.map.project(new mapboxgl.LngLat(v[0], v[1]));
};
getPixelXY(coordinate) {
var pixelP, map = this.map;
if (coordinate instanceof Point || coordinate instanceof GeoText) {
let tempPoint = map.project(new mapboxgl.LngLat(coordinate.x, coordinate.y));
pixelP = {x: parseInt(tempPoint.x), y: parseInt(tempPoint.y)};
}
if (coordinate instanceof LonLat) {
let tempPoint = map.project(new mapboxgl.LngLat(coordinate.lon, coordinate.lat));
pixelP = {x: parseInt(tempPoint.x), y: parseInt(tempPoint.y)};
}
return pixelP;
}
move(rawCenter, accuracy) {
this.marker.setLngLat(new LngLat(rawCenter[0], rawCenter[1]))
this.circle.update(rawCenter, accuracy, POLYCIRCLE_POINT_COUNT)
}
getPixelXY(coordinate) {
var pixelP, map = this.map;
if (coordinate instanceof Point || coordinate instanceof GeoText) {
let tempPoint = map.project(new mapboxgl.LngLat(coordinate.x, coordinate.y));
pixelP = {x: parseInt(tempPoint.x), y: parseInt(tempPoint.y)};
}
if (coordinate instanceof LonLat) {
let tempPoint = map.project(new mapboxgl.LngLat(coordinate.lon, coordinate.lat));
pixelP = {x: parseInt(tempPoint.x), y: parseInt(tempPoint.y)};
}
return pixelP;
}
if (self.options.size) {
self.options._size = self.options.size / zoomUnit;
}
if (self.options.width) {
self.options._width = self.options.width / zoomUnit;
}
if (self.options.height) {
self.options._height = self.options.height / zoomUnit;
}
} else {
self.options._size = self.options.size;
self.options._height = self.options.height;
self.options._width = self.options.width;
}
var worldPoint = map.project(new mapboxgl.LngLat(0, 0));
this.drawContext(context, data, self.options, worldPoint);
self.options.updateCallback && self.options.updateCallback(time);
}