【Cesium Sandcastle 研究7】- Classification Types (分类类型)

Classification Types (分类类型)

访问地址:

http://localhost:8080/Apps/Sandcastle/index.html?src=Clustering.html&label=Tutorials

知识点


// 定义多边形
var polygon = viewer.entities.add({
    polygon : {
	// 定义的多边形区域
        hierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromRadiansArray([-1.3194369277314022, 0.6988062530900625, -1.3193955980204217, 0.6988091578771254, -1.3193931220959367, 0.698743632490865, -1.3194358224045408, 0.6987471965556998])),
        material : Cesium.Color.RED.withAlpha(0.5),		// 材料:红色,半透明
        classificationType : Cesium.ClassificationType.BOTH	// 支持类型: 地形、3DTile、或者在地面上
    }
});



// 曲线
var polyline = viewer.entities.add({
    polyline : {
        positions : Cesium.Cartesian3.fromDegreesArray([
            -75.60217330403601, 40.04102882709425,
            -75.59968252414251, 40.04093615560871,
            -75.59802015382800, 40.04079437042357,
            -75.59674934074435, 40.040816173283304,
            -75.59630042791713, 40.03986900370842,
            -75.59563636849978, 40.03930996506271,
            -75.59492397899098, 40.03873932846581,
            -75.59457991226778, 40.038392701955786,
            -75.59424838652453, 40.03775403572295,
            -75.59387104290336, 40.03677022167725,
            -75.59355000490342, 40.03588760913535
        ]),
        width : 8,
        material : new Cesium.PolylineOutlineMaterialProperty({
            color : Cesium.Color.YELLOW,
            outlineWidth : 2,
            outlineColor : Cesium.Color.BLACK
        }),
        clampToGround : true
    }
});


polygon.polygon.classificationType = Cesium.ClassificationType.BOTH;
polyline.polyline.classificationType = Cesium.ClassificationType.BOTH


回顾

polygon 多边形
polyline 折线

Cesium.ClassificationType.BOTH 全部都显示
Cesium.ClassificationType.TERRAIN 只显示地形的内容
Cesium.ClassificationType.CESIUM_3D_TILE 只显示3dtile的内容

你可能感兴趣的:(Cesium)