STK Components 二次开发- 卫星地面站

前期卫星地面站创建已经说过,本次说一下卫星和地面站可见性时卫星名称和轨迹线变色问题。

1.创建卫星

// Get the current TLE for the given satellite identifier.
var tleList = TwoLineElementSetHelper.GetTles(m_satelliteIdentifier, JulianDate.Now);

// Use the epoch of the first TLE, since the TLE may have been loaded from offline data.
m_epoch = tleList[0].Epoch;

// Propagate the TLE and use that as the satellite's location point.
var locationPoint = new Sgp4Propagator(tleList).CreatePoint();
m_satellite = new Platform
{
	Name = "Satellite " + m_satelliteIdentifier,
	LocationPoint = locationPoint,
	// Orient the satellite using Vehicle Velocity Local Horizontal (VVLH) axes.
	OrientationAxes = new AxesVehicleVelocityLocalHorizontal(m_earth.FixedFrame, locationPoint),
};

// Set the identifier for the satellite in the CZML document.
m_satellite.Extensions.Add(new IdentifierExtension(m_satelliteIdentifier));

// Configure a glTF model for the satellite.
m_satellite.Extensions.Add(new ModelGraphicsExtension(new ModelGraphics
{
	// Link to a binary glTF file.
	Model = new CesiumResource(GetModelUri("satellite.glb"), CesiumResourceBehavior.LinkTo),
	// By default, Cesium plays all animations in the model simultaneously, which is not desirable.
	RunAnimations = false,
}));

2.创建地面站

// Define the location of the facility using cartographic coordinates.
var location = new Cartographic(Trig.DegreesToRadians(-75.596766667), Trig.DegreesToRadians(40.0388333333), 0.0);
var locationPoint = new PointCartographic(m_earth, location);
m_facility = new Platform
{
	Name = "AGI HQ",
	LocationPoint = locationPoint,
	// Orient the facility using East-North-Up (ENU) axes.
	OrientationAxes = new AxesEastNorthUp(m_earth, locationPoint),
};

// Set the identifier for the facility in the CZML document. 
m_facility.Extensions.Add(new IdentifierExtension("AGI"));

// Configure a glTF model for the facility.
m_facility.Extensions.Add(new ModelGraphicsExtension(new ModelGraphics
{
	// Link to a binary glTF file.
	Model = new CesiumResource(GetModelUri("facility.glb"), CesiumResourceBehavior.LinkTo),
	RunAnimations = false,
	HeightReference = CesiumHeightReference.ClampToGround,
}));

// Configure label for AGI HQ.
m_facility.Extensions.Add(new LabelGraphicsExtension(new LabelGraphics
{
	Text = m_facility.Name,
	FillColor = Color.White,
	// Only show label when camera is far enough from the satellite,
	// to avoid visually clashing with the model.
	DistanceDisplayCondition = new Bounds(1000.0, double.MaxValue),
	HeightReference = CesiumHeightReference.ClampToGround,
}));

3.创建卫星和地面站关系

m_satelliteFacilityLink = new LinkInstantaneous(m_facility, m_satellite);

// Set the identifier for the link in the CZML document. 
m_satelliteFacilityLink.Extensions.Add(new IdentifierExtension("SatelliteFacilityAccess"));

// Specify how access should be constrained.  In this case, 
// access will only exist when no part of the earth is between AGI HQ and the satellite.
m_accessQuery = new CentralBodyObstructionConstraint(m_satelliteFacilityLink, m_earth);

// Configure graphical display of the access link.
m_satelliteFacilityLink.Extensions.Add(new LinkGraphicsExtension(new LinkGraphics
{
	// Show the access link only when access is satisfied.
	Show = new AccessQueryCesiumProperty<bool>(m_accessQuery, true, false, false),
	Material = new SolidColorMaterialGraphics(Color.Yellow),
}));

因为随着可见性变色,需要在关系中获取到可见时间。

AccessEvaluator evaluator = m_accessQuery.GetEvaluator();

// Compute the time intervals when the viewing location is able to see the satellite.
AccessQueryResult accessResult = evaluator.Evaluate(m_epoch, m_epoch.AddDays(1));
var accessIntervals = accessResult.SatisfactionIntervals;
var LabelResults = new TimeIntervalCollection<Color>();

LabelResults =GetColorList(accessIntervals, m_epoch, false);
m_satellite.Extensions.Add(new LabelGraphicsExtension(new LabelGraphics
{
	Text = new ConstantCesiumProperty<string>(m_satellite.Name),
	Font= new ConstantCesiumProperty<string>("20px"),
	FillColor = LabelResults,

}));

