跳至主要內容

标注

小于 1 分钟

标注

标注对象常用于在场景中创建点位抽象化表达对象,或者通过文字的方式来标明对象,目前包括Billboard、Label两种方式,Label仅支持文字方式。

Billboard

Billboard对象支持图标和文字组合方式,也支持单独图标、单独文字方式,图标和文字内容样式均可配置。

图:Billboard示意

new VT.Billboard({
    avoid: false,
    center: [0.5, 0],
    material: {
        // 设置为false可置顶
        depthTest: true,
        // 内容与样式设置
        map: {
            icon: "",
            fill: false,
            fillColor: "#000000",
            fontSize: 14,
            fontColor: "#111111",
            fontFamily: 'Microsoft Yahei, Times, serif',
            fontWeight: "normal",
            fontVariant: "normal",
            lineGap: 6,
            padding: 4,
            textAlign: "left",
            textVisible: true,
            iconVisible: true,
            iconWidth: 32,
            iconHeight: 32,
            iconRotate: 0,
            iconMargin: 4,
            offsetX: 0,
            offsetY: 0,
            strokeWidth: 1,
            strokeColor: "#FFFFFF",
            outlineWidth: 0,
            outlineColor: "#FFFFFF",
            text: "",
            forcePowerOf2: false,
        }
    }
})

Label

Label对象常用于创建文字方式的标注,可贴于物体表面。

图:Label示意

new VT.Label({
    position: [0, 1, 0],
    geometry: {
        width: 1.0, 
        height: 0.4,
    },
    material: {
        map: {
            iconWidth: 32,
            iconHeight: 32,
            text: "标注",
            fontSize: 16,
            fontColor: "rgba(255,255,255,.9)",
            fontFamily: '微软雅黑',
            padding: 8,
            outlineWidth: 1,
            outlineColor: "#00ff00",
            iconMargin: 16,
            strokeWidth: 0,
            fill: true,
            fillColor: "rgba(0,255,155,.2)",
            textAlign: textAlign,
            iconPosition:iconPosition,
        }
    }
})
上次编辑于:
贡献者: dashun