Skip to content

Commit e266a1e

Browse files
committed
【fix】fix ol 高性能图层webgl渲染时不显示结果的问题 review by songym
1 parent 403d983 commit e266a1e

File tree

5 files changed

+55
-14
lines changed

5 files changed

+55
-14
lines changed

dist/openlayers/iclient9-openlayers-es6.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74015,8 +74015,23 @@ class WebGLRenderer_GraphicWebGLRenderer extends external_ol_default.a.Object {
7401574015
return external_ol_default.a.proj.transform(coordinates, projection, 'EPSG:4326');
7401674016
}
7401774017
_pixelToMeter(pixel) {
74018-
const meterRes = this.map.getView().getResolution();
74019-
return pixel * meterRes;
74018+
let view = this.map.getView();
74019+
let projection = view.getProjection();
74020+
74021+
let unit = projection.getUnits() || 'degrees';
74022+
if (unit === 'degrees') {
74023+
unit = Unit.DEGREE;
74024+
}
74025+
if (unit === 'm') {
74026+
unit = Unit.METER;
74027+
}
74028+
const res = view.getResolution();
74029+
if (unit === Unit.DEGREE) {
74030+
let meterRes= res*(Math.PI * 6378137 / 180);
74031+
return pixel * meterRes;
74032+
}else{
74033+
return pixel * res;
74034+
}
7402074035
}
7402174036

7402274037
}

dist/openlayers/iclient9-openlayers-es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/openlayers/iclient9-openlayers.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30806,8 +30806,23 @@ var GraphicWebGLRenderer = exports.GraphicWebGLRenderer = function (_ol$Object)
3080630806
}, {
3080730807
key: "_pixelToMeter",
3080830808
value: function _pixelToMeter(pixel) {
30809-
var meterRes = this.map.getView().getResolution();
30810-
return pixel * meterRes;
30809+
var view = this.map.getView();
30810+
var projection = view.getProjection();
30811+
30812+
var unit = projection.getUnits() || 'degrees';
30813+
if (unit === 'degrees') {
30814+
unit = _iclientCommon.Unit.DEGREE;
30815+
}
30816+
if (unit === 'm') {
30817+
unit = _iclientCommon.Unit.METER;
30818+
}
30819+
var res = view.getResolution();
30820+
if (unit === _iclientCommon.Unit.DEGREE) {
30821+
var meterRes = res * (Math.PI * 6378137 / 180);
30822+
return pixel * meterRes;
30823+
} else {
30824+
return pixel * res;
30825+
}
3081130826
}
3081230827
}]);
3081330828

0 commit comments

Comments
 (0)