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
Binary file modified License.pdf
Binary file not shown.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

<img src="https://embed.widencdn.net/svg/agi/2lb9tthe8d/STK_LogotypeLtBg02.svg?u=ivc64j" alt="STK_LogotypeLtBg02" width="640">

AGI's ready-to-use STK and ODTK families of products, enterprise software, and developer tools help customers deliver digital engineering value and make better-informed decisions in a mission context at any stage in the program lifecycle: from planning and design to training and operations.
Welcome to the AGI Engineering Team's GitHub Repository where we'll be sharing our favorite utilities and demonstrations. Please feel free to browse the content for both functional tools to add to your tool kit or example code that you can refactor to fit your needs.

AGI's ready-to-use STK and ODTK families of products, enterprise software, and developer tools help customers deliver digital engineering value and make better-informed decisions in a mission context at any stage in the program lifecycle: from planning and design to training and operations. For more information, please visit the [AGI website](https://www.agi.com "AGI's Homepage").

## Featured Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace SendEphemerisToSTK
{
Expand Down Expand Up @@ -52,6 +53,7 @@ public static void SendEphemeris(string[] filePaths, out string errors)
{
satName = IncrementName(satName);
}

dynamic sat;
try
{
Expand Down Expand Up @@ -82,9 +84,58 @@ public static void SendEphemeris(string[] filePaths, out string errors)
{
_stkRoot.ExecuteCommand("ImportTLEFile * \"" + filePath + "\" AutoPropagate On");
}
else if (extension.ToUpperInvariant().Equals(".GPX"))
{
ReadGpx(filePath, out errors);
}
}
}

public static void ReadGpx(string gpxFilePath, out string errors)
{
errors = "";
var gvName = Path.GetFileNameWithoutExtension(gpxFilePath);
gvName = ToStkSafeName(gvName);

const int eGroundVehicle = 9;
while (_stkRoot.CurrentScenario.Children.Contains(eGroundVehicle, gvName))
{
gvName = IncrementName(gvName);
}

XmlDocument gpxDoc = new XmlDocument();
gpxDoc.Load(gpxFilePath);

XmlNamespaceManager nsmgr = new XmlNamespaceManager(gpxDoc.NameTable);
nsmgr.AddNamespace("x", "http://www.topografix.com/GPX/1/1");
XmlNodeList nl = gpxDoc.SelectNodes("//x:trkpt", nsmgr);
_stkRoot.ExecuteCommand("BatchGraphics * On");
_stkRoot.ExecuteCommand($"New / */GroundVehicle {gvName}");
_stkRoot.ExecuteCommand($"AltitudeRef */GroundVehicle/{gvName} Ref MSL");
_stkRoot.ExecuteCommand($"Graphics */GroundVehicle/{gvName} Waypoints Off");
_stkRoot.ExecuteCommand($"Graphics */GroundVehicle/{gvName} Basic LineWidth 3");
_stkRoot.ExecuteCommand("Units_Set * Connect DateFormat ISO-YMD");
foreach (XmlNode xnode in nl)
{
string name = xnode.Name;
string lat = xnode.Attributes["lat"].Value;
string lon = xnode.Attributes["lon"].Value;
string alt = xnode["ele"].InnerText;
string time = xnode["time"].InnerText.Replace("Z",string.Empty);
try
{
_stkRoot.ExecuteCommand($"AddWaypoint */GroundVehicle/{gvName} DetVelFromTime {lat} {lon} {alt} {time}");
}
catch
{
errors += $"Error adding waypoint, most likely a duplicate point {lat} {lon} {alt} {time} {Environment.NewLine}";
}
}

_stkRoot.ExecuteCommand("BatchGraphics * Off");
}


public static bool IsGeoRegime(string objectPath)
{
if (string.IsNullOrEmpty(objectPath)) return false;
Expand Down