gis-common 3.1.2 → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/constant/ErrorTypeConstant.d.ts +23 -0
  2. package/dist/constant/EventTypeConstant.d.ts +24 -0
  3. package/dist/constant/GraphicConstant.d.ts +16 -0
  4. package/dist/constant/LayerType.d.ts +10 -0
  5. package/dist/constant/index.d.ts +4 -0
  6. package/dist/gis-common.es.js +1751 -0
  7. package/dist/gis-common.umd.js +1 -0
  8. package/dist/index.d.ts +9 -0
  9. package/dist/utils/Cookie.d.ts +6 -0
  10. package/dist/utils/MathUtils.d.ts +36 -0
  11. package/package.json +26 -28
  12. package/dist/resource.min.js +0 -1
  13. package/src/assets/images/location.png +0 -0
  14. package/src/constant/ErrorTypeConstant.js +0 -22
  15. package/src/constant/EventTypeConstant.js +0 -23
  16. package/src/constant/GraphicConstant.js +0 -16
  17. package/src/constant/LayerType.js +0 -9
  18. package/src/constant/index.js +0 -4
  19. package/src/core/AudioPlayer.js +0 -30
  20. package/src/core/CanvasDrawer.js +0 -51
  21. package/src/core/DevicePixelRatio.js +0 -86
  22. package/src/core/ElQuery.js +0 -88
  23. package/src/core/EventDispatcher.js +0 -93
  24. package/src/core/HashMap.js +0 -26
  25. package/src/core/MqttClient.js +0 -108
  26. package/src/core/WebSocketClient.js +0 -104
  27. package/src/core/WebStorage.js +0 -73
  28. package/src/index.js +0 -10
  29. package/src/utils/AnimateUtils.js +0 -78
  30. package/src/utils/ArrayUtils.js +0 -82
  31. package/src/utils/AssertUtils.js +0 -112
  32. package/src/utils/BrowserUtils.js +0 -107
  33. package/src/utils/CommUtils.js +0 -236
  34. package/src/utils/Cookie.js +0 -23
  35. package/src/utils/CoordsUtils.js +0 -145
  36. package/src/utils/DateUtils.js +0 -144
  37. package/src/utils/DomUtils.js +0 -94
  38. package/src/utils/FileUtils.js +0 -104
  39. package/src/utils/GeoUtils.js +0 -253
  40. package/src/utils/MathUtils.js +0 -49
  41. package/src/utils/OptimizeUtils.js +0 -94
  42. package/src/utils/StringUtils.js +0 -148
  43. package/src/utils/index.js +0 -14
