function getInfo() { //设置控件的当前操作为自定义操作 var myAction = new SuperMap.Web.UI.Action3Ds.MyAction(sceneControl); sceneControl.set_sceneAction(myAction); } //通过继承SceneAction的方式来扩展用户的Action,继承方式采用框架提供的格式 //扩展Action的构造函数 SuperMap.Web.UI.Action3Ds.MyAction = function(sceneControl) { ///<param name="sceneControl" type="SuperMap.Web.UI.Controls.SceneControl"></param> SuperMap.Web.UI.Action3Ds.MyAction.initializeBase(this); this._name = "myAction"; this._sceneControl = sceneControl; this._type = SuperMap.Web.UI.Action3Ds.SceneActionType.MEASUREAREA; }; //扩展Action的属性和方法 SuperMap.Web.UI.Action3Ds.MyAction.prototype ={ /* * 析构方法 */ dispose:function() { ///<returns type="void"></returns> this._sceneControl = null; }, /* * 鼠标单击方法 */ onMouseDown:function(e) { ///<param name="e" type="EventObject"></param> ///<returns type="void"></returns> if(e.get_flagType() == SuperMap.Web.Realspace.FlagType.LBUTTON){ var point = sceneControl.pixelToGlobe(new SuperMap.Pixel(e.get_clientX(), e.get_clientY())); var point3d = new SuperMap.Web.Core.Point3D(e.get_longitude(),e.get_latitude(),e.get_altitude()); point3ds.add(point3d); } if(e.get_flagType() == SuperMap.Web.Realspace.FlagType.RBUTTON){ var p3ds = [point3ds]; var georegion3d = new SuperMap.Web.Core.GeoRegion3D(p3ds); } } };