1. DynamicWater

动态水波纹类,可以设置水波纹的纹理、颜色、流速、频率、透明度和显隐等状态和属性。

1.1. 初始化 new DynamicWater(options)

Param Type Default Description
options Object
[options.name] String

名称。默认为undefined

[options.geojsonUrl] String

geojson的Url。不设置则为undefined。position、geojsonUrl或者wfsUrl)必传一个(此参数将逐渐废弃,建议使用FileUtil.getDegreesFromGeojsonWFS获取经纬度坐标信息后,再创建水面-2022.02.21)

[options.wfsUrl] String

wfs服务的Url。不设置则为undefined。position、geojsonUrl或者wfsUrl)必传一个(此参数将逐渐废弃,建议使用FileUtil.getDegreesFromGeojsonWFS获取经纬度坐标信息后,再创建水面-2022.02.21)

[options.img] String

水面背景图片,默认为buildModuleUrl('Assets/Images/effect/waterNormals.jpg' )。

[options.position] Array.<number>

构成水面的坐标数组。[longitude0, latitude0, longitude1, latitude1...]。position、geojsonUrl或者wfsUrl)必传一个。

[options.color] String '#1ba7ff'

动态水波纹的颜色,十六进制的颜色字符串,默认'#1ba7ff'。

[options.opacity] Number 1

不透明度,范围[0-1],默认1。

[options.height] Number 0.0

水面距离大地水准面的高度,默认为0.0。

[options.extrudedHeight] Number

拉伸后的水面高度,在大地水准面的基准上往上拉伸,默认为不拉伸(拉伸后变为体)。

[options.clampToGround] Boolean false

设置是否地形贴地,默认为false,position设置时有效。当该参数值为true时,height和extrudedHeight参数将不起效。

[options.show] Boolean true

显隐控制,默认为true,显示。

[options.isZoomTo] Boolean false

是否加载时缩放至,默认为false。

[options.frequency] Number 400

动态水波纹的频率

[options.speed] Number 0.03

动态水波纹的流速(仅作为示意效果)

[options.amplitude] Number 1000

动态水波纹的振幅

[options.specularIntensity] Number 2

动态水波纹的镜面反射强度

[options.degree] Number 0

水流方向,相对于正北方向顺时针的角度

[options.attribute] Object

自定义属性对象。

Example

let dw = new BOSGeo.DynamicWater({
    name: '动态水波纹',
    // position: [121.46665, 31.17088, 0, 121.4663, 31.16701, 0, 121.46384, 31.1663, 0, 121.46351, 31.16834, 0, 121.46665, 31.17088, 0],
    geojsonUrl:'http://192.168.1.42:8086/geo/code/data/river.json',

    // height: 0,

    // clampToGround: true,
    show: true,
    isZoomTo:true,
    extrudedHeight:10,
    color: '#49a8f9',
});

1.2. 属性

属性名 Type ReadOnly Description
show Boolean false

是否显示

color String false

动态水波纹的颜色,十六进制的颜色字符串,如"#1ba7ff"

opacity Number false

不透明度,范围为[0-1]。

height Number false

水面高度

ready Boolean true

水面是否已经准备好渲染, 为true时更新高度才有效

1.3. 方法

1.3.1. dynamicWater.updateAppearance(options)

更新水流的颜色、振幅、方向等样式信息

Param Type Description
options Object

更新样式的配置信息

[options.color] String

动态水波纹的颜色,十六进制的颜色字符串,如'#1ba7ff'

[options.opacity] Number

不透明度,范围[0-1]

[options.img] String

水面背景图片,如'https://xxx/water.png'

[options.frequency] Number

频率,如400

[options.speed] Number

流速,如0.03(仅作为示意效果)

[options.amplitude] Number

振幅,如1000

[options.specularIntensity] Number

镜面反射强度,如2

[options.degree] Number

水流方向,相对于正北方向顺时针的角度,如90

Example

let dw = new BOSGeo.DynamicWater({
            name: '动态水波纹',
            position: [121.46665, 31.17088, 0, 121.4663, 31.16701, 0, 121.46384, 31.1663, 0, 121.46351, 31.16834, 0, 121.46665, 31.17088, 0],
            show: true,
            isZoomTo:true,
            height:10,
            color: '#49a8f9',
        });
        dw.updateAppearance({
            color: '#f00"
        })

1.3.2. dynamicWater.zoomTo()

缩放至实例化的水波纹对象范围

Example

dw.zoomTo()

1.3.3. dynamicWater.remove()

移除

Example

dw.remove()
版权所有@盈嘉互联(北京)科技有限公司 京ICP备15051988号-9 Copyright © 2022 all right reserved,powered by Gitbook该文件修订时间: 2022-04-22 10:33:56

results matching ""

    No results matching ""