导出任务(C4D用)
This commit is contained in:
parent
dd8888efc2
commit
e5ded3d92a
@ -416,6 +416,29 @@ namespace Plane.FormationCreator.Formation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string ExportC4DFlytoTask()
|
||||||
|
{
|
||||||
|
int count = SelectedTask.SingleCopterInfos.Count();
|
||||||
|
//string[] lines = new string[count];
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
var singleCopterInfo = SelectedTask.SingleCopterInfos[i];
|
||||||
|
double x = 100 * GeographyUtils.CalcDistance(OriginLat, OriginLng, 0,
|
||||||
|
OriginLat, singleCopterInfo.TargetLng, 0);
|
||||||
|
if (singleCopterInfo.TargetLng < OriginLng) x = -x;
|
||||||
|
double y = 100 * singleCopterInfo.TargetAlt;
|
||||||
|
|
||||||
|
double z = 100 * GeographyUtils.CalcDistance(OriginLat, OriginLng, 0,
|
||||||
|
singleCopterInfo.TargetLat, OriginLng, 0);
|
||||||
|
if (singleCopterInfo.TargetLat < OriginLat) z = -z;
|
||||||
|
sb.AppendLine($"{i + 1} 0 {x} {y} {z}");
|
||||||
|
//lines[i] = $"{i+1} {x} {y} {z}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString().Trim();
|
||||||
|
}
|
||||||
|
|
||||||
public void ImportC4DFlytoTask(string txt)
|
public void ImportC4DFlytoTask(string txt)
|
||||||
{
|
{
|
||||||
string[] lines = txt.Replace("\r\n", "\n").Split('\n');
|
string[] lines = txt.Replace("\r\n", "\n").Split('\n');
|
||||||
@ -425,7 +448,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
string[] parameters = line.Split(' ');
|
string[] parameters = line.Split(' ');
|
||||||
int id = Convert.ToInt32(parameters[0])+1;
|
int id = Convert.ToInt32(parameters[0]);
|
||||||
string frame = parameters[1];
|
string frame = parameters[1];
|
||||||
string[] point = new string[3];
|
string[] point = new string[3];
|
||||||
point[0] = parameters[2]; //左右 经度
|
point[0] = parameters[2]; //左右 经度
|
||||||
|
@ -535,6 +535,29 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ICommand _ExportWayPointCommand;
|
||||||
|
public ICommand ExportWayPointCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _ExportWayPointCommand ?? (_ExportWayPointCommand = new RelayCommand<int>(async =>
|
||||||
|
{
|
||||||
|
var dialog = new SaveFileDialog
|
||||||
|
{
|
||||||
|
DefaultExt = "txt",
|
||||||
|
Filter = "文本文件|*.txt"
|
||||||
|
};
|
||||||
|
if (dialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
|
||||||
|
string exportedText = _flightTaskManager.ExportC4DFlytoTask();
|
||||||
|
|
||||||
|
File.WriteAllText(dialog.FileName, exportedText);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ICommand _OptimizeRouteCommand;
|
private ICommand _OptimizeRouteCommand;
|
||||||
public ICommand OptimizeRouteCommand
|
public ICommand OptimizeRouteCommand
|
||||||
{
|
{
|
||||||
|
@ -81,8 +81,8 @@
|
|||||||
Visibility="Collapsed"/>
|
Visibility="Collapsed"/>
|
||||||
<Button Content="优化路线" Command="{Binding OptimizeRouteCommand}"
|
<Button Content="优化路线" Command="{Binding OptimizeRouteCommand}"
|
||||||
Visibility="Collapsed"/>
|
Visibility="Collapsed"/>
|
||||||
<Button Content="导入航点" Command="{Binding ImportBlenderWayPointCommand}"
|
<Button Content="导入航点" Command="{Binding ImportBlenderWayPointCommand}"/>
|
||||||
/>
|
<Button Content="导出航点" Command="{Binding ExportWayPointCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Separator Margin="0,1"/>
|
<Separator Margin="0,1"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user