Cesium JS API
AppearanceArcGisMapServerImageryProviderArcGISTiledElevationTerrainProviderArcTypeAssociativeArrayAxisAxisAlignedBoundingBoxbarycentricCoordinatesBillboardBillboardCollectionBillboardGraphicsBillboardVisualizerbinarySearchbinarySearchComparatorBingMapsGeocoderServiceBingMapsImageryProviderBingMapsStyleBlendEquationBlendFunctionBlendingStateBlendOptionBoundingRectangleBoundingSphereBoxEmitterBoxGeometryBoxGeometryUpdaterBoxGraphicsBoxOutlineGeometrybuildModuleUrlCallbackPropertyCameraCameraEventAggregatorCameraEventTypeCartesian2Cartesian3Cartesian4CartographicCartographicGeocoderServiceCatmullRomSplineCesium3DTileCesium3DTileColorBlendModeCesium3DTileContentCesium3DTileFeatureCesium3DTilePointFeatureCesium3DTilesetCesium3DTilesetGraphicsCesium3DTilesetVisualizerCesium3DTileStyleCesium3DTilesVoxelProviderCesiumTerrainProviderCesiumWidgetCheckerboardMaterialPropertyCircleEmitterCircleGeometryCircleOutlineGeometryClassificationPrimitiveClassificationTypeClippingPlaneClippingPlaneCollectionClockClockRangeClockStepcloneCloudCollectionCloudTypeColorColorBlendModeColorGeometryInstanceAttributeColorMaterialPropertycombineComponentDatatypeCompositeEntityCollectionCompositeMaterialPropertyCompositePositionPropertyCompositePropertyCompressedTextureBufferConditionsExpressionConeEmitterConstantPositionPropertyConstantPropertyConstantSplineContextOptionsCoplanarPolygonGeometryCoplanarPolygonOutlineGeometryCornerTypeCorridorGeometryCorridorGeometryUpdaterCorridorGraphicsCorridorOutlineGeometrycreateElevationBandMaterialcreateElevationBandMaterialBandcreateElevationBandMaterialEntrycreateGuidcreateOsmBuildingscreateTangentSpaceDebugPrimitivecreateWorldImagerycreateWorldTerrainCreditCreditDisplayCubicRealPolynomialCullFaceCullingVolumeCumulusCloudCustomDataSourceCustomHeightmapTerrainProviderCustomShaderCustomShaderModeCustomShaderTranslucencyModeCylinderGeometryCylinderGeometryUpdaterCylinderGraphicsCylinderOutlineGeometryCzmlDataSourceDataSourceDataSourceClockDataSourceCollectionDataSourceDisplayDebugAppearanceDebugCameraPrimitiveDebugModelMatrixPrimitiveDefaultProxydefaultValuedefinedDepthFunctiondestroyObjectDeveloperErrorDirectionalLightDirectionUpDiscardEmptyTileImagePolicyDiscardMissingTileImagePolicyDistanceDisplayConditionDistanceDisplayConditionGeometryInstanceAttributeEasingFunctionEllipseGeometryEllipseGeometryUpdaterEllipseGraphicsEllipseOutlineGeometryEllipsoidEllipsoidGeodesicEllipsoidGeometryEllipsoidGeometryUpdaterEllipsoidGraphicsEllipsoidOutlineGeometryEllipsoidRhumbLineEllipsoidSurfaceAppearanceEllipsoidTangentPlaneEllipsoidTerrainProviderEntityEntityClusterEntityCollectionEntityViewEventEventHelperexcludesReverseAxisexportKmlexportKmlModelCallbackexportKmlResultKmlexportKmlResultKmzExpressionExtrapolationTypeFeatureDetectionFogformatErrorFrameRateMonitorFrustumGeometryFrustumOutlineGeometryFullscreenGeocoderServiceGeocodeTypeGeographicProjectionGeographicTilingSchemeGeoJsonDataSourceGeometryGeometryAttributeGeometryAttributesGeometryFactoryGeometryInstanceGeometryInstanceAttributeGeometryPipelineGeometryUpdaterGeometryVisualizergetAbsoluteUrigetBaseUrigetExtensionFromUriGetFeatureInfoFormatgetFilenameFromUrigetImagePixelsgetTimestampGlobeGlobeTranslucencyGoogleEarthEnterpriseImageryProviderGoogleEarthEnterpriseMapsProviderGoogleEarthEnterpriseMetadataGoogleEarthEnterpriseTerrainDataGoogleEarthEnterpriseTerrainProviderGpxDataSourceGregorianDateGridImageryProviderGridMaterialPropertyGroundGeometryUpdaterGroundPolylineGeometryGroundPolylinePrimitiveGroundPrimitiveHeadingPitchRangeHeadingPitchRollHeadingPitchRollValuesHeightmapEncodingHeightmapTerrainDataHeightReferenceHermitePolynomialApproximationHermiteSplineHilbertOrderHorizontalOriginI3SDataProviderI3SFeatureI3SFieldI3SGeometryI3SLayerI3SNodeImageBasedLightingImageMaterialPropertyImageryLayerImageryLayerCollectionImageryLayerFeatureInfoImageryProviderImageryTypesincludesReverseAxisIndexDatatypeIntersectIntersections2DIntersectionTestsIntervalIonIonGeocoderServiceIonImageryProviderIonResourceIonWorldImageryStyleisLeapYearIso8601JulianDateKeyboardEventModifierKmlCameraKmlDataSourceKmlFeatureDataKmlLookAtKmlTourKmlTourFlyToKmlTourWaitLabelLabelCollectionLabelGraphicsLabelStyleLabelVisualizerLagrangePolynomialApproximationLeapSecondLightLightingModelLinearApproximationLinearSplineMapboxImageryProviderMapboxStyleImageryProviderMapMode2DMapProjectionMaterialMaterialAppearanceMaterialSupportMaterialPropertyMathMatrix2Matrix3Matrix4mergeSortmergeSortComparatorMetadataClassMetadataClassPropertyMetadataComponentTypeMetadataEnumMetadataEnumValueMetadataSchemaMetadataTypeModelModelAnimationModelAnimationCollectionModelAnimationLoopModelFeatureModelGraphicsModelNodeModelVisualizerMoonMorphWeightSplineNearFarScalarNeverTileDiscardPolicyNodeTransformationPropertyobjectToQueryOccluderOpenCageGeocoderServiceOpenStreetMapImageryProviderOrientedBoundingBoxOrthographicFrustumOrthographicOffCenterFrustumPackableForInterpolationParticleParticleBurstParticleEmitterParticleSystemPathGraphicsPathVisualizerPeliasGeocoderServicePerInstanceColorAppearancePerspectiveFrustumPerspectiveOffCenterFrustumPinBuilderPixelDatatypePixelFormatPlanePlaneGeometryPlaneGeometryUpdaterPlaneGraphicsPlaneOutlineGeometryPointCloudShadingPointGraphicspointInsideTrianglePointPrimitivePointPrimitiveCollectionPointVisualizerPolygonGeometryPolygonGeometryUpdaterPolygonGraphicsPolygonHierarchyPolygonOutlineGeometryPolylinePolylineArrowMaterialPropertyPolylineCollectionPolylineColorAppearancePolylineDashMaterialPropertyPolylineGeometryPolylineGeometryUpdaterPolylineGlowMaterialPropertyPolylineGraphicsPolylineMaterialAppearancePolylineOutlineMaterialPropertyPolylineVisualizerPolylineVolumeGeometryPolylineVolumeGeometryUpdaterPolylineVolumeGraphicsPolylineVolumeOutlineGeometryPositionPropertyPositionPropertyArrayPostProcessStagePostProcessStageCollectionPostProcessStageCompositePostProcessStageLibraryPostProcessStageSampleModePrimitivePrimitiveCollectionPrimitiveTypePropertyPropertyArrayPropertyBagProxyQuadraticRealPolynomialQuantizedMeshTerrainDataQuarticRealPolynomialQuaternionQuaternionSplinequeryToObjectQueueRayreadyPromiseRectangleRectangleGeometryRectangleGeometryUpdaterRectangleGraphicsRectangleOutlineGeometryReferenceFrameReferencePropertyremoveExtensionRequestRequestErrorEventRequestSchedulerRequestStateRequestTypeResourceRuntimeErrorSampledPositionPropertySampledPropertysampleTerrainsampleTerrainMostDetailedSceneSceneModeSceneTransformsScreenSpaceCameraControllerScreenSpaceEventHandlerScreenSpaceEventTypeshaderDefinesshaderMaximumIntersectionsLengthshaderUniformsShadowMapShadowModeShowGeometryInstanceAttributeSimon1994PlanetaryPositionsSimplePolylineGeometrySingleTileImageryProviderSkyAtmosphereSkyBoxSphereEmitterSphereGeometrySphereOutlineGeometrySphericalSplineSplitDirectionStencilFunctionStencilOperationSteppedSplineStripeMaterialPropertyStripeOrientationStyleExpressionsubdivideArraySunSunLightTaskProcessorTerrainDataTerrainProviderTextureMagnificationFilterTextureMinificationFilterTextureUniformTileAvailabilityTileCoordinatesImageryProviderTileDiscardPolicyTileMapServiceImageryProviderTileProviderErrorTilingSchemeTimeDynamicImageryTimeDynamicPointCloudTimeIntervalTimeIntervalCollectionTimeIntervalCollectionPositionPropertyTimeIntervalCollectionPropertyTimeStandardTransformsTranslationRotationScaleTridiagonalSystemSolverTrustedServersUniformSpecifierUniformTypeUrlTemplateImageryProviderVaryingTypeVelocityOrientationPropertyVelocityVectorPropertyVertexFormatVerticalOriginVideoSynchronizerViewportQuadVisibilityVisualizerVoxelPrimitiveVoxelProviderVoxelShapeTypeVRTheWorldTerrainProviderWallGeometryWallGeometryUpdaterWallGraphicsWallOutlineGeometryWebGLConstantsWebGLOptionsWebMapServiceImageryProviderWebMapTileServiceImageryProviderWebMercatorProjectionWebMercatorTilingSchemeWindingOrderwriteTextToCanvasAnimationAnimationViewModelBaseLayerPickerBaseLayerPickerViewModelCesium3DTilesInspectorCesium3DTilesInspectorViewModelCesiumInspectorCesiumInspectorViewModelClockViewModelCommandcreateCommandFullscreenButtonFullscreenButtonViewModelGeocoderGeocoderViewModelHomeButtonHomeButtonViewModelInfoBoxInfoBoxViewModelNavigationHelpButtonNavigationHelpButtonViewModelPerformanceWatchdogPerformanceWatchdogViewModelProjectionPickerProjectionPickerViewModelProviderViewModelSceneModePickerSceneModePickerViewModelSelectionIndicatorSelectionIndicatorViewModelSvgPathBindingHandlerTimelineToggleButtonViewModelViewerviewerCesium3DTilesInspectorMixinviewerCesiumInspectorMixinviewerDragDropMixinviewerPerformanceWatchdogMixinviewerVoxelInspectorMixinVoxelInspectorVoxelInspectorViewModelVRButtonVRButtonViewModel

