// 立方体 private void btn_Box_Click(object sender, EventArgs e) { GSOGeoBoxEntity box = new GSOGeoBoxEntity(); box.Length = 100; //长度,X方向,单位:米 box.Width = 200; //宽度,Y方向,单位:米 box.Height = 100; //高度,Z方向,单位:米 box.Position = GetCurrentViewPoint(); AddNewGeoToLayer(box, "立方体"); }
private void CtrlBoxEntityParamPage_Load(object sender, EventArgs e) { geoBoxEntity = m_Geometry as GSOGeoBoxEntity; if (geoBoxEntity != null) { textBoxHeight.Text = geoBoxEntity.Height.ToString(); textBoxWidth.Text = geoBoxEntity.Width.ToString(); textBoxLength.Text = geoBoxEntity.Length.ToString(); } }
//添加模型参照物 private void CreateModel() { GSOGeoBoxEntity box = new GSOGeoBoxEntity(); box.Length = 300; box.Height = 300; box.Width = 200; box.Position = new GSOPoint3d(120, 30, 0); GSOFeature feature = new GSOFeature(); feature.Geometry = box; _glbControl.Globe.MemoryLayer.AddFeature(feature); _glbControl.Globe.JumpToFeature(feature, 6860); _glbControl.Globe.Refresh(); }
private void ParamChanged() { geoBoxEntity = m_Geometry as GSOGeoBoxEntity; if (geoBoxEntity != null) { try { geoBoxEntity.Height = Convert.ToDouble(textBoxHeight.Text); geoBoxEntity.Width = Convert.ToDouble(textBoxWidth.Text); geoBoxEntity.Length = Convert.ToDouble(textBoxLength.Text); if (m_GlobeControl != null) { m_GlobeControl.Refresh(); } } catch (System.Exception exp) { Log.PublishTxt(exp); } } }
//船尾迹 private void btn_BoatTail_Click(object sender, EventArgs e) { if (!_glbControl.Globe.Ocean.Visible) { btn_Ocean.PerformClick(); } if (_glbControl.Globe.MemoryLayer.GetFeatureByName(_tailName, true).Length > 0) { return; } //重要:海面效果打开 _glbControl.Globe.Ocean.Visible = true; //创建运动物体 GSOGeoBoxEntity box = new GSOGeoBoxEntity(); box.Height = 30; box.Width = 3; box.Length = 10; box.Position = new GSOPoint3d(0, 0, 15); //创建要素 GSOFeature feature = new GSOFeature(); feature.Geometry = box; feature.Name = _tailName; _glbControl.Globe.MemoryLayer.AddFeature(feature); //尾迹位置 GSOPoint3d pntWave = new GSOPoint3d(0, 0, 0); //添加船尾迹效果 _glbControl.Globe.Ocean.AddShipWake(_tailName, pntWave, false, -130.0, 200.0, 45.0, 200.0); _glbControl.Globe.JumpToPosition(box.Position, EnumAltitudeMode.RelativeToGround, 400); timer_tail.Start(); }
//根据timer更新船尾迹 private void UpdateShipWake() { GSOFeatures resFeatures = _glbControl.Globe.MemoryLayer.GetFeatureByName(_tailName, true); if (resFeatures.Length < 1) { return; } //获得与船尾迹绑定的要素 GSOFeature shipFeature = resFeatures[0]; if (shipFeature != null && shipFeature.Visible) { //获取绑定的物体 GSOGeoBoxEntity geoModel = shipFeature.Geometry as GSOGeoBoxEntity; //更新物体 位置 geoModel.PositionX = geoModel.PositionX - 0.00001; //获得物体位置 GSOPoint3d pntWave = geoModel.Position; //更新船尾迹 _glbControl.Globe.Ocean.UpdateShipWake(_tailName, pntWave); } }