STK Components 二次开发-创建卫星

news2025/2/22 14:46:08

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  3627
                            2 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.coloradmin.cn/o/1253369.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

宝塔面板安装搭建DiscuzQ论坛教程与小程序上架发布后的展示效果

DiscuzQ论坛小程序上架发布后的展示效果&#xff1a; 1、需要用到的环境&#xff1a; php7.2 mysql5.7或者MariaDB 10.2(我安装用的mysql8.0) php除了必要的一些扩展外&#xff0c;还需要启用readlink、symlink函数等&#xff0c;具体看官方说明&#xff0c;安装的时候也会提醒…

MidJourney笔记(3)-Prompts

MidJourney的Prompts介绍 MidJourney的Prompts是MidJourney的核心之一,这也是我们后续使用MidJourney过程中最重要的工作内容,根据生成的图片,不断的优化我们的Prompts内容。 那Prompts的中文意思是提示的意思。 Prompts的提示语有很多,最基础的用法就是: /imagine prompt…

【数据结构实验】查找(一)基于散列表的查找算法

文章目录 1. 引言2. 实验原理2.1 散列表2.2 线性探测法2.3 冲突解决 3. 实验内容3.1 实验题目&#xff08;一&#xff09;输入要求&#xff08;二&#xff09;输出要求 3.2 算法实现3.3 代码整合 4. 实验结果 1. 引言 本实验将通过C语言实现基于散列表的查找算法 2. 实验原理 …

Unity 场景切换

Unity场景切换可使用以下方法&#xff1a; 1、SceneManager.LoadScene()方法&#xff1a; using UnityEngine.SceneManagement;// 切换到Scene2场景 SceneManager.LoadScene("Scene2"); 2、使用SceneManager.LoadSceneAsync()方法异步加载场景&#xff0c;异步加载…

Python pandas对表格进行整行整列筛选、删除或修改,对特定值进行修改

Pandas库的使用 Pandas库&#xff1a;从入门到应用(二)–行列数据读写 Python数据处理工具 ——Pandas&#xff08;数据的预处理&#xff09; Pandas库有两个数据类型: Series, DataFrame Series 索引 一维数据DataFrame 行列索引 二维数据 DataFrame类型 DataFrame类型…

VMware虚拟机网络配置详解

vmware为我们提供了三种网络工作模式&#xff0c;它们分别是&#xff1a;Bridged&#xff08;桥接模式&#xff09;、NAT&#xff08;网络地址转换模式&#xff09;、Host-Only&#xff08;仅主机模式&#xff09; 打开vmware虚拟机&#xff0c;我们可以在选项栏的“编辑”下的…

U盘报错无法访问文件或目录损坏且无法读取

使用电脑打开U盘的部分文件时提示无法访问&#xff0c;文件或目录损坏且无法读取 报错内容如下图&#xff1a; 因为我这个U盘是那种双接口的 Type-C和USB&#xff0c;前段时间被我摔了一下 看网上说这种双接口的U盘USB接口容易坏掉 尝试在手机上使用OTG打开&#xff0c;先测试…

二叉树详讲(一)---完全二叉树、满二叉树、堆

1.树的概念及其结构 1.1树的概念 树是一种非线性数据结构&#xff0c;是一种种抽象数据类型&#xff0c;旨在模拟具有树状结构的节点之间的层次关系。一颗树由诺干个点和诺干条边组成。每棵树只有一个根节点&#xff0c;根节点向下延申又有子节点和叶子节点&#xff0c;叶子节…

Linux 命令vim(编辑器)

(一)vim编辑器的介绍 vim是文件编辑器&#xff0c;是vi的升级版本&#xff0c;兼容vi的所有指令&#xff0c;同时做了优化和延伸。vim有多种模式&#xff0c;其中常用的模式有命令模式、插入模式、末行模式&#xff1a;。 (二)vim编辑器基本操作 1 进入vim编辑文件 1 vim …

Kotlin学习——kt里的集合List,Set,Map List集合的各种方法之Int篇

Kotlin 是一门现代但已成熟的编程语言&#xff0c;旨在让开发人员更幸福快乐。 它简洁、安全、可与 Java 及其他语言互操作&#xff0c;并提供了多种方式在多个平台间复用代码&#xff0c;以实现高效编程。 https://play.kotlinlang.org/byExample/01_introduction/02_Functio…

