Example #1
0
        // 球
        private void btn_Sphere_Click(object sender, System.EventArgs e)
        {
            GSOGeoSphereEntity sphere = new GSOGeoSphereEntity();

            sphere.Position = GetCurrentViewPoint();
            sphere.Radius   = 10;  //球体半径,单位:米
            sphere.Slices   = 600; //切分份数,默认32,越大表示精度越高,但计算量相应变高
            AddNewGeoToLayer(sphere, "球");
        }
        private void CtrlSphereEntityParamPage_Load(object sender, EventArgs e)
        {
            GSOGeoSphereEntity geoSphereEntity = m_Geometry as GSOGeoSphereEntity;

            if (geoSphereEntity != null)
            {
                textBoxRadius.Text = geoSphereEntity.Radius.ToString();
            }
        }
        private void textBoxRadius_TextChanged(object sender, EventArgs e)
        {
            GSOGeoSphereEntity geoSphereEntity = m_Geometry as GSOGeoSphereEntity;

            if (geoSphereEntity != null)
            {
                try
                {
                    geoSphereEntity.Radius = Convert.ToDouble(textBoxRadius.Text);
                    if (m_GlobeControl != null)
                    {
                        m_GlobeControl.Refresh();
                    }
                }
                catch (System.Exception exp)
                {
                    Log.PublishTxt(exp);
                }
            }
        }
        //根据timer更新涡轮
        private void UpdateRotorWash()
        {
            GSOFeatures resFeatures = _glbControl.Globe.MemoryLayer.GetFeatureByName(_RotorWashName, true);

            if (resFeatures.Length < 1)
            {
                return;
            }
            //获得与涡轮绑定的要素
            GSOFeature shipFeature = resFeatures[0];

            if (shipFeature != null && shipFeature.Visible)
            {
                GSOGeoSphereEntity geoModel = shipFeature.Geometry as GSOGeoSphereEntity;
                geoModel.PositionX = geoModel.PositionX - 0.000003;
                //获得物体位置
                GSOPoint3d pntWave = geoModel.Position;
                //更新涡轮
                _glbControl.Globe.Ocean.UpdateRotorWash(_RotorWashName, pntWave, 100);
            }
        }
        //直升机涡轮
        private void btn_HelicopterFly_Click(object sender, EventArgs e)
        {
            if (!_glbControl.Globe.Ocean.Visible)
            {
                btn_Ocean.PerformClick();
            }

            if (_glbControl.Globe.MemoryLayer.GetFeatureByName(_RotorWashName, true).Length > 0)
            {
                return;
            }

            //重要:海面效果打开
            _glbControl.Globe.Ocean.Visible = true;

            //创建涡轮物体
            GSOGeoSphereEntity ball = new GSOGeoSphereEntity();

            ball.Radius       = 10;
            ball.Position     = new GSOPoint3d(0, 0, 30);
            ball.Name         = _RotorWashName;
            ball.AltitudeMode = EnumAltitudeMode.RelativeToGround;

            //创建要素
            GSOFeature feature = new GSOFeature();

            feature.Geometry = ball;
            feature.Name     = _RotorWashName;

            //添加要素
            _glbControl.Globe.MemoryLayer.AddFeature(feature);
            //涡轮位置
            GSOPoint3d pntWave = new GSOPoint3d(0, 0, 15);

            //添加涡轮效果
            _glbControl.Globe.Ocean.AddRotorWash(_RotorWashName, pntWave, 100, 50);
            _glbControl.Globe.JumpToPosition(ball.Position, EnumAltitudeMode.RelativeToGround, 400);
            //计时器开始计时
            timer_Rotor.Start();
        }