SuperMap iClient3D for Plugin Reference  
clipByBox 方法
请参见  反馈

geometry
指定的长方体盒子。
part
指定的裁剪区域。

Glossary Item Box

 

模型图层BOX裁剪功能,根据指定的长方体盒子和裁剪区域对图层进行裁剪。

语法

ASP.NET Ajax Javascript (Specification)  
function clipByBox(

geometry : Geometry
part : BoxClipPart
) : void;
ASP.NET Ajax Javascript (Usage)  
var resultVar = instanceOfLayer3D.clipByBox(Geometry,BoxClipPart);

参数

geometry
指定的长方体盒子。
part
指定的裁剪区域。

备注

ClipByBox()和 SetCustomClipPlane() 方法仅其中一个起作用,生效后指定的方法,即若设置了BOX裁剪,SetCustomClipPlane()方法设置的裁剪面将不再起作用。
此设置可以用ClearCustomClipPlane()方法清除。。

示例

以下代码示范了如何实现BOX剖切查看
JavaScript 拷贝代码
function clip(){

var newAction = new SuperMap.Web.UI.Action3Ds.DrawBox(sceneControl);

设置用户当前操作类型为绘制长方体盒子 sceneControl.set_sceneAction(newAction);}

绘制长方体功能
SuperMap.Web.UI.Action3Ds.DrawBox = function (sceneControl) {
SuperMap.Web.UI.Action3Ds.DrawBox.initializeBase(this);

this._name = "DrawBox";

this._sceneControl = sceneControl;

this._points = new SuperMap.Web.Core.Point3Ds();
this._point;

this._type = SuperMap.Web.UI.Action3Ds.SceneActionType.POINTSELECT;

记录静态id
this._id1;

记录动态态id
this._id2;
};
SuperMap.Web.UI.Action3Ds.DrawBox.prototype = {
dispose: function () {
this._sceneControl = null;},

onMouseDown: function (e) {
if (e.get_flagType() % 2 == 1) {

this._point = new SuperMap.Web.Core.Point3D(e.get_longitude(), e.get_latitude(), e.get_altitude());

this._point3D = new SuperMap.Web.Core.GeoPoint3D(this._point);
var feature3D = new SuperMap.Web.Core.Feature3D();
feature3D.set_geometry(this._point3D);

获取场景的跟踪图层
trackingLayer = this._sceneControl.get_scene().get_trackingLayer3D();

设置跟踪图层可见性
trackingLayer.set_isVisible(true);

this._id = this._id + 1;

构造长方体盒子
var GeoBox = new SuperMap.Web.Core.GeoBox(200, 250, 150);

获取三维模型对象 var geomodel = GeoBox.getGeoModel(50, 50);

设置三维模型位置
geomodel.set_position(this._point);

GeoBox.set_position(this._point);

var feature = new SuperMap.Web.Core.Feature3D();
var style3d = new SuperMap.Web.Core.Style3D();

设置高度模式为距地相对高度模式 style3d.set_altitudeMode(1);

设置填充前景色
style3d.set_fillForeColor(new SuperMap.Web.Core.Color(255, 0, 0, 150));

设置三维要素风格
feature.set_style3D(style3d);

设置三维要素所对应的几何对象
feature.set_geometry(geomodel);

向跟踪图层添加几何对象
trackingLayer.add(feature3D, "Point3D" + this._id);

向跟踪图层添加几何对象
trackingLayer.add(feature, "GeoBox");

指定裁剪BOX内部,显示盒子外部
scene.get_layer3Ds().get_item("Building@OlympicGreen").clipByBox(GeoBox,0);

var panAction = new SuperMap.Web.UI.Action3Ds.Pan(sceneControl);

设置三维要素所对应的几何对象 sceneControl.set_sceneAction(panAction);
}
else {
var panAction = new SuperMap.Web.UI.Action3Ds.Pan(sceneControl);

设置用户当前操作类型为漫游操作 sceneControl.set_sceneAction(panAction);
}
}
};
SuperMap.Web.UI.Action3Ds.DrawBox.registerClass('SuperMap.Web.UI.Action3Ds.DrawBox', SuperMap.Web.UI.Action3Ds.SceneAction, Sys.IDisposable);

需求

操作系统: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7


浏览器: Internet Explorer 6 以上

请参见

© 2000-2011 北京超图软件股份有限公司 保留所有权利。