【Mars3d 基础- 矢量数据】标绘完成事件
·
通常我们需要自己绘制一个矢量数据,绘制完成之后在进行下一步的需求,
graphicLayer.startDraw({
type: "rectangle",
style: {
fill: true,
color: "rgba(255,255,0,0.2)",
outline: true,
outlineWidth: 2,
outlineColor: "rgba(255,255,0,1)"
}
})
在上面我们完成了一个"矩形"的绘制,那么绘制完成之后绑定事件主要有两种:
一、success的回调
graphicLayer.startDraw({
type: "rectangle",
style: {
fill: true,
color: "rgba(255,255,0,0.2)",
outline: true,
outlineWidth: 2,
outlineColor: "rgba(255,255,0,1)"
},
success:(graphic)=>{
console.log(graphic)
}
})
二、全局绑定 drawCreated 事件
graphicLayer.on(mars3d.EventType.drawCreated, (e: any) => {
console.log(e.graphic)
})
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)