-
Notifications
You must be signed in to change notification settings - Fork 1
/
StkEngineHelper.GetSatellite.cs
42 lines (35 loc) · 1.27 KB
/
StkEngineHelper.GetSatellite.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using AGI.STKObjects;
//=============================================================================
// Edit By: Li Yunfei
// 20170927: 单独成文件
namespace StkEngineHelper
{
//#########################################################################
/// <summary>
/// StkEngine Object Model相关函数
/// </summary>
public static partial class StkObjectHelper
{
/// <summary>
/// 从场景中获取卫星
/// </summary>
/// <param name="SateName">卫星名称</param>
/// <returns></returns>
public static AgSatellite GetSatellite(string SateName)
{
try
{
if (stkRoot == null) throw new Exception("未与STK关联!");
// 检查STK场景是否包含此卫星
if (!stkRoot.CurrentScenario.Children.Contains(AgESTKObjectType.eSatellite, SateName)) throw new Exception("STK场景里无此卫星:" + SateName);
//
return (AgSatellite)stkRoot.CurrentScenario.Children[SateName];
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
}