/*! * * iclient-ol.(https://iclient.supermap.io) * Copyright© 2000 - 2020 SuperMap Software Co.Ltd * license: Apache-2.0 * version: v10.1.0 * */ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 65); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = ol.style.Style; /***/ }), /* 1 */ /***/ (function(module, exports) { module.exports = ol.style.Stroke; /***/ }), /* 2 */ /***/ (function(module, exports) { module.exports = ol.format.GeoJSON; /***/ }), /* 3 */ /***/ (function(module, exports) { module.exports = ol.style.Fill; /***/ }), /* 4 */ /***/ (function(module, exports) { module.exports = ol.geom.Point; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(71); /***/ }), /* 6 */ /***/ (function(module, exports) { module.exports = ol.layer; /***/ }), /* 7 */ /***/ (function(module, exports) { module.exports = ol.proj; /***/ }), /* 8 */ /***/ (function(module, exports) { module.exports = ol.source; /***/ }), /* 9 */ /***/ (function(module, exports) { module.exports = ol.Feature; /***/ }), /* 10 */ /***/ (function(module, exports) { module.exports = ol.tilegrid.TileGrid; /***/ }), /* 11 */ /***/ (function(module, exports) { module.exports = ol.style.Circle; /***/ }), /* 12 */ /***/ (function(module, exports) { module.exports = ol.style; /***/ }), /* 13 */ /***/ (function(module, exports) { module.exports = ol.format.MVT; /***/ }), /* 14 */ /***/ (function(module, exports) { module.exports = ol.geom.Geometry; /***/ }), /* 15 */ /***/ (function(module, exports) { module.exports = ol.style.Icon; /***/ }), /* 16 */ /***/ (function(module, exports) { module.exports = ol.style.Text; /***/ }), /* 17 */ /***/ (function(module, exports) { module.exports = ol.Observable; /***/ }), /* 18 */ /***/ (function(module, exports) { module.exports = ol.source.ImageCanvas; /***/ }), /* 19 */ /***/ (function(module, exports) { module.exports = ol.Map; /***/ }), /* 20 */ /***/ (function(module, exports) { module.exports = ol.extent; /***/ }), /* 21 */ /***/ (function(module, exports) { module.exports = ol.source.Vector; /***/ }), /* 22 */ /***/ (function(module, exports) { module.exports = ol.source.TileImage; /***/ }), /* 23 */ /***/ (function(module, exports) { module.exports = ol.size; /***/ }), /* 24 */ /***/ (function(module, exports) { module.exports = ol.Object; /***/ }), /* 25 */ /***/ (function(module, exports) { function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var g; // This works in non-strict mode g = function () { return this; }(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 26 */ /***/ (function(module, exports) { module.exports = ol.tilegrid.WMTS; /***/ }), /* 27 */ /***/ (function(module, exports) { module.exports = ol.geom.LineString; /***/ }), /* 28 */ /***/ (function(module, exports) { module.exports = ol.control.Control; /***/ }), /* 29 */ /***/ (function(module, exports) { module.exports = ol.render; /***/ }), /* 30 */ /***/ (function(module, exports) { module.exports = ol.tilegrid; /***/ }), /* 31 */ /***/ (function(module, exports) { module.exports = ol.util; /***/ }), /* 32 */ /***/ (function(module, exports) { module.exports = ol.proj.proj4; /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { var mod; } })(this, function (exports, module) { 'use strict'; var defaultOptions = { timeout: 5000, jsonpCallback: 'callback', jsonpCallbackFunction: null }; function generateCallbackFunction() { return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000); } function clearFunction(functionName) { // IE8 throws an exception when you try to delete a property on window // http://stackoverflow.com/a/1824228/751089 try { delete window[functionName]; } catch (e) { window[functionName] = undefined; } } function removeScript(scriptId) { var script = document.getElementById(scriptId); if (script) { document.getElementsByTagName('head')[0].removeChild(script); } } function fetchJsonp(_url) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; // to avoid param reassign var url = _url; var timeout = options.timeout || defaultOptions.timeout; var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback; var timeoutId = undefined; return new Promise(function (resolve, reject) { var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction(); var scriptId = jsonpCallback + '_' + callbackFunction; window[callbackFunction] = function (response) { resolve({ ok: true, // keep consistent with fetch API json: function json() { return Promise.resolve(response); } }); if (timeoutId) clearTimeout(timeoutId); removeScript(scriptId); clearFunction(callbackFunction); }; // Check if the user set their own params, and if not add a ? to start a list of params url += url.indexOf('?') === -1 ? '?' : '&'; var jsonpScript = document.createElement('script'); jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction); if (options.charset) { jsonpScript.setAttribute('charset', options.charset); } jsonpScript.id = scriptId; document.getElementsByTagName('head')[0].appendChild(jsonpScript); timeoutId = setTimeout(function () { reject(new Error('JSONP request to ' + _url + ' timed out')); clearFunction(callbackFunction); removeScript(scriptId); window[callbackFunction] = function () { clearFunction(callbackFunction); }; }, timeout); // Caught if got 404/500 jsonpScript.onerror = function () { reject(new Error('JSONP request to ' + _url + ' failed')); clearFunction(callbackFunction); removeScript(scriptId); if (timeoutId) clearTimeout(timeoutId); }; }); } // export as global function /* let local; if (typeof global !== 'undefined') { local = global; } else if (typeof self !== 'undefined') { local = self; } else { try { local = Function('return this')(); } catch (e) { throw new Error('polyfill failed because global object is unavailable in this environment'); } } local.fetchJsonp = fetchJsonp; */ module.exports = fetchJsonp; }); /***/ }), /* 34 */ /***/ (function(module, exports) { module.exports = function(){try{return XLSX}catch(e){return {}}}(); /***/ }), /* 35 */ /***/ (function(module, exports) { module.exports = function(){try{return mapv}catch(e){return {}}}(); /***/ }), /* 36 */ /***/ (function(module, exports) { module.exports = function(){try{return turf}catch(e){return {}}}(); /***/ }), /* 37 */ /***/ (function(module, exports) { module.exports = ol.View; /***/ }), /* 38 */ /***/ (function(module, exports) { module.exports = ol.format.WMTSCapabilities; /***/ }), /* 39 */ /***/ (function(module, exports) { module.exports = ol.geom; /***/ }), /* 40 */ /***/ (function(module, exports) { module.exports = function (module) { if (!module.webpackPolyfill) { module.deprecate = function () {}; module.paths = []; // module.parent = undefined by default if (!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function get() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function get() { return module.i; } }); module.webpackPolyfill = 1; } return module; }; /***/ }), /* 41 */ /***/ (function(module, exports) { module.exports = function(){try{return elasticsearch}catch(e){return {}}}(); /***/ }), /* 42 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', objectTag = '[object Object]', promiseTag = '[object Promise]', setTag = '[object Set]', weakMapTag = '[object WeakMap]'; var dataViewTag = '[object DataView]'; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Detect free variable `global` from Node.js. */ var freeGlobal = (typeof global === "undefined" ? "undefined" : _typeof(global)) == 'object' && global && global.Object === Object && global; /** Detect free variable `self`. */ var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array ? array.length : 0, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array * of key-value pairs for `object` corresponding to the property names of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the key-value pairs. */ function baseToPairs(object, props) { return arrayMap(props, function (key) { return [key, object[key]]; }); } /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function (value, key) { result[++index] = [key, value]; }); return result; } /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function (arg) { return func(transform(arg)); }; } /** * Converts `set` to its value-value pairs. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the value-value pairs. */ function setToPairs(set) { var index = -1, result = Array(set.size); set.forEach(function (value) { result[++index] = [value, value]; }); return result; } /** Used for built-in method references. */ var funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; /** Used to detect methods masquerading as native. */ var maskSrcKey = function () { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? 'Symbol(src)_1.' + uid : ''; }(); /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object); /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise = getNative(root, 'Promise'), Set = getNative(root, 'Set'), WeakMap = getNative(root, 'WeakMap'); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { // Safari 8.1 makes `arguments.callee` enumerable in strict mode. // Safari 9 makes `arguments.length` enumerable in strict mode. var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : []; var length = result.length, skipIndexes = !!length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == 'length' || isIndex(key, length)))) { result.push(key); } } return result; } /** * The base implementation of `getTag`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { return objectToString.call(value); } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } /** * Creates a `_.toPairs` or `_.toPairsIn` function. * * @private * @param {Function} keysFunc The function to get the keys of a given object. * @returns {Function} Returns the new pairs function. */ function createToPairs(keysFunc) { return function (object) { var tag = getTag(object); if (tag == mapTag) { return mapToArray(object); } if (tag == setTag) { return setToPairs(object); } return baseToPairs(object, keysFunc(object)); }; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, // for data views in Edge < 14, and promises in Node.js. if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { getTag = function getTag(value) { var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length; } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = typeof Ctor == 'function' && Ctor.prototype || objectProto; return value === proto; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to process. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return func + ''; } catch (e) {} } return ''; } /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = _typeof(value); return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && _typeof(value) == 'object'; } /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** * Creates an array of own enumerable string keyed-value pairs for `object` * which can be consumed by `_.fromPairs`. If `object` is a map or set, its * entries are returned. * * @static * @memberOf _ * @since 4.0.0 * @alias entries * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the key-value pairs. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.toPairs(new Foo); * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) */ var toPairs = createToPairs(keys); module.exports = toPairs; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(25))) /***/ }), /* 43 */ /***/ (function(module, exports) { module.exports = function(){try{return echarts}catch(e){return {}}}(); /***/ }), /* 44 */ /***/ (function(module, exports) { module.exports = ol.control.ScaleLine; /***/ }), /* 45 */ /***/ (function(module, exports) { module.exports = ol.AssertionError; /***/ }), /* 46 */ /***/ (function(module, exports) { module.exports = ol.layer.Vector; /***/ }), /* 47 */ /***/ (function(module, exports) { module.exports = function(){try{return canvg}catch(e){return {}}}(); /***/ }), /* 48 */ /***/ (function(module, exports) { module.exports = ol.layer.Group; /***/ }), /* 49 */ /***/ (function(module, exports) { module.exports = ol.asserts; /***/ }), /* 50 */ /***/ (function(module, exports) { module.exports = ol.source.XYZ; /***/ }), /* 51 */ /***/ (function(module, exports) { module.exports = ol.source.WMTS; /***/ }), /* 52 */ /***/ (function(module, exports) { module.exports = ol.style.RegularShape; /***/ }), /* 53 */ /***/ (function(module, exports) { module.exports = ol.geom.Polygon; /***/ }), /* 54 */ /***/ (function(module, exports) { module.exports = ol.layer.Image; /***/ }), /* 55 */ /***/ (function(module, exports) { module.exports = ol.interaction.Pointer; /***/ }), /* 56 */ /***/ (function(module, exports) { module.exports = ol.source.VectorTile; /***/ }), /* 57 */ /***/ (function(module, exports) { module.exports = ol.proj.Projection; /***/ }), /* 58 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, module) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', promiseTag = '[object Promise]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** Detect free variable `global` from Node.js. */ var freeGlobal = (typeof global === "undefined" ? "undefined" : _typeof(global)) == 'object' && global && global.Object === Object && global; /** Detect free variable `self`. */ var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** Detect free variable `exports`. */ var freeExports = ( false ? undefined : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && ( false ? undefined : _typeof(module)) == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = function () { try { return freeProcess && freeProcess.binding('util'); } catch (e) {} }(); /* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array ? array.length : 0; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function (object) { return object == null ? undefined : object[key]; }; } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function (value) { return func(value); }; } /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function (value, key) { result[++index] = [key, value]; }); return result; } /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function (arg) { return func(transform(arg)); }; } /** * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function (value) { result[++index] = value; }); return result; } /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; /** Used to detect methods masquerading as native. */ var maskSrcKey = function () { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? 'Symbol(src)_1.' + uid : ''; }(); /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); /** Built-in value references. */ var _Symbol = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object); /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise = getNative(root, 'Promise'), Set = getNative(root, 'Set'), WeakMap = getNative(root, 'WeakMap'), nativeCreate = getNative(Object, 'create'); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); /** Used to convert symbols to primitives and strings. */ var symbolProto = _Symbol ? _Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { return this.has(key) && delete this.__data__[key]; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.__data__ = { 'hash': new Hash(), 'map': new (Map || ListCache)(), 'string': new Hash() }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { return getMapData(this, key)['delete'](key); } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { getMapData(this, key).set(key, value); return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /** * * Creates an array cache object to store unique values. * * @private * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values ? values.length : 0; this.__data__ = new MapCache(); while (++index < length) { this.add(values[index]); } } /** * Adds `value` to the array cache. * * @private * @name add * @memberOf SetCache * @alias push * @param {*} value The value to cache. * @returns {Object} Returns the cache instance. */ function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } /** * Checks if `value` is in the array cache. * * @private * @name has * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { return this.__data__.has(value); } // Add methods to `SetCache`. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { this.__data__ = new ListCache(entries); } /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new ListCache(); } /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { return this.__data__['delete'](key); } /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var cache = this.__data__; if (cache instanceof ListCache) { var pairs = cache.__data__; if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { pairs.push([key, value]); return this; } cache = this.__data__ = new MapCache(pairs); } cache.set(key, value); return this; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { // Safari 8.1 makes `arguments.callee` enumerable in strict mode. // Safari 9 makes `arguments.length` enumerable in strict mode. var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : []; var length = result.length, skipIndexes = !!length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == 'length' || isIndex(key, length)))) { result.push(key); } } return result; } /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = isKey(path, object) ? [path] : castPath(path); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return index && index == length ? object : undefined; } /** * The base implementation of `getTag`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { return objectToString.call(value); } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return object != null && key in Object(object); } /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. * @param {boolean} [bitmask] The bitmask of comparison flags. * The bitmask may be composed of the following flags: * 1 - Unordered comparison * 2 - Partial comparison * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, customizer, bitmask, stack) { if (value === other) { return true; } if (value == null || other == null || !isObject(value) && !isObjectLike(other)) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); } /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` * for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; if (!objIsArr) { objTag = getTag(object); objTag = objTag == argsTag ? objectTag : objTag; } if (!othIsArr) { othTag = getTag(other); othTag = othTag == argsTag ? objectTag : othTag; } var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; if (isSameTag && !objIsObj) { stack || (stack = new Stack()); return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); } if (!(bitmask & PARTIAL_COMPARE_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack()); return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack()); return equalObjects(object, other, equalFunc, customizer, bitmask, stack); } /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new Stack(); if (customizer) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { return false; } } } return true; } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. if (typeof value == 'function') { return value; } if (value == null) { return identity; } if (_typeof(value) == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. */ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function (object) { return object === source || baseIsMatch(object, source, matchData); }; } /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function (object) { var objValue = get(object, path); return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); }; } /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { return function (object) { return baseGet(object, path); }; } /** * The base implementation of `_.pullAt` without support for individual * indexes or capturing the removed elements. * * @private * @param {Array} array The array to modify. * @param {number[]} indexes The indexes of elements to remove. * @returns {Array} Returns `array`. */ function basePullAt(array, indexes) { var length = array ? indexes.length : 0, lastIndex = length - 1; while (length--) { var index = indexes[length]; if (length == lastIndex || index !== previous) { var previous = index; if (isIndex(index)) { splice.call(array, index, 1); } else if (!isKey(index, array)) { var path = castPath(index), object = parent(array, path); if (object != null) { delete object[toKey(last(path))]; } } else { delete array[toKey(index)]; } } } return array; } /** * The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function baseSlice(array, start, end) { var index = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : length + start; } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : end - start >>> 0; start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = value + ''; return result == '0' && 1 / value == -INFINITY ? '-0' : result; } /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @returns {Array} Returns the cast property path array. */ function castPath(value) { return isArray(value) ? value : stringToPath(value); } /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} customizer The function to customize comparisons. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` * for more details. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Assume cyclic values are equal. var stacked = stack.get(array); if (stacked && stack.get(other)) { return stacked == other; } var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache() : undefined; stack.set(array, other); stack.set(other, array); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function (othValue, othIndex) { if (!seen.has(othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { return seen.add(othIndex); } })) { result = false; break; } } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} customizer The function to customize comparisons. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` * for more details. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { switch (tag) { case dataViewTag: if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: // Coerce booleans to `1` or `0` and dates to milliseconds. // Invalid dates are coerced to `NaN`. return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == other + ''; case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & PARTIAL_COMPARE_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= UNORDERED_COMPARE_FLAG; // Recursively compare objects (susceptible to call stack limits). stack.set(object, other); var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} customizer The function to customize comparisons. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` * for more details. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked && stack.get(other)) { return stacked == other; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, isStrictComparable(value)]; } return result; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, // for data views in Edge < 14, and promises in Node.js. if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { getTag = function getTag(value) { var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = isKey(path, object) ? [path] : castPath(path); var result, index = -1, length = path.length; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result) { return result; } var length = object ? object.length : 0; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length; } /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = _typeof(value); if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = _typeof(value); return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null; } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = typeof Ctor == 'function' && Ctor.prototype || objectProto; return value === proto; } /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !isObject(value); } /** * A specialized version of `matchesProperty` for source values suitable * for strict equality comparisons, i.e. `===`. * * @private * @param {string} key The key of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { return function (object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined || key in Object(object)); }; } /** * Gets the parent value at `path` of `object`. * * @private * @param {Object} object The object to query. * @param {Array} path The path to get the parent value of. * @returns {*} Returns the parent value. */ function parent(object, path) { return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); } /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoize(function (string) { string = toString(string); var result = []; if (reLeadingDot.test(string)) { result.push(''); } string.replace(rePropName, function (match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : number || match); }); return result; }); /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = value + ''; return result == '0' && 1 / value == -INFINITY ? '-0' : result; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to process. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return func + ''; } catch (e) {} } return ''; } /** * Gets the last element of `array`. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. * @example * * _.last([1, 2, 3]); * // => 3 */ function last(array) { var length = array ? array.length : 0; return length ? array[length - 1] : undefined; } /** * Removes all elements from `array` that `predicate` returns truthy for * and returns an array of the removed elements. The predicate is invoked * with three arguments: (value, index, array). * * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` * to pull elements from an array by value. * * @static * @memberOf _ * @since 2.0.0 * @category Array * @param {Array} array The array to modify. * @param {Function} [predicate=_.identity] * The function invoked per iteration. * @returns {Array} Returns the new array of removed elements. * @example * * var array = [1, 2, 3, 4]; * var evens = _.remove(array, function(n) { * return n % 2 == 0; * }); * * console.log(array); * // => [1, 3] * * console.log(evens); * // => [2, 4] */ function remove(array, predicate) { var result = []; if (!(array && array.length)) { return result; } var index = -1, indexes = [], length = array.length; predicate = baseIteratee(predicate, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result.push(value); indexes.push(index); } } basePullAt(array, indexes); return result; } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || resolver && typeof resolver != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function memoized() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result); return result; }; memoized.cache = new (memoize.Cache || MapCache)(); return memoized; } // Assign cache to `_.memoize`. memoize.Cache = MapCache; /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || value !== value && other !== other; } /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = _typeof(value); return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && _typeof(value) == 'object'; } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return _typeof(value) == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag; } /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b'); * // => true * * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. * @example * * var objects = [ * { 'a': { 'b': 2 } }, * { 'a': { 'b': 1 } } * ]; * * _.map(objects, _.property('a.b')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } module.exports = remove; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(25), __webpack_require__(40)(module))) /***/ }), /* 59 */ /***/ (function(module) { module.exports = JSON.parse("[{\"name\":\"黑龙江省\",\"coord\":[127.64559817675396,48.48668098449708]},{\"name\":\"内蒙古自治区\",\"coord\":[118.34519572208615,45.370218276977525]},{\"name\":\"新疆维吾尔自治区\",\"coord\":[87.13479065593184,41.75497055053711]},{\"name\":\"吉林省\",\"coord\":[126.12985278813787,43.57983207702637]},{\"name\":\"辽宁省\",\"coord\":[124.02494773936439,41.105743408203125]},{\"name\":\"甘肃省\",\"coord\":[102.87785725633012,37.69582366943361]},{\"name\":\"河北省\",\"coord\":[115.66327227481898,39.33383178710938]},{\"name\":\"北京市\",\"coord\":[116.62199343603638,40.25053787231445]},{\"name\":\"山西省\",\"coord\":[112.45180235808988,37.666561126708984]},{\"name\":\"天津市\",\"coord\":[117.35711842642581,39.406789779663086]},{\"name\":\"陕西省\",\"coord\":[109.56294003056632,35.64754199981689]},{\"name\":\"宁夏回族自治区\",\"coord\":[105.96110877640074,37.3081169128418]},{\"name\":\"青海省\",\"coord\":[96.07301048277901,35.44417190551758]},{\"name\":\"山东省\",\"coord\":[118.03833752951093,36.29800605773925]},{\"name\":\"西藏自治区\",\"coord\":[87.47361520439412,31.6703872680664]},{\"name\":\"河南省\",\"coord\":[113.07832397097275,33.87751102447509]},{\"name\":\"江苏省\",\"coord\":[119.93926538201052,32.945452690124505]},{\"name\":\"安徽省\",\"coord\":[117.15146765881019,32.024482727050774]},{\"name\":\"四川省\",\"coord\":[102.28998890142759,30.182161331176758]},{\"name\":\"湖北省\",\"coord\":[112.87798261431585,31.157071113586426]},{\"name\":\"重庆市\",\"coord\":[107.870126637831,30.188085556030266]},{\"name\":\"上海市\",\"coord\":[121.42561166015514,31.276043891906745]},{\"name\":\"浙江省\",\"coord\":[119.75337092707514,29.175934791564945]},{\"name\":\"湖南省\",\"coord\":[111.52770282777405,27.38110256195069]},{\"name\":\"江西省\",\"coord\":[115.51091280655628,27.283511161804206]},{\"name\":\"云南省\",\"coord\":[101.27053825991308,25.19783210754396]},{\"name\":\"贵州省\",\"coord\":[106.49672346773299,26.92267990112305]},{\"name\":\"福建省\",\"coord\":[117.9976766946587,25.939599990844727]},{\"name\":\"广西壮族自治区\",\"coord\":[108.98706831086302,23.891559600830078]},{\"name\":\"台湾省\",\"coord\":[120.82468432537434,23.602651596069336]},{\"name\":\"香港特别行政区\",\"coord\":[114.21036850371561,22.374858856201172]},{\"name\":\"海南省\",\"coord\":[109.62792940960824,19.163116455078125]},{\"name\":\"广东省\",\"coord\":[113.32127888266032,22.873867034912106]},{\"name\":\"澳门特别行政区\",\"coord\":[113.56819996291901,22.160347992976]}]"); /***/ }), /* 60 */ /***/ (function(module) { module.exports = JSON.parse("[{\"name\":\"克拉玛依市\",\"coord\":[85.01486759299489,45.406422237230046]},{\"name\":\"昌吉回族自治州\",\"coord\":[88.7154624754753,44.26991024636568]},{\"name\":\"石河子市\",\"coord\":[86.0208600035924,44.239045558096805]},{\"name\":\"霍林郭勒市\",\"coord\":[114.73479243733115,44.16058374713977]},{\"name\":\"本溪市\",\"coord\":[124.64357865201586,41.177197783134275]},{\"name\":\"嘉峪关市\",\"coord\":[98.16891560537093,39.76279786284264]},{\"name\":\"莱芜市\",\"coord\":[117.65723565456207,36.27916499211527]},{\"name\":\"神农架林区\",\"coord\":[110.48296222218153,31.581260143666697]},{\"name\":\"天门市\",\"coord\":[113.00615321481195,30.64105781887143]},{\"name\":\"鄂州市\",\"coord\":[114.94764081970385,30.325634953844585]},{\"name\":\"潜江市\",\"coord\":[112.70703817700621,30.349210666019893]},{\"name\":\"仙桃市\",\"coord\":[113.34688900729822,30.315951161935402]},{\"name\":\"萍乡市\",\"coord\":[113.88072263074415,27.47193090553213]},{\"name\":\"台湾省\",\"coord\":[120.14338943402045,23.596002465926095]},{\"name\":\"东莞市\",\"coord\":[113.89443658529342,22.897826158636448]},{\"name\":\"中山市\",\"coord\":[113.37118387764659,22.501478858616522]},{\"name\":\"珠海市\",\"coord\":[113.21799258934986,22.23782602992192]},{\"name\":\"北海市\",\"coord\":[109.18248083043899,21.695773689750148]},{\"name\":\"香港\",\"coord\":[114.20689279508653,22.36016760139811]},{\"name\":\"舟山市\",\"coord\":[122.22514712841459,30.338633120695956]},{\"name\":\"克孜勒苏柯尔克孜\",\"coord\":[74.62910472637343,39.59886016069875]},{\"name\":\"喀什地区\",\"coord\":[77.19899922143753,37.85462871211595]},{\"name\":\"阿克苏地区\",\"coord\":[81.43930290016381,41.067304799230456]},{\"name\":\"和田地区\",\"coord\":[80.69780509160952,36.95287032287055]},{\"name\":\"阿里地区\",\"coord\":[82.536487505389,32.69566569631762]},{\"name\":\"日喀则地区\",\"coord\":[86.5996831353606,29.54861754814263]},{\"name\":\"那曲地区\",\"coord\":[88.32523292667608,33.20600450932715]},{\"name\":\"玉树藏族自治州\",\"coord\":[95.2107128446203,33.90320387919257]},{\"name\":\"迪庆藏族自治州\",\"coord\":[99.42465312188943,28.052797714348895]},{\"name\":\"怒江傈傈族自治州\",\"coord\":[98.85737910439825,26.98345757528851]},{\"name\":\"大理白族自治州\",\"coord\":[99.93934374816013,25.684737357453045]},{\"name\":\"德宏傣族景颇族自\",\"coord\":[98.13830877778075,24.593421919561205]},{\"name\":\"保山市\",\"coord\":[99.19031013453166,24.979380341662]},{\"name\":\"临沧市\",\"coord\":[99.62483778975081,24.058807858948214]},{\"name\":\"普洱市\",\"coord\":[100.94440267992684,23.44121660743221]},{\"name\":\"西双版纳傣族自治\",\"coord\":[100.86105801845994,21.882475641324206]},{\"name\":\"拉萨市\",\"coord\":[91.3684790613129,30.14176592960237]},{\"name\":\"山南地区\",\"coord\":[92.11665242621062,28.33000201578789]},{\"name\":\"林芝地区\",\"coord\":[94.9307847458166,29.125110156601963]},{\"name\":\"昌都地区\",\"coord\":[97.33912235873476,30.48520825551814]},{\"name\":\"丽江市\",\"coord\":[100.65713436205135,26.96190318191959]},{\"name\":\"攀枝花市\",\"coord\":[101.73355913301131,26.714486678752795]},{\"name\":\"凉山彝族自治州\",\"coord\":[102.08678551422615,27.683020519860396]},{\"name\":\"楚雄彝族自治州\",\"coord\":[101.68264761198458,25.369603845264024]},{\"name\":\"红河哈尼族彝族自\",\"coord\":[102.95101719613119,23.624860095239875]},{\"name\":\"文山壮族苗族自治\",\"coord\":[104.8708359910614,23.579587266862504]},{\"name\":\"百色市\",\"coord\":[106.69546907589859,23.98220841166522]},{\"name\":\"崇左市\",\"coord\":[107.3277087317123,22.49769755349952]},{\"name\":\"防城港市\",\"coord\":[107.88939931155171,21.94550204069006]},{\"name\":\"南宁市\",\"coord\":[108.67078983716917,23.12207641861882]},{\"name\":\"钦州市\",\"coord\":[108.8532307305186,22.157690108421384]},{\"name\":\"玉林市\",\"coord\":[110.26918466489103,22.391823643610415]},{\"name\":\"湛江市\",\"coord\":[109.93033457863683,21.086751055633457]},{\"name\":\"茂名市\",\"coord\":[110.80336192333934,22.069184739040775]},{\"name\":\"阳江市\",\"coord\":[111.70471342186183,22.108751366417575]},{\"name\":\"江门市\",\"coord\":[112.53715618649149,22.297368082806777]},{\"name\":\"广州市\",\"coord\":[113.4949302208309,23.28359314707863]},{\"name\":\"清远市\",\"coord\":[113.10957368131268,24.334444053233856]},{\"name\":\"肇庆市\",\"coord\":[112.11117530204233,23.60241158796112]},{\"name\":\"梧州市\",\"coord\":[111.01709510772797,23.518132876753846]},{\"name\":\"贺州市\",\"coord\":[111.50423061842756,24.4095096817199]},{\"name\":\"桂林市\",\"coord\":[110.44046163393094,25.353966673735407]},{\"name\":\"柳州市\",\"coord\":[109.34854449214147,24.972408051485047]},{\"name\":\"河池市\",\"coord\":[107.81191841865586,24.649291651298164]},{\"name\":\"黔东南苗族侗族自\",\"coord\":[108.39952601614591,26.429286420465576]},{\"name\":\"贵阳市\",\"coord\":[106.59784062851153,26.797907456479816]},{\"name\":\"安顺市\",\"coord\":[105.76161265300635,25.988644902171018]},{\"name\":\"黔西南布依族苗族\",\"coord\":[105.5954078788574,25.404850939549405]},{\"name\":\"曲靖市\",\"coord\":[103.9164335632742,25.697243690315265]},{\"name\":\"六盘水市\",\"coord\":[104.77723228072432,26.15402255629164]},{\"name\":\"毕节地区\",\"coord\":[105.03867422931839,27.077913968069666]},{\"name\":\"昭通市\",\"coord\":[104.29730513046874,27.62418247971078]},{\"name\":\"宜宾市\",\"coord\":[104.76748901448207,28.553501804266475]},{\"name\":\"乐山市\",\"coord\":[103.56027669102787,29.160754519210577]},{\"name\":\"自贡市\",\"coord\":[104.63272827056402,29.273152614922402]},{\"name\":\"内江市\",\"coord\":[104.82644562304716,29.61272653799929]},{\"name\":\"遵义市\",\"coord\":[106.82413636302059,28.191847588570702]},{\"name\":\"达州市\",\"coord\":[107.59704170009518,31.32138258839703]},{\"name\":\"遂宁市\",\"coord\":[105.48979445433736,30.677687821242678]},{\"name\":\"广安市\",\"coord\":[106.56708164098042,30.43500706741521]},{\"name\":\"泸州市\",\"coord\":[105.42591761727707,28.50277238478137]},{\"name\":\"资阳市\",\"coord\":[104.97995126874034,30.154251886139654]},{\"name\":\"雅安市\",\"coord\":[102.69931299964517,29.892630706195035]},{\"name\":\"眉山市\",\"coord\":[104.07052881858888,29.894202166560405]},{\"name\":\"甘孜藏族自治州\",\"coord\":[100.50721042614238,30.975216556269658]},{\"name\":\"果洛藏族自治州\",\"coord\":[99.30775565051923,34.03539865224808]},{\"name\":\"海南藏族自治州\",\"coord\":[100.39969108016373,35.90048272566899]},{\"name\":\"黄南藏族自治州\",\"coord\":[101.5360706381689,35.10286360841902]},{\"name\":\"赣南藏族自治州\",\"coord\":[102.97083885806067,34.326752803339026]},{\"name\":\"陇南市\",\"coord\":[105.24780098912132,33.57031117443431]},{\"name\":\"天水市\",\"coord\":[105.53503634660417,34.62320421368087]},{\"name\":\"定西市\",\"coord\":[104.58787768541339,35.08900966621695]},{\"name\":\"临夏回族自治州\",\"coord\":[103.2612870434902,35.591577124455235]},{\"name\":\"西宁市\",\"coord\":[101.57680657999033,36.84800271717157]},{\"name\":\"海东地区\",\"coord\":[102.30909850729282,36.287400615025646]},{\"name\":\"海北藏族自治州\",\"coord\":[100.27122484450717,37.892557516083826]},{\"name\":\"金昌市\",\"coord\":[102.02244049169511,38.497330414886164]},{\"name\":\"酒泉市\",\"coord\":[95.94486678270127,40.56891536586272]},{\"name\":\"海西蒙古族藏族自\",\"coord\":[94.67143298050689,36.022725148503724]},{\"name\":\"巴音郭楞蒙古自治\",\"coord\":[88.18116214759745,39.556478810319916]},{\"name\":\"哈密地区\",\"coord\":[93.84302392518026,42.95015211178875]},{\"name\":\"叶鲁番地区\",\"coord\":[89.82035217277885,42.399368632283505]},{\"name\":\"乌鲁木齐市\",\"coord\":[88.00048109561487,43.549986370786]},{\"name\":\"阿勒泰地区\",\"coord\":[88.11213933257655,47.05593413019629]},{\"name\":\"博尔塔拉蒙古自治\",\"coord\":[82.26402238163408,44.671135542630864]},{\"name\":\"伊犁哈萨克自治州\",\"coord\":[82.80778717477179,43.53783381365267]},{\"name\":\"阿拉善盟\",\"coord\":[103.29923966842289,40.10955801781495]},{\"name\":\"武威市\",\"coord\":[102.73362058791429,37.94211141321436]},{\"name\":\"兰州市\",\"coord\":[103.73793563506032,36.27379827886003]},{\"name\":\"中卫市\",\"coord\":[105.6943786030716,37.20654236148948]},{\"name\":\"银川市\",\"coord\":[106.20022174140034,38.52103167597483]},{\"name\":\"石嘴山市\",\"coord\":[106.41544011793628,38.84054137571417]},{\"name\":\"乌海市\",\"coord\":[106.8984175998405,39.54616572239788]},{\"name\":\"鄂尔多斯市\",\"coord\":[108.43285571424619,39.24036799350715]},{\"name\":\"巴彦淖尔市\",\"coord\":[107.45840392808307,41.30159860424196]},{\"name\":\"包头市\",\"coord\":[110.46472193224272,41.48017783644221]},{\"name\":\"呼和浩特市\",\"coord\":[111.48365173603975,40.498363056149884]},{\"name\":\"乌兰察布市\",\"coord\":[112.61568977597707,41.75789561273154]},{\"name\":\"大同市\",\"coord\":[113.7107192749083,39.898956799744184]},{\"name\":\"朔州市\",\"coord\":[112.65428748167508,39.681772914701924]},{\"name\":\"忻州市\",\"coord\":[112.36127575589583,38.88990233614568]},{\"name\":\"榆林市\",\"coord\":[109.68473112169593,38.19921027134876]},{\"name\":\"延安市\",\"coord\":[109.52425222161318,36.406522726136814]},{\"name\":\"庆阳市\",\"coord\":[107.73052193155061,36.183821532624464]},{\"name\":\"固原市\",\"coord\":[106.20191575442442,36.11634909496382]},{\"name\":\"白银市\",\"coord\":[104.68634478137065,36.51582865625868]},{\"name\":\"宝鸡市\",\"coord\":[107.33534779230747,34.3387216485855]},{\"name\":\"汉中市\",\"coord\":[107.03534754266246,33.00142998064871]},{\"name\":\"广元市\",\"coord\":[105.92928137563939,32.21872447205537]},{\"name\":\"巴中市\",\"coord\":[107.03422410306194,31.99874720836291]},{\"name\":\"南充市\",\"coord\":[106.32964805032347,31.156657700184095]},{\"name\":\"绵阳市\",\"coord\":[104.58949560201106,31.88628780630976]},{\"name\":\"德阳市\",\"coord\":[104.41542984932845,31.110558133718676]},{\"name\":\"成都市\",\"coord\":[103.8852290010473,30.777258040348634]},{\"name\":\"阿坝藏族羌族自治\",\"coord\":[102.26209319552814,32.45725845387284]},{\"name\":\"安康市\",\"coord\":[109.14236501848015,32.77467694678074]},{\"name\":\"十堰市\",\"coord\":[110.39934083416314,32.376209039347906]},{\"name\":\"襄阳市\",\"coord\":[111.97539147094662,31.93399822417465]},{\"name\":\"宜昌市\",\"coord\":[111.22204852395754,30.772457669035354]},{\"name\":\"恩施市\",\"coord\":[109.42158366502872,30.260366574390105]},{\"name\":\"张家界市\",\"coord\":[110.59760006538717,29.330107409240718]},{\"name\":\"吉首市\",\"coord\":[109.72176899848378,28.681903937242495]},{\"name\":\"铜仁地区\",\"coord\":[108.54247523485463,28.11736237519646]},{\"name\":\"重庆市\",\"coord\":[107.86007108564992,30.186253395053196]},{\"name\":\"怀化市\",\"coord\":[109.94325166787243,27.43919084801186]},{\"name\":\"益阳市\",\"coord\":[112.43060358108062,28.75127294553697]},{\"name\":\"娄底市\",\"coord\":[111.41891416951897,27.696312460064604]},{\"name\":\"常德市\",\"coord\":[111.72571610131646,29.27189463838195]},{\"name\":\"荆州市\",\"coord\":[112.65896596965268,30.05161542755362]},{\"name\":\"荆门市\",\"coord\":[112.6586855902184,31.01267124474617]},{\"name\":\"岳阳市\",\"coord\":[113.2595036144316,29.106247116930163]},{\"name\":\"长沙市\",\"coord\":[113.15415586456598,28.222934680488425]},{\"name\":\"湘潭市\",\"coord\":[112.51092596317824,27.69881544105668]},{\"name\":\"株州市\",\"coord\":[113.49665538546823,27.03993794610501]},{\"name\":\"衡阳市\",\"coord\":[112.48849636578527,26.783613569970782]},{\"name\":\"邵阳市\",\"coord\":[110.6723832117475,26.81652287086792]},{\"name\":\"永州市\",\"coord\":[111.8565364154186,25.768488267811968]},{\"name\":\"韶关市\",\"coord\":[113.53420325850979,24.69848878771937]},{\"name\":\"惠州市\",\"coord\":[114.32029589634925,23.25504544231892]},{\"name\":\"佛山市\",\"coord\":[112.95925897403649,23.10116677189257]},{\"name\":\"云浮市\",\"coord\":[111.78042514904234,22.840400494105687]},{\"name\":\"深圳市\",\"coord\":[114.13138648919008,22.649563063468342]},{\"name\":\"汕尾市\",\"coord\":[115.57412892884373,23.06989642104901]},{\"name\":\"河源市\",\"coord\":[114.89746229844398,23.97971937124767]},{\"name\":\"揭阳市\",\"coord\":[116.04290004239446,23.304802704715357]},{\"name\":\"汕头市\",\"coord\":[116.7008461897183,23.35898625947344]},{\"name\":\"潮州市\",\"coord\":[116.75405548481658,23.854381508863064]},{\"name\":\"梅州市\",\"coord\":[116.13719397345734,24.15633544812716]},{\"name\":\"漳州市\",\"coord\":[117.38279760543345,24.41111215459575]},{\"name\":\"厦门市\",\"coord\":[118.04275971554665,24.675908246507944]},{\"name\":\"龙岩市\",\"coord\":[116.69341144552507,25.20284542644492]},{\"name\":\"泉州市\",\"coord\":[118.12035864630246,25.22984144365049]},{\"name\":\"莆田市\",\"coord\":[118.82439690138142,25.439653480972687]},{\"name\":\"福州市\",\"coord\":[119.1608285845262,25.99117532466728]},{\"name\":\"三明市\",\"coord\":[117.51188176216434,26.318292906961602]},{\"name\":\"南平市\",\"coord\":[118.16153136678187,27.306303151805437]},{\"name\":\"抚州市\",\"coord\":[116.3455359885574,27.487043655935366]},{\"name\":\"鹰潭市\",\"coord\":[117.01082360702333,28.241253742969946]},{\"name\":\"吉安市\",\"coord\":[114.91377151807418,26.957486660664525]},{\"name\":\"赣州市\",\"coord\":[115.046455717572,25.81565075681663]},{\"name\":\"郴州市\",\"coord\":[113.1544526703492,25.871927095452524]},{\"name\":\"新余市\",\"coord\":[114.94161795877827,27.79044654578371]},{\"name\":\"宜春市\",\"coord\":[115.04574494880995,28.306428044943356]},{\"name\":\"南昌市\",\"coord\":[115.9963824234495,28.664803351584705]},{\"name\":\"九江市\",\"coord\":[115.53225905704193,29.362905920276297]},{\"name\":\"上饶市\",\"coord\":[117.8595355766598,28.765755150094634]},{\"name\":\"景德镇市\",\"coord\":[117.25387030721845,29.33426823662448]},{\"name\":\"黄山市\",\"coord\":[117.85476357809696,29.969632034273722]},{\"name\":\"池州市\",\"coord\":[117.34517113140791,30.208089337922335]},{\"name\":\"铜陵市\",\"coord\":[117.93160431300694,30.926442655001676]},{\"name\":\"安庆市\",\"coord\":[116.54307680610799,30.524265461641296]},{\"name\":\"黄石市\",\"coord\":[115.02354597728443,29.924060229331015]},{\"name\":\"咸宁市\",\"coord\":[114.26967602231792,29.652174021136048]},{\"name\":\"黄冈市\",\"coord\":[115.2859016705373,30.65856897065683]},{\"name\":\"武汉市\",\"coord\":[114.34552076948799,30.68836237966767]},{\"name\":\"随州市\",\"coord\":[113.3850627838818,31.87891659924412]},{\"name\":\"信阳市\",\"coord\":[114.81374730587638,32.0309685135914]},{\"name\":\"驻马店市\",\"coord\":[114.07756451509235,32.896720987266114]},{\"name\":\"商洛市\",\"coord\":[109.82044421310393,33.77403373563189]},{\"name\":\"西安市\",\"coord\":[109.11839808451401,34.225257215515896]},{\"name\":\"渭南市\",\"coord\":[109.75732444226935,35.025913644359306]},{\"name\":\"铜川市\",\"coord\":[108.98695328111377,35.19235092947735]},{\"name\":\"咸阳市\",\"coord\":[108.36398776446165,34.84311348287181]},{\"name\":\"三门峡市\",\"coord\":[110.80049688104964,34.31818709571671]},{\"name\":\"运城市\",\"coord\":[111.1736679525165,35.19010372283576]},{\"name\":\"洛阳市\",\"coord\":[111.87577573098216,34.33379926109848]},{\"name\":\"平顶山市\",\"coord\":[112.80931281928427,33.759895800153096]},{\"name\":\"漯河市\",\"coord\":[113.83505724178012,33.70034266174508]},{\"name\":\"许昌市\",\"coord\":[113.78762484088509,34.051835688452435]},{\"name\":\"郑州市\",\"coord\":[113.49619951867594,34.61181797865449]},{\"name\":\"焦作市\",\"coord\":[113.13404280173008,35.134167097471625]},{\"name\":\"晋城市\",\"coord\":[112.7495732073233,35.63186423091449]},{\"name\":\"长治市\",\"coord\":[112.85900842873183,36.45872910742828]},{\"name\":\"临汾市\",\"coord\":[111.49379787924448,36.22810800777857]},{\"name\":\"太原市\",\"coord\":[112.15628804033796,37.91704444063036]},{\"name\":\"吕梁市\",\"coord\":[111.31901105774872,37.712740463356496]},{\"name\":\"晋中市\",\"coord\":[113.08199599739676,37.36532613794343]},{\"name\":\"邯郸市\",\"coord\":[114.41824047234618,36.530119932543315]},{\"name\":\"安阳市\",\"coord\":[113.88883283163116,35.7797611183252]},{\"name\":\"鹤壁市\",\"coord\":[114.3654094911545,35.75770487428472]},{\"name\":\"新乡市\",\"coord\":[113.9184107718167,35.348471214026716]},{\"name\":\"开封市\",\"coord\":[114.52801677500626,34.61371216679872]},{\"name\":\"周口市\",\"coord\":[114.88509782391864,33.69999759722657]},{\"name\":\"阜阳市\",\"coord\":[115.44595951398213,32.98060371610532]},{\"name\":\"淮南市\",\"coord\":[116.68941991880993,32.79972275772595]},{\"name\":\"蚌埠市\",\"coord\":[117.38594715783302,33.106729536033896]},{\"name\":\"淮北市\",\"coord\":[116.69651711889378,33.69527529383458]},{\"name\":\"宿州市\",\"coord\":[117.30175405886838,33.943330421260015]},{\"name\":\"亳州市\",\"coord\":[116.12410804185097,33.46769392946132]},{\"name\":\"商丘市\",\"coord\":[115.59575176872548,34.28339840831147]},{\"name\":\"菏泽市\",\"coord\":[115.53631974831816,35.197319393220624]},{\"name\":\"濮阳市\",\"coord\":[115.3070485514902,35.775883510964334]},{\"name\":\"聊城市\",\"coord\":[115.8870069012884,36.40529594548765]},{\"name\":\"邢台市\",\"coord\":[114.74259008644859,37.251396750084155]},{\"name\":\"石家庄市\",\"coord\":[114.56923838363613,38.13141710980106]},{\"name\":\"阳泉市\",\"coord\":[113.39216149668508,38.09075470547468]},{\"name\":\"保定市\",\"coord\":[115.261524468934,39.09118520781398]},{\"name\":\"衡水市\",\"coord\":[115.8182936677897,37.715661598187154]},{\"name\":\"德州市\",\"coord\":[116.4582273790399,37.19372347888644]},{\"name\":\"沧州市\",\"coord\":[116.76192710911863,38.20240042039232]},{\"name\":\"廊坊市\",\"coord\":[116.50410772133856,39.27896741763884]},{\"name\":\"天津市\",\"coord\":[117.31988934444873,39.37154482470619]},{\"name\":\"北京市\",\"coord\":[116.59734730757869,40.237112944270976]},{\"name\":\"张家口市\",\"coord\":[115.1823606483226,40.83732566607167]},{\"name\":\"唐山市\",\"coord\":[117.8693184261954,39.71862889477249]},{\"name\":\"秦皇岛市\",\"coord\":[119.30467355367742,39.990574652162564]},{\"name\":\"承德市\",\"coord\":[117.16275671911026,41.36623845548547]},{\"name\":\"葫芦岛市\",\"coord\":[119.9342336210531,40.5628822626519]},{\"name\":\"朝阳市\",\"coord\":[120.11853493535794,41.471852354885755]},{\"name\":\"赤峰市\",\"coord\":[118.50943546234379,43.25452976059767]},{\"name\":\"锦州市\",\"coord\":[121.5167549323861,41.45933087433065]},{\"name\":\"营口市\",\"coord\":[122.58571915054674,40.42093503997384]},{\"name\":\"丹东市\",\"coord\":[124.33549382902183,40.46369290272115]},{\"name\":\"辽阳市\",\"coord\":[123.34064798039414,41.152331397771356]},{\"name\":\"盘锦市\",\"coord\":[122.06718005354679,41.05573599862555]},{\"name\":\"阜新市\",\"coord\":[121.93889757908204,42.27641773244204]},{\"name\":\"鞍山市\",\"coord\":[122.78904432242356,40.77781183142038]},{\"name\":\"沈阳市\",\"coord\":[122.99508899709724,42.1162195010079]},{\"name\":\"铁岭市\",\"coord\":[124.23100515588399,42.72666083611828]},{\"name\":\"扶顺市\",\"coord\":[124.46027188217573,41.82955407638859]},{\"name\":\"通辽市\",\"coord\":[122.0729370657937,43.90889130864869]},{\"name\":\"兴安盟\",\"coord\":[120.79456431092532,45.92003249442161]},{\"name\":\"白城市\",\"coord\":[123.10619907715235,45.25475749267784]},{\"name\":\"齐齐哈尔市\",\"coord\":[124.5462214659102,47.55395009317394]},{\"name\":\"大兴安岭地区\",\"coord\":[124.50992855161529,52.18438447846694]},{\"name\":\"黑河市\",\"coord\":[127.14721400335922,49.25080134026901]},{\"name\":\"大庆市\",\"coord\":[124.40329830095243,46.401048760966745]},{\"name\":\"绥化市\",\"coord\":[126.5214484055605,46.76992452194825]},{\"name\":\"松原市\",\"coord\":[124.21244334807682,44.75779381338502]},{\"name\":\"四平市\",\"coord\":[124.27839350328821,43.52139065090318]},{\"name\":\"通化市\",\"coord\":[125.67392830706305,41.91771808663852]},{\"name\":\"辽源市\",\"coord\":[125.33529527643432,42.758340204944986]},{\"name\":\"吉林市\",\"coord\":[126.83350281902375,43.60730120049175]},{\"name\":\"长春市\",\"coord\":[125.53597875970374,44.24624314701737]},{\"name\":\"白山市\",\"coord\":[127.16780160322108,42.093893880305075]},{\"name\":\"哈尔滨市\",\"coord\":[127.39125008786029,45.36200668820575]},{\"name\":\"鹤岗市\",\"coord\":[130.4703811258197,47.66520688940109]},{\"name\":\"伊春市\",\"coord\":[128.91240831703635,47.93833794565277]},{\"name\":\"七台河市\",\"coord\":[131.2677920224311,45.945099776108584]},{\"name\":\"鸡西市\",\"coord\":[132.38059153660274,45.722934218318535]},{\"name\":\"双鸭山市\",\"coord\":[132.3184817002743,46.65813679030265]},{\"name\":\"佳木斯市\",\"coord\":[132.26174446608726,47.17569713691394]},{\"name\":\"呼伦贝尔市\",\"coord\":[122.3210739998419,50.18176996070858]},{\"name\":\"孝感市\",\"coord\":[113.83749892135485,31.11757234692128]},{\"name\":\"贵港市\",\"coord\":[110.07354588052804,23.380735604767374]},{\"name\":\"黔南布依族苗族自\",\"coord\":[107.30931767543106,26.2976919432269]},{\"name\":\"宁德市\",\"coord\":[119.52482556634342,27.013151692716413]},{\"name\":\"温州市\",\"coord\":[120.30037042732202,27.8699145504001]},{\"name\":\"台州市\",\"coord\":[120.88886782713843,28.670799172772313]},{\"name\":\"丽水市\",\"coord\":[119.56796851966463,28.170268394477755]},{\"name\":\"衢州市\",\"coord\":[118.79479802644406,28.865874397158763]},{\"name\":\"金华市\",\"coord\":[119.99381920686633,29.093455548185744]},{\"name\":\"绍兴市\",\"coord\":[120.46546691682343,29.69382513836818]},{\"name\":\"宁波市\",\"coord\":[121.42142987830871,29.70001162878972]},{\"name\":\"杭州市\",\"coord\":[119.4405685790891,29.87218307296989]},{\"name\":\"宣城市\",\"coord\":[118.68748382914703,30.628143499626418]},{\"name\":\"湖州市\",\"coord\":[119.98261306633574,30.7945175862809]},{\"name\":\"嘉兴市\",\"coord\":[120.83889215988998,30.67538495499343]},{\"name\":\"上海市\",\"coord\":[121.37534147322967,31.25628247908459]},{\"name\":\"苏州市\",\"coord\":[120.6906182622391,31.381280695137775]},{\"name\":\"无锡市\",\"coord\":[120.32182300914366,31.54113306724517]},{\"name\":\"常州市\",\"coord\":[119.61953292830165,31.611878565375576]},{\"name\":\"南京市\",\"coord\":[118.71890548838064,31.910863187910323]},{\"name\":\"镇江市\",\"coord\":[119.42349332902813,31.97942313430778]},{\"name\":\"合肥市\",\"coord\":[117.30651975617157,31.79407863049138]},{\"name\":\"六安市\",\"coord\":[116.24668220575353,31.820846193819513]},{\"name\":\"滁州市\",\"coord\":[117.88422385307969,32.51792621904418]},{\"name\":\"泰州市\",\"coord\":[120.03124303305091,32.56503102346783]},{\"name\":\"南通市\",\"coord\":[120.85599446760912,32.18496706099728]},{\"name\":\"盐城市\",\"coord\":[120.01812490612667,33.54219948734023]},{\"name\":\"淮安市\",\"coord\":[119.0749424205415,33.39203631772854]},{\"name\":\"宿迁市\",\"coord\":[118.45404943216346,33.666258719120265]},{\"name\":\"徐州市\",\"coord\":[117.77482249295966,34.30847766157078]},{\"name\":\"济宁市\",\"coord\":[116.74147276546373,35.27488504351119]},{\"name\":\"枣庄市\",\"coord\":[117.43359942491492,34.884162021736]},{\"name\":\"连云港市\",\"coord\":[119.01553213785074,34.54316517587849]},{\"name\":\"临沂市\",\"coord\":[118.31478835349617,35.28173079028279]},{\"name\":\"日照市\",\"coord\":[119.14265350444272,35.54479073199592]},{\"name\":\"青岛市\",\"coord\":[120.27779044405756,36.3464117375903]},{\"name\":\"威海市\",\"coord\":[122.12963327195605,37.13879077904251]},{\"name\":\"烟台市\",\"coord\":[120.7689567423966,37.19772002195597]},{\"name\":\"潍坊市\",\"coord\":[119.02178548592039,36.49292234053931]},{\"name\":\"淄博市\",\"coord\":[117.92936024367185,36.60871347163638]},{\"name\":\"泰安市\",\"coord\":[116.93810893944303,36.0423330118612]},{\"name\":\"济南市\",\"coord\":[117.34560282551296,36.769574973846304]},{\"name\":\"东营市\",\"coord\":[118.4915054457184,37.52194690335787]},{\"name\":\"滨州市\",\"coord\":[117.67610299757533,37.4439597758601]},{\"name\":\"昆明市\",\"coord\":[102.93100245594789,25.481300763922075]},{\"name\":\"玉溪市\",\"coord\":[102.23080854291823,24.156168324611663]},{\"name\":\"塔城地区\",\"coord\":[83.60908162840168,45.3721852373893]},{\"name\":\"张掖市\",\"coord\":[100.47710030600572,38.704239320458385]},{\"name\":\"南阳市\",\"coord\":[112.1400670951149,33.03033276715801]},{\"name\":\"扬州市\",\"coord\":[119.48949608990988,32.80956776339646]},{\"name\":\"延边朝鲜族自治州\",\"coord\":[129.3577692895626,43.24968794080283]},{\"name\":\"牡丹江市\",\"coord\":[129.87240796405672,44.7073040108322]},{\"name\":\"澳门\",\"coord\":[113.56289691515346,22.14602596262204]},{\"name\":\"吴忠市\",\"coord\":[106.76894508116403,37.72566765880316]},{\"name\":\"来宾市\",\"coord\":[109.25592217010114,23.86346274681084]},{\"name\":\"平凉市\",\"coord\":[107.0708132782897,35.30329631658711]},{\"name\":\"马鞍山市\",\"coord\":[118.27245878467022,31.657727937739004]},{\"name\":\"芜湖市\",\"coord\":[118.32992684415504,31.081688223101658]},{\"name\":\"澄迈县\",\"coord\":[110.04198076060266,19.694955078668105]},{\"name\":\"保亭黎族苗族自治\",\"coord\":[109.6055304964257,18.6101488675304]},{\"name\":\"乐东黎族自治县\",\"coord\":[109.04051999525574,18.643137437909203]},{\"name\":\"儋州市\",\"coord\":[109.3431358337404,19.550974957403195]},{\"name\":\"定安县\",\"coord\":[110.38744429685676,19.47557074114284]},{\"name\":\"屯昌县\",\"coord\":[110.00574767630334,19.367175093044388]},{\"name\":\"白沙黎族自治县\",\"coord\":[109.36860737761768,19.214416393082217]},{\"name\":\"琼中黎族苗族自治\",\"coord\":[109.86691465937548,19.073671135862682]},{\"name\":\"东方市\",\"coord\":[108.86903802405428,19.017352815445214]},{\"name\":\"昌江黎族自治县\",\"coord\":[108.9686431884767,19.182594167127824]},{\"name\":\"海口市\",\"coord\":[110.420654296875,19.806565564640795]},{\"name\":\"济源市\",\"coord\":[112.38051465474433,35.07958362422394]},{\"name\":\"五指山市\",\"coord\":[109.53595187364496,18.832908264613966]},{\"name\":\"大连市\",\"coord\":[121.96662235866603,39.444150542439914]},{\"name\":\"文昌市三沙市\",\"coord\":[110.81828537536748,19.756501444162936]},{\"name\":\"三亚市\",\"coord\":[109.38424600793707,18.39186315877128]},{\"name\":\"万宁市\",\"coord\":[110.28485046979574,18.860240588635115]},{\"name\":\"陵水黎族自治县\",\"coord\":[109.95577603229562,18.594712684620465]},{\"name\":\"临高县\",\"coord\":[109.71915395436967,19.79420403032508]},{\"name\":\"琼海市\",\"coord\":[110.41650700703043,19.22315873149372]}]"); /***/ }), /* 61 */ /***/ (function(module) { module.exports = JSON.parse("[{\"id\":\"SalesJan2009\",\"fileName\":\"SalesJan2009\",\"xField\":\"Longitude\",\"yField\":\"Latitude\",\"type\":\"POINT\"},{\"id\":\"Sacramentorealestatetransactions\",\"fileName\":\"Ealestate transactions\",\"xField\":\"longitude\",\"yField\":\"latitude\",\"type\":\"POINT\"},{\"id\":\"BeijingResidentialDistrict\",\"fileName\":\"北京市住宅小区\",\"xField\":\"SmX\",\"yField\":\"SmY\",\"type\":\"POINT\"},{\"id\":\"GlobalRecordOfOver7Earthquakes\",\"fileName\":\"全球历史7级以上地震记录\",\"xField\":\"经度\",\"yField\":\"纬度\",\"type\":\"POINT\"},{\"id\":\"ChinaRecordOfOver6Earthquakes\",\"fileName\":\"中国历史6级以上地震记录\",\"xField\":\"经度\",\"yField\":\"纬度\",\"type\":\"POINT\"},{\"id\":\"ChinaMeteorologicalObservationStation\",\"fileName\":\"中国气象观测站\",\"xField\":\"经度\",\"yField\":\"纬度\",\"type\":\"POINT\"},{\"id\":\"BeijingSubwayLine\",\"fileName\":\"北京市地铁交通线路\",\"type\":\"LINE\"},{\"id\":\"ChinaEarthquakeIntensityZone\",\"fileName\":\"中国地震烈度区划面\",\"type\":\"POLYGON\"}]"); /***/ }), /* 62 */ /***/ (function(module, exports) { module.exports = ol.proj.Units; /***/ }), /* 63 */ /***/ (function(module, exports) { module.exports = ol.render.Feature; /***/ }), /* 64 */ /***/ (function(module, exports) { module.exports = ol.Collection; /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(73); module.exports = __webpack_require__(72); /***/ }), /* 66 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(setImmediate, global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } (function (global, factory) { ( false ? undefined : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined; })(this, function () { 'use strict'; /** * @this {Promise} */ function finallyConstructor(callback) { var constructor = this.constructor; return this.then(function (value) { // @ts-ignore return constructor.resolve(callback()).then(function () { return value; }); }, function (reason) { // @ts-ignore return constructor.resolve(callback()).then(function () { // @ts-ignore return constructor.reject(reason); }); }); } // Store setTimeout reference so promise-polyfill will be unaffected by // other code modifying setTimeout (like sinon.useFakeTimers()) var setTimeoutFunc = setTimeout; function isArray(x) { return Boolean(x && typeof x.length !== 'undefined'); } function noop() {} // Polyfill for Function.prototype.bind function bind(fn, thisArg) { return function () { fn.apply(thisArg, arguments); }; } /** * @constructor * @param {Function} fn */ function Promise(fn) { if (!(this instanceof Promise)) throw new TypeError('Promises must be constructed via new'); if (typeof fn !== 'function') throw new TypeError('not a function'); /** @type {!number} */ this._state = 0; /** @type {!boolean} */ this._handled = false; /** @type {Promise|undefined} */ this._value = undefined; /** @type {!Array} */ this._deferreds = []; doResolve(fn, this); } function handle(self, deferred) { while (self._state === 3) { self = self._value; } if (self._state === 0) { self._deferreds.push(deferred); return; } self._handled = true; Promise._immediateFn(function () { var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { (self._state === 1 ? resolve : reject)(deferred.promise, self._value); return; } var ret; try { ret = cb(self._value); } catch (e) { reject(deferred.promise, e); return; } resolve(deferred.promise, ret); }); } function resolve(self, newValue) { try { // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.'); if (newValue && (_typeof(newValue) === 'object' || typeof newValue === 'function')) { var then = newValue.then; if (newValue instanceof Promise) { self._state = 3; self._value = newValue; finale(self); return; } else if (typeof then === 'function') { doResolve(bind(then, newValue), self); return; } } self._state = 1; self._value = newValue; finale(self); } catch (e) { reject(self, e); } } function reject(self, newValue) { self._state = 2; self._value = newValue; finale(self); } function finale(self) { if (self._state === 2 && self._deferreds.length === 0) { Promise._immediateFn(function () { if (!self._handled) { Promise._unhandledRejectionFn(self._value); } }); } for (var i = 0, len = self._deferreds.length; i < len; i++) { handle(self, self._deferreds[i]); } self._deferreds = null; } /** * @constructor */ function Handler(onFulfilled, onRejected, promise) { this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; this.onRejected = typeof onRejected === 'function' ? onRejected : null; this.promise = promise; } /** * Take a potentially misbehaving resolver function and make sure * onFulfilled and onRejected are only called once. * * Makes no guarantees about asynchrony. */ function doResolve(fn, self) { var done = false; try { fn(function (value) { if (done) return; done = true; resolve(self, value); }, function (reason) { if (done) return; done = true; reject(self, reason); }); } catch (ex) { if (done) return; done = true; reject(self, ex); } } Promise.prototype['catch'] = function (onRejected) { return this.then(null, onRejected); }; Promise.prototype.then = function (onFulfilled, onRejected) { // @ts-ignore var prom = new this.constructor(noop); handle(this, new Handler(onFulfilled, onRejected, prom)); return prom; }; Promise.prototype['finally'] = finallyConstructor; Promise.all = function (arr) { return new Promise(function (resolve, reject) { if (!isArray(arr)) { return reject(new TypeError('Promise.all accepts an array')); } var args = Array.prototype.slice.call(arr); if (args.length === 0) return resolve([]); var remaining = args.length; function res(i, val) { try { if (val && (_typeof(val) === 'object' || typeof val === 'function')) { var then = val.then; if (typeof then === 'function') { then.call(val, function (val) { res(i, val); }, reject); return; } } args[i] = val; if (--remaining === 0) { resolve(args); } } catch (ex) { reject(ex); } } for (var i = 0; i < args.length; i++) { res(i, args[i]); } }); }; Promise.resolve = function (value) { if (value && _typeof(value) === 'object' && value.constructor === Promise) { return value; } return new Promise(function (resolve) { resolve(value); }); }; Promise.reject = function (value) { return new Promise(function (resolve, reject) { reject(value); }); }; Promise.race = function (arr) { return new Promise(function (resolve, reject) { if (!isArray(arr)) { return reject(new TypeError('Promise.race accepts an array')); } for (var i = 0, len = arr.length; i < len; i++) { Promise.resolve(arr[i]).then(resolve, reject); } }); }; // Use polyfill for setImmediate for performance gains Promise._immediateFn = // @ts-ignore typeof setImmediate === 'function' && function (fn) { // @ts-ignore setImmediate(fn); } || function (fn) { setTimeoutFunc(fn, 0); }; Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { if (typeof console !== 'undefined' && console) { console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console } }; /** @suppress {undefinedVars} */ var globalNS = function () { // the only reliable means to get the global object is // `Function('return this')()` // However, this causes CSP violations in Chrome apps. if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } throw new Error('unable to locate global object'); }(); if (!('Promise' in globalNS)) { globalNS['Promise'] = Promise; } else if (!globalNS.Promise.prototype['finally']) { globalNS.Promise.prototype['finally'] = finallyConstructor; } }); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(67).setImmediate, __webpack_require__(25))) /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {var scope = typeof global !== "undefined" && global || typeof self !== "undefined" && self || window; var apply = Function.prototype.apply; // DOM APIs, for completeness exports.setTimeout = function () { return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout); }; exports.setInterval = function () { return new Timeout(apply.call(setInterval, scope, arguments), clearInterval); }; exports.clearTimeout = exports.clearInterval = function (timeout) { if (timeout) { timeout.close(); } }; function Timeout(id, clearFn) { this._id = id; this._clearFn = clearFn; } Timeout.prototype.unref = Timeout.prototype.ref = function () {}; Timeout.prototype.close = function () { this._clearFn.call(scope, this._id); }; // Does not start the time, just sets up the members needed. exports.enroll = function (item, msecs) { clearTimeout(item._idleTimeoutId); item._idleTimeout = msecs; }; exports.unenroll = function (item) { clearTimeout(item._idleTimeoutId); item._idleTimeout = -1; }; exports._unrefActive = exports.active = function (item) { clearTimeout(item._idleTimeoutId); var msecs = item._idleTimeout; if (msecs >= 0) { item._idleTimeoutId = setTimeout(function onTimeout() { if (item._onTimeout) item._onTimeout(); }, msecs); } }; // setimmediate attaches itself to the global object __webpack_require__(68); // On some exotic environments, it's not clear which object `setimmediate` was // able to install onto. Search each possibility in the same order as the // `setimmediate` library. exports.setImmediate = typeof self !== "undefined" && self.setImmediate || typeof global !== "undefined" && global.setImmediate || this && this.setImmediate; exports.clearImmediate = typeof self !== "undefined" && self.clearImmediate || typeof global !== "undefined" && global.clearImmediate || this && this.clearImmediate; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(25))) /***/ }), /* 68 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { "use strict"; if (global.setImmediate) { return; } var nextHandle = 1; // Spec says greater than zero var tasksByHandle = {}; var currentlyRunningATask = false; var doc = global.document; var registerImmediate; function setImmediate(callback) { // Callback can either be a function or a string if (typeof callback !== "function") { callback = new Function("" + callback); } // Copy function arguments var args = new Array(arguments.length - 1); for (var i = 0; i < args.length; i++) { args[i] = arguments[i + 1]; } // Store and register the task var task = { callback: callback, args: args }; tasksByHandle[nextHandle] = task; registerImmediate(nextHandle); return nextHandle++; } function clearImmediate(handle) { delete tasksByHandle[handle]; } function run(task) { var callback = task.callback; var args = task.args; switch (args.length) { case 0: callback(); break; case 1: callback(args[0]); break; case 2: callback(args[0], args[1]); break; case 3: callback(args[0], args[1], args[2]); break; default: callback.apply(undefined, args); break; } } function runIfPresent(handle) { // From the spec: "Wait until any invocations of this algorithm started before this one have completed." // So if we're currently running a task, we'll need to delay this invocation. if (currentlyRunningATask) { // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a // "too much recursion" error. setTimeout(runIfPresent, 0, handle); } else { var task = tasksByHandle[handle]; if (task) { currentlyRunningATask = true; try { run(task); } finally { clearImmediate(handle); currentlyRunningATask = false; } } } } function installNextTickImplementation() { registerImmediate = function registerImmediate(handle) { process.nextTick(function () { runIfPresent(handle); }); }; } function canUsePostMessage() { // The test against `importScripts` prevents this implementation from being installed inside a web worker, // where `global.postMessage` means something completely different and can't be used for this purpose. if (global.postMessage && !global.importScripts) { var postMessageIsAsynchronous = true; var oldOnMessage = global.onmessage; global.onmessage = function () { postMessageIsAsynchronous = false; }; global.postMessage("", "*"); global.onmessage = oldOnMessage; return postMessageIsAsynchronous; } } function installPostMessageImplementation() { // Installs an event handler on `global` for the `message` event: see // * https://developer.mozilla.org/en/DOM/window.postMessage // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages var messagePrefix = "setImmediate$" + Math.random() + "$"; var onGlobalMessage = function onGlobalMessage(event) { if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) { runIfPresent(+event.data.slice(messagePrefix.length)); } }; if (global.addEventListener) { global.addEventListener("message", onGlobalMessage, false); } else { global.attachEvent("onmessage", onGlobalMessage); } registerImmediate = function registerImmediate(handle) { global.postMessage(messagePrefix + handle, "*"); }; } function installMessageChannelImplementation() { var channel = new MessageChannel(); channel.port1.onmessage = function (event) { var handle = event.data; runIfPresent(handle); }; registerImmediate = function registerImmediate(handle) { channel.port2.postMessage(handle); }; } function installReadyStateChangeImplementation() { var html = doc.documentElement; registerImmediate = function registerImmediate(handle) { // Create a ` * * @category Visualization VectorTile * @param {Object} options - 初始化参数。 * @param {(string|undefined)} [options.url] - SuperMap iServer 地图服务地址,例如'http://localhost:8090/iserver/services/map-mvt-test/rest/maps/test',与options.style互斥,优先级低于options.style。 * @param {(Object|string|undefined)} [opStyleMaptions.style] - Mapbox Style JSON 对象或获取 Mapbox Style JSON 对象的 URL。与 options.url 互斥,优先级高于 options.url。 * @param {Array.} [options.resolutions] - 地图分辨率数组,用于映射 zoom 值。通常情況与地图的 {@link ol/View} 的分辨率一致。
* 默认值为:[78271.51696402048,39135.75848201024, 19567.87924100512,9783.93962050256,4891.96981025128,2445.98490512564, 1222.99245256282,611.49622628141,305.748113140705,152.8740565703525, 76.43702828517625,38.21851414258813,19.109257071294063,9.554628535647032, 4.777314267823516,2.388657133911758,1.194328566955879,0.5971642834779395, 0.29858214173896974,0.14929107086948487,0.07464553543474244]。 * @param {(string|Array.|undefined)} [options.source] - Mapbox Style 'source'的 key 值或者 'layer' 的 ID 数组。 * 当配置 'source' 的 key 值时,source 为该值的 layer 会被加载; * 当配置为 'layer' 的 ID 数组时,指定的 layer 会被加载,注意被指定的 layer 需要有相同的 source。 * 当不配置时,默认为 Mapbox Style JSON 的 `sources` 对象中的第一个。 * @param {ol/Map} [options.map] - Openlayers 地图对象,仅用于面填充样式,若没有面填充样式可不填。 * @param {ol/StyleFunction} [options.selectedStyle] -选中样式Function。 * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。 * @example * var mbStyle = new ol.supermap.MapboxStyles({ url: url, source: 'California', resolutions: [78271.51696402048,39135.75848201024, 19567.87924100512,9783.93962050256,4891.96981025128,2445.98490512564] }) mbStyle.on('styleLoaded', function () { var vectorLayer = new ol.layer.VectorTile({ //设置避让参数 declutter: true, source: new ol.source.VectorTileSuperMapRest({ url: url, format: new ol.format.MVT({ featureClass: ol.Feature }), tileType: 'ScaleXY' }), style: mbStyle.featureStyleFuntion }); map.addLayer(vectorLayer); }) */ var MapboxStyles_MapboxStyles = /*#__PURE__*/function (_Observable) { MapboxStyles_inherits(MapboxStyles, _Observable); var _super = MapboxStyles_createSuper(MapboxStyles); function MapboxStyles(options) { var _this; MapboxStyles_classCallCheck(this, MapboxStyles); _this = _super.call(this); options = options || {}; _this.spriteRegEx = /^(.*)(\?.*)$/; _this.defaultFont = ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]; _this.map = options.map; _this.source = options.source; _this.styleTarget = options.style || Util_Util.urlAppend(Util_Util.urlPathAppend(options.url, 'tileFeature/vectorstyles'), 'type=MapBox_GL&styleonly=true'); _this.resolutions = options.resolutions; _this.withCredentials = options.withCredentials; _this.selectedObjects = []; _this.selectedStyle = options.selectedStyle || function () { return new external_ol_style_Style_default.a({ fill: new external_ol_style_Fill_default.a({ color: "rgba(255, 0, 0, 1)" }), stroke: new external_ol_style_Stroke_default.a({ color: "rgba(255, 0, 0, 1)", width: 10 }), text: new external_ol_style_Text_default.a({ font: 'normal 400 11.19px "Microsoft YaHei"', placement: "point", fill: new external_ol_style_Fill_default.a({ color: "blue" }) }), image: new external_ol_style_Circle_default.a({ radius: 5, fill: new external_ol_style_Fill_default.a({ color: "blue" }) }) }); }; _this.layersBySourceLayer = {}; olExtends_olExtends(_this.map); _this._loadStyle(_this.styleTarget); return _this; } /** * @function ol.supermap.MapboxStyles.prototype.getStyleFunction * @description 获取 ol/StyleFunction。 * @returns {ol/StyleFunction} 返回 ol/StyleFunction */ MapboxStyles_createClass(MapboxStyles, [{ key: "getStyleFunction", value: function getStyleFunction() { return this.featureStyleFuntion; } /** * @function ol.supermap.MapboxStyles.prototype.getStylesBySourceLayer * @description 根据图层名称获取样式。 * @param {string} sourceLayer - 数据图层名称。 */ }, { key: "getStylesBySourceLayer", value: function getStylesBySourceLayer(sourceLayer) { if (this.layersBySourceLayer[sourceLayer]) { return this.layersBySourceLayer[sourceLayer]; } var layers = []; for (var index = 0; index < this._mbStyle.layers.length; index++) { var layer = this._mbStyle.layers[index]; if (layer["source-layer"] !== sourceLayer) { continue; } layers.push(layer); } this.layersBySourceLayer[sourceLayer] = layers; return layers; } /** * @function ol.supermap.MapboxStyles.prototype.setSelectedId * @description 设置选中要素,该要素将会用 `selectedStyle` 样式绘制。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。 * @param {number} selectedId - 要素ID。 * @param {string} sourceLayer - 要素所在图层名称。 */ }, { key: "setSelectedId", value: function setSelectedId(selectedId, sourceLayer) { this.selectedObjects = []; this.selectedObjects.push({ id: selectedId, sourceLayer: sourceLayer }); } /** * @typedef {Object} ol.supermap.MapboxStyles.selectedObject * @description 要选择的要素对象。 * @property {number} selectedId - 要素ID。 * @property {string} sourceLayer - 要素所在图层名称。 */ /** * @function ol.supermap.MapboxStyles.prototype.setSelectedObjects * @version 10.0.0 * @description 设置选中要素或要素数组,该要素将会用 `selectedStyle` 样式绘制。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。 * @param {ol.supermap.MapboxStyles.selectedObject|Array.} addSelectedObjects - 选择的要素或要素数组。 */ }, { key: "setSelectedObjects", value: function setSelectedObjects(selectedObjects) { if (!Array.isArray(selectedObjects)) { selectedObjects = [selectedObjects]; } this.selectedObjects = []; this.selectedObjects = selectedObjects; } /** * @function ol.supermap.MapboxStyles.prototype.addSelectedObjects * @version 10.0.0 * @description 增加选中的要素或要素数组,该要素将会用 `selectedStyle` 样式绘制。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。 * @param {ol.supermap.MapboxStyles.selectedObject|Array.} addSelectedObjects - 选择的要素或要素数组。 */ }, { key: "addSelectedObjects", value: function addSelectedObjects(selectedObjects) { var _this$selectedObjects; if (!Array.isArray(selectedObjects)) { selectedObjects = [selectedObjects]; } (_this$selectedObjects = this.selectedObjects).push.apply(_this$selectedObjects, _toConsumableArray(selectedObjects)); } /** * @function ol.supermap.MapboxStyles.prototype.clearSelectedObjects * @version 10.0.0 * @description 清空选中状态。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。 */ }, { key: "removeSelectedObjects", value: function removeSelectedObjects(selectedObjects) { var _this2 = this; if (!Array.isArray(selectedObjects)) { selectedObjects = [selectedObjects]; } selectedObjects.forEach(function (element) { lodash_remove_default()(_this2.selectedObjects, function (obj) { return element.id === obj.id && element.sourceLayer === obj.sourceLayer; }); }); } /** * @function ol.supermap.MapboxStyles.prototype.clearSelectedObjects * @version 10.0.0 * @description 清空选中状态。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。 */ }, { key: "clearSelectedObjects", value: function clearSelectedObjects() { this.selectedObjects = []; } /** * @function ol.supermap.MapboxStyles.prototype.updateStyles * @description 更新图层样式。 * @param {Object} layerStyles - 图层样式或图层样式数组。 */ }, { key: "updateStyles", value: function updateStyles(layerStyles) { if (Object.prototype.toString.call(layerStyles) !== "[object Array]") { layerStyles = [layerStyles]; } var layerObj = {}; layerStyles.forEach(function (layerStyle) { layerObj[layerStyle.id] = layerStyle; }); var count = 0; for (var key in this._mbStyle.layers) { var oldLayerStyle = this._mbStyle.layers[key]; if (count >= layerStyles.length) { break; } if (!layerObj[oldLayerStyle.id]) { continue; } var newLayerStyle = JSON.parse(JSON.stringify(layerObj[oldLayerStyle.id])); if (newLayerStyle.paint) { newLayerStyle.paint = Object.assign({}, oldLayerStyle.paint, newLayerStyle.paint); } if (newLayerStyle.layout) { newLayerStyle.layout = Object.assign({}, oldLayerStyle.layout, newLayerStyle.layout); } Object.assign(oldLayerStyle, newLayerStyle); count++; } this._createStyleFunction(); } /** * @function ol.supermap.MapboxStyles.prototype.setStyle * @version 9.1.1 * @description 设置 Mapbox style 对象。 * @param {Object} style - Mapbox style 对象。 */ }, { key: "setStyle", value: function setStyle(style) { this.layersBySourceLayer = {}; this._loadStyle(style); } }, { key: "_loadStyle", value: function _loadStyle(style) { var _this3 = this; if (Object.prototype.toString.call(style) == "[object Object]") { this._mbStyle = style; this._resolve(); } else { FetchRequest.get(style, null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then(function (mbStyle) { _this3._mbStyle = mbStyle; _this3._resolve(); }); } } }, { key: "_resolve", value: function _resolve() { var _this4 = this; if (!this.source) { this.source = Object.keys(this._mbStyle.sources)[0]; } if (this._mbStyle.sprite) { var spriteScale = window.devicePixelRatio >= 1.5 ? 0.5 : 1; var sizeFactor = spriteScale == 0.5 ? "@2x" : ""; //兼容一下iServer 等iServer修改 this._mbStyle.sprite = this._mbStyle.sprite.replace("@2x", ""); var spriteUrl = this._toSpriteUrl(this._mbStyle.sprite, this.path, sizeFactor + ".json"); FetchRequest.get(spriteUrl, null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then(function (spritesJson) { _this4._spriteData = spritesJson; _this4._spriteImageUrl = _this4._toSpriteUrl(_this4._mbStyle.sprite, _this4.path, sizeFactor + ".png"); _this4._spriteImage = null; var img = new Image(); img.crossOrigin = _this4.withCredentials ? "use-credentials" : "anonymous"; img.onload = function () { _this4._spriteImage = img; _this4._initStyleFunction(); }; img.onerror = function () { _this4._spriteImage = null; _this4._initStyleFunction(); }; img.src = _this4._spriteImageUrl; }); } else { this._initStyleFunction(); } } }, { key: "_initStyleFunction", value: function _initStyleFunction() { if (!this.resolutions && this._mbStyle.metadata && this._mbStyle.metadata.indexbounds) { var indexbounds = this._mbStyle.metadata.indexbounds; var max = Math.max(indexbounds[2] - indexbounds[0], indexbounds[3] - indexbounds[1]); var defaultResolutions = []; for (var index = 0; index < 30; index++) { defaultResolutions.push(max / 512 / Math.pow(2, index)); } this.resolutions = defaultResolutions; } this._createStyleFunction(); /** * @event ol.supermap.MapboxStyles#styleloaded * @description 样式加载成功后触发。 */ this.dispatchEvent("styleloaded"); } }, { key: "_createStyleFunction", value: function _createStyleFunction() { if (this.map) { window.olms.applyBackground(this.map, this._mbStyle); } this.featureStyleFuntion = this._getStyleFunction(); } }, { key: "_getStyleFunction", value: function _getStyleFunction() { var _this5 = this; this.fun = window.olms.stylefunction({ setStyle: function setStyle() {}, set: function set() {}, changed: function changed() {} }, this._mbStyle, this.source, this.resolutions, this._spriteData, "", this._spriteImage); return function (feature, resolution) { var style = _this5.fun(feature, resolution); if (_this5.selectedObjects.length > 0 && _this5.selectedObjects.find(function (element) { return element.id === feature.getId() && element.sourceLayer === feature.get("layer"); })) { var styleIndex = style && style[0] ? style[0].getZIndex() : 99999; var selectStyles = _this5.selectedStyle(feature, resolution); if (!Array.isArray(selectStyles)) { selectStyles = [selectStyles]; } for (var index = 0; index < selectStyles.length; index++) { var selectStyle = selectStyles[index]; if (feature.getGeometry().getType() === "Point" && style[0].getText() && selectStyle.getText()) { selectStyle.setFill(null); selectStyle.setStroke(null); selectStyle.setImage(); selectStyle.getText().setText(style[0].getText().getText()); } selectStyle.setZIndex(styleIndex); } return selectStyles; } return style; }; } }, { key: "_withPath", value: function _withPath(url, path) { if (path && url.indexOf("http") != 0) { url = path + url; } return url; } }, { key: "_toSpriteUrl", value: function _toSpriteUrl(url, path, extension) { url = this._withPath(url, path); var parts = url.match(this.spriteRegEx); return parts ? parts[1] + extension + (parts.length > 2 ? parts[2] : "") : url + extension; } }]); return MapboxStyles; }(external_ol_Observable_default.a); // CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/index.js /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ // CONCATENATED MODULE: ./src/openlayers/overlay/index.js /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ // CONCATENATED MODULE: ./src/openlayers/services/AddressMatchService.js function services_AddressMatchService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { services_AddressMatchService_typeof = function _typeof(obj) { return typeof obj; }; } else { services_AddressMatchService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return services_AddressMatchService_typeof(obj); } function services_AddressMatchService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function services_AddressMatchService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function services_AddressMatchService_createClass(Constructor, protoProps, staticProps) { if (protoProps) services_AddressMatchService_defineProperties(Constructor.prototype, protoProps); if (staticProps) services_AddressMatchService_defineProperties(Constructor, staticProps); return Constructor; } function services_AddressMatchService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) services_AddressMatchService_setPrototypeOf(subClass, superClass); } function services_AddressMatchService_setPrototypeOf(o, p) { services_AddressMatchService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return services_AddressMatchService_setPrototypeOf(o, p); } function services_AddressMatchService_createSuper(Derived) { var hasNativeReflectConstruct = services_AddressMatchService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = services_AddressMatchService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = services_AddressMatchService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return services_AddressMatchService_possibleConstructorReturn(this, result); }; } function services_AddressMatchService_possibleConstructorReturn(self, call) { if (call && (services_AddressMatchService_typeof(call) === "object" || typeof call === "function")) { return call; } return services_AddressMatchService_assertThisInitialized(self); } function services_AddressMatchService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function services_AddressMatchService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function services_AddressMatchService_getPrototypeOf(o) { services_AddressMatchService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return services_AddressMatchService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.AddressMatchService * @category iServer AddressMatch * @classdesc 地址匹配服务。 * @example * new ol.supermap.AddressMatchService(url,options) * .code(function(result){ * //doSomething * }) * @param {string} url - 与客户端交互的服务地址。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 * @extends {ol.supermap.ServiceBase} */ var services_AddressMatchService_AddressMatchService = /*#__PURE__*/function (_ServiceBase) { services_AddressMatchService_inherits(AddressMatchService, _ServiceBase); var _super = services_AddressMatchService_createSuper(AddressMatchService); function AddressMatchService(url, options) { services_AddressMatchService_classCallCheck(this, AddressMatchService); return _super.call(this, url, options); } /** * @function ol.supermap.AddressMatchService.prototype.code * @description 获取正向地址匹配结果。 * @param {SuperMap.GeoCodingParameter} params - 正向匹配参数。 * @param {RequestCallback} callback 请求结果的回调函数。 */ services_AddressMatchService_createClass(AddressMatchService, [{ key: "code", value: function code(params, callback) { var me = this; var addressMatchService = new AddressMatchService_AddressMatchService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); addressMatchService.code(Util_Util.urlPathAppend(me.url, 'geocoding'), params); } /** * @function ol.supermap.AddressMatchService.prototype.decode * @description 获取反向地址匹配结果。 * @param {SuperMap.GeoDecodingParameter} params - 反向匹配参数。 * @param {RequestCallback} callback 请求结果的回调函数。 */ }, { key: "decode", value: function decode(params, callback) { var me = this; var addressMatchService = new AddressMatchService_AddressMatchService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); addressMatchService.decode(Util_Util.urlPathAppend(me.url, 'geodecoding'), params); } }]); return AddressMatchService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/ChartService.js function ChartService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ChartService_typeof = function _typeof(obj) { return typeof obj; }; } else { ChartService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ChartService_typeof(obj); } function ChartService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ChartService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function ChartService_createClass(Constructor, protoProps, staticProps) { if (protoProps) ChartService_defineProperties(Constructor.prototype, protoProps); if (staticProps) ChartService_defineProperties(Constructor, staticProps); return Constructor; } function ChartService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ChartService_setPrototypeOf(subClass, superClass); } function ChartService_setPrototypeOf(o, p) { ChartService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ChartService_setPrototypeOf(o, p); } function ChartService_createSuper(Derived) { var hasNativeReflectConstruct = ChartService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = ChartService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = ChartService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ChartService_possibleConstructorReturn(this, result); }; } function ChartService_possibleConstructorReturn(self, call) { if (call && (ChartService_typeof(call) === "object" || typeof call === "function")) { return call; } return ChartService_assertThisInitialized(self); } function ChartService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function ChartService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function ChartService_getPrototypeOf(o) { ChartService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ChartService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.ChartService * @category iServer Map Chart * @classdesc 海图服务。 * @extends {ol.supermap.ServiceBase} * @example * new ol.supermap.ChartService(url) * .queryChart(param,function(result){ * //doSomething * }) * @param {string} url - 与客户端交互的海图服务地址。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var ChartService_ChartService = /*#__PURE__*/function (_ServiceBase) { ChartService_inherits(ChartService, _ServiceBase); var _super = ChartService_createSuper(ChartService); function ChartService(url, options) { ChartService_classCallCheck(this, ChartService); return _super.call(this, url, options); } /** * @function ol.supermap.ChartService.prototype.queryChart * @description 查询海图服务。 * @param {SuperMap.ChartQueryParameters} params - 海图查询所需参数类。 * @param {RequestCallback} callback - 回调函数。 * @param {SuperMap.DataFormat} resultFormat - 返回的结果格式类型。 */ ChartService_createClass(ChartService, [{ key: "queryChart", value: function queryChart(params, callback, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var chartQueryService = new ChartQueryService_ChartQueryService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); chartQueryService.processAsync(param); } /** * @function ol.supermap.ChartService.prototype.getChartFeatureInfo * @description 获取海图物标信息服务。 * @param {RequestCallback} callback 回调函数。 */ }, { key: "getChartFeatureInfo", value: function getChartFeatureInfo(callback) { var me = this; var url = Util_Util.urlPathAppend(me.url, 'chartFeatureInfoSpecs'); var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService_ChartFeatureInfoSpecsService(url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); chartFeatureInfoSpecsService.processAsync(); } }, { key: "_processParams", value: function _processParams(params) { if (!params) { return {}; } params.returnContent = params.returnContent == null ? true : params.returnContent; if (params.filter) { params.chartQueryFilterParameters = core_Util_Util.isArray(params.filter) ? params.filter : [params.filter]; } if (params.bounds) { params.bounds = new Bounds_Bounds(params.bounds[0], params.bounds[1], params.bounds[2], params.bounds[3]); } } }, { key: "_processFormat", value: function _processFormat(resultFormat) { return resultFormat ? resultFormat : DataFormat.GEOJSON; } }]); return ChartService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/FieldService.js function FieldService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { FieldService_typeof = function _typeof(obj) { return typeof obj; }; } else { FieldService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return FieldService_typeof(obj); } function FieldService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function FieldService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function FieldService_createClass(Constructor, protoProps, staticProps) { if (protoProps) FieldService_defineProperties(Constructor.prototype, protoProps); if (staticProps) FieldService_defineProperties(Constructor, staticProps); return Constructor; } function FieldService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) FieldService_setPrototypeOf(subClass, superClass); } function FieldService_setPrototypeOf(o, p) { FieldService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return FieldService_setPrototypeOf(o, p); } function FieldService_createSuper(Derived) { var hasNativeReflectConstruct = FieldService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = FieldService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = FieldService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return FieldService_possibleConstructorReturn(this, result); }; } function FieldService_possibleConstructorReturn(self, call) { if (call && (FieldService_typeof(call) === "object" || typeof call === "function")) { return call; } return FieldService_assertThisInitialized(self); } function FieldService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function FieldService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function FieldService_getPrototypeOf(o) { FieldService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return FieldService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.FieldService * @category iServer Data Field * @classdesc 字段服务类。 * @example * new ol.supermap.FieldService(url).getFields(function(result){ * //doSomething * }); * @param {string} url - 与客户端交互的服务地址。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 * @extends {ol.supermap.ServiceBase} */ var FieldService_FieldService = /*#__PURE__*/function (_ServiceBase) { FieldService_inherits(FieldService, _ServiceBase); var _super = FieldService_createSuper(FieldService); function FieldService(url, options) { FieldService_classCallCheck(this, FieldService); return _super.call(this, url, options); } /** * @function ol.supermap.FieldService.prototype.getFields * @description 字段查询服务。 * @param {SuperMap.FieldParameters} params - 字段信息查询参数类。 * @param {RequestCallback} callback - 回调函数。 */ FieldService_createClass(FieldService, [{ key: "getFields", value: function getFields(params, callback) { var me = this; var getFieldsService = new GetFieldsService_GetFieldsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, datasource: params.datasource, dataset: params.dataset }); getFieldsService.processAsync(); } /** * @function ol.supermap.FieldService.prototype.getFieldStatisticsInfo * @description 字段统计服务。 * @param {SuperMap.FieldStatisticsParameters} params - 查询所需参数类。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "getFieldStatisticsInfo", value: function getFieldStatisticsInfo(params, callback) { var me = this, fieldName = params.fieldName, modes = params.statisticMode; if (modes && !core_Util_Util.isArray(modes)) { modes = [modes]; } me.currentStatisticResult = { fieldName: fieldName }; me._statisticsCallback = callback; //针对每种统计方式分别进行请求 modes.forEach(function (mode) { me.currentStatisticResult[mode] = null; me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode); }); } }, { key: "_fieldStatisticRequest", value: function _fieldStatisticRequest(datasource, dataset, fieldName, statisticMode) { var me = this; var statisticService = new FieldStatisticService_FieldStatisticService(me.url, { eventListeners: { scope: me, processCompleted: me._processCompleted, processFailed: me._statisticsCallback }, crossOrigin: me.options.crossOrigin, headers: me.options.headers, datasource: datasource, dataset: dataset, field: fieldName, statisticMode: statisticMode }); statisticService.processAsync(); } }, { key: "_processCompleted", value: function _processCompleted(fieldStatisticResult) { var me = this; var getAll = true, result = fieldStatisticResult.result; if (this.currentStatisticResult) { if (null == me.currentStatisticResult[result.mode]) { this.currentStatisticResult[result.mode] = result.result; } } for (var mode in me.currentStatisticResult) { if (null == me.currentStatisticResult[mode]) { getAll = false; break; } } if (getAll) { me._statisticsCallback({ result: me.currentStatisticResult }); } } }]); return FieldService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/GridCellInfosService.js function GridCellInfosService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { GridCellInfosService_typeof = function _typeof(obj) { return typeof obj; }; } else { GridCellInfosService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return GridCellInfosService_typeof(obj); } function GridCellInfosService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function GridCellInfosService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function GridCellInfosService_createClass(Constructor, protoProps, staticProps) { if (protoProps) GridCellInfosService_defineProperties(Constructor.prototype, protoProps); if (staticProps) GridCellInfosService_defineProperties(Constructor, staticProps); return Constructor; } function GridCellInfosService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) GridCellInfosService_setPrototypeOf(subClass, superClass); } function GridCellInfosService_setPrototypeOf(o, p) { GridCellInfosService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return GridCellInfosService_setPrototypeOf(o, p); } function GridCellInfosService_createSuper(Derived) { var hasNativeReflectConstruct = GridCellInfosService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = GridCellInfosService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = GridCellInfosService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return GridCellInfosService_possibleConstructorReturn(this, result); }; } function GridCellInfosService_possibleConstructorReturn(self, call) { if (call && (GridCellInfosService_typeof(call) === "object" || typeof call === "function")) { return call; } return GridCellInfosService_assertThisInitialized(self); } function GridCellInfosService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function GridCellInfosService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function GridCellInfosService_getPrototypeOf(o) { GridCellInfosService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return GridCellInfosService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** /** * @class ol.supermap.GridCellInfosService * @category iServer Data Grid * @classdesc 数据栅格查询服务。 * @extends {ol.supermap.ServiceBase} * @example * new ol.supermap.GridCellInfosService(url) * .getGridCellInfos(param,function(result){ * //doSomething * }) * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为: * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var GridCellInfosService_GridCellInfosService = /*#__PURE__*/function (_ServiceBase) { GridCellInfosService_inherits(GridCellInfosService, _ServiceBase); var _super = GridCellInfosService_createSuper(GridCellInfosService); function GridCellInfosService(url, options) { GridCellInfosService_classCallCheck(this, GridCellInfosService); return _super.call(this, url, options); } /** * @function ol.supermap.GridCellInfosService.prototype.getGridCellInfos * @param {SuperMap.GetGridCellInfosParameters} params - 查询所需参数类。 * @param {RequestCallback} callback - 回调函数。 */ GridCellInfosService_createClass(GridCellInfosService, [{ key: "getGridCellInfos", value: function getGridCellInfos(params, callback) { if (!params) { return null; } var me = this; var gridCellQueryService = new GetGridCellInfosService_GetGridCellInfosService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); gridCellQueryService.processAsync(params); } }]); return GridCellInfosService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/GeoprocessingService.js function services_GeoprocessingService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { services_GeoprocessingService_typeof = function _typeof(obj) { return typeof obj; }; } else { services_GeoprocessingService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return services_GeoprocessingService_typeof(obj); } function services_GeoprocessingService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function services_GeoprocessingService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function services_GeoprocessingService_createClass(Constructor, protoProps, staticProps) { if (protoProps) services_GeoprocessingService_defineProperties(Constructor.prototype, protoProps); if (staticProps) services_GeoprocessingService_defineProperties(Constructor, staticProps); return Constructor; } function services_GeoprocessingService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) services_GeoprocessingService_setPrototypeOf(subClass, superClass); } function services_GeoprocessingService_setPrototypeOf(o, p) { services_GeoprocessingService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return services_GeoprocessingService_setPrototypeOf(o, p); } function services_GeoprocessingService_createSuper(Derived) { var hasNativeReflectConstruct = services_GeoprocessingService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = services_GeoprocessingService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = services_GeoprocessingService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return services_GeoprocessingService_possibleConstructorReturn(this, result); }; } function services_GeoprocessingService_possibleConstructorReturn(self, call) { if (call && (services_GeoprocessingService_typeof(call) === "object" || typeof call === "function")) { return call; } return services_GeoprocessingService_assertThisInitialized(self); } function services_GeoprocessingService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function services_GeoprocessingService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function services_GeoprocessingService_getPrototypeOf(o) { services_GeoprocessingService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return services_GeoprocessingService_getPrototypeOf(o); } /** * @class ol.supermap.GeoprocessingService * @classdesc 地理处理服务接口类。 * @version 10.1.0 * @category iServer GeoprocessingService * @extends {ol.supermap.ServiceBase} * @example * //为了安全访问受保护的地理处理服务,必须通过传递iserver令牌(token),才能正确访问相关资源。 * SuperMap.SecurityManager.registerToken(serviceUrl, token); * var geoprocessingService = new L.supermap.geoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2") geoprocessingService.submitJob(identifier,params, environments, function(serverResult) { console.log(serverResult.result); var jobID = serverResult.result.jobID; var options = { interval: 5000, statusCallback: function(state) { console.log("Job Status: ", state); } }; geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) { console.log(serverResult); }) }) * @param {string} url - 服务地址。 * @param {Object} options - 参数。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 iServer|iPortal|online。 */ var services_GeoprocessingService_GeoprocessingService = /*#__PURE__*/function (_ServiceBase) { services_GeoprocessingService_inherits(GeoprocessingService, _ServiceBase); var _super = services_GeoprocessingService_createSuper(GeoprocessingService); function GeoprocessingService(url, options) { var _this; services_GeoprocessingService_classCallCheck(this, GeoprocessingService); _this = _super.call(this, url, options); _this.headers = true; _this.crossOrigin = true; _this.withCredentials = true; _this.proxy = true; return _this; } /** * @function ol.supermap.GeoprocessingService.prototype.getTools * @description 获取地理处理工具列表。 * @param {RequestCallback} callback 请求结果的回调函数。 */ services_GeoprocessingService_createClass(GeoprocessingService, [{ key: "getTools", value: function getTools(callback) { var geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, { proxy: this.options.proxy, withCredentials: this.options.withCredentials, crossOrigin: this.options.crossOrigin, headers: this.options.headers, serverType: this.options.serverType, eventListeners: { scope: this, processCompleted: callback, processFailed: callback } }); geoprocessingJobsService.getTools(); } /** * @function ol.supermap.GeoprocessingService.prototype.getTool * @description 获取地理处理工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。 * @param {string} identifier - 地理处理工具ID。 * @param {RequestCallback} callback 请求结果的回调函数。 */ }, { key: "getTool", value: function getTool(identifier, callback) { var geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, { proxy: this.options.proxy, withCredentials: this.options.withCredentials, crossOrigin: this.options.crossOrigin, headers: this.options.headers, serverType: this.options.serverType, eventListeners: { scope: this, processCompleted: callback, processFailed: callback } }); geoprocessingJobsService.getTool(identifier); } /** * @function ol.supermap.GeoprocessingService.prototype.execute * @description 同步执行地理处理工具。 * @param {string} identifier - 地理处理工具ID。 * @param {Object} parameter - 地理处理工具的输入参数。 * @param {Object} environment - 地理处理工具的环境参数。 * @param {RequestCallback} callback 回调函数。 */ }, { key: "execute", value: function execute(identifier, parameter, environment, callback) { var geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, { proxy: this.options.proxy, withCredentials: this.options.withCredentials, crossOrigin: this.options.crossOrigin, headers: this.options.headers, serverType: this.options.serverType, eventListeners: { scope: this, processCompleted: callback, processFailed: callback } }); geoprocessingJobsService.execute(identifier, parameter, environment); } /** * @function ol.supermap.GeoprocessingService.prototype.submitJob * @description 异步执行地理处理工具。 * @param {string} identifier - 地理处理工具ID。 * @param {Object} parameter - 地理处理工具的输入参数。 * @param {Object} environment - 地理处理工具的环境参数。 * @param {RequestCallback} callback 回调函数。 */ }, { key: "submitJob", value: function submitJob(identifier, parameter, environment, callback) { var geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, { proxy: this.options.proxy, withCredentials: this.options.withCredentials, crossOrigin: this.options.crossOrigin, headers: this.options.headers, serverType: this.options.serverType, eventListeners: { scope: this, processCompleted: callback, processFailed: callback } }); geoprocessingJobsService.submitJob(identifier, parameter, environment); } /** * @function ol.supermap.GeoprocessingService.prototype.waitForJobCompletion * @description 获取地理处理异步执行状态信息。 * @param {string} jobId - 地理处理任务ID。 * @param {string} identifier - 地理处理工具ID。 * @param {Object} options - 状态信息参数。 * @param {number} options.interval - 定时器时间间隔。 * @param {Callback} options.statusCallback - 任务状态的回调函数。 * @param {RequestCallback} callback 回调函数。 */ }, { key: "waitForJobCompletion", value: function waitForJobCompletion(jobId, identifier, options, callback) { var geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, { proxy: this.options.proxy, withCredentials: this.options.withCredentials, crossOrigin: this.options.crossOrigin, headers: this.options.headers, serverType: this.options.serverType, eventListeners: { scope: this, processCompleted: callback, processFailed: callback } }); geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options); } /** * @function ol.supermap.GeoprocessingService.prototype.getJobInfo * @description 获取地理处理任务的执行信息。 * @param {string} identifier - 地理处理工具ID。 * @param {string} jobId - 地理处理任务ID。 * @param {RequestCallback} callback 回调函数。 */ }, { key: "getJobInfo", value: function getJobInfo(identifier, jobId, callback) { var geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, { proxy: this.options.proxy, withCredentials: this.options.withCredentials, crossOrigin: this.options.crossOrigin, headers: this.options.headers, serverType: this.options.serverType, eventListeners: { scope: this, processCompleted: callback, processFailed: callback } }); geoprocessingJobsService.getJobInfo(identifier, jobId); } /** * @function ol.supermap.GeoprocessingService.prototype.cancelJob * @description 取消地理处理任务的异步执行。 * @param {string} identifier - 地理处理工具ID。 * @param {string} jobId - 地理处理任务ID。 * @param {RequestCallback} callback 回调函数。 */ }, { key: "cancelJob", value: function cancelJob(identifier, jobId, callback) { var geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, { proxy: this.options.proxy, withCredentials: this.options.withCredentials, crossOrigin: this.options.crossOrigin, headers: this.options.headers, serverType: this.options.serverType, eventListeners: { scope: this, processCompleted: callback, processFailed: callback } }); geoprocessingJobsService.cancelJob(identifier, jobId); } /** * @function ol.supermap.GeoprocessingService.prototype.getJobs * @description 获取地理处理服务任务列表。 * @param {string} identifier - 地理处理工具ID。(可选,传参代表identifier算子的任务列表,不传参代表所有任务的列表) * @param {RequestCallback} callback 回调函数。 */ }, { key: "getJobs", value: function getJobs(identifier, callback) { var geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, { proxy: this.options.proxy, withCredentials: this.options.withCredentials, crossOrigin: this.options.crossOrigin, headers: this.options.headers, serverType: this.options.serverType, eventListeners: { scope: this, processCompleted: callback, processFailed: callback } }); geoprocessingJobsService.getJobs(identifier); } /** * @function ol.supermap.GeoprocessingService.prototype.getResults * @description 地理处理工具异步执行的结果,支持结果过滤。 * @param {string} identifier - 地理处理工具ID。 * @param {string} jobId - 地理处理任务ID。 * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该地理处理工具执行的结果进行过滤获取,不填参时显示所有的执行结果) * @param {RequestCallback} callback 请求结果的回调函数。 */ }, { key: "getResults", value: function getResults(identifier, jobId, filter, callback) { var geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, { proxy: this.options.proxy, withCredentials: this.options.withCredentials, crossOrigin: this.options.crossOrigin, headers: this.options.headers, serverType: this.options.serverType, eventListeners: { scope: this, processCompleted: callback, processFailed: callback } }); geoprocessingJobsService.getResults(identifier, jobId, filter); } }]); return GeoprocessingService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/LayerInfoService.js function LayerInfoService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { LayerInfoService_typeof = function _typeof(obj) { return typeof obj; }; } else { LayerInfoService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return LayerInfoService_typeof(obj); } function LayerInfoService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function LayerInfoService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function LayerInfoService_createClass(Constructor, protoProps, staticProps) { if (protoProps) LayerInfoService_defineProperties(Constructor.prototype, protoProps); if (staticProps) LayerInfoService_defineProperties(Constructor, staticProps); return Constructor; } function LayerInfoService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) LayerInfoService_setPrototypeOf(subClass, superClass); } function LayerInfoService_setPrototypeOf(o, p) { LayerInfoService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return LayerInfoService_setPrototypeOf(o, p); } function LayerInfoService_createSuper(Derived) { var hasNativeReflectConstruct = LayerInfoService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = LayerInfoService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = LayerInfoService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return LayerInfoService_possibleConstructorReturn(this, result); }; } function LayerInfoService_possibleConstructorReturn(self, call) { if (call && (LayerInfoService_typeof(call) === "object" || typeof call === "function")) { return call; } return LayerInfoService_assertThisInitialized(self); } function LayerInfoService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function LayerInfoService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function LayerInfoService_getPrototypeOf(o) { LayerInfoService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return LayerInfoService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.LayerInfoService * @category iServer Map Layer * @classdesc 图层信息服务类。 * @extends {ol.supermap.ServiceBase} * @example * new ol.supermap.LayerInfoService(url).getLayersInfo(function(result){ * //doSomething * }) * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为: * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var LayerInfoService_LayerInfoService = /*#__PURE__*/function (_ServiceBase) { LayerInfoService_inherits(LayerInfoService, _ServiceBase); var _super = LayerInfoService_createSuper(LayerInfoService); function LayerInfoService(url, options) { LayerInfoService_classCallCheck(this, LayerInfoService); return _super.call(this, url, options); } /** * @function ol.supermap.LayerInfoService.prototype.getLayersInfo * @description 获取图层信息服务。 * @param {RequestCallback} callback - 回调函数。 */ LayerInfoService_createClass(LayerInfoService, [{ key: "getLayersInfo", value: function getLayersInfo(callback) { var me = this; var getLayersInfoService = new GetLayersInfoService_GetLayersInfoService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { processCompleted: callback, processFailed: callback } }); getLayersInfoService.processAsync(); } /** * @function ol.supermap.LayerInfoService.prototype.setLayerInfo * @description 设置图层信息服务。可以实现临时图层中子图层的修改。 * @param {SuperMap.SetLayerInfoParameters} params - 设置图层信息参数类。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "setLayerInfo", value: function setLayerInfo(params, callback) { if (!params) { return; } var me = this, resourceID = params.resourceID, tempLayerName = params.tempLayerName, layerInfoParams = params.layerInfo; if (!resourceID || !tempLayerName) { return; } var url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + resourceID + "/" + tempLayerName); var setLayerInfoService = new SetLayerInfoService_SetLayerInfoService(url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { processCompleted: callback, processFailed: callback } }); setLayerInfoService.processAsync(layerInfoParams); } /** * @function ol.supermap.LayerInfoService.prototype.setLayersInfo * @description 设置图层信息服务。可以实现创建新的临时图层和对现有临时图层的修改。 * @param {SuperMap.SetLayersInfoParameters} params - 设置图层信息参数类,包括临时图层。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "setLayersInfo", value: function setLayersInfo(params, callback) { if (!params) { return; } var me = this, resourceID = params.resourceID, isTempLayers = params.isTempLayers ? params.isTempLayers : false, layersInfo = params.layersInfo; if (isTempLayers && !resourceID || !layersInfo) { return; } var setLayersInfoService = new SetLayersInfoService_SetLayersInfoService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { processCompleted: callback, processFailed: callback }, resourceID: resourceID, isTempLayers: isTempLayers }); setLayersInfoService.processAsync(layersInfo); } /** * @function ol.supermap.LayerInfoService.prototype.setLayerStatus * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。 * @param {SuperMap.SetLayerStatusParameters} params - 子图层显示控制参数类。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "setLayerStatus", value: function setLayerStatus(params, callback) { if (!params) { return; } var me = this; var setLayerStatusService = new SetLayerStatusService_SetLayerStatusService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { processCompleted: callback, processFailed: callback } }); setLayerStatusService.processAsync(params); } }]); return LayerInfoService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/MeasureService.js function services_MeasureService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { services_MeasureService_typeof = function _typeof(obj) { return typeof obj; }; } else { services_MeasureService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return services_MeasureService_typeof(obj); } function services_MeasureService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function services_MeasureService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function services_MeasureService_createClass(Constructor, protoProps, staticProps) { if (protoProps) services_MeasureService_defineProperties(Constructor.prototype, protoProps); if (staticProps) services_MeasureService_defineProperties(Constructor, staticProps); return Constructor; } function services_MeasureService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) services_MeasureService_setPrototypeOf(subClass, superClass); } function services_MeasureService_setPrototypeOf(o, p) { services_MeasureService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return services_MeasureService_setPrototypeOf(o, p); } function services_MeasureService_createSuper(Derived) { var hasNativeReflectConstruct = services_MeasureService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = services_MeasureService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = services_MeasureService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return services_MeasureService_possibleConstructorReturn(this, result); }; } function services_MeasureService_possibleConstructorReturn(self, call) { if (call && (services_MeasureService_typeof(call) === "object" || typeof call === "function")) { return call; } return services_MeasureService_assertThisInitialized(self); } function services_MeasureService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function services_MeasureService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function services_MeasureService_getPrototypeOf(o) { services_MeasureService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return services_MeasureService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.MeasureService * @category iServer Map Measure * @classdesc 测量服务。 * @extends ol.supermap.ServiceBase * @param {string} url - 服务访问的地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。 * @param {Object} options - 交互服务时所需可选参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var services_MeasureService_MeasureService = /*#__PURE__*/function (_ServiceBase) { services_MeasureService_inherits(MeasureService, _ServiceBase); var _super = services_MeasureService_createSuper(MeasureService); function MeasureService(url, options) { services_MeasureService_classCallCheck(this, MeasureService); return _super.call(this, url, options); } /** * @function ol.supermap.MeasureService.prototype.measureDistance * @description 测距。 * @param {SuperMap.MeasureParameters} params - 测量相关参数类。 * @param {RequestCallback} callback - 回调函数。 */ services_MeasureService_createClass(MeasureService, [{ key: "measureDistance", value: function measureDistance(params, callback) { this.measure(params, 'DISTANCE', callback); } /** * @function ol.supermap.MeasureService.prototype.measureArea * @description 测面积。 * @param {SuperMap.MeasureParameters} params - 测量相关参数类。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "measureArea", value: function measureArea(params, callback) { this.measure(params, 'AREA', callback); } /** * @function ol.supermap.MeasureService.prototype.measure * @description 测量。 * @param {SuperMap.MeasureParameters} params - 测量相关参数类。 * @param {string} type - 类型。 * @param {RequestCallback} callback - 回调函数。 * @returns {ol.supermap.MeasureService} 测量服务。 */ }, { key: "measure", value: function measure(params, type, callback) { var me = this; var measureService = new MeasureService_MeasureService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, measureMode: type, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); measureService.processAsync(me._processParam(params)); } }, { key: "_processParam", value: function _processParam(params) { if (params && params.geometry) { params.geometry = core_Util_Util.toSuperMapGeometry(JSON.parse(new external_ol_format_GeoJSON_default.a().writeGeometry(params.geometry))); } return params; } }]); return MeasureService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/NetworkAnalyst3DService.js function NetworkAnalyst3DService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { NetworkAnalyst3DService_typeof = function _typeof(obj) { return typeof obj; }; } else { NetworkAnalyst3DService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return NetworkAnalyst3DService_typeof(obj); } function NetworkAnalyst3DService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function NetworkAnalyst3DService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function NetworkAnalyst3DService_createClass(Constructor, protoProps, staticProps) { if (protoProps) NetworkAnalyst3DService_defineProperties(Constructor.prototype, protoProps); if (staticProps) NetworkAnalyst3DService_defineProperties(Constructor, staticProps); return Constructor; } function NetworkAnalyst3DService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) NetworkAnalyst3DService_setPrototypeOf(subClass, superClass); } function NetworkAnalyst3DService_setPrototypeOf(o, p) { NetworkAnalyst3DService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return NetworkAnalyst3DService_setPrototypeOf(o, p); } function NetworkAnalyst3DService_createSuper(Derived) { var hasNativeReflectConstruct = NetworkAnalyst3DService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = NetworkAnalyst3DService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = NetworkAnalyst3DService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return NetworkAnalyst3DService_possibleConstructorReturn(this, result); }; } function NetworkAnalyst3DService_possibleConstructorReturn(self, call) { if (call && (NetworkAnalyst3DService_typeof(call) === "object" || typeof call === "function")) { return call; } return NetworkAnalyst3DService_assertThisInitialized(self); } function NetworkAnalyst3DService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function NetworkAnalyst3DService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function NetworkAnalyst3DService_getPrototypeOf(o) { NetworkAnalyst3DService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return NetworkAnalyst3DService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.NetworkAnalyst3DService * @category iServer FacilityAnalyst3D * @classdesc 3D 网络分析服务类。 * @extends {ol.supermap.ServiceBase} * @example * new ol.supermap.NetworkAnalyst3DService(url) * .sinksFacilityAnalyst(params,function(result){ * //doSomething * }) * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为: * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}; * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var NetworkAnalyst3DService_NetworkAnalyst3DService = /*#__PURE__*/function (_ServiceBase) { NetworkAnalyst3DService_inherits(NetworkAnalyst3DService, _ServiceBase); var _super = NetworkAnalyst3DService_createSuper(NetworkAnalyst3DService); function NetworkAnalyst3DService(url, options) { NetworkAnalyst3DService_classCallCheck(this, NetworkAnalyst3DService); return _super.call(this, url, options); } /** * @function ol.supermap.NetworkAnalyst3DService.prototype.sinksFacilityAnalyst * @description 汇查找服务 * @param {SuperMap.FacilityAnalystSinks3DParameters} params- 最近设施分析参数类(汇查找资源)。 * @param {RequestCallback} callback - 回调函数。 * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。 */ NetworkAnalyst3DService_createClass(NetworkAnalyst3DService, [{ key: "sinksFacilityAnalyst", value: function sinksFacilityAnalyst(params, callback) { var me = this; var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService_FacilityAnalystSinks3DService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); facilityAnalystSinks3DService.processAsync(params); } /** * @function ol.supermap.NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst * @description 源查找服务。 * @param {SuperMap.FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。 * @param {RequestCallback} callback - 回调函数。 * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。 */ }, { key: "sourcesFacilityAnalyst", value: function sourcesFacilityAnalyst(params, callback) { var me = this; var facilityAnalystSources3DService = new FacilityAnalystSources3DService_FacilityAnalystSources3DService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); facilityAnalystSources3DService.processAsync(params); } /** * @function ol.supermap.NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst * @description 上游追踪资源服务。 * @param {SuperMap.FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。 * @param {RequestCallback} callback - 回调函数。 * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。 */ }, { key: "traceUpFacilityAnalyst", value: function traceUpFacilityAnalyst(params, callback) { var me = this; var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService_FacilityAnalystTraceup3DService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); facilityAnalystTraceup3DService.processAsync(params); } /** * @function ol.supermap.NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst * @description 下游追踪资源服务。 * @param {SuperMap.FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。 * @param {RequestCallback} callback - 回调函数。 * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。 */ }, { key: "traceDownFacilityAnalyst", value: function traceDownFacilityAnalyst(params, callback) { var me = this; var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService_FacilityAnalystTracedown3DService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); facilityAnalystTracedown3DService.processAsync(params); } /** * @function ol.supermap.NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst * @description 上游关键设施查找服务。 * @param {SuperMap.FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。 * @param {RequestCallback} callback - 回调函数。 * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。 */ }, { key: "upstreamFacilityAnalyst", value: function upstreamFacilityAnalyst(params, callback) { var me = this; var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService_FacilityAnalystUpstream3DService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); facilityAnalystUpstream3DService.processAsync(params); } }]); return NetworkAnalyst3DService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/NetworkAnalystService.js function NetworkAnalystService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { NetworkAnalystService_typeof = function _typeof(obj) { return typeof obj; }; } else { NetworkAnalystService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return NetworkAnalystService_typeof(obj); } function NetworkAnalystService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function NetworkAnalystService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function NetworkAnalystService_createClass(Constructor, protoProps, staticProps) { if (protoProps) NetworkAnalystService_defineProperties(Constructor.prototype, protoProps); if (staticProps) NetworkAnalystService_defineProperties(Constructor, staticProps); return Constructor; } function NetworkAnalystService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) NetworkAnalystService_setPrototypeOf(subClass, superClass); } function NetworkAnalystService_setPrototypeOf(o, p) { NetworkAnalystService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return NetworkAnalystService_setPrototypeOf(o, p); } function NetworkAnalystService_createSuper(Derived) { var hasNativeReflectConstruct = NetworkAnalystService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = NetworkAnalystService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = NetworkAnalystService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return NetworkAnalystService_possibleConstructorReturn(this, result); }; } function NetworkAnalystService_possibleConstructorReturn(self, call) { if (call && (NetworkAnalystService_typeof(call) === "object" || typeof call === "function")) { return call; } return NetworkAnalystService_assertThisInitialized(self); } function NetworkAnalystService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function NetworkAnalystService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function NetworkAnalystService_getPrototypeOf(o) { NetworkAnalystService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return NetworkAnalystService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.NetworkAnalystService * @category iServer NetworkAnalyst * @classdesc 网络分析服务类。 * @extends {ol.supermap.ServiceBase} * @example * new ol.supermap.NetworkAnalystService(url) * .findPath(params,function(result){ * //doSomething * }) * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为: * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
* 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var NetworkAnalystService_NetworkAnalystService = /*#__PURE__*/function (_ServiceBase) { NetworkAnalystService_inherits(NetworkAnalystService, _ServiceBase); var _super = NetworkAnalystService_createSuper(NetworkAnalystService); function NetworkAnalystService(url, options) { NetworkAnalystService_classCallCheck(this, NetworkAnalystService); return _super.call(this, url, options); } /** * @function ol.supermap.NetworkAnalystService.prototype.burstPipelineAnalyst * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。 * @param {SuperMap.BurstPipelineAnalystParameters} params - 爆管分析服务参数类。 * @param {RequestCallback} callback 回调函数。 */ NetworkAnalystService_createClass(NetworkAnalystService, [{ key: "burstPipelineAnalyst", value: function burstPipelineAnalyst(params, callback) { var me = this; var burstPipelineAnalystService = new BurstPipelineAnalystService_BurstPipelineAnalystService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); burstPipelineAnalystService.processAsync(me._processParams(params)); } /** * @function ol.supermap.NetworkAnalystService.prototype.computeWeightMatrix * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。 * @param {SuperMap.ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "computeWeightMatrix", value: function computeWeightMatrix(params, callback) { var me = this; var computeWeightMatrixService = new ComputeWeightMatrixService_ComputeWeightMatrixService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); computeWeightMatrixService.processAsync(me._processParams(params)); } /** * @function ol.supermap.NetworkAnalystService.prototype.findClosestFacilities * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。 * @param {SuperMap.FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。 * @param {RequestCallback} callback - 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "findClosestFacilities", value: function findClosestFacilities(params, callback, resultFormat) { var me = this; var findClosestFacilitiesService = new FindClosestFacilitiesService_FindClosestFacilitiesService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); findClosestFacilitiesService.processAsync(me._processParams(params)); } /** * @function ol.supermap.NetworkAnalystService.prototype.streamFacilityAnalyst * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。 * @param {SuperMap.FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。 * @param {RequestCallback} callback - 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "streamFacilityAnalyst", value: function streamFacilityAnalyst(params, callback, resultFormat) { var me = this; var facilityAnalystStreamService = new FacilityAnalystStreamService_FacilityAnalystStreamService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); facilityAnalystStreamService.processAsync(me._processParams(params)); } /** * @function ol.supermap.NetworkAnalystService.prototype.findLocation * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。 * @param {SuperMap.FindLocationParameters} params - 选址分区分析服务参数类。 * @param {RequestCallback} callback - 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "findLocation", value: function findLocation(params, callback, resultFormat) { var me = this; var findLocationService = new FindLocationService_FindLocationService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); findLocationService.processAsync(me._processParams(params)); } /** * @function ol.supermap.NetworkAnalystService.prototype.findPath * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。 * @param {SuperMap.FindPathParameters} params - 最佳路径分析服务参数类。 * @param {RequestCallback} callback - 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "findPath", value: function findPath(params, callback, resultFormat) { var me = this; var findPathService = new FindPathService_FindPathService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); findPathService.processAsync(me._processParams(params)); } /** * @function ol.supermap.NetworkAnalystService.prototype.findTSPPaths * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。 * @param {SuperMap.SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。 * @param {RequestCallback} callback - 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "findTSPPaths", value: function findTSPPaths(params, callback, resultFormat) { var me = this; var findTSPPathsService = new FindTSPPathsService_FindTSPPathsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); findTSPPathsService.processAsync(me._processParams(params)); } /** * @function ol.supermap.NetworkAnalystService.prototype.findMTSPPaths * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。 * @param {SuperMap.FindMTSPPathsParameters} params - 多旅行商分析服务参数类。 * @param {RequestCallback} callback - 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "findMTSPPaths", value: function findMTSPPaths(params, callback, resultFormat) { var me = this; var findMTSPPathsService = new FindMTSPPathsService_FindMTSPPathsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); findMTSPPathsService.processAsync(me._processParams(params)); } /** * @function ol.supermap.NetworkAnalystService.prototype.findServiceAreas * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。 * @param {SuperMap.FindServiceAreasParameters} params - 服务区分析服务参数类。 * @param {RequestCallback} callback - 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "findServiceAreas", value: function findServiceAreas(params, callback, resultFormat) { var me = this; var findServiceAreasService = new FindServiceAreasService_FindServiceAreasService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); findServiceAreasService.processAsync(me._processParams(params)); } /** * @function ol.supermap.NetworkAnalystService.prototype.updateEdgeWeight * @description 更新边的耗费权重服务。 * @param {SuperMap.UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。 * @param {RequestCallback} callback 回调函数。 */ }, { key: "updateEdgeWeight", value: function updateEdgeWeight(params, callback) { var me = this; var updateEdgeWeightService = new UpdateEdgeWeightService_UpdateEdgeWeightService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); updateEdgeWeightService.processAsync(params); } /** * @function ol.supermap.NetworkAnalystService.prototype.updateTurnNodeWeight * @description 转向耗费权重更新服务。 * @param {SuperMap.UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "updateTurnNodeWeight", value: function updateTurnNodeWeight(params, callback) { var me = this; var updateTurnNodeWeightService = new UpdateTurnNodeWeightService_UpdateTurnNodeWeightService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); updateTurnNodeWeightService.processAsync(params); } }, { key: "_processParams", value: function _processParams(params) { if (!params) { return {}; } if (params.centers && core_Util_Util.isArray(params.centers)) { params.centers.map(function (point, key) { params.centers[key] = point instanceof external_ol_geom_Point_default.a ? { x: point.getCoordinates()[0], y: point.getCoordinates()[1] } : point; return params.centers[key]; }); } if (params.nodes && core_Util_Util.isArray(params.nodes)) { params.nodes.map(function (point, key) { params.nodes[key] = point instanceof external_ol_geom_Point_default.a ? { x: point.getCoordinates()[0], y: point.getCoordinates()[1] } : point; return params.nodes[key]; }); } if (params.event && params.event instanceof external_ol_geom_Point_default.a) { params.event = { x: params.event.getCoordinates()[0], y: params.event.getCoordinates()[1] }; } if (params.facilities && core_Util_Util.isArray(params.facilities)) { params.facilities.map(function (point, key) { params.facilities[key] = point instanceof external_ol_geom_Point_default.a ? { x: point.getCoordinates()[0], y: point.getCoordinates()[1] } : point; return params.facilities[key]; }); } if (params.parameter && params.parameter.barrierPoints) { var barrierPoints = params.parameter.barrierPoints; if (core_Util_Util.isArray(barrierPoints)) { barrierPoints.map(function (point, key) { params.parameter.barrierPoints[key] = point instanceof external_ol_geom_Point_default.a ? { x: point.getCoordinates()[0], y: point.getCoordinates()[1] } : point; return params.parameter.barrierPoints[key]; }); } else { params.parameter.barrierPoints = [barrierPoints instanceof external_ol_geom_Point_default.a ? { x: barrierPoints.getCoordinates()[0], y: barrierPoints.getCoordinates()[1] } : barrierPoints]; } } return params; } }, { key: "_processFormat", value: function _processFormat(resultFormat) { return resultFormat ? resultFormat : DataFormat.GEOJSON; } }]); return NetworkAnalystService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/ProcessingService.js function ProcessingService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ProcessingService_typeof = function _typeof(obj) { return typeof obj; }; } else { ProcessingService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ProcessingService_typeof(obj); } function ProcessingService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ProcessingService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function ProcessingService_createClass(Constructor, protoProps, staticProps) { if (protoProps) ProcessingService_defineProperties(Constructor.prototype, protoProps); if (staticProps) ProcessingService_defineProperties(Constructor, staticProps); return Constructor; } function ProcessingService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ProcessingService_setPrototypeOf(subClass, superClass); } function ProcessingService_setPrototypeOf(o, p) { ProcessingService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ProcessingService_setPrototypeOf(o, p); } function ProcessingService_createSuper(Derived) { var hasNativeReflectConstruct = ProcessingService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = ProcessingService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = ProcessingService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ProcessingService_possibleConstructorReturn(this, result); }; } function ProcessingService_possibleConstructorReturn(self, call) { if (call && (ProcessingService_typeof(call) === "object" || typeof call === "function")) { return call; } return ProcessingService_assertThisInitialized(self); } function ProcessingService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function ProcessingService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function ProcessingService_getPrototypeOf(o) { ProcessingService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ProcessingService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.ProcessingService * @category iServer ProcessingService * @classdesc 分布式分析相关服务类。 * @extends {ol.supermap.ServiceBase} * @example * new ol.supermap.ProcessingService(url,options) * .getKernelDensityJobs(function(result){ * //doSomething * }) * @param {string} url - 分布式分析服务地址。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var ProcessingService_ProcessingService = /*#__PURE__*/function (_ServiceBase) { ProcessingService_inherits(ProcessingService, _ServiceBase); var _super = ProcessingService_createSuper(ProcessingService); function ProcessingService(url, options) { var _this; ProcessingService_classCallCheck(this, ProcessingService); _this = _super.call(this, url, options); _this.kernelDensityJobs = {}; _this.summaryMeshJobs = {}; _this.queryJobs = {}; _this.summaryRegionJobs = {}; _this.vectorClipJobs = {}; _this.overlayGeoJobs = {}; _this.buffersJobs = {}; _this.topologyValidatorJobs = {}; _this.summaryAttributesJobs = {}; return _this; } /** * @function ol.supermap.ProcessingService.prototype.getKernelDensityJobs * @description 获取密度分析的列表。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ ProcessingService_createClass(ProcessingService, [{ key: "getKernelDensityJobs", value: function getKernelDensityJobs(callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var kernelDensityJobsService = new KernelDensityJobsService_KernelDensityJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); kernelDensityJobsService.getKernelDensityJobs(); } /** * @function ol.supermap.ProcessingService.prototype.getKernelDensityJob * @description 获取某一个密度分析。 * @param {string} id - 空间分析的 ID。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getKernelDensityJob", value: function getKernelDensityJob(id, callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var kernelDensityJobsService = new KernelDensityJobsService_KernelDensityJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); kernelDensityJobsService.getKernelDensityJob(id); } /** * @function ol.supermap.ProcessingService.prototype.addKernelDensityJob * @description 新建一个密度分析。 * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "addKernelDensityJob", value: function addKernelDensityJob(params, callback, seconds, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var kernelDensityJobsService = new KernelDensityJobsService_KernelDensityJobsService(me.url, { proxy: me.proxy, crossOrigin: me.options.crossOrigin, headers: me.options.headers, eventListeners: { scope: me, processCompleted: callback, processFailed: callback, processRunning: function processRunning(job) { me.kernelDensityJobs[job.id] = job.state; } }, format: format }); kernelDensityJobsService.addKernelDensityJob(param, seconds); } /** * @function ol.supermap.ProcessingService.prototype.getKernelDensityJobState * @description 获取密度分析的状态。 * @param {string} id - 密度分析的 ID。 * @returns {Object} 密度分析的状态 */ }, { key: "getKernelDensityJobState", value: function getKernelDensityJobState(id) { return this.kernelDensityJobs[id]; } /** * @function ol.supermap.ProcessingService.prototype.getSummaryMeshJobs * @description 获取点聚合分析的列表。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getSummaryMeshJobs", value: function getSummaryMeshJobs(callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var summaryMeshJobsService = new SummaryMeshJobsService_SummaryMeshJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); summaryMeshJobsService.getSummaryMeshJobs(); } /** * @function ol.supermap.ProcessingService.prototype.getSummaryMeshJob * @description 获取某一个点聚合分析。 * @param {string} id - 空间分析的 ID。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getSummaryMeshJob", value: function getSummaryMeshJob(id, callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var summaryMeshJobsService = new SummaryMeshJobsService_SummaryMeshJobsService(me.url, { proxy: me.options.proxy, crossOrigin: me.options.crossOrigin, headers: me.options.headers, withCredentials: me.options.withCredentials, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); summaryMeshJobsService.getSummaryMeshJob(id); } /** * @function ol.supermap.ProcessingService.prototype.addSummaryMeshJob * @description 新建一个点聚合分析。 * @param {SuperMap.SummaryMeshJobParameter} params - 点聚合分析任务参数类。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "addSummaryMeshJob", value: function addSummaryMeshJob(params, callback, seconds, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var summaryMeshJobsService = new SummaryMeshJobsService_SummaryMeshJobsService(me.url, { proxy: me.proxy, crossOrigin: me.options.crossOrigin, headers: me.options.headers, eventListeners: { scope: me, processCompleted: callback, processFailed: callback, processRunning: function processRunning(job) { me.summaryMeshJobs[job.id] = job.state; } }, format: format }); summaryMeshJobsService.addSummaryMeshJob(param, seconds); } /** * @function ol.supermap.ProcessingService.prototype.getSummaryMeshJobState * @description 获取点聚合分析的状态。 * @param {string} id - 点聚合分析的 ID。 * @returns {Object} 点聚合分析的状态 */ }, { key: "getSummaryMeshJobState", value: function getSummaryMeshJobState(id) { return this.summaryMeshJobs[id]; } /** * @function ol.supermap.ProcessingService.prototype.getQueryJobs * @description 获取单对象查询分析的列表。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getQueryJobs", value: function getQueryJobs(callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var singleObjectQueryJobsService = new SingleObjectQueryJobsService_SingleObjectQueryJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); singleObjectQueryJobsService.getQueryJobs(); } /** * @function ol.supermap.ProcessingService.prototype.getQueryJob * @description 获取某一个单对象查询分析。 * @param {string} id - 空间分析的 ID。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getQueryJob", value: function getQueryJob(id, callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var singleObjectQueryJobsService = new SingleObjectQueryJobsService_SingleObjectQueryJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); singleObjectQueryJobsService.getQueryJob(id); } /** * @function ol.supermap.ProcessingService.prototype.addQueryJob * @description 新建一个单对象查询分析。 * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "addQueryJob", value: function addQueryJob(params, callback, seconds, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var singleObjectQueryJobsService = new SingleObjectQueryJobsService_SingleObjectQueryJobsService(me.url, { proxy: me.proxy, crossOrigin: me.options.crossOrigin, headers: me.options.headers, eventListeners: { scope: me, processCompleted: callback, processFailed: callback, processRunning: function processRunning(job) { me.queryJobs[job.id] = job.state; } }, format: format }); singleObjectQueryJobsService.addQueryJob(param, seconds); } /** * @function ol.supermap.ProcessingService.prototype.getQueryJobState * @description 获取单对象查询分析的状态。 * @param {string} id - 单对象查询分析的 ID。 * @returns {Object} 单对象查询分析的状态 */ }, { key: "getQueryJobState", value: function getQueryJobState(id) { return this.queryJobs[id]; } /** * @function ol.supermap.ProcessingService.prototype.getSummaryRegionJobs * @description 获取区域汇总分析的列表。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getSummaryRegionJobs", value: function getSummaryRegionJobs(callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var summaryRegionJobsService = new SummaryRegionJobsService_SummaryRegionJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); summaryRegionJobsService.getSummaryRegionJobs(); } /** * @function ol.supermap.ProcessingService.prototype.getSummaryRegionJob * @description 获取某一个区域汇总分析。 * @param {string} id - 区域汇总分析的 ID。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getSummaryRegionJob", value: function getSummaryRegionJob(id, callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var summaryRegionJobsService = new SummaryRegionJobsService_SummaryRegionJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); summaryRegionJobsService.getSummaryRegionJob(id); } /** * @function ol.supermap.ProcessingService.prototype.addSummaryRegionJob * @description 新建一个区域汇总分析。 * @param {SuperMap.SummaryRegionJobParameter} params - 区域汇总分析参数类。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "addSummaryRegionJob", value: function addSummaryRegionJob(params, callback, seconds, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var summaryRegionJobsService = new SummaryRegionJobsService_SummaryRegionJobsService(me.url, { proxy: me.proxy, crossOrigin: me.options.crossOrigin, headers: me.options.headers, eventListeners: { scope: me, processCompleted: callback, processFailed: callback, processRunning: function processRunning(job) { me.summaryRegionJobs[job.id] = job.state; } }, format: format }); summaryRegionJobsService.addSummaryRegionJob(param, seconds); } /** * @function ol.supermap.ProcessingService.prototype.getSummaryRegionJobState * @description 获取区域汇总分析的状态。 * @param {string} id - 生成区域汇总分析的 ID。 * @returns {Object} 区域汇总分析的状态。 */ }, { key: "getSummaryRegionJobState", value: function getSummaryRegionJobState(id) { return this.summaryRegionJobs[id]; } /** * @function ol.supermap.ProcessingService.prototype.getVectorClipJobs * @description 获取矢量裁剪分析的列表。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getVectorClipJobs", value: function getVectorClipJobs(callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var vectorClipJobsService = new VectorClipJobsService_VectorClipJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); vectorClipJobsService.getVectorClipJobs(); } /** * @function ol.supermap.ProcessingService.prototype.getVectorClipJob * @description 获取某一个矢量裁剪分析。 * @param {string} id - 空间分析的 ID。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getVectorClipJob", value: function getVectorClipJob(id, callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var vectorClipJobsService = new VectorClipJobsService_VectorClipJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); vectorClipJobsService.getVectorClipJob(id); } /** * @function ol.supermap.ProcessingService.prototype.addVectorClipJob * @description 新建一个矢量裁剪分析。 * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "addVectorClipJob", value: function addVectorClipJob(params, callback, seconds, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var vectorClipJobsService = new VectorClipJobsService_VectorClipJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback, processRunning: function processRunning(job) { me.vectorClipJobs[job.id] = job.state; } }, format: format }); vectorClipJobsService.addVectorClipJob(param, seconds); } /** * @function ol.supermap.ProcessingService.prototype.getVectorClipJobState * @description 获取矢量裁剪分析的状态。 * @param {number} id - 矢量裁剪分析的 ID。 * @returns {Object} 矢量裁剪分析的状态 */ }, { key: "getVectorClipJobState", value: function getVectorClipJobState(id) { return this.vectorClipJobs[id]; } /** * @function ol.supermap.processingService.prototype.getOverlayGeoJobs * @description 获取叠加分析的列表。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getOverlayGeoJobs", value: function getOverlayGeoJobs(callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var overlayGeoJobsService = new OverlayGeoJobsService_OverlayGeoJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); overlayGeoJobsService.getOverlayGeoJobs(); } /** * @function ol.supermap.processingService.prototype.getOverlayGeoJob * @description 获取某一个叠加分析。 * @param {string} id - 空间分析的 ID。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getOverlayGeoJob", value: function getOverlayGeoJob(id, callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var overlayGeoJobsService = new OverlayGeoJobsService_OverlayGeoJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); overlayGeoJobsService.getOverlayGeoJob(id); } /** * @function ol.supermap.processingService.prototype.addOverlayGeoJob * @description 新建一个叠加分析。 * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个空间分析的请求参数。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "addOverlayGeoJob", value: function addOverlayGeoJob(params, callback, seconds, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var overlayGeoJobsService = new OverlayGeoJobsService_OverlayGeoJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, serverType: me.options.serverType, crossOrigin: me.options.crossOrigin, headers: me.options.headers, eventListeners: { scope: me, processCompleted: callback, processFailed: callback, processRunning: function processRunning(job) { me.overlayGeoJobs[job.id] = job.state; } }, format: format }); overlayGeoJobsService.addOverlayGeoJob(param, seconds); } /** * @function ol.supermap.processingService.prototype.getoverlayGeoJobState * @description 获取叠加分析的状态。 * @param {string} id - 叠加分析的 ID。 * @returns {Object} 叠加分析的状态 */ }, { key: "getoverlayGeoJobState", value: function getoverlayGeoJobState(id) { return this.overlayGeoJobs[id]; } /** * @function ol.supermap.processingService.prototype.getBuffersJobs * @description 获取缓冲区分析的列表。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getBuffersJobs", value: function getBuffersJobs(callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var buffersAnalystJobsService = new BuffersAnalystJobsService_BuffersAnalystJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); buffersAnalystJobsService.getBuffersJobs(); } /** * @function ol.supermap.processingService.prototype.getBuffersJob * @description 获取某一个缓冲区分析。 * @param {string} id - 空间分析的 ID。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getBuffersJob", value: function getBuffersJob(id, callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var buffersAnalystJobsService = new BuffersAnalystJobsService_BuffersAnalystJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); buffersAnalystJobsService.getBuffersJob(id); } /** * @function ol.supermap.processingService.prototype.addBuffersJob * @description 新建一个缓冲区分析。 * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "addBuffersJob", value: function addBuffersJob(params, callback, seconds, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var buffersAnalystJobsService = new BuffersAnalystJobsService_BuffersAnalystJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback, processRunning: function processRunning(job) { me.buffersJobs[job.id] = job.state; } }, format: format }); buffersAnalystJobsService.addBuffersJob(param, seconds); } /** * @function ol.supermap.processingService.prototype.getBuffersJobState * @description 获取缓冲区分析的状态。 * @param {string} id - 缓冲区分析的 ID。 * @returns {Object} 缓冲区分析的状态。 */ }, { key: "getBuffersJobState", value: function getBuffersJobState(id) { return this.buffersJobs[id]; } /** * @function ol.supermap.processingService.prototype.getTopologyValidatorJobs * @description 获取拓扑检查分析的列表。 * @param {RequestCallback} callback 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getTopologyValidatorJobs", value: function getTopologyValidatorJobs(callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var topologyValidatorJobsService = new TopologyValidatorJobsService_TopologyValidatorJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); topologyValidatorJobsService.getTopologyValidatorJobs(); } /** * @function ol.supermap.processingService.prototype.getTopologyValidatorJob * @description 获取某一个拓扑检查分析。 * @param {string} id - 空间分析的 ID。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getTopologyValidatorJob", value: function getTopologyValidatorJob(id, callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var topologyValidatorJobsService = new TopologyValidatorJobsService_TopologyValidatorJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); topologyValidatorJobsService.getTopologyValidatorJob(id); } /** * @function ol.supermap.processingService.prototype.addTopologyValidatorJob * @description 新建一个拓扑检查分析。 * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "addTopologyValidatorJob", value: function addTopologyValidatorJob(params, callback, seconds, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var topologyValidatorJobsService = new TopologyValidatorJobsService_TopologyValidatorJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback, processRunning: function processRunning(job) { me.topologyValidatorJobs[job.id] = job.state; } }, format: format }); topologyValidatorJobsService.addTopologyValidatorJob(param, seconds); } /** * @function ol.supermap.processingService.prototype.getTopologyValidatorJobState * @description 获取拓扑检查分析的状态。 * @param {string} id - 拓扑检查分析的 ID。 * @returns {Object} 拓扑检查分析的状态 */ }, { key: "getTopologyValidatorJobState", value: function getTopologyValidatorJobState(id) { return this.topologyValidatorJobs[id]; } /** * @function ol.supermap.processingService.prototype.getSummaryAttributesJobs * @description 获取拓扑检查属性汇总分析的列表。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getSummaryAttributesJobs", value: function getSummaryAttributesJobs(callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var summaryAttributesJobsService = new SummaryAttributesJobsService_SummaryAttributesJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); summaryAttributesJobsService.getSummaryAttributesJobs(); } /** * @function ol.supermap.processingService.prototype.getSummaryAttributesJob * @description 获取某一个属性汇总分析。 * @param {string} id - 空间分析的 ID。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "getSummaryAttributesJob", value: function getSummaryAttributesJob(id, callback, resultFormat) { var me = this, format = me._processFormat(resultFormat); var summaryAttributesJobsService = new SummaryAttributesJobsService_SummaryAttributesJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: format }); summaryAttributesJobsService.getSummaryAttributesJob(id); } /** * @function ol.supermap.processingService.prototype.addSummaryAttributesJob * @description 新建一个属性汇总分析。 * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。 * @param {RequestCallback} callback - 请求结果的回调函数。 * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "addSummaryAttributesJob", value: function addSummaryAttributesJob(params, callback, seconds, resultFormat) { var me = this, param = me._processParams(params), format = me._processFormat(resultFormat); var summaryAttributesJobsService = new SummaryAttributesJobsService_SummaryAttributesJobsService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback, processRunning: function processRunning(job) { me.summaryAttributesJobs[job.id] = job.state; } }, format: format }); summaryAttributesJobsService.addSummaryAttributesJob(param, seconds); } /** * @function ol.supermap.processingService.prototype.getSummaryAttributesJobState * @description 获取属性汇总分析的状态。 * @param {string} id - 属性汇总分析的 ID。 * @returns {Object} 属性汇总分析的状态。 */ }, { key: "getSummaryAttributesJobState", value: function getSummaryAttributesJobState(id) { return this.summaryAttributesJobs[id]; } }, { key: "_processFormat", value: function _processFormat(resultFormat) { return resultFormat ? resultFormat : DataFormat.GEOJSON; } }, { key: "_processParams", value: function _processParams(params) { if (!params) { return {}; } if (params.bounds) { params.bounds = core_Util_Util.toSuperMapBounds(params.bounds); } if (params.query) { params.query = core_Util_Util.toSuperMapBounds(params.query); } if (params.geometryQuery) { params.geometryQuery = core_Util_Util.toProcessingParam(params.geometryQuery); } if (params.geometryClip) { params.geometryClip = core_Util_Util.toProcessingParam(params.geometryClip); } return params; } }]); return ProcessingService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/SpatialAnalystService.js function SpatialAnalystService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { SpatialAnalystService_typeof = function _typeof(obj) { return typeof obj; }; } else { SpatialAnalystService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return SpatialAnalystService_typeof(obj); } function SpatialAnalystService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function SpatialAnalystService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function SpatialAnalystService_createClass(Constructor, protoProps, staticProps) { if (protoProps) SpatialAnalystService_defineProperties(Constructor.prototype, protoProps); if (staticProps) SpatialAnalystService_defineProperties(Constructor, staticProps); return Constructor; } function SpatialAnalystService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) SpatialAnalystService_setPrototypeOf(subClass, superClass); } function SpatialAnalystService_setPrototypeOf(o, p) { SpatialAnalystService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return SpatialAnalystService_setPrototypeOf(o, p); } function SpatialAnalystService_createSuper(Derived) { var hasNativeReflectConstruct = SpatialAnalystService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = SpatialAnalystService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = SpatialAnalystService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return SpatialAnalystService_possibleConstructorReturn(this, result); }; } function SpatialAnalystService_possibleConstructorReturn(self, call) { if (call && (SpatialAnalystService_typeof(call) === "object" || typeof call === "function")) { return call; } return SpatialAnalystService_assertThisInitialized(self); } function SpatialAnalystService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function SpatialAnalystService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function SpatialAnalystService_getPrototypeOf(o) { SpatialAnalystService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return SpatialAnalystService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.SpatialAnalystService * @extends {ol.supermap.ServiceBase} * @category iServer SpatialAnalyst * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。 * @example * new ol.supermap.SpatialAnalystService(url) * .bufferAnalysis(params,function(result){ * //doSomething * }) * @param {string} url - 服务的访问地址。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var SpatialAnalystService_SpatialAnalystService = /*#__PURE__*/function (_ServiceBase) { SpatialAnalystService_inherits(SpatialAnalystService, _ServiceBase); var _super = SpatialAnalystService_createSuper(SpatialAnalystService); function SpatialAnalystService(url, options) { SpatialAnalystService_classCallCheck(this, SpatialAnalystService); return _super.call(this, url, options); } /** * @function ol.supermap.SpatialAnalystService.prototype.getAreaSolarRadiationResult * @description 地区太阳辐射。 * @param {SuperMap.AreaSolarRadiationParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ SpatialAnalystService_createClass(SpatialAnalystService, [{ key: "getAreaSolarRadiationResult", value: function getAreaSolarRadiationResult(params, callback, resultFormat) { var me = this; var areaSolarRadiationService = new AreaSolarRadiationService_AreaSolarRadiationService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); areaSolarRadiationService.processAsync(params); } /** * @function ol.supermap.SpatialAnalystService.prototype.bufferAnalysis * @description 缓冲区分析。 * @param {SuperMap.DatasetBufferAnalystParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "bufferAnalysis", value: function bufferAnalysis(params, callback, resultFormat) { var me = this; var bufferAnalystService = new BufferAnalystService_BufferAnalystService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); bufferAnalystService.processAsync(me._processParams(params)); } /** * @function ol.supermap.SpatialAnalystService.prototype.densityAnalysis * @description 点密度分析。 * @param {SuperMap.DensityKernelAnalystParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "densityAnalysis", value: function densityAnalysis(params, callback, resultFormat) { var me = this; var densityAnalystService = new DensityAnalystService_DensityAnalystService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); densityAnalystService.processAsync(me._processParams(params)); } /** * @function ol.supermap.SpatialAnalystService.prototype.generateSpatialData * @description 动态分段分析。 * @param {SuperMap.GenerateSpatialDataParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "generateSpatialData", value: function generateSpatialData(params, callback, resultFormat) { var me = this; var generateSpatialDataService = new GenerateSpatialDataService_GenerateSpatialDataService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); generateSpatialDataService.processAsync(params); } /** * @function ol.supermap.SpatialAnalystService.prototype.geoRelationAnalysis * @description 空间关系分析。 * @param {SuperMap.GeoRelationAnalystParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "geoRelationAnalysis", value: function geoRelationAnalysis(params, callback, resultFormat) { var me = this; var geoRelationAnalystService = new GeoRelationAnalystService_GeoRelationAnalystService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); geoRelationAnalystService.processAsync(params); } /** * @function ol.supermap.SpatialAnalystService.prototype.interpolationAnalysis * @description 插值分析。 * @param {SuperMap.InterpolationRBFAnalystParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "interpolationAnalysis", value: function interpolationAnalysis(params, callback, resultFormat) { var me = this; var interpolationAnalystService = new InterpolationAnalystService_InterpolationAnalystService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); interpolationAnalystService.processAsync(me._processParams(params)); } /** * @function ol.supermap.SpatialAnalystService.prototype.mathExpressionAnalysis * @description 栅格代数运算。 * @param {SuperMap.MathExpressionAnalysisParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "mathExpressionAnalysis", value: function mathExpressionAnalysis(params, callback, resultFormat) { var me = this; var mathExpressionAnalysisService = new MathExpressionAnalysisService_MathExpressionAnalysisService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); mathExpressionAnalysisService.processAsync(me._processParams(params)); } /** * @function ol.supermap.SpatialAnalystService.prototype.overlayAnalysis * @description 叠加分析。 * @param {SuperMap.DatasetOverlayAnalystParameters|SuperMap.GeometryOverlayAnalystParameters} params - 叠加分析参数类,支持批量几何要素叠加分析。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "overlayAnalysis", value: function overlayAnalysis(params, callback, resultFormat) { var me = this; var overlayAnalystService = new OverlayAnalystService_OverlayAnalystService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); overlayAnalystService.processAsync(me._processParams(params)); } /** * @function ol.supermap.SpatialAnalystService.prototype.routeCalculateMeasure * @description 路由测量计算。 * @param {SuperMap.RouteCalculateMeasureParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "routeCalculateMeasure", value: function routeCalculateMeasure(params, callback, resultFormat) { var me = this; var routeCalculateMeasureService = new RouteCalculateMeasureService_RouteCalculateMeasureService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); routeCalculateMeasureService.processAsync(me._processParams(params)); } /** * @function ol.supermap.SpatialAnalystService.prototype.routeLocate * @description 路由定位。 * @param {SuperMap.RouteLocatorParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "routeLocate", value: function routeLocate(params, callback, resultFormat) { var me = this; var routeLocatorService = new RouteLocatorService_RouteLocatorService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); routeLocatorService.processAsync(me._processParams(params)); } /** * @function ol.supermap.SpatialAnalystService.prototype.surfaceAnalysis * @description 表面分析。 * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "surfaceAnalysis", value: function surfaceAnalysis(params, callback, resultFormat) { var me = this; var surfaceAnalystService = new SurfaceAnalystService_SurfaceAnalystService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); surfaceAnalystService.processAsync(me._processParams(params)); } /** * @function ol.supermap.SpatialAnalystService.prototype.terrainCurvatureCalculate * @description 地形曲率计算。 * @param {SuperMap.TerrainCurvatureCalculationParameters} params - 地形曲率计算相关参数。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "terrainCurvatureCalculate", value: function terrainCurvatureCalculate(params, callback, resultFormat) { var me = this; var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService_TerrainCurvatureCalculationService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); terrainCurvatureCalculationService.processAsync(params); } /** * @function ol.supermap.SpatialAnalystService.prototype.thiessenAnalysis * @description 泰森多边形分析。 * @param {SuperMap.DatasetThiessenAnalystParameters} params - 查询相关参数类。 * @param {RequestCallback} callback 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "thiessenAnalysis", value: function thiessenAnalysis(params, callback, resultFormat) { var me = this; var thiessenAnalystService = new ThiessenAnalystService_ThiessenAnalystService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); thiessenAnalystService.processAsync(me._processParams(params)); } /** * @function ol.supermap.SpatialAnalystService.prototype.geometrybatchAnalysis * @description 批量空间分析。 * @param {Array} params - 批量分析参数对象数组。 * @param {Array.} params.analystName - 空间分析方法的名称。包括:
* "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。 * @param {Object} params.param - 空间分析类型对应的请求参数,包括:
* {SuperMap.GeometryBufferAnalystParameters} 缓冲区分析参数类。
* {SuperMap.GeometryOverlayAnalystParameters} 叠加分析参数类。
* {SuperMap.InterpolationAnalystParameters} 插值分析参数类。
* {SuperMap.SurfaceAnalystParameters} 表面分析参数类。
* @param {RequestCallback} callback - 回调函数。 * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。 */ }, { key: "geometrybatchAnalysis", value: function geometrybatchAnalysis(params, callback, resultFormat) { var me = this; var geometryBatchAnalystService = new GeometryBatchAnalystService_GeometryBatchAnalystService(me.url, { serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback }, format: me._processFormat(resultFormat) }); //处理批量分析中各个分类类型的参数: var analystParameters = []; for (var i = 0; i < params.length; i++) { var tempParameter = params[i]; analystParameters.push({ analystName: tempParameter.analystName, param: me._processParams(tempParameter.param) }); } geometryBatchAnalystService.processAsync(analystParameters); } }, { key: "_processParams", value: function _processParams(params) { if (!params) { return {}; } if (params.bounds) { params.bounds = core_Util_Util.toSuperMapBounds(params.bounds); } if (params.inputPoints) { for (var i = 0; i < params.inputPoints.length; i++) { var inputPoint = params.inputPoints[i]; if (core_Util_Util.isArray(inputPoint)) { params.inputPoints[i] = { x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2] }; } else { params.inputPoints[i] = { x: inputPoint.getCoordinates()[0], y: inputPoint.getCoordinates()[1], tag: inputPoint.tag }; } } } if (params.points) { for (var _i = 0; _i < params.points.length; _i++) { var point = params.points[_i]; if (core_Util_Util.isArray(point)) { point.setCoordinates(point); } params.points[_i] = new Point_Point(point.getCoordinates()[0], point.getCoordinates()[1]); } } if (params.point) { var _point = params.point; if (core_Util_Util.isArray(_point)) { _point.setCoordinates(_point); } params.point = new Point_Point(_point.getCoordinates()[0], _point.getCoordinates()[1]); } if (params.extractRegion) { params.extractRegion = this.convertGeometry(params.extractRegion); } if (params.extractParameter && params.extractParameter.clipRegion) { params.extractParameter.clipRegion = this.convertGeometry(params.extractParameter.clipRegion); } if (params.clipParam && params.clipParam.clipRegion) { params.clipParam.clipRegion = this.convertGeometry(params.clipParam.clipRegion); } //支持格式:Vector Layers; GeoJson if (params.sourceGeometry) { var SRID = null; if (params.sourceGeometrySRID) { SRID = params.sourceGeometrySRID; } params.sourceGeometry = this.convertGeometry(params.sourceGeometry); if (SRID) { params.sourceGeometry.SRID = SRID; } delete params.sourceGeometry.sourceGeometrySRID; } if (params.operateGeometry) { params.operateGeometry = this.convertGeometry(params.operateGeometry); } //支持传入多个几何要素进行叠加分析: if (params.sourceGeometries) { var sourceGeometries = []; for (var k = 0; k < params.sourceGeometries.length; k++) { sourceGeometries.push(this.convertGeometry(params.sourceGeometries[k])); } params.sourceGeometries = sourceGeometries; } //支持传入多个几何要素进行叠加分析: if (params.operateGeometries) { var operateGeometries = []; for (var j = 0; j < params.operateGeometries.length; j++) { operateGeometries.push(this.convertGeometry(params.operateGeometries[j])); } params.operateGeometries = operateGeometries; } if (params.sourceRoute) { if (params.sourceRoute instanceof external_ol_geom_LineString_default.a && params.sourceRoute.getCoordinates()) { var target = {}; target.type = "LINEM"; target.parts = [params.sourceRoute.getCoordinates()[0].length]; target.points = []; for (var _i2 = 0; _i2 < params.sourceRoute.getCoordinates()[0].length; _i2++) { var _point2 = params.sourceRoute.getCoordinates()[0][_i2]; target.points = target.points.concat({ x: _point2[0], y: _point2[1], measure: _point2[2] }); } params.sourceRoute = target; } } var me = this; if (params.operateRegions && core_Util_Util.isArray(params.operateRegions)) { params.operateRegions.map(function (geometry, key) { params.operateRegions[key] = me.convertGeometry(geometry); return params.operateRegions[key]; }); } if (params.sourceRoute && params.sourceRoute.components && core_Util_Util.isArray(params.sourceRoute.components)) { params.sourceRoute.components.map(function (geometry, key) { params.sourceRoute.components[key] = me.convertGeometry(geometry); return params.sourceRoute.components[key]; }); } return params; } }, { key: "_processFormat", value: function _processFormat(resultFormat) { return resultFormat ? resultFormat : DataFormat.GEOJSON; } /** * @private * @function ol.supermap.SpatialAnalystService.prototype.convertGeometry * @description 转换几何对象。 * @param {Object} ol3Geometry - 待转换的几何对象。 */ }, { key: "convertGeometry", value: function convertGeometry(ol3Geometry) { //判断是否传入的是geojson 并作相应处理 if (["FeatureCollection", "Feature", "Geometry"].indexOf(ol3Geometry.type) != -1) { return core_Util_Util.toSuperMapGeometry(ol3Geometry); } return core_Util_Util.toSuperMapGeometry(JSON.parse(new external_ol_format_GeoJSON_default.a().writeGeometry(ol3Geometry))); } }]); return SpatialAnalystService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/ThemeService.js function services_ThemeService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { services_ThemeService_typeof = function _typeof(obj) { return typeof obj; }; } else { services_ThemeService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return services_ThemeService_typeof(obj); } function services_ThemeService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function services_ThemeService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function services_ThemeService_createClass(Constructor, protoProps, staticProps) { if (protoProps) services_ThemeService_defineProperties(Constructor.prototype, protoProps); if (staticProps) services_ThemeService_defineProperties(Constructor, staticProps); return Constructor; } function services_ThemeService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) services_ThemeService_setPrototypeOf(subClass, superClass); } function services_ThemeService_setPrototypeOf(o, p) { services_ThemeService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return services_ThemeService_setPrototypeOf(o, p); } function services_ThemeService_createSuper(Derived) { var hasNativeReflectConstruct = services_ThemeService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = services_ThemeService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = services_ThemeService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return services_ThemeService_possibleConstructorReturn(this, result); }; } function services_ThemeService_possibleConstructorReturn(self, call) { if (call && (services_ThemeService_typeof(call) === "object" || typeof call === "function")) { return call; } return services_ThemeService_assertThisInitialized(self); } function services_ThemeService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function services_ThemeService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function services_ThemeService_getPrototypeOf(o) { services_ThemeService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return services_ThemeService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.ThemeService * @category iServer Map Theme * @classdesc 专题图服务类。 * @extends {ol.supermap.ServiceBase} * @example * new ol.supermap.ThemeService(url,{ * projection:projection * }).getThemeInfo(params,function(result){ * //doSomething * }); * @param {string} url - 服务的访问地址。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var services_ThemeService_ThemeService = /*#__PURE__*/function (_ServiceBase) { services_ThemeService_inherits(ThemeService, _ServiceBase); var _super = services_ThemeService_createSuper(ThemeService); function ThemeService(url, options) { services_ThemeService_classCallCheck(this, ThemeService); return _super.call(this, url, options); } /** * @function ol.supermap.ThemeService.prototype.getThemeInfo * @description 获取专题图信息。 * @param {SuperMap.ThemeParameters} params - 专题图参数类。 * @param {RequestCallback} callback 回调函数。 */ services_ThemeService_createClass(ThemeService, [{ key: "getThemeInfo", value: function getThemeInfo(params, callback) { var me = this; var themeService = new ThemeService_ThemeService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); themeService.processAsync(params); } }]); return ThemeService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/TrafficTransferAnalystService.js function TrafficTransferAnalystService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { TrafficTransferAnalystService_typeof = function _typeof(obj) { return typeof obj; }; } else { TrafficTransferAnalystService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return TrafficTransferAnalystService_typeof(obj); } function TrafficTransferAnalystService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function TrafficTransferAnalystService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function TrafficTransferAnalystService_createClass(Constructor, protoProps, staticProps) { if (protoProps) TrafficTransferAnalystService_defineProperties(Constructor.prototype, protoProps); if (staticProps) TrafficTransferAnalystService_defineProperties(Constructor, staticProps); return Constructor; } function TrafficTransferAnalystService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) TrafficTransferAnalystService_setPrototypeOf(subClass, superClass); } function TrafficTransferAnalystService_setPrototypeOf(o, p) { TrafficTransferAnalystService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return TrafficTransferAnalystService_setPrototypeOf(o, p); } function TrafficTransferAnalystService_createSuper(Derived) { var hasNativeReflectConstruct = TrafficTransferAnalystService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = TrafficTransferAnalystService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = TrafficTransferAnalystService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return TrafficTransferAnalystService_possibleConstructorReturn(this, result); }; } function TrafficTransferAnalystService_possibleConstructorReturn(self, call) { if (call && (TrafficTransferAnalystService_typeof(call) === "object" || typeof call === "function")) { return call; } return TrafficTransferAnalystService_assertThisInitialized(self); } function TrafficTransferAnalystService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function TrafficTransferAnalystService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function TrafficTransferAnalystService_getPrototypeOf(o) { TrafficTransferAnalystService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return TrafficTransferAnalystService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.TrafficTransferAnalystService * @extends {ol.supermap.ServiceBase} * @category iServer TrafficTransferAnalyst * @classdesc 交通换乘分析服务类。 * @example * new ol.supermap.TrafficTransferAnalystService(url) * .queryStop(params,function(result){ * //doSomething * }) * @param {string} url - 服务地址。 * @param {Object} options - 参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 */ var TrafficTransferAnalystService_TrafficTransferAnalystService = /*#__PURE__*/function (_ServiceBase) { TrafficTransferAnalystService_inherits(TrafficTransferAnalystService, _ServiceBase); var _super = TrafficTransferAnalystService_createSuper(TrafficTransferAnalystService); function TrafficTransferAnalystService(url, options) { TrafficTransferAnalystService_classCallCheck(this, TrafficTransferAnalystService); return _super.call(this, url, options); } /** * @function ol.supermap.TrafficTransferAnalystService.prototype.queryStop * @description 站点查询服务。 * @param {SuperMap.StopQueryParameters} params - 查询相关参数类。 * @param {RequestCallback} callback - 回调函数。 */ TrafficTransferAnalystService_createClass(TrafficTransferAnalystService, [{ key: "queryStop", value: function queryStop(params, callback) { var me = this; var stopQueryService = new StopQueryService_StopQueryService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); stopQueryService.processAsync(params); } /** * @function ol.supermap.TrafficTransferAnalystService.prototype.analysisTransferPath * @description 交通换乘线路查询服务。 * @param {SuperMap.TransferPathParameters} params - 查询相关参数类。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "analysisTransferPath", value: function analysisTransferPath(params, callback) { var me = this; var transferPathService = new TransferPathService_TransferPathService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); transferPathService.processAsync(me._processParams(params)); } /** * @function ol.supermap.TrafficTransferAnalystService.prototype.analysisTransferSolution * @description 交通换乘方案查询服务。 * @param {SuperMap.TransferSolutionParameters} params - 查询相关参数类。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "analysisTransferSolution", value: function analysisTransferSolution(params, callback) { var me = this; var transferSolutionService = new TransferSolutionService_TransferSolutionService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); transferSolutionService.processAsync(me._processParams(params)); } }, { key: "_processParams", value: function _processParams(params) { if (!params) { return {}; } if (params.transferLines && !core_Util_Util.isArray(params.transferLines)) { params.transferLines = [params.transferLines]; } if (params.points && core_Util_Util.isArray(params.points)) { params.points.map(function (point, key) { params.points[key] = point instanceof external_ol_geom_Point_default.a ? { x: point.getCoordinates()[0], y: point.getCoordinates()[1] } : point; return params.points[key]; }); } return params; } }]); return TrafficTransferAnalystService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/WebPrintingJobService.js function WebPrintingJobService_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { WebPrintingJobService_typeof = function _typeof(obj) { return typeof obj; }; } else { WebPrintingJobService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return WebPrintingJobService_typeof(obj); } function WebPrintingJobService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function WebPrintingJobService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function WebPrintingJobService_createClass(Constructor, protoProps, staticProps) { if (protoProps) WebPrintingJobService_defineProperties(Constructor.prototype, protoProps); if (staticProps) WebPrintingJobService_defineProperties(Constructor, staticProps); return Constructor; } function WebPrintingJobService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) WebPrintingJobService_setPrototypeOf(subClass, superClass); } function WebPrintingJobService_setPrototypeOf(o, p) { WebPrintingJobService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return WebPrintingJobService_setPrototypeOf(o, p); } function WebPrintingJobService_createSuper(Derived) { var hasNativeReflectConstruct = WebPrintingJobService_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = WebPrintingJobService_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = WebPrintingJobService_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return WebPrintingJobService_possibleConstructorReturn(this, result); }; } function WebPrintingJobService_possibleConstructorReturn(self, call) { if (call && (WebPrintingJobService_typeof(call) === "object" || typeof call === "function")) { return call; } return WebPrintingJobService_assertThisInitialized(self); } function WebPrintingJobService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function WebPrintingJobService_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function WebPrintingJobService_getPrototypeOf(o) { WebPrintingJobService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return WebPrintingJobService_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /** * @class ol.supermap.WebPrintingJobService * @category iServer WebPrintingJob * @version 10.1.0 * @classdesc Web 打印服务类。 * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。 * @extends {ol.supermap.ServiceBase} * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。 * @param {Object} options - 服务交互时所需的可选参数。 * @param {string} [options.proxy] - 服务代理地址。 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。 * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。 * @param {Object} [options.headers] - 请求头。 * @example * new ol.supermap.WebPrintingJobService(url) * .createWebPrintingJob(param,function(result){ * //doSomething * }) */ var WebPrintingJobService_WebPrintingJobService = /*#__PURE__*/function (_ServiceBase) { WebPrintingJobService_inherits(WebPrintingJobService, _ServiceBase); var _super = WebPrintingJobService_createSuper(WebPrintingJobService); function WebPrintingJobService(url, options) { WebPrintingJobService_classCallCheck(this, WebPrintingJobService); return _super.call(this, url, options); } /** * @function ol.supermap.WebPrintingJobService.prototype.createWebPrintingJob * @description 创建 Web 打印任务。 * @param {SuperMap.WebPrintingJobParameters} params - 打印的相关参数类。 * @param {RequestCallback} callback - 回调函数。 */ WebPrintingJobService_createClass(WebPrintingJobService, [{ key: "createWebPrintingJob", value: function createWebPrintingJob(params, callback) { if (!params) { return; } var me = this; var webPrintingService = new WebPrintingService_WebPrintingService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); webPrintingService.createWebPrintingJob(me._processParams(params)); } /** * @function ol.supermap.WebPrintingJobService.prototype.getPrintingJob * @description 获取 Web 打印输出文档任务。 * @param {String} jobId - Web 打印输入文档任务 Id。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "getPrintingJob", value: function getPrintingJob(jobId, callback) { var me = this; var webPrintingService = new WebPrintingService_WebPrintingService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); webPrintingService.getPrintingJob(jobId); } /** * @function ol.supermap.WebPrintingJobService.prototype.getPrintingJobResult * @description 获取 Web 打印任务的输出文档。 * @param {String} jobId - Web 打印输入文档任务 Id。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "getPrintingJobResult", value: function getPrintingJobResult(jobId, callback) { var me = this; var webPrintingService = new WebPrintingService_WebPrintingService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); webPrintingService.getPrintingJobResult(jobId); } /** * @function ol.supermap.WebPrintingJobService.prototype.getLayoutTemplates * @description 查询 Web 打印服务所有可用的模板信息。 * @param {RequestCallback} callback - 回调函数。 */ }, { key: "getLayoutTemplates", value: function getLayoutTemplates(callback) { var me = this; var webPrintingService = new WebPrintingService_WebPrintingService(me.url, { proxy: me.options.proxy, withCredentials: me.options.withCredentials, crossOrigin: me.options.crossOrigin, headers: me.options.headers, serverType: me.options.serverType, eventListeners: { scope: me, processCompleted: callback, processFailed: callback } }); webPrintingService.getLayoutTemplates(); } }, { key: "_processParams", value: function _processParams(params) { if (params.layoutOptions && params.layoutOptions.littleMapOptions) { params.layoutOptions.littleMapOptions.center = this._toPointObject(params.layoutOptions.littleMapOptions.center); } if (params.exportOptions) { params.exportOptions.center = this._toPointObject(params.exportOptions.center); } return params; } }, { key: "_toPointObject", value: function _toPointObject(point) { if (core_Util_Util.isArray(point)) { return { x: point[0], y: point[1] }; } else if (point instanceof SuperMap.Geometry.Point || point instanceof external_ol_geom_Point_default.a) { return { x: point.x, y: point.y }; } return point; } }]); return WebPrintingJobService; }(ServiceBase); // CONCATENATED MODULE: ./src/openlayers/services/index.js /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ // EXTERNAL MODULE: ./src/openlayers/mapping/webmap/config/ProvinceCenter.json var ProvinceCenter = __webpack_require__(59); // EXTERNAL MODULE: ./src/openlayers/mapping/webmap/config/MunicipalCenter.json var MunicipalCenter = __webpack_require__(60); // EXTERNAL MODULE: ./src/openlayers/mapping/webmap/config/SampleDataInfo.json var SampleDataInfo = __webpack_require__(61); // EXTERNAL MODULE: external "ol.View" var external_ol_View_ = __webpack_require__(37); var external_ol_View_default = /*#__PURE__*/__webpack_require__.n(external_ol_View_); // EXTERNAL MODULE: external "ol.proj.proj4" var external_ol_proj_proj4_ = __webpack_require__(32); // EXTERNAL MODULE: external "ol.proj.Units" var external_ol_proj_Units_ = __webpack_require__(62); var external_ol_proj_Units_default = /*#__PURE__*/__webpack_require__.n(external_ol_proj_Units_); // EXTERNAL MODULE: external "ol.layer" var external_ol_layer_ = __webpack_require__(6); // EXTERNAL MODULE: external "ol.format.WMTSCapabilities" var external_ol_format_WMTSCapabilities_ = __webpack_require__(38); var external_ol_format_WMTSCapabilities_default = /*#__PURE__*/__webpack_require__.n(external_ol_format_WMTSCapabilities_); // EXTERNAL MODULE: external "ol.geom" var external_ol_geom_ = __webpack_require__(39); // EXTERNAL MODULE: external "ol.source" var external_ol_source_ = __webpack_require__(8); // EXTERNAL MODULE: external "ol.render.Feature" var external_ol_render_Feature_ = __webpack_require__(63); var external_ol_render_Feature_default = /*#__PURE__*/__webpack_require__.n(external_ol_render_Feature_); // EXTERNAL MODULE: external "ol.Collection" var external_ol_Collection_ = __webpack_require__(64); var external_ol_Collection_default = /*#__PURE__*/__webpack_require__.n(external_ol_Collection_); // CONCATENATED MODULE: ./src/openlayers/mapping/WebMap.js function WebMap_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { WebMap_typeof = function _typeof(obj) { return typeof obj; }; } else { WebMap_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return WebMap_typeof(obj); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || WebMap_unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function WebMap_toConsumableArray(arr) { return WebMap_arrayWithoutHoles(arr) || WebMap_iterableToArray(arr) || WebMap_unsupportedIterableToArray(arr) || WebMap_nonIterableSpread(); } function WebMap_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function WebMap_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return WebMap_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return WebMap_arrayLikeToArray(o, minLen); } function WebMap_iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function WebMap_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return WebMap_arrayLikeToArray(arr); } function WebMap_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function WebMap_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function WebMap_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function WebMap_createClass(Constructor, protoProps, staticProps) { if (protoProps) WebMap_defineProperties(Constructor.prototype, protoProps); if (staticProps) WebMap_defineProperties(Constructor, staticProps); return Constructor; } function WebMap_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) WebMap_setPrototypeOf(subClass, superClass); } function WebMap_setPrototypeOf(o, p) { WebMap_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return WebMap_setPrototypeOf(o, p); } function WebMap_createSuper(Derived) { var hasNativeReflectConstruct = WebMap_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = WebMap_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = WebMap_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return WebMap_possibleConstructorReturn(this, result); }; } function WebMap_possibleConstructorReturn(self, call) { if (call && (WebMap_typeof(call) === "object" || typeof call === "function")) { return call; } return WebMap_assertThisInitialized(self); } function WebMap_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function WebMap_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function WebMap_getPrototypeOf(o) { WebMap_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return WebMap_getPrototypeOf(o); } /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ // eslint-disable-line import/extensions // eslint-disable-line import/extensions // eslint-disable-line import/extensions window.proj4 = lib; window.Proj4js = lib; //数据转换工具 var transformTools = new external_ol_format_GeoJSON_default.a(); // 迁徙图最大支持要素数量 var MAX_MIGRATION_ANIMATION_COUNT = 1000; //不同坐标系单位。计算公式中的值 var metersPerUnit = { DEGREES: 2 * Math.PI * 6370997 / 360, DEGREE: 2 * Math.PI * 6370997 / 360, FEET: 0.3048, METERS: 1, METER: 1, M: 1, USFEET: 1200 / 3937 }; var dpiConfig = { "default": 96, // 常用dpi iServerWMTS: 90.7142857142857 // iserver使用的wmts图层dpi }; /** * @class ol.supermap.WebMap * @category iPortal/Online * @classdesc 对接 iPortal/Online 地图类 * @param {Object} options - 参数 * @param {string} [options.target='map'] - 地图容器id * @param {Object | string} [options.webMap] - webMap对象,或者是获取webMap的url地址。存在webMap,优先使用webMap, id的选项则会被忽略 * @param {number} [options.id] - 地图的id * @param {string} [options.server="https://www.supermapol.com"] - 地图的地址,如果使用传入id,server则会和id拼接成webMap请求地址 * @param {function} [options.successCallback] - 成功加载地图后调用的函数 * @param {function} [options.errorCallback] - 加载地图失败调用的函数 * @param {string} [options.credentialKey] - 凭证密钥。例如为"key"、"token",或者用户自定义的密钥。用户申请了密钥,此参数必填 * @param {string} [options.credentialValue] - 凭证密钥对应的值,credentialKey和credentialValue必须一起使用 * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie * @param {boolean} [options.excludePortalProxyUrl] - server传递过来的url是否带有代理 * @param {Object} [options.serviceProxy] - iportal内置代理信息, 仅矢量瓦片图层上图才会使用 * @param {string} [options.tiandituKey] - 天地图的key * @param {string} [options.proxy] - 代理地址,当域名不一致,请求会加上代理。避免跨域 * @param {function} [options.mapSetting.mapClickCallback] - 地图被点击的回调函数 * @param {function} [options.mapSetting.overlays] - 地图的overlayer * @param {function} [options.mapSetting.controls] - 地图的控件 * @param {function} [options.mapSetting.interactions] - 地图控制的参数 * @extends {ol/Observable} */ var WebMap_WebMap = /*#__PURE__*/function (_Observable) { WebMap_inherits(WebMap, _Observable); var _super = WebMap_createSuper(WebMap); function WebMap(id, options) { var _this2; WebMap_classCallCheck(this, WebMap); _this2 = _super.call(this); if (core_Util_Util.isObject(id)) { options = id; _this2.mapId = options.id; } else { _this2.mapId = id; } options = options || {}; _this2.server = options.server; _this2.successCallback = options.successCallback; _this2.errorCallback = options.errorCallback; _this2.credentialKey = options.credentialKey; _this2.credentialValue = options.credentialValue; _this2.withCredentials = options.withCredentials || false; _this2.target = options.target || "map"; _this2.excludePortalProxyUrl = options.excludePortalProxyUrl || false; _this2.serviceProxy = options.serviceProxy || null; _this2.tiandituKey = options.tiandituKey; _this2.proxy = options.proxy; //计数叠加图层,处理过的数量(成功和失败都会计数) _this2.layerAdded = 0; _this2.layers = []; _this2.events = new Events_Events(WebMap_assertThisInitialized(_this2), null, ["updateDataflowFeature"], true); _this2.webMap = options.webMap; _this2.createMap(options.mapSetting); if (_this2.webMap) { // webmap有可能是url地址,有可能是webmap对象 core_Util_Util.isString(_this2.webMap) ? _this2.createWebmap(_this2.webMap) : _this2.getMapInfoSuccess(options.webMap); } else { if (!_this2.server) { _this2.server = 'https://www.supermapol.com'; } _this2.createWebmap(); } return _this2; } /** * @private * @function ol.supermap.WebMap.prototype._removeBaseLayer * @description 移除底图 */ WebMap_createClass(WebMap, [{ key: "_removeBaseLayer", value: function _removeBaseLayer() { var map = this.map; var _this$baseLayer = this.baseLayer, layer = _this$baseLayer.layer, labelLayer = _this$baseLayer.labelLayer; // 移除天地图标签图层 labelLayer && map.removeLayer(labelLayer); // 移除图层 layer && map.removeLayer(layer); this.baseLayer = null; } /** * @private * @function ol.supermap.WebMap.prototype._removeLayers * @description 移除叠加图层 */ }, { key: "_removeLayers", value: function _removeLayers() { var map = this.map; this.layers.forEach(function (_ref) { var layerType = _ref.layerType, layer = _ref.layer, labelLayer = _ref.labelLayer, pathLayer = _ref.pathLayer, dataflowService = _ref.dataflowService; if (!layer) { return; } if (layerType === 'MIGRATION') { layer.remove(); return; } if (layerType === 'DATAFLOW_POINT_TRACK' || layerType === 'DATAFLOW_HEAT') { // 移除轨迹图层 pathLayer && map.removeLayer(pathLayer); // 取消订阅 dataflowService && dataflowService.unSubscribe(); } // 移除标签图层 labelLayer && map.removeLayer(labelLayer); // 移除图层 map.removeLayer(layer); }); this.layers = []; } /** * @private * @function ol.supermap.WebMap.prototype.clear * @description 清空地图 */ }, { key: "_clear", value: function _clear() { // 比例尺 this.scales = []; // 分辨率 this.resolutionArray = []; // 比例尺-分辨率 {scale: resolution} this.resolutions = {}; // 计数叠加图层,处理过的数量(成功和失败都会计数) this.layerAdded = 0; this._removeBaseLayer(); this._removeLayers(); } /** * @function ol.supermap.WebMap.prototype.refresh * @version 10.1.0 * @description 重新渲染地图 */ }, { key: "refresh", value: function refresh() { this._clear(); this.createWebmap(); } /** * @private * @function ol.supermap.WebMap.prototype.createMap * @description 创建地图对象以及注册地图事件 * @param {object} mapSetting - 关于地图的设置以及需要注册的事件 */ }, { key: "createMap", value: function createMap(mapSetting) { var overlays, controls, interactions; if (mapSetting) { interactions = mapSetting.interactions; overlays = mapSetting.overlays; controls = mapSetting.controls; } this.map = new external_ol_Map_default.a({ interactions: interactions, overlays: overlays, controls: controls, target: this.target }); mapSetting && this.registerMapEvent({ mapClickCallback: mapSetting.mapClickCallback }); } /** * @private * @function ol.supermap.WebMap.prototype.registerMapEvent * @description 注册地图事件 * @param {object} mapSetting - 关于地图的设置以及需要注册的事件 */ }, { key: "registerMapEvent", value: function registerMapEvent(mapSetting) { var map = this.map; map.on("click", function (evt) { mapSetting.mapClickCallback && mapSetting.mapClickCallback(evt); }); } /** * @private * @function ol.supermap.WebMap.prototype.createWebmap * @description 创建webmap * @param {string} webMapUrl - 请求webMap的地址 */ }, { key: "createWebmap", value: function createWebmap(webMapUrl) { var mapUrl; if (webMapUrl) { mapUrl = webMapUrl; } else { var urlArr = this.server.split(''); if (urlArr[urlArr.length - 1] !== '/') { this.server += '/'; } mapUrl = this.server + 'web/maps/' + this.mapId + '/map'; var filter = 'getUrlResource.json?url='; if (this.excludePortalProxyUrl && this.server.indexOf(filter) > -1) { //大屏需求,或者有加上代理的 var urlArray = this.server.split(filter); if (urlArray.length > 1) { mapUrl = urlArray[0] + filter + this.server + 'web/maps/' + this.mapId + '/map.json'; } } } this.getMapInfo(mapUrl); } /** * @private * @function ol.supermap.WebMap.prototype.getMapInfo * @description 获取地图的json信息 * @param {string} url - 请求地图的url */ }, { key: "getMapInfo", value: function getMapInfo(url) { var that = this, mapUrl = url; if (url.indexOf('.json') === -1) { //传递过来的url,没有包括.json,在这里加上。 mapUrl = "".concat(url, ".json"); } FetchRequest.get(that.getRequestUrl(mapUrl), null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then(function (mapInfo) { that.getMapInfoSuccess(mapInfo); })["catch"](function (error) { that.errorCallback && that.errorCallback(error, 'getMapFaild', that.map); }); } /** * @private * @function ol.supermap.WebMap.prototype.getMapInfoSuccess * @description 获取地图的json信息 * @param {Object} mapInfo - webMap对象 */ }, { key: "getMapInfoSuccess", value: function () { var _getMapInfoSuccess = _asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee(mapInfo) { var that, handleResult; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: that = this; if (!(mapInfo.succeed === false)) { _context.next = 4; break; } that.errorCallback && that.errorCallback(mapInfo.error, 'getMapFaild', that.map); return _context.abrupt("return"); case 4: _context.next = 6; return that.handleCRS(mapInfo.projection, mapInfo.baseLayer.url); case 6: handleResult = _context.sent; //存储地图的名称以及描述等信息,返回给用户 that.mapParams = { title: mapInfo.title, description: mapInfo.description }; if (!(handleResult.action === "BrowseMap")) { _context.next = 12; break; } that.createSpecLayer(mapInfo); _context.next = 27; break; case 12: if (!(handleResult.action === "OpenMap")) { _context.next = 25; break; } that.baseProjection = handleResult.newCrs || mapInfo.projection; that.webMapVersion = mapInfo.version; that.baseLayer = mapInfo.baseLayer; // that.mapParams = { // title: mapInfo.title, // description: mapInfo.description // }; //存储地图的名称以及描述等信息,返回给用户 if (!(mapInfo.baseLayer && mapInfo.baseLayer.layerType === 'MAPBOXSTYLE')) { _context.next = 20; break; } // 添加矢量瓦片服务作为底图 that.addMVTMapLayer(mapInfo, mapInfo.baseLayer, 0).then(function () { that.createView(mapInfo); if (!mapInfo.layers || mapInfo.layers.length === 0) { that.sendMapToUser(0); } else { that.addLayers(mapInfo); } }); _context.next = 23; break; case 20: _context.next = 22; return that.addBaseMap(mapInfo); case 22: if (!mapInfo.layers || mapInfo.layers.length === 0) { that.sendMapToUser(0); } else { that.addLayers(mapInfo); } case 23: _context.next = 27; break; case 25: // 不支持的坐标系 that.errorCallback && that.errorCallback({ type: "Not support CS", errorMsg: "Not support CS: ".concat(mapInfo.projection) }, 'getMapFaild', that.map); return _context.abrupt("return"); case 27: case "end": return _context.stop(); } } }, _callee, this); })); function getMapInfoSuccess(_x) { return _getMapInfoSuccess.apply(this, arguments); } return getMapInfoSuccess; }() /** * 处理坐标系 * @private * @param {string} crs 必传参数,值是webmap2中定义的坐标系,可能是 1、EGSG:xxx 2、WKT string * @param {string} baseLayerUrl 可选参数,地图的服务地址;用于EPSG:-1 的时候,用于请求iServer提供的wkt * @return {Object} */ }, { key: "handleCRS", value: function () { var _handleCRS = _asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee3(crs, baseLayerUrl) { var that, handleResult, newCrs, action; return regenerator_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: that = this, handleResult = {}; newCrs = crs, action = "OpenMap"; if (!(crs === "EPSG:-1")) { _context3.next = 7; break; } _context3.next = 5; return FetchRequest.get(that.getRequestUrl("".concat(baseLayerUrl, "/prjCoordSys.wkt")), null, { withCredentials: that.withCredentials, withoutFormatSuffix: true }).then(function (response) { return response.text(); }).then( /*#__PURE__*/function () { var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee2(result) { return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: if (!(result.indexOf("") === -1)) { _context2.next = 5; break; } that.addProjctionFromWKT(result, "EPSG:-1"); handleResult = { action: action, newCrs: newCrs }; _context2.next = 6; break; case 5: throw 'ERROR'; case 6: case "end": return _context2.stop(); } } }, _callee2); })); return function (_x4) { return _ref2.apply(this, arguments); }; }())["catch"](function () { action = "BrowseMap"; handleResult = { action: action, newCrs: newCrs }; }); case 5: _context3.next = 9; break; case 7: if (crs.indexOf("EPSG") === 0 && crs.split(":")[1] <= 0) { // 自定义坐标系 rest map EPSG:-1(自定义坐标系) 支持编辑 // 未知坐标系情况特殊处理,只支持预览 1、rest map EPSG:-1000(没定义坐标系) 2、wms/wmts EPSG:0 (自定义坐标系) action = "BrowseMap"; } else if (crs === 'EPSG:910111' || crs === 'EPSG:910112') { // 早期数据存在的自定义坐标系 "EPSG:910111": "GCJ02MERCATOR", "EPSG:910112": "BDMERCATOR" newCrs = "EPSG:3857"; } else if (crs === 'EPSG:910101' || crs === 'EPSG:910102') { // 早期数据存在的自定义坐标系 "EPSG:910101": "GCJ02", "EPSG:910102": "BD", newCrs = "EPSG:4326"; } else if (crs.indexOf("EPSG") !== 0) { // wkt that.addProjctionFromWKT(newCrs); newCrs = that.getEpsgInfoFromWKT(crs); } handleResult = { action: action, newCrs: newCrs }; case 9: return _context3.abrupt("return", handleResult); case 10: case "end": return _context3.stop(); } } }, _callee3, this); })); function handleCRS(_x2, _x3) { return _handleCRS.apply(this, arguments); } return handleCRS; }() /** * @private * @function ol.supermap.WebMap.prototype.getScales * @description 根据级别获取每个级别对应的分辨率 * @param {Object} baseLayerInfo - 底图的图层信息 */ }, { key: "getScales", value: function getScales(baseLayerInfo) { var _this3 = this; var scales = [], resolutions = {}, res, scale, resolutionArray = [], coordUnit = baseLayerInfo.coordUnit || external_ol_proj_["get"](baseLayerInfo.projection).getUnits(); if (!coordUnit) { coordUnit = this.baseProjection === "EPSG:3857" ? "m" : "degree"; } if (baseLayerInfo.visibleScales && baseLayerInfo.visibleScales.length > 0) { //底部设置过固定比例尺,则使用设置的 baseLayerInfo.visibleScales.forEach(function (scale) { var value = 1 / scale; res = _this3.getResFromScale(value, coordUnit); scale = "1:".concat(value.toLocaleString()); //多此一举转换,因为toLocalString会自动保留小数点后三位,and当第二位小数是0就会保存小数点后两位。所有为了统一。 resolutions[_this3.formatScale(scale)] = res; resolutionArray.push(res); scales.push(scale); }, this); } else if (baseLayerInfo.layerType === 'WMTS') { baseLayerInfo.scales.forEach(function (scale) { res = _this3.getResFromScale(scale, coordUnit, 90.7); scale = "1:".concat(scale.toLocaleString()); //多此一举转换,因为toLocalString会自动保留小数点后三位,and当第二位小数是0就会保存小数点后两位。所有为了统一。 resolutions[_this3.formatScale(scale)] = res; resolutionArray.push(res); scales.push(scale); }, this); } else { var _baseLayerInfo$minZoo = baseLayerInfo.minZoom, minZoom = _baseLayerInfo$minZoo === void 0 ? 0 : _baseLayerInfo$minZoo, _baseLayerInfo$maxZoo = baseLayerInfo.maxZoom, maxZoom = _baseLayerInfo$maxZoo === void 0 ? 22 : _baseLayerInfo$maxZoo, view = this.map.getView(); for (var i = minZoom; i <= maxZoom; i++) { res = view.getResolutionForZoom(i); scale = this.getScaleFromRes(res, coordUnit); if (scales.indexOf(scale) === -1) { //不添加重复的比例尺 scales.push(scale); var attr = scale.replace(/,/g, ""); resolutions[attr] = res; resolutionArray.push(res); } } } this.scales = scales; this.resolutions = resolutions; this.resolutionArray = resolutionArray; } /** * @private * @function ol.supermap.WebMap.prototype.getResFromScale * @description 将比例尺转换为分辨率 * @param {Number} scale - 比例尺 * @param {String} coordUnit - 比例尺单位 * @param {Number} dpi */ }, { key: "getResFromScale", value: function getResFromScale(scale) { var coordUnit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "DEGREE"; var dpi = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 96; var mpu = metersPerUnit[coordUnit.toUpperCase()]; return scale * .0254 / dpi / mpu; } /** * @private * @function ol.supermap.WebMap.prototype.getScaleFromRes * @description 将分辨率转换为比例尺 * @param {Number} resolution - 分辨率 * @param {String} coordUnit - 比例尺单位 * @param {Number} dpi */ }, { key: "getScaleFromRes", value: function getScaleFromRes(resolution) { var coordUnit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "DEGREE"; var dpi = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 96; var scale, mpu = metersPerUnit[coordUnit.toUpperCase()]; scale = resolution * dpi * mpu / .0254; return '1:' + scale.toLocaleString(); } /** * @private * @function ol.supermap.WebMap.prototype.formatScale * @description 将有千位符的数字转为普通数字。例如:1,234 => 1234 * @param {number} scale - 比例尺分母 */ }, { key: "formatScale", value: function formatScale(scale) { return scale.replace(/,/g, ""); } /** * @private * @function ol.supermap.WebMap.prototype.createSpecLayer * @description 创建坐标系为0和-1000的图层 * @param {object} mapInfo - 地图信息 */ }, { key: "createSpecLayer", value: function createSpecLayer(mapInfo) { var me = this, baseLayerInfo = mapInfo.baseLayer, url = baseLayerInfo.url, baseLayerType = baseLayerInfo.layerType; var extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y]; var proj = new external_ol_proj_["Projection"]({ extent: extent, units: 'm', code: 'EPSG:0' }); external_ol_proj_["addProjection"](proj); var options = { center: mapInfo.center, level: 0 }; //添加view me.baseProjection = proj; var viewOptions = { center: options.center ? [options.center.x, options.center.y] : [0, 0], zoom: 0, projection: proj }; if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) < 0) { // 兼容 ol 4,5,6 viewOptions.multiWorld = true; } var view = new external_ol_View_default.a(viewOptions); me.map.setView(view); if (me.mapParams) { me.mapParams.extent = extent; me.mapParams.projection = mapInfo.projection; } if (url && url.indexOf("?token=") > -1) { //兼容iserver地址有token的情况 me.credentialKey = 'token'; me.credentialValue = mapInfo.baseLayer.credential = url.split("?token=")[1]; url = url.split("?token=")[0]; } var source; if (baseLayerType === "TILE") { FetchRequest.get(me.getRequestUrl("".concat(url, ".json")), null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then(function (result) { baseLayerInfo.originResult = result; var serverType = "IPORTAL", credential = baseLayerInfo.credential, keyfix = 'Token', keyParams = baseLayerInfo.url; if (baseLayerInfo.url.indexOf("www.supermapol.com") > -1 || baseLayerInfo.url.indexOf("itest.supermapol.com") > -1) { keyfix = 'Key'; keyParams = [keyParams]; serverType = "ONLINE"; } if (credential) { SecurityManager_SecurityManager["register".concat(keyfix)](keyParams, credential); } var options = { serverType: serverType, url: url, tileGrid: TileSuperMapRest_TileSuperMapRest.optionsFromMapJSON(url, result).tileGrid }; if (url && !me.isSameDomain(url)) { options.tileProxy = me.server + 'apps/viewer/getUrlResource.png?url='; } source = new TileSuperMapRest_TileSuperMapRest(options); me.addSpecToMap(source); })["catch"](function (error) { me.errorCallback && me.errorCallback(error, 'getMapFaild', me.map); }); } else if (baseLayerType === "WMS") { source = me.createWMSSource(baseLayerInfo); me.addSpecToMap(source); } else if (baseLayerType === "WMTS") { FetchRequest.get(me.getRequestUrl(url, true), null, { withCredentials: this.withCredentials }).then(function (response) { return response.text(); }).then(function (capabilitiesText) { baseLayerInfo.extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y]; baseLayerInfo.scales = me.getWMTSScales(baseLayerInfo.tileMatrixSet, capabilitiesText); baseLayerInfo.dpi = dpiConfig.iServerWMTS; source = me.createWMTSSource(baseLayerInfo); me.addSpecToMap(source); })["catch"](function (error) { me.errorCallback && me.errorCallback(error, 'getMapFaild', me.map); }); } else { me.errorCallback && me.errorCallback({ type: "Not support CS", errorMsg: "Not support CS: ".concat(baseLayerType) }, 'getMapFaild', me.map); } view && view.fit(extent); } /** * @private * @function ol.supermap.WebMap.prototype.addSpecToMap * @description 将坐标系为0和-1000的图层添加到地图上 * @param {object} mapInfo - 地图信息 */ }, { key: "addSpecToMap", value: function addSpecToMap(source) { var layer = new external_ol_layer_["Tile"]({ source: source, zIndex: 0 }); this.map.addLayer(layer); this.sendMapToUser(0); } /** * @private * @function ol.supermap.WebMap.prototype.getWMTSScales * @description 获取wmts的比例尺 * @param {object} identifier - 图层存储的标识信息 * @param {object} capabilitiesText - wmts信息 */ }, { key: "getWMTSScales", value: function getWMTSScales(identifier, capabilitiesText) { var format = new external_ol_format_WMTSCapabilities_default.a(); var capabilities = format.read(capabilitiesText); var content = capabilities.Contents, tileMatrixSet = content.TileMatrixSet; var scales = []; for (var i = 0; i < tileMatrixSet.length; i++) { if (tileMatrixSet[i].Identifier === identifier) { for (var h = 0; h < tileMatrixSet[i].TileMatrix.length; h++) { scales.push(tileMatrixSet[i].TileMatrix[h].ScaleDenominator); } break; } } return scales; } /** * @private * @function ol.supermap.WebMap.prototype.addBaseMap * @description 添加底图 * @param {string} mapInfo - 请求地图的url */ }, { key: "addBaseMap", value: function () { var _addBaseMap = _asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee4(mapInfo) { var baseLayer, layerType, layer, labelLayer; return regenerator_default.a.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: baseLayer = mapInfo.baseLayer, layerType = baseLayer.layerType; //底图,使用默认的配置,不用存储的 if (!(layerType !== 'TILE' && layerType !== 'WMS' && layerType !== 'WMTS')) { _context4.next = 5; break; } this.getInternetMapInfo(baseLayer); _context4.next = 13; break; case 5: if (!(layerType === 'WMTS')) { _context4.next = 10; break; } _context4.next = 8; return this.getWmtsInfo(baseLayer); case 8: _context4.next = 13; break; case 10: if (!(layerType === 'TILE')) { _context4.next = 13; break; } _context4.next = 13; return this.getTileInfo(baseLayer); case 13: baseLayer.projection = mapInfo.projection; if (!baseLayer.extent) { baseLayer.extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y]; } this.createView(mapInfo); layer = this.createBaseLayer(baseLayer, 0, null, null, true); //底图增加图层类型,DV分享需要用它来识别版权信息 layer.setProperties({ layerType: layerType }); this.map.addLayer(layer); if (this.mapParams) { this.mapParams.extent = baseLayer.extent; this.mapParams.projection = mapInfo.projection; } if (baseLayer.labelLayerVisible) { //存在天地图路网 labelLayer = new external_ol_layer_["Tile"]({ source: this.createTiandituSource(baseLayer.layerType, mapInfo.projection, true), zIndex: baseLayer.zIndex || 1, visible: baseLayer.visible }); this.map.addLayer(labelLayer); // 挂载带baseLayer上,便于删除 baseLayer.labelLayer = labelLayer; } case 21: case "end": return _context4.stop(); } } }, _callee4, this); })); function addBaseMap(_x5) { return _addBaseMap.apply(this, arguments); } return addBaseMap; }() /** * @private * @function ol.supermap.WebMap.prototype.addMVTMapLayer * @description 添加地图服务mapboxstyle图层 * @param {object} mapInfo - 地图信息 * @param {object} layerInfo - mapboxstyle图层信息 */ }, { key: "addMVTMapLayer", value: function addMVTMapLayer(mapInfo, layerInfo, zIndex) { var _this4 = this; layerInfo.zIndex = zIndex; // 获取地图详细信息 return this.getMapboxStyleLayerInfo(mapInfo, layerInfo).then(function (msLayerInfo) { // 创建图层 return _this4.createMVTLayer(msLayerInfo).then(function (layer) { var layerID = core_Util_Util.newGuid(8); if (layerInfo.name) { layer.setProperties({ name: layerInfo.name, layerID: layerID, layerType: 'VECTOR_TILE' }); } layerInfo.visibleScale && _this4.setVisibleScales(layer, layerInfo.visibleScale); //否则没有ID,对不上号 layerInfo.layer = layer; layerInfo.layerID = layerID; _this4.map.addLayer(layer); }); }); } /** * @private * @function ol.supermap.WebMap.prototype.createView * @description 创建地图视图 * @param {object} options - 关于地图的信息 */ }, { key: "createView", value: function createView(options) { var oldcenter = options.center, zoom = options.level !== undefined ? options.level : 1, maxZoom = options.maxZoom || 22, extent, projection = this.baseProjection; var center = []; for (var key in oldcenter) { center.push(oldcenter[key]); } if (center.length === 0) { //兼容wms center = [0, 0]; } //与DV一致用底图的默认范围,不用存储的范围。否则会导致地图拖不动 this.baseLayerExtent = extent = options.baseLayer && options.baseLayer.extent; if (this.mapParams) { this.mapParams.extent = extent; this.mapParams.projection = projection; } //当前中心点不在extent内,就用extent的中心点 todo !Object(external_ol_extent_["containsCoordinate"])(extent, center) && (center = Object(external_ol_extent_["getCenter"])(extent)); // 计算当前最大分辨率 var baseLayer = options.baseLayer; var maxResolution, minResolution; if (baseLayer.visibleScales && baseLayer.visibleScales.length > 0 || baseLayer.scales && baseLayer.scales.length > 0) { //底图有固定比例尺,就直接获取。不用view计算 this.getScales(baseLayer); } else if (options.baseLayer && ['TILE', 'VECTOR_TILE'].indexOf(options.baseLayer.layerType) > -1 && extent && extent.length === 4) { var width = extent[2] - extent[0]; var height = extent[3] - extent[1]; var maxResolution1 = width / 512; var maxResolution2 = height / 512; maxResolution = Math.max(maxResolution1, maxResolution2); } // if(options.baseLayer.visibleScales && options.baseLayer.visibleScales.length > 0){ // maxZoom = options.baseLayer.visibleScales.length; // } var viewOptions = {}; if (baseLayer.layerType === "WMTS") { if (baseLayer.scales && baseLayer.scales.length > 0) { //因为新版extent超出,不可见。所以将extent去除 viewOptions = { zoom: zoom, center: center, projection: projection, resolutions: this.resolutionArray, maxZoom: maxZoom }; } else { viewOptions = { zoom: zoom, center: center, projection: projection, maxZoom: maxZoom }; this.getScales(baseLayer); } } else { if (this.resolutionArray && this.resolutionArray.length > 0) { viewOptions = { zoom: zoom, center: center, projection: projection, resolutions: this.resolutionArray, maxZoom: maxZoom }; } else { viewOptions = { zoom: zoom, center: center, projection: projection, maxResolution: maxResolution, minResolution: minResolution, maxZoom: maxZoom }; this.getScales(baseLayer); } } if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) < 0) { // 兼容 ol 4,5,6 viewOptions.multiWorld = true; viewOptions.showFullExtent = true; viewOptions.enableRotation = false; viewOptions.constrainResolution = true; //设置此参数,是因为需要显示整数级别。为了可视比例尺中包含当前比例尺 } this.map.setView(new external_ol_View_default.a(viewOptions)); if (options.visibleExtent) { var view = this.map.getView(); var resolution = view.getResolutionForExtent(options.visibleExtent, this.map.getSize()); view.setResolution(resolution); view.setCenter(Object(external_ol_extent_["getCenter"])(options.visibleExtent)); } } /** * @private * @function ol.supermap.WebMap.prototype.createBaseLayer * @description 创建矢量图层,包括底图及其叠加的矢量图层 * @param {object} layerInfo - 关于地图的信息 * @param {number} index - 当前图层在地图中的index * @param {boolean} isCallBack - 是否调用回调函数 * @param {scope} {object} this对象 */ }, { key: "createBaseLayer", value: function createBaseLayer(layerInfo, index, isCallBack, scope, isBaseLayer) { var source, that = this; if (scope) { // 解决异步回调 that = scope; } var layerType = layerInfo.layerType; //底图和rest地图兼容 if (layerType.indexOf('TIANDITU_VEC') > -1 || layerType.indexOf('TIANDITU_IMG') > -1 || layerType.indexOf('TIANDITU_TER') > -1) { layerType = layerType.substr(0, 12); } switch (layerType) { case "TIANDITU_VEC": case "TIANDITU_IMG": case "TIANDITU_TER": source = this.createTiandituSource(layerType, layerInfo.projection); break; case "BAIDU": source = this.createBaiduSource(); break; case 'BING': source = this.createBingSource(layerInfo, layerInfo.projection); break; case "WMS": source = this.createWMSSource(layerInfo); break; case "WMTS": source = that.createWMTSSource(layerInfo); break; case 'TILE': case 'SUPERMAP_REST': source = that.createDynamicTiledSource(layerInfo, isBaseLayer); break; case 'CLOUD': case 'CLOUD_BLACK': case 'OSM': case 'JAPAN_ORT': case 'JAPAN_RELIEF': case 'JAPAN_PALE': case 'JAPAN_STD': case 'GOOGLE_CN': case 'GOOGLE': source = this.createXYZSource(layerInfo); break; default: break; } var layer = new external_ol_layer_["Tile"]({ source: source, zIndex: layerInfo.zIndex || 1, visible: layerInfo.visible }); var layerID = core_Util_Util.newGuid(8); if (layerInfo.name) { layer.setProperties({ name: layerInfo.name, layerID: layerID }); } if (layerInfo.visible === undefined || layerInfo.visible === null) { layerInfo.visible = true; } layer.setVisible(layerInfo.visible); layerInfo.opacity && layer.setOpacity(layerInfo.opacity); //layerInfo没有存储index属性 index && layer.setZIndex(index); //否则没有ID,对不上号 layerInfo.layer = layer; layerInfo.layerID = layerID; var visibleScale = layerInfo.visibleScale, autoUpdateTime = layerInfo.autoUpdateTime, minResolution, maxResolution; if (visibleScale) { maxResolution = this.resolutions[visibleScale.minScale]; minResolution = this.resolutions[visibleScale.maxScale]; //比例尺和分别率是反比的关系 maxResolution > 1 ? layer.setMaxResolution(Math.ceil(maxResolution)) : layer.setMaxResolution(maxResolution * 1.1); layer.setMinResolution(minResolution); } if (autoUpdateTime && !layerInfo.autoUpdateInterval) { //自动更新 layerInfo.autoUpdateInterval = setInterval(function () { that.updateTileToMap(layerInfo, index); }, autoUpdateTime); } if (isCallBack) { layer.setZIndex(0); // wmts that.map.addLayer(layer); } return layer; } /** * @private * @function ol.supermap.WebMap.prototype.updateTileToMap * @description 获取底图对应的图层信息,不是用请求回来的底图信息 * @param {object} layerInfo - 图层信息 * @param {number} layerIndex - 图层index */ }, { key: "updateTileToMap", value: function updateTileToMap(layerInfo, layerIndex) { this.map.removeLayer(layerInfo.layer); this.map.addLayer(this.createBaseLayer(layerInfo, layerIndex)); } /** * @private * @function ol.supermap.WebMap.prototype.getInternetMapInfo * @description 获取底图对应的图层信息,不是用请求回来的底图信息 * @param {object} baseLayerInfo - 底图信息 * @returns {Object} 底图的具体信息 */ }, { key: "getInternetMapInfo", value: function getInternetMapInfo(baseLayerInfo) { var baiduBounds = [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892]; var bounds_4326 = [-180, -90, 180, 90]; var osmBounds = [-20037508.34, -20037508.34, 20037508.34, 20037508.34]; var japanReliefBounds = [12555667.53929, 1281852.98656, 17525908.86651, 7484870.70596]; var japanOrtBounds = [-19741117.14519, -10003921.36848, 19981677.71404, 19660983.56089]; baseLayerInfo.units = "m"; switch (baseLayerInfo.layerType) { case 'BAIDU': baseLayerInfo.iServerUrl = 'https://map.baidu.com/'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 1; baseLayerInfo.maxZoom = 19; baseLayerInfo.level = 1; baseLayerInfo.extent = baiduBounds; // thumbnail: this.getImagePath('bmap.png') 暂时不用到缩略图 break; case 'CLOUD': baseLayerInfo.url = 'http://t2.dituhui.com/FileService/image?map=quanguo&type=web&x={x}&y={y}&z={z}'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 1; baseLayerInfo.maxZoom = 18; baseLayerInfo.level = 1; baseLayerInfo.extent = baiduBounds; break; case 'CLOUD_BLACK': baseLayerInfo.url = 'http://t3.dituhui.com/MapService/getGdp?x={x}&y={y}&z={z}'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 1; baseLayerInfo.maxZoom = 18; baseLayerInfo.level = 1; baseLayerInfo.extent = baiduBounds; break; case 'tencent': baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 1; baseLayerInfo.maxZoom = 18; baseLayerInfo.level = 1; baseLayerInfo.extent = baiduBounds; break; case 'TIANDITU_VEC_3857': case 'TIANDITU_IMG_3857': case 'TIANDITU_TER_3857': baseLayerInfo.iserverUrl = 'https://map.tianditu.gov.cn/'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 0; baseLayerInfo.maxZoom = 19; baseLayerInfo.level = 1; baseLayerInfo.extent = baiduBounds; if (baseLayerInfo.layerType === "TIANDITU_TER_3857") { baseLayerInfo.maxZoom = 14; } break; case 'TIANDITU_VEC_4326': case 'TIANDITU_IMG_4326': case 'TIANDITU_TER_4326': baseLayerInfo.iserverUrl = 'https://map.tianditu.gov.cn/'; baseLayerInfo.epsgCode = 'EPSG:4326'; baseLayerInfo.minZoom = 0; baseLayerInfo.maxZoom = 19; baseLayerInfo.level = 1; baseLayerInfo.extent = bounds_4326; if (baseLayerInfo.layerType === "TIANDITU_TER_4326") { baseLayerInfo.maxZoom = 14; } break; case 'OSM': baseLayerInfo.url = 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 1; baseLayerInfo.maxZoom = 19; baseLayerInfo.level = 1; baseLayerInfo.extent = osmBounds; baseLayerInfo.iserverUrl = 'https://www.openstreetmap.org'; break; case 'GOOGLE': baseLayerInfo.url = 'https://www.google.cn/maps/vt/pb=!1m4!1m3!1i{z}!2i{x}!3i{y}!2m3!1e0!2sm!3i380072576!3m8!2szh-CN!3scn!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0!5m1!1e0'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 1; baseLayerInfo.maxZoom = 22; baseLayerInfo.level = 1; baseLayerInfo.extent = osmBounds; baseLayerInfo.iserverUrl = 'https://www.google.cn/maps'; break; case 'JAPAN_STD': baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 1; baseLayerInfo.maxZoom = 19; baseLayerInfo.level = 0; baseLayerInfo.extent = osmBounds; break; case 'JAPAN_PALE': baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 2; baseLayerInfo.maxZoom = 19; baseLayerInfo.level = 2; baseLayerInfo.extent = osmBounds; break; case 'JAPAN_RELIEF': baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/relief/{z}/{x}/{y}.png'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 5; baseLayerInfo.maxZoom = 14; baseLayerInfo.level = 5; baseLayerInfo.extent = japanReliefBounds; break; case 'JAPAN_ORT': baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg'; baseLayerInfo.epsgCode = 'EPSG:3857'; baseLayerInfo.minZoom = 2; baseLayerInfo.maxZoom = 12; baseLayerInfo.level = 2; baseLayerInfo.extent = japanOrtBounds; break; } } /** * @private * @function ol.supermap.WebMap.prototype.createDynamicTiledSource * @description 获取supermap iServer类型的地图的source。 * @param {object} layerInfo * @param {boolean} isBaseLayer 是否是底图 */ }, { key: "createDynamicTiledSource", value: function createDynamicTiledSource(layerInfo, isBaseLayer) { var serverType = "IPORTAL", credential = layerInfo.credential ? layerInfo.credential.token : undefined, keyfix = 'Token', keyParams = layerInfo.url; if (layerInfo.url.indexOf("www.supermapol.com") > -1 || layerInfo.url.indexOf("itest.supermapol.com") > -1) { keyfix = 'Key'; keyParams = [keyParams]; serverType = "ONLINE"; } if (credential) { SecurityManager_SecurityManager["register".concat(keyfix)](keyParams, credential); } // extent: isBaseLayer ? layerInfo.extent : ol.proj.transformExtent(layerInfo.extent, layerInfo.projection, this.baseProjection), var options = { transparent: true, url: layerInfo.url, wrapX: false, serverType: serverType, // crossOrigin: 'anonymous', //在IE11.0.9600版本,会影响通过注册服务打开的iserver地图,不出图。因为没有携带cookie会报跨域问题 // extent: this.baseLayerExtent, // prjCoordSys: {epsgCode: isBaseLayer ? layerInfo.projection.split(':')[1] : this.baseProjection.split(':')[1]}, format: layerInfo.format }; if (!isBaseLayer && this.baseProjection !== "EPSG:-1") { options.prjCoordSys = { epsgCode: this.baseProjection.split(':')[1] }; } if (layerInfo.visibleScales && layerInfo.visibleScales.length > 0) { var visibleResolutions = []; for (var i in layerInfo.visibleScales) { var resolution = core_Util_Util.scaleToResolution(layerInfo.visibleScales[i], dpiConfig["default"], layerInfo.coordUnit); visibleResolutions.push(resolution); } layerInfo.visibleResolutions = visibleResolutions; var tileGrid = new external_ol_tilegrid_TileGrid_default.a({ extent: layerInfo.extent, resolutions: visibleResolutions }); options.tileGrid = tileGrid; } else { options.extent = this.baseLayerExtent; //bug:ISVJ-2412,不添加下列代码出不了图。参照iserver ol3出图方式 var _tileGrid = new external_ol_tilegrid_TileGrid_default.a({ extent: layerInfo.extent, resolutions: this.getResolutionsFromBounds(layerInfo.extent) }); options.tileGrid = _tileGrid; } //主机名相同时不添加代理 if (layerInfo.url && !this.isSameDomain(layerInfo.url)) { options.tileProxy = this.server + 'apps/viewer/getUrlResource.png?url='; } var source = new TileSuperMapRest_TileSuperMapRest(options); SecurityManager_SecurityManager["register".concat(keyfix)](layerInfo.url); return source; } /** * @private * @function ol.supermap.WebMap.prototype.getResolutionsFromBounds * @description 获取比例尺数组 * @param bounds {Array} 范围数组 * @returns {styleResolutions} 比例尺数组 */ }, { key: "getResolutionsFromBounds", value: function getResolutionsFromBounds(bounds) { var styleResolutions = []; var temp = Math.abs(bounds[0] - bounds[2]) / 512; for (var i = 0; i < 22; i++) { if (i === 0) { styleResolutions[i] = temp; continue; } temp = temp / 2; styleResolutions[i] = temp; } return styleResolutions; } /** * @private * @function ol.supermap.WebMap.prototype.createTiandituSource * @description 创建天地图的source。 * @param layerType 图层类型 * @param projection 地理坐标系 * @param isLabel 是否有路网图层 * @returns {ol.source.Tianditu} 天地图的source */ }, { key: "createTiandituSource", value: function createTiandituSource(layerType, projection, isLabel) { var options = { layerType: layerType.split('_')[1].toLowerCase(), isLabel: isLabel || false, projection: projection, url: "https://t{0-7}.tianditu.gov.cn/{layer}_{proj}/wmts?tk=".concat(this.tiandituKey) }; return new Tianditu_Tianditu(options); } /** * @private * @function ol.supermap.WebMap.prototype.createBaiduSource * @description 创建百度地图的source。 * @returns {ol.source.BaiduMap} baidu地图的source */ }, { key: "createBaiduSource", value: function createBaiduSource() { return new BaiduMap_BaiduMap(); } /** * @private * @function ol.supermap.WebMap.prototype.createBingSource * @description 创建bing地图的source。 * @returns {ol/source/XYZ} bing地图的source */ }, { key: "createBingSource", value: function createBingSource(layerInfo, projection) { var url = 'https://dynamic.t0.tiles.ditu.live.com/comp/ch/{quadKey}?it=G,TW,L,LA&mkt=zh-cn&og=109&cstl=w4c&ur=CN&n=z'; return new external_ol_source_["XYZ"]({ wrapX: false, projection: projection, crossOrigin: 'anonymous', tileUrlFunction: function tileUrlFunction(coordinates) { var _ref3 = WebMap_toConsumableArray(coordinates), z = _ref3[0], x = _ref3[1], y = _ref3[2]; y = y > 0 ? y - 1 : -y - 1; var index = ''; for (var i = z; i > 0; i--) { var b = 0; var mask = 1 << i - 1; if ((x & mask) !== 0) { b++; } if ((y & mask) !== 0) { b += 2; } index += b.toString(); } return url.replace('{quadKey}', index); } }); } /** * @private * @function ol.supermap.WebMap.prototype.createXYZSource * @description 创建图层的XYZsource。 * @param {Object} layerInfo - 图层信息 * @returns {ol/source/XYZ} xyz的source */ }, { key: "createXYZSource", value: function createXYZSource(layerInfo) { return new external_ol_source_["XYZ"]({ url: layerInfo.url, wrapX: false, crossOrigin: 'anonymous' }); } /** * @private * @function ol.supermap.WebMap.prototype.createWMSSource * @description 创建wms地图source。 * @param {Object} layerInfo - 图层信息。 * @returns {ol/source/TileWMS} wms的source */ }, { key: "createWMSSource", value: function createWMSSource(layerInfo) { var that = this; return new external_ol_source_["TileWMS"]({ url: layerInfo.url, wrapX: false, params: { LAYERS: layerInfo.layers ? layerInfo.layers[0] : "0", FORMAT: 'image/png' }, projection: layerInfo.projection || that.baseProjection, tileLoadFunction: function tileLoadFunction(imageTile, src) { imageTile.getImage().src = src; } }); } /** * @private * @function ol.supermap.WebMap.prototype.getTileLayerExtent * @description 获取(Supermap RestMap)的图层参数。 * @param {Object} layerInfo - 图层信息。 * @param {function} callback - 获得tile图层参数执行的回调函数 * @param {function} failedCallback - 失败回调函数 */ }, { key: "getTileLayerExtent", value: function () { var _getTileLayerExtent = _asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee5(layerInfo, callback, failedCallback) { var that, dynamicLayerInfo, originLayerInfo; return regenerator_default.a.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: that = this; // 默认使用动态投影方式请求数据 _context5.next = 3; return that.getTileLayerExtentInfo(layerInfo); case 3: dynamicLayerInfo = _context5.sent; if (!(dynamicLayerInfo.succeed === false)) { _context5.next = 15; break; } if (!(dynamicLayerInfo.error.code === 400)) { _context5.next = 12; break; } _context5.next = 8; return that.getTileLayerExtentInfo(layerInfo, false); case 8: originLayerInfo = _context5.sent; if (originLayerInfo.succeed === false) { failedCallback(); } else { Object.assign(layerInfo, originLayerInfo); callback(layerInfo); } _context5.next = 13; break; case 12: failedCallback(); case 13: _context5.next = 17; break; case 15: Object.assign(layerInfo, dynamicLayerInfo); callback(layerInfo); case 17: case "end": return _context5.stop(); } } }, _callee5, this); })); function getTileLayerExtent(_x6, _x7, _x8) { return _getTileLayerExtent.apply(this, arguments); } return getTileLayerExtent; }() /** * @private * @function ol.supermap.WebMap.prototype.getTileLayerExtentInfo * @description 获取rest map的图层参数。 * @param {Object} layerInfo - 图层信息。 * @param {Boolean} isDynamic - 是否请求动态投影信息 */ }, { key: "getTileLayerExtentInfo", value: function getTileLayerExtentInfo(layerInfo) { var isDynamic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var that = this, // token, url = layerInfo.url.trim(), credential = layerInfo.credential, options = { withCredentials: this.withCredentials, withoutFormatSuffix: true }; if (isDynamic) { var projection = { epsgCode: that.baseProjection.split(":")[1] }; if (that.baseProjection !== "EPSG:-1") { // bug IE11 不会自动编码 url += '.json?prjCoordSys=' + encodeURI(JSON.stringify(projection)); } } if (credential) { url = "".concat(url, "&token=").concat(encodeURI(credential.token)); // token = credential.token; } return FetchRequest.get(that.getRequestUrl("".concat(url, ".json")), null, options).then(function (response) { return response.json(); }).then( /*#__PURE__*/function () { var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee6(result) { return regenerator_default.a.wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: if (!(result.succeed === false)) { _context6.next = 2; break; } return _context6.abrupt("return", result); case 2: return _context6.abrupt("return", { units: result.coordUnit && result.coordUnit.toLowerCase(), coordUnit: result.coordUnit, visibleScales: result.visibleScales, extent: [result.bounds.left, result.bounds.bottom, result.bounds.right, result.bounds.top], projection: "EPSG:".concat(result.prjCoordSys.epsgCode), format: 'png' }); case 3: case "end": return _context6.stop(); } } }, _callee6); })); return function (_x9) { return _ref4.apply(this, arguments); }; }())["catch"](function (error) { return { succeed: false, error: error }; }); } /** * @private * @function ol.supermap.WebMap.prototype.getTileInfo * @description 获取rest map的图层参数。 * @param {Object} layerInfo - 图层信息。 * @param {function} callback - 获得wmts图层参数执行的回调函数 */ }, { key: "getTileInfo", value: function getTileInfo(layerInfo, callback, mapInfo) { var that = this; var options = { withCredentials: this.withCredentials, withoutFormatSuffix: true }; if (layerInfo.url.indexOf("?token=") > -1) { that.credentialKey = 'token'; that.credentialValue = layerInfo.credential = layerInfo.url.split("?token=")[1]; layerInfo.url = layerInfo.url.split("?token=")[0]; } return FetchRequest.get(that.getRequestUrl("".concat(layerInfo.url, ".json")), null, options).then(function (response) { return response.json(); }).then(function (result) { // layerInfo.projection = mapInfo.projection; // layerInfo.extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y]; // 比例尺 单位 if (result && result.code && result.code !== 200) { throw result; } if (result.visibleScales) { layerInfo.visibleScales = result.visibleScales; layerInfo.coordUnit = result.coordUnit; } layerInfo.maxZoom = result.maxZoom; layerInfo.maxZoom = result.minZoom; // let token = layerInfo.credential ? layerInfo.credential.token : undefined; // let isSupprtWebp = await that.isSupportWebp(layerInfo.url, token); // eslint-disable-next-line require-atomic-updates // layerInfo.format = isSupprtWebp ? 'webp' : 'png'; layerInfo.format = 'png'; // 请求结果完成 继续添加图层 if (mapInfo) { //todo 这个貌似没有用到,下次优化 callback && callback(mapInfo, null, true, that); } else { callback && callback(layerInfo); } })["catch"](function (error) { that.errorCallback && that.errorCallback(error, 'getTileInfo', that.map); }); } /** * @private * @function ol.supermap.WebMap.prototype.getWMTSUrl * @description 获取wmts请求文档的url * @param {string} url - 图层信息。 * @param {boolean} isKvp - 是否为kvp模式 */ }, { key: "getWMTSUrl", value: function getWMTSUrl(url, isKvp) { var splitStr = '?'; if (url.indexOf('?') > -1) { splitStr = '&'; } if (isKvp) { url += splitStr + 'SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities'; } else { url += splitStr + '/1.0.0/WMTSCapabilities.xml'; } return this.getRequestUrl(url, true); } /** * @private * @function ol.supermap.WebMap.prototype.getWmtsInfo * @description 获取wmts的图层参数。 * @param {Object} layerInfo - 图层信息。 * @param {function} callback - 获得wmts图层参数执行的回调函数 */ }, { key: "getWmtsInfo", value: function getWmtsInfo(layerInfo, callback) { var that = this; var options = { withCredentials: that.withCredentials, withoutFormatSuffix: true }; var isKvp = !layerInfo.requestEncoding || layerInfo.requestEncoding === 'KVP'; return FetchRequest.get(that.getWMTSUrl(layerInfo.url, isKvp), null, options).then(function (response) { return response.text(); }).then(function (capabilitiesText) { var format = new external_ol_format_WMTSCapabilities_default.a(); var capabilities = format.read(capabilitiesText); if (that.isValidResponse(capabilities)) { var content = capabilities.Contents, tileMatrixSet = content.TileMatrixSet, layers = content.Layer, layer, idx, layerFormat, style = 'default'; for (var n = 0; n < layers.length; n++) { if (layers[n].Identifier === layerInfo.layer) { idx = n; layer = layers[idx]; layerFormat = layer.Format[0]; var layerBounds = layer.WGS84BoundingBox; // tileMatrixSetLink = layer.TileMatrixSetLink; break; } } layer && layer.Style && layer.Style.forEach(function (value) { if (value.isDefault) { style = value.Identifier; } }); var scales = [], matrixIds = []; for (var i = 0; i < tileMatrixSet.length; i++) { if (tileMatrixSet[i].Identifier === layerInfo.tileMatrixSet) { var wmtsLayerEpsg = "EPSG:".concat(tileMatrixSet[i].SupportedCRS.split('::')[1]); for (var h = 0; h < tileMatrixSet[i].TileMatrix.length; h++) { scales.push(tileMatrixSet[i].TileMatrix[h].ScaleDenominator); matrixIds.push(tileMatrixSet[i].TileMatrix[h].Identifier); } //bug wmts出图需要加上origin,否则会出现出图不正确的情况。偏移或者瓦片出不了 var origin = tileMatrixSet[i].TileMatrix[0].TopLeftCorner; layerInfo.origin = ["EPSG:4326", "EPSG:4490"].indexOf(wmtsLayerEpsg) > -1 ? [origin[1], origin[0]] : origin; break; } } var name = layerInfo.name, extent; if (layerBounds) { extent = external_ol_proj_["transformExtent"](layerBounds, 'EPSG:4326', that.baseProjection); } else { extent = external_ol_proj_["get"](that.baseProjection).getExtent(); } layerInfo.tileUrl = that.getTileUrl(capabilities.OperationsMetadata.GetTile.DCP.HTTP.Get, layer, layerFormat, isKvp); //将需要的参数补上 layerInfo.extent = extent; layerInfo.name = name; layerInfo.orginEpsgCode = layerInfo.projection; layerInfo.overLayer = true; layerInfo.scales = scales; layerInfo.style = style; layerInfo.title = name; layerInfo.unit = "m"; layerInfo.layerFormat = layerFormat; layerInfo.matrixIds = matrixIds; callback && callback(layerInfo); } })["catch"](function (error) { that.errorCallback && that.errorCallback(error, 'getWmtsFaild', that.map); }); } /** * @private * @function ol.supermap.WebMap.prototype.getTileUrl * @description 获取wmts的图层参数。 * @param {array} getTileArray - 图层信息。 * @param {string} layer - 选择的图层 * @param {string} format - 选择的出图方式 * @param {boolean} isKvp - 是否是kvp方式 */ }, { key: "getTileUrl", value: function getTileUrl(getTileArray, layer, format, isKvp) { var url; if (isKvp) { getTileArray.forEach(function (data) { if (data.Constraint[0].AllowedValues.Value[0].toUpperCase() === 'KVP') { url = data.href; } }); } else { var reuslt = layer.ResourceURL.filter(function (resource) { return resource.format === format; }); url = reuslt[0].template; } return url; } /** * @private * @function ol.supermap.WebMap.prototype.createWMTSSource * @description 获取WMTS类型图层的source。 * @param {Object} layerInfo - 图层信息。 * @returns {ol/source/WMTS} wmts的souce */ }, { key: "createWMTSSource", value: function createWMTSSource(layerInfo) { var extent = layerInfo.extent || external_ol_proj_["get"](layerInfo.projection).getExtent(); // 单位通过坐标系获取 (PS: 以前代码非4326 都默认是米) var unit = external_ol_proj_["get"](this.baseProjection).getUnits(); return new external_ol_source_["WMTS"]({ url: layerInfo.tileUrl || layerInfo.url, layer: layerInfo.layer, format: layerInfo.layerFormat, style: layerInfo.style, matrixSet: layerInfo.tileMatrixSet, requestEncoding: layerInfo.requestEncoding || 'KVP', tileGrid: this.getWMTSTileGrid(extent, layerInfo.scales, unit, layerInfo.dpi, layerInfo.origin, layerInfo.matrixIds), tileLoadFunction: function tileLoadFunction(imageTile, src) { imageTile.getImage().src = src; } }); } /** * @private * @function ol.supermap.WebMap.prototype.getWMTSTileGrid * @description 获取wmts的瓦片。 * @param {Object} extent - 图层范围。 * @param {number} scales - 图层比例尺 * @param {string} unit - 单位 * @param {number} dpi - dpi * @param {Array} origin 瓦片的原点 * @returns {ol/tilegrid/WMTS} wmts的瓦片 */ }, { key: "getWMTSTileGrid", value: function getWMTSTileGrid(extent, scales, unit, dpi, origin, matrixIds) { var resolutionsInfo = this.getReslutionsFromScales(scales, dpi || dpiConfig.iServerWMTS, unit); return new external_ol_tilegrid_WMTS_default.a({ origin: origin, extent: extent, resolutions: resolutionsInfo.res, matrixIds: matrixIds || resolutionsInfo.matrixIds }); } /** * @private * @function ol.supermap.WebMap.prototype.getReslutionsFromScales * @description 根据比例尺(比例尺分母)、地图单位、dpi、获取一个分辨率数组 * @param {array} scales - 比例尺(比例尺分母) * @param {number} dpi - 地图dpi * @param {string} unit - 单位 * @param {number} datumAxis * @returns {{res: Array, matrixIds: Array}} */ }, { key: "getReslutionsFromScales", value: function getReslutionsFromScales(scales, dpi, unit, datumAxis) { unit = unit && unit.toLowerCase() || 'degrees'; dpi = dpi || dpiConfig.iServerWMTS; datumAxis = datumAxis || 6370997; var res = [], matrixIds = []; //给个默认的 if (core_Util_Util.isArray(scales)) { scales && scales.forEach(function (scale, idx) { if (scale > 1.0) { matrixIds.push(idx); res.push(this.getResolutionFromScale(scale, dpi, unit, datumAxis)); } }, this); } else { var tileMatrixSet = scales['TileMatrix']; tileMatrixSet && tileMatrixSet.forEach(function (tileMatrix) { matrixIds.push(tileMatrix['Identifier']); res.push(this.getResolutionFromScale(tileMatrix['ScaleDenominator'], dpi, unit, datumAxis)); }, this); } return { res: res, matrixIds: matrixIds }; } /** * @private * @function ol.supermap.WebMap.prototype.getResolutionFromScale * @description 获取一个WMTS source需要的tileGrid * @param {number} scale - 比例尺(比例尺分母) * @param {number} dpi - 地图dpi * @param {string} unit - 单位 * @param {number} datumAxis * @returns {{res: Array, matrixIds: Array}} */ }, { key: "getResolutionFromScale", value: function getResolutionFromScale(scale) { var dpi = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : dpiConfig["default"]; var unit = arguments.length > 2 ? arguments[2] : undefined; var datumAxis = arguments.length > 3 ? arguments[3] : undefined; //radio = 10000; var res; scale = +scale; scale = scale > 1.0 ? 1.0 / scale : scale; if (unit === 'degrees' || unit === 'dd' || unit === 'degree') { res = 0.0254 * 10000 / dpi / scale / (Math.PI * 2 * datumAxis / 360) / 10000; } else { res = 0.0254 * 10000 / dpi / scale / 10000; } return res; } /** * @private * @function ol.supermap.WebMap.prototype.isValidResponse * @description 返回信息是否符合对应类型的标准 * @param {object} response - 返回的信息 * @returns {boolean} */ }, { key: "isValidResponse", value: function isValidResponse(response) { var responseEnum = ['Contents', 'OperationsMetadata'], valid = true; for (var i = 0; i < responseEnum.length; i++) { if (!response[responseEnum[i]] || response.error) { valid = false; break; } } return valid; } /** * @private * @function ol.supermap.WebMap.prototype.addLayers * @description 添加叠加图层 * @param {object} mapInfo - 地图信息 */ }, { key: "addLayers", value: function addLayers(mapInfo) { var layers = mapInfo.layers, that = this; var features = [], len = layers.length; if (len > 0) { //存储地图上所有的图层对象 this.layers = layers; layers.forEach(function (layer, index) { //加上底图的index var layerIndex = index + 1, dataSource = layer.dataSource, isSampleData = dataSource && dataSource.type === "SAMPLE_DATA" && !!dataSource.name; //SAMPLE_DATA是本地示例数据 if (layer.layerType === "MAPBOXSTYLE") { that.addMVTMapLayer(mapInfo, layer, layerIndex).then(function () { that.layerAdded++; that.sendMapToUser(len); }); } else if (dataSource && dataSource.serverId || layer.layerType === "MARKER" || layer.layerType === 'HOSTED_TILE' || isSampleData) { //数据存储到iportal上了 var _dataSource = layer.dataSource, serverId = _dataSource ? _dataSource.serverId : layer.serverId; if (!serverId && !isSampleData) { that.addLayer(layer, null, layerIndex); that.layerAdded++; that.sendMapToUser(len); return; } if (layer.layerType === "MARKER" || _dataSource && (!_dataSource.accessType || _dataSource.accessType === 'DIRECT') || isSampleData) { //原来二进制文件 var url = isSampleData ? "".concat(that.server, "apps/dataviz/libs/sample-datas/").concat(_dataSource.name, ".json") : "".concat(that.server, "web/datas/").concat(serverId, "/content.json?pageSize=9999999¤tPage=1"); url = that.getRequestUrl(url); FetchRequest.get(url, null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then( /*#__PURE__*/function () { var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee7(data) { var _layer$dataSource$adm, divisionType, divisionField, geojson, content; return regenerator_default.a.wrap(function _callee7$(_context7) { while (1) { switch (_context7.prev = _context7.next) { case 0: if (!(data.succeed === false)) { _context7.next = 5; break; } //请求失败 that.layerAdded++; that.sendMapToUser(len); that.errorCallback && that.errorCallback(data.error, 'getLayerFaild', that.map); return _context7.abrupt("return"); case 5: if (!(data && data.type)) { _context7.next = 28; break; } if (!(data.type === "JSON" || data.type === "GEOJSON")) { _context7.next = 11; break; } data.content = data.content.type ? data.content : JSON.parse(data.content); features = that.geojsonToFeature(data.content, layer); _context7.next = 25; break; case 11: if (!(data.type === 'EXCEL' || data.type === 'CSV')) { _context7.next = 24; break; } if (!(layer.dataSource && layer.dataSource.administrativeInfo)) { _context7.next = 19; break; } //行政规划信息 data.content.rows.unshift(data.content.colTitles); _layer$dataSource$adm = layer.dataSource.administrativeInfo, divisionType = _layer$dataSource$adm.divisionType, divisionField = _layer$dataSource$adm.divisionField; geojson = that.excelData2FeatureByDivision(data.content, divisionType, divisionField); features = that._parseGeoJsonData2Feature({ allDatas: { features: geojson.features }, fileCode: layer.projection }); _context7.next = 22; break; case 19: _context7.next = 21; return that.excelData2Feature(data.content, layer); case 21: features = _context7.sent; case 22: _context7.next = 25; break; case 24: if (data.type === 'SHP') { content = JSON.parse(data.content); data.content = content.layers[0]; features = that.geojsonToFeature(data.content, layer); } case 25: that.addLayer(layer, features, layerIndex); that.layerAdded++; that.sendMapToUser(len); case 28: case "end": return _context7.stop(); } } }, _callee7); })); return function (_x10) { return _ref5.apply(this, arguments); }; }())["catch"](function (error) { that.layerAdded++; that.sendMapToUser(len); that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map); }); } else { //关系型文件 var isMapService = layer.layerType === 'HOSTED_TILE', _serverId = _dataSource ? _dataSource.serverId : layer.serverId; that.checkUploadToRelationship(_serverId).then(function (result) { if (result && result.length > 0) { var datasetName = result[0].name, featureType = result[0].type.toUpperCase(); that.getDataService(_serverId, datasetName).then(function (data) { var dataItemServices = data.dataItemServices; if (dataItemServices.length === 0) { that.layerAdded++; that.sendMapToUser(len); that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map); return; } if (isMapService) { //需要判断是使用tile还是mvt服务 var dataService = that.getService(dataItemServices, 'RESTDATA'); that.isMvt(dataService.address, datasetName).then(function (info) { that.getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType, info); })["catch"](function () { //判断失败就走之前逻辑,>数据量用tile that.getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType); }); } else { that.getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType); } }); } else { that.layerAdded++; that.sendMapToUser(len); that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map); } })["catch"](function (error) { that.layerAdded++; that.sendMapToUser(len); that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map); }); } } else if (dataSource && dataSource.type === "USER_DATA") { that.addGeojsonFromUrl(layer, len, layerIndex, false); } else if (layer.layerType === "TILE") { that.getTileLayerExtent(layer, function (layerInfo) { that.map.addLayer(that.createBaseLayer(layerInfo, layerIndex)); that.layerAdded++; that.sendMapToUser(len); }, function (e) { that.layerAdded++; that.sendMapToUser(len); that.errorCallback && that.errorCallback(e, 'getLayerFaild', that.map); }); } else if (layer.layerType === 'SUPERMAP_REST' || layer.layerType === "WMS" || layer.layerType === "WMTS") { if (layer.layerType === "WMTS") { that.getWmtsInfo(layer, function (layerInfo) { that.map.addLayer(that.createBaseLayer(layerInfo, layerIndex)); that.layerAdded++; that.sendMapToUser(len); }); } else { layer.projection = that.baseProjection; that.map.addLayer(that.createBaseLayer(layer, layerIndex)); that.layerAdded++; that.sendMapToUser(len); } } else if (dataSource && dataSource.type === "REST_DATA") { //从restData获取数据 that.getFeaturesFromRestData(layer, layerIndex, len); } else if (dataSource && dataSource.type === "REST_MAP" && dataSource.url) { //示例数据 core_Util_Util.queryFeatureBySQL(dataSource.url, dataSource.layerName, 'smid=1', null, null, function (result) { var recordsets = result && result.result.recordsets; var recordset = recordsets && recordsets[0]; var attributes = recordset.fields; if (recordset && attributes) { var fileterAttrs = []; for (var i in attributes) { var value = attributes[i]; if (value.indexOf('Sm') !== 0 || value === "SmID") { fileterAttrs.push(value); } } that.getFeatures(fileterAttrs, layer, function (features) { that.addLayer(layer, features, layerIndex); that.layerAdded++; that.sendMapToUser(len); }, function (e) { that.layerAdded++; that.errorCallback && that.errorCallback(e, 'getFeatureFaild', that.map); }); } }, function (e) { that.errorCallback && that.errorCallback(e, 'getFeatureFaild', that.map); }); } else if (layer.layerType === "DATAFLOW_POINT_TRACK" || layer.layerType === "DATAFLOW_HEAT") { that.getDataflowInfo(layer, function () { that.addLayer(layer, features, layerIndex); that.layerAdded++; that.sendMapToUser(len); }, function (e) { that.layerAdded++; that.errorCallback && that.errorCallback(e, 'getFeatureFaild', that.map); }); } }, this); } } /** * @private * @function ol.supermap.WebMap.prototype.addGeojsonFromUrl * @description 从web服务输入geojson地址的图层 * @param {object} layerInfo - 图层信息 * @param {Number} len - 总的图层数量 * @param {Number} layerIndex - 当前图层index * @param {Boolean} withCredentials - 是否携带cookie */ }, { key: "addGeojsonFromUrl", value: function addGeojsonFromUrl(layerInfo, len, layerIndex) { var withCredentials = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.withCredentials; // 通过web添加geojson不需要携带cookie var dataSource = layerInfo.dataSource, url = dataSource.url, that = this; FetchRequest.get(url, null, { withCredentials: withCredentials, withoutFormatSuffix: true }).then(function (response) { return response.json(); }).then( /*#__PURE__*/function () { var _ref6 = _asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee8(data) { var features, _layerInfo$dataSource, divisionType, divisionField, geojson, geoJson; return regenerator_default.a.wrap(function _callee8$(_context8) { while (1) { switch (_context8.prev = _context8.next) { case 0: if (!(!data || data.succeed === false)) { _context8.next = 3; break; } //请求失败 if (len) { that.errorCallback && that.errorCallback(data.error, 'autoUpdateFaild', that.map); } else { that.layerAdded++; that.sendMapToUser(len); that.errorCallback && that.errorCallback(data.error, 'getLayerFaild', that.map); } return _context8.abrupt("return"); case 3: if (!(data.type === 'CSV' || data.type === 'EXCEL')) { _context8.next = 16; break; } if (!(layerInfo.dataSource && layerInfo.dataSource.administrativeInfo)) { _context8.next = 11; break; } //行政规划信息 data.content.rows.unshift(data.content.colTitles); _layerInfo$dataSource = layerInfo.dataSource.administrativeInfo, divisionType = _layerInfo$dataSource.divisionType, divisionField = _layerInfo$dataSource.divisionField; geojson = that.excelData2FeatureByDivision(data.content, divisionType, divisionField); features = that._parseGeoJsonData2Feature({ allDatas: { features: geojson.features }, fileCode: layerInfo.projection }); _context8.next = 14; break; case 11: _context8.next = 13; return that.excelData2Feature(data.content, layerInfo); case 13: features = _context8.sent; case 14: _context8.next = 18; break; case 16: geoJson = data.content ? JSON.parse(data.content) : data; features = that.geojsonToFeature(geoJson, layerInfo); case 18: if (len) { //上图 that.addLayer(layerInfo, features, layerIndex); that.layerAdded++; that.sendMapToUser(len); } else { //自动更新 that.map.removeLayer(layerInfo.layer); layerInfo.labelLayer && that.map.removeLayer(layerInfo.labelLayer); that.addLayer(layerInfo, features, layerIndex); } case 19: case "end": return _context8.stop(); } } }, _callee8); })); return function (_x11) { return _ref6.apply(this, arguments); }; }())["catch"](function (error) { that.layerAdded++; that.sendMapToUser(len); that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map); }); } /** * @private * @function ol.supermap.WebMap.prototype.getServiceInfoFromLayer * @description 判断使用哪种服务上图 * @param {Number} layerIndex - 图层对应的index * @param {Number} len - 成功添加的图层个数 * @param {Object} layer - 图层信息 * @param {Array} dataItemServices - 数据发布的服务 * @param {String} datasetName - 数据服务的数据集名称 * @param {String} featureType - feature类型 * @param {Object} info - 数据服务的信息 */ }, { key: "getServiceInfoFromLayer", value: function getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType, info) { var that = this; var isMapService = info ? !info.isMvt : layer.layerType === 'HOSTED_TILE', isAdded = false; dataItemServices.forEach(function (service) { if (isAdded) { return; } //有服务了,就不需要循环 if (service && isMapService && service.serviceType === 'RESTMAP') { isAdded = true; //地图服务,判断使用mvt还是tile that.getTileLayerInfo(service.address).then(function (restMaps) { restMaps.forEach(function (restMapInfo) { var bounds = restMapInfo.bounds; layer.layerType = 'TILE'; layer.orginEpsgCode = that.baseProjection; layer.units = restMapInfo.coordUnit && restMapInfo.coordUnit.toLowerCase(); layer.extent = [bounds.left, bounds.bottom, bounds.right, bounds.top]; layer.visibleScales = restMapInfo.visibleScales; layer.url = restMapInfo.url; layer.sourceType = 'TILE'; that.map.addLayer(that.createBaseLayer(layer, layerIndex)); that.layerAdded++; that.sendMapToUser(len); }); }); } else if (service && !isMapService && service.serviceType === 'RESTDATA') { isAdded = true; if (info && info.isMvt) { var bounds = info.bounds; layer = Object.assign(layer, { layerType: "VECTOR_TILE", epsgCode: info.epsgCode, projection: "EPSG:".concat(info.epsgCode), bounds: bounds, extent: [bounds.left, bounds.bottom, bounds.right, bounds.top], name: layer.name, url: info.url, visible: layer.visible, featureType: featureType, serverId: layer.serverId.toString() }); that.map.addLayer(that.addVectorTileLayer(layer, layerIndex, 'RESTDATA')); that.layerAdded++; that.sendMapToUser(len); } else { //数据服务 isAdded = true; //关系型文件发布的数据服务 that.getDatasources(service.address).then(function (datasourceName) { layer.dataSource.dataSourceName = datasourceName + ":" + datasetName; layer.dataSource.url = "".concat(service.address, "/data"); that.getFeaturesFromRestData(layer, layerIndex, len); }); } } }); if (!isAdded) { //循环完成了,也没有找到合适的服务。有可能服务被删除 that.layerAdded++; that.sendMapToUser(len); that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map); } } /** * @private * @function ol.supermap.WebMap.prototype.getDataflowInfo * @description 获取数据流服务的参数 * @param {object} layerInfo - 图层信息 * @param {function} success - 成功回调函数 * @param {function} faild - 失败回调函数 */ }, { key: "getDataflowInfo", value: function getDataflowInfo(layerInfo, success, faild) { var that = this; var url = layerInfo.url, token; var requestUrl = that.getRequestUrl("".concat(url, ".json"), false); if (layerInfo.credential && layerInfo.credential.token) { token = layerInfo.credential.token; requestUrl += "?token=".concat(token); } FetchRequest.get(requestUrl, null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then(function (result) { layerInfo.featureType = "POINT"; if (result && result.featureMetaData) { layerInfo.featureType = result.featureMetaData.featureType.toUpperCase(); } layerInfo.wsUrl = result.urls[0].url; success(); })["catch"](function () { faild(); }); } /** * @private * @function ol.supermap.WebMap.prototype.getFeaturesFromRestData * @description 从数据服务中获取feature * @param {object} layer - 图层信息 * @param {Number} layerIndex - 图层index * @param {Number} layerLength - 图层数量 */ }, { key: "getFeaturesFromRestData", value: function getFeaturesFromRestData(layer, layerIndex, layerLength) { var that = this, dataSource = layer.dataSource, url = layer.dataSource.url, dataSourceName = dataSource.dataSourceName || layer.name; var requestUrl = that.formatUrlWithCredential(url), serviceOptions = {}; if (!this.excludePortalProxyUrl && !Util_Util.isInTheSameDomain(requestUrl)) { serviceOptions.proxy = this.getProxy(); } //因为itest上使用的https,iserver是http,所以要加上代理 core_Util_Util.getFeatureBySQL(requestUrl, [dataSourceName], serviceOptions, function (result) { var features = that.parseGeoJsonData2Feature({ allDatas: { features: result.result.features.features }, fileCode: layer.projection, featureProjection: that.baseProjection }); that.addLayer(layer, features, layerIndex); that.layerAdded++; that.sendMapToUser(layerLength); }, function (err) { that.layerAdded++; that.sendMapToUser(layerLength); that.errorCallback && that.errorCallback(err, 'getFeatureFaild', that.map); }); } /** * @private * @function ol.supermap.WebMap.prototype.getFeatures * @description 从地图中获取feature * @param {object} fields - 图层信息 * @param {Number} layerInfo - 图层index * @param {Number} success - 成功回调 * @param {Number} faild - 失败回调 */ }, { key: "getFeatures", value: function getFeatures(fields, layerInfo, success, faild) { var that = this; var source = layerInfo.dataSource; var fileCode = layerInfo.projection; core_Util_Util.queryFeatureBySQL(source.url, source.layerName, null, fields, null, function (result) { var recordsets = result.result.recordsets[0]; var features = recordsets.features.features; var featuresObj = that.parseGeoJsonData2Feature({ allDatas: { features: features }, fileCode: fileCode, featureProjection: that.baseProjection }, 'JSON'); success(featuresObj); }, function (err) { faild(err); }); } /** * @private * @function ol.supermap.WebMap.prototype.sendMapToUser * @description 将所有叠加图层叠加后,返回最终的map对象给用户,供他们操作使用 * @param {number} layersLen - 叠加图层总数 */ }, { key: "sendMapToUser", value: function sendMapToUser(layersLen) { if (this.layerAdded === layersLen && this.successCallback) { this.successCallback(this.map, this.mapParams, this.layers, this.baseLayer); } } /** * @private * @function ol.supermap.WebMap.prototype.excelData2Feature * @description 将csv和xls文件内容转换成ol.feature * @param {object} content - 文件内容 * @param {object} layerInfo - 图层信息 * @returns {Array} ol.feature的数组集合 */ }, { key: "excelData2Feature", value: function () { var _excelData2Feature = _asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee9(content, layerInfo) { var rows, colTitles, i, fileCode, dataSource, baseLayerEpsgCode, features, xField, yField, xIdx, yIdx, _yield$FetchRequest$g, dataMetaInfo, sampleData, _i, len, rowDatas, attributes, geomX, geomY, olGeom, j, leng, field, newField, feature; return regenerator_default.a.wrap(function _callee9$(_context9) { while (1) { switch (_context9.prev = _context9.next) { case 0: rows = content.rows, colTitles = content.colTitles; // 解决V2恢复的数据中含有空格 for (i in colTitles) { if (core_Util_Util.isString(colTitles[i])) { colTitles[i] = core_Util_Util.trim(colTitles[i]); } } fileCode = layerInfo.projection, dataSource = layerInfo.dataSource, baseLayerEpsgCode = this.baseProjection, features = [], xField = core_Util_Util.trim(layerInfo.xyField && layerInfo.xyField.xField || layerInfo.from && layerInfo.from.xField), yField = core_Util_Util.trim(layerInfo.xyField && layerInfo.xyField.yField || layerInfo.from && layerInfo.from.yField), xIdx = colTitles.indexOf(xField), yIdx = colTitles.indexOf(yField); // todo 优化 暂时这样处理 if (!(layerInfo.layerType === 'MIGRATION')) { _context9.next = 20; break; } _context9.prev = 4; if (!(dataSource.type === 'PORTAL_DATA')) { _context9.next = 14; break; } _context9.next = 8; return FetchRequest.get("".concat(this.server, "web/datas/").concat(dataSource.serverId, ".json"), null, { withCredentials: true }).then(function (res) { return res.json(); }); case 8: _yield$FetchRequest$g = _context9.sent; dataMetaInfo = _yield$FetchRequest$g.dataMetaInfo; // eslint-disable-next-line require-atomic-updates layerInfo.xyField = { xField: dataMetaInfo.xField, yField: dataMetaInfo.yField }; if (!dataMetaInfo.xIndex) { xIdx = colTitles.indexOf(dataMetaInfo.xField); yIdx = colTitles.indexOf(dataMetaInfo.yField); } else { xIdx = dataMetaInfo.xIndex; yIdx = dataMetaInfo.yIndex; } _context9.next = 15; break; case 14: if (dataSource.type === 'SAMPLE_DATA') { // 示例数据从本地拿xyField sampleData = SampleDataInfo.find(function (item) { return item.id === dataSource.name; }) || {}; xField = sampleData.xField; yField = sampleData.yField; layerInfo.xyField = { xField: xField, yField: yField }; xIdx = colTitles.findIndex(function (item) { return item === xField; }); yIdx = colTitles.findIndex(function (item) { return item === yField; }); } case 15: _context9.next = 20; break; case 17: _context9.prev = 17; _context9.t0 = _context9["catch"](4); console.error(_context9.t0); case 20: _i = 0, len = rows.length; case 21: if (!(_i < len)) { _context9.next = 41; break; } rowDatas = rows[_i], attributes = {}, geomX = rows[_i][xIdx], geomY = rows[_i][yIdx]; // 位置字段信息不存在 过滤数据 if (!(geomX !== '' && geomY !== '')) { _context9.next = 38; break; } olGeom = new external_ol_geom_["Point"]([+geomX, +geomY]); if (fileCode !== baseLayerEpsgCode) { olGeom.transform(fileCode, baseLayerEpsgCode); } j = 0, leng = rowDatas.length; case 27: if (!(j < leng)) { _context9.next = 36; break; } field = colTitles[j]; if (!(field === undefined || field === null)) { _context9.next = 31; break; } return _context9.abrupt("continue", 33); case 31: field = field.trim(); if (Object.keys(attributes).indexOf(field) > -1) { //说明前面有个一模一样的字段 newField = field + '_1'; attributes[newField] = rowDatas[j]; } else { attributes[field] = rowDatas[j]; } case 33: j++; _context9.next = 27; break; case 36: feature = new external_ol_Feature_default.a({ geometry: olGeom, attributes: attributes }); features.push(feature); case 38: _i++; _context9.next = 21; break; case 41: return _context9.abrupt("return", Promise.resolve(features)); case 42: case "end": return _context9.stop(); } } }, _callee9, this, [[4, 17]]); })); function excelData2Feature(_x12, _x13) { return _excelData2Feature.apply(this, arguments); } return excelData2Feature; }() /** * @private * @function ol.supermap.WebMap.prototype.excelData2FeatureByDivision * @description 行政区划数据处理 * @param {object} content - 文件内容 * @param {object} layerInfo - 图层信息 * @returns {object} geojson对象 */ }, { key: "excelData2FeatureByDivision", value: function excelData2FeatureByDivision(content, divisionType, divisionField) { var me = this; var asyncInport; if (divisionType === 'Province') { asyncInport = window.ProvinceData; } else if (divisionType === 'City') { asyncInport = window.MunicipalData; } else if (divisionType === 'GB-T_2260') { // let geojso; asyncInport = window.AdministrativeArea; } if (asyncInport) { var geojson = me.changeExcel2Geojson(asyncInport.features, content.rows, divisionType, divisionField); return geojson; } } /** * @private * @function ol.supermap.WebMap.prototype._parseGeoJsonData2Feature * @description 将geojson的数据转换成ol.Feature * @param {object} metaData - 文件内容 * @returns {Array.
    } features */ }, { key: "_parseGeoJsonData2Feature", value: function _parseGeoJsonData2Feature(metaData) { var allFeatures = metaData.allDatas.features, features = []; for (var i = 0, len = allFeatures.length; i < len; i++) { //不删除properties转换后,属性全都在feature上 var properties = Object.assign({}, allFeatures[i].properties); delete allFeatures[i].properties; var feature = transformTools.readFeature(allFeatures[i], { dataProjection: metaData.fileCode, featureProjection: this.baseProjection || 'ESPG:4326' }); feature.setProperties({ attributes: properties }); features.push(feature); } return features; } /** * @private * @function ol.supermap.WebMap.prototype.changeExcel2Geojson * @description 将excel和csv数据转换成标准geojson数据 * @param {array} features - feature对象 * @param {array} datas - 数据内容 * @param {string} divisionType - 行政区划类型 * @param {string} divisionField - 行政区划字段 * @returns {object} geojson对象 */ }, { key: "changeExcel2Geojson", value: function changeExcel2Geojson(features, datas, divisionType, divisionField) { var geojson = { type: 'FeatureCollection', features: [] }; if (datas.length < 2) { return geojson; //只有一行数据时为标题 } var titles = datas[0], rows = datas.slice(1), fieldIndex = titles.findIndex(function (title) { return title === divisionField; }); rows.forEach(function (row) { var feature = features.find(function (item) { if (divisionType === 'GB-T_2260') { return item.properties.GB === row[fieldIndex]; } else { return core_Util_Util.isMatchAdministrativeName(item.properties.Name, row[fieldIndex]); } }); //todo 需提示忽略无效数据 if (feature) { var newFeature = window.cloneDeep(feature); newFeature.properties = {}; row.forEach(function (item, idx) { //空格问题,看见DV多处处理空格问题,TODO统一整理 var key = titles[idx].trim(); newFeature.properties[key] = item; }); geojson.features.push(newFeature); } }); return geojson; } /** * @private * @function ol.supermap.WebMap.prototype.geojsonToFeature * @description geojson 转换为 feature * @param {object} layerInfo - 图层信息 * @returns {Array} ol.feature的数组集合 */ }, { key: "geojsonToFeature", value: function geojsonToFeature(geojson, layerInfo) { var allFeatures = geojson.features, features = []; for (var i = 0, len = allFeatures.length; i < len; i++) { //转换前删除properties,这样转换后属性不会重复存储 var featureAttr = allFeatures[i].properties || {}; delete allFeatures[i].properties; var feature = transformTools.readFeature(allFeatures[i], { dataProjection: layerInfo.projection || 'EPSG:4326', featureProjection: this.baseProjection || 'ESPG:4326' }); //geojson格式的feature属性没有坐标系字段,为了统一,再次加上 var coordinate = feature.getGeometry().getCoordinates(); if (allFeatures[i].geometry.type === 'Point') { // 标注图层 还没有属性值时候不加 if (allFeatures[i].properties) { allFeatures[i].properties.lon = coordinate[0]; allFeatures[i].properties.lat = coordinate[1]; } } // 标注图层特殊处理 var isMarker = false; var attributes = void 0; var useStyle = void 0; if (allFeatures[i].dv_v5_markerInfo) { //因为优化代码之前,属性字段都存储在propertise上,markerInfo没有 attributes = Object.assign({}, allFeatures[i].dv_v5_markerInfo, featureAttr); if (attributes.lon) { //标注图层不需要 delete attributes.lon; delete attributes.lat; } } if (allFeatures[i].dv_v5_markerStyle) { useStyle = allFeatures[i].dv_v5_markerStyle; isMarker = true; } var properties = void 0; if (isMarker) { properties = Object.assign({}, { attributes: attributes }, { useStyle: useStyle }); //feature上添加图层的id,为了对应图层 feature.layerId = layerInfo.timeId; } else if (layerInfo.featureStyles) { //V4 版本标注图层处理 var style = JSON.parse(layerInfo.featureStyles[i].style); var attr = featureAttr; var imgUrl = void 0; if (attr._smiportal_imgLinkUrl.indexOf('http://') > -1 || attr._smiportal_imgLinkUrl.indexOf('https://') > -1) { imgUrl = attr._smiportal_imgLinkUrl; } else if (attr._smiportal_imgLinkUrl !== undefined && attr._smiportal_imgLinkUrl !== null && attr._smiportal_imgLinkUrl !== '') { //上传的图片,加上当前地址 imgUrl = "".concat(core_Util_Util.getIPortalUrl(), "resources/markerIcon/").concat(attr._smiportal_imgLinkUrl); } attributes = { dataViz_description: attr._smiportal_description, dataViz_imgUrl: imgUrl, dataViz_title: attr._smiportal_title, dataViz_url: attr._smiportal_otherLinkUrl }; style.anchor = [0.5, 1]; style.src = style.externalGraphic; useStyle = style; properties = Object.assign({}, { attributes: attributes }, { useStyle: useStyle }); delete attr._smiportal_description; delete attr._smiportal_imgLinkUrl; delete attr._smiportal_title; delete attr._smiportal_otherLinkUrl; } else { properties = { attributes: featureAttr }; } feature.setProperties(properties); features.push(feature); } return features; } /** * @private * @function ol.supermap.WebMap.prototype.parseGeoJsonData2Feature * @description 将从restData地址上获取的json转换成feature(从iserver中获取的json转换成feature) * @param {object} metaData - json内容 * @returns {Array} ol.feature的数组集合 */ }, { key: "parseGeoJsonData2Feature", value: function parseGeoJsonData2Feature(metaData) { var allFeatures = metaData.allDatas.features, features = []; for (var i = 0, len = allFeatures.length; i < len; i++) { var properties = allFeatures[i].properties; delete allFeatures[i].properties; var feature = transformTools.readFeature(allFeatures[i], { dataProjection: metaData.fileCode || 'EPSG:4326', featureProjection: metaData.featureProjection || this.baseProjection || 'EPSG:4326' }); //geojson格式的feature属性没有坐标系字段,为了统一,再次加上 var coordinate = feature.getGeometry().getCoordinates(); if (allFeatures[i].geometry.type === 'Point') { properties.lon = coordinate[0]; properties.lat = coordinate[1]; } feature.setProperties({ attributes: properties }); features.push(feature); } return features; } /** * @private * @function ol.supermap.WebMap.prototype.addLayer * @description 将叠加图层添加到地图上 * @param {object} layerInfo - 图层信息 * @param {array} features - 图层上的feature集合 * @param {number} index 图层的顺序 */ }, { key: "addLayer", value: function addLayer(layerInfo, features, index) { var layer, that = this; if (layerInfo.layerType === "VECTOR") { if (layerInfo.featureType === "POINT") { if (layerInfo.style.type === 'SYMBOL_POINT') { layer = this.createSymbolLayer(layerInfo, features); } else { layer = this.createGraphicLayer(layerInfo, features); } } else { //线和面 layer = this.createVectorLayer(layerInfo, features); } } else if (layerInfo.layerType === "UNIQUE") { layer = this.createUniqueLayer(layerInfo, features); } else if (layerInfo.layerType === "RANGE") { layer = this.createRangeLayer(layerInfo, features); } else if (layerInfo.layerType === "HEAT") { layer = this.createHeatLayer(layerInfo, features); } else if (layerInfo.layerType === "MARKER") { layer = this.createMarkerLayer(features); } else if (layerInfo.layerType === "DATAFLOW_POINT_TRACK") { layer = this.createDataflowLayer(layerInfo, index); } else if (layerInfo.layerType === "DATAFLOW_HEAT") { layer = this.createDataflowHeatLayer(layerInfo); } else if (layerInfo.layerType === "RANK_SYMBOL") { layer = this.createRankSymbolLayer(layerInfo, features); } else if (layerInfo.layerType === "MIGRATION") { layer = this.createMigrationLayer(layerInfo, features); } var layerID = core_Util_Util.newGuid(8); if (layer) { layerInfo.name && layer.setProperties({ name: layerInfo.name, layerID: layerID, layerType: layerInfo.layerType }); //刷新下图层,否则feature样式出不来 if (layerInfo && layerInfo.style && layerInfo.style.imageInfo) { var img = new Image(); img.src = layerInfo.style.imageInfo.url; img.onload = function () { layer.getSource().changed(); }; } if (layerInfo.layerType === 'MIGRATION') { layer.appendTo(this.map); // 在这里恢复图层可见性状态 layer.setVisible(layerInfo.visible); // 设置鼠标样式为默认 layer.setCursor(); } else { layerInfo.opacity != undefined && layer.setOpacity(layerInfo.opacity); layer.setVisible(layerInfo.visible); this.map.addLayer(layer); } layer.setZIndex(index); var visibleScale = layerInfo.visibleScale, autoUpdateTime = layerInfo.autoUpdateTime; visibleScale && this.setVisibleScales(layer, visibleScale); if (autoUpdateTime && !layerInfo.autoUpdateInterval) { //自动更新数据 var dataSource = layerInfo.dataSource; if (dataSource.accessType === "DIRECT" && !dataSource.url) { // 二进制数据更新feautre所需的url dataSource.url = "".concat(this.server, "web/datas/").concat(dataSource.serverId, "/content.json?pageSize=9999999¤tPage=1"); } layerInfo.autoUpdateInterval = setInterval(function () { that.updateFeaturesToMap(layerInfo, index, true); }, autoUpdateTime); } } layerInfo.layer = layer; layerInfo.layerID = layerID; if (layerInfo.labelStyle && layerInfo.labelStyle.labelField && layerInfo.layerType !== "DATAFLOW_POINT_TRACK") { //存在标签专题图 //过滤条件过滤feature features = layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features; this.addLabelLayer(layerInfo, features); } } /** * @private * @function ol.supermap.WebMap.prototype.updateFeaturesToMap * @description 更新地图上的feature,适用于专题图 * @param {object} layerInfo - 图层信息 * @param {number} index 图层的顺序 */ }, { key: "updateFeaturesToMap", value: function updateFeaturesToMap(layerInfo, layerIndex) { var that = this, dataSource = layerInfo.dataSource, url = layerInfo.dataSource.url, dataSourceName = dataSource.dataSourceName || layerInfo.name; if (dataSource.type === "USER_DATA" || dataSource.accessType === "DIRECT") { that.addGeojsonFromUrl(layerInfo, null, layerIndex); } else { var requestUrl = that.formatUrlWithCredential(url), serviceOptions = {}; if (!this.excludePortalProxyUrl && !Util_Util.isInTheSameDomain(requestUrl)) { serviceOptions.proxy = this.getProxy(); } //因为itest上使用的https,iserver是http,所以要加上代理 core_Util_Util.getFeatureBySQL(requestUrl, [dataSourceName], serviceOptions, function (result) { var features = that.parseGeoJsonData2Feature({ allDatas: { features: result.result.features.features }, fileCode: layerInfo.projection, featureProjection: that.baseProjection }); //删除之前的图层和标签图层 that.map.removeLayer(layerInfo.layer); layerInfo.labelLayer && that.map.removeLayer(layerInfo.labelLayer); that.addLayer(layerInfo, features, layerIndex); }, function (err) { that.errorCallback && that.errorCallback(err, 'autoUpdateFaild', that.map); }); } } /** * @private * @function ol.supermap.WebMap.prototype.addVectorTileLayer * @description 添加vectorTILE图层 * @param {object} layerInfo - 图层信息 * @param {number} index 图层的顺序 * @param {String} type 创建的图层类型,restData为创建数据服务的mvt, restMap为创建地图服务的mvt * @returns {ol/layer/VectorTile} 图层对象 */ }, { key: "addVectorTileLayer", value: function addVectorTileLayer(layerInfo, index, type) { var layer; if (type === 'RESTDATA') { //用的是restdata服务的mvt layer = this.createDataVectorTileLayer(layerInfo); } var layerID = core_Util_Util.newGuid(8); if (layer) { layerInfo.name && layer.setProperties({ name: layerInfo.name, layerID: layerID }); layerInfo.opacity != undefined && layer.setOpacity(layerInfo.opacity); layer.setVisible(layerInfo.visible); layer.setZIndex(index); } layerInfo.layer = layer; layerInfo.layerID = layerID; return layer; } /** * @private * @function ol.supermap.WebMap.prototype.createDataVectorTileLayer * @description 创建vectorTILE图层 * @param {object} layerInfo - 图层信息 * @returns {ol/layer/VectorTile} 图层对象 */ }, { key: "createDataVectorTileLayer", value: function createDataVectorTileLayer(layerInfo) { //创建图层 var format = new external_ol_format_MVT_default.a({ featureClass: external_ol_Feature_default.a }); //要加上这一句,否则坐标,默认都是3857 external_ol_format_MVT_default.a.prototype.readProjection = function () { return new external_ol_proj_["Projection"]({ code: '', units: external_ol_proj_Units_default.a.TILE_PIXELS }); }; var featureType = layerInfo.featureType; var style = StyleUtils_StyleUtils.toOpenLayersStyle(this.getDataVectorTileStyle(featureType), featureType); return new external_ol_layer_["VectorTile"]({ //设置避让参数 source: new VectorTileSuperMapRest_VectorTileSuperMapRest({ url: layerInfo.url, projection: layerInfo.projection, tileType: "ScaleXY", format: format }), style: style }); } /** * @private * @function ol.supermap.WebMap.prototype.getDataVectorTileStyle * @description 获取数据服务的mvt上图的默认样式 * @param {String} featureType - 要素类型 * @returns {Object} 样式参数 */ }, { key: "getDataVectorTileStyle", value: function getDataVectorTileStyle(featureType) { var styleParameters = { radius: 8, //圆点半径 fillColor: '#EE4D5A', //填充色 fillOpacity: 0.9, strokeColor: '#ffffff', //边框颜色 strokeWidth: 1, strokeOpacity: 1, lineDash: 'solid', type: "BASIC_POINT" }; if (["LINE", "LINESTRING", "MULTILINESTRING"].indexOf(featureType) > -1) { styleParameters.strokeColor = '#4CC8A3'; styleParameters.strokeWidth = 2; } else if (["REGION", "POLYGON", "MULTIPOLYGON"].indexOf(featureType) > -1) { styleParameters.fillColor = '#826DBA'; } return styleParameters; } /** * @private * @function ol.supermap.WebMap.prototype.getFiterFeatures * @description 通过过滤条件查询满足的feature * @param {string} filterCondition - 过滤条件 * @param {array} allFeatures - 图层上的feature集合 */ }, { key: "getFiterFeatures", value: function getFiterFeatures(filterCondition, allFeatures) { var condition = this.parseFilterCondition(filterCondition); var sql = "select * from json where (" + condition + ")"; var filterFeatures = []; for (var i = 0; i < allFeatures.length; i++) { var feature = allFeatures[i]; var filterResult = false; try { filterResult = window.jsonsql.query(sql, { attributes: feature.get('attributes') }); } catch (err) { //必须把要过滤得内容封装成一个对象,主要是处理jsonsql(line : 62)中由于with语句遍历对象造成的问题 continue; } if (filterResult && filterResult.length > 0) { //afterFilterFeatureIdx.push(i); filterFeatures.push(feature); } } return filterFeatures; } /** * @private * @function ol.supermap.WebMap.prototype.parseFilterCondition * @description 1、替换查询语句 中的 and / AND / or / OR / = / != * 2、匹配 Name in ('', ''),多条件需用()包裹 * @param {string} filterCondition - 过滤条件 * @return {string} 换成组件能识别的字符串 */ }, { key: "parseFilterCondition", value: function parseFilterCondition(filterCondition) { return filterCondition.replace(/=/g, "==").replace(/AND|and/g, "&&").replace(/or|OR/g, "||").replace(/<==/g, "<=").replace(/>==/g, ">=").replace(/\(?[^\(]+?\s*in\s*\([^\)]+?\)\)?/gi, function (res) { // res格式:(省份 in ('四川', '河南')) var data = res.match(/([^(]+?)\s*in\s*\(([^)]+?)\)/i); return data.length === 3 ? "(".concat(data[2].split(",").map(function (c) { return "".concat(data[1], " == ").concat(c.trim()); }).join(" || "), ")") : res; }); } /** * @private * @function ol.supermap.WebMap.prototype.createGraphicLayer * @description 添加大数据图层到地图上 * @param {object} layerInfo - 图层信息 * @param {array} features - feature的集合 * @return {ol/layer/image} 大数据图层 */ }, { key: "createGraphicLayer", value: function createGraphicLayer(layerInfo, features) { features = layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features; var graphics = this.getGraphicsFromFeatures(features, layerInfo.style, layerInfo.featureType); var source = new overlay_Graphic_Graphic({ graphics: graphics, render: 'canvas', map: this.map, isHighLight: false }); return new external_ol_layer_["Image"]({ source: source }); } /** * @private * @function ol.supermap.WebMap.prototype.getGraphicsFromFeatures * @description 将feature转换成大数据图层对应的Graphics要素 * @param {array} features - feature的集合 * @param {object} style - 图层样式 * @param {string} featureType - feature的类型 * @return {array} 大数据图层要素数组 */ }, { key: "getGraphicsFromFeatures", value: function getGraphicsFromFeatures(features, style, featureType) { var olStyle = StyleUtils_StyleUtils.getOpenlayersStyle(style, featureType), shape = olStyle.getImage(); var graphics = []; //构建graphic for (var i in features) { var graphic = new Graphic_Graphic(features[i].getGeometry()); graphic.setStyle(shape); graphic.setProperties({ attributes: features[i].get('attributes') }); graphics.push(graphic); } return graphics; } /** * @private * @function ol.supermap.WebMap.prototype.createSymbolLayer * @description 添加符号图层 * @param {object} layerInfo - 图层信息 * @param {array} features - feature的集合 * @return {ol/layer/Vector} 符号图层 */ }, { key: "createSymbolLayer", value: function createSymbolLayer(layerInfo, features) { var style = StyleUtils_StyleUtils.getSymbolStyle(layerInfo.style); return new external_ol_layer_["Vector"]({ style: style, source: new external_ol_source_["Vector"]({ features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features, wrapX: false }), renderMode: 'image' }); } /** * @private * @function ol.supermap.WebMap.prototype.addLabelLayer * @description 添加标签图层 * @param {object} layerInfo - 图层信息 * @param {array} features -feature的集合 * @returns {ol/layer/Vector} 图层对象 */ }, { key: "addLabelLayer", value: function addLabelLayer(layerInfo, features) { var labelStyle = layerInfo.labelStyle; var style = this.getLabelStyle(labelStyle, layerInfo); var layer = layerInfo.labelLayer = new external_ol_layer_["Vector"]({ declutter: true, styleOL: style, labelField: labelStyle.labelField, source: new external_ol_source_["Vector"]({ features: features, wrapX: false }) }); layer.setStyle(function (features) { var labelField = labelStyle.labelField; var label = features.get('attributes')[labelField.trim()] + ""; if (label === "undefined") { return null; } var styleOL = layer.get('styleOL'); var text = styleOL.getText(); if (text && text.setText) { text.setText(label); } return styleOL; }); this.map.addLayer(layer); layer.setVisible(layerInfo.visible); layer.setZIndex(1000); var visibleScale = layerInfo.visibleScale; visibleScale && this.setVisibleScales(layer, visibleScale); return layer; } /** * @private * @function ol.supermap.WebMap.prototype.setVisibleScales * @description 改变图层可视范围 * @param {object} layer - 图层对象。ol.Layer * @param {object} visibleScale - 图层样式参数 */ }, { key: "setVisibleScales", value: function setVisibleScales(layer, visibleScale) { var maxResolution = this.resolutions[visibleScale.minScale], minResolution = this.resolutions[visibleScale.maxScale]; //比例尺和分别率是反比的关系 maxResolution > 1 ? layer.setMaxResolution(Math.ceil(maxResolution)) : layer.setMaxResolution(maxResolution * 1.1); layer.setMinResolution(minResolution); } /** * @private * @function ol.supermap.WebMap.prototype.getLabelStyle * @description 获取标签样式 * @param {object} parameters - 标签图层样式参数 * @param {object} layerInfo - 图层样式参数 * @returns {ol/style/Style} 标签样式 */ }, { key: "getLabelStyle", value: function getLabelStyle(parameters, layerInfo) { var style = layerInfo.style || layerInfo.pointStyle; var _style$radius = style.radius, radius = _style$radius === void 0 ? 0 : _style$radius, _style$strokeWidth = style.strokeWidth, strokeWidth = _style$strokeWidth === void 0 ? 0 : _style$strokeWidth, beforeOffsetY = -(radius + strokeWidth); var _parameters$fontSize = parameters.fontSize, fontSize = _parameters$fontSize === void 0 ? '14px' : _parameters$fontSize, fontFamily = parameters.fontFamily, fill = parameters.fill, backgroundFill = parameters.backgroundFill, _parameters$offsetX = parameters.offsetX, offsetX = _parameters$offsetX === void 0 ? 0 : _parameters$offsetX, _parameters$offsetY = parameters.offsetY, offsetY = _parameters$offsetY === void 0 ? beforeOffsetY : _parameters$offsetY, _parameters$placement = parameters.placement, placement = _parameters$placement === void 0 ? "point" : _parameters$placement, _parameters$textBasel = parameters.textBaseline, textBaseline = _parameters$textBasel === void 0 ? "bottom" : _parameters$textBasel, _parameters$textAlign = parameters.textAlign, textAlign = _parameters$textAlign === void 0 ? 'center' : _parameters$textAlign, _parameters$outlineCo = parameters.outlineColor, outlineColor = _parameters$outlineCo === void 0 ? "#000000" : _parameters$outlineCo, _parameters$outlineWi = parameters.outlineWidth, outlineWidth = _parameters$outlineWi === void 0 ? 0 : _parameters$outlineWi; var option = { font: "".concat(fontSize, " ").concat(fontFamily), placement: placement, textBaseline: textBaseline, fill: new external_ol_style_Fill_default.a({ color: fill }), backgroundFill: new external_ol_style_Fill_default.a({ color: backgroundFill }), padding: [3, 3, 3, 3], offsetX: layerInfo.featureType === 'POINT' ? offsetX : 0, offsetY: layerInfo.featureType === 'POINT' ? offsetY : 0, overflow: true, maxAngle: 0 }; if (layerInfo.featureType === 'POINT') { //线面不需要此参数,否则超出线面overflow:true,也不会显示标签 option.textAlign = textAlign; } if (outlineWidth > 0) { option.stroke = new external_ol_style_Stroke_default.a({ color: outlineColor, width: outlineWidth }); } return new external_ol_style_Style_default.a({ text: new external_ol_style_Text_default.a(option) }); } /** * @private * @function ol.supermap.WebMap.prototype.createVectorLayer * @description 创建vector图层 * @param {object} layerInfo - 图层信息 * @param {array} features -feature的集合 * @returns {ol/layer/Vector} 矢量图层 */ }, { key: "createVectorLayer", value: function createVectorLayer(layerInfo, features) { var featureType = layerInfo.featureType, style = layerInfo.style; var newStyle; if (featureType === 'LINE' && core_Util_Util.isArray(style)) { var _style = _slicedToArray(style, 2), outlineStyle = _style[0], strokeStyle = _style[1]; newStyle = strokeStyle.lineDash === 'solid' ? StyleUtils_StyleUtils.getRoadPath(strokeStyle, outlineStyle) : StyleUtils_StyleUtils.getPathway(strokeStyle, outlineStyle); } else { newStyle = StyleUtils_StyleUtils.toOpenLayersStyle(layerInfo.style, layerInfo.featureType); } return new external_ol_layer_["Vector"]({ style: newStyle, source: new external_ol_source_["Vector"]({ features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features, wrapX: false }) }); } /** * @private * @function ol.supermap.WebMap.prototype.createHeatLayer * @description 创建热力图图层 * @param {object} layerInfo - 图层信息 * @param {array} features -feature的集合 * @returns {ol/layer/Heatmap} 热力图图层 */ }, { key: "createHeatLayer", value: function createHeatLayer(layerInfo, features) { //因为热力图,随着过滤,需要重新计算权重 features = layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features; var source = new external_ol_source_["Vector"]({ features: features, wrapX: false }); var layerOptions = { source: source }; var themeSetting = layerInfo.themeSetting; layerOptions.gradient = themeSetting.colors.slice(); layerOptions.radius = parseInt(themeSetting.radius); //自定义颜色 var customSettings = themeSetting.customSettings; for (var i in customSettings) { layerOptions.gradient[i] = customSettings[i]; } // 权重字段恢复 if (themeSetting.weight) { this.changeWeight(features, themeSetting.weight); } return new external_ol_layer_["Heatmap"](layerOptions); } /** * @private * @function ol.supermap.WebMap.prototype.changeWeight * @description 改变当前权重字段 * @param {array} features - feature的集合 * @param {string} weightFeild - 权重字段 */ }, { key: "changeWeight", value: function changeWeight(features, weightFeild) { var that = this; this.fieldMaxValue = {}; this.getMaxValue(features, weightFeild); var maxValue = this.fieldMaxValue[weightFeild]; features.forEach(function (feature) { var attributes = feature.get('attributes'); try { var value = attributes[weightFeild]; feature.set('weight', value / maxValue); } catch (e) { that.errorCallback && that.errorCallback(e); } }); } /** * @private * @function ol.supermap.WebMap.prototype.getMaxValue * @description 获取当前字段对应的最大值,用于计算权重 * @param {array} features - feature 数组 * @param {string} weightField - 权重字段 */ }, { key: "getMaxValue", value: function getMaxValue(features, weightField) { var values = [], that = this, attributes; var field = weightField; if (this.fieldMaxValue[field]) { return; } features.forEach(function (feature) { //收集当前权重字段对应的所有值 attributes = feature.get('attributes'); try { values.push(parseFloat(attributes[field])); } catch (e) { that.errorCallback && that.errorCallback(e); } }); this.fieldMaxValue[field] = ArrayStatistic.getArrayStatistic(values, 'Maximum'); } /** * @private * @function ol.supermap.WebMap.prototype.createUniqueLayer * @description 获取当前字段对应的最大值,用于计算权重 * @param {array} layerInfo - 图层信息 * @param {array} features - 所有feature结合 */ }, { key: "createUniqueLayer", value: function createUniqueLayer(layerInfo, features) { var styleSource = this.createUniqueSource(layerInfo, features); var layer = new external_ol_layer_["Vector"]({ styleSource: styleSource, source: new external_ol_source_["Vector"]({ features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features, wrapX: false }) }); layer.setStyle(function (feature) { var styleSource = layer.get('styleSource'); var labelField = styleSource.themeField; var label = feature.get('attributes')[labelField]; var styleGroup = styleSource.styleGroups.find(function (item) { return item.value === label; }); return styleGroup.olStyle; }); return layer; } /** * @private * @function ol.supermap.WebMap.prototype.createUniqueSource * @description 创建单值图层的source * @param {layerInfo} parameters- 图层信息 * @param {array} features - feature 数组 * @returns {{map: *, style: *, isHoverAble: *, highlightStyle: *, themeField: *, styleGroups: Array}} */ }, { key: "createUniqueSource", value: function createUniqueSource(parameters, features) { //找到合适的专题字段 var styleGroup = this.getUniqueStyleGroup(parameters, features); return { map: this.map, //必传参数 API居然不提示 style: parameters.style, isHoverAble: parameters.isHoverAble, highlightStyle: parameters.highlightStyle, themeField: parameters.themeSetting.themeField, styleGroups: styleGroup }; } /** * @private * @function ol.supermap.WebMap.prototype.getUniqueStyleGroup * @description 获取单值专题图的styleGroup * @param {object} parameters- 图层信息 * @param {array} features - feature 数组 * @returns {Array} 单值样式 */ }, { key: "getUniqueStyleGroup", value: function getUniqueStyleGroup(parameters, features) { // 找出所有的单值 var featureType = parameters.featureType, style = parameters.style, themeSetting = parameters.themeSetting; var fieldName = themeSetting.themeField, colors = themeSetting.colors; var names = [], customSettings = themeSetting.customSettings; for (var i in features) { var attributes = features[i].get('attributes'); var name = attributes[fieldName]; var isSaved = false; for (var j in names) { if (names[j] === name) { isSaved = true; break; } } if (!isSaved) { names.push(name); } } //获取一定量的颜色 var curentColors = colors; curentColors = ColorsPickerUtil.getGradientColors(curentColors, names.length); //生成styleGroup var styleGroup = []; names.forEach(function (name, index) { //兼容之前自定义是用key,现在因为数据支持编辑,需要用属性值。 var key = this.webMapVersion === "1.0" ? index : name; var color = curentColors[key]; if (key in customSettings) { color = customSettings[key]; } if (featureType === "LINE") { style.strokeColor = color; } else { style.fillColor = color; } // 转化成 ol 样式 var olStyle = StyleUtils_StyleUtils.toOpenLayersStyle(style, featureType); styleGroup.push({ olStyle: olStyle, color: color, value: name }); }, this); return styleGroup; } /** * @private * @function ol.supermap.WebMap.prototype.createRangeLayer * @description 创建分段图层 * @param {object} layerInfo- 图层信息 * @param {array} features - 所有feature结合 * @returns {ol/layer/Vector} 单值图层 */ }, { key: "createRangeLayer", value: function createRangeLayer(layerInfo, features) { //这里获取styleGroup要用所以的feature var styleSource = this.createRangeSource(layerInfo, features); var layer = new external_ol_layer_["Vector"]({ styleSource: styleSource, source: new external_ol_source_["Vector"]({ features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features, wrapX: false }) }); layer.setStyle(function (feature) { var styleSource = layer.get('styleSource'); if (styleSource) { var labelField = styleSource.themeField; var value = Number(feature.get('attributes')[labelField.trim()]); var styleGroups = styleSource.styleGroups; for (var i = 0; i < styleGroups.length; i++) { if (i === 0) { if (value >= styleGroups[i].start && value <= styleGroups[i].end) { return styleGroups[i].olStyle; } } else { if (value > styleGroups[i].start && value <= styleGroups[i].end) { return styleGroups[i].olStyle; } } } } }); return layer; } /** * @private * @function ol.supermap.WebMap.prototype.createRangeSource * @description 创建分段专题图的图层source * @param {object} parameters- 图层信息 * @param {array} features - 所以的feature集合 * @returns {Object} 图层source */ }, { key: "createRangeSource", value: function createRangeSource(parameters, features) { //找到合适的专题字段 var styleGroup = this.getRangeStyleGroup(parameters, features); if (styleGroup) { return { style: parameters.style, themeField: parameters.themeSetting.themeField, styleGroups: styleGroup }; } else { return false; } } /** * @private * @function ol.supermap.WebMap.prototype.getRangeStyleGroup * @description 获取分段专题图的styleGroup样式 * @param {object} parameters- 图层信息 * @param {array} features - 所以的feature集合 * @returns {Array} styleGroups */ }, { key: "getRangeStyleGroup", value: function getRangeStyleGroup(parameters, features) { // 找出分段值 var featureType = parameters.featureType, themeSetting = parameters.themeSetting, style = parameters.style; var count = themeSetting.segmentCount, method = themeSetting.segmentMethod, colors = themeSetting.colors, customSettings = themeSetting.customSettings, fieldName = themeSetting.themeField; var values = [], attributes; var segmentCount = count; var segmentMethod = method; var that = this; features.forEach(function (feature) { attributes = feature.get("attributes"); try { if (attributes) { //过滤掉非数值的数据 var value = attributes[fieldName.trim()]; if (value !== undefined && value !== null && core_Util_Util.isNumber(value)) { values.push(parseFloat(value)); } } else if (feature.get(fieldName) && core_Util_Util.isNumber(feature.get(fieldName))) { if (feature.get(fieldName)) { values.push(parseFloat(feature.get(fieldName))); } } } catch (e) { that.errorCallback && that.errorCallback(e); } }); var segements; try { segements = ArrayStatistic.getArraySegments(values, segmentMethod, segmentCount); } catch (e) { that.errorCallback && that.errorCallback(e); } if (segements) { var itemNum = segmentCount; if (attributes && segements[0] === segements[attributes.length - 1]) { itemNum = 1; segements.length = 2; } //保留两位有效数 for (var key in segements) { var value = segements[key]; if (Number(key) === 0) { // 最小的值下舍入,要用两个等于号。否则有些值判断不对 value = Math.floor(value * 100) / 100; } else { // 其余上舍入 value = Math.ceil(value * 100) / 100 + 0.1; // 加0.1 解决最大值没有样式问题 } segements[key] = Number(value.toFixed(2)); } //获取一定量的颜色 var curentColors = colors; curentColors = ColorsPickerUtil.getGradientColors(curentColors, itemNum, 'RANGE'); for (var index = 0; index < itemNum; index++) { if (index in customSettings) { if (customSettings[index]["segment"]["start"]) { segements[index] = customSettings[index]["segment"]["start"]; } if (customSettings[index]["segment"]["end"]) { segements[index + 1] = customSettings[index]["segment"]["end"]; } } } //生成styleGroup var styleGroups = []; for (var i = 0; i < itemNum; i++) { var color = curentColors[i]; if (i in customSettings) { if (customSettings[i].color) { color = customSettings[i].color; } } if (featureType === "LINE") { style.strokeColor = color; } else { style.fillColor = color; } // 转化成 ol 样式 var olStyle = StyleUtils_StyleUtils.toOpenLayersStyle(style, featureType); var start = segements[i]; var end = segements[i + 1]; styleGroups.push({ olStyle: olStyle, color: color, start: start, end: end }); } return styleGroups; } else { return false; } } /** * @private * @function ol.supermap.WebMap.prototype.createMarkerLayer * @description 创建标注图层 * @param {array} features - 所以的feature集合 * @returns {ol/layer/Vector} 矢量图层 */ }, { key: "createMarkerLayer", value: function createMarkerLayer(features) { features && this.setEachFeatureDefaultStyle(features); return new external_ol_layer_["Vector"]({ source: new external_ol_source_["Vector"]({ features: features, wrapX: false }) }); } /** * @private * @function ol.supermap.WebMap.prototype.createDataflowLayer * @description 创建数据流图层 * @param {object} layerInfo- 图层信息 * @param {number} layerIndex - 图层的zindex * @returns {ol/layer/Vector} 数据流图层 */ }, { key: "createDataflowLayer", value: function createDataflowLayer(layerInfo, layerIndex) { var layerStyle = layerInfo.pointStyle, style; //获取样式 style = StyleUtils_StyleUtils.getOpenlayersStyle(layerStyle, layerInfo.featureType); var source = new external_ol_source_["Vector"]({ wrapX: false }), labelLayer, labelSource, pathLayer, pathSource; var layer = new external_ol_layer_["Vector"]({ styleOL: style, source: source }); if (layerInfo.labelStyle && layerInfo.visible) { //有标签图层 labelLayer = this.addLabelLayer(layerInfo); //和编辑页面保持一致 labelLayer.setZIndex(1000); labelSource = labelLayer.getSource(); } var visibleScale = layerInfo.visibleScale; if (layerInfo.lineStyle && layerInfo.visible) { pathLayer = this.createVectorLayer({ style: layerInfo.lineStyle, featureType: "LINE" }); pathSource = pathLayer.getSource(); pathLayer.setZIndex(layerIndex); this.map.addLayer(pathLayer); visibleScale && this.setVisibleScales(pathLayer, visibleScale); // 挂载到layerInfo上,便于删除 layerInfo.pathLayer = pathLayer; } var featureCache = {}, labelFeatureCache = {}, pathFeatureCache = {}, that = this; this.createDataflowService(layerInfo, function (featureCache, labelFeatureCache, pathFeatureCache) { return function (feature) { that.events.triggerEvent('updateDataflowFeature', { feature: feature, identifyField: layerInfo.identifyField, layerID: layerInfo.layerID }); if (layerInfo.filterCondition) { //过滤条件 var condition = that.parseFilterCondition(layerInfo.filterCondition); var sql = "select * from json where (" + condition + ")"; var filterResult = window.jsonsql.query(sql, { attributes: feature.get('attributes') }); if (filterResult && filterResult.length > 0) { that.addDataflowFeature(feature, layerInfo.identifyField, { dataflowSource: source, featureCache: featureCache, labelSource: labelSource, labelFeatureCache: labelFeatureCache, pathSource: pathSource, pathFeatureCache: pathFeatureCache, maxPointCount: layerInfo.maxPointCount }); } } else { that.addDataflowFeature(feature, layerInfo.identifyField, { dataflowSource: source, featureCache: featureCache, labelSource: labelSource, labelFeatureCache: labelFeatureCache, pathSource: pathSource, pathFeatureCache: pathFeatureCache, maxPointCount: layerInfo.maxPointCount }); } }; }(featureCache, labelFeatureCache, pathFeatureCache)); this.setFeatureStyle(layer, layerInfo.directionField, layerStyle.type); return layer; } /** * @private * @function ol.supermap.WebMap.prototype.addDataflowFeature * @description 添加数据流的feature * @param {object} feature - 服务器更新的feature * @param {string} identifyField - 标识feature的字段 * @param {object} options - 其他参数 */ }, { key: "addDataflowFeature", value: function addDataflowFeature(feature, identifyField, options) { options.dataflowSource && this.addFeatureFromDataflowService(options.dataflowSource, feature, identifyField, options.featureCache); options.labelSource && this.addFeatureFromDataflowService(options.labelSource, feature, identifyField, options.labelFeatureCache); options.pathSource && this.addPathFeature(options.pathSource, feature, identifyField, options.pathFeatureCache, options.maxPointCount); } /** * @private * @function ol.supermap.WebMap.prototype.addPathFeature * @description 添加数据流图层中轨迹线的feature * @param {object} source - 轨迹线图层的source * @param {object} feature - 轨迹线feature * @param {string} identifyField - 标识feature的字段 * @param {object} featureCache - 存储feature * @param {number} maxPointCount - 轨迹线最多点个数数量 */ }, { key: "addPathFeature", value: function addPathFeature(source, feature, identifyField, featureCache, maxPointCount) { var coordinates = []; var geoID = feature.get(identifyField); if (featureCache[geoID]) { //加过feautre coordinates = featureCache[geoID].getGeometry().getCoordinates(); coordinates.push(feature.getGeometry().getCoordinates()); if (maxPointCount && coordinates.length > maxPointCount) { coordinates.splice(0, coordinates.length - maxPointCount); } featureCache[geoID].getGeometry().setCoordinates(coordinates); } else { coordinates.push(feature.getGeometry().getCoordinates()); featureCache[geoID] = new external_ol_Feature_default.a({ geometry: new external_ol_geom_["LineString"](coordinates) }); source.addFeature(featureCache[geoID]); } } /** * @private * @function ol.supermap.WebMap.prototype.setFeatureStyle * @description 设置feature样式 * @param {object} layer - 图层对象 * @param {string} directionField - 方向字段 * @param {string} styleType - 样式的类型 */ }, { key: "setFeatureStyle", value: function setFeatureStyle(layer, directionField, styleType) { var layerStyle = layer.get('styleOL'); layer.setStyle(function (feature) { //有转向字段 var value, image; if (directionField !== undefined && directionField !== "未设置" && directionField !== "None") { value = feature.get('attributes')[directionField]; } else { value = 0; } if (value > 360 || value < 0) { return null; } if (styleType === "SYMBOL_POINT") { image = layerStyle.getText(); } else { image = layerStyle.getImage(); } //默认用户使用的是角度,换算成弧度 var rotate = Math.PI * value / 180; image && image.setRotation(rotate); return layerStyle; }); } /** * @private * @function ol.supermap.WebMap.prototype.createDataflowHeatLayer * @description 创建数据流服务的热力图图层 * @param {object} layerInfo - 图层参数 * @returns {ol/layer/Heatmap} 热力图图层对象 */ }, { key: "createDataflowHeatLayer", value: function createDataflowHeatLayer(layerInfo) { var source = this.createDataflowHeatSource(layerInfo); var layerOptions = { source: source }; layerOptions.gradient = layerInfo.themeSetting.colors.slice(); layerOptions.radius = parseInt(layerInfo.themeSetting.radius); if (layerInfo.themeSetting.customSettings) { var customSettings = layerInfo.themeSetting.customSettings; for (var i in customSettings) { layerOptions.gradient[i] = customSettings[i]; } } return new external_ol_layer_["Heatmap"](layerOptions); } /** * @private * @function ol.supermap.WebMap.prototype.createDataflowHeatSource * @description 创建数据流服务的热力图的source * @param {object} layerInfo - 图层参数 * @returns {ol/souce/Vector} 热力图source对象 */ }, { key: "createDataflowHeatSource", value: function createDataflowHeatSource(layerInfo) { var that = this, source = new external_ol_source_["Vector"]({ wrapX: false }); var featureCache = {}; this.createDataflowService(layerInfo, function (featureCache) { return function (feature) { if (layerInfo.filterCondition) { //过滤条件 var condition = that.parseFilterCondition(layerInfo.filterCondition); var sql = "select * from json where (" + condition + ")"; var filterResult = window.jsonsql.query(sql, { attributes: feature.get('attributes') }); if (filterResult && filterResult.length > 0) { that.addDataflowFeature(feature, layerInfo.identifyField, { dataflowSource: source, featureCache: featureCache }); } } else { that.addDataflowFeature(feature, layerInfo.identifyField, { dataflowSource: source, featureCache: featureCache }); } // 权重字段恢复 if (layerInfo.themeSetting.weight) { that.changeWeight(source.getFeatures(), layerInfo.themeSetting.weight); } }; }(featureCache)); return source; } /** * @private * @function ol.supermap.WebMap.prototype.addFeatureFromDataflowService * @description 将feature添加到数据流图层 * @param {object} source - 图层对应的source * @param {object} feature - 需要添加到图层的feature * @param {object} identifyField - feature的标识字段 * @param {object} featureCache - 存储已添加到图层的feature对象 */ }, { key: "addFeatureFromDataflowService", value: function addFeatureFromDataflowService(source, feature, identifyField, featureCache) { //判断是否有这个feature,存在feature就更新位置。 var geoID = feature.get(identifyField); if (geoID !== undefined && featureCache[geoID]) { /*if(that.addFeatureFinish) { //feature全都加上图层,就缩放范围 MapManager.zoomToExtent(LayerUtil.getBoundsFromFeatures(source.getFeatures())); that.addFeatureFinish = false; }*/ featureCache[geoID].setGeometry(feature.getGeometry()); featureCache[geoID].setProperties(feature.getProperties()); source.changed(); } else { source.addFeature(feature); featureCache[geoID] = feature; } } /** * @private * @function ol.supermap.WebMap.prototype.createDataflowService * @description 将feature添加到数据流图层 * @param {object} layerInfo - 图层参数 * @param {object} callback - 回调函数 */ }, { key: "createDataflowService", value: function createDataflowService(layerInfo, callback) { var that = this; var dataflowService = new services_DataFlowService_DataFlowService(layerInfo.wsUrl).initSubscribe(); dataflowService.on('messageSucceeded', function (e) { var geojson = JSON.parse(e.value.data); var feature = transformTools.readFeature(geojson, { dataProjection: "EPSG:4326", // todo 坐标系 featureProjection: that.baseProjection || 'EPSG:4326' }); feature.setProperties({ attributes: geojson.properties }); callback(feature); }); layerInfo.dataflowService = dataflowService; } /** * @private * @function ol.supermap.WebMap.prototype.setEachFeatureDefaultStyle * @description 为标注图层上的feature设置样式 * @param {array} features - 所以的feature集合 */ }, { key: "setEachFeatureDefaultStyle", value: function setEachFeatureDefaultStyle(features) { var that = this; features = core_Util_Util.isArray(features) || features instanceof external_ol_Collection_default.a ? features : [features]; features.forEach(function (feature) { var geomType = feature.getGeometry().getType().toUpperCase(); // let styleType = geomType === "POINT" ? 'MARKER' : geomType; var defaultStyle = feature.getProperties().useStyle; if (defaultStyle) { if (geomType === 'POINT' && defaultStyle.text) { //说明是文字的feature类型 geomType = "TEXT"; } var attributes = that.setFeatureInfo(feature); feature.setProperties({ useStyle: defaultStyle, attributes: attributes }); //标注图层的feature上需要存一个layerId,为了之后样式应用到图层上使用 // feature.layerId = timeId; if (geomType === 'POINT' && defaultStyle.src && defaultStyle.src.indexOf('http://') === -1 && defaultStyle.src.indexOf('https://') === -1) { //说明地址不完整 defaultStyle.src = that.server + defaultStyle.src; } } else { defaultStyle = StyleUtils_StyleUtils.getMarkerDefaultStyle(geomType, that.server); } feature.setStyle(StyleUtils_StyleUtils.toOpenLayersStyle(defaultStyle, geomType)); }, this); } /** * @private * @function ol.supermap.WebMap.prototype.setFeatureInfo * @description 为feature设置属性 * @param {array} feature - 单个feature * @returns {object} 属性 */ }, { key: "setFeatureInfo", value: function setFeatureInfo(feature) { var attributes = feature.get('attributes'), defaultAttr = { dataViz_title: '', dataViz_description: '', dataViz_imgUrl: '', dataViz_url: '' }, newAttribute = Object.assign(defaultAttr, attributes); var properties = feature.getProperties(); for (var key in newAttribute) { if (properties[key]) { newAttribute[key] = properties[key]; delete properties[key]; } } return newAttribute; } /** * @private * @function ol.supermap.WebMap.prototype.createRankSymbolLayer * @description 创建等级符号图层 * @param {object} layerInfo - 图层信息 * @param {array} features - 添加到图层上的features * @returns {ol/layer/Vector} 矢量图层 */ }, { key: "createRankSymbolLayer", value: function createRankSymbolLayer(layerInfo, features) { var styleSource = this.createRankStyleSource(layerInfo, features, layerInfo.featureType); var layer = new external_ol_layer_["Vector"]({ styleSource: styleSource, source: new external_ol_source_["Vector"]({ features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features, wrapX: false }), renderMode: 'image' }); layer.setStyle(function (feature) { var styleSource = layer.get('styleSource'); var themeField = styleSource.parameters.themeSetting.themeField; var value = Number(feature.get('attributes')[themeField]); var styleGroups = styleSource.styleGroups; for (var i = 0, len = styleGroups.length; i < len; i++) { if (value >= styleGroups[i].start && value < styleGroups[i].end) { return styleSource.styleGroups[i].olStyle; } } }); return layer; } /** * @private * @function ol.supermap.WebMap.prototype.createRankSymbolLayer * @description 创建等级符号图层的source * @param {object} parameters - 图层信息 * @param {array} features - 添加到图层上的features * @param {string} featureType - feature的类型 * @returns {object} styleGroups */ }, { key: "createRankStyleSource", value: function createRankStyleSource(parameters, features, featureType) { var themeSetting = parameters.themeSetting, themeField = themeSetting.themeField; var styleGroups = this.getRankStyleGroup(themeField, features, parameters, featureType); return styleGroups ? { parameters: parameters, styleGroups: styleGroups } : false; } /** * @private * @function ol.supermap.WebMap.prototype.getRankStyleGroup * @description 获取等级符号的style * @param {string} themeField - 分段字段 * @param {array} features - 添加到图层上的features * @param {object} parameters - 图层参数 * @param {string} featureType - feature的类型 * @returns {array} stylegroup */ }, { key: "getRankStyleGroup", value: function getRankStyleGroup(themeField, features, parameters, featureType) { // 找出所有的单值 var values = [], segements = [], style = parameters.style, themeSetting = parameters.themeSetting, segmentMethod = themeSetting.segmentMethod || this.defaultParameters.themeSetting.segmentMethod, segmentCount = themeSetting.segmentCount || this.defaultParameters.themeSetting.segmentCount, customSettings = themeSetting.customSettings, minR = parameters.themeSetting.minRadius, maxR = parameters.themeSetting.maxRadius, fillColor = style.fillColor, colors = parameters.themeSetting.colors; features.forEach(function (feature) { var attributes = feature.get('attributes'), value = attributes[themeField]; // 过滤掉空值和非数值 if (value == null || !core_Util_Util.isNumber(value)) { return; } values.push(Number(value)); }); try { segements = ArrayStatistic.getArraySegments(values, segmentMethod, segmentCount); } catch (error) { console.error(error); } // 处理自定义 分段 for (var i = 0; i < segmentCount; i++) { if (i in customSettings) { var startValue = customSettings[i]['segment']['start'], endValue = customSettings[i]['segment']['end']; startValue != null && (segements[i] = startValue); endValue != null && (segements[i + 1] = endValue); } } //生成styleGroup var styleGroup = []; if (segements && segements.length) { var len = segements.length, incrementR = (maxR - minR) / (len - 1), // 半径增量 start, end, radius = Number(((maxR + minR) / 2).toFixed(2)); // 获取颜色 var rangeColors = colors ? ColorsPickerUtil.getGradientColors(colors, len, 'RANGE') : []; for (var j = 0; j < len - 1; j++) { start = Number(segements[j].toFixed(2)); end = Number(segements[j + 1].toFixed(2)); // 这里特殊处理以下分段值相同的情况(即所有字段值相同) radius = start === end ? radius : minR + Math.round(incrementR * j); // 最后一个分段时将end+0.01,避免取不到最大值 end = j === len - 2 ? end + 0.01 : end; // 处理自定义 半径 radius = customSettings[j] && customSettings[j].radius ? customSettings[j].radius : radius; // 转化成 ol 样式 style.radius = radius; style.fillColor = customSettings[j] && customSettings[j].color ? customSettings[j].color : rangeColors[j] || fillColor; var olStyle = StyleUtils_StyleUtils.getOpenlayersStyle(style, featureType, true); styleGroup.push({ olStyle: olStyle, radius: radius, start: start, end: end, fillColor: style.fillColor }); } return styleGroup; } else { return false; } } /** * @private * @function ol.supermap.WebMap.prototype.checkUploadToRelationship * @description 检查是否上传到关系型 * @param {String} fileId - 文件的id * @returns {Promise} 关系型文件一些参数 */ }, { key: "checkUploadToRelationship", value: function checkUploadToRelationship(fileId) { var url = this.getRequestUrl("".concat(this.server, "web/datas/").concat(fileId, "/datasets.json")); return FetchRequest.get(url, null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then(function (result) { return result; }); } /** * @private * @function ol.supermap.WebMap.prototype.getDatasources * @description 获取关系型文件发布的数据服务中数据源的名称 * @param {String} url - 获取数据源信息的url * @returns {Promise} 数据源名称 */ }, { key: "getDatasources", value: function getDatasources(url) { var requestUrl = this.getRequestUrl("".concat(url, "/data/datasources.json")); return FetchRequest.get(requestUrl, null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then(function (datasource) { var datasourceNames = datasource.datasourceNames; return datasourceNames[0]; }); } /** * @private * @function ol.supermap.WebMap.prototype.getDataService * @description 获取上传的数据信息 * @param {String} fileId - 文件id * @param {String} datasetName 数据服务的数据集名称 * @returns {Promise} 数据的信息 */ }, { key: "getDataService", value: function getDataService(fileId, datasetName) { var url = this.getRequestUrl("".concat(this.server, "web/datas/").concat(fileId, ".json")); return FetchRequest.get(url, null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then(function (result) { result.fileId = fileId; result.datasetName = datasetName; return result; }); } /** * @private * @function ol.supermap.WebMap.prototype.getRootUrl * @description 获取请求地址 * @param {string} url 请求的地址 * @param {boolean} 请求是否带上Credential. * @returns {Promise} 请求地址 */ }, { key: "getRequestUrl", value: function getRequestUrl(url, excludeCreditial) { url = excludeCreditial ? url : this.formatUrlWithCredential(url); //如果传入进来的url带了代理则不需要处理 if (this.excludePortalProxyUrl) { return; } return Util_Util.isInTheSameDomain(url) ? url : "".concat(this.getProxy()).concat(encodeURIComponent(url)); } /** * 给url带上凭证密钥 * @param {*} url 地址 */ }, { key: "formatUrlWithCredential", value: function formatUrlWithCredential(url) { if (this.credentialValue) { //有token之类的配置项 url = url.indexOf("?") === -1 ? "".concat(url, "?").concat(this.credentialKey, "=").concat(this.credentialValue) : "".concat(url, "&").concat(this.credentialKey, "=").concat(this.credentialValue); } return url; } /** * @private * @function ol.supermap.WebMap.prototype.getProxy * @description 获取代理地址 * @returns {Promise} 代理地址 */ }, { key: "getProxy", value: function getProxy(type) { if (!type) { type = 'json'; } return this.proxy || this.server + "apps/viewer/getUrlResource.".concat(type, "?url="); } /** * @private * @function ol.supermap.WebMap.prototype.getTileLayerInfo * @description 获取地图服务的信息 * @param {String} url 地图服务的url(没有地图名字) * @returns {Promise} 地图服务信息 */ }, { key: "getTileLayerInfo", value: function getTileLayerInfo(url) { var that = this, epsgCode = that.baseProjection.split('EPSG:')[1]; var requestUrl = that.getRequestUrl("".concat(url, "/maps.json")); return FetchRequest.get(requestUrl, null, { withCredentials: this.withCredentials }).then(function (response) { return response.json(); }).then(function (mapInfo) { var promises = []; if (mapInfo) { mapInfo.forEach(function (info) { var mapUrl = that.getRequestUrl("".concat(info.path, ".json?prjCoordSys=").concat(encodeURI(JSON.stringify({ epsgCode: epsgCode })))); var promise = FetchRequest.get(mapUrl, null, { withCredentials: that.withCredentials }).then(function (response) { return response.json(); }).then(function (restMapInfo) { restMapInfo.url = info.path; return restMapInfo; }); promises.push(promise); }); } return Promise.all(promises).then(function (allRestMaps) { return allRestMaps; }); }); } /** * 通过wkt参数扩展支持多坐标系 * * @param {String} wkt 字符串 * @param {string} crsCode epsg信息,如: "EPSG:4490" * * @returns {Boolean} 坐标系是否添加成功 */ }, { key: "addProjctionFromWKT", value: function addProjctionFromWKT(wkt, crsCode) { if (typeof wkt !== 'string') { //参数类型错误 return false; } else { if (wkt === "EPSG:4326" || wkt === "EPSG:3857") { return true; } else { var epsgCode = crsCode || this.getEpsgInfoFromWKT(wkt); if (epsgCode) { lib.defs(epsgCode, wkt); // 重新注册proj4到ol.proj,不然不会生效 if (external_ol_proj_proj4_ && external_ol_proj_proj4_["register"]) { external_ol_proj_proj4_["register"](lib); } else if (window.ol.proj && window.ol.proj.setProj4) { window.ol.proj.setProj4(lib); } return true; } else { // 参数类型非wkt标准 return false; } } } } /** * 通过wkt参数获取坐标信息 * * @param {String} wkt 字符串 * @returns {String} epsg 如:"EPSG:4326" */ }, { key: "getEpsgInfoFromWKT", value: function getEpsgInfoFromWKT(wkt) { if (typeof wkt !== 'string') { return false; } else if (wkt.indexOf("EPSG") === 0) { return wkt; } else { var lastAuthority = wkt.lastIndexOf("AUTHORITY") + 10, endString = wkt.indexOf("]", lastAuthority) - 1; if (lastAuthority > 0 && endString > 0) { return "EPSG:".concat(wkt.substring(lastAuthority, endString).split(",")[1].substr(1)); } else { return false; } } } /** * @private * @function ol.supermap.WebMap.prototype.createMigrationLayer * @description 创建迁徙图 * @param {Object} layerInfo 图层信息 * @param {Array} features 要素数组 * @returns {ol/layer} 图层 */ }, { key: "createMigrationLayer", value: function createMigrationLayer(layerInfo, features) { // 获取图层外包DOM if (!window.EChartsLayer.prototype.getContainer) { window.EChartsLayer.prototype.getContainer = function () { return this.$container; }; } // 设置图层可见性 if (!window.EChartsLayer.prototype.setVisible) { window.EChartsLayer.prototype.setVisible = function (visible) { if (visible) { var _options = this.get('options'); if (_options) { this.setChartOptions(_options); this.unset('options'); } } else { var _options2 = this.getChartOptions(); this.set('options', _options2); this.clear(); this.setChartOptions({}); } }; } // 设置图层层级 if (!window.EChartsLayer.prototype.setZIndex) { window.EChartsLayer.prototype.setZIndex = function (zIndex) { var container = this.getContainer(); if (container) { container.style.zIndex = zIndex; } }; } /** * 设置鼠标样式 * .cursor-default > div { * cursor: default !important; * } */ if (!window.EChartsLayer.prototype.setCursor) { window.EChartsLayer.prototype.setCursor = function () { var cursor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default'; var container = this.getContainer(); if (container && cursor === 'default') { container.classList.add('cursor-default'); } }; } var properties = core_Util_Util.getFeatureProperties(features); var lineData = this.createLinesData(layerInfo, properties); var pointData = this.createPointsData(lineData, layerInfo, properties); var options = this.createOptions(layerInfo, lineData, pointData); var layer = new window.EChartsLayer(options, { // hideOnMoving: true, // hideOnZooming: true //以下三个参数,如果不按照这样设置,会造成不可见图层时,缩放还会出现图层 hideOnMoving: false, hideOnZooming: false, forcedPrecomposeRerender: true }); layer.type = 'ECHARTS'; return layer; } /** * @private * @function ol.supermap.WebMap.prototype.createOptions * @description 创建echarts的options * @param {Object} layerInfo 图层信息 * @param {Array} lineData 线数据 * @param {Array} pointData 点数据 * @returns {Object} echarts参数 */ }, { key: "createOptions", value: function createOptions(layerInfo, lineData, pointData) { var series; var lineSeries = this.createLineSeries(layerInfo, lineData); if (pointData && pointData.length) { var pointSeries = this.createPointSeries(layerInfo, pointData); series = lineSeries.concat(pointSeries); } else { series = lineSeries.slice(); } var options = { series: series }; return options; } /** * @private * @function ol.supermap.WebMap.prototype.createLineSeries * @description 创建线系列 * @param {Object} layerInfo 图层参数 * @param {Array} lineData 线数据 * @returns {Object} 线系列 */ }, { key: "createLineSeries", value: function createLineSeries(layerInfo, lineData) { var lineSetting = layerInfo.lineSetting; var animationSetting = layerInfo.animationSetting; var linesSeries = [// 轨迹线样式 { name: 'line-series', type: 'lines', zlevel: 1, silent: true, effect: { show: animationSetting.show, constantSpeed: animationSetting.constantSpeed, trailLength: 0, symbol: animationSetting.symbol, symbolSize: animationSetting.symbolSize }, lineStyle: { normal: { color: lineSetting.color, type: lineSetting.type, width: lineSetting.width, opacity: lineSetting.opacity, curveness: lineSetting.curveness } }, data: lineData }]; if (lineData.length > MAX_MIGRATION_ANIMATION_COUNT) { // linesSeries[0].large = true; // linesSeries[0].largeThreshold = 100; linesSeries[0].blendMode = 'lighter'; } return linesSeries; } /** * @private * @function ol.supermap.WebMap.prototype.createPointSeries * @description 创建点系列 * @param {Object} layerInfo 图层参数 * @param {Array} pointData 点数据 * @returns {Object} 点系列 */ }, { key: "createPointSeries", value: function createPointSeries(layerInfo, pointData) { var lineSetting = layerInfo.lineSetting; var animationSetting = layerInfo.animationSetting; var labelSetting = layerInfo.labelSetting; var pointSeries = [{ name: 'point-series', coordinateSystem: 'geo', zlevel: 2, silent: true, label: { normal: { show: labelSetting.show, position: 'right', formatter: '{b}', color: labelSetting.color, fontFamily: labelSetting.fontFamily } }, itemStyle: { normal: { color: lineSetting.color || labelSetting.color } }, data: pointData }]; if (animationSetting.show) { // 开启动画 pointSeries[0].type = 'effectScatter'; pointSeries[0].rippleEffect = { brushType: 'stroke' }; } else { // 关闭动画 pointSeries[0].type = 'scatter'; } return pointSeries; } /** * @private * @function ol.supermap.WebMap.prototype.createPointsData * @param {Array} lineData 线数据 * @param {Object} layerInfo 图层信息 * @param {Array} properties 属性 * @returns {Array} 点数据 */ }, { key: "createPointsData", value: function createPointsData(lineData, layerInfo, properties) { var data = [], labelSetting = layerInfo.labelSetting; // 标签隐藏则直接返回 if (!labelSetting.show || !lineData.length) { return data; } var fromData = [], toData = []; lineData.forEach(function (item, idx) { var coords = item.coords, fromCoord = coords[0], toCoord = coords[1], fromProperty = properties[idx][labelSetting.from], toProperty = properties[idx][labelSetting.to]; // 起始字段去重 var f = fromData.find(function (d) { return d.value[0] === fromCoord[0] && d.value[1] === fromCoord[1]; }); !f && fromData.push({ name: fromProperty, value: fromCoord }); // 终点字段去重 var t = toData.find(function (d) { return d.value[0] === toCoord[0] && d.value[1] === toCoord[1]; }); !t && toData.push({ name: toProperty, value: toCoord }); }); data = fromData.concat(toData); return data; } /** * @private * @function ol.supermap.WebMap.prototype.createLinesData * @param {Object} layerInfo 图层信息 * @param {Array} properties 属性 * @returns {Array} 线数据 */ }, { key: "createLinesData", value: function createLinesData(layerInfo, properties) { var data = []; if (properties && properties.length) { // 重新获取数据 var from = layerInfo.from, to = layerInfo.to, fromCoord, toCoord; if (from.type === 'XY_FIELD' && from['xField'] && from['yField'] && to['xField'] && to['yField']) { properties.forEach(function (property) { var fromX = property[from['xField']], fromY = property[from['yField']], toX = property[to['xField']], toY = property[to['yField']]; if (!fromX || !fromY || !toX || !toY) { return; } fromCoord = [property[from['xField']], property[from['yField']]]; toCoord = [property[to['xField']], property[to['yField']]]; data.push({ coords: [fromCoord, toCoord] }); }); } else if (from.type === 'PLACE_FIELD' && from['field'] && to['field']) { var centerDatas = ProvinceCenter.concat(MunicipalCenter); properties.forEach(function (property) { var fromField = property[from['field']], toField = property[to['field']]; fromCoord = centerDatas.find(function (item) { return core_Util_Util.isMatchAdministrativeName(item.name, fromField); }); toCoord = centerDatas.find(function (item) { return core_Util_Util.isMatchAdministrativeName(item.name, toField); }); if (!fromCoord || !toCoord) { return; } data.push({ coords: [fromCoord.coord, toCoord.coord] }); }); } } return data; } /** * @private * @function ol.supermap.WebMap.prototype.getService * @description 获取当前数据发布的服务中的某种类型服务 * @param {Array} services 服务集合 * @param {String} type 服务类型,RESTDATA, RESTMAP * @returns {Object} 服务 */ }, { key: "getService", value: function getService(services, type) { var service = services.filter(function (info) { return info && info.serviceType === type; }); return service[0]; } /** * @private * @function ol.supermap.WebMap.prototype.isMvt * @description 判断当前能否使用数据服务的mvt上图方式 * @param {String} serviceUrl 数据服务的地址 * @param {String} datasetName 数据服务的数据集名称 * @returns {Object} 数据服务的信息 */ }, { key: "isMvt", value: function isMvt(serviceUrl, datasetName) { var that = this; return this.getDatasetsInfo(serviceUrl, datasetName).then(function (info) { //判断是否和底图坐标系一直 if (info.epsgCode == that.baseProjection.split('EPSG:')[1]) { return FetchRequest.get(that.getRequestUrl("".concat(info.url, "/tilefeature.mvt")), null, { withCredentials: that.withCredentials }).then(function (response) { return response.json(); }).then(function (result) { info.isMvt = result.error && result.error.code === 400; return info; })["catch"](function () { return info; }); } return info; }); } /** * @private * @function ol.supermap.WebMap.prototype.getDatasetsInfo * @description 获取数据集信息 * @param {String} serviceUrl 数据服务的地址 * @param {String} datasetName 数据服务的数据集名称 * @returns {Object} 数据服务的信息 */ }, { key: "getDatasetsInfo", value: function getDatasetsInfo(serviceUrl, datasetName) { var that = this; return that.getDatasources(serviceUrl).then(function (datasourceName) { //判断mvt服务是否可用 var url = "".concat(serviceUrl, "/data/datasources/").concat(datasourceName, "/datasets/").concat(datasetName, ".json"); return FetchRequest.get(that.getRequestUrl(url), null, { withCredentials: that.withCredentials }).then(function (response) { return response.json(); }).then(function (datasetsInfo) { return { epsgCode: datasetsInfo.datasetInfo.prjCoordSys.epsgCode, bounds: datasetsInfo.datasetInfo.bounds, url: url //返回的是原始url,没有代理。因为用于请求mvt }; }); }); } /** * @private * @function ol.supermap.WebMap.prototype.isRestMapMapboxStyle * @description 仅判断是否为restmap mvt地图服务 rest-map服务的Mapbox Style资源地址是这样的: .../iserver/services/map-Population/rest/maps/PopulationDistribution/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true * @param {Object} layerInfo webmap中的MapStylerLayer * @returns {Boolean} 是否为restmap mvt地图服务 */ }, { key: "isRestMapMapboxStyle", value: function isRestMapMapboxStyle(layerInfo) { var restMapMVTStr = '/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true&tileURLTemplate=ZXY'; var dataSource = layerInfo.dataSource; var layerType = layerInfo.layerType; if (dataSource && dataSource.type === "EXTERNAL" && dataSource.url.indexOf(restMapMVTStr) > -1 && (layerType === "MAPBOXSTYLE" || layerType === "VECTOR_TILE")) { return true; } return false; } /** * @private * @function ol.supermap.WebMap.prototype.getMapboxStyleLayerInfo * @description 获取mapboxstyle图层信息 * @param {layerInfo} layerInfo 图层信息 * @returns {Object} 图层信息 */ }, { key: "getMapboxStyleLayerInfo", value: function getMapboxStyleLayerInfo(mapInfo, layerInfo) { var _this = this; return new Promise(function (resolve, reject) { return _this.getMapLayerExtent(layerInfo).then(function (layer) { return _this.getMapboxStyle(mapInfo, layer).then(function (styleLayer) { Object.assign(layer, styleLayer); resolve(layer); })["catch"](function (error) { reject(error); }); })["catch"](function (error) { reject(error); }); }); } /** * @private * @function ol.supermap.WebMap.prototype.getMapLayerExtent * @description 获取mapboxstyle图层信息 * @param {Object} layerInfo 图层信息 * @returns {Object} 图层信息 */ }, { key: "getMapLayerExtent", value: function getMapLayerExtent(layerInfo) { var restMapMVTStr = '/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true&tileURLTemplate=ZXY'; var dataSource = layerInfo.dataSource; var url = dataSource.url; if (this.isRestMapMapboxStyle(layerInfo)) { url = url.replace(restMapMVTStr, ''); } url = this.getRequestUrl(url + '.json'); var credential = layerInfo.credential; var credentialValue, keyfix; //携带令牌(restmap用的首字母大写,但是这里要用小写) if (credential) { keyfix = Object.keys(credential)[0]; credentialValue = credential[keyfix]; url = "".concat(url, "?").concat(keyfix, "=").concat(credentialValue); } return FetchRequest.get(url, null, { withCredentials: this.withCredentials, withoutFormatSuffix: true, headers: { 'Content-Type': 'application/json;chartset=uft-8' } }).then(function (response) { return response.json(); }).then(function (result) { layerInfo.visibleScales = result.visibleScales; layerInfo.coordUnit = result.coordUnit; layerInfo.scale = result.scale; layerInfo.epsgCode = result.prjCoordSys.epsgCode; layerInfo.bounds = result.bounds; return layerInfo; })["catch"](function (error) { return error; }); } /** * @private * @function ol.supermap.WebMap.prototype.getMapboxStyle * @description 获取mapboxstyle --- ipt中自定义底图请求mapboxstyle目前有两种url格式 * rest-map服务的Mapbox Style资源地址是这样的: .../iserver/services/map-Population/rest/maps/PopulationDistribution/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true * restjsr片服务的Mapbox Style资源地址是这样的:.../iserver/services/map-china400/restjsr/v1/vectortile/maps/China/style.json * @param {Object} mapboxstyle图层信息 * @returns {Object} 图层信息 */ }, { key: "getMapboxStyle", value: function getMapboxStyle(mapInfo, layerInfo) { var _this = this; var url = layerInfo.url || layerInfo.dataSource.url; var styleUrl = url; if (styleUrl.indexOf('/restjsr/') > -1) { styleUrl = "".concat(styleUrl, "/style.json"); } styleUrl = this.getRequestUrl(styleUrl); var credential = layerInfo.credential; //携带令牌(restmap用的首字母大写,但是这里要用小写) var credentialValue, keyfix; if (credential) { keyfix = Object.keys(credential)[0]; credentialValue = credential[keyfix]; styleUrl = "".concat(styleUrl, "?").concat(keyfix, "=").concat(credentialValue); } return FetchRequest.get(styleUrl, null, { withCredentials: this.withCredentials, withoutFormatSuffix: true, headers: { 'Content-Type': 'application/json;chartset=uft-8' } }).then(function (response) { return response.json(); }).then(function (styles) { _this._matchStyleObject(styles); var bounds = layerInfo.bounds; // 处理携带令牌的情况 if (credentialValue) { styles.sprite = "".concat(styles.sprite, "?").concat(keyfix, "=").concat(credentialValue); var sources = styles.sources; var sourcesNames = Object.keys(sources); sourcesNames.forEach(function (sourceName) { styles.sources[sourceName].tiles.forEach(function (tiles, i) { styles.sources[sourceName].tiles[i] = "".concat(tiles, "?").concat(keyfix, "=").concat(credentialValue); }); }); } var newLayerInfo = { url: url, sourceType: 'VECTOR_TILE', layerType: 'VECTOR_TILE', styles: styles, extent: bounds && [bounds.left, bounds.bottom, bounds.right, bounds.top], bounds: layerInfo.bounds, projection: "EPSG:" + layerInfo.epsgCode, epsgCode: layerInfo.epsgCode, name: layerInfo.name }; Object.assign(layerInfo, newLayerInfo); if (layerInfo.zIndex > 0) { // 过滤styles 非底图mapboxstyle图层才需此处理 _this.modifyMapboxstyleLayer(mapInfo, layerInfo); } return layerInfo; })["catch"](function (error) { return error; }); } /** * @private * @function ol.supermap.WebMap.prototype.modifyMapboxstyleLayer * @description mapboxstyle图层:1. layer id重复问题 2.叠加图层背景色问题 * @param {Object} mapInfo 地图信息 * @param {Object} layerInfo 当前要添加到地图的图层 */ }, { key: "modifyMapboxstyleLayer", value: function modifyMapboxstyleLayer(mapInfo, layerInfo) { var that = this; if (mapInfo.layers && mapInfo.layers.length === 0) { return; } var curLayers = layerInfo.styles.layers; if (!curLayers) { return; } // 非底图,则移除"background"图层 curLayers = curLayers.filter(function (layer) { return layer.type !== "background"; }); layerInfo.styles.layers = curLayers; // 处理mapboxstyle图层layer id重复的情况 var addedLayersArr = mapInfo.layers.filter(function (layer) { return layer.layerType === 'VECTOR_TILE' && layer.zIndex !== layerInfo.zIndex; }).map(function (addLayer) { return addLayer.styles && addLayer.styles.layers; }); if (!addedLayersArr || addedLayersArr && addedLayersArr.length === 0) { return; } addedLayersArr.forEach(function (layers) { curLayers.forEach(function (curLayer) { that.renameLayerId(layers, curLayer); }); }); } /** * @private * @function ol.supermap.WebMap.prototype.renameLayerId * @description mapboxstyle图层 id重复的layer添加后缀编码 (n)[参考mapstudio] * @param {mapboxgl.Layer[]} layers 已添加到地图的图层组 * @param {mapboxgl.Layer} curLayer 当前图层 */ }, { key: "renameLayerId", value: function renameLayerId(layers, curLayer) { if (layers.find(function (l) { return l.id === curLayer.id; })) { var result = curLayer.id.match(/(.+)\((\w)\)$/); if (result) { curLayer.id = "".concat(result[1], "(").concat(+result[2] + 1, ")"); } else { curLayer.id += '(1)'; } if (layers.find(function (l) { return l.id === curLayer.id; })) { this.renameLayerId(layers, curLayer); } } } /** * @private * @function mapboxgl.supermap.WebMap.prototype._matchStyleObject * @description 恢复 style 为标准格式。 * @param {Object} style - mapbox 样式。 */ }, { key: "_matchStyleObject", value: function _matchStyleObject(style) { var sprite = style.sprite, glyphs = style.glyphs; if (sprite && WebMap_typeof(sprite) === 'object') { style.sprite = Object.values(sprite)[0]; } if (glyphs && WebMap_typeof(glyphs) === 'object') { style.glyphs = Object.values(glyphs)[0]; } } /** * @private * @function ol.supermap.WebMap.prototype.renameLayerId * @description 判断url是否是iportal的代理地址 * @param {*} serviceUrl */ }, { key: "isIportalProxyServiceUrl", value: function isIportalProxyServiceUrl(serviceUrl) { if (this.serviceProxy && this.serviceProxy.enable && serviceUrl) { var proxyStr = ''; if (this.serviceProxy.proxyServerRootUrl) { proxyStr = "".concat(this.serviceProxy.proxyServerRootUrl, "/"); } else if (this.serviceProxy.rootUrlPostfix) { proxyStr = "".concat(this.serviceProxy.port, "/").concat(this.serviceProxy.rootUrlPostfix, "/"); } else if (!this.serviceProxy.rootUrlPostfix) { proxyStr = "".concat(this.serviceProxy.port, "/"); } if (this.serviceProxy.port !== 80) { return serviceUrl.indexOf(proxyStr) >= 0; } else { // 代理端口为80,url中不一定有端口,满足一种情况即可 return serviceUrl.indexOf(proxyStr) >= 0 || serviceUrl.indexOf(proxyStr.replace(':80', '')) >= 0; } } else { return false; } } /** * @private * @function ol.supermap.WebMap.prototype.getStyleResolutions * @description 创建图层分辨率 * @param {Object} bounds 图层上下左右范围 * @returns {Array} styleResolutions 样式分辨率 */ }, { key: "getStyleResolutions", value: function getStyleResolutions(bounds) { var minZoom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var maxZoom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 22; var styleResolutions = []; var TILE_SIZE = 512; var temp = Math.abs(bounds.left - bounds.right) / TILE_SIZE; for (var i = minZoom; i <= maxZoom; i++) { if (i === 0) { styleResolutions[i] = temp; continue; } temp = temp / 2; styleResolutions[i] = temp; } return styleResolutions; } /** * @private * @function ol.supermap.WebMap.prototype.createVisibleResolution * @description 创建图层可视分辨率 * @param {Array} visibleScales 可视比例尺范围 * @param {Array} indexbounds * @param {Object} bounds 图层上下左右范围 * @param {String} coordUnit * @returns {Array} visibleResolution */ }, { key: "createVisibleResolution", value: function createVisibleResolution(visibleScales, indexbounds, bounds, coordUnit) { var _this5 = this; var visibleResolution = []; // 1 设置了地图visibleScales的情况 if (visibleScales && visibleScales.length > 0) { visibleResolution = visibleScales.map(function (scale) { var value = 1 / scale; var res = _this5.getResFromScale(value, coordUnit); return res; }); } else { // 2 地图的bounds var envelope = this.getEnvelope(indexbounds, bounds); visibleResolution = this.getStyleResolutions(envelope); } return visibleResolution; } /** * @private * @function ol.supermap.WebMap.prototype.createVisibleResolution * @description 图层边界范围 * @param {Array} indexbounds * @param {Object} bounds 图层上下左右范围 * @returns {Object} envelope */ }, { key: "getEnvelope", value: function getEnvelope(indexbounds, bounds) { var envelope = {}; if (indexbounds && indexbounds.length === 4) { envelope.left = indexbounds[0]; envelope.bottom = indexbounds[1]; envelope.right = indexbounds[2]; envelope.top = indexbounds[3]; } else { envelope = bounds; } return envelope; } /** * @private * @function ol.supermap.WebMap.prototype.createMVTLayer * @description 创建矢量瓦片图层 * @param {object} layerInfo - 图层信息 */ }, { key: "createMVTLayer", value: function createMVTLayer(layerInfo) { // let that = this; var styles = layerInfo.styles; var indexbounds = styles && styles.metadata && styles.metadata.indexbounds; var visibleResolution = this.createVisibleResolution(layerInfo.visibleScales, indexbounds, layerInfo.bounds, layerInfo.coordUnit); var envelope = this.getEnvelope(indexbounds, layerInfo.bounds); var styleResolutions = this.getStyleResolutions(envelope); // const origin = [envelope.left, envelope.top]; var withCredentials = this.isIportalProxyServiceUrl(styles.sprite); // 创建MapBoxStyle样式 var mapboxStyles = new MapboxStyles_MapboxStyles({ style: styles, source: styles.name, resolutions: styleResolutions, map: this.map, withCredentials: withCredentials }); return new Promise(function (resolve) { mapboxStyles.on('styleloaded', function () { var minResolution = visibleResolution[visibleResolution.length - 1]; var maxResolution = visibleResolution[0]; var layer = new external_ol_layer_["VectorTile"]({ //设置避让参数 declutter: true, source: new VectorTileSuperMapRest_VectorTileSuperMapRest({ style: styles, withCredentials: withCredentials, projection: layerInfo.projection, format: new external_ol_format_MVT_default.a({ featureClass: external_ol_render_Feature_default.a }), wrapX: false }), style: mapboxStyles.featureStyleFuntion, visible: layerInfo.visible, zIndex: layerInfo.zIndex, opacity: layerInfo.opacity, minResolution: minResolution, // The maximum resolution (exclusive) below which this layer will be visible. maxResolution: maxResolution > 1 ? Math.ceil(maxResolution) : maxResolution * 1.1 }); resolve(layer); }); }); } /** * @private * @function ol.supermap.WebMap.prototype.isSameDomain * @description 判断是否同域名(如果是域名,只判断后门两级域名是否相同,第一级忽略),如果是ip地址则需要完全相同。 * @param {*} url */ }, { key: "isSameDomain", value: function isSameDomain(url) { var documentUrlArray = url.split("://"), substring = documentUrlArray[1]; var domainIndex = substring.indexOf("/"), domain = substring.substring(0, domainIndex); var documentUrl = document.location.toString(); var docUrlArray = documentUrl.split("://"), documentSubstring = docUrlArray[1]; var docuDomainIndex = documentSubstring.indexOf("/"), docDomain = documentSubstring.substring(0, docuDomainIndex); if (domain.indexOf(':') > -1 || window.location.port !== "") { //说明用的是ip地址,判断完整域名判断 return domain === docDomain; } else { var domainArray = domain.split('.'), docDomainArray = docDomain.split('.'); return domainArray[1] === docDomainArray[1] && domainArray[2] === docDomainArray[2]; } } /** * @private * @function ol.supermap.WebMap.prototype.isSupportWebp * @description 判断是否支持webP * @param {*} url 服务地址 * @param {*} token 服务token * @returns {boolean} */ // isSupportWebp(url, token) { // // 还需要判断浏览器 // let isIE = this.isIE(); // if (isIE || (this.isFirefox() && this.getFirefoxVersion() < 65) || // (this.isChrome() && this.getChromeVersion() < 32)) { // return false; // } // url = token ? `${url}/tileImage.webp?token=${token}` : `${url}/tileImage.webp`; // let isSameDomain = CommonUtil.isInTheSameDomain(url), excledeCreditial; // if (isSameDomain && !token) { // // online上服务域名一直,要用token值 // excledeCreditial = false; // } else { // excledeCreditial = true; // } // url = this.getRequestUrl(url, excledeCreditial); // return FetchRequest.get(url, null, { // withCredentials: this.withCredentials, // withoutFormatSuffix: true // }).then(function (response) { // if (response.status !== 200) { // throw response.status; // } // return response; // }).then(() => { // return true; // }).catch(() => { // return false; // }) // } /** * @private * @function ol.supermap.WebMap.prototype.isIE * @description 判断当前浏览器是否为IE * @returns {boolean} */ }, { key: "isIE", value: function isIE() { if (!!window.ActiveXObject || "ActiveXObject" in window) { return true; } return false; } /** * @private * @function ol.supermap.WebMap.prototype.isFirefox * @description 判断当前浏览器是否为 firefox * @returns {boolean} */ }, { key: "isFirefox", value: function isFirefox() { var userAgent = navigator.userAgent; return userAgent.indexOf("Firefox") > -1; } /** * @private * @function ol.supermap.WebMap.prototype.isChrome * @description 判断当前浏览器是否为谷歌 * @returns {boolean} */ }, { key: "isChrome", value: function isChrome() { var userAgent = navigator.userAgent; return userAgent.indexOf("Chrome") > -1; } /** * @private * @function ol.supermap.WebMap.prototype.getFirefoxVersion * @description 获取火狐浏览器的版本号 * @returns {Number} */ }, { key: "getFirefoxVersion", value: function getFirefoxVersion() { var userAgent = navigator.userAgent.toLowerCase(), version = userAgent.match(/firefox\/([\d.]+)/); return +version[1]; } /** * @private * @function ol.supermap.WebMap.prototype.getChromeVersion * @description 获取谷歌浏览器版本号 * @returns {Number} */ }, { key: "getChromeVersion", value: function getChromeVersion() { var userAgent = navigator.userAgent.toLowerCase(), version = userAgent.match(/chrome\/([\d.]+)/); return +version[1]; } }]); return WebMap; }(external_ol_Observable_default.a); // CONCATENATED MODULE: ./src/openlayers/mapping/index.js /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ // CONCATENATED MODULE: ./src/openlayers/namespace.js /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ /* control */ /* core */ /* mapping */ /* overlay */ /* service */ if (window && window.ol) { var namespace_ol = window.ol; namespace_ol.supermap = window.ol.supermap || {}; namespace_ol.supermap.control = window.ol.supermap.control || {}; // control namespace_ol.supermap.control.ChangeTileVersion = ChangeTileVersion_ChangeTileVersion; namespace_ol.supermap.control.Logo = Logo_Logo; namespace_ol.supermap.control.ScaleLine = ScaleLine_ScaleLine; // core namespace_ol.supermap.StyleUtils = StyleUtils_StyleUtils; namespace_ol.supermap.Util = core_Util_Util; // mapping namespace_ol.source.BaiduMap = BaiduMap_BaiduMap; namespace_ol.source.ImageSuperMapRest = ImageSuperMapRest_ImageSuperMapRest; namespace_ol.source.SuperMapCloud = SuperMapCloud; namespace_ol.source.Tianditu = Tianditu_Tianditu; namespace_ol.source.TileSuperMapRest = TileSuperMapRest_TileSuperMapRest; namespace_ol.supermap.WebMap = WebMap_WebMap; // overlay namespace_ol.style.CloverShape = CloverShape_CloverShape; namespace_ol.Graphic = Graphic_Graphic; namespace_ol.style.HitCloverShape = HitCloverShape; namespace_ol.source.GeoFeature = GeoFeature_GeoFeature; namespace_ol.source.Theme = theme_Theme_Theme; namespace_ol.supermap.ThemeFeature = ThemeFeature_ThemeFeature; namespace_ol.supermap.MapboxStyles = MapboxStyles_MapboxStyles; namespace_ol.supermap.VectorTileStyles = VectorTileStyles_VectorTileStyles; namespace_ol.source.DataFlow = DataFlow_DataFlow; namespace_ol.source.Graph = overlay_Graph_Graph; namespace_ol.source.Graphic = overlay_Graphic_Graphic; namespace_ol.source.HeatMap = HeatMap_HeatMap; namespace_ol.source.Label = overlay_Label_Label; namespace_ol.source.Mapv = Mapv_Mapv; namespace_ol.source.Range = Range_Range; namespace_ol.source.RankSymbol = overlay_RankSymbol_RankSymbol; namespace_ol.source.Turf = Turf_Turf; namespace_ol.source.Unique = Unique_Unique; namespace_ol.source.VectorTileSuperMapRest = VectorTileSuperMapRest_VectorTileSuperMapRest; // service namespace_ol.supermap.AddressMatchService = services_AddressMatchService_AddressMatchService; namespace_ol.supermap.ChartService = ChartService_ChartService; namespace_ol.supermap.DataFlowService = services_DataFlowService_DataFlowService; namespace_ol.supermap.FeatureService = FeatureService_FeatureService; namespace_ol.supermap.FieldService = FieldService_FieldService; namespace_ol.supermap.GridCellInfosService = GridCellInfosService_GridCellInfosService; namespace_ol.supermap.GeoprocessingService = services_GeoprocessingService_GeoprocessingService; namespace_ol.supermap.LayerInfoService = LayerInfoService_LayerInfoService; namespace_ol.supermap.MapService = services_MapService_MapService; namespace_ol.supermap.MeasureService = services_MeasureService_MeasureService; namespace_ol.supermap.NetworkAnalyst3DService = NetworkAnalyst3DService_NetworkAnalyst3DService; namespace_ol.supermap.NetworkAnalystService = NetworkAnalystService_NetworkAnalystService; namespace_ol.supermap.ProcessingService = ProcessingService_ProcessingService; namespace_ol.supermap.QueryService = services_QueryService_QueryService; namespace_ol.supermap.ServiceBase = ServiceBase; namespace_ol.supermap.SpatialAnalystService = SpatialAnalystService_SpatialAnalystService; namespace_ol.supermap.ThemeService = services_ThemeService_ThemeService; namespace_ol.supermap.TrafficTransferAnalystService = TrafficTransferAnalystService_TrafficTransferAnalystService; namespace_ol.supermap.WebPrintingJobService = WebPrintingJobService_WebPrintingJobService; } /***/ }), /* 74 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /* 75 */, /* 76 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }) /******/ ]);