### JSDoc Template Configuration Example Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/classes.list.html This example shows a configuration used by the DocStrap template for JSDoc. It specifies options for syntax highlighting, line numbers, and menu display, which are common in project documentation. ```javascript Sunlight.highlightAll( { lineNumbers : true, showMenu : true, enableDoclinks : true } ); $.catchAnchorLinks( { navbarOffset: 10 } ); $( "#toc" ).toc( { anchorName: function ( i, heading, prefix ) { return $( heading ).attr( "id" ) || ( prefix + i ); }, selectors: "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4", showAndHide: false, smoothScrolling: true } ); ``` -------------------------------- ### Tag Management: Start, Stop, and Update Ticks Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/webui_ex.html This function demonstrates how to manage time-based updates (ticks) for a tag. It includes starting a tick that repeatedly updates tag text and logs frame information, stopping the tick, and deleting the tag. It relies on `fdapi.tag.delete`, `fdapi.tag.add`, `fdapi.tag.focus`, and `fdapi.tag.setText`. ```javascript function startTick() { window.i = 0; fdapi.tag.delete(tagId); fdapi.tag.add(tagData, o => fdapi.tag.focus(tagId, 100, 0)); window.tick = frame => { let data = fdapi.tag.setText(tagId, 'Tag2:' + (i++).toString(), null); document.getElementById('info1').innerText = `[Frame:${frame}] ` + JSON.stringify(tagData); } } function stopTick() { delete window.tick; fdapi.tag.delete(tagId); document.getElementById('info1').innerText = 'tick stopped.' document.getElementById('info2').innerText = ''; } ``` -------------------------------- ### Start System Process (JavaScript) Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html Shows the `startProcess` method available on the `misc` object, which allows for launching external system processes, such as opening a web page in the default browser or executing another application. ```javascript misc.startProcess; ``` -------------------------------- ### Configuration Tool: Standalone HTTP Service Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html The configuration tool now includes functionality to start a standalone HTTP service, providing a dedicated web server for application deployment or access. ```javascript configTool.startHttpService(port); ``` -------------------------------- ### Unified Measurement, Clipping, and Analysis Method Names Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html Method names within the tools object for measurement, clipping, and analysis operations have been standardized. They now consistently use 'start' and 'stop' prefixes for clarity and ease of use. For example, createSkyline is now startSkylineAnalysis and deleteSkyline is now stopSkylineAnalysis. ```javascript // Skyline Analysis startSkylineAnalysis(); stopSkylineAnalysis(); // Viewshed Analysis startViewshedAnalysis(); stopViewshedAnalysis(); ``` -------------------------------- ### Video Projection Setup (JavaScript) Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html Enables the creation and addition of video projections within the 3D environment. Requires detailed data including ID, video URL, media type, location, rotation, FOV, aspect ratio, and distance. ```javascript let o = new VideoProjectionData(); o.id = "vp1"; o.videoURL = "d:/data/video/1.mp4"; o.mediaType = 0; o.location = [66.14, -7288.16, 9.47]; o.rotation = [-50, 0, 0]; o.fov = 90; o.aspectRatio = 1.77; o.distance = 100; fdapi.videoProjection.add(o); ``` -------------------------------- ### Initialize Digital Twin API and Handle Events Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/webui_ex.html This snippet shows how to initialize the DigitalTwinAPI and handle various events like onReady, onEvent, and onLog. It sets up event listeners to update the UI with status messages and log information. Dependencies include the DigitalTwinAPI and DOM manipulation for UI updates. ```javascript var tagId = 'webui_tick_tag'; var tagData = { id: tagId, coordinate: [493237, 2491951, 2.9], text: 'Tag2:0', textSize: 20, textColor: Color.Yellow, range: [1, 10000], showLine: false } window.onload = function () { document.getElementById('info1').innerText = 'onload'; new DigitalTwinAPI(null, { onReady: () => { document.getElementById('info1').innerText = 'onReady is called.' }, onEvent: e => { document.getElementById('info2').innerText = e.eventtype; }, onLog: (msg, noLineBreak, color) => { let e = document.getElementById('info2'); if (e) { msg = color ? `` + msg + '' : msg; e.insertAdjacentHTML('beforeend', msg + (noLineBreak ? '' : '\n')); e.scrollTop = e.scrollHeight + 100; } } }); } ``` -------------------------------- ### New Classes and TileLayer Information Method Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html Addition of FloodFill and Cesium3DTile classes, and a new method for TileLayer to get detailed information. ```APIDOC ## New Classes and TileLayer Information Method ### Description This update introduces new classes, `FloodFill` and `Cesium3DTile`, and adds a method to the `TileLayer` object for retrieving detailed layer information. ### Method N/A (Class and Method Additions) ### Endpoint N/A ### Parameters #### TileLayer Object - **getInformation** - Added: Method to get detailed layer information. ### Request Example N/A ### Response N/A ``` -------------------------------- ### ODLine Management: Create and Delete Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/webui_ex.html This snippet demonstrates how to create and delete ODLines (Object Detection Lines) in the digital twin environment. It includes adding a new ODLine with specified properties and then clearing all ODLines. It utilizes `fdapi.odline.clear`, `fdapi.odline.add`, and `fdapi.odline.focus`. ```javascript function createOdline() { fdapi.odline.clear(); let o = { id: 'od1', color: Color.Green, coordinates: [[492303.65625, 2487534.5, 4.195], [491391.5625, 2487777.5, 4.2]], flowRate: 1, intensity: 1, bendDegree: 0.5, tiling: 0.5, lineThickness: 15, flowPointSizeScale: 30, labelSizeScale: 1000, lineShape: 1, lineStyle: 0, flowShape: 1, startPointShape: 1, endPointShape: 1, startLabelShape: 1, endLabelShape: 1 }; fdapi.odline.add(o); fdapi.odline.focus(o.id); } function deleteOdline() { fdapi.odline.clear(); } ``` -------------------------------- ### HTML & JavaScript: Example Tick Page Structure Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html A basic HTML structure for a tick page, including script includes for necessary libraries (`ac_conf.js`, `ac.min.js`) and elements to display information. It also includes JavaScript for initializing `DigitalTwinAPI`, adding a tag, and handling button clicks for actions like deleting tags or posting events. ```html TICK Test Debug Window DeleteTag PostEvent Close


