STK二次开发

本文介绍了STK的三种二次开发工具:STK集成、STKEngine及STKComponents,并对比了它们的应用场景与优缺点。STK集成适用于自动化操作及与其他应用集成;STKEngine在无GUI环境下提供STK功能;STKComponents则用于深层定制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

STK二次开发

引言

内容摘自AGI官网,仅供参考。

1. 开发者工具

ArchitectureDiagram.png

2022-01-23_175650.png

STK主要提供了三种开发工具(方式),下面分别介绍。

1.1 STK集成

Automate STK and integrate it with other applications to extend its capabilities.

自动化操作STK(不需要手动点击界面进行操作),并将其与其他应用程序集成(如Matlab等),以扩展其功能。

STK Integration enables you to automate repetitive tasks from outside Systems Tool Kit (STK), integrate other applications with STK, and access STK’s capabilities from other applications. Integration provides access to two APIs — the STK Object Model and Connect. All the components of Integration are fully documented, and AGI maintains a GitHub repository of code samples to help you get started with the STK Object Model.

通过与STK集成,可以在STK外部自动化执行重复的任务,也可以通过其他应用程序调用STK的功能。提供两类API—STK对象模型和Connect连接,关于STK Object Model的发展历史可以参见:A History of the Development of the STK Object Model,其中重点如下:

Originally, the only way to programmatically modify STK was through “Connect Commands”. The outside applications were able to establish TCP/IP connection with STK and exchange string commands. While STK OM was created as replacement for the Connect commands, the Connect commands can still be used as part of the STK OM. The Connect commands are still important as they fill current gaps in the STK OM.

虽然STK OM是用来替代Connect commands,但两者并不独立,在STK OM中仍旧可以使用Connect

2022-01-23_182839.png

注:这种开发方式依赖于STK桌面端。

1.2 STK Engine

STK Engine gives you access to STK’s analytical and visualization capabilities without the weight of STK’s graphical user interface. Using the Connect or STK Object Model APIs, you can achieve a seamless integration with an existing application or design an entirely new application to support a specific workflow. And to achieve even more efficient computation speeds, you can deactivate visualization.

STK Engine可以看作是没有用户界面的STK。

2022-01-23_190151.png

注:STK Engine在Windows、Linux环境下均可以使用,在Windows环境下安装STK后,就已经包含STK Engine,在Linux环境下STK Engine是单独压缩包。

1.3 STK Components

STK Components is a collection of native Java and .Net libraries designed to provide an extensible, open architecture for analyzing and visualizing complex  problems. Use the STK Components libraries in conjunction with your proprietary business logic to accelerate the development and deployment of software solutions for your enterprise or programs.

STK Components是Java、.Net库的集合。

2022-01-24_102401.png

注:STK Components独立于STK桌面端,对其没有依赖,就是纯资源库。

STK Engine与STK Components的区别:

虽然两个产品都提供了API用来扩展和自动化操作STK,但是两者在有些方面还是有很大不同的,在实际项目中可以根据两者的强项来选择更适合的产品。

You should use STK Engine if the STK fits into your workflow already. You need less programming knowledge to create a custom application using Engine because it works with the STK user interface. If you are familiar with the STK Object Model and Connect, you can use both of those APIs with Engine. By default, Engine enables graphics, but you can disable them to speed up computations.

如果STK的工作流程已经满足需要,就可以选择STK Engine。

You should use STK Components if you want to customize STK down to the core. To achieve this level of customization, you will need to rely on strong programming skills to adapt Components to your needs. Your reward is simple but powerful — full control over the capabilities of STK. With Components, you have the flexibility to create an application completely specialized to your mission. By default, Components does not include graphics, but it’s easy to integrate them.

STK Components相对来说更底层一些,如果想要深入到STK内核进行定制化,就需要选择STK Components。

三者关系:STK Engine可以看成是没有用户界面的STK,STK Components的大部分可以看成是STK Engine的底层依赖。

2. 应用场景

2.1 STK集成

依赖于STK桌面端,通过自动化的方式解决一些重复性的工作。比如原来可能需要手动在STK内创建100个Facility,现在可以通过Matlab脚本或者其他语言的接口直接自动化创建。

2.2 STK Engine

想要使用STK中的已有功能,但是用户界面根据自己的业务需要进行开发。适合桌面端系统开发,不适合作为B/S系统的服务端(作为后端服务需要向前端提供CZML,Windows环境下CZML的生成依赖于Connect命令,就是说需要STK桌面端的支持,显然无法满足STK桌面端替代的需求;STK Engine提供Linux版本,解压后可用,可以满足不安装STK的需求,应该也可以导出CZML;但是STK Engine的操作首先建立在 AgStkObjectRoot上,在其之上有场景的加载或新建、场景对象的创建等,后端可能需要同时维护多个rootObject,类似于运行多个STK,极其耗费资源。因此不适合作为后端服务。)。

2.3 STK Components

想要对STK进行更深层次的定制化功能开发。适合桌面端系统开发,也可以作为B/S系统的服务端,后端将分析结果生成czml文档,前端通过Cesium对结果进行可视化展示。

参考链接

[1]. STK Developer Tools

[2]. A History of the Development of the STK Object Model

[3]. STK Components

[4]. STK Integration

[5]. STK Engine

