From 21205e5b26a4d004394a3aa1ea15ab7c308bf5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85=E6=97=AD?= Date: Fri, 28 Jun 2024 14:31:46 +0800 Subject: [PATCH] feat:update docs --- Tools/jsdoc/conf.json | 2 +- packages/engine/Source/Core/DeveloperError.js | 23 ++- packages/engine/Source/Core/defined.js | 4 +- .../Source/DataSources/CustomDataSource.js | 32 ++-- .../engine/Source/DataSources/DataSource.js | 36 ++--- packages/engine/Source/DataSources/Entity.js | 82 +++++------ .../Source/DataSources/GeoJsonDataSource.js | 138 +++++++++--------- 7 files changed, 158 insertions(+), 159 deletions(-) diff --git a/Tools/jsdoc/conf.json b/Tools/jsdoc/conf.json index 840e70cb87..041e79b60f 100644 --- a/Tools/jsdoc/conf.json +++ b/Tools/jsdoc/conf.json @@ -23,7 +23,7 @@ "default": { "outputSourceFiles": false }, - "sourceUrl": "https://github.com/CesiumGS/cesium/blob/{version}/packages/{filename}" + "sourceUrl": "https://gitee.com/zulezhe/cesium/blob/{version}/packages/{filename}" }, "opts": { "destination": "Build/Documentation", diff --git a/packages/engine/Source/Core/DeveloperError.js b/packages/engine/Source/Core/DeveloperError.js index a330471eef..8b828a8cd2 100644 --- a/packages/engine/Source/Core/DeveloperError.js +++ b/packages/engine/Source/Core/DeveloperError.js @@ -1,39 +1,38 @@ import defined from "./defined.js"; /** - * Constructs an exception object that is thrown due to a developer error, e.g., invalid argument, - * argument out of range, etc. This exception should only be thrown during development; - * it usually indicates a bug in the calling code. This exception should never be - * caught; instead the calling code should strive not to generate it. + * 构造一个由于开发人员错误而抛出的异常对象,例如,无效的参数, + * 参数超出范围等。 此异常应仅在开发过程中抛出;这个异常永远不应该被捕获;相反,调用代码应该努力不生成它 + * 它通常表示调用代码中的错误。 *

- * On the other hand, a {@link RuntimeError} indicates an exception that may - * be thrown at runtime, e.g., out of memory, that the calling code should be prepared - * to catch. + * 另一方面,{@link RuntimeError} 表示可能 + * 在运行时抛出,例如,内存不足,应准备调用代码 + * 捕捉。 * * @alias DeveloperError * @constructor * @extends Error * - * @param {string} [message] The error message for this exception. + * @param {string} [message] 此异常的错误消息。 * * @see RuntimeError */ function DeveloperError(message) { /** - * 'DeveloperError' indicating that this exception was thrown due to a developer error. + * 'DeveloperError“,表示此异常是由于开发人员错误而引发的. * @type {string} * @readonly */ this.name = "DeveloperError"; /** - * The explanation for why this exception was thrown. + * 为什么会抛出此异常的解释。 * @type {string} * @readonly */ this.message = message; - //Browsers such as IE don't have a stack property until you actually throw the error. + //IE 等浏览器在实际抛出错误之前没有堆栈属性。 let stack; try { throw new Error(); @@ -42,7 +41,7 @@ function DeveloperError(message) { } /** - * The stack trace of this exception, if available. + * 此异常的堆栈跟踪(如果可用)。 * @type {string} * @readonly */ diff --git a/packages/engine/Source/Core/defined.js b/packages/engine/Source/Core/defined.js index 5040c613e7..c1edc8a154 100644 --- a/packages/engine/Source/Core/defined.js +++ b/packages/engine/Source/Core/defined.js @@ -1,8 +1,8 @@ /** * @function * - * @param {*} value The object. - * @returns {boolean} Returns true if the object is defined, returns false otherwise. + * @param {*} value 对象。 + * @returns {boolean}如果定义了对象,则返回 true,否则返回 false。 * * @example * if (Cesium.defined(positions)) { diff --git a/packages/engine/Source/DataSources/CustomDataSource.js b/packages/engine/Source/DataSources/CustomDataSource.js index a853be4c43..e6a9275fe4 100644 --- a/packages/engine/Source/DataSources/CustomDataSource.js +++ b/packages/engine/Source/DataSources/CustomDataSource.js @@ -6,7 +6,7 @@ import EntityCluster from "./EntityCluster.js"; import EntityCollection from "./EntityCollection.js"; /** - * A {@link DataSource} implementation which can be used to manually manage a group of entities. + * A {@link DataSource} 可用于手动管理一组实体的实现。 * * @alias CustomDataSource * @constructor @@ -38,7 +38,7 @@ function CustomDataSource(name) { Object.defineProperties(CustomDataSource.prototype, { /** - * Gets or sets a human-readable name for this instance. + * 获取或设置此实例的人类可读名称. * @memberof CustomDataSource.prototype * @type {string} */ @@ -54,7 +54,7 @@ Object.defineProperties(CustomDataSource.prototype, { }, }, /** - * Gets or sets the clock for this instance. + * 获取或设置此实例的时钟。 * @memberof CustomDataSource.prototype * @type {DataSourceClock} */ @@ -70,7 +70,7 @@ Object.defineProperties(CustomDataSource.prototype, { }, }, /** - * Gets the collection of {@link Entity} instances. + * 获取 {@link Entity} 实例的集合。 * @memberof CustomDataSource.prototype * @type {EntityCollection} */ @@ -80,7 +80,7 @@ Object.defineProperties(CustomDataSource.prototype, { }, }, /** - * Gets or sets whether the data source is currently loading data. + * 获取或设置数据源当前是否正在加载数据。 * @memberof CustomDataSource.prototype * @type {boolean} */ @@ -93,7 +93,7 @@ Object.defineProperties(CustomDataSource.prototype, { }, }, /** - * Gets an event that will be raised when the underlying data changes. + * 获取基础数据更改时将引发的事件。 * @memberof CustomDataSource.prototype * @type {Event} */ @@ -103,7 +103,7 @@ Object.defineProperties(CustomDataSource.prototype, { }, }, /** - * Gets an event that will be raised if an error is encountered during processing. + * GETS 在处理过程中遇到错误时将引发的事件。 * @memberof CustomDataSource.prototype * @type {Event} */ @@ -113,7 +113,7 @@ Object.defineProperties(CustomDataSource.prototype, { }, }, /** - * Gets an event that will be raised when the data source either starts or stops loading. + * 获取在数据源开始或停止加载时将引发的事件。 * @memberof CustomDataSource.prototype * @type {Event} */ @@ -123,7 +123,7 @@ Object.defineProperties(CustomDataSource.prototype, { }, }, /** - * Gets whether or not this data source should be displayed. + * 获取是否应显示此数据源。 * @memberof CustomDataSource.prototype * @type {boolean} */ @@ -137,7 +137,7 @@ Object.defineProperties(CustomDataSource.prototype, { }, /** - * Gets or sets the clustering options for this data source. This object can be shared between multiple data sources. + * 获取或设置此数据源的聚类分析选项。此对象可以在多个数据源之间共享。 * * @memberof CustomDataSource.prototype * @type {EntityCluster} @@ -158,13 +158,13 @@ Object.defineProperties(CustomDataSource.prototype, { }); /** - * Updates the data source to the provided time. This function is optional and - * is not required to be implemented. It is provided for data sources which - * retrieve data based on the current animation time or scene state. - * If implemented, update will be called by {@link DataSourceDisplay} once a frame. + * 将数据源更新到提供的时间。 此功能是可选的,并且 + * 不需要实现。 它适用于以下数据源 + * 根据当前动画时间或场景状态检索数据。 + * 如果实现,则 {@link DataSourceDisplay} 将每帧调用一次 update。 * - * @param {JulianDate} time The simulation time. - * @returns {boolean} True if this data source is ready to be displayed at the provided time, false otherwise. + * @param {JulianDate} time 模拟时间。 + * @returns {boolean} 如果此数据源已准备好在提供的时间显示,则为 true,否则为 false。 */ CustomDataSource.prototype.update = function (time) { return true; diff --git a/packages/engine/Source/DataSources/DataSource.js b/packages/engine/Source/DataSources/DataSource.js index 8f72f258ae..91b523fe7a 100644 --- a/packages/engine/Source/DataSources/DataSource.js +++ b/packages/engine/Source/DataSources/DataSource.js @@ -1,9 +1,9 @@ import DeveloperError from "../Core/DeveloperError.js"; /** - * Defines the interface for data sources, which turn arbitrary data into a - * {@link EntityCollection} for generic consumption. This object is an interface - * for documentation purposes and is not intended to be instantiated directly. + * 定义数据源的接口,将任意数据转换为 + * {@link EntityCollection} 用于泛型使用。此对象是一个接口 + * 仅用于文档目的,不打算直接实例化。 * @alias DataSource * @constructor * @@ -16,7 +16,7 @@ function DataSource() { Object.defineProperties(DataSource.prototype, { /** - * Gets a human-readable name for this instance. + * 获取此实例的人类可读名称。 * @memberof DataSource.prototype * @type {string} */ @@ -24,7 +24,7 @@ Object.defineProperties(DataSource.prototype, { get: DeveloperError.throwInstantiationError, }, /** - * Gets the preferred clock settings for this data source. + * 获取此数据源的首选时钟设置。 * @memberof DataSource.prototype * @type {DataSourceClock} */ @@ -32,7 +32,7 @@ Object.defineProperties(DataSource.prototype, { get: DeveloperError.throwInstantiationError, }, /** - * Gets the collection of {@link Entity} instances. + * 获取 {@link Entity} 实例的集合。 * @memberof DataSource.prototype * @type {EntityCollection} */ @@ -40,7 +40,7 @@ Object.defineProperties(DataSource.prototype, { get: DeveloperError.throwInstantiationError, }, /** - * Gets a value indicating if the data source is currently loading data. + * 获取一个值,该值指示数据源当前是否正在加载数据。 * @memberof DataSource.prototype * @type {boolean} */ @@ -48,7 +48,7 @@ Object.defineProperties(DataSource.prototype, { get: DeveloperError.throwInstantiationError, }, /** - * Gets an event that will be raised when the underlying data changes. + * 获取基础数据更改时将引发的事件。 * @memberof DataSource.prototype * @type {Event} */ @@ -56,7 +56,7 @@ Object.defineProperties(DataSource.prototype, { get: DeveloperError.throwInstantiationError, }, /** - * Gets an event that will be raised if an error is encountered during processing. + * 获取一个事件,如果在处理过程中遇到错误,则将引发该事件。 * @memberof DataSource.prototype * @type {Event} */ @@ -64,7 +64,7 @@ Object.defineProperties(DataSource.prototype, { get: DeveloperError.throwInstantiationError, }, /** - * Gets an event that will be raised when the value of isLoading changes. + * 获取一个事件,当 isLoading 的值发生更改时,将引发该事件。 * @memberof DataSource.prototype * @type {Event} */ @@ -72,7 +72,7 @@ Object.defineProperties(DataSource.prototype, { get: DeveloperError.throwInstantiationError, }, /** - * Gets whether or not this data source should be displayed. + * 获取是否应显示此数据源。 * @memberof DataSource.prototype * @type {boolean} */ @@ -81,7 +81,7 @@ Object.defineProperties(DataSource.prototype, { }, /** - * Gets or sets the clustering options for this data source. This object can be shared between multiple data sources. + *获取或设置此数据源的聚类分析选项。此对象可以在多个数据源之间共享。 * * @memberof DataSource.prototype * @type {EntityCluster} @@ -92,13 +92,13 @@ Object.defineProperties(DataSource.prototype, { }); /** - * Updates the data source to the provided time. This function is optional and - * is not required to be implemented. It is provided for data sources which - * retrieve data based on the current animation time or scene state. - * If implemented, update will be called by {@link DataSourceDisplay} once a frame. + * 将数据源更新到提供的时间。 此功能是可选的,并且 + * 不需要实现。 它适用于以下数据源 + * 根据当前动画时间或场景状态检索数据。 + * 如果实现,则 {@link DataSourceDisplay} 将每帧调用一次 update。 * - * @param {JulianDate} time The simulation time. - * @returns {boolean} True if this data source is ready to be displayed at the provided time, false otherwise. + * @param {JulianDate} time 模拟时间。 + * @returns {boolean}如果此数据源已准备好在提供的时间显示,则为 true,否则为 false。 */ DataSource.prototype.update = function (time) { DeveloperError.throwInstantiationError(); diff --git a/packages/engine/Source/DataSources/Entity.js b/packages/engine/Source/DataSources/Entity.js index 998108671b..4ff3bd4819 100644 --- a/packages/engine/Source/DataSources/Entity.js +++ b/packages/engine/Source/DataSources/Entity.js @@ -67,45 +67,45 @@ function createPropertyTypeDescriptor(name, Type) { /** * @typedef {object} Entity.ConstructorOptions * - * Initialization options for the Entity constructor + * Entity 构造函数的初始化选项 * - * @property {string} [id] A unique identifier for this object. If none is provided, a GUID is generated. - * @property {string} [name] A human readable name to display to users. It does not have to be unique. - * @property {TimeIntervalCollection} [availability] The availability, if any, associated with this object. - * @property {boolean} [show] A boolean value indicating if the entity and its children are displayed. - * @property {Property | string} [description] A string Property specifying an HTML description for this entity. - * @property {PositionProperty | Cartesian3} [position] A Property specifying the entity position. - * @property {Property | Quaternion} [orientation=Transforms.eastNorthUpToFixedFrame(position)] A Property specifying the entity orientation in respect to Earth-fixed-Earth-centered (ECEF). If undefined, east-north-up at entity position is used. - * @property {Property | Cartesian3} [viewFrom] A suggested initial offset for viewing this object. - * @property {Entity} [parent] A parent entity to associate with this entity. - * @property {BillboardGraphics | BillboardGraphics.ConstructorOptions} [billboard] A billboard to associate with this entity. - * @property {BoxGraphics | BoxGraphics.ConstructorOptions} [box] A box to associate with this entity. - * @property {CorridorGraphics | CorridorGraphics.ConstructorOptions} [corridor] A corridor to associate with this entity. - * @property {CylinderGraphics | CylinderGraphics.ConstructorOptions} [cylinder] A cylinder to associate with this entity. - * @property {EllipseGraphics | EllipseGraphics.ConstructorOptions} [ellipse] A ellipse to associate with this entity. - * @property {EllipsoidGraphics | EllipsoidGraphics.ConstructorOptions} [ellipsoid] A ellipsoid to associate with this entity. - * @property {LabelGraphics | LabelGraphics.ConstructorOptions} [label] A options.label to associate with this entity. - * @property {ModelGraphics | ModelGraphics.ConstructorOptions} [model] A model to associate with this entity. - * @property {Cesium3DTilesetGraphics | Cesium3DTilesetGraphics.ConstructorOptions} [tileset] A 3D Tiles tileset to associate with this entity. - * @property {PathGraphics | PathGraphics.ConstructorOptions} [path] A path to associate with this entity. - * @property {PlaneGraphics | PlaneGraphics.ConstructorOptions} [plane] A plane to associate with this entity. - * @property {PointGraphics | PointGraphics.ConstructorOptions} [point] A point to associate with this entity. - * @property {PolygonGraphics | PolygonGraphics.ConstructorOptions} [polygon] A polygon to associate with this entity. - * @property {PolylineGraphics | PolylineGraphics.ConstructorOptions} [polyline] A polyline to associate with this entity. - * @property {PropertyBag | Object} [properties] Arbitrary properties to associate with this entity. - * @property {PolylineVolumeGraphics | PolylineVolumeGraphics.ConstructorOptions} [polylineVolume] A polylineVolume to associate with this entity. - * @property {RectangleGraphics | RectangleGraphics.ConstructorOptions} [rectangle] A rectangle to associate with this entity. - * @property {WallGraphics | WallGraphics.ConstructorOptions} [wall] A wall to associate with this entity. + * @property {string} [id] 此对象的唯一标识符。如果未提供任何信息,则生成 GUID。 + * @property {string} [name] 要向用户显示的人类可读名称。它不一定是唯一的。 + * @property {TimeIntervalCollection} [availability] 与此对象关联的可用性(如果有)。 + * @property {boolean} [show] 一个布尔值,指示是否显示实体及其子实体。 + * @property {Property | string} [description] 一个字符串 属性,指定此实体的 HTML 说明。 + * @property {PositionProperty |Cartesian3} [position] 指定实体位置的属性。 + * @property {Property |Quaternion} [orientation=Transforms.eastNorthUpToFixedFrame(position)] 一个属性,用于指定相对于地球固定地球中心 (ECEF) 的实体方向。如果未定义,则在实体位置使用东-北-上。 + * @property {Property |Cartesian3} [viewFrom] 用于查看此对象的建议初始偏移量。 + * @property {Entity} [parent] 要与此实体关联的父实体。 + * @property {BillboardGraphics |BillboardGraphics.ConstructorOptions} [billboard] 要与此实体关联的广告牌。 + * @property {BoxGraphics |BoxGraphics.ConstructorOptions} [box] 要与此实体关联的框。 + * @property {CorridorGraphics |CorridorGraphics.ConstructorOptions} [corridor] 要与此实体关联的走廊。 + * @property {CylinderGraphics |CylinderGraphics.ConstructorOptions} [cylinder] 要与此实体关联的圆柱体。 + * @property {EllipseGraphics |EllipseGraphics.ConstructorOptions} [ellipse] 要与此实体关联的椭圆。 + * @property {EllipseGraphics |EllipsoidGraphics.ConstructorOptions} [ellipsoid] 要与此实体关联的椭球体。 + * @property {LabelGraphics |LabelGraphics.ConstructorOptions} [label] 要与此实体关联的 options.label。 + * @property {ModelGraphics |ModelGraphics.ConstructorOptions} [model] 要与此实体关联的模型。 + * @property {Cesium3DTilesetGraphics |Cesium3DTilesetGraphics.ConstructorOptions} [tileset] 要与此实体关联的 3D Tiles 图块集。 + * @property {PathGraphics |PathGraphics.ConstructorOptions} [path] 要与此实体关联的路径。 + * @property {PlaneGraphics |PlaneGraphics.ConstructorOptions} [plane] 要与此实体关联的平面。 + * @property {PointGraphics |PointGraphics.ConstructorOptions} [point] 要与此实体关联的点。 + * @property {PolygonGraphics |PolygonGraphics.ConstructorOptions} [polygon] 要与此实体关联的多边形。 + * @property {PolylineGraphics |PolylineGraphics.ConstructorOptions} [polyline] 要与此实体关联的折线。 + * @property {PropertyBag |Object} [properties] 要与此实体关联的任意属性。 + * @property {PolylineVolumeGraphics |PolylineVolumeGraphics.ConstructorOptions} [polylineVolume] 要与此实体关联的 polylineVolume。 + * @property {RectangleGraphics |RectangleGraphics.ConstructorOptions} [rectangle] 要与此实体关联的矩形。 + * @property {WallGraphics |WallGraphics.ConstructorOptions} [wall] 要与此实体关联的墙。 */ /** - * Entity instances aggregate multiple forms of visualization into a single high-level object. - * They can be created manually and added to {@link Viewer#entities} or be produced by - * data sources, such as {@link CzmlDataSource} and {@link GeoJsonDataSource}. + * 实体实例将多种形式的可视化聚合到单个高级对象中。 + * 它们可以手动创建并添加到 {@link Viewer#entities} 或由 + * 数据源,例如 {@link CzmlDataSource} 和 {@link GeoJsonDataSource}。 * @alias Entity * @constructor * - * @param {Entity.ConstructorOptions} [options] Object describing initialization options + * @param {Entity.ConstructorOptions} [options] 描述初始化选项的对象 * * @see {@link https://cesium.com/learn/cesiumjs-learn/cesiumjs-creating-entities/|Creating Entities} */ @@ -226,17 +226,17 @@ function updateShow(entity, children, isShowing) { Object.defineProperties(Entity.prototype, { /** - * The availability, if any, associated with this object. - * If availability is undefined, it is assumed that this object's - * other properties will return valid data for any provided time. - * If availability exists, the objects other properties will only - * provide valid data if queried within the given interval. + * 与此对象关联的可用性(如果有)。 + * 如果可用性未定义,则假定此对象的 + * 其他属性将返回任何提供时间的有效数据。 + * 如果存在可用性,则其他属性的对象将仅 + * 如果在给定的时间间隔内查询,请提供有效数据。 * @memberof Entity.prototype * @type {TimeIntervalCollection|undefined} */ availability: createRawPropertyDescriptor("availability"), /** - * Gets the unique ID associated with this object. + * 获取与此对象关联的唯一 ID。 * @memberof Entity.prototype * @type {string} */ @@ -246,7 +246,7 @@ Object.defineProperties(Entity.prototype, { }, }, /** - * Gets the event that is raised whenever a property or sub-property is changed or modified. + * 获取每当更改或修改属性或子属性时引发的事件。 * @memberof Entity.prototype * * @type {Event} @@ -258,8 +258,8 @@ Object.defineProperties(Entity.prototype, { }, }, /** - * Gets or sets the name of the object. The name is intended for end-user - * consumption and does not need to be unique. + * 获取或设置对象的名称。 该名称适用于最终用户 + * 消费,不需要是唯一的。 * @memberof Entity.prototype * @type {string|undefined} */ diff --git a/packages/engine/Source/DataSources/GeoJsonDataSource.js b/packages/engine/Source/DataSources/GeoJsonDataSource.js index ce8429d476..6213251aeb 100644 --- a/packages/engine/Source/DataSources/GeoJsonDataSource.js +++ b/packages/engine/Source/DataSources/GeoJsonDataSource.js @@ -552,31 +552,31 @@ function processTopology(dataSource, geoJson, geometry, crsFunction, options) { /** * @typedef {object} GeoJsonDataSource.LoadOptions * - * Initialization options for the load method. + * load 方法的初始化选项。 * - * @property {string} [sourceUri] Overrides the url to use for resolving relative links. - * @property {GeoJsonDataSource.describe} [describe=GeoJsonDataSource.defaultDescribeProperty] A function which returns a Property object (or just a string). - * @property {number} [markerSize=GeoJsonDataSource.markerSize] The default size of the map pin created for each point, in pixels. - * @property {string} [markerSymbol=GeoJsonDataSource.markerSymbol] The default symbol of the map pin created for each point. - * @property {Color} [markerColor=GeoJsonDataSource.markerColor] The default color of the map pin created for each point. - * @property {Color} [stroke=GeoJsonDataSource.stroke] The default color of polylines and polygon outlines. - * @property {number} [strokeWidth=GeoJsonDataSource.strokeWidth] The default width of polylines and polygon outlines. - * @property {Color} [fill=GeoJsonDataSource.fill] The default color for polygon interiors. - * @property {boolean} [clampToGround=GeoJsonDataSource.clampToGround] true if we want the geometry features (polygons or linestrings) clamped to the ground. - * @property {Credit|string} [credit] A credit for the data source, which is displayed on the canvas. + *@property {string} [sourceUri] 覆盖用于解析相对链接的 url。 + *@property {GeoJsonDataSource.describe} [describe=GeoJsonDataSource.defaultDescribeProperty] 返回 Property 对象(或只是字符串)的函数。 + *@property {number} [markerSize=GeoJsonDataSource.markerSize] 为每个点创建的地图图钉的默认大小(以像素为单位)。 + *@property {string} [markerSymbol=GeoJsonDataSource.markerSymbol] 为每个点创建的地图图钉的默认符号。 + *@property {Color} [markerColor=GeoJsonDataSource.markerColor] 为每个点创建的地图图钉的默认颜色。 + *@property {Color} [Stroke=GeoJsonDataSource.Stroke] 折线和多边形轮廓的默认颜色。 + *@property {number} [StrokeWidth=GeoJsonDataSource.StrokeWidth] 折线和多边形轮廓的默认宽度。 + *@property {Color} [fill=GeoJsonDataSource.fill] 多边形内部的默认颜色。 + *@property {boolean} [clampToGround=GeoJsonDataSource.clampToGround] 如果我们希望将几何特征(多边形或线串)固定在地面上,则为 true。 + *@property {Credit|string} [credit] 数据源的信用,显示在画布上。 */ /** - * A {@link DataSource} which processes both - * {@link http://www.geojson.org/|GeoJSON} and {@link https://github.com/mbostock/topojson|TopoJSON} data. - * {@link https://github.com/mapbox/simplestyle-spec|simplestyle-spec} properties will also be used if they - * are present. + * 一个 {@link DataSource} 它同时处理 + * {@link http://www.geojson.org/|GeoJSON} 和 {@link https://github.com/mbostock/topojson|TopoJSON} 数据. + * 如果它们{@link https://github.com/mapbox/simplestyle-spec|simplestyle-spec} 属性也将被使用 + * * * @alias GeoJsonDataSource * @constructor * - * @param {string} [name] The name of this data source. If undefined, a name will be taken from - * the name of the GeoJSON file. + * @param {string} [name] 该数据源的名称。 如果未定义,名称将从 + *GeoJSON 文件的名称。 * * @demo {@link https://sandcastle.cesium.com/index.html?src=GeoJSON%20and%20TopoJSON.html|Cesium Sandcastle GeoJSON and TopoJSON Demo} * @demo {@link https://sandcastle.cesium.com/index.html?src=GeoJSON%20simplestyle.html|Cesium Sandcastle GeoJSON simplestyle Demo} @@ -605,12 +605,12 @@ function GeoJsonDataSource(name) { } /** - * Creates a Promise to a new instance loaded with the provided GeoJSON or TopoJSON data. + * 创建一个 Promise 到加载了所提供的 GeoJSON 或 TopoJSON 数据的新实例。 * - * @param {Resource|string|object} data A url, GeoJSON object, or TopoJSON object to be loaded. - * @param {GeoJsonDataSource.LoadOptions} [options] An object specifying configuration options + *@param {Resource|string|object} data 要加载的 url、GeoJSON 对象或 TopoJSON 对象。 + *@param {GeoJsonDataSource.LoadOptions} [options] 指定配置选项的对象 * - * @returns {Promise} A promise that will resolve when the data is loaded. + *@returns {Promise} 加载数据时将解析的承诺。 */ GeoJsonDataSource.load = function (data, options) { return new GeoJsonDataSource().load(data, options); @@ -618,7 +618,7 @@ GeoJsonDataSource.load = function (data, options) { Object.defineProperties(GeoJsonDataSource, { /** - * Gets or sets the default size of the map pin created for each point, in pixels. + * 获取或设置为每个点创建的地图图钉的默认大小(以像素为单位)。 * @memberof GeoJsonDataSource * @type {number} * @default 48 @@ -632,9 +632,9 @@ Object.defineProperties(GeoJsonDataSource, { }, }, /** - * Gets or sets the default symbol of the map pin created for each point. - * This can be any valid {@link http://mapbox.com/maki/|Maki} identifier, any single character, - * or blank if no symbol is to be used. + * 获取或设置为每个点创建的地图图钉的默认符号。 + *这可以是任何有效的{@link http://mapbox.com/maki/|Maki}标识符,任何单个字符, + *或空白(如果不使用符号)。 * @memberof GeoJsonDataSource * @type {string} */ @@ -647,7 +647,7 @@ Object.defineProperties(GeoJsonDataSource, { }, }, /** - * Gets or sets the default color of the map pin created for each point. + *获取或设置为每个点创建的地图图钉的默认颜色。 * @memberof GeoJsonDataSource * @type {Color} * @default Color.ROYALBLUE @@ -661,7 +661,7 @@ Object.defineProperties(GeoJsonDataSource, { }, }, /** - * Gets or sets the default color of polylines and polygon outlines. + * 获取或设置折线和多边形轮廓的默认颜色。 * @memberof GeoJsonDataSource * @type {Color} * @default Color.BLACK @@ -675,7 +675,7 @@ Object.defineProperties(GeoJsonDataSource, { }, }, /** - * Gets or sets the default width of polylines and polygon outlines. + * 获取或设置折线和多边形轮廓的默认宽度。 * @memberof GeoJsonDataSource * @type {number} * @default 2.0 @@ -689,7 +689,7 @@ Object.defineProperties(GeoJsonDataSource, { }, }, /** - * Gets or sets default color for polygon interiors. + * 获取或设置多边形内部的默认颜色。 * @memberof GeoJsonDataSource * @type {Color} * @default Color.YELLOW @@ -703,7 +703,7 @@ Object.defineProperties(GeoJsonDataSource, { }, }, /** - * Gets or sets default of whether to clamp to the ground. + * 获取或设置是否夹紧地面的默认值。 * @memberof GeoJsonDataSource * @type {boolean} * @default false @@ -718,10 +718,10 @@ Object.defineProperties(GeoJsonDataSource, { }, /** - * Gets an object that maps the name of a crs to a callback function which takes a GeoJSON coordinate - * and transforms it into a WGS84 Earth-fixed Cartesian. Older versions of GeoJSON which - * supported the EPSG type can be added to this list as well, by specifying the complete EPSG name, - * for example 'EPSG:4326'. + *获取一个对象,该对象将 crs 的名称映射到采用 GeoJSON 坐标的回调函数 + *并将其转换为 WGS84 地球固定笛卡尔坐标。 旧版本的 GeoJSON + *支持的 EPSG 类型也可以通过指定完整的 EPSG 名称添加到此列表中, + *例如“EPSG:4326”。 * @memberof GeoJsonDataSource * @type {object} */ @@ -732,11 +732,11 @@ Object.defineProperties(GeoJsonDataSource, { }, /** - * Gets an object that maps the href property of a crs link to a callback function - * which takes the crs properties object and returns a Promise that resolves - * to a function that takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian. - * Items in this object take precedence over those defined in crsLinkHrefs, assuming - * the link has a type specified. + *获取一个对象,该对象将crs链接的href属性映射到回调函数 + *它接受 crs 属性对象并返回一个解析的 Promise + *一个函数,该函数采用 GeoJSON 坐标并将其转换为 WGS84 地球固定笛卡尔坐标。 + *该对象中的项目优先于 crsLinkHrefs 中定义的项目,假设 + *链接已指定类型。 * @memberof GeoJsonDataSource * @type {object} */ @@ -747,10 +747,10 @@ Object.defineProperties(GeoJsonDataSource, { }, /** - * Gets an object that maps the type property of a crs link to a callback function - * which takes the crs properties object and returns a Promise that resolves - * to a function that takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian. - * Items in crsLinkHrefs take precedence over this object. + *获取一个对象,该对象将crs链接的类型属性映射到回调函数 + *它接受 crs 属性对象并返回一个解析的 Promise + *一个函数,该函数采用 GeoJSON 坐标并将其转换为 WGS84 地球固定笛卡尔坐标。 + *crsLinkHrefs 中的项目优先于该对象。 * @memberof GeoJsonDataSource * @type {object} */ @@ -763,7 +763,7 @@ Object.defineProperties(GeoJsonDataSource, { Object.defineProperties(GeoJsonDataSource.prototype, { /** - * Gets or sets a human-readable name for this instance. + * 获取或设置此实例的人类可读名称。 * @memberof GeoJsonDataSource.prototype * @type {string} */ @@ -779,7 +779,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { }, }, /** - * This DataSource only defines static data, therefore this property is always undefined. + * 该数据源仅定义静态数据,因此该属性始终未定义。 * @memberof GeoJsonDataSource.prototype * @type {DataSourceClock} */ @@ -788,7 +788,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { writable: false, }, /** - * Gets the collection of {@link Entity} instances. + * 获取 {@link Entity} 实例的集合。 * @memberof GeoJsonDataSource.prototype * @type {EntityCollection} */ @@ -798,7 +798,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { }, }, /** - * Gets a value indicating if the data source is currently loading data. + * 获取一个值,该值指示数据源当前是否正在加载数据。 * @memberof GeoJsonDataSource.prototype * @type {boolean} */ @@ -808,7 +808,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { }, }, /** - * Gets an event that will be raised when the underlying data changes. + *获取当基础数据更改时将引发的事件。 * @memberof GeoJsonDataSource.prototype * @type {Event} */ @@ -818,7 +818,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { }, }, /** - * Gets an event that will be raised if an error is encountered during processing. + * 获取在处理过程中遇到错误时将引发的事件。 * @memberof GeoJsonDataSource.prototype * @type {Event} */ @@ -828,7 +828,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { }, }, /** - * Gets an event that will be raised when the data source either starts or stops loading. + *获取当数据源开始或停止加载时将引发的事件。 * @memberof GeoJsonDataSource.prototype * @type {Event} */ @@ -838,7 +838,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { }, }, /** - * Gets whether or not this data source should be displayed. + * 获取是否应显示此数据源。 * @memberof GeoJsonDataSource.prototype * @type {boolean} */ @@ -852,7 +852,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { }, /** - * Gets or sets the clustering options for this data source. This object can be shared between multiple data sources. + * 获取或设置此数据源的聚类选项。该对象可以在多个数据源之间共享。 * * @memberof GeoJsonDataSource.prototype * @type {EntityCluster} @@ -871,7 +871,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { }, }, /** - * Gets the credit that will be displayed for the data source + *获取将为数据源显示的信用 * @memberof GeoJsonDataSource.prototype * @type {Credit} */ @@ -883,24 +883,24 @@ Object.defineProperties(GeoJsonDataSource.prototype, { }); /** - * Asynchronously loads the provided GeoJSON or TopoJSON data, replacing any existing data. + * 异步加载提供的 GeoJSON 或 TopoJSON 数据,替换任何现有数据。 * - * @param {Resource|string|object} data A url, GeoJSON object, or TopoJSON object to be loaded. + * @param {Resource|string|object} data 要加载的 url、GeoJSON 对象或 TopoJSON 对象。 * @param {GeoJsonDataSource.LoadOptions} [options] An object specifying configuration options * - * @returns {Promise} a promise that will resolve when the GeoJSON is loaded. + * @returns {Promise} 加载 GeoJSON 时将解决的承诺。 */ GeoJsonDataSource.prototype.load = function (data, options) { return preload(this, data, options, true); }; /** - * Asynchronously loads the provided GeoJSON or TopoJSON data, without replacing any existing data. + * 异步加载提供的 GeoJSON 或 TopoJSON 数据,而不替换任何现有数据。 * - * @param {Resource|string|object} data A url, GeoJSON object, or TopoJSON object to be loaded. - * @param {GeoJsonDataSource.LoadOptions} [options] An object specifying configuration options + *@param {Resource|string|object} data 要加载的 url、GeoJSON 对象或 TopoJSON 对象。 + *@param {GeoJsonDataSource.LoadOptions} [options] 指定配置选项的对象 * - * @returns {Promise} a promise that will resolve when the GeoJSON is loaded. + *@returns {Promise} 一个将在加载 GeoJSON 时解析的承诺。 */ GeoJsonDataSource.prototype.process = function (data, options) { return preload(this, data, options, false); @@ -970,13 +970,13 @@ function preload(that, data, options, clear) { } /** - * Updates the data source to the provided time. This function is optional and - * is not required to be implemented. It is provided for data sources which - * retrieve data based on the current animation time or scene state. - * If implemented, update will be called by {@link DataSourceDisplay} once a frame. + *将数据源更新到提供的时间。 该功能是可选的并且 + *不需要执行。 它是为数据源提供的 + *根据当前动画时间或场景状态检索数据。 + *如果实现,更新将由 {@link DataSourceDisplay} 每帧调用一次。 * - * @param {JulianDate} time The simulation time. - * @returns {boolean} True if this data source is ready to be displayed at the provided time, false otherwise. + * @param {JulianDate} time 模拟时间。 + * @returns {boolean} 如果此数据源已准备好在提供的时间显示,则为 true,否则为 false。 */ GeoJsonDataSource.prototype.update = function (time) { return true; @@ -1056,9 +1056,9 @@ function load(that, geoJson, options, sourceUri, clear) { } /** - * This callback is displayed as part of the GeoJsonDataSource class. + * 此回调显示为 GeoJsonDataSource 类的一部分。 * @callback GeoJsonDataSource.describe - * @param {object} properties The properties of the feature. - * @param {string} nameProperty The property key that Cesium estimates to have the name of the feature. + * @param {object} properties 特征的属性。 + * @param {string} nameProperty Cesium估计具有特征名称的属性键。 */ export default GeoJsonDataSource; -- Gitee