``` ```javascript var fdapi; var id = 'testTag'; var i = 0; var data = { id: id, coordinate: [493217, 2491901, -1.9], text: 'Tag:0', textSize: 20, textColor: Color.Yellow, range: [1, 10000], showLine: false } window.onload = function () { fdapi = new DigitalTwinAPI(); fdapi.tag.delete(id); fdapi.tag.add(data, o => { document.getElementById('r3').innerText = 'tag created.' fdapi.tag.focus(id, 100, 0); }); } function clientCalled(str) { document.getElementById('r3').innerText = str; } function tick(frameNo) { let data = fdapi.tag.setText(id, 'Tag:' + (i++).toString(), null); document.getElementById('r1').innerText = `[Frame:${frameNo}] ` + JS ``` -------------------------------- ### JavaScript: Initialize DigitalTwinAPI and Handle Tick Events Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/popup_follow.html This snippet shows how to initialize the DigitalTwinAPI and defines a 'tick' function to capture and display real-time vehicle data on every frame. It emphasizes avoiding time-consuming operations within the 'ontick' method to prevent video stream lag. Dependencies include the DigitalTwinAPI library. ```javascript var fdapi; let currentSource = null; let signalSource1 = [492540.78125, 2492213.75, 9.2458667755126953]; let signalSource2 = [492532.5625, 2492235.25, 7.5611543655395508]; let signalSource3 = [492547.78125, 2492251, 7.5889630317687988]; let signalSource4 = [492526.65625, 2492183.5, 5.4552111625671387]; let signalSource5 = [492511.125, 2492188.5, 7.5469346046447754]; window.onload = async function () { fdapi = new DigitalTwinAPI(); } /** * tick事件 监听每一帧操作 */ function tick() { //获取车辆每一帧实时位置 注意:ontick方法里禁止调用耗时接口 否则会导致视频流卡顿影响交互 let data = fdapi.customObject.get('co1', null); document.getElementById('info').innerText = JSON.stringify(data); } ``` -------------------------------- ### JSDoc Documentation Generation Example Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/classes.list.html This snippet demonstrates how JSDoc comments are processed to generate API documentation. It shows the use of tags like @param and @returns, which are standard in JSDoc for describing function parameters and return values. The generated output typically includes HTML files detailing the API. ```javascript /** * @param {string} name The name of the user. * @param {number} age The age of the user. * @returns {string} A greeting message. */ function greetUser(name, age) { return "Hello, " + name + ". You are " + age + " years old."; } ``` -------------------------------- ### Initialize and Resize DigitalTwinPlayer in JavaScript Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/player.html Initializes the DigitalTwinPlayer with configuration options, retrieves user and instance details from URL parameters or local storage, and sets up event listeners for window resizing and page load. It also handles determining the correct player host based on network conditions and a port mapping configuration. ```javascript var fdplayer; var disableResizeObserver = false; // Set to true if video flickering due to constant resizing occurs function resize() { let p = document.getElementById('player'); p.style.height = window.innerHeight + "px"; p.style.width = window.innerWidth + "px"; if (disableResizeObserver) fdplayer?.resize(); } function init() { let urlParams = new URLSearchParams(window.location.search); // Username let username = urlParams.get('username'); if (!username) { let userLoginInfo = JSON.parse(localStorage.getItem("userLoginInfo")); if (userLoginInfo) username = userLoginInfo.username; } // DigitalTwinPlayer let options = { domId: 'player', // HTML element ID (will be parent of the Video tag) iid: urlParams.get('iid'), // Cloud rendering instance ID pid: urlParams.get('pid'), // Project ID to load password: urlParams.get('password'), // Instance access password ui: { statusButton: true, // Show info button in bottom left (default: false) fullscreenButton: true, // Show fullscreen button in bottom right (default: false) homeButton: true, // Show 'return to initial position' button in bottom left (default: false) debugEventsPanel: urlParams.get('debugEventsPanel') // Show detailed event info (for debugging) }, urlExtraInfo: { uid: urlParams.get('uid'), // For authorization management (2023.05.31) username: username, // For user login (2023.12.16) }, events: { onLoginRequired: (captchaRequired) => { // Called when login is required if user system is enabled (2023.12.16) let href = 'login.html?from=player&captcha=' + (captchaRequired ? 1 : 0); if (options.pid) href += '&pid=' + options.pid; if (options.iid) href += '&iid=' + options.iid; location.href = href; } }, disableResizeObserver: disableResizeObserver // Optional, default: false } /* * 2023.03.21 Handle server connection port mapping issues. * For SDK test pages only. If the user's network environment cannot connect to the mapped public IP and port from the internal network, * address processing for internal and external network access is required. * Explanation: * CloudMaster modifies HostConfig after startup. * HostConfig.Player: Internal network address * HostConfig.PlayerMapping: External network address */ let playerHost = HostConfig.Player; // Default to internal address if (location.protocol != 'file:') { // If accessed via HTTP service if (HostConfig.Player.indexOf(location.hostname) == -1 && HostConfig.PlayerMapping) { playerHost = HostConfig.PlayerMapping; // Use mapped address and port for WebSocket connection if URL is not internal and port mapping is enabled } } fdplayer = new DigitalTwinPlayer(playerHost, options); } window.addEventListener('resize', resize, true); window.addEventListener("load", init, true); ``` -------------------------------- ### Tag Event Handling: Update and Get Commands Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/webui_ex.html This function processes commands related to tag updates and retrieval. When a `Tag_Update` command is received, it attempts to get the tag. For a `Tag_Get` command, it displays the retrieved tag data. This function is designed to work with the `onEvent` callback from the DigitalTwinAPI. ```javascript function tick_next(o, frame) { if (o.command == CommandType.Tag_Update) { fdapi.tag.get(tagId, null); } else if (o.command == CommandType.Tag_Get) { document.getElementById('info2').innerText = `[Frame:${frame}] ` + JSON.stringify(o); } } ``` -------------------------------- ### Initialize DigitalTwinAPI with Options (JavaScript) Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html Demonstrates the new constructor for DigitalTwinAPI using an options object. The `host` parameter now requires an IP:Port format. This method is recommended for new implementations. ```javascript let apiOptions = { 'onReady': _onReady, 'onApiVersion': _onApiVersion, 'onEvent': _onEvent, 'onLog': log }; aircityApi = new DigitalTwinAPI(HostConfig.API, apiOptions); ``` -------------------------------- ### Viewport and Data Management: Get, Set Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/webui_ex.html This section covers functions for interacting with the viewport and external data. `getViewportSize` retrieves the current viewport dimensions, `setData` stores a key-value pair, and `getData` retrieves a value by its key. These functions use `FdExternal.getViewportSize`, `FdExternal.setData`, and `FdExternal.getData`. ```javascript async function getViewportSize() { let res = await FdExternal.getViewportSize(); alert(res); } function setData() { FdExternal.setData('name', 'iFreedo-元空间,新生活!'); } async function getData() { let val = await FdExternal.getData('name'); alert(val); } ``` -------------------------------- ### DigitalTwinPlayer Initialization with Logging (JavaScript) Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html Initializes the DigitalTwinPlayer, controlling the visibility of initialization logs and the 'show info' link. The 4th parameter controls the info link, and the 5th controls the log window. ```javascript new DigitalTwinPlayer(HostConfig.Player, 'player', HostConfig.Token, true, true); ``` -------------------------------- ### Polygon Data Structure Example Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html Provides an example of the data structure returned when retrieving detailed information about a Polygon object. This includes properties like ID, color, and style. ```json { "id": "polygon1", "groupId": "", "userData": "", "depthTest": 0, "color": [0.000000, 0.000000, 1.000000, 1.000000], "style": 0, "brightness": 1.000000 } ``` -------------------------------- ### Initialize Document Ready Functionality Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/HighlightArea.html This JavaScript snippet initializes various functionalities when the document is ready. It handles ID attribute replacements, code highlighting for preformatted text, table styling, and initializes search functionality. ```javascript $( function () { $( "[id*='$']" ).each( function () { var $this = $( this ); $this.attr( "id", $this.attr( "id" ).replace( "$", "\_\_" ) ); } ); $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { var $this = $( this ); var example = $this.find( "code" ); exampleText = example.html(); var lang = /\{@lang (.\*?)}\/.exec( exampleText ); if ( lang && lang\[1\] ) { exampleText = exampleText.replace( lang\[0\] , "" ); example.html( exampleText ); lang = lang\[1\]; } else { var langClassMatch = example.parent()\[0\] .className .match(/lang\-(\S+)/); lang = langClassMatch ? langClassMatch\[1\] : "javascript"; } if ( lang ) { $this .addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); Sunlight.highlightAll( { lineNumbers : true, showMenu : true, enableDoclinks : true } ); $.catchAnchorLinks( { navbarOffset: 10 } ); $( "#toc" ).toc( { anchorName: function ( i, heading, prefix ) { return $( heading ).attr( "id" ) || ( prefix + i ); }, selectors: "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4", showAndHide: false, smoothScrolling: true } ); $( "#main span\[id^='toc']" ).addClass( "toc-shim" ); $( '.dropdown-toggle' ).dropdown(); $( "table" ).each( function () { var $this = $( this ); $this.addClass('table'); } ); } ); $(document).ready(function() { SearcherDisplay.init(); }); ``` -------------------------------- ### Initialize DigitalTwinPlayer with Options (JavaScript) Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html Shows the updated constructor for DigitalTwinPlayer, accepting an options object. It illustrates how to configure player settings, including integrating API options directly for automatic DigitalTwinAPI instantiation in Cloud applications. The `host` parameter must be IP:Port. ```javascript let iid = getQueryVariable('iid'); let apiOptions = { 'onReady': _onReady, 'onApiVersion': _onApiVersion, 'onEvent': _onEvent, 'onLog': log }; //DigitalTwinPlayer let options; if (document.getElementById('player')) { //需要显示视频流 options = { 'iid': iid, //如果想连接指定的云渲染实例,可以指定这个参数 'domId': 'player', 'apiOptions': apiOptions, 'showStatus': true, 'showStartupInfo': true } } else { options = { 'iid': iid, //不带视频流的连接必须指定云渲染实例 'apiOptions': apiOptions }; } aircityPlayer = new DigitalTwinPlayer(HostConfig.Player, options); //对于Cloud应用可以不用显式的创建DigitalTwinAPI对象,只需要在DigitalTwinPlayer创建参数里指定apiOptions,就会自动创建。 aircityApi = aircityPlayer.getAPI(); ``` -------------------------------- ### Object ID Handling in TileLayer Pick Events Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html The 'ObjectID' returned in TileLayer pick events is clarified: for XML+OSG, it's the GUID from the XML; for RVT files, it's the GUID of the component; for 3dt from UE projects, it's the Actor's NameID. ```javascript // Event structure example: { "ID": "tileLayerId", "ObjectID": "uniqueObjectIdentifier", ... } ``` -------------------------------- ### DigitalTwinPlayer Initialization Properties Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html Describes the addition of the `useBuiltinCursors` property to the `DigitalTwinPlayer` constructor for cursor management and `urlExtraInfo` for WebSocket connection customization. ```APIDOC ## DigitalTwinPlayer Initialization ### Description Properties for initializing the DigitalTwinPlayer. ### Initialization Properties - `useBuiltinCursors` (boolean): Whether to use built-in cursors. Defaults to `true`. If `false`, the video window will always show an arrow cursor. - `urlExtraInfo` (object): Additional information to append to the WebSocket URL for authentication or other purposes. Example: `{ userToken:'jb3k5b345', appToken:'jbsfhjg4234' }` ``` -------------------------------- ### TileLayer Object: Set View Height Range and Get Properties (JavaScript) Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html The `TileLayer` object now includes `setViewHeightRange(id, minVisibleHeight, maxVisibleHeight)` to set the visible height range for layers. Additionally, the `get()` method's return value now includes `minVisibleHeight` and `maxVisibleHeight` properties. ```javascript tileLayer.setViewHeightRange(layerId, minHeight, maxHeight); const layerInfo = tileLayer.get(layerId); console.log(layerInfo.minVisibleHeight, layerInfo.maxVisibleHeight); ``` -------------------------------- ### DigitalTwinPlayer Initialization with URL Extra Info (JavaScript) Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html The `DigitalTwinPlayer` initialization options now support `urlExtraInfo`. This allows appending custom information, such as authentication tokens, to the WebSocket connection URL, enabling secure and personalized connections. ```javascript var player = new DigitalTwinPlayer('127.0.0.1:8080', { iid: '2471787814316', pid: 1, urlExtraInfo: { userToken: 'jb3k5b345', appToken: 'jbsfhjg4234' } }); ``` -------------------------------- ### Get Info Operations Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/global.html Endpoints for retrieving information about various entities like tags, radiation points, polygons, and tile layers. ```APIDOC ## Get Info Operations ### Description Endpoints for retrieving information about various entities within the system. ### Method POST ### Endpoint /api/get_info ### Parameters #### Request Body - **action** (string) - Required - The get info action to perform (e.g., `Tag_Get`, `RadiationPoint_Get`, `Polygon_Get`, `Polygon3D_Get`, `HighlightArea_Get`, `TileLayer_Get`, `Beam_Get`, `HeatMap_Get`, `Settings_GetMapMode`). - **parameters** (object) - Optional - Additional parameters specific to the action. ### Request Example ```json { "action": "Tag_Get", "parameters": { "tagId": "tag1" } } ``` ### Response #### Success Response (200) - **status** (string) - The result of the operation (e.g., "success", "error"). - **data** (object) - The requested information. #### Response Example ```json { "status": "success", "data": { "tagId": "tag1", "position": { "x": 10, "y": 20, "z": 30 }, "value": "Example Tag" } } ``` ``` -------------------------------- ### DigitalTwinPlayer Initialization Options Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html Details initialization options for `DigitalTwinPlayer`. The `options` object can include `actionEventHander` for input callbacks and `useHttps` for WebSocket connection security. Other properties like `playerHost` are also part of the initialization. ```javascript let playerHost = "192.168.1.29:8080"; let options = { actionEventHander: { 'onmousedown': e => { console.log('Mouse down'); }, 'onkeydown': e => { console.log('Key down'); } }, useHttps: false, // ... other options }; var aircityPlayer = new DigitalTwinPlayer(playerHost, options); ``` -------------------------------- ### Single Line Segment Intersection Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html Performs intersection detection for a single line segment within the camera's field of view. Returns the closest object if multiple objects are intersected, or ResourceNotFound if no intersection occurs. Requires start and end points of the line segment. Terrain height is obtained by intersecting from top to bottom, so the start point's Z must be greater than the end point's Z. ```javascript lineIntersect(start, end, fn); ``` -------------------------------- ### Configuration Tool: Instance Start/Stop and Real-time Status Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html The configuration tool has been enhanced to allow individual instance start/stop controls. Instances now have identifiers (IDs), and the instance list displays real-time operational status. Automatic GPU allocation is also supported for multi-GPU systems. ```javascript // Conceptual example of instance management: configTool.startInstance('instanceId'); configTool.stopInstance('instanceId'); // Instance status is displayed in the UI. ``` -------------------------------- ### Search Initialization (Custom) Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/CustomMesh.html Initializes the search functionality provided by `SearcherDisplay.init()`. This is specific to the project's search implementation. ```javascript $(document).ready(function() { SearcherDisplay.init(); }); ``` -------------------------------- ### Tile Layer API Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/global.html Endpoints for managing Tile Layers, including getting actor information, setting view height ranges, and handling flattened data. ```APIDOC ## TileLayer_GetActorInfoFromDB ### Description Gets detailed information about a tile layer from the database. ### Method GET ### Endpoint /tilelayer/getactorinfo ### Parameters #### Query Parameters - **id** (number) - Required - The ID of the tile layer. ### Response #### Success Response (200) - **actorInfo** (object) - Detailed information about the tile layer. ### Response Example ```json { "actorInfo": { "id": 1, "name": "Example Tile Layer", "type": "3DTILED" } } ``` ## TileLayer_SetViewHeightRange ### Description Sets the visible height range for a tile layer. ### Method POST ### Endpoint /tilelayer/setviewheightrange ### Parameters #### Request Body - **layerId** (number) - Required - The ID of the tile layer. - **minHeight** (number) - Required - The minimum visible height. - **maxHeight** (number) - Required - The maximum visible height. ### Request Example ```json { "layerId": 1, "minHeight": 0, "maxHeight": 1000 } ``` ## TileLayer_GetAllFlattenData ### Description Retrieves all flattened data for a tile layer. ### Method GET ### Endpoint /tilelayer/getallflatteneddata ### Parameters #### Query Parameters - **layerId** (number) - Required - The ID of the tile layer. ### Response #### Success Response (200) - **flattenedData** (array) - An array of flattened data objects. ### Response Example ```json { "flattenedData": [ { "id": 101, "property": "value" } ] } ``` ``` -------------------------------- ### DigitalTwinPlayer Initialization and Logging Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html Details on initializing the DigitalTwinPlayer, including options for controlling log visibility during the video stream initialization process. ```APIDOC ## DigitalTwinPlayer Initialization and Logging ### Description Provides information on initializing the `DigitalTwinPlayer`, focusing on the control of initialization log messages. Users can choose to display or hide these logs for better insight into the connection process. ### Method `new DigitalTwinPlayer(playerConfig, elementId, token, showInfoLink, showLogWindow)` ### Endpoint Constructor for `DigitalTwinPlayer` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript // Initialize player with logs visible (default behavior or explicitly true) let playerWithLogs = new DigitalTwinPlayer(HostConfig.Player, 'player', HostConfig.Token, true, true); // Initialize player with logs hidden let playerWithoutLogs = new DigitalTwinPlayer(HostConfig.Player, 'player', HostConfig.Token, true, false); // The 4th parameter controls the visibility of the 'Show Info' link in the bottom left. // The 5th parameter controls the visibility of the initialization log window. ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get Active Viewport Information (JavaScript) Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html Retrieves information about the currently active viewport. An optional callback function `fn` can be provided. ```javascript fdapi.misc.getActiveViewport(fn); ``` -------------------------------- ### Viewshed Analysis API Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html Enables starting and stopping viewshed analysis. The `createViewshed` and `deleteViewshed` methods are part of the `tools` object and supersede the older `fdapi.viewshed`. ```APIDOC ## POST /api/viewshed ### Description Manages viewshed analysis operations. Use `startViewshedAnalysis` to begin an analysis and `stopViewshedAnalysis` to terminate it. This replaces the previously deprecated `fdapi.viewshed` functionality. ### Method POST ### Endpoint /api/viewshed ### Parameters #### Request Body - **command** (string) - Required - The command type, "startViewshedAnalysis" or "stopViewshedAnalysis". ### Request Example ```json { "command": "startViewshedAnalysis" } ``` ### Response #### Success Response (200) - **result** (integer) - Indicates success (0) or failure. - **resultMessage** (string) - A message describing the result of the operation. #### Response Example ```json { "command": 103, "timestamp": 1616134672222, "callbackIndex": 3, "result": 0, "resultMessage": "OK" } ``` ``` -------------------------------- ### JQuery Code Block Highlighting Initialization Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/SignalWave.html This JQuery code initializes syntax highlighting for pre-formatted code blocks within tutorial, readme, and general pre tags. It attempts to detect the language and applies appropriate styling using the Sunlight highlighter. ```javascript $( function () { $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { var $this = $( this ); var example = $this.find( "code" ); exampleText = example.html(); var lang = /{@lang (.*?)}/.exec( exampleText ); if ( lang && lang[1] ) { exampleText = exampleText.replace( lang[0], "" ); example.html( exampleText ); lang = lang[1]; } else { var langClassMatch = example.parent()[0].className.match(/lang-(\S+)/); lang = langClassMatch ? langClassMatch[1] : "javascript"; } if ( lang ) { $this.addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); Sunlight.highlightAll( { lineNumbers : true, showMenu : true, enableDoclinks : true } ); } ); ``` -------------------------------- ### Weather API Endpoints Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/quicksearch.html This section details the available endpoints for interacting with the Weather API, including methods for getting and setting weather parameters. ```APIDOC ## Weather Class Provides weather-related parameter settings and retrieval interfaces. ### Methods #### `disableRainSnow()` **Description**: Disables rain and snow effects. **Method**: `protected` **Endpoint**: `new Weather().disableRainSnow(fn)` **Parameters**: * **fn** (function) - Optional callback function. #### `getDateTime(fn)` **Description**: Retrieves the current date and time settings. **Method**: `protected` **Endpoint**: `new Weather().getDateTime(fn)` **Parameters**: * **fn** (function) - Optional callback function. (See secondary development for asynchronous API call methods). **Response Example**: ```json { "hour": 9, "minute": 0, "year": 2021, "month": 10, "day": 28, "latitude": 20.000000, "longitude": 116.000000, "timeZone": 8.000000, "daynightLoop": 0, "dayLength": 3.000000 } ``` #### `getParams(fn)` **Description**: Retrieves current weather parameters. **Method**: `protected` **Endpoint**: `new Weather().getParams(fn)` **Parameters**: * **fn** (function) - Optional callback function. **Response Example**: ```json { "darkMode": 0, "cloudDensity": 0.500000, "cloudThickness": 2.00000, "fogDensity": 0.100000, "fogGroundDensity": 0.000000, "fogGroundHeight": 0.000000, "rainsnow": 0, "rainsnowStrength": 0.000000, "rainsnowSpeed": 0.300000, "raindropSize": 0.200000, "snowflakeSize": 0.800000, "sunSize": 25, "moonSize": 30, "sunIntensity": 0.7, "moonIntensity": 30, "ambientLightIntensity": 0.3, "temperature": 8500, "shadowQuality": 2, "shadowDistance": 2000 } ``` #### `setAmbientLightIntensity(ambientLightIntensity, fn)` **Description**: Sets the ambient light intensity. **Method**: `protected` **Endpoint**: `new Weather().setAmbientLightIntensity(ambientLightIntensity, fn)` **Parameters**: * **ambientLightIntensity** (number) - Ambient light intensity, range: [0~5]. * **fn** (function) - Optional callback function. #### `setCloudDensity(cloudDensity, fn)` **Description**: Sets the density of cloud layers. **Method**: `protected` **Endpoint**: `new Weather().setCloudDensity(cloudDensity, fn)` **Parameters**: * **cloudDensity** (number) - Cloud density, range: [0~1.0]. * **fn** (function) - Optional callback function. #### `setCloudHeight(cloudHeight, fn)` **Description**: Sets the height of cloud layers. **Method**: `protected` **Endpoint**: `new Weather().setCloudHeight(cloudHeight, fn)` **Parameters**: * **cloudHeight** (number) - Cloud height, range: [0~20] km. * **fn** (function) - Optional callback function. #### `setCloudParam(cloudsColor, cloudsAltitude, cloudShadowStrength, fn)` **Description**: Sets cloud effect parameters. **Method**: `protected` **Endpoint**: `new Weather().setCloudParam(cloudsColor, cloudsAltitude, cloudShadowStrength, fn)` **Parameters**: * **cloudsColor** (number) - Cloud color (supports four formats). * **cloudsAltitude** (number) - Cloud altitude in kilometers, range: [0~8km]. * **cloudShadowStrength** (number) - Cloud shadow strength, range: [0~1]. * **fn** (function) - Optional callback function. #### `setCloudThickness(cloudThickness, fn)` **Description**: Sets the thickness of cloud layers. **Method**: `protected` **Endpoint**: `new Weather().setCloudThickness(cloudThickness, fn)` **Parameters**: * **cloudThickness** (number) - Cloud thickness, range: [0~0.5]. * **fn** (function) - Optional callback function. #### `setDarkMode(bDark, fn)` **Description**: Sets whether to enter dark mode. **Method**: `protected` **Endpoint**: `new Weather().setDarkMode(bDark, fn)` **Parameters**: * **bDark** (boolean) - Boolean value. * **fn** (function) - Optional callback function. #### `setDateTime(year, month, day, hour, minute, daynightLoop, fn)` **Description**: Sets the date and time. **Method**: `protected` **Endpoint**: `new Weather().setDateTime(year, month, day, hour, minute, daynightLoop, fn)` **Parameters**: * **year** (number) - Year. * **month** (number) - Month. * **day** (number) - Day. * **hour** (number) - Hour. * **minute** (number) - Minute. * **daynightLoop** (boolean) - Whether to loop day and night. If true, simulates one day cycle in three minutes. * **fn** (function) - Optional callback function. #### `setFogParam(fogDensity, fogColor, fogHeightFalloff, fogStartDistance, fogOpacity, fn)` **Description**: Sets fog effect parameters. **Method**: `protected` **Endpoint**: `new Weather().setFogParam(fogDensity, fogColor, fogHeightFalloff, fogStartDistance, fogOpacity, fn)` **Parameters**: * **fogDensity** (number) - Fog concentration, range: [0~2.0]. * **fogColor** (number) - Fog color (supports four formats). * **fogHeightFalloff** (number) - Height falloff, range: [0~2]. * **fogStartDistance** (number) - Fog start distance, range: [0~10000]. * **fogOpacity** (number) - Opacity, range: [0.00~1.00]. * **fn** (function) - Optional callback function. #### `setHighCloud(highCloudLayerCoverage, highCloudWindSpeed, highCloudWindDirection, cirrusCloudDensity, cirrostratusCloudDensity, cirrocumulusCloudDensity, fn)` **Description**: Sets high cloud layer effect parameters. **Method**: `protected` **Endpoint**: `new Weather().setHighCloud(highCloudLayerCoverage, highCloudWindSpeed, highCloudWindDirection, cirrusCloudDensity, cirrostratusCloudDensity, cirrocumulusCloudDensity, fn)` **Parameters**: * **highCloudLayerCoverage** (number) - Coverage, range: [0~1]. * **highCloudWindSpeed** (number) - Wind speed, range: [0~100]. * **highCloudWindDirection** (number) - Wind direction, range: [0~360]. * **cirrusCloudDensity** (number) - Cirrus cloud density, range: [0~1]. * **cirrostratusCloudDensity** (number) - Cirrostratus cloud density, range: [0~1]. * **cirrocumulusCloudDensity** (number) - Cirrocumulus cloud density, range: [0~1]. * **fn** (function) - Optional callback function. #### `setLowCloud(lowCloudCoverage, lowCloudDensity, lowCloudHeight, lowCloudWindSpeed, lowCloudWindDirection, fn)` **Description**: Sets low cloud layer effect parameters. **Method**: `protected` **Endpoint**: `new Weather().setLowCloud(lowCloudCoverage, lowCloudDensity, lowCloudHeight, lowCloudWindSpeed, lowCloudWindDirection, fn)` **Parameters**: * **lowCloudCoverage** (number) - Coverage, range: [0~1]. * **lowCloudDensity** (number) - Density, range: [0~1]. * **lowCloudHeight** (number) - Thickness, range: [0~0.5]. * **lowCloudWindSpeed** (number) - Wind speed, range: [0~100]. * **lowCloudWindDirection** (number) - Wind direction, range: [0~360]. * **fn** (function) - Optional callback function. #### `setMoonIntensity(moonIntensity, fn)` **Description**: Sets the moon light intensity. **Method**: `protected` **Endpoint**: `new Weather().setMoonIntensity(moonIntensity, fn)` **Parameters**: * **moonIntensity** (number) - Moon light intensity, range: [0~1]. * **fn** (function) - Optional callback function. #### `setMoonSize(moonSize, fn)` **Description**: Sets the moon size. **Method**: `protected` **Endpoint**: `new Weather().setMoonSize(moonSize, fn)` **Parameters**: * **moonSize** (number) - Moon size, range: [0~10]. * **fn** (function) - Optional callback function. #### `setRainParam(strength, speed, raindropSize, rainColor, alignCamera, overcastStrength, fn)` **Description**: Sets rain effect parameters. Note: Before enabling rain effects, set the cloud thickness and density. **Method**: `protected` **Endpoint**: `new Weather().setRainParam(strength, speed, raindropSize, rainColor, alignCamera, overcastStrength, fn)` **Parameters**: * **strength** (number) - Rain effect strength (must be greater than 0 for rain effect), range: [0~1.0]. * **speed** (number) - Rain effect speed, range: [0~1.0]. * **raindropSize** (number) - Raindrop size, range: [0~1.0]. * **rainColor** (Color) - Raindrop color (supports four formats). * **alignCamera** (number) - Camera alignment with movement, range: [0~1.0]. * **overcastStrength** (number) - Overcast level, range: [0~1.0]. * **fn** (function) - Optional callback function. ``` -------------------------------- ### Get Camera Information Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/popup_interact.html Asynchronously retrieves camera information using fdapi.camera.get() and displays the result as a JSON string in an HTML element with the ID 'info'. ```javascript async function getCamera() { let o = await fdapi.camera.get(); document.getElementById('info').innerText = JSON.stringify(o); } ``` -------------------------------- ### HeatMap3D Object Methods Source: https://github.com/nangongwentian-fe/dtscloudapi6.1/blob/main/doc/tutorial-API_Revision.html This section details the newly added methods for the HeatMap3D object, including add, update, delete, get, focus, hide, show, and clear. ```APIDOC ## HeatMap3D Object Methods ### Description Methods for managing HeatMap3D objects. ### Methods - `add()`: Adds a HeatMap3D object. - `update()`: Modifies an existing HeatMap3D object. - `delete()`: Removes a HeatMap3D object. - `get()`: Retrieves a HeatMap3D object. - `focus()`: Centers the view on a HeatMap3D object. - `hide()`: Hides a HeatMap3D object. - `show()`: Shows a hidden HeatMap3D object. - `clear()`: Removes all HeatMap3D objects. ```