### Start development server Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-webpack Launch the application using the configured start script. ```bash npm start ``` -------------------------------- ### Install webpack-dev-server Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-webpack Install the development server dependency. ```bash npm install --save-dev webpack-dev-server ``` -------------------------------- ### CustomPatternSensor Examples Source: https://cesium.com/learn/ion-sdk/ref-doc/CustomPatternSensor.html Illustrative examples of how to create and configure a CustomPatternSensor. ```APIDOC ## Examples ### Example 1. Sensor on the ground pointing straight up ```javascript // Example 1. Sensor on the ground pointing straight up var sensor = scene.primitives.add(new IonSdkSensors.CustomPatternSensor({ modelMatrix : Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706)), radius : 1000000.0, directions : [{ clock : Cesium.Math.toRadians(0.0), cone : Cesium.Math.toRadians(30.0) }, { clock : Cesium.Math.toRadians(90.0), cone : Cesium.Math.toRadians(30.0) }, { clock : Cesium.Math.toRadians(180.0), cone : Cesium.Math.toRadians(30.0) }] })); ``` ### Example 2. Star-pattern sensor pointing straight down with its lateral surface intersecting the ellipsoid. ```javascript // Example 2. Star-pattern sensor pointing straight down with its lateral surface intersecting the ellipsoid. var sensor = scene.primitives.add(new IonSdkSensors.CustomPatternSensor({ modelMatrix : Cesium.Transforms.northEastDownToFixedFrame(Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 700000.0)), radius : 1000000.0, directions : [{ clock : Cesium.Math.toRadians(0.0), cone : Cesium.Math.toRadians(40.0) }, { clock : Cesium.Math.toRadians(45.0), cone : Cesium.Math.toRadians(20.0) }, { clock : Cesium.Math.toRadians(90.0), cone : Cesium.Math.toRadians(40.0) }, { clock : Cesium.Math.toRadians(135.0), cone : Cesium.Math.toRadians(20.0) }, { clock : Cesium.Math.toRadians(180.0), cone : Cesium.Math.toRadians(40.0) }, { clock : Cesium.Math.toRadians(225.0), cone : Cesium.Math.toRadians(20.0) }, { clock : Cesium.Math.toRadians(270.0), cone : Cesium.Math.toRadians(40.0) }, { clock : Cesium.Math.toRadians(315.0), cone : Cesium.Math.toRadians(20.0) }], })); ``` ### Example 3. Sensor pointing straight down with its dome intersecting the ellipsoid ```javascript // Example 3. Sensor pointing straight down with its dome intersecting the ellipsoid var sensor = scene.primitives.add(new IonSdkSensors.CustomPatternSensor({ modelMatrix : Cesium.Transforms.northEastDownToFixedFrame(Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 900000.0)), radius : 1000000.0, directions : [{ clock : Cesium.Math.toRadians(270.0), cone : Cesium.Math.toRadians(30.0) }, { clock : Cesium.Math.toRadians(0.0), cone : Cesium.Math.toRadians(30.0) }, { clock : Cesium.Math.toRadians(90.0), cone : Cesium.Math.toRadians(30.0) }], lateralSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.StripeType), intersectionColor : Cesium.Color.YELLOW })); ``` ### Example 4. Sensor with custom materials for each surface. Switch to 2D to see the ellipsoid surface material. ```javascript // Example 4. Sensor with custom materials for each surface. Switch to 2D to see the ellipsoid surface material. var sensor = scene.primitives.add(new IonSdkSensors.CustomPatternSensor({ modelMatrix : Cesium.Transforms.northEastDownToFixedFrame(Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 9000000.0)), radius : 20000000.0, directions : [{ clock : Cesium.Math.toRadians(270.0), cone : Cesium.Math.toRadians(30.0) }, { clock : Cesium.Math.toRadians(0.0), cone : Cesium.Math.toRadians(30.0) }, { clock : Cesium.Math.toRadians(90.0), cone : Cesium.Math.toRadians(30.0) }], lateralSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.ColorType, { color : new Cesium.Color(1.0, 0.0, 0.0, 0.5) }), ellipsoidHorizonSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.ColorType, { color : new Cesium.Color(0.0, 1.0, 0.0, 0.5) }), ellipsoidSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.ColorType, { color : new Cesium.Color(0.0, 0.0, 1.0, 0.5) }), domeSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.ColorType, { color : new Cesium.Color(1.0, 1.0, 1.0, 0.5) }) })); ``` ``` -------------------------------- ### Webpack build output example Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-webpack Example output generated by the Webpack build process. ```text npm run build > test-app@1.0.0 build C:\workspace\test-app > node_modules/.bin/webpack --config webpack.config.js Hash: 2b42bff7a022b5d956a9 Version: webpack 3.6.0 Time: 2002ms Asset Size Chunks Chunk Names Assets/Textures/NaturalEarthII/2/0/3.jpg 10.3 kB [emitted] app.js 162 kB 0 [emitted] app ``` -------------------------------- ### Install html-webpack-plugin Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-webpack Install the plugin required to inject the bundle into index.html. ```bash npm install --save-dev html-webpack-plugin ``` -------------------------------- ### GET /asset Source: https://cesium.com/learn/cesium-native/ref-doc/classCesiumAsync_1_1CesiumIonAssetAccessor.html Starts an asynchronous GET request for an asset. ```APIDOC ## GET (get) ### Description Starts a new request for the asset with the given URL. The request proceeds asynchronously without blocking the calling thread. ### Method GET ### Parameters #### Path Parameters - **asyncSystem** (AsyncSystem) - Required - The async system used to do work in threads. - **url** (string) - Required - The URL of the asset. - **headers** (vector) - Optional - The headers to include in the request. ### Response - **Future>** - The in-progress asset request. ``` -------------------------------- ### Clone and Initialize the Starter App Source: https://cesium.com/learn/itwin/itwin-add-design-context Commands to set up the local development environment for the iTwin-Cesium integration. ```bash git clone https://github.com/iTwin/itwin-cesium-tutorial-app.git cd itwin-cesium-tutorial-app ``` ```bash npm install ``` ```bash VITE_ION_TOKEN="your_access_token" ``` ```bash npm run dev ``` -------------------------------- ### Install and Run Cesium Server Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-google-earth-api/cesiumjs-google-earth-api-part-i Install Node.js dependencies and start the local development server for Cesium. This is required to run Cesium applications locally. ```bash npm install node server.js ``` -------------------------------- ### Initialize App with npm Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-webpack Run this command in your project directory to initialize a new Node.js project and create a package.json file. ```bash npm init ``` -------------------------------- ### Get Accessor Stride Source: https://cesium.com/learn/cesium-native/ref-doc/classCesiumGltf_1_1AccessorView.html Returns the stride of this accessor, which is the number of bytes from the start of one element to the start of the next. This is crucial for correctly interpreting the raw data. ```cpp int64_t stride() const noexcept ``` -------------------------------- ### Get archive info response sample Source: https://cesium.com/learn/ion/rest-api Example response showing the metadata and status of an existing archive. ```json { "id": 10, "assetId": 3812, "format": "ZIP", "status": "COMPLETE", "bytesArchived": 1024 } ``` -------------------------------- ### Start Method Source: https://cesium.com/learn/cesium-unity/ref-doc/Cesium3DTileset_8cs_source.html Called when the script instance is being loaded. This is a private partial method. ```csharp private partial void Start(); ``` -------------------------------- ### Initialize and manage points in BufferPointCollection Source: https://cesium.com/learn/cesiumjs/ref-doc/BufferPointCollection.html Demonstrates creating a collection with a fixed capacity, adding a point, and iterating through the collection to update point materials. ```javascript const collection = new BufferPointCollection({primitiveCountMax: 1024}); const point = new BufferPoint(); const material = new BufferPointMaterial({color: Color.WHITE}); // Create a new point, temporarily bound to 'point' local variable. collection.add({ position: new Cartesian3(0.0, 0.0, 0.0), material }, point); // Iterate over all points in collection, temporarily binding 'point' // local variable to each, and updating point material. for (let i = 0; i < collection.primitiveCount; i++) { collection.get(i, point); point.setMaterial(material); } ``` -------------------------------- ### get() - Asset Retrieval Source: https://cesium.com/learn/cesium-native/ref-doc/classCesiumCurl_1_1CurlAssetAccessor.html Starts an asynchronous request to retrieve an asset from a given URL with specified headers. ```APIDOC ## get() ### Description Starts a new request for the asset with the given URL. The request proceeds asynchronously without blocking the calling thread. ### Method GET ### Endpoint (Not specified, typically derived from URL parameter) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **asyncSystem** (const CesiumAsync::AsyncSystem &) - The async system used to do work in threads. - **url** (const std::string &) - The URL of the asset. - **headers** (const std::vector< CesiumAsync::IAssetAccessor::THeader > &) - The headers to include in the request. ### Response #### Success Response (200) - **std::shared_ptr< CesiumAsync::IAssetRequest >** - The in-progress asset request. #### Response Example (Response structure depends on IAssetRequest implementation) ``` -------------------------------- ### Initialize CesiumCredit System Source: https://cesium.com/learn/cesium-unity/ref-doc/ConfigureReinterop_8cs_source.html Initializes or gets the default CesiumCreditSystem and starts a coroutine to load an image. This system manages the display of credits. ```csharp CesiumCreditSystem creditSystem = go.AddComponent(); creditSystem = CesiumCreditSystem.GetDefaultCreditSystem(); creditSystem.StartCoroutine(creditSystem.LoadImage("string")); ``` -------------------------------- ### Create Google Photorealistic 3D Tiles Import Job Source: https://cesium.com/learn/ion/self-hosted Execute this command after configuring import-google.yaml to activate Google Photorealistic 3D Tiles. ```bash microk8s kubectl create --namespace cesium-ion -f import-google.yaml ``` -------------------------------- ### get() - CachingAssetAccessor Source: https://cesium.com/learn/cesium-native/ref-doc/classCesiumAsync_1_1CachingAssetAccessor.html Starts a new request for the asset with the given URL. The request proceeds asynchronously without blocking the calling thread. ```APIDOC ## GET /asset ### Description Starts a new request for the asset with the given URL. The request proceeds asynchronously without blocking the calling thread. ### Method GET ### Endpoint /asset ### Parameters #### Query Parameters - **url** (std::string) - Required - The URL of the asset. - **headers** (std::vector) - Optional - The headers to include in the request. ### Returns - **Future>** - The in-progress asset request. ### Example ```json { "url": "http://example.com/asset.json", "headers": [ {"name": "Accept", "value": "application/json"} ] } ``` ``` -------------------------------- ### Initialize GoogleEarthEnterpriseMapsProvider Source: https://cesium.com/learn/cesiumjs/ref-doc/GoogleEarthEnterpriseMapsProvider.html Use the static fromUrl method to create an instance of the provider. Do not call the constructor directly. ```javascript const google = await Cesium.GoogleEarthEnterpriseMapsProvider.fromUrl("https://earth.localdomain", 1008); ``` -------------------------------- ### Get Current Node Pointer Source: https://cesium.com/learn/cesium-native/ref-doc/TreeTraversalState_8h_source.html Retrieves a pointer to the current node being processed in the traversal. Returns nullptr if the traversal has not started or is empty. ```cpp TNodePointer getCurrentNode() const noexcept { if (this->_parentIndices.empty()) return nullptr; return this->currentData().pNode; } ``` -------------------------------- ### Initialize Cesium Viewer with Custom Options and Mixins Source: https://cesium.com/learn/cesiumjs/ref-doc/Viewer.html Demonstrates creating a Viewer instance with custom scene settings, terrain providers, and imagery layers, followed by extending it with drag-and-drop functionality. ```javascript // Initialize the viewer widget with several custom options and mixins. try { const viewer = new Cesium.Viewer("cesiumContainer", { // Start in Columbus Viewer sceneMode: Cesium.SceneMode.COLUMBUS_VIEW, // Use Cesium World Terrain terrain: Cesium.Terrain.fromWorldTerrain(), // Hide the base layer picker baseLayerPicker: false, // Use OpenStreetMaps baseLayer: new Cesium.ImageryLayer(new Cesium.OpenStreetMapImageryProvider({ url: "https://tile.openstreetmap.org/" })), skyBox: new Cesium.SkyBox({ sources: { positiveX: "stars/TychoSkymapII.t3_08192x04096_80_px.jpg", negativeX: "stars/TychoSkymapII.t3_08192x04096_80_mx.jpg", positiveY: "stars/TychoSkymapII.t3_08192x04096_80_py.jpg", negativeY: "stars/TychoSkymapII.t3_08192x04096_80_my.jpg", positiveZ: "stars/TychoSkymapII.t3_08192x04096_80_pz.jpg", negativeZ: "stars/TychoSkymapII.t3_08192x04096_80_mz.jpg" } }), // Show Columbus View map with Web Mercator projection mapProjection: new Cesium.WebMercatorProjection() }); } catch (error) { console.log(error); } // Add basic drag and drop functionality viewer.extend(Cesium.viewerDragDropMixin); // Show a pop-up alert if we encounter an error when processing a dropped file viewer.dropError.addEventListener(function(dropHandler, name, error) { console.log(error); window.alert(error); }); ``` -------------------------------- ### GunzipAssetAccessor::get Source: https://cesium.com/learn/cesium-native/ref-doc/GunzipAssetAccessor_8h_source.html Starts a new request for the asset with the given URL. The request proceeds asynchronously. This is a convenience method for GET requests. ```cpp virtual Future< std::shared_ptr< IAssetRequest > > get(const AsyncSystem &asyncSystem, const std::string &url, const std::vector< THeader > &headers) override ``` -------------------------------- ### Initialize WebMapServiceImageryProvider Source: https://cesium.com/learn/cesiumjs/ref-doc/WebMapServiceImageryProvider.html Create a new imagery provider instance and add it to the viewer's imagery layers. ```javascript // WMS servers operated by the US government https://apps.nationalmap.gov/services/ const provider = new Cesium.WebMapServiceImageryProvider({ url : 'https://basemap.nationalmap.gov:443/arcgis/services/USGSHydroCached/MapServer/WMSServer', layers : '0', proxy: new Cesium.DefaultProxy('/proxy/') }); const imageryLayer = new Cesium.ImageryLayer(provider); viewer.imageryLayers.add(imageryLayer); ``` -------------------------------- ### Implement begin method Source: https://cesium.com/learn/cesium-native/ref-doc/structCesiumVectorData_1_1GeoJsonObject_1_1IteratorProvider.html Returns an iterator pointing to the first element of the collection. ```cpp template TIterator CesiumVectorData::GeoJsonObject::IteratorProvider< TIterator >::begin ( __ ) ``` -------------------------------- ### Get Accessor Offset Source: https://cesium.com/learn/cesium-native/ref-doc/classCesiumGltf_1_1AccessorView.html Returns the offset of this accessor, which is the number of bytes from the start of the buffer to the first element. This is important for locating the data within a larger buffer. ```cpp int64_t offset() const noexcept ``` -------------------------------- ### Initialize Azure2DImageryProvider Source: https://cesium.com/learn/cesiumjs/ref-doc/Azure2DImageryProvider.html Create a new instance of the imagery provider by specifying the subscription key and tileset ID. ```javascript // Azure 2D imagery provider const azureImageryProvider = new Cesium.Azure2DImageryProvider({ subscriptionKey: "subscription-key", tilesetId: "microsoft.base.road" }); ``` -------------------------------- ### Get Raw Accessor Data Pointer Source: https://cesium.com/learn/cesium-native/ref-doc/classCesiumGltf_1_1AccessorView.html Returns a pointer to the first byte of this accessor view's data. The elements are stored contiguously, so the next one starts `stride` bytes later. ```cpp const std::byte * data() const noexcept ``` -------------------------------- ### Create ConicSensor instances Source: https://cesium.com/learn/ion-sdk/ref-doc/ConicSensor.html Examples demonstrating different configurations for ConicSensor, including ground-based, downward-pointing, and custom-material sensors. ```javascript // Example 1. Sensor on the ground pointing straight up var sensor = scene.primitives.add(new IonSdkSensors.ConicSensor({ modelMatrix : Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706)), radius : 1000000.0, innerHalfAngle : Cesium.Math.toRadians(5.0), outerHalfAngle : Cesium.Math.toRadians(85.0) })); ``` ```javascript // Example 2. Sensor pointing straight down with its dome intersecting the ellipsoid var sensor = scene.primitives.add(new IonSdkSensors.ConicSensor({ modelMatrix : Cesium.Transforms.northEastDownToFixedFrame(Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 900000.0)), radius : 1000000.0, innerHalfAngle : Cesium.Math.toRadians(0.0), outerHalfAngle : Cesium.Math.toRadians(40.0), minimumClockAngle : Cesium.Math.toRadians(-30.0), maximumClockAngle : Cesium.Math.toRadians(30.0), lateralSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.StripeType), intersectionColor : Cesium.Color.YELLOW })); ``` ```javascript // Example 3. Sensor with custom materials for each surface. Switch to 2D to see the ellipsoid surface material. var sensor = scene.primitives.add(new IonSdkSensors.ConicSensor({ modelMatrix : Cesium.Transforms.northEastDownToFixedFrame(Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 9000000.0)), radius : 20000000.0, innerHalfAngle : Cesium.Math.toRadians(15.0), outerHalfAngle : Cesium.Math.toRadians(40.0), minimumClockAngle : Cesium.Math.toRadians(-60.0), maximumClockAngle : Cesium.Math.toRadians(60.0), lateralSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.ColorType, { color : new Cesium.Color(1.0, 0.0, 0.0, 0.5) }), ellipsoidHorizonSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.ColorType, { color : new Cesium.Color(0.0, 1.0, 0.0, 0.5) }), ellipsoidSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.ColorType, { color : new Cesium.Color(0.0, 0.0, 1.0, 0.5) }), domeSurfaceMaterial : Cesium.Material.fromType(Cesium.Material.ColorType, { color : new Cesium.Color(1.0, 1.0, 1.0, 0.5) }) })); ``` -------------------------------- ### Get Archive Info Response Sample Source: https://cesium.com/learn/ion/self-hosted/restApi.html Example JSON response for retrieving information about a specific archive. Details include ID, name, asset IDs, format, status, bytes archived, and type. ```json { "id": 10, "name": "string", "assetIds": [ 3812 ], "format": "ZIP", "status": "COMPLETE", "bytesArchived": 1024, "type": "FULL" } ``` -------------------------------- ### Initialize CesiumUintMat2x2, CesiumUintMat3x3, CesiumUintMat4x4 Source: https://cesium.com/learn/cesium-unity/ref-doc/ConfigureReinterop_8cs_source.html Demonstrates the initialization of Cesium unsigned integer matrices. ```csharp CesiumUintMat2x2 myUintMat2 = new CesiumUintMat2x2(myUintVec2, myUintVec2); CesiumUintMat3x3 myUintMat3 = new CesiumUintMat3x3(myUintVec3, myUintVec3, myUintVec3); CesiumUintMat4x4 myUintMat4 = new CesiumUintMat4x4(myUintVec4, myUintVec4, myUintVec4, myUintVec4); ``` -------------------------------- ### Set Cesium3DTileStyle show with a regular expression Source: https://cesium.com/learn/cesiumjs/ref-doc/Cesium3DTileStyle.html Use a regular expression within a string expression to control feature visibility. This example shows features where the 'County' property starts with 'Chest' and 'YearBuilt' is 1970 or later. ```javascript const style = new Cesium3DTileStyle({ show : '(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)' }); style.show.evaluate(feature); // returns true or false depending on the feature's properties ``` -------------------------------- ### Create a Looping Clock Source: https://cesium.com/learn/cesiumjs/ref-doc/Clock.html Instantiate a Cesium Clock with specific start, current, and stop times, configured to loop. This setup is useful for scenarios requiring time to cycle between defined boundaries, such as daily or yearly simulations. ```javascript const clock = new Cesium.Clock({ startTime : Cesium.JulianDate.fromIso8601("2013-12-25"), currentTime : Cesium.JulianDate.fromIso8601("2013-12-25"), stopTime : Cesium.JulianDate.fromIso8601("2013-12-26"), clockRange : Cesium.ClockRange.LOOP_STOP, clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER }); ``` -------------------------------- ### VRTheWorldTerrainProvider Constructor and fromUrl Method Source: https://cesium.com/learn/ion-sdk/ref-doc/VRTheWorldTerrainProvider.html Information on how to construct and use the VRTheWorldTerrainProvider, primarily through the static fromUrl method. ```APIDOC ## VRTheWorldTerrainProvider ### Description A `TerrainProvider` that produces terrain geometry by tessellating height maps retrieved from a VT MÄK VR-TheWorld server. ### Method `new Cesium.VRTheWorldTerrainProvider(options)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Static Method: fromUrl ## POST /api/users ### Description Creates a `TerrainProvider` that produces terrain geometry by tessellating height maps retrieved from a VT MÄK VR-TheWorld server. ### Method `static Cesium.VRTheWorldTerrainProvider.fromUrl(url, options)` ### Endpoint N/A (Static method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **url** (Resource | string) - Required - The URL of the VR-TheWorld TileMap. - **options** (VRTheWorldTerrainProvider.ConstructorOptions) - Optional - An object describing initialization options. ### Request Example ```javascript const terrainProvider = await Cesium.VRTheWorldTerrainProvider.fromUrl( "https://www.vr-theworld.com/vr-theworld/tiles1.0.0/73/" ); v viewer.terrainProvider = terrainProvider; ``` ### Response #### Success Response (200) - **VRTheWorldTerrainProvider** - A Promise that resolves to a VRTheWorldTerrainProvider instance. #### Response Example ```javascript // Example response is conceptual, as this is a constructor // The promise resolves with an instance of VRTheWorldTerrainProvider ``` ### Throws - `RuntimeError` - metadata specifies and unknown SRS ``` -------------------------------- ### Create and Use ReferenceProperty Source: https://cesium.com/learn/cesiumjs/ref-doc/ReferenceProperty.html Demonstrates creating entities and referencing properties using ReferenceProperty and ReferenceProperty.fromString. It shows how to link billboard scales between entities and how to handle special characters in IDs and property names. ```javascript const collection = new Cesium.EntityCollection(); //Create a new entity and assign a billboard scale. const object1 = new Cesium.Entity({id:'object1'}); object1.billboard = new Cesium.BillboardGraphics(); object1.billboard.scale = new Cesium.ConstantProperty(2.0); collection.add(object1); //Create a second entity and reference the scale from the first one. const object2 = new Cesium.Entity({id:'object2'}); object2.model = new Cesium.ModelGraphics(); object2.model.scale = new Cesium.ReferenceProperty(collection, 'object1', ['billboard', 'scale']); collection.add(object2); //Create a third object, but use the fromString helper function. const object3 = new Cesium.Entity({id:'object3'}); object3.billboard = new Cesium.BillboardGraphics(); object3.billboard.scale = Cesium.ReferenceProperty.fromString(collection, 'object1#billboard.scale'); collection.add(object3); //You can refer to an entity with a # or . in id and property names by escaping them. const object4 = new Cesium.Entity({id:'#object.4'}); object4.billboard = new Cesium.BillboardGraphics(); object4.billboard.scale = new Cesium.ConstantProperty(2.0); collection.add(object4); const object5 = new Cesium.Entity({id:'object5'}); object5.billboard = new Cesium.BillboardGraphics(); object5.billboard.scale = Cesium.ReferenceProperty.fromString(collection, '\#object\.4#billboard.scale'); collection.add(object5); ``` -------------------------------- ### Get Pixel Dimensions at a Specific Distance Source: https://cesium.com/learn/cesiumjs/ref-doc/PerspectiveFrustum.html Determines the pixel dimensions in meters at a specified distance from the camera, useful for calculating the size of objects in world space that correspond to a single pixel on screen. This example shows how to calculate the distance to a primitive's bounding volume center. ```javascript // Example 2 // Get the width and height of a pixel if the near plane was set to 'distance'. // For example, get the size of a pixel of an image on a billboard. const position = camera.position; const direction = camera.direction; const toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3()); // vector from camera to a primitive const toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector const distance = Cesium.Cartesian3.magnitude(toCenterProj); const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2()); ``` -------------------------------- ### Initialize and populate a BufferPolygonCollection Source: https://cesium.com/learn/cesiumjs/ref-doc/BufferPolygonCollection.html Demonstrates creating a collection with defined capacity limits and adding a polygon using earcut for triangulation. ```javascript import earcut from "earcut"; const collection = new BufferPolygonCollection({ primitiveCountMax: 1024, vertexCountMax: 4096, holeCountMax: 1024, triangleCountMax: 2048, }); const polygon = new BufferPolygon(); const positions = [ ... ]; const holes = [ ... ]; const material = new BufferPolygonMaterial({color: Color.WHITE}); // Create a new polygon, temporarily bound to 'polygon' local variable. collection.add({ positions: new Float64Array(positions), holes: new Uint32Array(holes), triangles: new Uint32Array(earcut(positions, holes, 3)), material }, polygon); // Iterate over all polygons in collection, temporarily binding 'polygon' // local variable to each, and updating polygon material. for (let i = 0; i < collection.primitiveCount; i++) { collection.get(i, polygon); polygon.setMaterial(material); } ``` -------------------------------- ### Get Component Count Source: https://cesium.com/learn/cesium-unreal/ref-doc/CesiumPropertyTableProperty_8h_source.html Gets the number of elements in an array property. This is a deprecated function for getting array size. ```cpp static PRAGMA_DISABLE_DEPRECATION_WARNINGS int64 GetComponentCount(UPARAM(ref) const FCesiumPropertyTableProperty &Property) ``` -------------------------------- ### Example Ingress Output Source: https://cesium.com/learn/ion/self-hosted Sample output showing the ingress status and assigned IP address. ```text NAME CLASS HOSTS ADDRESS PORTS AGE cesium-ion public assets.ion.example,api.ion.example,ion.example 127.0.0.1 80, 443 20s ``` -------------------------------- ### Install microk8s on Linux Source: https://cesium.com/learn/ion/self-hosted Use this command to install microk8s on a Linux system via snap. Ensure you have snapd installed. ```bash sudo snap install microk8s --classic ``` -------------------------------- ### get Source: https://cesium.com/learn/cesiumjs/ref-doc/TimeIntervalCollection.html Gets the interval at the specified index. ```APIDOC ## get(index) ### Description Gets the interval at the specified index. ### Method (Implicitly a method of TimeIntervalCollection) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **index** (number) - The index of the interval to retrieve. ### Request Example ```json { "index": 0 } ``` ### Response #### Success Response (200) - **TimeInterval** (object) - The interval at the specified index, or undefined if no interval exists at that index. #### Response Example ```json { "start": "2023-10-27T10:00:00Z", "stop": "2023-10-27T12:00:00Z", "isStartIncluded": true, "isStopIncluded": false, "data": {} } ``` ``` -------------------------------- ### Verify Development Environment Prerequisites Source: https://cesium.com/learn/cesium-unity/ref-doc/developer-setup.html Check that the required .NET and CMake versions are installed. ```bash dotnet --version ``` ```bash cmake --version ``` -------------------------------- ### Get Scale Source: https://cesium.com/learn/cesium-unreal/ref-doc/CesiumPropertyTextureProperty_8h_source.html Gets the scale of this property. ```APIDOC ## GetScale /websites/cesium_learn ### Description Gets the scale of this property. ### Method GET ### Endpoint /websites/cesium_learn ### Parameters #### Query Parameters - **Property** (FCesiumPropertyTextureProperty) - Required - The property texture. ### Response #### Success Response (200) - **FCesiumMetadataValue** (FCesiumMetadataValue) - The scale of the property. ``` -------------------------------- ### Generate Reference Documentation Source: https://cesium.com/learn/cesium-unreal/ref-doc/developer-setup-unreal.html Commands to install dependencies and trigger the Doxygen documentation build process. ```bash npm install npm run doxygen ``` -------------------------------- ### Install LLVM and clang-tidy on Debian-based Linux Source: https://cesium.com/learn/cesium-native/ref-doc/developer-setup.html Installs LLVM 19+ using the official install script. Ensure you have wget and chmod permissions. ```bash wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 19 ``` -------------------------------- ### Port Forward Output Example Source: https://cesium.com/learn/ion/self-hosted Expected output when successfully establishing a port forward connection. ```text Forwarding from 127.0.0.1:80 -> 80 Forwarding from 127.0.0.1:443 -> 443 ``` -------------------------------- ### get(index) Source: https://cesium.com/learn/cesiumjs/ref-doc/ImageryLayerCollection.html Gets a layer by index from the collection. ```APIDOC ## get(index) ### Description Gets a layer by index from the collection. ### Parameters #### Request Body - **index** (number) - Required - The index to retrieve. ### Response #### Success Response (200) - **layer** (ImageryLayer) - The imagery layer at the given index. ``` -------------------------------- ### Update package.json scripts Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-webpack Add the start script to package.json to launch the development server. ```json "scripts": { "build": "node_modules/.bin/webpack --config webpack.config.js", "start": "node_modules/.bin/webpack-dev-server --config webpack.config.js --open" } ``` -------------------------------- ### Initialize and manage BufferPolylineCollection Source: https://cesium.com/learn/cesiumjs/ref-doc/BufferPolylineCollection.html Demonstrates creating a collection with fixed capacity, adding a polyline, and iterating through the collection to update materials. ```javascript const collection = new BufferPolylineCollection({ primitiveCountMax: 1024, vertexCountMax: 4096, }); const polyline = new BufferPolyline(); const material = new BufferPolylineMaterial({color: Color.WHITE}); // Create a new polyline, temporarily bound to 'polyline' local variable. collection.add({ positions: new Float64Array([ ... ]), material, }, polyline); // Iterate over all polylines in collection, temporarily binding 'polyline' // local variable to each, and updating polyline material. for (let i = 0; i < collection.primitiveCount; i++) { collection.get(i, polyline); polyline.setMaterial(material); } ``` -------------------------------- ### Get Channels Source: https://cesium.com/learn/cesium-unreal/ref-doc/CesiumPropertyTextureProperty_8h_source.html Get the channels array of this property. ```APIDOC ## GetChannels /websites/cesium_learn ### Description Get the channels array of this property. ### Method GET ### Endpoint /websites/cesium_learn ### Parameters #### Query Parameters - **Property** (FCesiumPropertyTextureProperty) - Required - The property texture. ### Response #### Success Response (200) - **TArray** (TArray) - The channels array of the property. ``` -------------------------------- ### Initialize Cesium Credit System Source: https://cesium.com/learn/cesium-unity/ref-doc/CesiumCreditSystemUI_8cs_source.html Sets up the credit system, UI document, and ensures an EventSystem exists for handling credit link interactions. ```csharp private void OnEnable() { this._creditSystem = this.GetComponent(); if (this._creditSystem == null) { this._creditSystem = CesiumCreditSystem.GetDefaultCreditSystem(); } this._creditSystem.OnCreditsUpdate += this.SetCredits; this._uiDocument = this.GetComponent(); if (this._uiDocument.rootVisualElement != null) { this._onScreenCredits = this._uiDocument.rootVisualElement.Q("OnScreenCredits"); this._popupCredits = this._uiDocument.rootVisualElement.Q("PopupCredits"); } #if UNITY_EDITOR if (!EditorApplication.isPlaying) { return; } #endif // If no EventSystem exists, create one to handle clicking on credit links. if (EventSystem.current == null) { GameObject eventSystemGameObject = new GameObject("EventSystem"); eventSystemGameObject.AddComponent(); #if ENABLE_INPUT_SYSTEM eventSystemGameObject.AddComponent(); #elif ENABLE_LEGACY_INPUT_MANAGER eventSystemGameObject.AddComponent(); #endif } } ``` -------------------------------- ### GET /api/users/{id} Source: https://cesium.com/learn/ion-sdk/ref-doc/ImageryLayerCollection.html Gets a layer by index from the collection. ```APIDOC ## GET /api/users/{id} ### Description Gets a layer by index from the collection. ### Method GET ### Endpoint N/A (Method of ImageryLayerCollection instance) ### Parameters #### Path Parameters - **index** (number) - Required - The index to retrieve. #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **ImageryLayer** (ImageryLayer) - The imagery layer at the given index. ``` -------------------------------- ### Get Minimum Value Source: https://cesium.com/learn/cesium-unreal/ref-doc/CesiumPropertyTextureProperty_8h_source.html Gets the minimum value of this property. ```APIDOC ## GetMinimumValue /websites/cesium_learn ### Description Gets the minimum value of this property. ### Method GET ### Endpoint /websites/cesium_learn ### Parameters #### Query Parameters - **Property** (FCesiumPropertyTextureProperty) - Required - The property texture. ### Response #### Success Response (200) - **FCesiumMetadataValue** (FCesiumMetadataValue) - The minimum value of the property. ``` -------------------------------- ### Initialize Google2DImageryProvider Source: https://cesium.com/learn/cesiumjs/ref-doc/Google2DImageryProvider.html Examples demonstrating how to instantiate the provider using an Ion asset ID or a custom Google Maps API key. ```javascript // Google 2D imagery provider const googleTilesProvider = Cesium.Google2DImageryProvider.fromIonAssetId({ assetId: 3830184 }); ``` ```javascript // Use your own Google api key Cesium.GoogleMaps.defaultApiKey = "your-api-key"; const googleTilesProvider = Cesium.Google2DImageryProvider.fromUrl({ mapType: "SATELLITE" }); ``` -------------------------------- ### Get Component Count Source: https://cesium.com/learn/cesium-unreal/ref-doc/CesiumPropertyTextureProperty_8h_source.html Get the component count of this property. ```APIDOC ## GetComponentCount /websites/cesium_learn ### Description Get the component count of this property. ### Method GET ### Endpoint /websites/cesium_learn ### Parameters #### Query Parameters - **Property** (FCesiumPropertyTextureProperty) - Required - The property texture. ### Response #### Success Response (200) - **int64** (int64) - The component count of the property. ``` -------------------------------- ### Configure Build.cs Dependencies Source: https://cesium.com/learn/unreal/unreal-procedural-foliage Add necessary modules and set the C++ standard to C++17 to support the foliage spawning system. ```C# using UnrealBuildTool; public class aiden_geo_tutorial : ModuleRules { public aiden_geo_tutorial(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Foliage", "CesiumRuntime", "RHI", "RenderCore", "HTTP" }); PrivateDependencyModuleNames.AddRange(new string[] { }); CppStandard = CppStandardVersion.Cpp17; } } ``` -------------------------------- ### Get Maximum Value Source: https://cesium.com/learn/cesium-unreal/ref-doc/CesiumPropertyTextureProperty_8h_source.html Gets the maximum value of this property. ```APIDOC ## GetMaximumValue /websites/cesium_learn ### Description Gets the maximum value of this property. ### Method GET ### Endpoint /websites/cesium_learn ### Parameters #### Query Parameters - **Property** (FCesiumPropertyTextureProperty) - Required - The property texture. ### Response #### Success Response (200) - **FCesiumMetadataValue** (FCesiumMetadataValue) - The maximum value of the property. ``` -------------------------------- ### Manage Server for New Objects Source: https://cesium.com/learn/cesium-unreal/ref-doc/CesiumIonServer_8h_source.html Methods to get or set the server instance assigned to newly created objects. ```cpp static void SetServerForNewObjects(UCesiumIonServer *Server) ``` ```cpp static UCesiumIonServer * GetServerForNewObjects() ``` -------------------------------- ### Get Property Size Source: https://cesium.com/learn/cesium-unreal/ref-doc/CesiumPropertyAttributeProperty_8h_source.html Gets the number of values in the property. ```APIDOC ## GetPropertySize ### Description Gets the number of values in the property. ### Method `static int64 GetPropertySize(UPARAM(ref) const FCesiumPropertyAttributeProperty &Property)` ### Endpoint N/A (Blueprint Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **int64** - The number of values in the property. #### Response Example ```json { "example": 10 } ``` ``` -------------------------------- ### Primitive Usage Examples Source: https://cesium.com/learn/ion-sdk/ref-doc/Primitive.html Examples demonstrating how to create and add primitives to the scene, including different geometry types and appearances. ```APIDOC ## Primitive Usage Examples ### Example 1: Draw a translucent ellipse on the surface with a checkerboard pattern ```javascript const instance = new Cesium.GeometryInstance({ geometry : new Cesium.EllipseGeometry({ center : Cesium.Cartesian3.fromDegrees(-100.0, 20.0), semiMinorAxis : 500000.0, semiMajorAxis : 1000000.0, rotation : Cesium.Math.PI_OVER_FOUR, vertexFormat : Cesium.VertexFormat.POSITION_AND_ST }), id : 'object returned when this instance is picked and to get/set per-instance attributes' }); scene.primitives.add(new Cesium.Primitive({ geometryInstances : instance, appearance : new Cesium.EllipsoidSurfaceAppearance({ material : Cesium.Material.fromType('Checkerboard') }) })); ``` ### Example 2: Draw different instances each with a unique color ```javascript const rectangleInstance = new Cesium.GeometryInstance({ geometry : new Cesium.RectangleGeometry({ rectangle : Cesium.Rectangle.fromDegrees(-140.0, 30.0, -100.0, 40.0), vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT }), id : 'rectangle', attributes : { color : new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5) } }); const ellipsoidInstance = new Cesium.GeometryInstance({ geometry : new Cesium.EllipsoidGeometry({ radii : new Cesium.Cartesian3(500000.0, 500000.0, 1000000.0), vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL }), modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame( Cesium.Cartesian3.fromDegrees(-95.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 500000.0), new Cesium.Matrix4()), id : 'ellipsoid', attributes : { color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA) } }); scene.primitives.add(new Cesium.Primitive({ geometryInstances : [rectangleInstance, ellipsoidInstance], appearance : new Cesium.PerInstanceColorAppearance() })); ``` ### Example 3: Create the geometry on the main thread. ```javascript scene.primitives.add(new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ geometry : Cesium.EllipsoidGeometry.createGeometry(new Cesium.EllipsoidGeometry({ radii : new Cesium.Cartesian3(500000.0, 500000.0, 1000000.0), vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL })), modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame( Cesium.Cartesian3.fromDegrees(-95.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 500000.0), new Cesium.Matrix4()), id : 'ellipsoid', attributes : { color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA) } }), appearance : new Cesium.PerInstanceColorAppearance(), asynchronous : false })); ``` ``` -------------------------------- ### Install uglifyjs-webpack-plugin Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-webpack Installs the uglifyjs-webpack-plugin package as a development dependency. ```bash npm install uglifyjs-webpack-plugin --save-dev ``` -------------------------------- ### Install strip-pragma-loader Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-webpack Installs the strip-pragma-loader package as a development dependency. ```bash npm install strip-pragma-loader --save-dev ``` -------------------------------- ### static Cesium.VRTheWorldTerrainProvider.fromUrl Source: https://cesium.com/learn/cesiumjs/ref-doc/VRTheWorldTerrainProvider.html Creates a new VRTheWorldTerrainProvider instance from a specified URL. ```APIDOC ## static Cesium.VRTheWorldTerrainProvider.fromUrl ### Description Creates a TerrainProvider that produces terrain geometry by tessellating height maps retrieved from a VT MÄK VR-TheWorld server. ### Parameters #### Request Body - **url** (Resource|string) - Required - The URL of the VR-TheWorld TileMap. - **options** (VRTheWorldTerrainProvider.ConstructorOptions) - Optional - An object describing initialization options. ### Request Example ```javascript const terrainProvider = await Cesium.VRTheWorldTerrainProvider.fromUrl( "https://www.vr-theworld.com/vr-theworld/tiles1.0.0/73/" ); ``` ### Response #### Success Response (200) - **Promise.** - A promise that resolves to the created terrain provider. ``` -------------------------------- ### Build and Install Release Version via CMake Source: https://cesium.com/learn/cesium-unreal/ref-doc/developer-setup-windows.html Builds the Release version of the project entirely from the command-line and installs it. This command should be run from the build directory. ```bash cmake --build build --config Release --target install ``` -------------------------------- ### Install Webpack Source: https://cesium.com/learn/cesiumjs-learn/cesiumjs-webpack Install webpack as a development dependency for your project. ```bash npm install --save-dev webpack ``` -------------------------------- ### Instantiate PolylineVolumeGeometry Source: https://cesium.com/learn/ion-sdk/ref-doc/PolylineVolumeGeometry.html Example of creating a PolylineVolumeGeometry instance. Requires polylinePositions and shapePositions. VertexFormat.POSITION_ONLY is used for simplicity. ```javascript const volume = new Cesium.PolylineVolumeGeometry({ vertexFormat : Cesium.VertexFormat.POSITION_ONLY, polylinePositions : Cesium.Cartesian3.fromDegreesArray([ -72.0, 40.0, -70.0, 35.0 ]), shapePositions : computeCircle(100000.0) }); ``` -------------------------------- ### SphereGeometry Example Source: https://cesium.com/learn/ion-sdk/ref-doc/SphereGeometry.html Example usage of creating and processing a SphereGeometry. ```APIDOC ## Example Usage ```javascript // Create a sphere geometry const sphere = new Cesium.SphereGeometry({ radius : 100.0, vertexFormat : Cesium.VertexFormat.POSITION_ONLY }); // Compute the geometry const geometry = Cesium.SphereGeometry.createGeometry(sphere); ``` ### See Also - SphereGeometry#createGeometry ``` -------------------------------- ### Create a Primitive with PolylineMaterialAppearance Source: https://cesium.com/learn/cesiumjs/ref-doc/PolylineMaterialAppearance.html Demonstrates how to initialize a Primitive using PolylineGeometry and apply a material via PolylineMaterialAppearance. ```javascript const primitive = new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ geometry : new Cesium.PolylineGeometry({ positions : Cesium.Cartesian3.fromDegreesArray([ 0.0, 0.0, 5.0, 0.0 ]), width : 10.0, vertexFormat : Cesium.PolylineMaterialAppearance.VERTEX_FORMAT }) }), appearance : new Cesium.PolylineMaterialAppearance({ material : Cesium.Material.fromType('Color') }) }); ``` -------------------------------- ### Get Array Size Source: https://cesium.com/learn/cesium-unreal/ref-doc/CesiumPropertyTextureProperty_8h_source.html Gets the number of elements in an array of this property. ```APIDOC ## GetArraySize /websites/cesium_learn ### Description Gets the number of elements in an array of this property. ### Method GET ### Endpoint /websites/cesium_learn ### Parameters #### Query Parameters - **Property** (FCesiumPropertyTextureProperty) - Required - The property texture. ### Response #### Success Response (200) - **int64** (int64) - The number of elements in the array. ``` -------------------------------- ### Initialize Submodules Source: https://cesium.com/learn/cesium-unreal/ref-doc/developer-setup-linux.html Run this command if the repository was cloned without the --recursive flag to fetch missing submodules. ```bash git submodule update --init --recursive ```