<!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 redLine = viewer.entities.add({ name: 'Red line on terrain', polyline: { positions: bmgl.Cartesian3.fromDegreesArray([-75, 35, -125, 35]), width: 5, material: bmgl.Color.RED, } }); //不启用地形遮挡 viewer.scene.globe.depthTestAgainstTerrain = false; var glowingLine = viewer.entities.add({ name: 'Glowing blue line on the surface', polyline: { positions: bmgl.Cartesian3.fromDegreesArray([-75, 37, -125, 37]), width: 10, material: new bmgl.PolylineGlowMaterialProperty({ glowPower: 0.2, color: bmgl.Color.BLUE }) } }); var orangeOutlined = viewer.entities.add({ name: 'Orange line', polyline: { positions: bmgl.Cartesian3.fromDegreesArrayHeights([-75, 39, 250000, -125, 39, 250000]), width: 5, material: new bmgl.PolylineOutlineMaterialProperty({ color: bmgl.Color.ORANGE, outlineWidth: 2, outlineColor: bmgl.Color.BLACK }) } }); // var purpleArrow = viewer.entities.add({ name: 'Purple', polyline: { positions: bmgl.Cartesian3.fromDegreesArrayHeights([-75, 43, 500000, -125, 43, 500000]), width: 10, followSurface: false, material: new bmgl.PolylineArrowMaterialProperty(bmgl.Color.PURPLE) } }); var dashedLine = viewer.entities.add({ name: 'Blue dashed line', polyline: { positions: bmgl.Cartesian3.fromDegreesArrayHeights([-75, 45, 500000, -125, 45, 500000]), width: 4, material: new bmgl.PolylineDashMaterialProperty({ color: bmgl.Color.CYAN }) } }); var Line = viewer.entities.add({ name: 'Blue dashed line', polyline: { positions: bmgl.Cartesian3.fromDegreesArrayHeights([-75, 47, 500000, -125, 47, 500000]), width: 4, material: new bmgl.PolylineDashMaterialProperty({ gapColor:bmgl.Color.BLACK }) } }); viewer.flyTo(viewer.entities); </script> </body> </html>
源码