Skip to content

Commit 94833e2

Browse files
committed
尝试解决sonar block问题
1 parent fb7099b commit 94833e2

File tree

9 files changed

+161
-252
lines changed

9 files changed

+161
-252
lines changed

dist/iclient9-leaflet.js

Lines changed: 137 additions & 171 deletions
Large diffs are not rendered by default.

dist/iclient9-openlayers.js

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5912,9 +5912,6 @@ ol.source.GeoFeature.prototype.addFeatures = function (features) {
59125912
var event = {features: features};
59135913
this.dispatchEvent(new ol.Collection.Event('beforefeaturesadded', event));
59145914

5915-
if (ret === false) {
5916-
return;
5917-
}
59185915
features = event.features;
59195916
var featuresFailAdded = [];
59205917
for (var i = 0, len = features.length; i < len; i++) {
@@ -16983,7 +16980,8 @@ SuperMap.Feature.Theme.Circle = SuperMap.Class(SuperMap.Feature.Theme.RankSymbol
1698316980
this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
1698416981
}
1698516982
else {
16986-
this.DVBUnitValue = sets.maxR / maxValue;
16983+
//this.DVBUnitValue = sets.maxR / maxValue;
16984+
this.DVBUnitValue = sets.maxR;
1698716985
}
1698816986

1698916987
var uv = this.DVBUnitValue;
@@ -38270,7 +38268,7 @@ module.exports = ol.Graphic;
3827038268

3827138269
__webpack_require__(4);
3827238270

38273-
MapvCanvasLayer = function (options) {
38271+
var MapvCanvasLayer = function (options) {
3827438272
this.options = options || {};
3827538273
this.paneName = this.options.paneName || 'mapPane';
3827638274
this.context = this.options.context || '2d';
@@ -38339,12 +38337,11 @@ try {
3833938337
} catch (ex) {
3834038338
mapv = {};
3834138339
}
38342-
var BaiduMapLayer = mapv.baiduMapLayer || Function;
38340+
var BaiduMapLayer = mapv.baiduMapLayer.__proto__ || Function;
3834338341

3834438342
class MapvLayer extends BaiduMapLayer {
3834538343

3834638344
constructor(map, dataSet, options) {
38347-
MapvLayer.__proto__ = BaiduMapLayer.__proto__;
3834838345
super(map, dataSet, options);
3834938346
this.dataSet = dataSet;
3835038347
var self = this;
@@ -38387,32 +38384,12 @@ class MapvLayer extends BaiduMapLayer {
3838738384

3838838385
clickEvent(e) {
3838938386
var pixel = e.pixel;
38390-
var context = this.canvasLayer.canvas.getContext(this.context);
38391-
var data = this.dataSet.get();
38392-
for (var i = 0; i < data.length; i++) {
38393-
context.beginPath();
38394-
pathSimple.draw(context, data[i], this.options);
38395-
if (context.isPointInPath(pixel[0] * this.canvasLayer.devicePixelRatio, pixel[1] * this.canvasLayer.devicePixelRatio)) {
38396-
this.options.methods.click(data[i], e);
38397-
return;
38398-
}
38399-
}
38400-
this.options.methods.click(null, e);
38387+
super.clickEvent({x: pixel[0], y: pixel[1]}, e);
3840138388
}
3840238389

3840338390
mousemoveEvent(e) {
3840438391
var pixel = e.pixel;
38405-
var context = this.canvasLayer.canvas.getContext(this.context);
38406-
var data = this.dataSet.get();
38407-
for (var i = 0; i < data.length; i++) {
38408-
context.beginPath();
38409-
pathSimple.draw(context, data[i], this.options);
38410-
if (context.isPointInPath(pixel[0] * this.canvasLayer.devicePixelRatio, pixel[1] * this.canvasLayer.devicePixelRatio)) {
38411-
this.options.methods.mousemove(data[i], e);
38412-
return;
38413-
}
38414-
}
38415-
this.options.methods.mousemove(null, e);
38392+
super.mousemoveEvent({x: pixel[0], y: pixel[1]}, e);
3841638393
}
3841738394

3841838395
bindEvent() {
@@ -38490,11 +38467,9 @@ class MapvLayer extends BaiduMapLayer {
3849038467
};
3849138468
}
3849238469
var data = self.dataSet.get(dataGetOptions);
38493-
if (self.options.unit === 'm' && self.options.size) {
38494-
self.options._size = self.options.size / zoomUnit;
38495-
} else {
38496-
self.options._size = self.options.size;
38497-
}
38470+
38471+
self.options._size = self.options.size;
38472+
3849838473
var pixel = map.getPixelFromCoordinate([0, 0]);
3849938474
this.drawContext(context, new mapv.DataSet(data), self.options, {x: pixel[0], y: pixel[1]});
3850038475
self.options.updateCallback && self.options.updateCallback(time);

examples/openlayers/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ var exampleConfig = {
386386
}, {
387387
name: "纽约出租车上车点",
388388
thumbnail: "mapNycTaxi.png",
389-
fileName: "mapNycTaxi"
389+
fileName: "mapvNycTaxi"
390390
}]
391391
},
392392
"VectorTileLayer": {

src/common/iServer/Circle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ SuperMap.Feature.Theme.Circle = SuperMap.Class(SuperMap.Feature.Theme.RankSymbol
8484
this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
8585
}
8686
else {
87-
this.DVBUnitValue = sets.maxR / maxValue;
87+
//this.DVBUnitValue = sets.maxR / maxValue;
88+
this.DVBUnitValue = sets.maxR;
8889
}
8990

9091
var uv = this.DVBUnitValue;

src/leaflet/core/Util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var L = require("leaflet");
22
var GeoJSONFormat = require('../../common/format/GeoJSON');
3-
3+
var SuperMap = require('../../common/SuperMap');
44
L.Util.supermap_callbacks = {};
55

66
L.Util.toGeoJSON = function (feature) {

src/leaflet/overlay/mapv/MapVRenderer.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ try {
55
} catch (ex) {
66
mapv = {};
77
}
8-
var BaseLayer = mapv.baiduMapLayer || Function;
8+
var BaseLayer = mapv.baiduMapLayer.__proto__ || Function;
99

1010
class MapVRenderer extends BaseLayer {
1111
constructor(map, layer, dataSet, options) {
1212
if (!BaseLayer) {
1313
return;
1414
}
15-
MapVRenderer.__proto__ = BaseLayer.__proto__;
1615
super(map, dataSet, options);
1716

1817
var self = this;
@@ -27,12 +26,12 @@ class MapVRenderer extends BaseLayer {
2726
}
2827

2928
clickEvent(e) {
30-
var pixel = e.pixel;
29+
var pixel = e.layerPoint;
3130
super.clickEvent(pixel, e);
3231
}
3332

3433
mousemoveEvent(e) {
35-
var pixel = e.pixel;
34+
var pixel = e.layerPoint;
3635
super.mousemoveEvent(pixel, e);
3736
}
3837

@@ -41,7 +40,6 @@ class MapVRenderer extends BaseLayer {
4140

4241
if (this.options.methods) {
4342
if (this.options.methods.click) {
44-
map.setDefaultCursor("default");
4543
map.on('click', this.clickEvent);
4644
}
4745
if (this.options.methods.mousemove) {
@@ -129,13 +127,8 @@ class MapVRenderer extends BaseLayer {
129127

130128
this.processData(data);
131129

132-
if (self.options.unit === 'm' && self.options.size) {
133-
self.options._size = self.options.size / zoomUnit;
134-
} else {
135-
self.options._size = self.options.size;
136-
}
130+
self.options._size = self.options.size;
137131

138-
// var pixel = {x: 0, y: 0};
139132
var worldPoint = map.latLngToContainerPoint(L.latLng(0, 0));
140133
var pixel = {
141134
x: worldPoint.x - offset.x,

src/openlayers/overlay/mapv/MapvCanvasLayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require('../../core/Base');
22

3-
MapvCanvasLayer = function (options) {
3+
var MapvCanvasLayer = function (options) {
44
this.options = options || {};
55
this.paneName = this.options.paneName || 'mapPane';
66
this.context = this.options.context || '2d';

src/openlayers/overlay/mapv/MapvLayer.js

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ try {
77
} catch (ex) {
88
mapv = {};
99
}
10-
var BaiduMapLayer = mapv.baiduMapLayer || Function;
10+
var BaiduMapLayer = mapv.baiduMapLayer.__proto__ || Function;
1111

1212
class MapvLayer extends BaiduMapLayer {
1313

1414
constructor(map, dataSet, options) {
15-
MapvLayer.__proto__ = BaiduMapLayer.__proto__;
1615
super(map, dataSet, options);
1716
this.dataSet = dataSet;
1817
var self = this;
@@ -55,32 +54,12 @@ class MapvLayer extends BaiduMapLayer {
5554

5655
clickEvent(e) {
5756
var pixel = e.pixel;
58-
var context = this.canvasLayer.canvas.getContext(this.context);
59-
var data = this.dataSet.get();
60-
for (var i = 0; i < data.length; i++) {
61-
context.beginPath();
62-
pathSimple.draw(context, data[i], this.options);
63-
if (context.isPointInPath(pixel[0] * this.canvasLayer.devicePixelRatio, pixel[1] * this.canvasLayer.devicePixelRatio)) {
64-
this.options.methods.click(data[i], e);
65-
return;
66-
}
67-
}
68-
this.options.methods.click(null, e);
57+
super.clickEvent({x: pixel[0], y: pixel[1]}, e);
6958
}
7059

7160
mousemoveEvent(e) {
7261
var pixel = e.pixel;
73-
var context = this.canvasLayer.canvas.getContext(this.context);
74-
var data = this.dataSet.get();
75-
for (var i = 0; i < data.length; i++) {
76-
context.beginPath();
77-
pathSimple.draw(context, data[i], this.options);
78-
if (context.isPointInPath(pixel[0] * this.canvasLayer.devicePixelRatio, pixel[1] * this.canvasLayer.devicePixelRatio)) {
79-
this.options.methods.mousemove(data[i], e);
80-
return;
81-
}
82-
}
83-
this.options.methods.mousemove(null, e);
62+
super.mousemoveEvent({x: pixel[0], y: pixel[1]}, e);
8463
}
8564

8665
bindEvent() {
@@ -158,11 +137,9 @@ class MapvLayer extends BaiduMapLayer {
158137
};
159138
}
160139
var data = self.dataSet.get(dataGetOptions);
161-
if (self.options.unit === 'm' && self.options.size) {
162-
self.options._size = self.options.size / zoomUnit;
163-
} else {
164-
self.options._size = self.options.size;
165-
}
140+
141+
self.options._size = self.options.size;
142+
166143
var pixel = map.getPixelFromCoordinate([0, 0]);
167144
this.drawContext(context, new mapv.DataSet(data), self.options, {x: pixel[0], y: pixel[1]});
168145
self.options.updateCallback && self.options.updateCallback(time);

src/openlayers/overlay/theme/geoFeature.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ ol.source.GeoFeature.prototype.addFeatures = function (features) {
4242
var event = {features: features};
4343
this.dispatchEvent(new ol.Collection.Event('beforefeaturesadded', event));
4444

45-
if (ret === false) {
46-
return;
47-
}
4845
features = event.features;
4946
var featuresFailAdded = [];
5047
for (var i = 0, len = features.length; i < len; i++) {

0 commit comments

Comments
 (0)