广告牌旨在显示光栅化数据,例如图像。如果要将html渲染为1,则必须为其创建一个canvas元素draw the dom elements,然后将该画布作为其图像属性传递给广告牌。
如果您实际上只需要显示图标/图像,然后在用户点击时显示一些HTML,那么您应该使用Entity API来创建广告牌。您将获得其他属性,例如' description'当您使用Entity API时。描述可以是静态HTML字符串或回调属性,可以根据需要随时更新。当用户通过鼠标点击选择实体时会显示描述,但可以通过ackedEntity属性以编程方式完成。
var viewer = new Cesium.Viewer('cesiumContainer');
var canvas = ateElement('canvas');
canvas.width = 300;
canvas.height = 300;
var svgString = '' +
'' +
'
' +'I like' +
'' +
'Cupcakes' +
'
' +'' +
'';
var image = new Image();
image.src = 'data:image/svg+xml;base64,' + window.btoa(svgString);
//Need to wait for image to load before proceeding to draw
id: 'Cupcake SVG',
position: Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
billboard: {
image: canvas
},
description: '
This is a cupcake that can be modified.
'});
};
本文发布于:2024-01-31 10:13:29,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170666721027782.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |