marsgis / mars3d

【Mars3D平台 】主仓库,包含所有开源仓库清单导航
http://mars3d.cn
Apache License 2.0
977 stars 137 forks source link

向 GraphicLayer 添加 PolygonPrimitive 对象时报错 #10

Closed cjh804263197 closed 2 years ago

cjh804263197 commented 2 years ago

描述

在向 GraphicLayer 添加 PolygonPrimitive 对象时报错,错误如下图: image

示例代码:

const positions = [
  new Cartesian3(-2877753.8912436897, 4848831.729657154, 2971314.4878532737),
  new Cartesian3(-2877782.6632767506, 4848822.004413433, 2971302.1542773163),
  new Cartesian3(-2877798.206913736, 4848827.3474626485, 2971278.564903176),
]
const polygonPrimitive = new mars3d.graphic.PolygonPrimitive({
    positions,
    style: {
        color: '#d40000',
        opacity: 0.4,
        outline: true,
        outlineColor: '#d40000',
        outlineOpacity: 1,
        clampToGround: true
    }
})

// graphicLayer 的创建过程省略
graphicLayer.addGraphic(polygonPrimitive)

版本信息

mars3d: v3.1.20 mars3d-cesium: 1.89.0

muyao1987 commented 2 years ago

当前版本可以加属性:outlineWidth: 2, 解决报错问题。 这个错误将在3.1.22修复。

const polygonPrimitive = new mars3d.graphic.PolygonPrimitive({ positions, style: { color: "#d40000", opacity: 0.4, outline: true, outlineWidth: 2, outlineColor: "#d40000", outlineOpacity: 1, clampToGround: true, }, });