cesium点线面测试数据

//初始化cesium
var viewer = new Cesium.Viewer('cesiumContainer',{
imageryProvider:new Cesium.SingleTileImageryProvider({
url:'img/world.jpg'
}),
infoBox : false,
selectionIndicator : true,
shadows : true,
shouldAnimate : true,
geocoder:false,
homeButton:false,
baseLayerPicker:false,
navigationHelpButton:false,
animation:false,
timeline:false,
fullscreenButton:true,
vrButton: true,
creditContainer:"credit",
sceneModePicker:true,
//terrainProvider:terrainProvider //加载三维地形
});
flyToHotSpot(105.79,34.55,50000);
var flyToHotSpot=function(lon,lat,alt) {
// var heading = 0 // 方位角
// 模型加载完毕后的回调
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(lon, lat, alt),
orientation: {
heading: Cesium.Math.toRadians(0.0),
pitch: Cesium.Math.toRadians(-90.0),
roll: 0.0
}
});
}

//测试数据
var objId = 123;
var testdata=new Cesium.Entity({
name : '线测试',
polyline : {
positions: Cesium.Cartesian3.fromDegreesArrayHeights([105.64248720323886, 34.573489842026575, 500, 105.68875409774925, 34.54886257584699, 500, 105.73299519869232, 34.545638370895034, 500, 105.79688037793541, 34.555139095010624, 500, 105.82604745621094, 34.57031428652784, 500, 105.8693212999452, 34.5816814079848, 500, 105.9319510139601, 34.580817011688026, 500, 105.95815208412665, 34.56044869581827, 500]),
width: 5,
material: new Cesium.PolylineOutlineMaterialProperty({
color: Cesium.Color.ORANGE,
outlineWidth: 2,
outlineColor: Cesium.Color.BLACK
}),
},
properties:{
contact:"小明",
tel:"1303291111",
num:"1326"
},
layerId:"testLayer",
objId:objId,
shapeType:"Polyline"
})


viewer.entities.add(testdata);



alert(testdata.properties.masspoint)

var objId = 124;
var testdata2=new Cesium.Entity({
name : '点测试',
position:Cesium.Cartesian3.fromDegrees(105.64248720323886, 34.573489842026575,500),
billboard: new Cesium.BillboardGraphics({
image: "GoogleMapMarker/red-pushpin.png",
width: 50,
height: 50,
// heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
}),
properties:{
contact:"小明",
tel:"1303291111",
num:"1326"
},
layerId:"testLayer",
objId:objId ,
shapeType:"Point"
})


viewer.entities.add(testdata2);






var objId = 125;
var testdata3=new Cesium.Entity({
name : '面测试',

polygon: {
hierarchy :Cesium.Cartesian3.fromDegreesArrayHeights([105.64248720323886, 34.573489842026575, 500, 105.68875409774925, 34.54886257584699, 500, 105.73299519869232, 34.545638370895034, 500]),
material : Cesium.Color.RED.withAlpha(0.5), //材质
outline : true, //是否显示轮廓
outlineColor : Cesium.Color.BLACK //轮廓的颜色
},
properties:{
contact:"小明",
tel:"1303291111",
num:"1326"
},
layerId:"testLayer",
    objId:objId ,
shapeType:"Polygon"
})


viewer.entities.add(testdata3);


ps:点是随机点的

猜你喜欢

转载自www.cnblogs.com/implementer/p/10953442.html