Cesium标点


let startPoint = this.viewer.entities.add( //viewer.entities.add 添加实体的方法 { name: '测量距离', //这个属性跟页面显示的内容没有关系,只是一个属性 position: this.Cesium.Cartesian3.fromDegress(longitude, latitude, height), point: { //表示点 heightReference: this.Cesium.HeightReference.CLAMP_TO_GROUND, color: this.Cesium.Color.WHITE, //点的颜色 pixelSize: 6, //点的大小 outlineColor: this.Cesium.Color.RED, //就是所谓的border-color outlineWidth: 2 //border-width }, label: { //表示点的描述 text: "起点", //点的文字 font: '14pt Source Han Sans CN', //文字的大小和字体 fillColor: _this.Cesium.Color.RED, //文字的颜色

注意,这里的this.Cesium.Color后面只能接颜色的英文,不能接十六进制的颜色
                    如果你需要用到十六进制的颜色,可以使用这样来表示:
fillColor: this.Cesium.Color.fromCssColorString('#f00')
backgroundColor: _this.Cesium.Color.AQUA,    //给文字添加背景颜色
                    showBackground: true,                        //若是想给文字添加背景颜色 这行必不可少
                    style: this.Cesium.LabelStyle.FILL_AND_OUTLINE,
                    outlineWidth: 3,
                    //垂直位置
                    heightReference: this.Cesium.HeightReference.NONE,
                    verticalOrigin: this.Cesium.VerticalOrigin.TOP,
                    pixelOffset: new this.Cesium.Cartesian2(0, 10)     //偏移度 0 表示x轴上的偏移量 10表示y轴上的偏移量
                  }
                }
            )
( 我这里用this.Cesium 是因为我配置了Cesuim的全局变量,如果没有配置的就直接Cesium.就可以 )


猜你喜欢

转载自www.cnblogs.com/reround/p/12091822.html
今日推荐