【代码】考虑电解槽变载启停特性与阶梯式碳交易机制的综合能源系统优化调度matlab-yalmip-cplex/gurob

程序名称&#xff1a;考虑电解槽变载启停特性与阶梯式碳交易机制的综合能源系统优化调度 实现平台&#xff1a;matlab-yalmip-cplex/gurobi 代码简介&#xff1a;提出了一种考虑 变载启停特性的电解槽混合整数线性模型&#xff0c;根据电 氢负荷可以实时调整设备工作状态&…

android系统新特性——用户界面以及系统界面改进

用户界面改进 Android用户界面改进最明显的就是MD了。MD是Google于2014年推出的设计语言&#xff0c;它是一套完整的设计系统&#xff0c;包含了动画、样式、布局、组件等一系列与设计有关的元素。通过对这些行为的描述&#xff0c;让开发者设计出更符合目标的软件&#xff0c…

代码随想录算法训练营 ---第四十三天

前言&#xff1a; 今天同样是01背包问题&#xff0c;今天详细学习了背包问题在各种场景下的应用。今天一道也没做出来&#xff0c;有点废。好难啊&#xff01;就是思路不太清晰&#xff0c;不知道如何去做&#xff0c;看了题解后感觉原来如此&#xff0c;但是想不出来。今天做…

蓝桥杯官网算法赛(蓝桥小课堂)

问题描述 蓝桥小课堂开课啦&#xff01; 海伦公式&#xff08;Herons formula&#xff09;&#xff0c;也称为海伦-秦九韶公式&#xff0c;是用于计算三角形面积的一种公式&#xff0c;它可以通过三条边的长度来确定三角形的面积&#xff0c;而无需知道三角形的高度。 海伦公…

②⑩② 【读写分离】Sharding - JDBC 实现 MySQL读写分离[SpringBoot框架]

个人简介&#xff1a;Java领域新星创作者&#xff1b;阿里云技术博主、星级博主、专家博主&#xff1b;正在Java学习的路上摸爬滚打&#xff0c;记录学习的过程~ 个人主页&#xff1a;.29.的博客 学习社区&#xff1a;进去逛一逛~ Sharding-JDBC Sharding-JDBC介绍使用 Shardin…

cmake install接口常用方式介绍

cmake install接口常用方式介绍 1 Synopsis2 Introduction2.1 DESTINATION <dir>2.2 PERMISSIONS <permission>...2.3 CONFIGURATIONS <config>...2.4 COMPONENT <component>2.5 EXCLUDE_FROM_ALL2.6 RENAME <name>2.7 OPTIONAL 3 Signatures4 E…

<JavaEE> 线程的五种创建方法 和 查看线程的两种方式

目录 一、线程的创建方法 1.1 继承 Thread -> 重写 run 方法 1.2 使用匿名内部类 -> 继承 Thread -> 重写 run 方法 1.3 实现 Runnable 接口 -> 重写 run 方法 1.4 使用匿名内部类 -> 实现 Runnable 接口 -> 重写 run 方法 1.5 使用 lambda 表达式 二…

Redis面试题:redis做为缓存,数据的持久化是怎么做的?两种持久化方式有什么区别呢?这两种方式,哪种恢复的比较快呢?

目录 面试官&#xff1a;redis做为缓存&#xff0c;数据的持久化是怎么做的&#xff1f; 面试官&#xff1a;这两种持久化方式有什么区别呢&#xff1f; 面试官&#xff1a;这两种方式&#xff0c;哪种恢复的比较快呢&#xff1f; 面试官&#xff1a;redis做为缓存&#xff…

Element-Plus 图标自动导入

&#x1f680; 作者主页&#xff1a; 有来技术 &#x1f525; 开源项目&#xff1a; youlai-mall &#x1f343; vue3-element-admin &#x1f343; youlai-boot &#x1f33a; 仓库主页&#xff1a; Gitee &#x1f4ab; Github &#x1f4ab; GitCode &#x1f496; 欢迎点赞…

【RTP】RTPSenderAudio::SendAudio

RTPSenderAudio 可以将一个opus帧封装为rtp包进行发送,以下是其过程:RTPSenderAudio::SendAudio :只需要提供payload部分 创建RtpPacketToSend 并写入各个部分 填充payload部分 sender 本身分配全session唯一的twcc序号 if (!rtp_sender_->