<!DOCTYPE html> <html> <head> <meta charset='UTF-8'/> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no'/> <link href='http://bigemap.com:9000/bigemap-gl.js/v1.1.0/Widgets/widgets.css' rel='stylesheet'/> <script src='http://bigemap.com:9000/bigemap-gl.js/v1.1.0/bigemap-gl.js'></script> <style> body { margin: 0; padding: 0; } #container { position: absolute; top: 0; bottom: 0; width: 100%; } .bmgl-widget-credits{display:none} </style> <title>part_test</title> </head> <body> <div id='container'></div> <script> bmgl.Config.HTTP_URL = 'http://bigemap.com:9000'; var viewer = new bmgl.Viewer('container', {mapId: 'bigemap.zhongkexingtu'}); var tilesets = new bmgl.BM3DTileset({ url:'/bmgl/data/osgb_house/tileset.json', skipLevelOfDetail: true, maximumNumberOfLoadedTiles: 1000000, // 最大加载的 tile 数量 // baseScreenSpaceError: 4096, maximumScreenSpaceError: 64, // 数值加大,能让最终成像变模糊 // skipScreenSpaceErrorFactor: 2048, // skipLevels: 1, immediatelyLoadDesiredLevelOfDetail: false, loadSiblings: false, // 如果为true则不会在已加载完概况房屋后,自动从中心开始超清化房屋 cullWithChildrenBounds: true, cullRequestsWhileMoving: true, cullRequestsWhileMovingMultiplier: 1, // 值越小能够更快的剔除 preloadWhenHidden: true, preferLeaves: false, maximumMemoryUsage: 3600, // 内存分配变小有利于倾斜摄影数据回收,提升性能体验 maximumScreenSpaceError: 24, // 数值加大,能让最终成像变模糊 数值越小显示的画面会月精美,同时会增加内存消耗,最小是0,默认值为16 preloadWhenHidden: true, // 当 tileset 隐藏时进行预加载 preloadFlightDuration: 10, // 预加载飞行过程中的数据,数值越大,预加载的范围越广 // loadSiblings: true, // 如果为true则不会在已加载完概况房屋后,自动从中心开始超清化房屋 show: true, //它控制BM3DTileset是否可见 dynamicScreenSpaceErrorDensity: 10000000000, //数值加大,能让周边加载变快 }); tilesets.readyPromise.then(function(tileset) { viewer.scene.primitives.add(tileset); default_HeadingPitchRange = new bmgl.HeadingPitchRange(0.0, -0.5, tileset.boundingSphere.radius * 2.0); viewer.zoomTo(tileset, default_HeadingPitchRange); var cartographic = bmgl.Cartographic.fromCartesian(tileset.boundingSphere.center); var delta_lng=0,delta_lat=0; var surface = bmgl.Cartesian3.fromRadians(cartographic.longitude+delta_lng, cartographic.latitude+delta_lat, 0.0); var offset = bmgl.Cartesian3.fromRadians(cartographic.longitude+delta_lng, cartographic.latitude+delta_lat,40.0); var translation = bmgl.Cartesian3.subtract(offset, surface, new bmgl.Cartesian3()); tileset.modelMatrix = bmgl.Matrix4.fromTranslation(translation); }).otherwise(function(error) { console.log(error); }); </script> </body> </html>
源码