3D GIS 中显示数据无法刷新

0 投票
使用产品 :iClient plugin 9D

操作系统:win7 64,IE11

function init(){
kmlLayer = scene.get_layer3Ds().get_item("monitor_kml");
var feas= kmlLayer.get_feature3Ds();
var feature3D = new SuperMap.Web.Core.Feature3D();
var geoText3D = new SuperMap.Web.Core.GeoText3D();
var position = new SuperMap.Web.Core.Point3D(115.24942954746477, 39.2602752557057, 100);
var textPart3D = new SuperMap.Web.Core.TextPart3D("压力:100;流量:100" , position);
geoText3D.addPart(textPart3D);
feature3D.set_geometry(geoText3D);
var style3d = new SuperMap.Web.Core.Style3D();
style3d.set_altitudeMode(1);
var textStyle = new SuperMap.Web.Core.TextStyle3D();
textStyle.set_outline(true);
textStyle.set_foreColor(new SuperMap.Web.Core.Color(255, 255, 0, 255));
textStyle.set_backColor(new SuperMap.Web.Core.Color(0, 0, 0, 255));
textStyle.set_isSizeFixed(true);
textStyle.set_fontScale(1);
feature3D.set_textStyle3D(textStyle);
feature3D.set_style3D(style3d);
feas.add(feature3D);

kmlLayer.get_feature3Ds().updateData();
kmlLayer.updated();
}

function refresh(){
                kmlLayer._innerLayer.Feature3Ds.RemoveAll();
                kmlLayer.updated();
                var feas= kmlLayer.get_feature3Ds();

                  var feature3D = new SuperMap.Web.Core.Feature3D();
                    var geoText3D = new SuperMap.Web.Core.GeoText3D();
                   var position = new SuperMap.Web.Core.Point3D(115.24942954746477, 39.2602752557057, 100);
                    var textPart3D = new SuperMap.Web.Core.TextPart3D("压力:999;流量:999", position);
                    geoText3D.addPart(textPart3D);
                    feature3D.set_geometry(geoText3D);
                    var style3d = new SuperMap.Web.Core.Style3D();
                    style3d.set_altitudeMode(1);
                    var textStyle = new SuperMap.Web.Core.TextStyle3D();
                    textStyle.set_outline(true);
                    textStyle.set_foreColor(new SuperMap.Web.Core.Color(255, 255, 0, 255));
                    textStyle.set_backColor(new SuperMap.Web.Core.Color(0, 0, 0, 255));
                    textStyle.set_isSizeFixed(true);
                    textStyle.set_fontScale(1);
                    feature3D.set_textStyle3D(textStyle);
                    feature3D.set_style3D(style3d);
                    feas.add(feature3D);

                kmlLayer.get_feature3Ds().updateData();
                kmlLayer.updated();

}
10月 6 分类:  23次浏览 | 用户: final_2008 (3 分)

2 个回答

0 投票
您好,我这边做一下测试再回复您,请稍候。
10月 8 用户: 张阳名 登峰造极 (5,347 分)
0 投票
请问一下,通过kml图层添加或者更新要素的业务需求是……?一般来说,前端需要添加要素的话,是建议通过跟踪图层(即trackinglayer)进行的。将您这个代码套给trackinglayer就没有问题了。示例中,可以参考EditFeature示例或者DrawPlacemarkAction示例。
10月 9 用户: 张阳名 登峰造极 (5,347 分)
业务需求是在实时平台中后端通过websocket发送设备的实时数据,前端GIS需要实时显示更新的数据。

请发一下考EditFeature示例或者DrawPlacemarkAction示例的地址。
示例就在插件客户端的包里。

路径:.\samplecode\samplecode\samples
...