Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StkMetadataExtractor
{
class Program
{
static void Main(string[] args)
{

StkMetadataExtractor.SummarizeScenario(args[0], args[1]);

}


}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("StkMetadataExtractor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StkMetadataExtractor")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bc521779-be3e-44ae-af3c-0f5707519287")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using AGI.STKObjects;
using AGI.STKX;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;

namespace StkMetadataExtractor
{
public static class StkMetadataExtractor
{
//Get a reference to the STK Engine Root
public static AgStkObjectRoot Root
{
get
{
// if it's already been created, just return it
if (_root != null) return _root;

// otherwise, start a new engine application
stkxApplication = new AgSTKXApplication();
// and capture the root
_root = new AgStkObjectRoot();

return _root;
}

set => _root = value;
}


public static void SummarizeScenario(string scenarioFilePath, string outputDirectory)
{
if (!Directory.Exists(outputDirectory))
{
Console.WriteLine("Output directory does not exist.");
return;
}

if (!File.Exists(scenarioFilePath))
{
Console.WriteLine("Scenario file not found.");
return;
}

// Load the scenario
Root.Load(scenarioFilePath);

//Summarize the scenario
var summary = StkObjectSummary.SummarizeStkObject(Root.CurrentScenario);

var xmlPath = Path.Combine(outputDirectory, Path.GetFileName(Path.ChangeExtension(scenarioFilePath, ".xml")));
using (var stringWriter = new StreamWriter(xmlPath))
{
// Serialize the resulting summary object
var serializer = new XmlSerializer(typeof(StkObjectSummary));
serializer.Serialize(stringWriter, summary);
}

// Determine what version of STK engine you are using
var version = stkxApplication.Version.Split('v').Last();
var versionInts = version.Split('.').Select(int.Parse).ToList();

// 12.0.0 doesn't support Cesium Export so if that's what you have, skip the czml export
if (versionInts[0] >= 12 && versionInts[1] >= 0 && versionInts[2] > 0)
{
var outputCzmlPath = Path.Combine(outputDirectory,
Path.GetFileName(Path.ChangeExtension(scenarioFilePath, ".czml")));
var cmd = $"ExportCZML * \"{outputCzmlPath}\" http://assets.agi.com/models/";
try
{
Root.ExecuteCommand(cmd);
}
catch (Exception e)
{
Console.WriteLine(e);
}
}

// Close the scenario and exit STK
Root.CloseScenario();
stkxApplication.Terminate();
}

private static AgSTKXApplication stkxApplication;
private static AgStkObjectRoot _root;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BC521779-BE3E-44AE-AF3C-0F5707519287}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>StkMetadataExtractor</RootNamespace>
<AssemblyName>StkMetadataExtractor</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="AGI.STKObjects.Interop">
<HintPath>..\..\..\..\..\..\..\Program Files\AGI\STK 12\bin\Primary Interop Assemblies\AGI.STKObjects.Interop.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="AGI.STKUtil.Interop">
<HintPath>..\..\..\..\..\..\..\Program Files\AGI\STK 12\bin\Primary Interop Assemblies\AGI.STKUtil.Interop.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="AGI.STKVgt.Interop">
<HintPath>..\..\..\..\..\..\..\Program Files\AGI\STK 12\bin\Primary Interop Assemblies\AGI.STKVgt.Interop.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="AGI.STKX.Interop">
<HintPath>..\..\..\..\..\..\..\Program Files\AGI\STK 12\bin\Primary Interop Assemblies\AGI.STKX.Interop.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StkObjectSummary.cs" />
<Compile Include="StkMetadataExtractor.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StkMetadataExtractor", "StkMetadataExtractor.csproj", "{BC521779-BE3E-44AE-AF3C-0F5707519287}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BC521779-BE3E-44AE-AF3C-0F5707519287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC521779-BE3E-44AE-AF3C-0F5707519287}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC521779-BE3E-44AE-AF3C-0F5707519287}.Debug|x64.ActiveCfg = Debug|x64
{BC521779-BE3E-44AE-AF3C-0F5707519287}.Debug|x64.Build.0 = Debug|x64
{BC521779-BE3E-44AE-AF3C-0F5707519287}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC521779-BE3E-44AE-AF3C-0F5707519287}.Release|Any CPU.Build.0 = Release|Any CPU
{BC521779-BE3E-44AE-AF3C-0F5707519287}.Release|x64.ActiveCfg = Release|x64
{BC521779-BE3E-44AE-AF3C-0F5707519287}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {41C5DD7D-048F-46DE-95F5-D9CDB485A487}
EndGlobalSection
EndGlobal
Loading