Cesium JS API
AppearanceArcGisMapServerImageryProviderArcGISTiledElevationTerrainProviderArcTypeAssociativeArrayAxisAxisAlignedBoundingBoxbarycentricCoordinatesBillboardBillboardCollectionBillboardGraphicsBillboardVisualizerbinarySearchbinarySearchComparatorBingMapsGeocoderServiceBingMapsImageryProviderBingMapsStyleBlendEquationBlendFunctionBlendingStateBlendOptionBoundingRectangleBoundingSphereBoxEmitterBoxGeometryBoxGeometryUpdaterBoxGraphicsBoxOutlineGeometrybuildModuleUrlCallbackPropertyCameraCameraEventAggregatorCameraEventTypeCartesian2Cartesian3Cartesian4CartographicCartographicGeocoderServiceCatmullRomSplineCesium3DTileCesium3DTileColorBlendModeCesium3DTileContentCesium3DTileFeatureCesium3DTilePointFeatureCesium3DTilesetCesium3DTilesetGraphicsCesium3DTilesetVisualizerCesium3DTileStyleCesium3DTilesVoxelProviderCesiumTerrainProviderCesiumWidgetCheckerboardMaterialPropertyCircleEmitterCircleGeometryCircleOutlineGeometryClassificationPrimitiveClassificationTypeClippingPlaneClippingPlaneCollectionClockClockRangeClockStepcloneCloudCollectionCloudTypeColorColorBlendModeColorGeometryInstanceAttributeColorMaterialPropertycombineComponentDatatypeCompositeEntityCollectionCompositeMaterialPropertyCompositePositionPropertyCompositePropertyCompressedTextureBufferConditionsExpressionConeEmitterConstantPositionPropertyConstantPropertyConstantSplineContextOptionsCoplanarPolygonGeometryCoplanarPolygonOutlineGeometryCornerTypeCorridorGeometryCorridorGeometryUpdaterCorridorGraphicsCorridorOutlineGeometrycreateElevationBandMaterialcreateElevationBandMaterialBandcreateElevationBandMaterialEntrycreateGuidcreateOsmBuildingscreateTangentSpaceDebugPrimitivecreateWorldImagerycreateWorldTerrainCreditCreditDisplayCubicRealPolynomialCullFaceCullingVolumeCumulusCloudCustomDataSourceCustomHeightmapTerrainProviderCustomShaderCustomShaderModeCustomShaderTranslucencyModeCylinderGeometryCylinderGeometryUpdaterCylinderGraphicsCylinderOutlineGeometryCzmlDataSourceDataSourceDataSourceClockDataSourceCollectionDataSourceDisplayDebugAppearanceDebugCameraPrimitiveDebugModelMatrixPrimitiveDefaultProxydefaultValuedefinedDepthFunctiondestroyObjectDeveloperErrorDirectionalLightDirectionUpDiscardEmptyTileImagePolicyDiscardMissingTileImagePolicyDistanceDisplayConditionDistanceDisplayConditionGeometryInstanceAttributeEasingFunctionEllipseGeometryEllipseGeometryUpdaterEllipseGraphicsEllipseOutlineGeometryEllipsoidEllipsoidGeodesicEllipsoidGeometryEllipsoidGeometryUpdaterEllipsoidGraphicsEllipsoidOutlineGeometryEllipsoidRhumbLineEllipsoidSurfaceAppearanceEllipsoidTangentPlaneEllipsoidTerrainProviderEntityEntityClusterEntityCollectionEntityViewEventEventHelperexcludesReverseAxisexportKmlexportKmlModelCallbackexportKmlResultKmlexportKmlResultKmzExpressionExtrapolationTypeFeatureDetectionFogformatErrorFrameRateMonitorFrustumGeometryFrustumOutlineGeometryFullscreenGeocoderServiceGeocodeTypeGeographicProjectionGeographicTilingSchemeGeoJsonDataSourceGeometryGeometryAttributeGeometryAttributesGeometryFactoryGeometryInstanceGeometryInstanceAttributeGeometryPipelineGeometryUpdaterGeometryVisualizergetAbsoluteUrigetBaseUrigetExtensionFromUriGetFeatureInfoFormatgetFilenameFromUrigetImagePixelsgetTimestampGlobeGlobeTranslucencyGoogleEarthEnterpriseImageryProviderGoogleEarthEnterpriseMapsProviderGoogleEarthEnterpriseMetadataGoogleEarthEnterpriseTerrainDataGoogleEarthEnterpriseTerrainProviderGpxDataSourceGregorianDateGridImageryProviderGridMaterialPropertyGroundGeometryUpdaterGroundPolylineGeometryGroundPolylinePrimitiveGroundPrimitiveHeadingPitchRangeHeadingPitchRollHeadingPitchRollValuesHeightmapEncodingHeightmapTerrainDataHeightReferenceHermitePolynomialApproximationHermiteSplineHilbertOrderHorizontalOriginI3SDataProviderI3SFeatureI3SFieldI3SGeometryI3SLayerI3SNodeImageBasedLightingImageMaterialPropertyImageryLayerImageryLayerCollectionImageryLayerFeatureInfoImageryProviderImageryTypesincludesReverseAxisIndexDatatypeIntersectIntersections2DIntersectionTestsIntervalIonIonGeocoderServiceIonImageryProviderIonResourceIonWorldImageryStyleisLeapYearIso8601JulianDateKeyboardEventModifierKmlCameraKmlDataSourceKmlFeatureDataKmlLookAtKmlTourKmlTourFlyToKmlTourWaitLabelLabelCollectionLabelGraphicsLabelStyleLabelVisualizerLagrangePolynomialApproximationLeapSecondLightLightingModelLinearApproximationLinearSplineMapboxImageryProviderMapboxStyleImageryProviderMapMode2DMapProjectionMaterialMaterialAppearanceMaterialSupportMaterialPropertyMathMatrix2Matrix3Matrix4mergeSortmergeSortComparatorMetadataClassMetadataClassPropertyMetadataComponentTypeMetadataEnumMetadataEnumValueMetadataSchemaMetadataTypeModelModelAnimationModelAnimationCollectionModelAnimationLoopModelFeatureModelGraphicsModelNodeModelVisualizerMoonMorphWeightSplineNearFarScalarNeverTileDiscardPolicyNodeTransformationPropertyobjectToQueryOccluderOpenCageGeocoderServiceOpenStreetMapImageryProviderOrientedBoundingBoxOrthographicFrustumOrthographicOffCenterFrustumPackableForInterpolationParticleParticleBurstParticleEmitterParticleSystemPathGraphicsPathVisualizerPeliasGeocoderServicePerInstanceColorAppearancePerspectiveFrustumPerspectiveOffCenterFrustumPinBuilderPixelDatatypePixelFormatPlanePlaneGeometryPlaneGeometryUpdaterPlaneGraphicsPlaneOutlineGeometryPointCloudShadingPointGraphicspointInsideTrianglePointPrimitivePointPrimitiveCollectionPointVisualizerPolygonGeometryPolygonGeometryUpdaterPolygonGraphicsPolygonHierarchyPolygonOutlineGeometryPolylinePolylineArrowMaterialPropertyPolylineCollectionPolylineColorAppearancePolylineDashMaterialPropertyPolylineGeometryPolylineGeometryUpdaterPolylineGlowMaterialPropertyPolylineGraphicsPolylineMaterialAppearancePolylineOutlineMaterialPropertyPolylineVisualizerPolylineVolumeGeometryPolylineVolumeGeometryUpdaterPolylineVolumeGraphicsPolylineVolumeOutlineGeometryPositionPropertyPositionPropertyArrayPostProcessStagePostProcessStageCollectionPostProcessStageCompositePostProcessStageLibraryPostProcessStageSampleModePrimitivePrimitiveCollectionPrimitiveTypePropertyPropertyArrayPropertyBagProxyQuadraticRealPolynomialQuantizedMeshTerrainDataQuarticRealPolynomialQuaternionQuaternionSplinequeryToObjectQueueRayreadyPromiseRectangleRectangleGeometryRectangleGeometryUpdaterRectangleGraphicsRectangleOutlineGeometryReferenceFrameReferencePropertyremoveExtensionRequestRequestErrorEventRequestSchedulerRequestStateRequestTypeResourceRuntimeErrorSampledPositionPropertySampledPropertysampleTerrainsampleTerrainMostDetailedSceneSceneModeSceneTransformsScreenSpaceCameraControllerScreenSpaceEventHandlerScreenSpaceEventTypeshaderDefinesshaderMaximumIntersectionsLengthshaderUniformsShadowMapShadowModeShowGeometryInstanceAttributeSimon1994PlanetaryPositionsSimplePolylineGeometrySingleTileImageryProviderSkyAtmosphereSkyBoxSphereEmitterSphereGeometrySphereOutlineGeometrySphericalSplineSplitDirectionStencilFunctionStencilOperationSteppedSplineStripeMaterialPropertyStripeOrientationStyleExpressionsubdivideArraySunSunLightTaskProcessorTerrainDataTerrainProviderTextureMagnificationFilterTextureMinificationFilterTextureUniformTileAvailabilityTileCoordinatesImageryProviderTileDiscardPolicyTileMapServiceImageryProviderTileProviderErrorTilingSchemeTimeDynamicImageryTimeDynamicPointCloudTimeIntervalTimeIntervalCollectionTimeIntervalCollectionPositionPropertyTimeIntervalCollectionPropertyTimeStandardTransformsTranslationRotationScaleTridiagonalSystemSolverTrustedServersUniformSpecifierUniformTypeUrlTemplateImageryProviderVaryingTypeVelocityOrientationPropertyVelocityVectorPropertyVertexFormatVerticalOriginVideoSynchronizerViewportQuadVisibilityVisualizerVoxelPrimitiveVoxelProviderVoxelShapeTypeVRTheWorldTerrainProviderWallGeometryWallGeometryUpdaterWallGraphicsWallOutlineGeometryWebGLConstantsWebGLOptionsWebMapServiceImageryProviderWebMapTileServiceImageryProviderWebMercatorProjectionWebMercatorTilingSchemeWindingOrderwriteTextToCanvasAnimationAnimationViewModelBaseLayerPickerBaseLayerPickerViewModelCesium3DTilesInspectorCesium3DTilesInspectorViewModelCesiumInspectorCesiumInspectorViewModelClockViewModelCommandcreateCommandFullscreenButtonFullscreenButtonViewModelGeocoderGeocoderViewModelHomeButtonHomeButtonViewModelInfoBoxInfoBoxViewModelNavigationHelpButtonNavigationHelpButtonViewModelPerformanceWatchdogPerformanceWatchdogViewModelProjectionPickerProjectionPickerViewModelProviderViewModelSceneModePickerSceneModePickerViewModelSelectionIndicatorSelectionIndicatorViewModelSvgPathBindingHandlerTimelineToggleButtonViewModelViewerviewerCesium3DTilesInspectorMixinviewerCesiumInspectorMixinviewerDragDropMixinviewerPerformanceWatchdogMixinviewerVoxelInspectorMixinVoxelInspectorVoxelInspectorViewModelVRButtonVRButtonViewModel

