English中文

Cesium3DTilePointFeature

new Cesium.Cesium3DTilePointFeature()

的一个点特征 A point feature of a Cesium3DTileset.

提供对存储在图块批处理表中的要素属性的访问,以及显示/隐藏要素和更改其点属性的能力 Provides access to a feature's properties stored in the tile's batch table, as well as the ability to show/hide a feature and change its point properties

修改为 Modifications to a Cesium3DTilePointFeature 对象具有图块内容的生命周期。如果图块的内容被卸载,例如,由于它超出了视图范围并且需要在缓存中释放可见图块的空间,请收听 object have the lifetime of the tile's content. If the tile's content is unloaded, e.g., due to it going out of view and needing to free space in the cache for visible tiles, listen to the Cesium3DTileset#tileUnload 事件来保存任何修改。还听听 event to save any modifications. Also listen to the Cesium3DTileset#tileVisible 重新应用任何修改的事件。 event to reapply any modifications.

不要直接构建它。通过访问它 Do not construct this directly. Access it through Cesium3DTileContent#getFeature 或使用采摘 or picking using Scene#pick and Scene#pickPosition.

示例: Example:
// On mouse over, display all the properties for a feature in the console log.
handler.setInputAction(function(movement) {
    const feature = scene.pick(movement.endPosition);
    if (feature instanceof Cesium.Cesium3DTilePointFeature) {
        const propertyIds = feature.getPropertyIds();
        const length = propertyIds.length;
        for (let i = 0; i < length; ++i) {
            const propertyId = propertyIds[i];
            console.log(`{propertyId}: ${feature.getProperty(propertyId)}`);
        }
    }
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
实验性 Experimental

此功能使用的是 3D Tiles 规范的一部分,该规范不是最终版本,并且可能会在没有 Cesium 的标准弃用政策的情况下进行更改。 This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.

成员 Members

获取或设置锚线的颜色。 Gets or sets the color for the anchor line.

仅适用于以下情况 Only applied when heightOffset 被定义。 is defined.

获取或设置是否显示锚线。 Gets or sets whether the anchor line is displayed.

仅适用于以下情况 Only applied when heightOffset 被定义。 is defined.

获取或设置此功能的文本背景颜色。 Gets or sets the background color of the text for this feature.

仅适用于以下情况 Only applied when labelText 被定义。 is defined.

获取或设置是否显示此功能的文本背景。 Gets or sets whether to display the background of the text for this feature.

仅适用于以下情况 Only applied when labelText 被定义。 is defined.

获取或设置此功能的文本背景填充。 Gets or sets the background padding of the text for this feature.

仅适用于以下情况 Only applied when labelText 被定义。 is defined.

获取或设置此要素的点的颜色。 Gets or sets the color of the point of this feature.

仅适用于以下情况 Only applied when image is undefined.

disableDepthTestDistance : number

获取或设置禁用深度测试的距离。 Gets or sets the distance where depth testing will be disabled.
获取或设置指定在距相机的距离处显示此功能的条件。 Gets or sets the condition specifying at what distance from the camera that this feature will be displayed.
获取或设置此功能的字体。 Gets or sets the font of this feature.

仅适用于当 Only applied when the labelText 被定义。 is defined.

获取或设置此要素的高度偏移(以米为单位)。 Gets or sets the height offset in meters of this feature.
获取或设置该点的水平原点,这确定该点是在其锚点位置的左侧、中心还是右侧。 Gets or sets the horizontal origin of this point, which determines if the point is to the left, center, or right of its anchor position.
获取或设置此功能的图像。 Gets or sets the image of this feature.
获取或设置该要素的标签颜色。 Gets or sets the label color of this feature.

如果满足以下条件,颜色将应用于标签: The color will be applied to the label if labelText 被定义。 is defined.

获取或设置该点文本的水平原点,这确定该点文本是在其锚点位置的左侧、中心还是右侧。 Gets or sets the horizontal origin of this point's text, which determines if the point's text is to the left, center, or right of its anchor position.
获取或设置该要素的标签轮廓颜色。 Gets or sets the label outline color of this feature.

如果出现以下情况,轮廓颜色将应用于标签: The outline color will be applied to the label if labelText 被定义。 is defined.

获取或设置此要素的轮廓宽度(以像素为单位)。 Gets or sets the outline width in pixels of this feature.

轮廓宽度将应用于该点,如果 The outline width will be applied to the point if labelText 被定义。 is defined.

获取或设置此要素的填充和轮廓样式。 Gets or sets the fill and outline style of this feature.

仅适用于以下情况 Only applied when labelText 被定义。 is defined.

获取或设置此功能的文本。 Gets or sets the text for this feature.
获取或设置该点文本的垂直原点,这确定该点的文本是否位于其锚点的底部、中心、顶部或基线。 Get or sets the vertical origin of this point's text, which determines if the point's text is to the bottom, center, top, or baseline of it's anchor point.
获取或设置该要素的点轮廓颜色。 Gets or sets the point outline color of this feature.

仅适用于以下情况 Only applied when image is undefined.

获取或设置此要素的点轮廓宽度(以像素为单位)。 Gets or sets the point outline width in pixels of this feature.

仅适用于以下情况 Only applied when image is undefined.

获取或设置此要素的磅值。 Gets or sets the point size of this feature.

仅适用于以下情况 Only applied when image is undefined.

返回的所有对象 All objects returned by Scene#pick 有一个 have a primitive 财产。这将返回包含该要素的图块集。 property. This returns the tileset containing the feature.
获取或设置此功能的近距和远距缩放属性。 Gets or sets the near and far scaling properties for this feature.
获取或设置是否显示该功能。这是在评估样式的显示时为所有功能设置的。 Gets or sets if the feature will be shown. This is set for all features when a style's show is evaluated.
默认值: Default Value: true
获取包含该要素的图块集。 Gets the tileset containing the feature.
获取或设置此功能的近端和远端半透明度属性。 Gets or sets the near and far translucency properties for this feature.
获取或设置该点的垂直原点,这确定该点是否位于其锚点位置的底部、中心或顶部。 Gets or sets the vertical origin of this point, which determines if the point is to the bottom, center, or top of its anchor position.

方法 Methods

返回具有给定名称的要素属性值的副本。这包括使用批处理表层次结构时来自该功能的类和继承类的属性。 Returns a copy of the value of the feature's property with the given name. This includes properties from this feature's class and inherited classes when using a batch table hierarchy.
名称 Name 类型 Type 说明 Description
name string 属性的名称区分大小写。 The case-sensitive name of the property.
返回: Returns:
财产的价值或 The value of the property or undefined 如果该功能没有此属性。 if the feature does not have this property.
示例: Example:
// Display all the properties for a feature in the console log.
const propertyIds = feature.getPropertyIds();
const length = propertyIds.length;
for (let i = 0; i < length; ++i) {
    const propertyId = propertyIds[i];
    console.log(`{propertyId} : ${feature.getProperty(propertyId)}`);
}
另见: See:

getPropertyIds(results)Array.<string>

返回该功能的属性 ID 数组。这包括使用批处理表层次结构时来自该功能的类和继承类的属性。 Returns an array of property IDs for the feature. This includes properties from this feature's class and inherited classes when using a batch table hierarchy.
名称 Name 类型 Type 说明 Description
results Array.<string> 可选 optional 用于存储结果的数组。 An array into which to store the results.
返回: Returns:
要素属性的 ID。 The IDs of the feature's properties.
另见: See:
返回该功能是否包含此属性。这包括使用批处理表层次结构时来自该功能的类和继承类的属性。 Returns whether the feature contains this property. This includes properties from this feature's class and inherited classes when using a batch table hierarchy.
名称 Name 类型 Type 说明 Description
name string 属性的名称区分大小写。 The case-sensitive name of the property.
返回: Returns:
该功能是否包含此属性。 Whether the feature contains this property.
另见: See:
设置具有给定名称的要素属性的值。 Sets the value of the feature's property with the given name.

如果具有给定名称的属性不存在,则会创建该属性。 If a property with the given name doesn't exist, it is created.

名称 Name 类型 Type 说明 Description
name string 属性的名称区分大小写。 The case-sensitive name of the property.
value * 将复制的属性的值。 The value of the property that will be copied.
抛出: Throws:
  • DeveloperError :继承的批处理表层次结构属性是只读的。 : Inherited batch table hierarchy property is read only.
示例: Examples:
const height = feature.getProperty('Height'); // e.g., the height of a building
const name = 'clicked';
if (feature.getProperty(name)) {
    console.log('already clicked');
} else {
    feature.setProperty(name, true);
    console.log('first click');
}
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.