首页 / 浏览问题 / 三维GIS / 问题详情
3D插件注册场景Action
48EXP 2017年06月15日
SuperMap.Web.UI.Action3Ds.DrawArea = function(sceneControl){
    SuperMap.Web.UI.Action3Ds.DrawArea.initializeBase(this);
    this._name = "DrawAreaAction";
    this._sceneControl = sceneControl;
    this._type = SuperMap.Web.UI.Action3Ds.SceneActionType.PAN;
};

SuperMap.Web.UI.Action3Ds.DrawArea.prototype ={
    dispose:function(){
        this._sceneControl = null;
    },
    onMouseDown:function(e)
    {
        var point = new SuperMap.Web.Core.Point3D(e.get_longitude(),e.get_latitude(),0);
        if(this._Point3Ds.get_count() > 0){
            this._Point3Ds.insert(point,this._Point3Ds.get_count()-1);
        }else{
            this._Point3Ds.add(point);
            this._Point3Ds.add(point);
        }
        var geoPoint = new SuperMap.Web.Core.GeoPoint3D(geoPoint);
        var feature = new SuperMap.Web.Core.Feature3D();
        var style3D = new SuperMap.Web.Core.Style3D();
        feature.set_geometry(geoPoint);
        
         //定义节点颜色
        style3D.set_markerColor(new SuperMap.Web.Core.Color(255, 0, 255, 225));
        style3D.set_markerScale(5);
        feature.set_style3D(style3D);
        
    }
};

SuperMap.Web.UI.Action3Ds.DrawArea.registerClass('SuperMap.Web.UI.Action3Ds.DrawArea',SuperMap.Web.UI.Action3Ds.SceneAction,Sys.IDisposable);

drawAreaAction = new SuperMap.Web.UI.Action3Ds.DrawArea(sceneControl);
sceneControl.set_sceneAction(drawAreaAction);

鼠标键按下不触onMouseDown发事件
问题关闭原因: 问题已解决

1个回答

您好,我直接复制您的代码,没问题呢。您确保下面这两句有执行才行哦:

drawAreaAction = new SuperMap.Web.UI.Action3Ds.DrawArea(sceneControl);
sceneControl.set_sceneAction(drawAreaAction);

3,389EXP 2017年06月16日
哦,可是在我这儿确实注册不进去,我想问一下,这个插件是不是在指定的浏览器和浏览器的模式才能正常运行啊?
IE内核(11以下)浏览器,谷歌需要45版本一下的浏览器并且开启NPAPI,其他不支持了。
...