在TE的二次开发中,可以选择一个对象,并飞到对象的位置,在其中可以加入一些其他的程序操作,假如想飞到对象完成后,进行一系列的程序操作,就需要在二次开发中定义TE的对象事件。

下边以在CS中开发一个飞到对象完成事件为例,具体的代码如下:

//定义对象的事件

_sgworld = new SGWorld66();

_sgworld.OnObjectAction += _sgworld_OnObjectAction;

//事件的实现

 string _tempLabel = string.Empty; //临时记录对象的ID

void _sgworld_OnObjectAction(string ObjectID, IAction66 Action)

        { 

           //事件会判断所有的对象,所以要根据临时对象做操作,并且是在对象停            //下来的情况下

            if (_tempLabel == ObjectID && Action.Code == ActionCode.AC_STOP)

            { 

              //得到对象停止,执行下一步操作

                dynamic _lab = _sgworld.Creator.GetObject(ObjectID); 

                _tempLabel = string.Empty;

            }

        }

//执行飞到对象事件

{

var _tPos = _sgworld.Creator.CreatePosition(_disPint.X, _disPint.Y, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, -89, 0, 500);

 _tempLabel = _sgworld.Creator.CreateLabel(_tPos, "", string.Empty).ID;

_sgworld.Navigate.FlyTo(_tempLabel);

}


此事件同样适用于飞到一个位置,需要自己程序创建个临时的对象,才能判断已经飞到了位置。


技术交流群:665060698

微信公众号:

image.png