var LineResults = new TimeIntervalCollection<Color>();
LineResults = GetColorList(accessIntervals, m_epoch, true);
m_satellite.Extensions.Add(new PathGraphicsExtension(new PathGraphics
{
	Material = new PolylineOutlineMaterialGraphics
	{
		Color = LineResults,

		OutlineWidth = new ConstantCesiumProperty<double>(1.0),
		OutlineColor = new ConstantCesiumProperty<Color>(Color.Black),
	},
	Width = 2,
	LeadTime = Duration.FromMinutes(44).TotalSeconds,
	TrailTime = Duration.FromMinutes(44).TotalSeconds,
}));
  public static TimeIntervalCollection<Color> GetColorList(TimeIntervalCollection accessIntervals, Define.Link struLink,bool isLine)
  {
      var results = new TimeIntervalCollection<Color>();
      JulianDate tmp = new JulianDate();
      foreach (TimeInterval interval in accessIntervals)
      {
          if (results.Count() == 0)
          {
              results.Add(new TimeInterval<Color>(struLink.m_jBeginTime, interval.Start.ToGregorianDate().ToJulianDate(), Color.White, true, false));
          }

          if (tmp.ToString() != "")
          {
              results.Add(new TimeInterval<Color>(tmp, interval.Start.ToGregorianDate().ToJulianDate(), Color.White, true, false));
          }
          if(isLine)
          {
              results.Add(new TimeInterval<Color>(interval.Start.ToGregorianDate().ToJulianDate(), interval.Stop.ToGregorianDate().ToJulianDate(), Color.Red, false, true));
          }
          else
          {
              results.Add(new TimeInterval<Color>(interval.Start.ToGregorianDate().ToJulianDate(), interval.Stop.ToGregorianDate().ToJulianDate(), Color.Green, false, true));
          }

          tmp = interval.Stop.ToGregorianDate().ToJulianDate();
      }

      return results;
  }

效果:

轨迹线和名称变色

  • 9
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: STK Commu是一种常用的通信软件开发工具包(SDK),它具有丰富的功能和灵活的二次开发能力,可以用于各种通信领域的应用。在STK Commu的二次开发过程中,我们可以根据具体的需求进行定制开发,以实现特定的通信功能。 首先,我们可以利用STK Commu的API接口来实现与其他通信设备的连接和数据交互。例如,我们可以通过SDK提供的接口实现与传感器、终端设备或其他软件的通信,从而获得实时数据或进行远程控制。 其次,STK Commu还具备网络通信功能,可以支持TCP/IP、UDP等常见的通信协议。我们可以利用这些协议进行网络通信的二次开发,实现数据的传输和通信的稳定性。 此外,STK Commu还提供了丰富的数据处理和管理功能。我们可以使用SDK提供的数据处理接口,对接收到的数据进行解析、处理和存储。同时,STK Commu还支持多种数据格式,如JSON、XML等,使得数据的交互更加灵活多样。 在STK Commu的二次开发中,我们还可以根据需求进行界面定制和用户交互设计。通过SDK提供的界面开发工具,我们可以自定义通信软件的界面风格和布局,使其更加符合用户的需求和习惯。 总之,STK Commu作为一款通信软件开发工具包,具备强大的功能和灵活的二次开发能力,可以满足各种通信应用的需求。通过STK Commu的二次开发,我们可以实现与其他通信设备的连接和数据交互、网络通信功能、数据处理和管理以及界面定制等功能,从而开发出更加强大和定制化的通信软件。 ### 回答2: STK COMMU是一款功能强大的通信工具,具备二次开发的潜力。二次开发是指在原有软件基础上进行定制和扩展,以满足用户的特定需求。 对于STK COMMU的二次开发来说,首先需要了解其提供的功能和接口。通过查阅官方文档或联系软件开发商,可以获取相关资源和技术支持。 在二次开发过程中,我们可以通过编写插件或使用软件开发工具包(SDK)来实现定制化的功能。例如,插件可以增加新的通信协议、改进用户界面、增加数据分析功能等。 此外,我们还可以利用STK COMMU提供的API(应用程序接口)进行开发。API是一组预定义的函数和协议,可以帮助我们与软件进行交互。通过API,我们可以实现与其他软件的集成、数据传输、自动化控制等功能。 对于开发人员来说,具备一定的编程知识和技能是必要的。常见的编程语言如Python、Java、C++等都可以与STK COMMU进行集成。通过编写代码,我们可以进行高度的定制和扩展,以满足特定的需求和业务流程。 总之,STK COMMU的二次开发为用户提供了很多定制化的可能性。通过插件、SDK、API等手段,我们可以为用户量身定制通信工具,扩展其功能和性能,满足其特定的需求。这不仅提高了软件的灵活性和适用性,也促进了更广泛的应用和创新。 ### 回答3: stk commu二次开发是指在原有的stk commu软件基础上进行修改和扩展的开发工作。stk commu是一款用于通信协议仿真和分析的软件,通过对通信协议的建模和仿真,可以帮助用户测试和优化通信系统的性能。 在进行stk commu二次开发时,我们可以根据用户的需求来进行功能定制和改进,以满足特定的应用场景。可能的二次开发方向包括但不限于: 1. 新增通信协议支持:根据需要,可以扩展stk commu的协议库,使其支持更多的通信协议,如蓝牙、WiFi、LTE等。 2. 用户界面定制:可以根据用户的习惯和需求,进行界面的定制和优化,使其更符合用户的使用习惯和工作流程。 3. 数据分析功能增强:可以增加一些数据分析功能,如数据可视化、统计分析等,方便用户获取对通信系统性能的更全面和准确的认识。 4. 集成其他工具和平台:可以将stk commu与其他常用的工具和平台进行集成,如MATLAB、Python等,以便更方便地进行数据分析和算法验证等工作。 5. 性能优化和bug修复:可以对stk commu进行性能优化和bug修复,以提升软件的稳定性和可靠性。 在进行stk commu二次开发时,需要了解stk commu的内部架构和功能模块,并根据用户需求进行相应的开发工作。同时,要充分考虑软件的可扩展性和兼容性,确保二次开发的成果能够与原有的stk commu软件相互兼容和无缝集成。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值