ExtrapolationType

ExtrapolationType 枚举类型指定用于超出时间戳区间的位置执行外推的策略。

此类型定义了以下枚举值:

  • NONE:不执行外推。
  • HOLD:在超出第一个时间戳之前保持位置,超出最后一个时间戳之后保持最后位置。
  • EXTRAPOLATE:基于最近两个时间戳之间的位置和速度进行外推。

NONE

当使用 NONE 时,位置不会超出提供的时间戳边界。这是默认值。

HOLD

当使用 HOLD 时,位置将保持在第一个时间戳之前和最后一个时间戳之后提供的位置。在提供的时间戳范围内,位置将根据提供的位置和时间戳计算。

EXTRAPOLATE

当使用 EXTRAPOLATE 时,位置将在第一个和最后一个时间戳之间外推。在提供的时间戳范围内,位置将根据提供的位置和时间戳计算。外推依赖于最近两个时间戳之间的位置和速度,并且应只用于预测准确性高的场景。

const now = Cesium.JulianDate.now();
const positions = [
  new Cesium.SampledPositionProperty(),
  new Cesium.SampledPositionProperty(),
  new Cesium.SampledPositionProperty()
];

positions[0].addSample(
  now,
  Cesium.Cartesian3.fromDegrees(0.0, 0.0, 0.0)
);
positions[0].addSample(
  Cesium.JulianDate.addSeconds(now, 300.0, new Cesium.JulianDate()),
  Cesium.Cartesian3.fromDegrees(1.0, 0.0, 0.0)
);

