fix(map): map style map

This commit is contained in:
thinkinggis 2019-07-10 14:39:27 +08:00
parent 0d833f52d6
commit 9ab41ff9d2
6 changed files with 18 additions and 13 deletions

View File

@ -21,14 +21,18 @@
<script src="./assets/dat.gui.min.js"></script> <script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script> <script src="../build/L7.js"></script>
<script> <script>
const scene = new L7.Scene({ var mapinstance = new AMap.Map('map',{
id: 'map',
mapStyle: 'dark', // 样式URL
center: [121.576757,31.279873 ], center: [121.576757,31.279873 ],
viewMode: '3D',
pitch: 0, pitch: 0,
zoom: 12, zoom: 12,
rotation:0 maxZoom:20,
minZoom:0,
});
const scene = new L7.Scene({
map:mapinstance,
//mapStyle: 'dark', // 样式URL
}); });
const testdata = [ const testdata = [
{ {

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7", "name": "@antv/l7",
"version": "1.2.0-beta.2", "version": "1.2.0-beta.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.js", "browser": "build/l7.js",

View File

@ -108,7 +108,8 @@ export default class Layer extends Base {
if (type === 'fill') { if (type === 'fill') {
this.get('pickingController').addPickMesh(object); this.get('pickingController').addPickMesh(object);
} }
setTimeout(() => this.scene._engine.update(), 500); this.scene._engine.update();
// setTimeout(() => this.scene._engine.update(), 200);
} }
remove(object) { remove(object) {
if (object.type === 'composer') { if (object.type === 'composer') {

View File

@ -41,7 +41,6 @@ export default class Scene extends Base {
const Map = new MapProvider(this._attrs); const Map = new MapProvider(this._attrs);
Map.mixMap(this); Map.mixMap(this);
this._container = Map.container; this._container = Map.container;
// const Map = new MapProvider(this.mapContainer, this._attrs);
Map.on('mapLoad', () => { Map.on('mapLoad', () => {
this.map = Map.map; this.map = Map.map;
this._initEngine(Map.renderDom); this._initEngine(Map.renderDom);
@ -55,8 +54,8 @@ export default class Scene extends Base {
interaction._onHashChange(); interaction._onHashChange();
} }
this.emit('loaded'); this.emit('loaded');
this._engine.update();
}); });
} }
initLayer() { initLayer() {
for (const key in LAYER_MAP) { for (const key in LAYER_MAP) {

View File

@ -5,7 +5,7 @@
// const Global = {}; // const Global = {};
const FONT_FAMILY = '"-apple-system", BlinkMacSystemFont, "Segoe UI", Roboto,"Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",SimSun, "sans-serif"'; const FONT_FAMILY = '"-apple-system", BlinkMacSystemFont, "Segoe UI", Roboto,"Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",SimSun, "sans-serif"';
const Global = { const Global = {
version: '1.2.0-beta.2', version: '1.2.0-beta.3',
scene: { scene: {
mapType: 'AMAP', mapType: 'AMAP',
zoom: 5, zoom: 5,

View File

@ -55,7 +55,7 @@ export default class GaodeMap extends Base {
if (map instanceof AMap.Map) { if (map instanceof AMap.Map) {
this.map = map; this.map = map;
this.container = map.getContainer(); this.container = map.getContainer();
this.map.setMapStyle(this.get('mapStyle')); this.get('mapStyle') && this.map.setMapStyle(this.get('mapStyle'));
} else { } else {
this.map = new AMap.Map(this.container, this._attrs); this.map = new AMap.Map(this.container, this._attrs);
} }
@ -82,6 +82,7 @@ export default class GaodeMap extends Base {
camera.lookAt(0, 0, 0); camera.lookAt(0, 0, 0);
camera.position.x += e.camera.position.x; camera.position.x += e.camera.position.x;
camera.position.y += -e.camera.position.y; camera.position.y += -e.camera.position.y;
this._engine.update();
}); });
} }