S3MTilesLayer

new Cesium.S3MTilesLayer(options)

S3M(Spatial 3D Model)图层类,通过该图层实现加载各类三维模型,包括倾斜摄影模型、BIM模型、点云数据、精细模型等。

通过Scene.addS3MTilesLayerByScp(url, options)的方式将发布的*.s3m格式的三维服务添加到场景中。
Name Type Description
options Object optional 对象具有以下属性:
Name Type Default Description
gl WebGLRenderingContext optional webgl上下文。
servers Array optional 包含服务器地址的数组。
urls Array optional 包含xml地址的数组。
position Array optional 图层的经纬度位置信息,数组第1个元素表示经度,第2个元素表示纬度,第3个元素表示高度。
name Array optional 图层名称.。
bReleaseColor Boolean true optional 是否释放颜色所占内存,默认为true,表示释放。如选中BIM模型、矢量数据,取消选中后将释放颜色导致颜色消失,此时可将此值设为false。
Example:
//new S3MTilesLayer instance
var S3MTilesLayer = new S3MTilesLayer({
 gl : gl,
 servers : ["http://localhost:8090"],
 urls : ["http://localhost:8090/data/tile_001.xml","http://localhost:8090/data/tile_002.xml"],
 position : [10,20],
 name : ["S3MTilesLayer"]
});

Members

clipLineColor : Color

获取或设置对S3M图层进行BOX裁剪时裁剪线的颜色。

dataMaxValue : Number

获取数据的最大高度值或最大强度值。 对点云数据而言,该属性为高度值或强度值(默认为强度值);对其他三维数据而言,该属性为高度值。
Example:
//获取数据最大值
var dataMaxValue = S3MTilesLayer.DataMaxValue;

dataMinValue : Number

获取数据的最小高度值或最小强度值。 对点云数据而言,该属性为高度值或强度值(默认为强度值);对其他三维数据而言,该属性为高度值。
Example:
//获取数据最小值
var dataMinValue = S3MTilesLayer.DataMinValue;

hypsometricSetting : AnalysisRegionMode

获取或设置图层的分层设色表达。
Example:
//设置图层分层设色属性
var hypsometricSetting = new Cesium.HypsometricSetting();
hypsometricSetting.MinVisibleValue = 30;
hypsometricSetting.MaxVisibleValue = 150;
var colorTable = new Cesium.ColorTable();
colorTable.insert(150, new Cesium.Color(1, 0, 0));
colorTable.insert(30, new Cesium.Color(0, 0, 1));
hypsometricSetting.ColorTable= colorTable;
S3MTilesLayer.HypsometricSetting = {
hypsometricSetting : hypsometricSetting,
analysisMode: Cesium.HypsometricSettingEnum.AnalysisRegionMode.ARM_ALL
}
//获取图层分层设色属性
var hyp = S3MTilesLayer.HypsometricSetting ;

layerBounds : Rectangle

获取或设置图层范围。

lodRangeScale : Number

获取或设置图层的LOD层级切换距离缩放系数。

shadowType : SHADOWTYPE

获取或设置图层中模型参与显示阴影的范围类型。

style3D : Style3D

获取或设置图层风格。
Example:
//获取图层风格
var style = S3MTilesLayer.style3D;
//设置图层风格
var style3D = new Cesium.Style3D();
var color = new Cesium.Color(1.0, 0.0, 0.0);
style3D.fillForeColor = color;
S3MTilesLayer.style3D = style3D;
//设置后需刷新图层
S3MTilesLayer.refresh();

visible : Boolean

获取或设置图层可见性。
Example:
//获取可见性
var isVisible = S3MTilesLayer.visible;
//设置不可见
S3MTilesLayer.visible = false;

visibleDistanceMax : Number

获取或设置该图层的最大可见距离值,单位为米。该距离值用于距离过滤功能,当相机与图层的距离大于该距离值时,该图层将不可见。

visibleDistanceMin : Number

获取或设置该图层的最小可见距离值,单位为米。该距离值用于距离过滤功能,当相机与图层的距离小于该距离值时,该图层将不可见。

Methods

addFlattenRegion(options)Boolean

添加压平面,用于压平模型表面。
Name Type Description
options Object 压平区域参数:
Name Type Description
position Array 指定压平区域位置信息。
name String 压平区域名称。
Returns:
成功返回true,失败返回false。
Example:
S3MTilesLayer.addFlattenRegion({
    position : [13.0500640714, 47.8279189759, 400.0,
                13.0500640714, 47.8230189759, 400.0,
                13.0530640714, 47.8260189759, 400.0,
                13.0538640714, 47.8230189759, 400.0,
                13.0538640714, 47.8279189759, 400.0],
       name : 'flatten2'});