positions[0].setInterpolationOptions({
  interpolationDegree: 3,
  interpolationAlgorithm: Cesium.HermitePolynomialApproximation
});

positions[1].addSample(
  now,
  Cesium.Cartesian3.fromDegrees(0.0, 0.0, 0.0)
);
positions[1].addSample(
  Cesium.JulianDate.addSeconds(now, 300.0, new Cesium.JulianDate()),
  Cesium.Cartesian3.fromDegrees(1.0, 0.0, 0.0)
);

positions[1].setInterpolationOptions({
  interpolationDegree: 3,
  interpolationAlgorithm: Cesium.LagrangePolynomialApproximation
});

positions[2].addSample(
  now,
  Cesium.Cartesian3.fromDegrees(0.0, 0.0, 0.0)
);
positions[2].addSample(
  Cesium.JulianDate.addSeconds(now, 300.0, new Cesium.JulianDate()),
  Cesium.Cartesian3.fromDegrees(1.0, 0.0, 0.0)
);

positions[2].setInterpolationOptions({
  interpolationDegree: 3,
  interpolationAlgorithm: Cesium.LinearApproximation
});

viewer.entities.add({
  position: positions[0],
  point: {
    color: Cesium.Color.RED,
    pixelSize: 10
  },
  path: {
    resolution: 1,
    material: Cesium.Color.YELLOW,
    width: 2
  }
});