@@ -1,112 +0,0 @@
1
- import GeoUtils from './GeoUtils'
2
- import CommUtils from './CommUtils'
3
- import ErrorType from '../constant/ErrorTypeConstant'
4
- import StringUtils from './StringUtils'
5
- export default {
6
- notNull(data) {
7
- if (CommUtils.isEmpty(data)) {
8
- throw Error('不能为空:>>>' + data)
9
- }
10
- },
11
- legalLnglat(lng, lat) {
12
- if (!GeoUtils.isLnglat(lng, lat)) {
13
- throw Error(ErrorType.COORDINATE_ERROR)
14
- }
15
- },
16
- contain(str, ...args) {
17
- let res = false
18
- const len = args.length || 0
19
- for (let i = 0, l = len; i < l; i++) {
20
- res = str.indexOf(args[i]) >= 0
21
- }
22
- if (res) {
23
- throw Error(ErrorType.STRING_CHECK_LOSS)
24
- }
25
- },
26
- verify: {
27
- array(data) {
28
- if (CommUtils.getDataType(data) !== 'Array') {
29
- throw Error(ErrorType.PARAMETER_ERROR_ARRAY + ':>>>' + data)
30
- }
31
- },
32
- function(data) {
33
- if (CommUtils.getDataType(data) !== 'Function') {
34
- throw Error(ErrorType.PARAMETER_ERROR_FUNCTION + ':>>>' + data)
35
- }
36
- },
37
- object(data) {
38
- if (CommUtils.getDataType(data) !== 'Object') {
39
- throw Error(ErrorType.PARAMETER_ERROR_OBJECT + ':>>>' + data)
40
- }
41
- },
42
- },
43
- legalJSON(data) {
44
- try {
45
- JSON.parse(data)
46
- } catch (err) {
47
- throw Error(ErrorType.JSON_PARSE_ERROR + ':>>>' + data)
48
- }
49
- },
50
- legalData(data, type) {
51
- const bool = StringUtils.checkStr(data, type)
52
- let typename = ''
53
- switch (type) {
54
- case 'phone':
55
- typename = '电话'
56
- break
57
- case 'tel':
58
- typename = '座机'
59
- break
60
- case 'card':
61
- typename = '身份证'
62
- break
63
- case 'pwd':
64
- typename = '密码'
65
- break
66
- case 'postal':
67
- typename = '邮政编码'
68
- break
69
- case 'QQ':
70
- typename = 'QQ'
71
- break
72
- case 'email':
73
- typename = '邮箱'
74
- break
75
- case 'money':
76
- typename = '金额'
77
- break
78
- case 'URL':
79
- typename = '网址'
80
- break
81
- case 'IP':
82
- typename = 'IP'
83
- break
84
- case 'date':
85
- typename = '日期时间'
86
- break
87
- case 'number':
88
- typename = '数字'
89
- break
90
- case 'english':
91
- typename = '英文'
92
- break
93
- case 'chinese':
94
- typename = '中文'
95
- break
96
- case 'lower':
97
- typename = '小写'
98
- break
99
- case 'upper':
100
- typename = '大写'
101
- break
102
- case 'HTML':
103
- typename = 'HTML标记'
104
- break
105
- default:
106
- break
107
- }
108
- if (!bool) {
109
- throw Error(ErrorType.PARAMETER_ERROR + ':>>>不是' + typename)
110
- }
111
- },
112
- }
@@ -1,107 +0,0 @@
1
- export default {
2
- getUrlParams(href = window.location.href, needDecode = true) {
3
- const reg = /([^&=]+)=([\w\W]*?)(&|$|#)/g
4
- const { search, hash } = new URL(href)
5
- const args = [search, hash]
6
- let obj = {}
7
- for (let i = 0; i < args.length; i++) {
8
- const str = args[i]
9
- if (str) {
10
- const s = str.replace(/#|\//g, '')
11
- const arr = s.split('?')
12
- if (arr.length > 1) {
13
- for (let i = 1; i < arr.length; i++) {
14
- let res
15
- while ((res = reg.exec(arr[i]))) {
16
- obj[res[1]] = needDecode ? decodeURIComponent(res[2]) : res[2]
17
- }
18
- }
19
- }
20
- }
21
- }
22
- return obj
23
- },
24
- getExplorer() {
25
- var explorer = window.navigator.userAgent
26
- if (explorer.indexOf('MSIE') >= 0) {
27
- return 'IE'
28
- }
29
- if (!!window.ActiveXObject || 'ActiveXObject' in window) {
30
- // IE
31
- return 'IE'
32
- } else if (explorer.indexOf('Firefox') >= 0) {
33
- // Firefox
34
- return 'Firefox'
35
- } else if (explorer.indexOf('Chrome') >= 0) {
36
- // Chrome
37
- return 'Chrome'
38
- } else if (explorer.indexOf('Opera') >= 0) {
39
- // Opera
40
- return 'Opera'
41
- } else if (explorer.indexOf('Safari') >= 0) {
42
- // Safari
43
- return 'Safari'
44
- }
45
- },
46
- detectOS() {
47
- let os_type = ''
48
- const windows = navigator.userAgent.indexOf('Windows', 0) != -1 ? 1 : 0
49
- const mac = navigator.userAgent.indexOf('mac', 0) != -1 ? 1 : 0
50
- const linux = navigator.userAgent.indexOf('Linux', 0) != -1 ? 1 : 0
51
- const unix = navigator.userAgent.indexOf('X11', 0) != -1 ? 1 : 0
52
- if (windows) os_type = 'MS Windows'
53
- else if (mac) os_type = 'Apple mac'
54
- else if (linux) os_type = 'Linux'
55
- else if (unix) os_type = 'Unix'
56
- return os_type
57
- },
58
- switchFullScreen(status) {
59
- if (status) {
60
- const element = document.documentElement
61
- if (element.requestFullscreen) {
62
- element.requestFullscreen()
63
- } else if (element.msRequestFullscreen) {
64
- element.msRequestFullscreen()
65
- } else if (element.mozRequestFullScreen) {
66
- element.mozRequestFullScreen()
67
- } else if (element.webkitRequestFullscreen) {
68
- element.webkitRequestFullscreen()
69
- }
70
- } else {
71
- if (document.exitFullscreen) {
72
- document.exitFullscreen()
73
- } else if (document.msExitFullscreen) {
74
- document.msExitFullscreen()
75
- } else if (document.mozCancelFullScreen) {
76
- document.mozCancelFullScreen()
77
- } else if (document.webkitExitFullscreen) {
78
- document.webkitExitFullscreen()
79
- }
80
- }
81
- },
82
- /**
83
- * scale屏幕适配方案
84
- */
85
- refreshScale() {
86
- const baseWidth = document.documentElement.clientWidth
87
- const baseHeight = document.documentElement.clientHeight
88
- const appStyle = document.getElementById('app').style
89
- const realRatio = baseWidth / baseHeight
90
- const designRatio = 16 / 9
91
- let scaleRate = baseWidth / 1920
92
- if (realRatio > designRatio) {
93
- scaleRate = baseHeight / 1080
94
- }
95
- appStyle.transformOrigin = 'left top'
96
- appStyle.transform = `scale(${scaleRate}) translateX(-49.99%)`
97
- appStyle.width = `${baseWidth / scaleRate}px`
98
- },
99
- /**
100
- * rem屏幕适配方案
101
- */
102
- getHtmlFontSize() {
103
- const htmlwidth = document.documentElement.clientWidth || document.body.clientWidth
104
- const htmlDom = document.querySelector('html')
105
- htmlDom.style.fontSize = htmlwidth / 192 + 'px'
106
- },
107
- }
@@ -1,236 +0,0 @@
1
- import { ErrorType } from '../constant'
2
-
3
- /* eslint-disable no-extend-native, space-in-parens */
4
- export default {
5
- /**
6
- * 判断数据类型
7
- *
8
- * @param {*} data
9
- * @returns {*}
10
- */
11
- getDataType(data) {
12
- return Object.prototype.toString.call(data).slice(8, -1)
13
- },
14
- isEmpty(value) {
15
- if (value == null) {
16
- // 等同于 value === undefined || value === null
17
- return true
18
- }
19
- const type = this.getDataType(value)
20
- switch (type) {
21
- case 'String':
22
- return value.trim() === ''
23
- case 'Array':
24
- return !value.length
25
- case 'Object':
26
- return !Object.keys(value).length
27
- case 'Boolean':
28
- return !value
29
- default:
30
- return false // 其他对象均视作非空
31
- }
32
- },
33
- isNotEmpty(val) {
34
- return !this.isEmpty(val)
35
- },
36
- json2form(json) {
37
- const formData = new FormData()
38
- Object.keys(json).forEach((key) => {
39
- formData.append(key, json[key] instanceof Object ? JSON.stringify(json[key]) : json[key])
40
- })
41
- return formData
42
- },
43
- /**
44
- * json转换成get参数形式
45
- *
46
- * @param {*} json
47
- * @returns {*}
48
- */
49
- json2Query(json) {
50
- var tempArr = []
51
- for (var i in json) {
52
- var key = i
53
- var value = json[i]
54
- tempArr.push(key + '=' + value)
55
- }
56
- var urlParamsStr = tempArr.join('&')
57
- return urlParamsStr
58
- },
59
- generateGuid() {
60
- const S4 = function () {
61
- return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
62
- }
63
- return S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4()
64
- },
65
- decodeDict(...args) {
66
- let res = ''
67
- if (args.length > 1) {
68
- const items = args.slice(1, args.length % 2 === 0 ? args.length - 1 : args.length)
69
- for (let i = 0; i < items.length; i = i + 2) {
70
- const item = items[i]
71
- if (args[0] === item) {
72
- res = items[i + 1]
73
- }
74
- }
75
- if (!res && args.length % 2 === 0) {
76
- res = args[args.length - 1]
77
- }
78
- } else {
79
- res = args[0]
80
- }
81
- return res
82
- },
83
- /**
84
- *
85
- * @param {*} dest
86
- * @param {...any} args
87
- * @returns 等同于L.extend
88
- */
89
- extend(dest, ...args) {
90
- let i, j, len, src
91
- for (j = 0, len = args.length; j < len; j++) {
92
- src = args[j]
93
- for (i in src) {
94
- dest[i] = src[i]
95
- }
96
- }
97
- return dest
98
- },
99
- rgb2hex(rgb) {
100
- var hex = '#' + ((1 << 24) + (rgb[0] << 16) + (rgb[1] << 8) + rgb[2]).toString(16).slice(1)
101
- return hex
102
- },
103
- /**
104
- * 将平级对象列表转换为树形结构对象列表
105
- *
106
- * @param {Array} data
107
- * @param {string} [idPropertyName="id"]
108
- * @param {string} [parentIdPropertyName="parentId"]
109
- * @param {string} [childrenPropertyName="children"]
110
- * @returns {*}
111
- */
112
- convertToTree2(data, idPropertyName = 'id', parentIdPropertyName = 'parentId', childrenPropertyName = 'children') {
113
- const result = []
114
- function buildChildren(item) {
115
- const id = item[idPropertyName]
116
- const children = data.filter((item2) => item2.hasOwnProperty(parentIdPropertyName) && item2[parentIdPropertyName] === id)
117
- if (children.length > 0) {
118
- children.forEach(buildChildren)
119
- item[childrenPropertyName] = children
120
- }
121
- }
122
- for (const item of data) {
123
- if (data.findIndex((t) => t[idPropertyName] === item[parentIdPropertyName]) === -1) {
124
- buildChildren(item)
125
- result.push(item)
126
- }
127
- }
128
- return result
129
- },
130
- /**
131
- * 异步加载script
132
- *
133
- * @param {*} url
134
- */
135
- asyncLoadScript(url) {
136
- return new Promise((resolve, reject) => {
137
- try {
138
- var oscript = document.createElement('script')
139
- if (oscript.readyState) {
140
- // ie8及以下版本
141
- oscript.onreadystatechange = function () {
142
- if (oscript.readyState === 'complete' || oscript.readyState === 'loaded') {
143
- resolve(oscript)
144
- }
145
- }
146
- } else {
147
- oscript.onload = function () {
148
- resolve(oscript)
149
- }
150
- }
151
- oscript.type = 'text/javascript'
152
- oscript.src = url
153
- document.body.appendChild(oscript)
154
- } catch (error) {
155
- reject(error)
156
- }
157
- })
158
- },
159
- loadStyle(urls) {
160
- urls.forEach((url) => {
161
- const css = document.createElement('link')
162
- css.href = url
163
- css.rel = 'stylesheet'
164
- css.type = 'text/css'
165
- document.head.appendChild(css)
166
- })
167
- },
168
- /**
169
- * 提取json中的value组成一个新的字符串
170
- * eg: template('aaa{key}', json)
171
- *
172
- * @param {*} str
173
- * @param {*} data
174
- * @returns {*}
175
- */
176
- template(str, data) {
177
- const templateRe = /\{ *([\w_-]+) *\}/g
178
- return str.replace(templateRe, function (str, key) {
179
- var value = data[key]
180
- if (value === undefined) {
181
- throw new Error(ErrorType.JSON_VALUE_ERROR + str)
182
- } else if (typeof value === 'function') {
183
- value = value(data)
184
- }
185
- return value
186
- })
187
- },
188
- deleteEmptyProperty(data) {
189
- return Object.fromEntries(
190
- Object.keys(data)
191
- .filter((d) => !this.isEmpty(data[d]))
192
- .map((i) => [i, data[i]])
193
- )
194
- },
195
- deepAssign() {
196
- let len = arguments.length,
197
- target = arguments[0]
198
- if (this.getDataType(target) !== 'Object') {
199
- target = {}
200
- }
201
- for (let i = 1; i < len; i++) {
202
- let source = arguments[i]
203
- if (this.getDataType(source) === 'Object') {
204
- for (let s in source) {
205
- if (s === '__proto__' || target === source[s]) {
206
- continue
207
- }
208
- if (this.getDataType(source[s]) === 'Object') {
209
- target[s] = this.deepAssign(target[s], source[s])
210
- } else {
211
- target[s] = source[s]
212
- }
213
- }
214
- }
215
- }
216
- return target
217
- },
218
- handleCopyValue(text) {
219
- if (!navigator.clipboard && window.isSecureContext) {
220
- return navigator.clipboard.writeText(text)
221
- } else {
222
- const textArea = document.createElement('textarea')
223
- textArea.style.position = 'fixed'
224
- textArea.style.top = textArea.style.left = '-100vh'
225
- textArea.style.opacity = '0'
226
- textArea.value = text
227
- document.body.appendChild(textArea)
228
- textArea.focus()
229
- textArea.select()
230
- return new Promise((resolve, reject) => {
231
- document.execCommand('copy') ? resolve() : reject(new Error('copy failed'))
232
- textArea.remove()
233
- })
234
- }
235
- },
236
- }
@@ -1,23 +0,0 @@
1
- export default {
2
- set: function (name, value, Days = 30) {
3
- var exp = new Date()
4
- exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000)
5
- document.cookie = name + '=' + escape(value) + ';expires=' + exp.toGMTString()
6
- },
7
- remove: function (name) {
8
- var exp = new Date()
9
- exp.setTime(exp.getTime() - 1)
10
- var cval = this.get(name)
11
- if (cval != null) {
12
- document.cookie = name + '=' + cval + ';expires=' + exp.toGMTString()
13
- }
14
- },
15
- get: function (name) {
16
- var arr = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'))
17
- if (arr != null) {
18
- return arr[2]
19
- } else {
20
- return ''
21
- }
22
- },
23
- }
@@ -1,145 +0,0 @@
1
- export default {
2
- PI: 3.14159265358979324,
3
- XPI: (3.14159265358979324 * 3000.0) / 180.0,
4
- delta(lat, lng) {
5
- const a = 6378245.0 // a: 卫星椭球坐标投影到平面地图坐标系的投影因子。
6
- const ee = 0.00669342162296594323 // ee: 椭球的偏心率。
7
- let dLat = this.transformLat(lng - 105.0, lat - 35.0)
8
- let dLon = this.transformLon(lng - 105.0, lat - 35.0)
9
- const radLat = (lat / 180.0) * this.PI
10
- let magic = Math.sin(radLat)
11
- magic = 1 - ee * magic * magic
12
- const sqrtMagic = Math.sqrt(magic)
13
- dLat = (dLat * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * this.PI)
14
- dLon = (dLon * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * this.PI)
15
- return { lat: dLat, lng: dLon }
16
- },
17
- // WGS-84 to GCJ-02
18
- gcjEncrypt(wgsLat, wgsLon) {
19
- if (this.outOfChina(wgsLat, wgsLon)) {
20
- return { lat: wgsLat, lng: wgsLon }
21
- }
22
-
23
- const d = this.delta(wgsLat, wgsLon)
24
- return { lat: wgsLat + d.lat, lng: wgsLon + d.lng }
25
- },
26
- // GCJ-02 to WGS-84
27
- gcjDecrypt(gcjLat, gcjLon) {
28
- if (this.outOfChina(gcjLat, gcjLon)) {
29
- return { lat: gcjLat, lng: gcjLon }
30
- }
31
-
32
- const d = this.delta(gcjLat, gcjLon)
33
- return { lat: gcjLat - d.lat, lng: gcjLon - d.lng }
34
- },
35
- // GCJ-02 to WGS-84 exactly
36
- gcjDecryptExact(gcjLat, gcjLon) {
37
- const initDelta = 0.01
38
- const threshold = 0.000000001
39
- let dLat = initDelta
40
- let dLon = initDelta
41
- let mLat = gcjLat - dLat
42
- let mLon = gcjLon - dLon
43
- let pLat = gcjLat + dLat
44
- let pLon = gcjLon + dLon
45
- let wgsLat
46
- let wgsLon
47
- let i = 0
48
- while (1) {
49
- wgsLat = (mLat + pLat) / 2
50
- wgsLon = (mLon + pLon) / 2
51
- const tmp = this.gcj_encrypt(wgsLat, wgsLon)
52
- dLat = tmp.lat - gcjLat
53
- dLon = tmp.lng - gcjLon
54
- if (Math.abs(dLat) < threshold && Math.abs(dLon) < threshold) {
55
- break
56
- }
57
-
58
- if (dLat > 0) pLat = wgsLat
59
- else mLat = wgsLat
60
- if (dLon > 0) pLon = wgsLon
61
- else mLon = wgsLon
62
-
63
- if (++i > 10000) break
64
- }
65
- // console.log(i);
66
- return { lat: wgsLat, lng: wgsLon }
67
- },
68
- // GCJ-02 to BD-09
69
- bdEncrypt(gcjLat, gcjLon) {
70
- const x = gcjLon
71
- const y = gcjLat
72
- const z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * this.XPI)
73
- const theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * this.XPI)
74
- const bdLon = z * Math.cos(theta) + 0.0065
75
- const bdLat = z * Math.sin(theta) + 0.006
76
- return { lat: bdLat, lng: bdLon }
77
- },
78
- // BD-09 to GCJ-02
79
- bdDecrypt(bdLat, bdLon) {
80
- const x = bdLon - 0.0065
81
- const y = bdLat - 0.006
82
- const z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * this.XPI)
83
- const theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * this.XPI)
84
- const gcjLon = z * Math.cos(theta)
85
- const gcjLat = z * Math.sin(theta)
86
- return { lat: gcjLat, lng: gcjLon }
87
- },
88
- // WGS-84 to Web mercator
89
- // mercatorLat -> y mercatorLon -> x
90
- mercatorEncrypt(wgsLat, wgsLon) {
91
- const x = (wgsLon * 20037508.34) / 180.0
92
- let y = Math.log(Math.tan(((90.0 + wgsLat) * this.PI) / 360.0)) / (this.PI / 180.0)
93
- y = (y * 20037508.34) / 180.0
94
- return { lat: y, lng: x }
95
- },
96
- // Web mercator to WGS-84
97
- // mercatorLat -> y mercatorLon -> x
98
- mercatorDecrypt(mercatorLat, mercatorLon) {
99
- const x = (mercatorLon / 20037508.34) * 180.0
100
- let y = (mercatorLat / 20037508.34) * 180.0
101
- y = (180 / this.PI) * (2 * Math.atan(Math.exp((y * this.PI) / 180.0)) - this.PI / 2)
102
- return { lat: y, lng: x }
103
- },
104
- // two point's distance
105
- distance(latA, lngA, latB, lngB) {
106
- const earthR = 6371000.0
107
- const x = Math.cos((latA * this.PI) / 180.0) * Math.cos((latB * this.PI) / 180.0) * Math.cos(((lngA - lngB) * this.PI) / 180)
108
- const y = Math.sin((latA * this.PI) / 180.0) * Math.sin((latB * this.PI) / 180.0)
109
- let s = x + y
110
- if (s > 1) s = 1
111
- if (s < -1) s = -1
112
- const alpha = Math.acos(s)
113
- const distance = alpha * earthR
114
- return distance
115
- },
116
- outOfChina(lat, lng) {
117
- if (lng < 72.004 || lng > 137.8347) {
118
- return true
119
- }
120
- if (lat < 0.8293 || lat > 55.8271) {
121
- return true
122
- }
123
- return false
124
- },
125
- transformLat(x, y) {
126
- let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x))
127
- ret += ((20.0 * Math.sin(6.0 * x * this.PI) + 20.0 * Math.sin(2.0 * x * this.PI)) * 2.0) / 3.0
128
- ret += ((20.0 * Math.sin(y * this.PI) + 40.0 * Math.sin((y / 3.0) * this.PI)) * 2.0) / 3.0
129
- ret += ((160.0 * Math.sin((y / 12.0) * this.PI) + 320 * Math.sin((y * this.PI) / 30.0)) * 2.0) / 3.0
130
- return ret
131
- },
132
- transformLon(x, y) {
133
- let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
134
- ret += ((20.0 * Math.sin(6.0 * x * this.PI) + 20.0 * Math.sin(2.0 * x * this.PI)) * 2.0) / 3.0
135
- ret += ((20.0 * Math.sin(x * this.PI) + 40.0 * Math.sin((x / 3.0) * this.PI)) * 2.0) / 3.0
136
- ret += ((150.0 * Math.sin((x / 12.0) * this.PI) + 300.0 * Math.sin((x / 30.0) * this.PI)) * 2.0) / 3.0
137
- return ret
138
- },
139
- randomCoordinate(minX, minY, maxX, maxY) {
140
- return {
141
- lat: Math.random() * (maxY - minY) + minY,
142
- lng: Math.random() * (maxX - minX) + minX,
143
- }
144
- },
145
- }