Skip to content

Commit 522cf97

Browse files
author
caoxinke
committed
fix OpenLayers客户端专题图事件失效的问题、TimeFlowControl的repeat属性失效的问题、OpenLayers对接mapV显示的一些缺陷。
1 parent 205383f commit 522cf97

File tree

11 files changed

+124
-117
lines changed

11 files changed

+124
-117
lines changed

dist/iclient9-leaflet.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14940,12 +14940,13 @@ var TimeFlowControl = function (_TimeControlBase) {
1494014940
//不循环时
1494114941
if (!me.repeat) {
1494214942
me.running = false;
14943+
me.stop();
1494314944
return null;
1494414945
}
14945-
14946+
me.stop();
1494614947
me.currentTime = me.startTime;
1494714948
me.oldTime = me.currentTime;
14948-
me.stop();
14949+
me.start();
1494914950
}
1495014951
//否则时间递增
1495114952
else {
@@ -56782,18 +56783,10 @@ var _leaflet2 = _interopRequireDefault(_leaflet);
5678256783

5678356784
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5678456785

56785-
/**
56786-
* @const L.supermap.CartoStyleMap
56787-
* @classdesc aaaaaaa
56788-
*/
5678956786
/**
5679056787
* CartoCSS中的style属性名与leaflet的style属性名的对应表
5679156788
* */
56792-
var CartoStyleMap = exports.CartoStyleMap = {
56793-
/**
56794-
* @constant L.supermap.CartoStyleMap.prototype.TEXT
56795-
* @description
56796-
*/
56789+
var CartoStyleMap = exports.CartoStyleMap = _leaflet2.default.supermap.CartoStyleMap = {
5679756790
"TEXT": {
5679856791
"text-size": "fontSize",
5679956792
"text-face-name": "fontFamily",
@@ -56836,7 +56829,7 @@ var CartoStyleMap = exports.CartoStyleMap = {
5683656829
"polygon-comp-op": "globalCompositeOperation"
5683756830
}
5683856831
};
56839-
_leaflet2.default.supermap.CartoStyleMap = CartoStyleMap;
56832+
5684056833
/**
5684156834
* 服务端传过来的style属性名与leaflet的style属性名的对应表
5684256835
* */
@@ -63553,7 +63546,7 @@ var names = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
6355363546
/* 396 */
6355463547
/***/ (function(module, exports) {
6355563548

63556-
module.exports = {"_args":[[{"raw":"proj4@2.4.3","scope":null,"escapedName":"proj4","name":"proj4","rawSpec":"2.4.3","spec":"2.4.3","type":"version"},"E:\\git\\iClient9"]],"_from":"proj4@2.4.3","_id":"proj4@2.4.3","_inCache":true,"_location":"/proj4","_nodeVersion":"6.9.2","_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/proj4-2.4.3.tgz_1488570790416_0.3068596587982029"},"_npmUser":{"name":"cwmma","email":"calvin.metcalf@gmail.com"},"_npmVersion":"4.0.5","_phantomChildren":{},"_requested":{"raw":"proj4@2.4.3","scope":null,"escapedName":"proj4","name":"proj4","rawSpec":"2.4.3","spec":"2.4.3","type":"version"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/proj4/-/proj4-2.4.3.tgz","_shasum":"f3bb7e631bffc047c36a1a3cc14533a03bbe9969","_shrinkwrap":null,"_spec":"proj4@2.4.3","_where":"E:\\git\\iClient9","author":"","bugs":{"url":"https://github.com/proj4js/proj4js/issues"},"contributors":[{"name":"Mike Adair","email":"madair@dmsolutions.ca"},{"name":"Richard Greenwood","email":"rich@greenwoodmap.com"},{"name":"Calvin Metcalf","email":"calvin.metcalf@gmail.com"},{"name":"Richard Marsden","url":"http://www.winwaed.com"},{"name":"T. Mittan"},{"name":"D. Steinwand"},{"name":"S. Nelson"}],"dependencies":{"mgrs":"1.0.0","wkt-parser":"^1.1.3"},"description":"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.","devDependencies":{"chai":"~1.8.1","curl":"git://github.com/cujojs/curl.git","grunt":"~0.4.2","grunt-cli":"~0.1.13","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~1.1.0","grunt-contrib-uglify":"~0.11.1","grunt-mocha-phantomjs":"~0.4.0","grunt-rollup":"^1.0.1","istanbul":"~0.2.4","mocha":"~1.17.1","rollup":"^0.41.4","rollup-plugin-json":"^2.0.1","rollup-plugin-node-resolve":"^2.0.0","tin":"~0.4.0"},"directories":{"test":"test","doc":"docs"},"dist":{"shasum":"f3bb7e631bffc047c36a1a3cc14533a03bbe9969","tarball":"https://registry.npmjs.org/proj4/-/proj4-2.4.3.tgz"},"gitHead":"e975a5462ad7abb23e33ea75281eb749e77e1510","homepage":"https://github.com/proj4js/proj4js#readme","license":"MIT","main":"dist/proj4-src.js","maintainers":[{"name":"cwmma","email":"calvin.metcalf@gmail.com"},{"name":"ahocevar","email":"andreas.hocevar@gmail.com"}],"module":"lib/index.js","name":"proj4","optionalDependencies":{},"readme":"ERROR: No README data found!","repository":{"type":"git","url":"git://github.com/proj4js/proj4js.git"},"scripts":{"build":"grunt","build:tmerc":"grunt build:tmerc","test":"npm run build && istanbul test _mocha test/test.js"},"version":"2.4.3"}
63549+
module.exports = {"_from":"proj4@2.4.3","_id":"proj4@2.4.3","_inBundle":false,"_integrity":"sha1-87t+Yxv/wEfDaho8wUUzoDu+mWk=","_location":"/proj4","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"proj4@2.4.3","name":"proj4","escapedName":"proj4","rawSpec":"2.4.3","saveSpec":null,"fetchSpec":"2.4.3"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/proj4/-/proj4-2.4.3.tgz","_shasum":"f3bb7e631bffc047c36a1a3cc14533a03bbe9969","_spec":"proj4@2.4.3","_where":"E:\\codes\\iClient9","author":"","bugs":{"url":"https://github.com/proj4js/proj4js/issues"},"bundleDependencies":false,"contributors":[{"name":"Mike Adair","email":"madair@dmsolutions.ca"},{"name":"Richard Greenwood","email":"rich@greenwoodmap.com"},{"name":"Calvin Metcalf","email":"calvin.metcalf@gmail.com"},{"name":"Richard Marsden","url":"http://www.winwaed.com"},{"name":"T. Mittan"},{"name":"D. Steinwand"},{"name":"S. Nelson"}],"dependencies":{"mgrs":"1.0.0","wkt-parser":"^1.1.3"},"deprecated":false,"description":"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.","devDependencies":{"chai":"~1.8.1","curl":"git://github.com/cujojs/curl.git","grunt":"~0.4.2","grunt-cli":"~0.1.13","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~1.1.0","grunt-contrib-uglify":"~0.11.1","grunt-mocha-phantomjs":"~0.4.0","grunt-rollup":"^1.0.1","istanbul":"~0.2.4","mocha":"~1.17.1","rollup":"^0.41.4","rollup-plugin-json":"^2.0.1","rollup-plugin-node-resolve":"^2.0.0","tin":"~0.4.0"},"directories":{"test":"test","doc":"docs"},"homepage":"https://github.com/proj4js/proj4js#readme","license":"MIT","main":"dist/proj4-src.js","module":"lib/index.js","name":"proj4","repository":{"type":"git","url":"git://github.com/proj4js/proj4js.git"},"scripts":{"build":"grunt","build:tmerc":"grunt build:tmerc","test":"npm run build && istanbul test _mocha test/test.js"},"version":"2.4.3"}
6355763550

6355863551
/***/ }),
6355963552
/* 397 */

dist/iclient9-leaflet.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/iclient9-openlayers.js

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14265,28 +14265,30 @@ var Mapv = function (_ol$source$ImageCanva) {
1426514265
state: options.state
1426614266
}));
1426714267

14268-
_this.layer = new _MapvLayer2.default(opt_options.map, opt_options.dataSet, opt_options.mapvOptions, _this);
14269-
_this.layer.canvasLayer.draw();
1427014268
_this.map = opt_options.map;
14269+
_this.dataSet = opt_options.dataSet;
14270+
_this.mapvOptions = opt_options.mapvOptions;
1427114271

1427214272
function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) {
14273-
if (this.layer) {
14274-
if (!this.layer.isEnabledTime()) {
14275-
this.layer.canvasLayer.draw();
14276-
}
14277-
var mapWidth = Math.ceil(_olDebug2.default.extent.getWidth(extent) / resolution * pixelRatio);
14278-
var mapHeight = Math.ceil(_olDebug2.default.extent.getHeight(extent) / resolution * pixelRatio);
14279-
var width = this.map.getSize()[0] * pixelRatio;
14280-
var height = this.map.getSize()[1] * pixelRatio;
14281-
var canvas = this.layer.canvasLayer.canvas;
14282-
var context = _Util2.default.createCanvasContext2D(mapWidth, mapHeight);
14283-
context.drawImage(canvas, 0, 0, width, height, (mapWidth - width) / 2, (mapHeight - height) / 2, width, height);
14284-
if (this.resolution !== resolution || JSON.stringify(this.extent) !== JSON.stringify(extent)) {
14285-
this.resolution = resolution;
14286-
this.extent = extent;
14287-
}
14288-
return context.canvas;
14273+
var mapWidth = Math.round(_olDebug2.default.extent.getWidth(extent) / resolution) * pixelRatio;
14274+
var mapHeight = Math.round(_olDebug2.default.extent.getHeight(extent) / resolution) * pixelRatio;
14275+
var width = this.map.getSize()[0] * pixelRatio;
14276+
var height = this.map.getSize()[1] * pixelRatio;
14277+
if (!this.layer) {
14278+
this.layer = new _MapvLayer2.default(this.map, this.dataSet, this.mapvOptions, mapWidth, mapHeight, this);
14279+
}
14280+
this.layer.offset = [(mapWidth - width) / 2, (mapHeight - height) / 2];
14281+
if (!this.layer.isEnabledTime()) {
14282+
this.layer.canvasLayer.draw(mapWidth, mapHeight);
14283+
}
14284+
var canvas = this.layer.canvasLayer.canvas;
14285+
var context = _Util2.default.createCanvasContext2D(mapWidth, mapHeight);
14286+
context.drawImage(canvas, 0, 0, mapWidth, mapHeight, 0, 0, mapWidth, mapHeight);
14287+
if (this.resolution !== resolution || JSON.stringify(this.extent) !== JSON.stringify(extent)) {
14288+
this.resolution = resolution;
14289+
this.extent = extent;
1428914290
}
14291+
return context.canvas;
1429014292
}
1429114293
return _this;
1429214294
}
@@ -51648,12 +51650,14 @@ var MapvCanvasLayer = function () {
5164851650
_classCallCheck(this, MapvCanvasLayer);
5164951651

5165051652
this.options = options || {};
51653+
this.enableMassClear = this.options.enableMassClear;
51654+
this._map = options.map;
5165151655
this.paneName = this.options.paneName || 'mapPane';
5165251656
this.context = this.options.context || '2d';
5165351657
this.zIndex = this.options.zIndex || 2;
5165451658
this.mixBlendMode = this.options.mixBlendMode || null;
51655-
this.enableMassClear = this.options.enableMassClear;
51656-
this._map = options.map;
51659+
this.width = options.width;
51660+
this.height = options.height;
5165751661
this.initialize();
5165851662
}
5165951663

@@ -51665,11 +51669,10 @@ var MapvCanvasLayer = function () {
5166551669
canvas.style.cssText = "position:absolute;" + "left:0;" + "top:0;" + "z-index:" + me.zIndex + ";user-select:none;";
5166651670
canvas.style.mixBlendMode = me.mixBlendMode;
5166751671
canvas.className = "mapvClass";
51668-
var size = me._map.getSize();
5166951672
var global$2 = typeof window === 'undefined' ? {} : window;
5167051673
var devicePixelRatio = me.devicePixelRatio = global$2.devicePixelRatio;
51671-
canvas.width = size[0];
51672-
canvas.height = size[1];
51674+
canvas.width = me.width;
51675+
canvas.height = me.height;
5167351676
if (me.context == '2d') {
5167451677
canvas.getContext(me.context).scale(devicePixelRatio, devicePixelRatio);
5167551678
}
@@ -51678,17 +51681,12 @@ var MapvCanvasLayer = function () {
5167851681
}
5167951682
}, {
5168051683
key: 'draw',
51681-
value: function draw() {
51682-
var size = this._map.getSize();
51683-
var center = this._map.getView().getCenter();
51684-
if (center) {
51685-
var _p = this._map.getPixelFromCoordinate(center);
51686-
if (_p) {
51687-
this.canvas.style.left = _p[0] - size[0] / 2 + 'px';
51688-
this.canvas.style.top = _p[1] - size[1] / 2 + 'px';
51689-
this.options.update && this.options.update.call(this);
51690-
}
51691-
}
51684+
value: function draw(mapWidth, mapHeight) {
51685+
this.canvas.width = mapWidth;
51686+
this.canvas.height = mapHeight;
51687+
this.canvas.style.width = mapWidth + "px";
51688+
this.canvas.style.height = mapHeight + "px";
51689+
this.options.update && this.options.update.call(this);
5169251690
}
5169351691
}, {
5169451692
key: 'getContainer',
@@ -51750,7 +51748,7 @@ var BaiduMapLayer = _mapv.baiduMapLayer ? _mapv.baiduMapLayer.__proto__ : Functi
5175051748
var MapvLayer = function (_BaiduMapLayer) {
5175151749
_inherits(MapvLayer, _BaiduMapLayer);
5175251750

51753-
function MapvLayer(map, dataSet, options, source) {
51751+
function MapvLayer(map, dataSet, options, mapWidth, mapHeight, source) {
5175451752
_classCallCheck(this, MapvLayer);
5175551753

5175651754
var _this = _possibleConstructorReturn(this, (MapvLayer.__proto__ || Object.getPrototypeOf(MapvLayer)).call(this, map, dataSet, options));
@@ -51770,6 +51768,8 @@ var MapvLayer = function (_BaiduMapLayer) {
5177051768
mixBlendMode: options.mixBlendMode,
5177151769
enableMassClear: options.enableMassClear,
5177251770
zIndex: options.zIndex,
51771+
width: mapWidth,
51772+
height: mapHeight,
5177351773
update: function update() {
5177451774
self._canvasUpdate();
5177551775
}
@@ -51869,7 +51869,11 @@ var MapvLayer = function (_BaiduMapLayer) {
5186951869
}
5187051870
var dataGetOptions = {
5187151871
transferCoordinate: function transferCoordinate(coordinate) {
51872-
return map.getPixelFromCoordinate(coordinate);
51872+
coordinate = map.getPixelFromCoordinate(coordinate);
51873+
if (self.offset) {
51874+
coordinate = [coordinate[0] + self.offset[0], coordinate[1] + self.offset[1]];
51875+
}
51876+
return coordinate;
5187351877
}
5187451878
};
5187551879
if (time !== undefined) {

dist/iclient9-openlayers.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.

examples/openlayers/rangeThemeLayer.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@
105105

106106
<script type="text/javascript">
107107
var map, options, themeLayer, themeSource,
108-
baseUrl = "http://support.supermap.com.cn:8090/iserver/services/map-jingjin/rest/maps/京津地区地图",
109-
url2 = "http://support.supermap.com.cn:8090/iserver/services/data-jingjin/rest/data",
110-
extent = [104.07, 30.54, 119.51, 42.31];
108+
baseUrl = "http://support.supermap.com.cn:8090/iserver/services/map-jingjin/rest/maps/京津地区地图",
109+
url2 = "http://support.supermap.com.cn:8090/iserver/services/data-jingjin/rest/data",
110+
extent = [104.07, 30.54, 119.51, 42.31];
111111
new ol.supermap.MapService(baseUrl).getMapInfo(function (serviceResult) {
112112
var mapJSONObj = serviceResult.result;
113113
map = new ol.Map({
@@ -205,10 +205,11 @@
205205
}
206206
});
207207

208-
var pointerInteraction = new ol.interaction.Pointer();
209-
pointerInteraction.handleMoveEvent_ = function (event) {
210-
themeSource.fire('mousemove', event);
211-
};
208+
var pointerInteraction = new ol.interaction.Pointer({
209+
handleMoveEvent: function (event) {
210+
themeSource.fire('mousemove', event);
211+
}
212+
});
212213
map.addInteraction(pointerInteraction);
213214
clearLayer();
214215
var getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;

examples/openlayers/rankSymbolThemeLayer.html

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818

1919
<script type="text/javascript">
2020
var map, themeLayer, themeSource,
21-
url = "http://support.supermap.com.cn:8090/iserver/services/map-china400/rest/maps/China_4326",
22-
container = document.getElementById('popup'),
23-
content = document.getElementById('popup-content'),
24-
overlay = new ol.Overlay(({
25-
element: container,
26-
autoPan: true,
27-
autoPanAnimation: {
28-
duration: 250
29-
}
30-
}));
21+
url = "http://support.supermap.com.cn:8090/iserver/services/map-china400/rest/maps/China_4326",
22+
container = document.getElementById('popup'),
23+
content = document.getElementById('popup-content'),
24+
overlay = new ol.Overlay(({
25+
element: container,
26+
autoPan: true,
27+
autoPanAnimation: {
28+
duration: 250
29+
}
30+
}));
3131
new ol.supermap.MapService(url).getMapInfo(function (serviceResult) {
3232
var mapJSONObj = serviceResult.result;
3333
map = new ol.Map({
@@ -120,10 +120,11 @@
120120
}
121121
}
122122

123-
var pointerInteraction = new ol.interaction.Pointer();
124-
pointerInteraction.handleMoveEvent_ = function (event) {
125-
themeSource.fire('mousemove', event);
126-
};
123+
var pointerInteraction = new ol.interaction.Pointer({
124+
handleMoveEvent: function (event) {
125+
themeSource.fire('mousemove', event);
126+
}
127+
});
127128
map.addInteraction(pointerInteraction);
128129
});
129130

examples/openlayers/uniqueThemeLayer.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,11 @@
271271
}
272272
});
273273

274-
var pointerInteraction = new ol.interaction.Pointer();
275-
pointerInteraction.handleMoveEvent_ = function (event) {
276-
themeSource.fire('mousemove', event);
277-
};
274+
var pointerInteraction = new ol.interaction.Pointer({
275+
handleMoveEvent: function (event) {
276+
themeSource.fire('mousemove', event);
277+
}
278+
});
278279
map.addInteraction(pointerInteraction);
279280
clearLayer();
280281
var getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
@@ -292,7 +293,8 @@
292293
eventListeners: {"processCompleted": processCompleted, "processFailed": processFailed}
293294
});
294295
getFeatureBySQLService.processAsync(getFeatureBySQLParams);
295-
});
296+
})
297+
;
296298

297299
function processCompleted(getFeaturesEventArgs) {
298300
var result = getFeaturesEventArgs.result;

src/common/control/TimeFlowControl.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export default class TimeFlowControl extends TimeControlBase {
5454
},
5555
fBound = function () {
5656
return fToBind.apply(this instanceof fNOP && oThis
57-
? this
58-
: oThis,
57+
? this
58+
: oThis,
5959
aArgs.concat(Array.prototype.slice.call(arguments)));
6060
};
6161
fNOP.prototype = this.prototype;
@@ -162,12 +162,14 @@ export default class TimeFlowControl extends TimeControlBase {
162162
//不循环时
163163
if (!me.repeat) {
164164
me.running = false;
165+
me.stop();
165166
return null;
166167
}
167-
168+
me.stop();
168169
me.currentTime = me.startTime;
169170
me.oldTime = me.currentTime;
170-
me.stop();
171+
me.start();
172+
171173
}
172174
//否则时间递增
173175
else {

0 commit comments

Comments
 (0)