viewer.entities.add({
  position: positions[1],
  point: {
    color: Cesium.Color.BLUE,
    pixelSize: 10
  },
  path: {
    resolution: 1,
    material: Cesium.Color.GREEN,
    width: 2
  },
  id: "holdPosition",
  interpolationAlgorithm: Cesium.LagrangePolynomialApproximation,
  interpolationDegree: 5,
  availability: new Cesium.TimeIntervalCollection([
    new Cesium.TimeInterval({
      start: positions[0].getStartExtrapolation(Cesium.ExtrapolationType.HOLD),
      stop: positions[0].getStopExtrapolation(Cesium.ExtrapolationType.HOLD)
    })
  ])
});

viewer.entities.add({
  position: positions[2],
  point: {
    color: Cesium.Color.ORANGE,
    pixelSize: 10
  },
  path: {
    resolution: 1,
    material: Cesium.Color.PURPLE,
    width: 2
  },
  id: "extrapolatedPosition",
  interpolationAlgorithm: Cesium.CentralBodySurfaceAppearance,
  interpolationDegree: 5,
  availability: new Cesium.TimeIntervalCollection([
    new Cesium.TimeInterval({
      start: positions[0].getStartExtrapolation(Cesium.ExtrapolationType.EXTRAPOLATE),
      stop: positions[0].getStopExtrapolation(Cesium.ExtrapolationType.EXTRAPOLATE)
    })
  ])
});

setTimeout(() => {
  viewer.entities.getById("holdPosition").position.setInterpolationOptions({
    interpolationDegree: 5,
    interpolationAlgorithm: Cesium.CentralBodySurfaceAppearance
  });
}, 10000);

setTimeout(() => {
  viewer.entities.getById("extrapolatedPosition").position.setInterpolationOptions({
    interpolationDegree: 5,
    interpolationAlgorithm: Cesium.HermitePolynomialApproximation
  });
}, 20000);

注释:此示例将三个位置属性添加到实体中,使用不同的插值算法和插值度数。第一条路径显示在黄色,路径是由 Hermite 多项式的三次多项式分段拟合。第二条路径被定义为由 Lagrange 多项式的五次多项式分段拟合的一个实体。为了显示 HOLD 外推类型,在第一个时间戳之前和最后一个时间戳之后保持此位置的蓝点和路径已添加到实体中。第三个位置属性的路径使用线性插值及其值为橙色。在路径的末尾,尝试外推,结果不是很好。为了改善此路径,setTimeout() 函数改变曲线的 interpolationDegrees 并乘以不同的 interpolationAlgorithms。