<think>好的,用户想了解STK(Systems Tool Kit)的二次开发方法或教程,特别是API示例。首先,我需要整理已有的引用内容,看看里面有没有相关的信息。 引用[1]提到STK Engine的COM库位于安装目录的“bin\Primary Interop Assemblies”。这应该和COM接口开发相关,可能需要使用C#或VB.NET进行开发。用户可能需要注册这些COM库或者通过Interop来调用。 引用[2]虽然讲的是Sage X3的二次开发,但提到了RESTful API和SOAP API的使用方法,这可能对STK的API类型有所启发,不过不确定是否直接相关。需要确认STK是否支持类似的Web服务,但根据现有资料,引用[3]提到STK支持.NET VGT插件,特别是免注册的部署,这可能涉及到使用C#和.NET框架进行插件开发。 用户需要的是方法和教程,所以应该分点说明不同的开发方式,比如COM接口、.NET插件、REST/SOAP API(如果有的话)。但根据现有的引用,主要的信息集中在COM和.NET VGT插件上。可能需要结合引用[1]和引用[3]的内容。 接下来,我需要检查是否有遗漏的信息。比如,STK Engine二次开发通常使用COM技术,而VGT插件更多是用于分析工作台的矢量、点等计算。用户可能需要两种途径:一种是通过COM控制STK Engine,另一种是开发VGT插件扩展分析功能。 然后,关于教程和示例,引用[1]提到COM库的位置,引用[3]提到需要参考STK编程帮助中的构建引擎插件,这可能意味着STK自带的文档里有详细步骤。需要建议用户查阅这些文档,并提供基本的示例代码框架,比如C#调用COM库的示例,或者VGT插件的结构。 另外,用户可能需要API的具体调用方法,比如如何连接STK,创建场景,添加卫星等对象。这些可能需要使用STK Engine的API,比如IAgStkObjectRoot接口。示例代码应该展示如何初始化STK实例,创建场景,保存等基本操作。 对于VGT插件,引用[3]提到免注册的部署,说明可能需要创建类库,实现特定接口,然后部署到指定目录。这部分需要更详细的步骤,比如使用C#创建DLL,注册或放置到STK的插件目录,然后在STK中调用。 可能还需要提到STK的自动化接口(Automation),支持多种语言如Python,但引用中未直接提到,但根据常识,STK可以通过COM与Python结合,使用win32com库。不过现有引用中没有相关示例,可能需要建议用户查阅STK的Automation文档。 总结回答结构:分为COM接口开发、.NET VGT插件、API类型(如果有的话),以及学习资源。每个部分给出步骤和示例代码框架,并引用提供的引用来源。 还需要生成相关问题,可能涉及不同开发方式的比较、具体API调用问题、插件开发中的常见错误处理等。</think>### STK二次开发方法详解 STK提供多种二次开发接口,主要包括COM组件接口和.NET插件开发两种方式。以下是具体开发方法和示例: #### 一、基于COM组件的开发(STK Engine) 1. **环境准备** STK Engine的COM库位于安装目录`bin\Primary Interop Assemblies`,包含`AGI.STKObjects.dll`等关键程序集[^1]。 2. **C#开发示例** ```csharp using AGI.STKObjects; // 创建STK实例 AgStkObjectRoot stk = new AgStkObjectRoot(); stk.NewScenario("TestScenario"); // 创建卫星对象 IAgSatellite satellite = stk.CurrentScenario.Children.New( eSatellite, "MySatellite") as IAgSatellite; // 设置轨道参数 satellite.SetPropagatorType(ePropagatorTwoBody); IAgVePropagatorTwoBody propagator = satellite.Propagator as IAgVePropagatorTwoBody; propagator.InitialState.Representation.AssignClassical( eCoordinateSystemICRF, 7000, 0.1, 30, 0, 0, 0); propagator.Propagate(); // 保存场景 stk.SaveScenario(@"C:\Scenario\TestScenario.sc"); ``` 3. **Python调用COM接口** ```python import win32com.client stk = win32com.client.Dispatch("STK12.Application") root = stk.Personality2 root.NewScenario("PyScenario") ``` #### 二、.NET VGT插件开发 1. **开发流程** - 创建类库项目实现`IAgUtPluginConfig`接口[^3] - 编译DLL并部署到`STK安装目录\bin\Plugins` - 在STK分析工作台中调用插件 2. **矢量计算插件示例** ```csharp using AGI.STK.Plugin; [Guid("YOUR_GUID"), ComVisible(true)] public class MyVectorPlugin : IAgUtPluginConfig { public void Register(IAgUtPluginConfigRegistrar registrar) { registrar.RegisterVector("MyVector", "Custom vector calculation"); } public object GetPluginConfig(string className) { return new MyVectorImpl(); } } public class MyVectorImpl : IAgUtVectorPluginResult { public void ComputeVector(IAgUtVectorPluginResultComputeParams parameters) { // 矢量计算逻辑 parameters.OutputVector = ...; } } ``` #### 三、API类型与工具 STK支持的开发接口类型包括: - **COM Automation**:支持C#、Python、MATLAB等 - **REST API**(需STK Connect模块):通过HTTP协议交互[^2] - **.NET SDK**:提供STK Objects API深度集成 #### 四、学习资源推荐 1. 官方文档路径:`STK安装目录\Help\programming.chm` 2. 示例代码位置:`STK安装目录\CodeSamples` 3. 关键类库参考: - `AGI.STKObjects.dll`(核心对象模型) - `AGI.STKUtil.dll`(数学计算工具)
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值