scene 新增设置地图要素方法,新增导出图片方法

更新package文件main 入口文件
This commit is contained in:
thinkinggis 2019-08-30 16:53:08 +08:00
parent 4ec2e2e0d7
commit e9b2ed3074
4 changed files with 17 additions and 8 deletions

View File

@ -1,10 +1,8 @@
{ {
"name": "@antv/l7", "name": "@antv/l7",
"version": "1.3.2", "version": "1.3.3",
"description": "Large-scale WebGL-powered Geospatial Data Visualization", "description": "Large-scale WebGL-powered Geospatial Data Visualization",
"main": "build/L7.js", "main": "build/L7.js",
"browser": "build/L7-min.js",
"module": "lib/index.js",
"homepage": "https://github.com/antvis/l7", "homepage": "https://github.com/antvis/l7",
"repository": { "repository": {
"type": "git", "type": "git",
@ -57,6 +55,7 @@
"rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-resolve": "^4.0.1", "rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-postcss": "^2.0.3", "rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-terser": "^4.0.4", "rollup-plugin-terser": "^4.0.4",
"serve-static": "^1.13.2", "serve-static": "^1.13.2",
"shelljs": "~0.7.8", "shelljs": "~0.7.8",
@ -67,7 +66,7 @@
"scripts": { "scripts": {
"build-dev": "rollup -c --environment BUILD:dev", "build-dev": "rollup -c --environment BUILD:dev",
"watch-dev": "rollup -c --environment BUILD:dev --watch & npm run demos-web ", "watch-dev": "rollup -c --environment BUILD:dev --watch & npm run demos-web ",
"build-prod": "rollup -c --environment BUILD:production", "build-prod": "rollup -c --environment BUILD",
"build-prod-min": "rollup -c --environment BUILD:production,MINIFY:true", "build-prod-min": "rollup -c --environment BUILD:production,MINIFY:true",
"build": "rollup -c --environment BUILD:production", "build": "rollup -c --environment BUILD:production",
"build-lib": "babel src --out-dir lib", "build-lib": "babel src --out-dir lib",
@ -83,11 +82,11 @@
"demos": "electron ./demos/app.js", "demos": "electron ./demos/app.js",
"demos-web": "node ./demos/app.js --web --port 2046", "demos-web": "node ./demos/app.js --web --port 2046",
"dev": "npm run watch & npm run demos-web", "dev": "npm run watch & npm run demos-web",
"dist": "npm run build-dev && npm run build-prod && npm run build-prod-min", "dist": "npm run build-prod && npm run build-prod-min",
"lint": "eslint --ext .html,.js ./", "lint": "eslint --ext .html,.js ./",
"lint-fix": "eslint --ext .html,.js --fix ./", "lint-fix": "eslint --ext .html,.js --fix ./",
"mkdir-dist": "node ./bin/mkdir-dist.js", "mkdir-dist": "node ./bin/mkdir-dist.js",
"prepublishOnly": "npm run build-lib && npm run dist", "prepublishOnly": "npm run dist",
"screenshot": "node ./bin/screenshot.js", "screenshot": "node ./bin/screenshot.js",
"start": "npm run watch-dev", "start": "npm run watch-dev",
"test": "torch --compile-opts ./.torch.compile.opts.js --compile --renderer --recursive test/unit", "test": "torch --compile-opts ./.torch.compile.opts.js --compile --renderer --recursive test/unit",
@ -106,7 +105,6 @@
"silent": false "silent": false
}, },
"dependencies": { "dependencies": {
"@antv/g": "^3.1.3",
"@antv/geo-coord": "^1.0.8", "@antv/geo-coord": "^1.0.8",
"@antv/util": "~2.0.1", "@antv/util": "~2.0.1",
"@mapbox/geojson-rewind": "^0.4.0", "@mapbox/geojson-rewind": "^0.4.0",

View File

@ -1,4 +1,5 @@
import fs from 'fs'; import fs from 'fs';
import sourcemaps from 'rollup-plugin-sourcemaps';
import json from 'rollup-plugin-json'; import json from 'rollup-plugin-json';
import buble from 'rollup-plugin-buble'; import buble from 'rollup-plugin-buble';
import resolve from 'rollup-plugin-node-resolve'; import resolve from 'rollup-plugin-node-resolve';
@ -74,7 +75,7 @@ const config = [
}, },
treeshake: false, treeshake: false,
plugins: [ plugins: [
// css() sourcemaps()
] ]
} }
]; ];

View File

@ -130,6 +130,13 @@ export default class Scene extends Base {
getMarkerContainer() { getMarkerContainer() {
return this._markerContainier; return this._markerContainier;
} }
map2Png() {
this.scene._engine.update();
const vis = this.scene._engine._renderer.domElement.toDataURL();
const map = this.scene.map.getContainer().getElementsByClassName('amap-layer')[0].toDataURL();
return [ map, vis ];
}
_registEvents() { _registEvents() {
const events = [ const events = [
'mouseout', 'mouseout',

View File

@ -147,6 +147,9 @@ export default class GaodeMap extends Base {
const lnglat = new AMap.LngLat(center[0], center[1]); const lnglat = new AMap.LngLat(center[0], center[1]);
return map.setZoomAndCenter(zoom, lnglat); return map.setZoomAndCenter(zoom, lnglat);
}; };
scene.setFeature = features => {
return map.setFeature(features);
};
scene.setBounds = extent => { scene.setBounds = extent => {
return map.setBounds(new AMap.Bounds([ extent[0], extent[1] ], [ extent[2], extent[3] ])); return map.setBounds(new AMap.Bounds([ extent[0], extent[1] ], [ extent[2], extent[3] ]));
}; };