TimeDynamicPointCloud

TimeDynamicPointCloud是一个用于在Cesium JS中显示动态点云数据的库。它允许您按时间顺序显示3D点云数据,并支持交互式数据浏览,例如通过时间滑块、点云过滤和点云聚类。

特点

  • 显示具有时间信息的点云数据。
  • 支持在时间轴上通过时间滑块交互式浏览数据。
  • 可以在点云上应用过滤器,以选择要显示的点云数据。
  • 可以将点云分组成簇。

使用方法

以下是使用TimeDynamicPointCloud库的步骤。

安装

要使用TimeDynamicPointCloud库,请首先将其添加到您的Cesium项目中。在HTML文件中添加以下代码:

<script src="https://cesium.com/downloads/cesiumjs/releases/1.80/Build/Cesium/Cesium.js"></script>
<script src="path/to/TimeDynamicPointCloud.js"></script>

创建点云数据

要使用TimeDynamicPointCloud,您需要创建与点云数据对应的PointCloud对象。点云数据应该是TimeSeries对象的数组,每个TimeSeries对象都应该包含一组点和一个时间戳。

例如,以下代码创建了两个TimeSeries对象,每个对象都包含一组随机的3D点坐标和一个时间戳:

var series1 = new Cesium.TimeDynamicPointCloud.TimeSeries({
    positions: Cesium.TimeDynamicPointCloud.PointData.generateRandomPositions(1000),
    timestamp: Cesium.JulianDate.fromDate(new Date('2021-01-01'))
});

