### Initialize and Start FdTransformHelper
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdMicroApp
Demonstrates how to create a Freedo viewer, load a 3D model tileset, and then initialize and start the FdTransformHelper to move the model. This involves creating a viewer, adding a model, and then instantiating FdTransformHelper with the viewer.
```javascript
var viewer = Freedo.FdApp.createDefaultViewer('freedoContainer');
var tileset = viewer.scene.primitives.add(new Freedo.FreedoPModelset({
url : '../../sampleData/文化室2018z'
}));
tileset.readyPromise.then(function(tileset) {
viewer.camera.viewBoundingSphere(tileset.boundingSphere, new Freedo.HeadingPitchRange(0, -0.5, 0));
var th = new Freedo.FdMicroApp.FdTransformHelper(viewer);
th.setData([tileset]);
th.start('MOVE');
});
```
--------------------------------
### FdTransformHelper Class Overview
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdMicroApp
Provides an overview of the FdTransformHelper class and its constructor, along with an example of its usage in initializing and manipulating a 3D model viewer.
```APIDOC
## Class: FdTransformHelper
### Description
Model editor class for transforming and manipulating 3D models.
### Constructor
`new FdTransformHelper(viewer)`
### Example
```javascript
var viewer = Freedo.FdApp.createDefaultViewer('freedoContainer');
var tileset = viewer.scene.primitives.add(new Freedo.FreedoPModelset({
url : '../../sampleData/文化室2018z'
}));
tileset.readyPromise.then(function(tileset) {
viewer.camera.viewBoundingSphere(tileset.boundingSphere, new Freedo.HeadingPitchRange(0, -0.5, 0));
var th = new Freedo.FdMicroApp.FdTransformHelper(viewer);
th.setData([tileset]);
th.start('MOVE');
});
```
```
--------------------------------
### Quick Start: Create a 3D Environment
Source: https://forweb.gbim360.com/latest/freedox/Documentation/index
This HTML snippet demonstrates how to quickly set up a 3D environment using the Freedo Holo3D for Web API. It includes necessary script includes for Freedo.js, lodash, FreedoX.js, and Sandcastle-header.js, along with basic HTML structure and initialization of the Freedo viewer.
```html
快速创建三维环境
Loading...
```
--------------------------------
### Initialize and Use FdVolumn for Earthwork Analysis
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdTools
Demonstrates how to create a Freedo viewer, instantiate FdVolumn, start the analysis, set the base height (either by picking or direct value), and handle analysis completion events. It also shows how to destroy the instance.
```javascript
let viewer = Freedo.FdApp.createDefaultViewer('freedoContainer');
// ...
let volm = new Freedo.FdTools.FdVolumn(viewer);
volm.start();
// 可以通过鼠标点选获取基准高度:
volm.pickHeight();
// 也可以直接设置指定的基准高度值:
volm.baseHeight = 100;
// 获取分析结果:
volm.on(function(eventType, eventArg) {
if (eventType === 'PMTAdd') {
// ...
}
});
// 销毁
volm.destroy();
```
--------------------------------
### getEnablePicking
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Gets the current state of the picking (selection) switch.
```APIDOC
## getEnablePicking
### Description
Gets the current state of the picking (selection) switch.
### Method
Not specified (assumed to be a utility function within the library)
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
#### Success Response (200)
- **return** (Boolean) - True if picking is enabled, false otherwise.
#### Response Example
```json
{
"return": true
}
```
```
--------------------------------
### Toggle Picking/Selection (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Provides methods to get and set the picking (selection) state of the viewer. `getEnablePicking()` retrieves the current state, while `setEnablePicking(enabled)` enables or disables picking.
```javascript
getEnablePicking()
```
```javascript
setEnablePicking(enabled)
```
--------------------------------
### Traverse Parent Tiles with Callback
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
This function traverses parent tiles in a hierarchical structure, starting from a given coordinate (x, y, z), and invokes a callback function for each parent tile. This is helpful for navigating up the tile hierarchy.
```javascript
traversalParentTile(x, y, z, callback)
```
--------------------------------
### Control Transform Helper State
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdMicroApp
Methods to control the state and behavior of the FdTransformHelper, including starting transformations, canceling operations, resetting transformations, and hiding the manipulation axes.
```javascript
start(type)
cancel()
resetTransform()
hideAxis()
```
--------------------------------
### Get Transformation Matrix for Tileset
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdMicroApp
Calculates and returns the transformation matrix for a 3D model tileset based on provided translation, rotation, and scaling parameters. It also supports specifying optional center points for the transformation.
```javascript
getMatrixOfTileset(tileSet, TMoveX, TMoveY, TMoveZ, THeading, TPitch, TRoll, TScaleX, TScaleY, TScaleZ [, XCenter] [, YCenter] [, ZCenter])
```
--------------------------------
### Get Current Camera Information (Freedo)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Retrieves the current position and orientation of the camera. Returns an array containing longitude, latitude, height, heading, pitch, and roll.
```javascript
var cameraInfo = getCurrentCameraInfo(camera);
```
--------------------------------
### FdMath: Get View Position Information
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdMisc
Retrieves information about the observer's viewpoint relative to a target point. Both points are provided as geographic coordinates (longitude, latitude, altitude).
```javascript
FdMath.getViewPosInfo(viewPos, targetPos)
```
--------------------------------
### Get Component Bounding Box (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Retrieves the bounding box information for a given component ID. It returns an object containing the min and max points of the bounding box if found, or undefined otherwise.
```javascript
getComponentBoundingBox(componentId)
```
--------------------------------
### FdMath: Get Screen Coordinates of a Point
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdMisc
Retrieves the client-area coordinates (screen position) of a given geographical point within a scene. Takes the scene object and the point's longitude, latitude, and altitude.
```javascript
FdMath.getScreenPos(scene, pos)
```
--------------------------------
### FdVolumn Constructor and Usage
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdTools
Demonstrates how to create an instance of FdVolumn, set analysis parameters, and handle events.
```APIDOC
## FdVolumn Constructor and Usage
### Description
This section details the constructor for the FdVolumn class and provides examples of its usage, including setting base height, starting analysis, and handling results.
### Constructor
`new FdVolumn(viewer [, option])`
- **viewer** (Viewer) - The viewer instance.
- **option** (Object, optional) - Configuration options.
- **id** (String, optional) - The instance ID.
- **accuracy** (Number, optional) - The ratio of total area to the smallest triangle area. Defaults to 400.
- **baseHeight** (Number, optional) - The base height for volume calculation. Defaults to the lowest point of the triangulated mesh.
- **wallColor** (Color, optional) - The color of the boundary walls.
- **wallOutlineColor** (Color, optional) - The outline color of the boundary walls.
- **planeColor** (Color, optional) - The color of the base plane.
- **planeOutlineColor** (Color, optional) - The outline color of the base plane.
### Methods
- `start()`: Begins the process of selecting points to define the analysis area.
- `pickHeight([val])`: Allows picking the base height using the mouse. `val` (Boolean, optional, defaults to true) enables picking.
- `setAccuracy(val)`: Sets the analysis accuracy. `val` (Number) is the ratio of projected area to triangle area; higher values increase precision but may impact performance.
- `setBaseHeight(val)`: Sets the base height value for volume calculation. `val` (Number).
- `setShowGrids([val])`: Toggles the display of the triangulated mesh. `val` (Boolean, optional, defaults to true) controls visibility.
- `on(listener [, scope])`: Registers an event listener. `listener` (FdVolumnCallback) is the function to execute on event. `scope` (Object, optional) is the binding object for the listener.
- `destroy()`: Destroys the FdVolumn instance.
### Example Usage
```javascript
let viewer = Freedo.FdApp.createDefaultViewer('freedoContainer');
// ...
let volm = new Freedo.FdTools.FdVolumn(viewer);
volm.start();
// Pick base height using mouse:
volm.pickHeight();
// Or set a specific base height:
volm.baseHeight = 100;
// Get analysis results:
volm.on(function(eventType, eventArg) {
if (eventType === 'PMTAdd') {
// ...
}
});
// Destroy the instance:
volm.destroy();
```
### Type Definitions
#### FdVolumnCallback(eventType, eventArg)
- **eventType** (String): Event types include 'Start', 'AnaFinished', 'PMTAdd'.
- **eventArg**: 'Start' has no return value. 'AnaFinished' returns analysis results.
```
--------------------------------
### FdTransformHelper Methods
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdMicroApp
Detailed documentation for each method available in the FdTransformHelper class.
```APIDOC
## Methods
### addPModel(pModel)
#### Description
Adds a PModel object to the helper.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
#### Parameters
##### Path Parameters
None
##### Query Parameters
None
##### Request Body
- **pModel** (PModel) - Required - The PModel object to add.
### applyTransformToTileset(tileSet, TMoveX, TMoveY, TMoveZ, THeading, TPitch, TRoll, TScaleX, TScaleY, TScaleZ [, XCenter] [, YCenter] [, ZCenter])
#### Description
Applies transformations to a tileset based on the provided parameters.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
#### Parameters
##### Path Parameters
None
##### Query Parameters
None
##### Request Body
- **tileSet** (Object) - Required - The tileset to transform.
- **TMoveX** (Number) - Required - Longitude offset from origin, in radians.
- **TMoveY** (Number) - Required - Latitude offset from origin, in radians.
- **TMoveZ** (Number) - Required - Final elevation value in meters.
- **THeading** (Number) - Required - Heading in degrees.
- **TPitch** (Number) - Required - Pitch in degrees.
- **TRoll** (Number) - Required - Roll in degrees.
- **TScaleX** (Number) - Required - Scale factor in the X-axis.
- **TScaleY** (Number) - Required - Scale factor in the Y-axis.
- **TScaleZ** (Number) - Required - Scale factor in the Z-axis.
- **XCenter** (Number) - Optional - Longitude of the operation point in radians.
- **YCenter** (Number) - Optional - Latitude of the operation point in radians.
- **ZCenter** (Number) - Optional - Elevation of the operation point in meters.
### cancel()
#### Description
Exits model editing mode.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
### dispose()
#### Description
Disposes of all resources held by the helper.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
### getData()
#### Description
Retrieves the current data, including tilesets and their transformation matrices.
#### Returns
- **Object** - An array of objects, each containing `tileset` and `modelMatrix`.
#### Method
GET
#### Endpoint
N/A (Method of a class instance)
### getMatrixOfTileset(tileSet, TMoveX, TMoveY, TMoveZ, THeading, TPitch, TRoll, TScaleX, TScaleY, TScaleZ [, XCenter] [, YCenter] [, ZCenter])
#### Description
Calculates the transformation matrix for a tileset based on the provided parameters.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
#### Parameters
##### Path Parameters
None
##### Query Parameters
None
##### Request Body
- **tileSet** (Object) - Required - The tileset to get the matrix for.
- **TMoveX** (Number) - Required - Longitude offset from origin, in radians.
- **TMoveY** (Number) - Required - Latitude offset from origin, in radians.
- **TMoveZ** (Number) - Required - Final elevation value in meters.
- **THeading** (Number) - Required - Heading in degrees.
- **TPitch** (Number) - Required - Pitch in degrees.
- **TRoll** (Number) - Required - Roll in degrees.
- **TScaleX** (Number) - Required - Scale factor in the X-axis.
- **TScaleY** (Number) - Required - Scale factor in the Y-axis.
- **TScaleZ** (Number) - Required - Scale factor in the Z-axis.
- **XCenter** (Number) - Optional - Longitude of the operation point in radians.
- **YCenter** (Number) - Optional - Latitude of the operation point in radians.
- **ZCenter** (Number) - Optional - Elevation of the operation point in meters.
### hideAxis()
#### Description
Hides the transformation gizmo/axis.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
### on(listener [, scope])
#### Description
Registers an event listener for transformation events.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
#### Parameters
##### Path Parameters
None
##### Query Parameters
None
##### Request Body
- **listener** (FdMicroApp.FdTransformHelper~FdTransformHelperCallback) - Required - The callback function to execute when an event is triggered.
- **scope** (Object) - Optional - The object to bind the listener function to.
#### Returns
- **Freedo.Event~RemoveCallback** - A function that can be called to unregister the listener.
### removePModel(pModel)
#### Description
Removes a PModel object from the helper.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
#### Parameters
##### Path Parameters
None
##### Query Parameters
None
##### Request Body
- **pModel** (PModel) - Required - The PModel object to remove.
### reset()
#### Description
Resets the helper to its initial state.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
### resetTransform()
#### Description
Resets the transformation matrix of the scene.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
### saveTransform()
#### Description
Saves the current transformation matrix.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
### setArg(argName, argValue)
#### Description
Sets a specific argument value for the helper.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
#### Parameters
##### Path Parameters
None
##### Query Parameters
None
##### Request Body
- **argName** (String) - Required - The name of the argument.
- **argValue** (String) - Required - The value of the argument.
### setData(aPModel)
#### Description
Sets the array of PModel objects for the helper.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
#### Parameters
##### Path Parameters
None
##### Query Parameters
None
##### Request Body
- **aPModel** (Array) - Required - An array of PModelSet objects.
### setModel(aPModel)
#### Description
Sets the array of PModel objects for the helper.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
#### Parameters
##### Path Parameters
None
##### Query Parameters
None
##### Request Body
- **aPModel** (Array) - Required - An array of PModelSet objects.
### start(type)
#### Description
Activates model editing mode with the specified type.
#### Method
POST
#### Endpoint
N/A (Method of a class instance)
#### Parameters
##### Path Parameters
None
##### Query Parameters
None
##### Request Body
- **type** (String) - Required - The type of editing: 'MOVE', 'SCALE', or 'ROTATE'.
```
--------------------------------
### GLTFLoader
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Initializes the GLTFLoader with authors.
```APIDOC
## GLTFLoader
### Description
Initializes the GLTFLoader.
### Method
Constructor
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### DRACOLoader Initialization (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Initializes the DRACOLoader for handling Draco-compressed glTF models. It requires a THREE.LoadingManager to manage the loading process and provides support for efficient mesh compression.
```javascript
DRACOLoader(manager)
```
--------------------------------
### DRACOLoader
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Initializes the DRACOLoader with a LoadingManager.
```APIDOC
## DRACOLoader
### Description
Initializes the DRACOLoader with a LoadingManager.
### Method
Constructor
### Endpoint
Not applicable
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```json
{
"manager": "THREE.LoadingManager"
}
```
### Response
None
```
--------------------------------
### FdView Constructor (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdWidgets
Initializes a new FdView instance. It requires a viewer and a viewPointsManager as parameters.
```javascript
new FdView(viewer, viewPointsManager)
```
--------------------------------
### showAllComponents
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Controls the visibility of all components in the viewer.
```APIDOC
## showAllComponents
### Description
Controls the visibility of all components in the viewer.
### Method
Not specified (assumed to be a utility function within the library)
### Endpoint
Not applicable
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```json
{
"visible": "Boolean"
}
```
### Response
#### Success Response (200)
None (function triggers visual change in viewer)
#### Response Example
None
```
--------------------------------
### resize
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Callback function for window resize events.
```APIDOC
## resize
### Description
Callback function for window resize events.
### Method
Not specified (assumed to be a callback function)
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### GifMaterialProperty Methods
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdEffect
API documentation for the methods available on the GifMaterialProperty object.
```APIDOC
## GifMaterialProperty Methods
### destroy()
#### Description
Destroys the GifMaterialProperty instance. It's recommended to call this before removing the associated primitive or entity.
### equals( [other])
#### Description
Compares this property to the provided property and returns `true` if they are equal, `false` otherwise.
##### Parameters:
Name | Type | Argument | Description
---|---|---|---
`other` | Property | `` | The other property to compare with.
##### Returns:
`true` if the properties are equal, `false` otherwise.
Type: Boolean
### getData()
#### Description
Retrieves the data associated with the GIF material.
##### Returns:
An object containing frame data, timings, dimensions, and frame count.
```json
{
"frames": [image, image, image, ...], // Array of image frames
"times": [400, 400, ...], // Interval times between frames
"width": 300, // Width of the GIF frames
"counts": 20 // Number of frames in the GIF
}
```
Type: Object
### getMaterial()
#### Description
When using the primitive method, this function retrieves the material generated from GIF frames, suitable for assigning to `MaterialAppearance`.
##### Returns:
A dynamic material created from the GIF frames.
Type: Material
### getTexture()
#### Description
Retrieves the dynamic texture generated from the GIF frames.
##### Returns:
A dynamic texture created from the GIF frames.
Type: Texture
### getType(time)
#### Description
Gets the type of material at a specific time.
##### Parameters:
Name | Type | Description
---|---|---
`time` | JulianDate | The time at which to retrieve the material type.
##### Returns:
The type of the material.
Type: String
### getValue(time [, result])
#### Description
Gets the value of the property at a specified time.
##### Parameters:
Name | Type | Argument | Description
---|---|---|---
`time` | JulianDate | | The time for which to retrieve the value.
`result` | Object | `` | An existing object to store the value into. If omitted, a new instance is created.
##### Returns:
The modified result parameter or a new instance if `result` was not supplied.
Type: Object
### nextFrame()
#### Description
Displays the next frame of the GIF animation when it is paused.
### pause()
#### Description
Pauses the GIF animation playback.
### play()
#### Description
Resumes the GIF animation playback.
### toggle()
#### Description
Toggles the playback state between play and pause.
```
--------------------------------
### SingleViewerControls
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Initializes single viewer controls. Likely used for standard viewing configurations.
```APIDOC
## SingleViewerControls
### Description
Initializes single viewer controls.
### Method
Constructor
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### showComponents
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Controls the visibility of specific components based on an array of names.
```APIDOC
## showComponents
### Description
Controls the visibility of specific components based on an array of names. If the array is empty, it affects all components.
### Method
Not specified (assumed to be a utility function within the library)
### Endpoint
Not applicable
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```json
{
"componentsArray": "Array",
"visible": "Boolean"
}
```
### Response
#### Success Response (200)
None (function triggers visual change in viewer)
#### Response Example
None
```
--------------------------------
### Show All Components (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Controls the visibility of all components in the scene. Passing `true` makes all components visible, while `false` hides them.
```javascript
showAllComponents(visible)
```
--------------------------------
### Highlight and Show/Hide Components (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Methods for visually manipulating components within the scene. `highlightComponents` applies a specified color to an array of components, while `showComponents` toggles the visibility of components based on an array of names and a boolean flag.
```javascript
highlightComponents(componentsArray, color)
```
```javascript
showComponents(componentsArray, visible)
```
--------------------------------
### Go to Model (Freedo)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Navigates the camera to focus on a specified GLTF model. Requires a viewer object and the model object.
```javascript
Freedo.FdCamera.gotoModel(viewer, tileset);
```
--------------------------------
### GifMaterialProperty Initialization and Usage
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdEffect
Demonstrates how to initialize GifMaterialProperty and use it with both primitive and entity-based model additions in a Freedo viewer. It shows asynchronous handling via promises for material retrieval and model integration.
```javascript
// 1. use primitive:
let viewer = Freedo.FdApp.createDefaultViewer('freedoContainer');
let src = './example.gif';
let gmp = new Freedo.FdEffect.GifMaterialProperty(viewer, { src });
gmp.promise.then(() => {
let material = gmp.getMaterial();
let primitive = new Freedo.Primitive({
geometryInstances: new Freedo.GeometryInstance({
geometry: new Freedo.RectangleGeometry({
rectangle: Freedo.Rectangle.fromDegrees(100, 30, 120, 40),
vertexFormat: Freedo.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,
height: 100000
})
}),
appearance: new Freedo.MaterialAppearance({ material: material }),
});
viewer.scene.primitives.add(primitive);
}).catch(err => { throw err; });
// 2. use entity:
let gmp2 = new Freedo.FdEffect.GifMaterialProperty(viewer, { src });
gmp2.promise.then(() => {
let entity = viewer.entities.add({
position: Freedo.Cartesian3.fromDegrees(103.9526, 30.7617, 300000),
ellipsoid: {
radii: new Freedo.Cartesian3(240000, 240000, 240000),
material: gmp2
}
})
}).catch(err => { throw err });
```
--------------------------------
### GLTFLightsExtension
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Represents the PENDING Lights extension for glTF.
```APIDOC
## GLTFLightsExtension
### Description
Lights Extension for glTF (Specification PENDING).
### Method
Not specified (likely a class or constructor)
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### FdCamera - Capture Screen
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Captures a screenshot of the current scene and provides the image data via a callback function.
```APIDOC
## POST /api/FdCamera/capture
### Description
Captures a screenshot of the current scene and provides the image data via a callback function.
### Method
POST
### Endpoint
/api/FdCamera/capture
### Parameters
#### Path Parameters
None
#### Query Parameters
* **scene** (Freedo.Scene) - Required - The scene object.
* **captureResultFunc** (Callback) - Required - A callback function that receives the captured image data (base64 string), width, and height.
* **width** (Number) - Optional - The desired image width. Defaults to 128.
* **height** (Number) - Optional - The desired image height. Defaults to 128.
### Request Example
```javascript
function saveCapturedScreenImage(imageData, width, height) {}
var scene = viewer.scene;
Freedo.FdCamera.capture(scene, saveCapturedScreenImage, width, height);
```
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
```
--------------------------------
### FdCamera - Aerial View
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Triggers a bird's-eye view of China with customizable bounds and duration.
```APIDOC
## POST /api/FdCamera/aerialView
### Description
Triggers a bird's-eye view of China with customizable bounds and duration.
### Method
POST
### Endpoint
/api/FdCamera/aerialView
### Parameters
#### Path Parameters
None
#### Query Parameters
* **scene** (Freedo.Scene) - Required - The scene object.
* **duration** (Number) - Optional - The flight duration in seconds. Defaults to an automatically calculated duration based on flight distance.
* **west** (Number) - Optional - The western longitude boundary (degrees, range: [-180.0, 180.0]). Defaults to 80.
* **south** (Number) - Optional - The southern latitude boundary (degrees, range: [-90.0, 90.0]). Defaults to 5.
* **east** (Number) - Optional - The eastern longitude boundary (degrees, range: [-180.0, 180.0]). Defaults to 135.
* **north** (Number) - Optional - The northern latitude boundary (degrees, range: [-90.0, 90.0]). Defaults to 55.
### Request Example
```javascript
var scene = viewer.scene;
Freedo.FdCamera.aerialView(scene); // Can omit the last 5 parameters
// Freedo.FdCamera.aerialView(scene, 2, 80, 5, 135, 55); // Default China view
```
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
```
--------------------------------
### highlightComponents
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Highlights specified components in the viewer with a given color.
```APIDOC
## highlightComponents
### Description
Highlights specified components in the viewer with a given color.
### Method
Not specified (assumed to be a utility function within the library)
### Endpoint
Not applicable
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```json
{
"componentsArray": "Array",
"color": "THREE.Vector3"
}
```
### Response
#### Success Response (200)
None (function triggers visual change in viewer)
#### Response Example
None
```
--------------------------------
### Clone glTF PBR Specular-Glossiness Material (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Clones a THREE.ShaderMaterial that uses the glTF PBR Specular-Glossiness extension. Standard ShaderMaterial copying is insufficient for these materials, so this method ensures all relevant properties are copied correctly for seamless material duplication.
```javascript
cloneMaterial(source)
```
--------------------------------
### Capture Screen with FdCamera in JavaScript
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Captures the current view of the scene and returns the image data via a callback function. Optional width and height parameters can specify the output image dimensions. The callback receives the image data as a base64 string along with its dimensions.
```javascript
function saveCapturedScreenImage(imageData, width, height){}
var scene = viewer.scene;
Freedo.FdCamera.capture(scene, saveCapturedScreenImage, width, height);
```
--------------------------------
### GifMaterialProperty Constructor
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdEffect
Initializes a new instance of GifMaterialProperty to display GIF animations. It uses asynchronous operations, returning a promise that resolves with the material.
```APIDOC
## GifMaterialProperty Constructor
### Description
Initializes a new instance of GifMaterialProperty for displaying GIF animations. This operation is asynchronous and returns a promise for subsequent operations.
### Method
`new GifMaterialProperty(viewer, options)`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
##### Parameters:
Name | Type | Description
---|---|---
`viewer` | viewer | The viewer instance.
`options` | Object | Configuration options for the GIF material.
###### Properties
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
| `src` | String | | | (Required) The URL of the GIF image. |
| `repeat` | Cartesian2 | `` | `new Cartesian2(1.0, 1.0)` | (Optional, for entity usage) Specifies the repeat count for the image in each direction. |
| `color` | Color | `` | `Freedo.Color.WHITE` | (Optional, for entity usage) The color to apply to the image. |
| `transparent` | Boolean | `` | `false` | (Optional, for entity usage) Whether the image includes transparency. |
### Request Example
```javascript
// 1. Use with primitive:
let viewer = Freedo.FdApp.createDefaultViewer('freedoContainer');
let src = './example.gif';
let gmp = new Freedo.FdEffect.GifMaterialProperty(viewer, { src });
gmp.promise.then(() => {
let material = gmp.getMaterial();
let primitive = new Freedo.Primitive({
geometryInstances: new Freedo.GeometryInstance({
geometry: new Freedo.RectangleGeometry({
rectangle: Freedo.Rectangle.fromDegrees(100, 30, 120, 40),
vertexFormat: Freedo.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,
height: 100000
})
}),
appearance: new Freedo.MaterialAppearance({ material: material })
});
viewer.scene.primitives.add(primitive);
}).catch(err => { throw err; });
// 2. Use with entity:
let gmp2 = new Freedo.FdEffect.GifMaterialProperty(viewer, { src });
gmp2.promise.then(() => {
let entity = viewer.entities.add({
position: Freedo.Cartesian3.fromDegrees(103.9526, 30.7617, 300000),
ellipsoid: {
radii: new Freedo.Cartesian3(240000, 240000, 240000),
material: gmp2
}
})
}).catch(err => { throw err });
```
### Response
#### Success Response (200)
This constructor does not return a response in the typical HTTP sense. It returns an instance of `GifMaterialProperty`.
```
--------------------------------
### createDefaultMaterial
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Creates a default material according to the glTF specification.
```APIDOC
## createDefaultMaterial
### Description
Creates a default material according to the glTF specification.
### Method
Not specified (assumed to be a utility function within the library)
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
#### Success Response (200)
- **return** (THREE.Material) - The default material.
#### Response Example
```json
{
"return": "THREE.Material"
}
```
```
--------------------------------
### cloneMaterial
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Clones a GLTFSpecularGlossinessMaterial instance, ensuring all necessary properties are copied.
```APIDOC
## cloneMaterial
### Description
Clones a GLTFSpecularGlossinessMaterial instance. The ShaderMaterial.copy() method can copy only properties it knows about or inherits, and misses many properties that would normally be defined by MeshStandardMaterial. This method allows GLTFSpecularGlossinessMaterials to be cloned in the process of loading a glTF model.
### Method
Not specified (assumed to be a utility function within the library)
### Endpoint
Not applicable
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```json
{
"source": "THREE.ShaderMaterial"
}
```
### Response
#### Success Response (200)
- **return** (THREE.ShaderMaterial) - A cloned ShaderMaterial instance.
#### Response Example
```json
{
"return": "THREE.ShaderMaterial"
}
```
```
--------------------------------
### GLTFMaterialsPbrSpecularGlossinessExtension
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Represents the Specular-Glossiness PBR Materials extension for glTF.
```APIDOC
## GLTFMaterialsPbrSpecularGlossinessExtension
### Description
Specular-Glossiness Extension for glTF Materials.
### Method
Not specified (likely a class or constructor)
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### GLTFMaterialsUnlitExtension
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Represents the Unlit Materials extension for glTF (PR pending).
```APIDOC
## GLTFMaterialsUnlitExtension
### Description
Unlit Materials Extension for glTF (PR pending).
### Method
Not specified (likely a class or constructor)
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### Fly to Camera Info with FdCamera in JavaScript
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Transitions the camera to a specified camera pose defined by an array of numbers. This method provides a smooth flying animation to the target camera information, which is typically obtained from FdCamera.getCurrentCameraInfo.
```javascript
var cameraInfo = [119.0, 39.0, 5000.0, 0.0, -90.0, 0.0];
Freedo.FdCamera.flyToByCameraInfo(viewer.scene.camera, cameraInfo) ;
```
--------------------------------
### FdCamera - Fly to Top
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Positions the camera directly above the bounding sphere, looking down at the model.
```APIDOC
## POST /api/FdCamera/flyToTop
### Description
Positions the camera directly above the bounding sphere, orienting it to look down at the model.
### Method
POST
### Endpoint
/api/FdCamera/flyToTop
### Parameters
#### Path Parameters
None
#### Query Parameters
* **scene** (Freedo.Scene) - Required - The scene object.
* **boundingSphere** (Freedo.BoundingSphere) - Required - The bounding sphere of the model.
### Request Example
```javascript
var boundingSphere = tileset.boundingSphere;
Freedo.FdCamera.flyToTop(viewer.scene, boundingSphere);
```
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
```
--------------------------------
### Go to Position (Freedo)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Moves the camera to a specified geographic location. Requires the camera object, a position array [longitude, latitude, height], and an optional range.
```javascript
var positon = [119.0, 39.0, 5000.0];
Freedo.FdCamera.goToByPosition(viewer.scene.camera, positon);
```
--------------------------------
### Go to Camera Position by Info (Freedo)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Directly sets the camera to a specified position and orientation without animation. Takes camera information as an array [longitude, latitude, height, heading, pitch, roll].
```javascript
var cameraInfo = [119.0, 39.0, 5000.0, 0.0, -90.0, 0.0];
Freedo.FdCamera.goToByCameraInfo(viewer.scene.camera, cameraInfo);
```
--------------------------------
### Destroy FdVolumn Instance
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdTools
Demonstrates the proper way to release resources and clean up the FdVolumn instance by calling its destroy method.
```javascript
volm.destroy();
```
--------------------------------
### Viewer Controls (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Provides control mechanisms for navigating and interacting with the 3D scene. Includes 'DoubleViewerControls' and 'SingleViewerControls' for different interaction modes, authored by meisongjun.
```javascript
DoubleViewerControls()
```
```javascript
SingleViewerControls()
```
--------------------------------
### glTF Extensions (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Implements various glTF extensions for enhanced model features. This includes DRACO mesh compression, PBR specular-glossiness materials, unlit materials, and DDS texture support.
```javascript
GLTFDracoMeshCompressionExtension()
```
```javascript
GLTFLightsExtension()
```
```javascript
GLTFMaterialsPbrSpecularGlossinessExtension()
```
```javascript
GLTFMaterialsUnlitExtension()
```
```javascript
GLTFTextureDDSExtension()
```
--------------------------------
### flyTo
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Animates the camera to fly to a specified bounding box.
```APIDOC
## flyTo
### Description
Animates the camera to fly to a specified bounding box.
### Method
Not specified (assumed to be a utility function within the library)
### Endpoint
Not applicable
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```json
{
"bbmin": "Array | String",
"bbmax": "Array | String"
}
```
### Response
#### Success Response (200)
None (function triggers camera animation)
#### Response Example
None
```
--------------------------------
### FdCamera - Fly to Camera Info
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Animates the camera to a specified camera orientation and position.
```APIDOC
## POST /api/FdCamera/flyToByCameraInfo
### Description
Animates the camera to a specified camera orientation and position. The transition includes a flight animation.
### Method
POST
### Endpoint
/api/FdCamera/flyToByCameraInfo
### Parameters
#### Path Parameters
None
#### Query Parameters
* **camera** (Freedo.Camera) - Required - The scene camera object.
* **cameraInfo** (Array.) - Required - An array containing camera information, structured similarly to the output of `FdCamera.getCurrentCameraInfo`.
* **options** (Object) - Optional - Currently undocumented options.
### Request Example
```javascript
var cameraInfo = [119.0, 39.0, 5000.0, 0.0, -90.0, 0.0];
Freedo.FdCamera.flyToByCameraInfo(viewer.scene.camera, cameraInfo);
```
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
```
--------------------------------
### DoubleViewerControls
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Initializes double viewer controls. Likely used for specific viewing modes or configurations.
```APIDOC
## DoubleViewerControls
### Description
Initializes double viewer controls.
### Method
Constructor
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### Fly to Bounding Box (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Navigates the viewer to focus on a specified bounding box. This method accepts either array representations or string representations of the minimum and maximum points of the bounding box.
```javascript
flyTo(bbmin, bbmax)
```
--------------------------------
### Pick Base Height with FdVolumn
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdTools
Shows how to enable or disable the interactive picking of the base height for the earthwork analysis using the pickHeight method. Setting val to true enables picking.
```javascript
volm.pickHeight(true); // Enable picking
volm.pickHeight(false); // Disable picking
```
--------------------------------
### Manage PModel Data
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdMicroApp
Provides methods for adding and removing PModel objects from the helper, as well as setting and retrieving the array of PModelSets. These methods are crucial for managing the data that the FdTransformHelper operates on.
```javascript
addPModel(pModel)
removePModel(pModel)
setData(aPModel)
setModel(aPModel)
```
--------------------------------
### Window Resize Callback (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
A callback function that is executed when the browser window's size changes. This is typically used to update the renderer's size and aspect ratio to match the new window dimensions.
```javascript
resize()
```
--------------------------------
### Create Default glTF Material (JavaScript)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Creates a default material conforming to the glTF 2.0 specification. This is used when a material is not explicitly defined in the glTF file, ensuring a fallback rendering option.
```javascript
createDefaultMaterial()
```
--------------------------------
### GLTFDracoMeshCompressionExtension
Source: https://forweb.gbim360.com/latest/freedox/Documentation/global
Represents the DRACO Mesh Compression extension for glTF.
```APIDOC
## GLTFDracoMeshCompressionExtension
### Description
DRACO Mesh Compression Extension for glTF.
### Method
Not specified (likely a class or constructor)
### Endpoint
Not applicable
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### Fly Camera to Model's West Side (Freedo)
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Moves the camera to the west side of a model's bounding sphere, orienting it towards the model. Requires a Freedo Scene and BoundingSphere object.
```javascript
var boundingSphere = tileset.boundingSphere;
Freedo.FdCamera.flyToWest(viewer.scene, boundingSphere);
```
--------------------------------
### FdCamera - Fly to North
Source: https://forweb.gbim360.com/latest/freedox/Documentation/FdCamera
Positions the camera to the north of the bounding sphere, looking towards the model.
```APIDOC
## POST /api/FdCamera/flyToNorth
### Description
Positions the camera to the north of the bounding sphere, orienting it to look towards the model.
### Method
POST
### Endpoint
/api/FdCamera/flyToNorth
### Parameters
#### Path Parameters
None
#### Query Parameters
* **scene** (Freedo.Scene) - Required - The scene object.
* **boundingSphere** (Freedo.BoundingSphere) - Required - The bounding sphere of the model.
### Request Example
```javascript
var boundingSphere = tileset.boundingSphere;
Freedo.FdCamera.flyToNorth(viewer.scene, boundingSphere);
```
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
```