Skip to content

Commit d37c53d

Browse files
committed
升级openlayers 到4.6.3, review by caoxinke.
1 parent e16b9e2 commit d37c53d

File tree

7 files changed

+41668
-37722
lines changed

7 files changed

+41668
-37722
lines changed

dist/iclient9-openlayers.js

Lines changed: 120 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,10 +2619,6 @@ var CommonServiceBase = exports.CommonServiceBase = function () {
26192619
credential = void 0,
26202620
value = void 0;
26212621
switch (this.serverType) {
2622-
case _REST.ServerType.ISERVER:
2623-
value = _SecurityManager.SecurityManager.getToken(keyUrl);
2624-
credential = value ? new _Credential.Credential(value, "token") : null;
2625-
break;
26262622
case _REST.ServerType.IPORTAL:
26272623
value = _SecurityManager.SecurityManager.getToken(keyUrl);
26282624
credential = value ? new _Credential.Credential(value, "token") : null;
@@ -2636,6 +2632,7 @@ var CommonServiceBase = exports.CommonServiceBase = function () {
26362632
credential = value ? new _Credential.Credential(value, "key") : null;
26372633
break;
26382634
default:
2635+
//iServer or others
26392636
value = _SecurityManager.SecurityManager.getToken(keyUrl);
26402637
credential = value ? new _Credential.Credential(value, "token") : null;
26412638
break;
@@ -25381,41 +25378,6 @@ var SmicText = exports.SmicText = function (_Shape) {
2538125378
}
2538225379

2538325380
switch (style.brushType) {
25384-
case 'fill':
25385-
this.setCtxGlobalAlpha(ctx, "fill", style);
25386-
if (style.textRotation && style.textRotation !== 0) {
25387-
ctx.save();
25388-
ctx.translate(ox, oy);
25389-
ctx.rotate(style.textRotation * Math.PI / 180);
25390-
if (style.textBaseline == 'top') {
25391-
if (style.maxWidth) {
25392-
ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
25393-
} else {
25394-
ctx.fillText(text[i], 0, lineHeight * i);
25395-
}
25396-
} else if (style.textBaseline == 'bottom') {
25397-
if (style.maxWidth) {
25398-
ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
25399-
} else {
25400-
ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
25401-
}
25402-
} else {
25403-
if (style.maxWidth) {
25404-
ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
25405-
} else {
25406-
ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
25407-
}
25408-
}
25409-
ctx.restore();
25410-
} else {
25411-
if (style.maxWidth) {
25412-
ctx.fillText(text[i], x, y, style.maxWidth);
25413-
} else {
25414-
ctx.fillText(text[i], x, y);
25415-
}
25416-
}
25417-
this.setCtxGlobalAlpha(ctx, "reset", style);
25418-
break;
2541925381
case 'stroke':
2542025382
this.setCtxGlobalAlpha(ctx, "stroke", style);
2542125383
if (style.textRotation && style.textRotation !== 0) {
@@ -25533,6 +25495,7 @@ var SmicText = exports.SmicText = function (_Shape) {
2553325495
}
2553425496
break;
2553525497
default:
25498+
//fill or others
2553625499
this.setCtxGlobalAlpha(ctx, "fill", style);
2553725500
if (style.textRotation && style.textRotation !== 0) {
2553825501
ctx.save();
@@ -50679,20 +50642,13 @@ var Http = exports.Http = function () {
5067950642

5068050643
_createClass(Http, [{
5068150644
key: 'get',
50682-
value: function get(url, onsuccess, onerror, opts) {
50683-
// eslint-disable-line no-unused-vars
50645+
value: function get(url, onsuccess, onerror) {
5068450646
if ((typeof url === 'undefined' ? 'undefined' : _typeof(url)) === 'object') {
5068550647
var obj = url;
5068650648
url = obj.url;
5068750649
onsuccess = obj.onsuccess;
5068850650
onerror = obj.onerror;
50689-
opts = obj; // eslint-disable-line no-unused-vars
50690-
} else {
50691-
if ((typeof onerror === 'undefined' ? 'undefined' : _typeof(onerror)) === 'object') {
50692-
opts = onerror; // eslint-disable-line no-unused-vars
50693-
}
5069450651
}
50695-
/* jshint ignore:start */
5069650652
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new window.ActiveXObject('Microsoft.XMLHTTP');
5069750653
xhr.open('GET', url, true);
5069850654
xhr.onreadystatechange = function () {
@@ -50708,7 +50664,6 @@ var Http = exports.Http = function () {
5070850664
};
5070950665

5071050666
xhr.send(null);
50711-
/* jshint ignore:end */
5071250667
}
5071350668
}]);
5071450669

@@ -51329,7 +51284,7 @@ var Painter = exports.Painter = function () {
5132951284
}
5133051285

5133151286
// 什么都不干的空方法
51332-
function doNothing() {// eslint-disable-line no-unused-vars
51287+
function doNothing() {// eslint-disable-line no-unused-vars //NOSONAR
5133351288

5133451289
}
5133551290
}
@@ -57649,10 +57604,6 @@ var ImageSuperMapRest = exports.ImageSuperMapRest = function (_ol$source$TileIma
5764957604
credential,
5765057605
value;
5765157606
switch (serverType) {
57652-
case _iclientCommon.ServerType.ISERVER:
57653-
value = _iclientCommon.SecurityManager.getToken(url);
57654-
credential = value ? new _iclientCommon.Credential(value, "token") : null;
57655-
break;
5765657607
case _iclientCommon.ServerType.IPORTAL:
5765757608
value = _iclientCommon.SecurityManager.getToken(url);
5765857609
credential = value ? new _iclientCommon.Credential(value, "token") : null;
@@ -57666,6 +57617,7 @@ var ImageSuperMapRest = exports.ImageSuperMapRest = function (_ol$source$TileIma
5766657617
credential = value ? new _iclientCommon.Credential(value, "key") : null;
5766757618
break;
5766857619
default:
57620+
//iserver or others
5766957621
value = _iclientCommon.SecurityManager.getToken(url);
5767057622
credential = value ? new _iclientCommon.Credential(value, "token") : null;
5767157623
break;
@@ -58012,10 +57964,6 @@ var TileSuperMapRest = exports.TileSuperMapRest = function (_ol$source$TileImage
5801257964
credential,
5801357965
value;
5801457966
switch (serverType) {
58015-
case _iclientCommon.ServerType.ISERVER:
58016-
value = _iclientCommon.SecurityManager.getToken(url);
58017-
credential = value ? new _iclientCommon.Credential(value, "token") : null;
58018-
break;
5801957967
case _iclientCommon.ServerType.IPORTAL:
5802057968
value = _iclientCommon.SecurityManager.getToken(url);
5802157969
credential = value ? new _iclientCommon.Credential(value, "token") : null;
@@ -58029,6 +57977,7 @@ var TileSuperMapRest = exports.TileSuperMapRest = function (_ol$source$TileImage
5802957977
credential = value ? new _iclientCommon.Credential(value, "key") : null;
5803057978
break;
5803157979
default:
57980+
//iserver or others
5803257981
value = _iclientCommon.SecurityManager.getToken(url);
5803357982
credential = value ? new _iclientCommon.Credential(value, "token") : null;
5803457983
break;
@@ -60145,7 +60094,7 @@ var Mapv = exports.Mapv = function (_ol$source$ImageCanva) {
6014560094
this.resolution = resolution;
6014660095
this.extent = extent;
6014760096
}
60148-
return this.context.canvas;
60097+
return canvas2;
6014960098
}
6015060099
return _this;
6015160100
}
@@ -60654,10 +60603,6 @@ var VectorTileSuperMapRest = exports.VectorTileSuperMapRest = function (_ol$sour
6065460603
credential,
6065560604
value;
6065660605
switch (serverType) {
60657-
case _iclientCommon.ServerType.ISERVER:
60658-
value = _iclientCommon.SecurityManager.getToken(url);
60659-
credential = value ? new _iclientCommon.Credential(value, "token") : null;
60660-
break;
6066160606
case _iclientCommon.ServerType.IPORTAL:
6066260607
value = _iclientCommon.SecurityManager.getToken(url);
6066360608
credential = value ? new _iclientCommon.Credential(value, "token") : null;
@@ -60671,6 +60616,7 @@ var VectorTileSuperMapRest = exports.VectorTileSuperMapRest = function (_ol$sour
6067160616
credential = value ? new _iclientCommon.Credential(value, "key") : null;
6067260617
break;
6067360618
default:
60619+
//iserver or others
6067460620
value = _iclientCommon.SecurityManager.getToken(url);
6067560621
credential = value ? new _iclientCommon.Credential(value, "token") : null;
6067660622
break;
@@ -60758,6 +60704,11 @@ var VectorTileSuperMapRest = exports.VectorTileSuperMapRest = function (_ol$sour
6075860704
* @param tileUrl -{string} 瓦片地址
6075960705
*/
6076060706
function tileLoadFunction(tile, tileUrl) {
60707+
var regWidth = new RegExp("(^|\\?|&)" + 'width' + "=([^&]*)(\\s|&|$)");
60708+
var regHeight = new RegExp("(^|\\?|&)" + 'height' + "=([^&]*)(\\s|&|$)");
60709+
var width = Number(tileUrl.match(regWidth)[2]);
60710+
var height = Number(tileUrl.match(regHeight)[2]);
60711+
6076160712
tile.setLoader(function () {
6076260713
_iclientCommon.FetchRequest.get(tileUrl).then(function (response) {
6076360714
if (tile.getFormat() instanceof _olDebug2.default.format.GeoJSON) {
@@ -60794,6 +60745,7 @@ var VectorTileSuperMapRest = exports.VectorTileSuperMapRest = function (_ol$sour
6079460745
features = tile.getFormat().readFeatures(_Util.Util.toGeoJSON(features));
6079560746
}
6079660747
tile.setFeatures(features);
60748+
tile.setExtent([0, 0, width, height]);
6079760749
tile.setProjection(new _olDebug2.default.proj.Projection({
6079860750
code: 'TILE_PIXELS',
6079960751
units: 'tile-pixels'
@@ -60895,6 +60847,7 @@ var VectorTileSuperMapRest = exports.VectorTileSuperMapRest = function (_ol$sour
6089560847
extent: extent,
6089660848
resolutions: resolutions
6089760849
});
60850+
// options.projection = 'EPSG:' + mapJSONObj.prjCoordSys.epsgCode;
6089860851
return options;
6089960852
}
6090060853
}]);
@@ -84215,7 +84168,6 @@ _SuperMap.SuperMap.CartoCSS.Tree.Definition = function () {
8421584168

8421684169
var available = _SuperMap.SuperMap.CartoCSS.Tree.Zoom.all,
8421784170
xml = '',
84218-
zoom,
8421984171
symbolizers,
8422084172
zooms = { available: _SuperMap.SuperMap.CartoCSS.Tree.Zoom.all };
8422184173
for (var i = 0; i < this.rules.length && available; i++) {
@@ -92755,7 +92707,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9275592707
}
9275692708

9275792709
function Promise(fn) {
92758-
if (!(this instanceof Promise)) throw new TypeError('Promises must be constructed via new');
92710+
if (_typeof(this) !== 'object') throw new TypeError('Promises must be constructed via new');
9275992711
if (typeof fn !== 'function') throw new TypeError('not a function');
9276092712
this._state = 0;
9276192713
this._handled = false;
@@ -92879,9 +92831,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9287992831
};
9288092832

9288192833
Promise.all = function (arr) {
92834+
var args = Array.prototype.slice.call(arr);
92835+
9288292836
return new Promise(function (resolve, reject) {
92883-
if (!arr || typeof arr.length === 'undefined') throw new TypeError('Promise.all accepts an array');
92884-
var args = Array.prototype.slice.call(arr);
9288592837
if (args.length === 0) return resolve([]);
9288692838
var remaining = args.length;
9288792839

@@ -93652,7 +93604,108 @@ module.exports = whatwgFetch;
9365293604
/* 468 */
9365393605
/***/ (function(module, exports) {
9365493606

93655-
module.exports = {"_from":"proj4@2.3.15","_id":"proj4@2.3.15","_inBundle":false,"_integrity":"sha1-WtBui8owvg/6OJpJ5FZfUfBtCJ4=","_location":"/proj4","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"proj4@2.3.15","name":"proj4","escapedName":"proj4","rawSpec":"2.3.15","saveSpec":null,"fetchSpec":"2.3.15"},"_requiredBy":["/"],"_resolved":"http://registry.npm.taobao.org/proj4/download/proj4-2.3.15.tgz","_shasum":"5ad06e8bca30be0ffa389a49e4565f51f06d089e","_spec":"proj4@2.3.15","_where":"E:\\git\\SuperMap\\iClient-JavaScript","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":"~0.0.2"},"deprecated":false,"description":"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.","devDependencies":{"browserify":"~12.0.1","chai":"~1.8.1","curl":"git://github.com/cujojs/curl.git","grunt":"~0.4.2","grunt-browserify":"~4.0.1","grunt-cli":"~0.1.13","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0","grunt-contrib-uglify":"~0.11.1","grunt-mocha-phantomjs":"~0.4.0","istanbul":"~0.2.4","mocha":"~1.17.1","tin":"~0.4.0"},"directories":{"test":"test","doc":"docs"},"homepage":"https://github.com/proj4js/proj4js#readme","jam":{"main":"dist/proj4.js","include":["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},"license":"MIT","main":"lib/index.js","name":"proj4","repository":{"type":"git","url":"git://github.com/proj4js/proj4js.git"},"scripts":{"test":"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},"version":"2.3.15"}
93607+
module.exports = {
93608+
"_from": "proj4@2.3.15",
93609+
"_id": "proj4@2.3.15",
93610+
"_inBundle": false,
93611+
"_integrity": "sha1-WtBui8owvg/6OJpJ5FZfUfBtCJ4=",
93612+
"_location": "/proj4",
93613+
"_phantomChildren": {},
93614+
"_requested": {
93615+
"type": "version",
93616+
"registry": true,
93617+
"raw": "proj4@2.3.15",
93618+
"name": "proj4",
93619+
"escapedName": "proj4",
93620+
"rawSpec": "2.3.15",
93621+
"saveSpec": null,
93622+
"fetchSpec": "2.3.15"
93623+
},
93624+
"_requiredBy": [
93625+
"/"
93626+
],
93627+
"_resolved": "https://registry.npmjs.org/proj4/-/proj4-2.3.15.tgz",
93628+
"_shasum": "5ad06e8bca30be0ffa389a49e4565f51f06d089e",
93629+
"_spec": "proj4@2.3.15",
93630+
"_where": "G:\\github-iClient\\iClient9",
93631+
"author": "",
93632+
"bugs": {
93633+
"url": "https://github.com/proj4js/proj4js/issues"
93634+
},
93635+
"bundleDependencies": false,
93636+
"contributors": [
93637+
{
93638+
"name": "Mike Adair",
93639+
"email": "madair@dmsolutions.ca"
93640+
},
93641+
{
93642+
"name": "Richard Greenwood",
93643+
"email": "rich@greenwoodmap.com"
93644+
},
93645+
{
93646+
"name": "Calvin Metcalf",
93647+
"email": "calvin.metcalf@gmail.com"
93648+
},
93649+
{
93650+
"name": "Richard Marsden",
93651+
"url": "http://www.winwaed.com"
93652+
},
93653+
{
93654+
"name": "T. Mittan"
93655+
},
93656+
{
93657+
"name": "D. Steinwand"
93658+
},
93659+
{
93660+
"name": "S. Nelson"
93661+
}
93662+
],
93663+
"dependencies": {
93664+
"mgrs": "~0.0.2"
93665+
},
93666+
"deprecated": false,
93667+
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
93668+
"devDependencies": {
93669+
"browserify": "~12.0.1",
93670+
"chai": "~1.8.1",
93671+
"curl": "git://github.com/cujojs/curl.git",
93672+
"grunt": "~0.4.2",
93673+
"grunt-browserify": "~4.0.1",
93674+
"grunt-cli": "~0.1.13",
93675+
"grunt-contrib-connect": "~0.6.0",
93676+
"grunt-contrib-jshint": "~0.8.0",
93677+
"grunt-contrib-uglify": "~0.11.1",
93678+
"grunt-mocha-phantomjs": "~0.4.0",
93679+
"istanbul": "~0.2.4",
93680+
"mocha": "~1.17.1",
93681+
"tin": "~0.4.0"
93682+
},
93683+
"directories": {
93684+
"test": "test",
93685+
"doc": "docs"
93686+
},
93687+
"homepage": "https://github.com/proj4js/proj4js#readme",
93688+
"jam": {
93689+
"main": "dist/proj4.js",
93690+
"include": [
93691+
"dist/proj4.js",
93692+
"README.md",
93693+
"AUTHORS",
93694+
"LICENSE.md"
93695+
]
93696+
},
93697+
"license": "MIT",
93698+
"main": "lib/index.js",
93699+
"name": "proj4",
93700+
"repository": {
93701+
"type": "git",
93702+
"url": "git://github.com/proj4js/proj4js.git"
93703+
},
93704+
"scripts": {
93705+
"test": "./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"
93706+
},
93707+
"version": "2.3.15"
93708+
};
9365693709

9365793710
/***/ }),
9365893711
/* 469 */

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.

dist/include-openlayers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
var excludes = (targetScript.getAttribute('exclude') || "").split(",");
3838
if (!inArray(excludes, 'ol')) {
3939
inputCSS("http://openlayers.org/en/latest/css/ol.css");
40-
inputScript("http://openlayers.org/en/latest/build/ol.js");
40+
inputScript("http://openlayers.org/en/latest/build/ol-debug.js");
4141
}
4242
if (inArray(includes, 'mapv')) {
4343
inputScript("http://mapv.baidu.com/build/mapv.min.js");

examples/openlayers/mvtVectorLayer4326.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%">
99
<div id="map" style="margin:0 auto;width: 100%;height: 100%;border: 1px solid #dddddd"></div>
1010
<script type="text/javascript">
11-
var url = (window.isLocal ? window.server : "http://117.122.248.69:8090")+"/iserver/services/map-world/rest/maps/World";
11+
var url = (window.isLocal ? window.server : "http://117.122.248.69:8090") + "/iserver/services/map-world/rest/maps/World";
1212
new ol.supermap.MapService(url).getMapInfo(function (serviceResult) {
1313
var map = new ol.Map({
1414
target: 'map',
@@ -27,6 +27,10 @@
2727
var vectorTileStyles = new ol.supermap.VectorTileStyles(stylesOptions);
2828
var vectorTileOptions = ol.source.VectorTileSuperMapRest.optionsFromMapJSON(url, serviceResult.result);
2929
vectorTileOptions.format = new ol.format.MVT({featureClass: ol.Feature});
30+
vectorTileOptions.format.defaultDataProjection = new ol.proj.Projection({
31+
code: '',
32+
units: ol.proj.Units.TILE_PIXELS
33+
});
3034
var vectorLayer = new ol.layer.VectorTile({
3135
source: new ol.source.VectorTileSuperMapRest(vectorTileOptions),
3236
style: vectorTileStyles.getFeatureStyle
@@ -35,7 +39,8 @@
3539

3640
map.on('click', function (e) {
3741
map.forEachFeatureAtPixel(e.pixel, function (feature) {
38-
vectorTileStyles.dispatchEvent({type: 'featureSelected',
42+
vectorTileStyles.dispatchEvent({
43+
type: 'featureSelected',
3944
selectedId: feature.getId(),
4045
layerName: feature.getProperties().layer
4146
});

0 commit comments

Comments
 (0)