var drawAreaAction;
var drawBuild = function(){
//设置控件的当前操作为面积量算
var measureAreaAction = new SuperMap.Web.UI.Action3Ds.MeasureArea(sceneControl);
sceneControl.set_sceneAction(measureAreaAction);
//给面积量算事件和量算结束事件注册回调函数
sceneControl.addEvent("measureAreaFinished", drawFinish);
};
var drawFinish = function(dArea, line3D){
//量算结束后显示总的面积信息
var geoRegion = new SuperMap.Web.Core.GeoRegion3D();
var points = new SuperMap.Web.Core.Point3Ds();
for (var i = 0; i < line3D.get_partCount() ; i++) {
var point3Ds = line3D.getPart(i);
for (var j = 0; j < point3Ds.get_count() ; j++) {
var point3D = point3Ds.get_item(j);
points.add(point3D);
var geoPoint = new SuperMap.Web.Core.GeoPoint3D(point3D);
var feature3D = new SuperMap.Web.Core.Feature3D();
var style3D = new SuperMap.Web.Core.Style3D();
feature3D.set_geometry(geoPoint);
//定义节点颜色
style3D.set_markerColor(new SuperMap.Web.Core.Color(255, 0, 255, 225));
style3D.set_markerScale(5);
feature3D.set_style3D(style3D);
scene.get_trackingLayer3D().add(feature3D, 'p');
}
}
geoRegion.addPart(points);
var feature3d = new SuperMap.Web.Core.Feature3D();
feature3d.set_geometry(geoRegion);
var style3d = new SuperMap.Web.Core.Style3D();
feature3d.set_style3D(style3d);
//设置跟踪图层可见
scene.get_trackingLayer3D().set_isVisible(true);
//将feature3D加入跟踪图层
scene.get_trackingLayer3D().add(feature3d, "p1");
lashenModal();
};
function lashenModal(){
var feature = scene.get_trackingLayer3D().get_item("p1");
var style3d = feature.get_style3D();
style3d.set_fillForeColor(new SuperMap.Web.Core.Color(255, 255, 0, 255));
style3d.set_altitudeMode(SuperMap.Web.Realspace.AltitudeMode.RELATIVE_TO_GROUND);
style3d.set_extendHeight(100000);
style3d.set_bottomAltitude(5000);
feature.set_style3D(style3d);
scene.get_trackingLayer3D().refresh();
};
用这个代码画出来的图形拉伸之后没有出现拉伸的效果,而且图形消失