PlottingSymbolLib

new Cesium.PlottingSymbolLib()

符号标绘库,用以解析符号文件,目前支持ttf、woff文件格式
Example:
const options = {
     	url: "http://172.30.80.144:8090/fontTest/MapServerParks.ttf",
     }
 const symbolLib = Cesium.PlottingSymbolLibManager.getOrCreateSymbolLib(options);
 symbolLib.initEvent.addEventListener(function(result) {
     	if (result.success) //初始化成功
     	{
     		const cavaswidth = 60;
     		const symbolSize = 48;
     		const glyphOptions = {
     			xoffset: (cavaswidth - symbolSize) * 0.5 + symbolSize * 0.1,
     			yoffset: cavaswidth - (cavaswidth - symbolSize) * 0.5,
     			symbolSize: symbolSize,
     			cavaswidth: cavaswidth
     		}
     		for (const i = 0; i < symbolLib.codes.length; i++) {
     			const code = symbolLib.codes[i];//符号库编码
     			const thumbnail = symbolLib.getGlyph(code, glyphOptions);//根据符号编码生成缩略图
     			const symbolLibID = symbolLib.id;//符号库id,可用此id获取符号库
     		};

     	}
     } else {
     	//do something
     }
 console.log(result.message);
 });

Members

符号库有效的编码数组,编码类型为Number
符号库版权信息
符号库描述信息
符号库系列
符号库全名
符号库id
符号库初始化事件,当调用PlottingSymbolLibManager.getOrCreateSymbolLib方法时会触发该事件。已初始化完的符号库不再会触发该事件, 事件抛出的对象包含两个属性success和message,用以表达初始化状态和日志信息
Default Value: new Event()
Example:
const symbolLib = Cesium.PlottingSymbolLibManager.getOrCreateSymbolLib(options);
   symbolLib.initEvent.addEventListener(function(result) {
      console.log(result.message);
   });
符号库版本号

Methods

getGlyph(code, options)String

获取指定符号的图形,图片格式为64位编码
Name Type Description
code Number 符号的编码.
options Object 对象具有如下属性:
Name Type Description
cavasWidth Number optional cavas的尺寸
symbolSize Number optional 符号的尺寸
xoffset Number optional
yoffset Number optional
format String optional 图形格式,默认值为“image/png”
Returns:
64位编码图片
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.