You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
30 KiB
1 line
30 KiB
4 weeks ago
|
{"version":3,"file":"bmap.js","sources":["../../extension/bmap/BMapCoordSys.js","../../extension/bmap/BMapModel.js","../../extension/bmap/BMapView.js","../../extension/bmap/bmap.js"],"sourcesContent":["\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// @ts-nocheck\n/* global BMap */\nimport { util as zrUtil, graphic, matrix } from 'echarts';\nfunction BMapCoordSys(bmap, api) {\n this._bmap = bmap;\n this.dimensions = ['lng', 'lat'];\n this._mapOffset = [0, 0];\n this._api = api;\n this._projection = new BMap.MercatorProjection();\n}\nBMapCoordSys.prototype.type = 'bmap';\nBMapCoordSys.prototype.dimensions = ['lng', 'lat'];\nBMapCoordSys.prototype.setZoom = function (zoom) {\n this._zoom = zoom;\n};\nBMapCoordSys.prototype.setCenter = function (center) {\n this._center = this._projection.lngLatToPoint(new BMap.Point(center[0], center[1]));\n};\nBMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n this._mapOffset = mapOffset;\n};\nBMapCoordSys.prototype.getBMap = function () {\n return this._bmap;\n};\nBMapCoordSys.prototype.dataToPoint = function (data) {\n var point = new BMap.Point(data[0], data[1]);\n // TODO mercator projection is toooooooo slow\n // let mercatorPoint = this._projection.lngLatToPoint(point);\n // let width = this._api.getZr().getWidth();\n // let height = this._api.getZr().getHeight();\n // let divider = Math.pow(2, 18 - 10);\n // return [\n // Math.round((mercatorPoint.x - this._center.x) / divider + width / 2),\n // Math.round((this._center.y - mercatorPoint.y) / divider + height / 2)\n // ];\n var px = this._bmap.pointToOverlayPixel(point);\n var mapOffset = this._mapOffset;\n return [px.x - mapOffset[0], px.y - mapOffset[1]];\n};\nBMapCoordSys.prototype.pointToData = function (pt) {\n var mapOffset = this._mapOffset;\n pt = this._bmap.overlayPixelToPoint({\n x: pt[0] + mapOffset[0],\n y: pt[1] + mapOffset[1]\n });\n return [pt.lng, pt.lat];\n};\nBMapCoordSys.prototype.getViewRect = function () {\n var api = this._api;\n return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());\n};\nBMapCoordSys.prototype.getRoamTransform = function () {\n return matrix.create();\n};\nBMapCoordSys.prototype.prepareCustoms = function () {\n var rect = this.getViewRect();\n return {\n coordSys: {\n // The name exposed to user is always 'cartesian2d' but not 'grid'.\n type: 'bmap',\n x: rect.x,\n y: rect.y,\n width: r
|