UNPKG

bcgis-type

Version:

The SDK is based on Cesium for secondary development of 2, 3D all-in-one WebGis application framework, the framework optimizes the use of Cesium and add some additional features, designed for developers to quickly build WebGis applications.

80 lines (79 loc) 2.69 kB
import Overlay from "../Overlay"; import { T_Position } from "../../common/type"; /** * 注记 * @noInheritDoc * @example * ```ts * let position = new BC.Position(120, 20) * let Label = new BC.Label(position, 'test') * ``` */ declare class Label extends Overlay { private _position; private _text; /** * * @param position 坐标 * @param text 文本 */ constructor(position: T_Position, text: string); get type(): any; set position(position: T_Position); get position(): T_Position; set text(text: string); get text(): string; _mountedHook(): void; /** * * @param text * @param textStyle */ setLabel(text: string, textStyle: any): this; /** * 设置风格 * @param style * @returns {Label} * @example * ```json * // 样式参数(可选) * { * "font": "30px sans-serif", // CSS 字体设置 * "scale": 1, //比例 * "pixelOffset": { "x": 0, "y": 0 }, //偏移像素 * "heightReference": 0, //高度参照,0:位置无参照,位置是绝对的,1:位置固定在地形上 2:位置高度是指地形上方的高度。 * "showBackground": false, //是否显示背景 * "backgroundColor": BC.Color.BLACK, //背景颜色 * "backgroundPadding": { "x": 0, "y": 0 }, //背景间隙 * "fillColor": BC.Color.BLACK, //文字颜色 * "outlineColor": BC.Color.WHITE, //边框颜色 * "outlineWidth": 0, //边框大小, * "scaleByDistance": { * "near": 0, //最近距离 * "nearValue": 0, //最近距离值 * "far": 1, //最远距离值 * "farValue": 0 //最远距离值 * }, //根据距离设置比例 * "translucencyByDistance": { * "near": 0, //最近距离 * "nearValue": 0, //最近距离值 * "far": 1, //最远距离值 * "farValue": 0 //最远距离值 * }, //根据距离设置透明度 * "distanceDisplayCondition": { * "near": 0, //最近距离 * "far": Number.MAX_VALUE //最远距离 * }, //根据距离设置可见 * "disableDepthTestDistance": 0 // 深度检测距离,用于防止剪切地形,设置为零时,将始终应用深度测试。设置为Number.POSITIVE_INFINITY时,永远不会应用深度测试。 * } * ``` */ setStyle(style: any): this; /** * Parse from entity * @param entity * @returns {Label} */ static fromEntity(entity: Cesium.Entity): Label | undefined; } export default Label;