STK Components 二次开发-创建卫星

news/2024/11/8 15:15:17/

1.卫星数据

可以用stk 里面自带的 参数帮助文档。

也可以自己下载

CelesTrak: Current GP Element Sets

这里你所需要的最新卫星数据全有。

其实创建需要的就是卫星的二根数。

给定二根数也可以。

读取数据库中的卫星数据

这个接口优先下载最新的。

var tleList = TwoLineElementSetHelper.GetTles(m_satelliteIdentifier, JulianDate.Now);

也可直接指定

var issTle =new TwoLineElementSet(@"1 25544U 98067A   10172.34241898  .00007451  00000-0  60420-4 0  36272 25544  51.6459 209.3399 0009135 352.3227 186.5240 15.71934500664129");

2.创建卫星对象


// Propagate the TLE and use that as the satellite's location point.
var issPoint = new Sgp4Propagator(issTle).CreatePoint();
var m_satellite= new Platform
{Name = "ISS",LocationPoint = issPoint,OrientationAxes = new AxesVehicleVelocityLocalHorizontal(earth.FixedFrame, issPoint),
};

3.设置卫星名称

var labelExtension = new LabelGraphicsExtension(new LabelGraphics
{Text = new ConstantCesiumProperty<string>(m_satellite.Name),FillColor = new ConstantCesiumProperty<Color>(Color.White),
});
m_satellite.Extensions.Add(labelExtension);

4.设置卫星模型

 // 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,}));

设置卫星轨迹线颜色

// Configure graphical display of the orbital path of the satellite
m_satellite.Extensions.Add(new PathGraphicsExtension(new PathGraphics
{// Configure the visual appearance of the line.Material = new PolylineOutlineMaterialGraphics{Color = new ConstantCesiumProperty<Color>(Color.White),OutlineWidth = new ConstantCesiumProperty<double>(1.0),OutlineColor = new ConstantCesiumProperty<Color>(Color.Black),},Width = 2,// Lead and Trail time indicate how much of the path to render.LeadTime = Duration.FromMinutes(44).TotalSeconds,TrailTime = Duration.FromMinutes(44).TotalSeconds,
}));

完成后的样子

完整代码

        private void CreateSatellite(){// 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,}));// Configure a label for the satellite.m_satellite.Extensions.Add(new LabelGraphicsExtension(new LabelGraphics{// Use the name of the satellite as the text of the label.Text = m_satellite.Name,// Change the color of the label after 12 hours. This demonstrates specifying that // a value varies over time using intervals.FillColor = new TimeIntervalCollection<Color>{// Green for the first half day...new TimeInterval<Color>(JulianDate.MinValue, m_epoch.AddDays(0.5), Color.Green, true, false),// Red thereafter.new TimeInterval<Color>(m_epoch.AddDays(0.5), JulianDate.MaxValue, Color.Red, false, true),},// 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),}));// Configure graphical display of the orbital path of the satellite.m_satellite.Extensions.Add(new PathGraphicsExtension(new PathGraphics{// Configure the visual appearance of the line.Material = new PolylineOutlineMaterialGraphics{Color = Color.White,OutlineWidth = 1.0,OutlineColor = Color.Black,},Width = 2.0,// Lead and Trail time indicate how much of the path to render.LeadTime = Duration.FromMinutes(44.0).TotalSeconds,TrailTime = Duration.FromMinutes(44.0).TotalSeconds,}));}

生成czml

        public void WriteDocument(TextWriter writer){// Configure the interval over which to generate data.// In this case, compute 1 day of data.var dataInterval = new TimeInterval(m_epoch, m_epoch.AddDays(1));// Create and configure the CZML document.var czmlDocument = new CzmlDocument{Name = "CesiumDemo",Description = "Demonstrates CZML generation using STK Components",RequestedInterval = dataInterval,// For this demonstration, include whitespace in the CZML// to enable easy inspection of the contents. In a real application,// this would usually be false to reduce file size.PrettyFormatting = true,// Configure the clock on the client to reflect the time for which the data is computed.Clock = new Clock{Interval = dataInterval,CurrentTime = dataInterval.Start,Multiplier = 15.0,},};// Add all of our objects with graphical extensions.czmlDocument.ObjectsToWrite.Add(m_satellite);// Write the CZML.czmlDocument.WriteDocument(writer);}


http://www.ppmy.cn/news/1241440.html

相关文章

python之pycryptodome模块,加密算法库

一、简介 PyCryptodome是PyCrypto库的一个分支&#xff0c;它是Python中最受欢迎的密码学库之一。PyCryptodome提供了许多密码学算法和协议的实现&#xff0c;包括对称加密、非对称加密、消息摘要、密码哈希、数字签名等。它还提供了一些其他功能&#xff0c;如密码学安全随机…

Linux学习笔记之六(进程之间的管道通信和信号处理)

目录 1、管道通信1.1、无名管道1.1、有名管道 2、信号处理2.1、信号的种类和发送2.2、信号的接受和处理 1、管道通信 管道通信是一个设备中进程与进程之间通信的一种方式&#xff0c;分为无名管道和有名管道两种。前者只能用于有亲缘关系的进程之间的通信&#xff0c;如父子进…

ethernet II 的故事

以太帧有很多种类型。不同类型的帧具有不同的格式和MTU值。但在同种物理媒体上都可同时存在。 以太网第二版或者称之为Ethernet II 帧&#xff0c;DIX帧&#xff0c;是最常见的帧类型。并通常直接被IP协议使用。 格式 当数据帧到达网卡时&#xff0c;网卡要先去掉前导码&#…

React基础入门

文章目录 创建项目组件和事件更新状态导出组件jsx react是目前最流行的前端框架&#xff0c;几乎也不用太介绍了。 创建项目 首先下载node.js&#xff0c;安装成功后&#xff0c;最好换成国内的源 npm config set registry https://registry.npm.taobao.org然后就可以使用脚…

发布鸿蒙的第一个java应用

1.下载和安装华为自己的app开发软件DevEco Studio HUAWEI DevEco Studio和SDK下载和升级 | HarmonyOS开发者 2.打开IDE新建工程&#xff08;当前用的IDEA 3.1.1 Release&#xff09; 选择第一个&#xff0c;其他的默认只能用(API9)版本&#xff0c;搞了半天才发现8&#xff…

常用脚本-持续更新(文件重命名、视频抽帧、拆帧、删除冗余文件、yolo2xml、转换图片格式、修改xml)

所有代码位置&#xff1a;Learning-Notebook-Codes/Python/常用脚本 1. 文件重命名 脚本路径&#xff1a;codes/files_rename.py脚本说明&#xff1a;可以自动重命名某个文件夹下指定类型的文件。 修改前文件名称: img1.jpg修改后文件名称: Le0v1n-20231123-X-0001.jpg imp…

flv视频轮播功能(单个时)

1.轮播思路 获取八个视频源的地址。 将这些地址分成两组&#xff0c;每组包含四个地址。 在页面中创建一个四分屏布局的视频播放器。 将第一组的四个视频地址分别插入到四分屏布局的四个视频框中。 设置一个定时器&#xff0c;每10秒执行一次。 每次定时器触发时&#xf…

Spark---基于Yarn模式提交任务

Yarn模式两种提交任务方式 一、yarn-client提交任务方式 1、提交命令 ./spark-submit --master yarn --class org.apache.spark.examples.SparkPi ../examples/jars/spark-examples_2.11-2.3.1.jar 100 或者 ./spark-submit --master yarn–client --class org.apache.s…