3D model layer (ModelLayer)
method
addAxesHelper
Add model auxiliary coordinate axes. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| group | Object3D | RequiredObject3D object. |
| length | Number | RequiredThe length of the coordinate axis. |
addBatchModel
Similar models are loaded in batches, and the models can be operated in the callback function. For specific usage, refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array[Object] | | RequiredPoint data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredPoint coordinates, [longitude, latitude, height]. |
| | model | Object | | Required3D model resources, support glb, gltf, obj, fbx type loading. | name | type | description |
|---|
| mtl | String | RequiredMaterial file path, only valid when the model format type is "obj". | | type | String | RequiredModel format, values are "gltf", "glb", "obj", "fbx". | | url | String | RequiredModel file path. | | dracoUrl | String | optionalDecompression library file path, only valid when type is "glb" and "gltf". |
| | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | scale | Number | 1 | optionalModel scaling. |
|
| callback | Function | optionalCallback function executed after the model is loaded| name | type | description |
|---|
| group | Object3D | RequiredObject3D object, including a series of methods for operating the model. |
|
addBoxHelper
Add a model outsourcing box. For specific usage, refer to Example.
Parameters
| name | type | default value | description |
|---|
| group | Object3D | | RequiredObject3D object. |
| color | String | #ff0000 | optionalColor of model outer box. |
addCircle
Add a dynamic circle model and return the model group object. For specific usage, please refer to Example.
Parameters
- Scanning circle/diffusion circle/radar circle/ripple diffusion circle
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| center | Array | | RequiredCircle center coordinates, [longitude, latitude, height]. | | type | String | | RequiredCircle type, the values are divided into "scan", "spread", "radar" and "ripple", which represent scanning circle, diffusion circle, radar circle and ripple diffusion. | | color | String | #FFFFFF | optionalColor value. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | radius | Number | 10 | optionalCircle radius, unit meter, value is a positive number. | | segment | Number | 256 | optionalThe number of patches forming a circle. | | speed | Number | 1 | optionalThe circle changes speed, the value is a positive number. | | isCW | Boolean | true | optionalWhether it is clockwise, only valid when type is "radar". | | turns | Number | 8 | optionalThe number of stripes forming a circle, the value is a positive integer, only valid when type is "ripple". |
|
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| type | String | | RequiredCircle type, value is "gradient". | | data | Array[Object] | | RequiredGradient circle attribute, multiple gradient circle data can be added. | name | type | default value | description |
|---|
| center | Array | | RequiredCircle center coordinates, [longitude, latitude, height]. | | radius | Number | 10 | optionalCircle radius, unit meter, value is a positive number. | | centerColor | String | #FF0000 | optionalCircle center color value. | | centerOpacity | Number | 1.0 | optionalOpacity of the center of the circle, ranging from 0-1. | | edgeColor | String | #FF0000 | optionalCircle edge color value. | | edgeOpacity | Number | 0.1 | optionalCircle edge opacity, ranging from 0-1. |
|
|
addDynamicWater
Add dynamic water effects. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| baseTexture | String | | RequiredBasic texture resource path. | | data | String | | RequiredWater surface geometry data. | | noiseTexture | String | | RequiredNoise texture resource path. | | opacity | Number | 0.8 | optionalTransparency. | | speed | Number | 0.01 | optionalThe speed of water flow. | | altitude | Number | 0 | optionalAltitude, in meters. |
|
addFlame
Add flame effect. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | description |
|---|
| coordinate | Array | RequiredThe position where the center of the bottom of the flame is placed, in the shape of [longitude, latitude, altitude]. | | size | Array | RequiredThe size of the flame, you can specify the size of the three axes of x, y, and z, the unit is meters, the shape is [100,100,100]. | | imgUrl | String | RequiredFire map path. |
|
addFlowLine
Add a pipeline model with flow texture and return the model group object. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Object | | RequiredPipeline data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredThe coordinates of the points that make up the pipeline, [[longitude, latitude, height], [longitude, latitude, height]]. |
| | type | String | | RequiredCircular nozzle section type, value is "Circle". | | closed | Boolean | false | optionalWhether the pipeline model is closed from beginning to end. | | color | String | #FFFFFF | optionalColor value. | | image | String | undefined | optionalTexture path, the length and width are required to be consistent. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | radius | Number | 1 | optionalradius of the circular nozzle, in meters. | | repeatX | Number | 10 | optionalNumber of repeats along the pipeline path direction. | | repeatY | Number | 1 | optionalNumber of repetitions around the pipeline direction. | | side | String | FrontSide | optionalMaterial map side settings, three types, "FrontSide", "BackSide", "DoubleSide". | | speed | Number | 1 | optionalPipeline texture flow speed. |
|
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Object | | RequiredPipeline data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredThe coordinates of the points that make up the pipeline, [[longitude, latitude, height], [longitude, latitude, height]]. |
| | rectangle | Array | | RequiredThe side length of the rectangular pipe mouth, such as [a,b], in meters. | | type | String | | RequiredRectangular nozzle section type, value is "Rectangle". | | color | String | #FFFFFF | optionalColor value. | | image | String | undefined | optionalTexture path. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | repeatX | Number | 10 | optionalNumber of repeats along the pipeline path direction. | | repeatY | Number | 1 | optionalNumber of repetitions around the pipeline direction. | | side | String | FrontSide | optionalMaterial map side settings, three types, "FrontSide", "BackSide", "DoubleSide". | | speed | Number | 1 | optionalPipeline texture flow speed. | | steps | Number | 10 | optionalThe number of points used to subdivide the segment deeply along the stretched spline, can be used with the repeatX attribute. |
|
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Object | | RequiredLine data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredThe coordinates of the points that make up the trajectory line, [[longitude, latitude, height], [longitude, latitude, height]]. |
| | type | String | | RequiredTrail line type, value is "trail". | | color | String | #003CFF | optionalColor value. | | opacity | Number | 1 | optionalOpacity. | | speed | Number | 3 | optionalFlow speed. | | width | Number | 10 | optionalLine width. |
|
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Object | | RequiredLine data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredThe point coordinates that make up the flying line, [[longitude, latitude, height], [longitude, latitude, height]]. |
| | type | String | | RequiredFlying line type, value is "flow". | | color | String | #ffff00 | optionalColor value. | | gradient | Number | 0.02 | optionalBackground transparency. | | opacity | Number | 1 | optionalOpacity. | | percent | Number | 0.08 | optionalProportion of the flowing part. | | speed | Number | 3 | optionalFlow speed. | | width | Number | 10 | optionalLine width. |
|
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Object | | RequiredLine data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredThe point coordinates that make up the dynamic pattern line, [[longitude, latitude, height], [longitude, latitude, height]]. |
| | image | String | | RequiredPicture resource path. | | type | String | | RequiredDynamic pattern line type, value is "image". | | color | String | #FFFFFF | optionalColor value. | | opacity | String | 1 | optionalOpacity. | | depthTest | Boolean | true | optionalWhether to enable depth testing, that is, whether to enable occlusion. | | speed | Number | 3 | optionalFlow speed. | | width | Number | 10 | optionalLine width. | | textureFactor | Number | 6 | optionalThe compression coefficient of the texture in the flow direction. The larger the value, the greater the compression strength, ranging from 0-10. | | towards | String | screen | optionalFlow line expression, the value is "screen", it always faces the screen, and the value is "ground", it sticks to the ground. |
|
addGeoFencing
Add a 3D geofencing model and return the model group object. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Object | | RequiredFence data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredThe coordinates of the points that make up the fence, [[longitude, latitude, height], [longitude, latitude, height]]. | | name | String | optionalFence name. |
| | type | String | | RequiredThree-dimensional geofence type, the values are divided into "diffuse", "fade" and "outLine", which represent visible and invisible track fences and outline fences. | | color | String | #FFFFFF | optionalColor value. | | height | Number | 1 | optionalFence height. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | speed | Number | 3.0 | optionalFence changing speed. | | imageUrl | String | | optionalTexture path, only effective when type is "outLine". | | imageColor | String | rgb(0,255,255) | optionalThe color of the texture pattern. It is required that the pattern color in the map is pure white and the background color is pure black. It only takes effect when type is "outLine". | | imageSpeed | Number | 0.0015 | optionalTexture moving speed, range 0-1, only effective when type is "outLine". | | gradientColor | String | rgb(0,255,255) | optionalThe color of the gradient, only takes effect when type is "outLine". | | gradientSpeed | Number | 0.015 | optionalGradient color movement speed, only effective when type is "outLine". |
|
addInstancedModel
High-performance loading of similar models in large batches, the model position, color and angle information can be updated through the updateInstancedModel and updateInstancedModelById methods in the callback function. For specific usage, refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array[Object] | | RequiredPoint coordinate data. | name | type | default value | description |
|---|
| coordinate | Array[Number] | | RequiredPoint coordinates, [longitude, latitude, height]. | | id | String | | optionalUnique identifier information. This parameter is required when used with the updateInstancedModelById method. | | color | String | Original model color | optionalColor information of a single model, in the form of "#ffffff". | | rotation | Array[Number] | [0,0,0] | optionalThe rotation angle of a single model around the coordinate axis, the counterclockwise direction is positive, the angle value range is [0,360], the positive direction of the X-axis is due east, the positive direction of the Y-axis is vertically upward, and the positive direction of the Z-axis is due north. |
| | model | Object | | Required3D model resources. | name | type | description |
|---|
| type | String | RequiredModel format, values are "gltf", "glb". | | url | String | RequiredModel file path. | | dracoUrl | String | optionalDecompression library file path. |
| | maxCount | Number | 99999 | optionalSet the maximum number of models that can be displayed. | | opacity | Number | 1 | optionalSet the opacity of the model material, ranging from 0-1. | | project | String | undefined | optionalLoaded 3D model coordinate system. The default coordinate system is meters, and the parameter is set to "3857" when loading the EPSG:3857 coordinate system model. | | rotation | Array[Number] | [0,0,0] | optionalInitial model rotation parameters, in the form [x,y,z]. | | scale | Number | 1 | optionalInitial model scaling factor. |
|
| callback | Function | optionalCallback function executed after the model is loaded| name | type | description |
|---|
| group | Object3D | RequiredObject3D object, update model position information through updateInstancedModel and updateInstancedModelById methods. |
|
addLines
Add a three-dimensional line and return the model group object. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array[Object] | | RequiredLine data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredThe coordinates of the points that make up the line, [[longitude, latitude, height], [longitude, latitude, height]]. |
| | image | String | | RequiredImage resource path, only valid when type is "image". | | color | String | #FFFFFF | optionalcolor value. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | repeat | Object | {x: 1, y: 1} | optionalThe number of tiles of the image in the x and y directions, only effective when type is "image". | | type | String | pipe | optionalThree-dimensional line type, supporting pipeline (pipe), solid line (solid), dotted line (dash), and pattern line (image) types. | | width | Number | 1/10 | optionalLine width, when type is "pipe", the default is 1, other types default to 10. |
|
addMarker
To add 3D point annotations in batches, it needs to be used together with options.funcRender to return an object containing the dom element group of the annotations.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| id | String | | RequiredThe id of the annotation layer, unique. | | data | Array | | RequiredBatch label data. | name | type | description |
|---|
| element | HTMLElement | RequiredDOM element as a markup. | | position | Array | RequiredMark point coordinates, [longitude, latitude, height]. |
| | avoidance | Boolean | false | optionalWhether to enable label avoidance. | | edit | Boolean | false | optionalWhen the value is true, the three-dimensional label can be moved by dragging the mouse. |
|
- Refer to the Create 3D Label example:
- Can be removed in batches through the
remove() method; - Locations can be updated in batches through the
update() method. Please refer to the specific usage.
- Refer to the Edit 3D Label example:
- The editing state can be enabled based on the name through the
selectMarkerByName('name') method; - The editing on and off status can be set through the
setEditable(true)/setEditable(false) method; - You can obtain the dragged label position by listening to the
marker-drag event.
addMarker3D
To add 3D labels in batches, you need to introduce html2canvas.min.js. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array | | RequiredArray of label position, id and orientation. | name | type | default value | description |
|---|
| coordinate | Array | | RequiredThe coordinates of the label, in the form: [longitude, latitude, height]. | | id | String | | optionalAttribute information of the label. | | rotationOffset | Number | 0 | optionalIndicates the angle between the front direction of the three-dimensional label and the north direction in the horizontal direction, ranging from -180 to 180, with counterclockwise being the positive direction. |
| | element | HTMLElement | | RequiredCustomized dom element. The larger the resolution of the dom element, the clearer the label. | | width | Number | | RequiredThe width of the label, in meters. | | height | Number | | RequiredThe width of the label, in meters. | | depthTest | Boolean | true | optionalWhether to enable depth testing. |
|
| callback | Function | optionalCallback function executed after loading is completed. | name | type | description |
|---|
| group | Object3D | RequiredObject3D object, which can be combined with the renderMarker3D and getMarker3DId interfaces to realize the function of 3D labels always facing the screen and obtaining bound attribute information. |
|
addModel
You can load the model in meters and manipulate the model in the callback function.
Parameters
| name | type | default value | description |
|---|
| models | Array | | RequiredInitially loaded 3D model resource. | name | type | description |
|---|
| model | Object | RequiredSingle 3D model resource supports loading of glb, gltf, obj, and fbx types. | name | type | description |
|---|
| mtl | String | RequiredMaterial file path, only valid when type is "obj". | | type | String | RequiredModel format, values are "gltf", "glb", "obj", "fbx". | | url | String | RequiredModel file path. | | dracoUrl | String | optionalDecompression library file path, only valid when type is "glb" and "gltf". | | ktx2ParseUrl | String | optional |
|
|
| center | Array | [0, 0, 0] | optionalSet the geospatial coordinates of the world origin of the 3D model. The coordinate system uses WGS84 coordinates. Required if models are set. Example: [lng, lat, height], if height is default, the default is 0. |
| callback | Function | | optionalThe callback function executed after the model is loaded, usage: "callback: function (group, layer) {}". | name | type | description |
|---|
| group | Object3D | RequiredObject3D object, which contains a series of methods for operating the model. | | layer | ModelLayer | Required3D layer instance. |
|
addModelEffect
To add 3D model special effects, the model is required to face the Y axis upward. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| model | Object3D | RequiredThree-dimensional model object. |
| options | Array[Object] | RequiredModel special effects array, the effects can be superimposed. | name | type | description |
|---|
| option1 | Object | Requiredparameter| name | type | default value | description |
|---|
| type | String | | RequiredModel gradient type, bottom-up gradient, value is "gradient". | | endColor | String | #FFFFFF | optionalEnd color value. | | percent | Number | 0.5 | optionalGradient scale, ranging from 0-1. | | startColor | String | #040912 | optionalStart color value. |
| | option2 | Object | Requiredparameter| name | type | default value | description |
|---|
| type | String | | RequiredThe model’s own sweeping effect type changes from bottom to top, and the value is "flow". | | color | String | #339bf6 | optionalColor value. | | percent | Number | 0.01 | optionalThe proportion of the width of the sweeping bar to the entire model. | | speed | Number | 3.0 | optionalSweeping bar movement speed. |
|
|
addModelMercator
You can load the model in the 3857 coordinate system and operate the model in the callback function. The parameters models, center, and callback are consistent with the description above.
addParticle
Load particles and return the model group object.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array[Object] | | RequiredPoint data. Adding custom attributes is not supported. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredPoint coordinates, [longitude, latitude, altitude], only supports CGCS2000 coordinates. |
| | color | String | rgb(255,255,255) | optionalColor value. | | maxPoints | Number | | optionalMaximum number of points. If you need to use updateParticle to update the number of points, please enter the maximum number of points. The default is all points of the current data. | | opacity | Number | 1.0 | optionalOpacity, ranging from 0-1. | | size | Number | 1 | optionalParticle size. |
|
addPoints
Add 3D point models in batches and return model group objects. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array[Object] | | RequiredPoint data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredPoint coordinates, [longitude, latitude, height]. |
| | type | String | | RequiredModel format, the values are "cube" cube and "sphere" sphere. | | color | String/Number | #FFFFFF | optionalColor value, the color value accepts string or hexadecimal representation. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | size | Number | 1 | optionalSize, in meters, representing edge length and radius respectively. |
|
addPolygons
Add a three-dimensional surface and return the model group object. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array[Object] | | RequiredFacial data. Custom properties can be added. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredThe coordinates of the points that make up the surface, [[longitude, latitude, height], [longitude, latitude, height]]. |
| | color | String/Number | #FFFFFF | optionalColor value, the color value accepts string or hexadecimal representation. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | side | String | FrontSide | optionalMaterial map side settings, three types, "FrontSide" front, "BackSide" back, "DoubleSide" double-sided. |
|
addPolygonByLine
Add a three-dimensional plane and return the model group object. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array | | RequiredThe point coordinates that make up the line, [[longitude, latitude, height], [longitude, latitude, height]]. | | height | Number | | RequiredPlane elevation height. | | color | String/Number | #FFFFFF | optionalColor value, color value accepts string or hexadecimal representation. | | image | String | | optionalTexture path. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. |
|
addPyramid
Add the cone model and return the model group object. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| basePoints | Array | | RequiredPyramid base data, point coordinates that make up the base, [[Longitude, Latitude, Height], [Longitude, Latitude, Height]], the points are in clockwise order. | | topColor | Array[String/Number] | | RequiredPyramid side color array, the color value accepts string or hexadecimal representation, such as ["#FFFF00", "#00FF00"], which represents the color gradient from top to bottom, and only accepts two colors at most. | | topPoint | Array | | RequiredPyramid vertex data, [longitude, latitude, height]. | | baseColor | String/Number | | optionalThe color value of the pyramid base. The color value accepts string or hexadecimal representation, such as "#FFFFFF" or 0xFFFFFF. If not set, the bottom will be transparent and invisible by default. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | side | String | FrontSide | optionalMaterial map side settings, three types, "FrontSide" front, "BackSide" back, "DoubleSide" double-sided. |
|
addRainSystem
Adding rain animation can be removed in batches through the remove() method, and other parameters except the bounds parameter can be updated in batches through the update(options) method. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| bounds | Array | | RequiredThe geographical range of the rain animation, represented by the longitude and latitude of the southwest and northeast corners, in the form of [[120.661, 31.299],[120.701, 31.311]]. | | top | Number | 1000 | optionalThe maximum height when it starts to rain, in meters. | | count | Number | 2000 | optionalNumber of raindrops. | | size | Number | 1.0 | optionalA multiple of the raindrop length, such as 1.5 means 1.5 times the existing effect. | | speed | Number | 1.0 | optionalA multiple of the falling speed of raindrops, such as 1.5 means 1.5 times the existing effect. | | opacity | Number | 0.8 | optionalRaindrop opacity, ranging from 0-1. | | color | String | #AAAAEE | optionalRaindrop color value. |
|
addSnowSystem
Add snow animation, which can be removed in batches through the remove() method. Other parameters except the bounds parameter can be updated in batches through the update(options) method. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| bounds | Array | | RequiredThe geographical range of the snow animation, represented by the longitude and latitude of the southwest and northeast corners, in the shape of [[120.661, 31.299],[120.701, 31.311]]. | | top | Number | 1000 | optionalThe maximum height where snow starts to fall, in meters. | | count | Number | 2000 | optionalNumber of snowflakes. | | size | Number | 40 | optionalA multiple of the snowflake length, such as 1.5 means 1.5 times the existing effect. | | speed | Number | 1.0 | optionalA multiple of the snowflake falling speed, such as 1.5 means 1.5 times the existing effect. | | opacity | Number | 0.8 | optionalSnowflake opacity, ranging from 0-1. | | color | String | #FFFFFF | optionalSnowflake color value. |
|
addSphere
Add a special effect ball model and return the model object. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| center | Array | | RequiredCoordinates of the center of the sphere, [longitude, latitude, height]. | | color | String | #ff0000 | optionalColor value. | | hSegment | Number | 16 | optionalThe number of vertical segments that make up the ball, the minimum value is 2. | | opacity | Number | 1 | optionalOpacity, ranging from 0-1. | | phiLength | Number | 360° | optionalSpecify the horizontal scanning angle size. | | phiStart | Number | 0 | optionalSpecify the horizontal starting angle. | | radius | Number | 10 | optionalSphere radius, unit meter. | | speed | Number | 3 | optionalHow fast the ball surface effect changes. | | thetaLength | Number | 180° | optionalSpecify the vertical scanning angle size. | | thetaStart | Number | 0 | optionalSpecify the vertical starting angle. | | wSegment | Number | 32 | optionalThe number of horizontal segments that make up the ball, the minimum value is 3. |
|
addTextMarker
Add text labels. For specific usage, refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array | | RequiredData parameters of the text label. | name | type | default value | description |
|---|
| coordinate | Array | | RequiredThe position coordinate of the text label, in the form: [longitude, latitude, height]. | | text | String | | RequiredThe text content of the text label. | | angle | Array | [0, 0, 0] | optionalThe rotation angle of the text label, rotate around the X, Y, and Z axes respectively, with clockwise rotation as positive. In the scene, the positive direction of the X axis is due east, the positive direction of the Y axis is due south, and the positive direction of the Z axis is vertically upward. |
| | color | String | #000000 | optionalThe color of the text content font. | | fontFamily | String | sans-serif | optionalType of text content font, supports CSS font type name. | | fontSize | Number | 10 | optionalThe size of the text content font. | | letterSpacing | Number | 0 | optionalThe spacing between text content fonts. | | type | String | horizontal | optionalThe direction of the text label, the values are "horizontal" and "vertical" represent horizontal and vertical respectively. |
|
addTrackLines
Add people flow trajectory lines. For specific usage, refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array | | RequiredCoordinate data that constitutes the trajectory line. Each trajectory line is composed of one coordinate point as a circle, two coordinate points as a line segment, and three or more coordinate points as a line segment or curve. See below for specific data format. | | range | Array | | RequiredThe track line displays the area range, in the form of [[longitude, latitude], [longitude, latitude],...]. | | height | Number | 0 | optionalThe track line displays the height of the plane, in meters. | | resolution | Number | 1024 | optionalCanvas width resolution, the larger the track line, the clearer it will be. | | trackWidth | Number | 6 | optionalThe width of the track line is related to the resolution. The greater the resolution, the smaller the displayed line width. | | trackColor | String | #63E8FF | optionalThe color of the track line. |
|
| callback | Function | optionalCallback function executed after the trajectory line is loaded. | name | type | description |
|---|
| updateTrackLines | Function | optionalUpdate track line method, the parameter is data, and the description is consistent with the above data. |
|
let data1 = [
[
[120, 30]
],
[
[120, 31]
],
......
]
let data2 = [
[
[120, 30],
[120, 31]
],
[
[121, 31],
[121, 30]
],
......
]
let data3 = [
[
[120, 30],
[120, 31],
[120, 32],
......
],
[
[121, 31],
[121, 30],
[121, 32],
......
],
......
]
changeModelTexture
Modify the 3D model texture of automated batch construction. Before modification, you need to set the texture rules. This is achieved through the above setTextureRules(options). For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | description |
|---|
| data | Object | RequiredSet the texture name and corresponding model number data, expressed in the form of key-value pairs. | name | type | description |
|---|
| key | String | RequiredSet the texture name, corresponding to the "key" parameter value of textureData in the setTextureRules(options) interface. | | value | Array | RequiredSet the model number array whose texture needs to be changed, expressed in array form such as [0,10,100], indicating the models labeled 0th, 10th, and 100th. The texture is modified to the texture segmentation block corresponding to key. |
| | model | Group/Mesh | RequiredThe model object that needs to be operated. |
|
exportModel
Export the 3D model. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| model | Group | RequiredThe organizational structure of the corresponding glb file in the model object. A single model can be exported at a time. |
fadeModels
Realize the model floating up and down animation.
Parameters
| Name | Type | Description |
|---|
| duartion | Number | RequiredModel animation duration, in milliseconds. |
| from | Object | RequiredInitial state of model motion. | name | type | description |
|---|
| height | Number | RequiredInitial height of model movement. | | opacity | Number | RequiredInitial transparency of model movement. |
|
| models | Object3D | RequiredSingle model or model group. |
| to | Object | RequiredModel movement end state. | name | type | description |
|---|
| height | Number | RequiredModel movement end height. | | opacity | Number | RequiredModel movement ends transparency. |
|
getInstancedModelId
Select the instantiated model based on the screen coordinates, and the return value is the id attribute information bound to the instantiated model. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| point | Object | RequiredScreen coordinates, such as {x: 1152, y: 643}. |
| object | Object3D | RequiredThe model object returned by the addInstancedModel interface callback. |
getIntersectCoordinate
Model surface coordinate picking, the return value is an array of [longitude, latitude, height], for specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| data | Object | Required is a sub-item of the result array returned by layer.selectModel(point), such as layer.selectModel(point)[0]. |
getMarker3DId
Get the id attribute of the 3D label based on the screen coordinates. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| point | Object | RequiredScreen coordinates, in the form {x: 1152, y: 643}. |
| groups | Object/Array[Object] | RequiredThe group returned in the addMarker3D interface callback function, or an array containing multiple groups. |
getModelCenter
Get the geometric center coordinates of a model or model group. The return value is an array of [longitude, latitude, height]. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| object | Object3D | RequiredModel or model group object. |
highlightMergeBatchModel
Efficient picking and highlighting of 3D models built in automated batches are implemented based on the mouse click model picking results, and the number attribute of the picked model is returned. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| intersect | Object | | RequiredPick up model information, which is a sub-item of the result array returned by layer.selectModel(point), such as layer.selectModel(point)[0]. | | name | String | | RequiredThe name attribute of the model contains a value, which is used to identify the model. | | texture | String | | RequiredThe texture map path highlighted by the model. | | color | String | rgb(231,201,122) | optionalThe color of the model highlight. | | faceCount | Number | 2 | optionalThe number of triangles in each model. |
|
onAfterRender
Listen to the first rendering completion event of the loaded model. For specific usage, refer to Example.
Parameters
| Name | Type | Description |
|---|
| group | Object3D | RequiredThe model object or model group that needs to be monitored. |
| isAll | Boolean | optionalIndicates whether to monitor the entire group. When this parameter is missing or false, it indicates that only the group part within the current screen range is monitored. |
outlineModel
Model outline highlighting, the highlighting effects of the same layer are mutually exclusive. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| objects | Object3D | RequiredModel object or model group. |
| options | Object | optionalparameter| name | type | default value | description |
|---|
| scope | String | default | optionalModel highlighting range, optional values are: "layer": the entire modelLayer, "model": model file, such as glb, "default": the passed in object itself. | | edgeStrength | Number | 3.0 | optionalContour strength coefficient. | | edgeGlow | Number | 0.0 | optionalOutline luminescence coefficient. | | edgeColor | Number | #ffff00 | optionalOutline color. | | enableFillColor | Boolean | true | optionalWhether the outline is filled with color. | | fillColorOpacity | Number | 0.2 | optionalThe fill color opacity inside the outline. |
|
recoveryModelTexture
Restore textures for 3D models built in automated batches.
Parameters
| Name | Type | Description |
|---|
| model | Group/Mesh | RequiredThe model object that needs to be operated comes from the model value in the above changeModelTexture(options) interface. |
removeModel
Loaded models can be removed in the callback function.
Parameters
| Name | Type | Description |
|---|
| group | Object3D | RequiredThe model that needs to be removed. |
removeModelByAttribute
Remove a single loaded model in the scene based on an attribute set by the model. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| key | String | RequiredThe name of the key attribute in the data. |
| value | String | RequiredThe value corresponding to the key attribute name of the model needs to be removed. |
removeModelEffect
Remove the 3D model special effects. For specific usage, please refer to Example.
renderMarker3D
Render three-dimensional labels in real time so that they always face the screen. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| groups | Object/Array[Object] | RequiredThe group returned in the addMarker3D interface callback function, or an array containing multiple groups. |
selectModel
Select a model based on screen coordinates, and the return value is an array of selectable model information.
Parameters
| Name | Type | Description |
|---|
| point | Object | RequiredScreen coordinates, such as {x: 1152, y: 643}. |
| object | Object/Array[Object] | optionalSpecify the pickup range, which can be a model object or a model group. If no parameters are specified, it defaults to all models in the scene. |
setRenderPassSync
Set whether the rendering queue synchronization parameter is turned on.
Parameters
| Name | Type | Description |
|---|
| renderPassSync | Boolean | RequiredSuitable for loading and displaying underground 3D models. When this parameter is turned on, the opaque material model will be rendered before the translucent surface to achieve the correct three-dimensional space effect. However, the rendering performance in this mode will be affected to a certain extent. |
setTextureRules
Set the 3D model texture rules for automated batch construction. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | description |
|---|
| faceCount | Number | RequiredThe number of triangles in each model. | | model | Scene/Mesh | RequiredThe model object of the binding operation, if it is of Scene type, must contain only one Mesh in its children. | | size | Array | RequiredThe number of rows and columns of uniformly divided texture textures, expressed in the form of an array, such as [3,3], indicating that the texture image has a division of 3 rows and 3 columns. | | textureData | Object | RequiredSet the texture name and corresponding texture coordinates, expressed in the form of key-value pairs. | name | type | description |
|---|
| key | String | RequiredSet the texture name. | | value | Array | RequiredSet texture coordinates, expressed in the form of a two-dimensional array, from left to right, top to bottom, such as [0,0], which represents the texture segmentation block in the first row and first column. |
| | textureUrl | String | RequiredTexture map path. The texture storage rules must be uniformly divided image resources, and the divided block in the upper left corner must be the texture corresponding to the model itself. |
|
unhighlightMergeBatchModel
Remove highlighting for automated batch build models.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | description |
|---|
| name | String | RequiredThe name attribute of the model contains a value, which is used to identify the model. | | object | Object | optionalThe range of the model level where the highlight effect is removed can be used to quickly locate the level. If not set, it will be searched in the entire scene. |
|
unOutlineModel
Cancel model outline highlighting. For specific usage, refer to Example.
updateInstancedModel
Large batches of models are updated as a whole, and the overall effect will be cleared before updating. It is suitable for rapid updating and display of large batches of scattered data. This interface is used in conjunction with addInstancedModel. For specific usage, refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array[Object] | | RequiredPoint coordinate data. | name | type | default value | description |
|---|
| coordinate | Array[Number] | | RequiredPoint coordinates, [longitude, latitude, height]. | | id | String | | optionalUnique identifier information. | | color | String | Original model color | optionalColor information of a single model, in the form of "#ffffff". | | rotation | Array[Number] | [0,0,0] | optionalThe rotation angle of a single model around the coordinate axis, the counterclockwise direction is positive, the angle value range is [0,360], the positive direction of the X-axis is due east, the positive direction of the Y-axis is vertically upward, and the positive direction of the Z-axis is due north. |
| | model | Object3D | | RequiredThe model object returned by the addInstancedModel interface callback. | | scale | Number | 1 | optionalModel scaling factor. |
|
updateInstancedModelById
Change the attribute information of a single model based on Id, including position, color and angle. It is suitable for model single operation and supports model color restoration. This interface can be used in conjunction with addInstancedModel. For specific usage, refer to Example.
Parameters
| Name | Type | Description |
|---|
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array[Object] | | RequiredPoint coordinate data. | name | type | description |
|---|
| id | String | RequiredUnique identifier information, which is the corresponding id in the addInstancedModel interface. | | coordinate | Array[Number] | RequiredPoint coordinates, [longitude, latitude, height]. | | color | String/null | optionalColor information of a single model, in the form of "#ffffff" or null. When the parameter is null, the color is the original color of the model. | | rotation | Array[Number] | optionalThe rotation angle of a single model around the coordinate axis, the counterclockwise direction is positive, the angle value range is [0,360], the positive direction of the X-axis is due east, the positive direction of the Y-axis is vertically upward, and the positive direction of the Z-axis is due north. | | scale | Number | optionalModel scaling factor. |
| | model | Object3D | | RequiredThe model object returned by the addInstancedModel interface callback. | | clearColor | Boolean | true | optionalWhether to clear the set model color. |
|
updateParticle
Update particles. You can update particle coordinates, size, transparency and color. For specific usage, please refer to Example.
Parameters
| Name | Type | Description |
|---|
| group | Object3D | Required The return value of addParticle. |
| options | Object | Requiredparameter| name | type | default value | description |
|---|
| data | Array[Object] | | RequiredPoint data. Adding custom attributes is not supported. | name | type | description |
|---|
| coordinate | Array[Number] | RequiredPoint coordinates, [longitude, latitude, height]. |
| | color | String | rgb(255,255,255) | optionalColor value. | | opacity | Number | 1.0 | optionalOpacity, ranging from 0-1. | | size | Number | 1 | optionalParticle size. |
|