var series2 = new Cesium.TimeDynamicPointCloud.TimeSeries({
    positions: Cesium.TimeDynamicPointCloud.PointData.generateRandomPositions(1000),
    timestamp: Cesium.JulianDate.fromDate(new Date('2021-01-02'))
});

创建TimeDynamicPointCloud

一旦有了点云数据,就可以使用TimeDynamicPointCloud来显示它。要创建TimeDynamicPointCloud,请使用以下代码:

var viewer = new Cesium.Viewer('cesiumContainer');

var pointCloud = new Cesium.TimeDynamicPointCloud(viewer.scene);

pointCloud.add(series1);
pointCloud.add(series2);

创建了TimeDynamicPointCloud后,您可以使用add()方法将每个TimeSeries对象添加到点云中。

设置时间轴和时间滑块

您可以使用Cesium JS提供的Timeline小部件和Animation小部件来设置时间轴和时间滑块。例如,以下代码创建了一个包含时间轴和时间滑块的基本控制面板:

var toolbar = document.getElementById('toolbar');

var timeline = new Cesium.Timeline(toolbar, viewer.clock);
var animation = new Cesium.Animation(toolbar, viewer);

应用点云过滤器和聚类

TimeDynamicPointCloud支持过滤器和聚类功能,以便在点云数据中选择子集。例如,以下代码创建了一个基于高度的过滤器,以隐藏低于海拔500米的点:

var heightFilter = function(point) {
    var position = Cesium.Cartographic.fromCartesian(point.position);
    return position.height > 500.0;
}

pointCloud.setPointFilter(heightFilter);

以下代码创建了一个将点云分组成簇的聚类器:

var clustering = new Cesium.TimeDynamicPointCloud.Clustering({
    enabled: true,
    pixelRange: 100,
    minimumClusterSize: 5
});

pointCloud.setClustering(clustering);

完整示例

以下是显示点云数据的完整示例代码:

var viewer = new Cesium.Viewer('cesiumContainer');

var series1 = new Cesium.TimeDynamicPointCloud.TimeSeries({
    positions: Cesium.TimeDynamicPointCloud.PointData.generateRandomPositions(1000),
    timestamp: Cesium.JulianDate.fromDate(new Date('2021-01-01'))
});

var series2 = new Cesium.TimeDynamicPointCloud.TimeSeries({
    positions: Cesium.TimeDynamicPointCloud.PointData.generateRandomPositions(1000),
    timestamp: Cesium.JulianDate.fromDate(new Date('2021-01-02'))
});

var toolbar = document.getElementById('toolbar');

var timeline = new Cesium.Timeline(toolbar, viewer.clock);
var animation = new Cesium.Animation(toolbar, viewer);

var pointCloud = new Cesium.TimeDynamicPointCloud(viewer.scene);

pointCloud.add(series1);
pointCloud.add(series2);

var heightFilter = function(point) {
    var position = Cesium.Cartographic.fromCartesian(point.position);
    return position.height > 500.0;
}

pointCloud.setPointFilter(heightFilter);

var clustering = new Cesium.TimeDynamicPointCloud.Clustering({
    enabled: true,
    pixelRange: 100,
    minimumClusterSize: 5
});

pointCloud.setClustering(clustering);

viewer.zoomTo(pointCloud);

viewer.scene.postUpdate.addEventListener(function() {
    pointCloud.update(viewer.clock.currentTime);
});

API参考

以下是TimeDynamicPointCloud库中的主要类。

TimeDynamicPointCloud

表示一个动态点云对象。

构造函数

new TimeDynamicPointCloud(scene : Scene)
  • scene :需要添加动态点云的场景对象。

方法

add(series : TimeSeries) : void
  • series :要添加的TimeSeries对象。

将一个TimeSeries对象添加到该点云中。

clear() : void

从该点云中删除所有点和TimeSeries。

remove(series : TimeSeries) : void
  • series:要从点云中删除的TimeSeries对象。

从该点云中删除给定的TimeSeries。

setClustering(clustering : Clustering) : void
  • clustering:要应用于点云的聚类器对象。

启用点云聚类,并将给定的Clustering对象应用于该点云。

setPointFilter(filter : function) : void
  • filter:用于过滤点的函数。

启用点云过滤器,并将给定的函数应用于点云的每个点。

update(time : JulianDate) : void
  • time:应该在点云中显示哪个时间戳。

更新该点云以显示给定时间的数据。

TimeSeries

表示一组点及其对应的时间戳。

构造函数

new TimeSeries(options : Object)
  • options:TimeSeries的选项对象。

选项

positions : Cartesian3[]

该TimeSeries的每个点的笛卡尔坐标数组。

timestamp : JulianDate

该TimeSeries的时间戳。

Clustering

表示一个点云的聚类器。

构造函数

new Clustering(options : Object)
  • options:聚类器的选项对象。

选项

enabled : Boolean

指示聚类是否处于启用状态。

pixelRange : Number

聚类像素范围。

minimumClusterSize : Number

最小聚类大小。

参考