clearCustomClipBox()

清除自定义裁剪面。
Example:
S3MTilesLayer.clearCustomClipBox();

getObjsColor()Object

获取对象颜色表。
Returns:
对象颜色表:Key为对象ID,Value为对象颜色。
Example:
var objectsColor = S3MTilesLayer.getObjectsColor();

getObjsVisible(id)Boolean

获得指定ID的对象可见性。
Name Type Description
id Number 指定的对象ID。
Returns:
对象是否可见。
Example:
var  id = 12;
S3MTilesLayer. getObjsVisible (id);

getSelection()Array

获取选择集。
Returns:
包含所有被选中对象的ID数组。
Example:
S3MTilesLayer. getSelection();

refresh()

刷新图层

releaseSelection()

释放选择集。
Example:
S3MTilesLayer. releaseSelection();

removeAllFlattenRegion()

移除所有压平面。
Example:
S3MTilesLayer. removeAllFlattenRegion();

removeAllObjsColor()

移除所有对象的颜色。
Example:
S3MTilesLayer.removeAllObjsColor();

removeFlattenRegion(name)Boolean

移除指定名称的压平面。
Name Type Description
name String 待移除压平面的名称。
Returns:
移除成功返回true,失败返回false。
Example:
S3MTilesLayer. removeFlattenRegion(regionName);

removeObjsColor(ids)Boolean

移除指定ID对象列表的颜色。
Name Type Description
ids Array 要移除颜色的对象ID列表。
Returns:
移除成功返回true,否则返回false。
Example:
var  ids = [12, 22, 65, 98];
S3MTilesLayer.removeObjsColor(ids);

SetBound3D(left, bottom, right, top, minHeight, maxHeight)

为图层设置一个包围盒,盒子区域内模型具有体渲染效果,区域外模型保持原样。
Name Type Description
left Number 包围盒左侧的经度,以度为范围。
bottom Number 包围盒下方的纬度,以度为范围。
right Number 包围盒右侧的经度,以度为范围。
top Number 包围盒的上方的纬度,以度为范围。
minHeight Number 包围盒的高度最小值,以米为范围。
maxHeight Number 包围盒的高度最大值,以米为范围。

setCustomClipBox(options)Boolean

添加自定义裁剪面。
Name Type Description
options Object 裁剪面参数:
Name Type Description
dimensions Cartesian3 指定裁剪box的长宽高。
position Cartesian3 指定裁剪面位置。
clipMode String 指定裁剪模式。 裁剪模式包括以下几类:

clip_behind_any_plane:裁剪掉位于任何裁剪面后面的部分。

clip_behind_all_plane:裁剪掉位于所有裁剪面后面的部分。

only_keep_line:只保留裁剪线,裁剪掉其他部分。
Returns:
添加成功返回true,失败返回false。
Throws:
  • DeveloperError : options and options.dimensions and options.position are required.
Example:
var boxOptions = {
      dimensions : new Cesium.Cartesian3(10, 10, 10)
      position : Cesium.Cartesian3.fromDegrees(120, 40, 20),
      clipMode : "clip_behind_all_plane"
};
S3MTilesLayer.setCustomClipBox(boxOptions);

setObjsColor(ids, color)

设置对象颜色信息。
Name Type Description
ids Array 要设置颜色的对象ID列表。
color Color 要设置的颜色。
Example:
var color = new Cesium.Color(1.0, 0.0, 0.0, 1.0);
var  ids = [12, 22, 65, 98];
S3MTilesLayer.setObjectsColor(ids, color);

setObjsVisible(ids, visible)

设置对象可见性。
Name Type Description
ids Array 待设置可见性的对象ID数组。
visible Boolean 指定对象是否可见。
Example:
var ids = [12, 33, 44 , 65];
S3MTilesLayer. setObjsVisible (ids,false);

setQueryParameter(options)

设置属性查询参数。
Name Type Description
options Object 属性查询参数对象
Name Type Description
url String 数据服务的url地址。
dataSourceName String 用于属性查询的数据源名称。
dataSetName String 用于属性查询的数据集名称。
keyWord String 查询关键字,通常可采用'SmID'作为查询关键字。
Example:
layer.setQueryParameter({
                    url: 'localhost:8090/services/realspace/services/xxx/rest/data',
                    dataSourceName: 'xxx',
                    dataSetName: 'xxx',
                    keyWord: 'SmID'
});

setSelection(ids)

设置选择集,即选中指定ID数组的对象。
Name Type Description
ids Array 待选中的对象ID数组。
Example:
var  ids = [12, 22, 65, 98];
S3MTilesLayer. setSelection(ids);