加入立体缩放比例设置,用于立体视图显示超出范围的航点
修复自动编号寻找的bug 开始修改通讯了---还没改完
This commit is contained in:
parent
e3f4e557dd
commit
7fb0bcf60e
@ -104,6 +104,14 @@ namespace Plane.FormationCreator.Formation
|
|||||||
public List<ICopter> ShowCopter = new List<ICopter>();
|
public List<ICopter> ShowCopter = new List<ICopter>();
|
||||||
|
|
||||||
|
|
||||||
|
//3维视图显示比例,有些大的图案显示不出来可以缩小
|
||||||
|
private float _scale3d = 1.0f;
|
||||||
|
public float scale3d
|
||||||
|
{
|
||||||
|
get { return _scale3d; }
|
||||||
|
set { Set(nameof(scale3d), ref _scale3d, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public CopterCollection Copters { get;} = new CopterCollection();
|
public CopterCollection Copters { get;} = new CopterCollection();
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
|
FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
|
||||||
float StepDis_Row = _flightTaskManager.ColumnDistance; //行内间距-列间距
|
float StepDis_Row = _flightTaskManager.ColumnDistance; //行内间距-列间距
|
||||||
float StepDis_Col = _flightTaskManager.RowDistance ; //列间距-行间距
|
float StepDis_Col = _flightTaskManager.RowDistance ; //列间距-行间距
|
||||||
float FindDis =Math.Min(StepDis_Row, StepDis_Col); //查找半径
|
float FindDis =Math.Min(StepDis_Row, StepDis_Col)*0.8f; //查找半径
|
||||||
if (_copterManager.AcceptingControlCopters.Count() >= 2)
|
if (_copterManager.AcceptingControlCopters.Count() >= 2)
|
||||||
{
|
{
|
||||||
var copters = _copterManager.AcceptingControlCopters.ToList();
|
var copters = _copterManager.AcceptingControlCopters.ToList();
|
||||||
|
@ -126,6 +126,15 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public float scale3d
|
||||||
|
{
|
||||||
|
get { return _copterManager.scale3d ; }
|
||||||
|
set { _copterManager.scale3d = value;}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int _CopterSum=100;
|
private int _CopterSum=100;
|
||||||
public int CopterSum
|
public int CopterSum
|
||||||
{
|
{
|
||||||
|
@ -1155,7 +1155,8 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
//循环3次 发送起飞命令 避免通信问题
|
//循环3次 发送起飞命令 避免通信问题
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
await _commModuleManager.DoMissionStartAsync(utchour,
|
await _commModuleManager.DoMissionStartAsync(_copterManager.Copters,
|
||||||
|
utchour,
|
||||||
utcminute,
|
utcminute,
|
||||||
utcsecond,
|
utcsecond,
|
||||||
_flightTaskManager.OriginLng,
|
_flightTaskManager.OriginLng,
|
||||||
@ -1384,7 +1385,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var targetCopter = _copterManager.Copters.FirstOrDefault(o => o.VirtualId == (i+1));
|
var targetCopter = _copterManager.Copters.FirstOrDefault(o => o.VirtualId == (i+1));
|
||||||
bool result = await _commModuleManager.WriteMissionListAsync(short.Parse(targetCopter.Id), missions);
|
bool result = await _commModuleManager.WriteMissionListAsync(targetCopter, missions);
|
||||||
//CommWriteMissinState state = new CommWriteMissinState(result);
|
//CommWriteMissinState state = new CommWriteMissinState(result);
|
||||||
//_commModuleManager.missionWriteState.Add(int.Parse(_copterManager.Copters[i].Id), state);
|
//_commModuleManager.missionWriteState.Add(int.Parse(_copterManager.Copters[i].Id), state);
|
||||||
if (!result)
|
if (!result)
|
||||||
|
@ -144,7 +144,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
|
|
||||||
//meshBuilderwaypoint.AddTriangle(new Point3D(-0.1, -0.1, 0), new Point3D(0.1, -0.1, 0), new Point3D(0, 0.2, 0));
|
//meshBuilderwaypoint.AddTriangle(new Point3D(-0.1, -0.1, 0), new Point3D(0.1, -0.1, 0), new Point3D(0, 0.2, 0));
|
||||||
//飞机点的大小形状
|
//飞机点的大小形状
|
||||||
meshBuilderwaypoint.AddSphere(new Point3D(0, 0, 0), 0.3);
|
meshBuilderwaypoint.AddSphere(new Point3D(0, 0, 0), 0.3* _copterManager.scale3d);
|
||||||
var meshwaypoint = meshBuilderwaypoint.ToMesh(true);
|
var meshwaypoint = meshBuilderwaypoint.ToMesh(true);
|
||||||
|
|
||||||
double y = GeographyUtils.CalcDistance(0, observationLatLng.Item1, 0, 0, copter.Latitude, 0) / 2;
|
double y = GeographyUtils.CalcDistance(0, observationLatLng.Item1, 0, 0, copter.Latitude, 0) / 2;
|
||||||
@ -153,12 +153,17 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
double x = GeographyUtils.CalcDistance(observationLatLng.Item2, 0, 0, copter.Longitude, 0, 0) / 2;
|
double x = GeographyUtils.CalcDistance(observationLatLng.Item2, 0, 0, copter.Longitude, 0, 0) / 2;
|
||||||
if (observationLatLng.Item2 > copter.Longitude) x = -x;
|
if (observationLatLng.Item2 > copter.Longitude) x = -x;
|
||||||
|
|
||||||
|
double z = copter.Altitude + 0.1;
|
||||||
|
|
||||||
|
x *= _copterManager.scale3d;
|
||||||
|
y *= _copterManager.scale3d;
|
||||||
|
z *= _copterManager.scale3d;
|
||||||
|
|
||||||
|
|
||||||
var model3D = new GeometryModel3D
|
var model3D = new GeometryModel3D
|
||||||
{
|
{
|
||||||
Geometry = meshwaypoint,
|
Geometry = meshwaypoint,
|
||||||
Transform = new TranslateTransform3D(x, y, copter.Altitude + 0.1),
|
Transform = new TranslateTransform3D(x, y, z),
|
||||||
Material = MaterialHelper.CreateMaterial(Color.FromRgb(238, 210, 238)),
|
Material = MaterialHelper.CreateMaterial(Color.FromRgb(238, 210, 238)),
|
||||||
BackMaterial = MaterialHelper.CreateMaterial(Color.FromRgb(238, 210, 238))
|
BackMaterial = MaterialHelper.CreateMaterial(Color.FromRgb(238, 210, 238))
|
||||||
};
|
};
|
||||||
@ -181,7 +186,9 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
double z = Math.Round(copter.Altitude / 2, 2);
|
double z = Math.Round(copter.Altitude / 2, 2);
|
||||||
|
|
||||||
GeometryModel3D panle3D = planeModel3Ds[copter];
|
GeometryModel3D panle3D = planeModel3Ds[copter];
|
||||||
|
x *= _copterManager.scale3d;
|
||||||
|
y *= _copterManager.scale3d;
|
||||||
|
z *= _copterManager.scale3d;
|
||||||
if (x != panle3D.Transform.Value.OffsetX || y != panle3D.Transform.Value.OffsetY || z != panle3D.Transform.Value.OffsetZ)
|
if (x != panle3D.Transform.Value.OffsetX || y != panle3D.Transform.Value.OffsetY || z != panle3D.Transform.Value.OffsetZ)
|
||||||
{
|
{
|
||||||
panle3D.Transform = new TranslateTransform3D(x, y, z);
|
panle3D.Transform = new TranslateTransform3D(x, y, z);
|
||||||
@ -227,7 +234,8 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
//modelGroup.Children.Clear();
|
//modelGroup.Children.Clear();
|
||||||
|
|
||||||
var meshBuilderwaypoint = new MeshBuilder(false, false);
|
var meshBuilderwaypoint = new MeshBuilder(false, false);
|
||||||
meshBuilderwaypoint.AddSphere(new Point3D(0, 0, 0), 0.2);
|
//航点的大小形状
|
||||||
|
meshBuilderwaypoint.AddSphere(new Point3D(0, 0, 0), 0.2* _copterManager.scale3d);
|
||||||
var meshwaypoint = meshBuilderwaypoint.ToMesh(true);
|
var meshwaypoint = meshBuilderwaypoint.ToMesh(true);
|
||||||
var greenMaterial = MaterialHelper.CreateMaterial(Color.FromRgb(0,255,0));
|
var greenMaterial = MaterialHelper.CreateMaterial(Color.FromRgb(0,255,0));
|
||||||
|
|
||||||
@ -239,12 +247,16 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
|
|
||||||
double x = GeographyUtils.CalcDistance(observationLatLng.Item2, 0, 0, info.TargetLng, 0, 0)/2;
|
double x = GeographyUtils.CalcDistance(observationLatLng.Item2, 0, 0, info.TargetLng, 0, 0)/2;
|
||||||
if (observationLatLng.Item2 > info.TargetLng) x = -x;
|
if (observationLatLng.Item2 > info.TargetLng) x = -x;
|
||||||
|
double z = info.TargetAlt / 2;
|
||||||
|
|
||||||
|
x *= _copterManager.scale3d;
|
||||||
|
y *= _copterManager.scale3d;
|
||||||
|
z *= _copterManager.scale3d;
|
||||||
|
|
||||||
waypointGroup.Children.Add(new GeometryModel3D
|
waypointGroup.Children.Add(new GeometryModel3D
|
||||||
{
|
{
|
||||||
Geometry = meshwaypoint,
|
Geometry = meshwaypoint,
|
||||||
Transform = new TranslateTransform3D(x, y, info.TargetAlt/2),
|
Transform = new TranslateTransform3D(x, y, z),
|
||||||
Material = greenMaterial,
|
Material = greenMaterial,
|
||||||
BackMaterial = greenMaterial
|
BackMaterial = greenMaterial
|
||||||
});
|
});
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
|
<RowDefinition Height="40" />
|
||||||
|
|
||||||
|
|
||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
<RowDefinition Height="30" />
|
<RowDefinition Height="30" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
@ -35,19 +38,7 @@
|
|||||||
|
|
||||||
<StackPanel Orientation="Horizontal"
|
<StackPanel Orientation="Horizontal"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Grid.Row="0"
|
Grid.Row="0" >
|
||||||
Name="panel2" >
|
|
||||||
<TextBlock Margin="5" VerticalAlignment="Center" Text="总数:" />
|
|
||||||
<TextBox Width="45" VerticalContentAlignment="Center" Text="{Binding CopterSum}" Margin="5,5,5,5" />
|
|
||||||
<Button Content="设置总数" Width="90" Margin="5,5,5,5" Command="{Binding Path=SendCommand}" />
|
|
||||||
<Button Content="切换写航点" Width="90" Margin="5,5,5,5" Command="{Binding Path=ChangeWriteMissionCommand}" />
|
|
||||||
<Button Content="通信状态" Width="90" Margin="5,5,5,5" Command="{Binding StateInquireCommand}"/>
|
|
||||||
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Grid.Row="1" >
|
|
||||||
<TextBlock Margin="5" VerticalAlignment="Center" Text="ID:" />
|
<TextBlock Margin="5" VerticalAlignment="Center" Text="ID:" />
|
||||||
<TextBox Width="30" VerticalContentAlignment="Center" Text="{Binding CopterNum}" Margin="5,5,5,5" />
|
<TextBox Width="30" VerticalContentAlignment="Center" Text="{Binding CopterNum}" Margin="5,5,5,5" />
|
||||||
<TextBlock Margin="5" VerticalAlignment="Center" Text="参数:" />
|
<TextBlock Margin="5" VerticalAlignment="Center" Text="参数:" />
|
||||||
@ -58,17 +49,42 @@
|
|||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Grid.Row="1"
|
||||||
|
Name="panel4" >
|
||||||
|
<Button Content="立体缩放" Width="90" Margin="5,5,5,5" Command="{Binding UpdateAllCopterCommand}"></Button>
|
||||||
|
<TextBlock Margin="5" VerticalAlignment="Center" Text="比例:" />
|
||||||
|
<TextBox Width="30" VerticalContentAlignment="Center" Text="{Binding scale3d}" Margin="5,5,5,5" />
|
||||||
|
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal"
|
<StackPanel Orientation="Horizontal"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
|
Name="panel2" >
|
||||||
|
<TextBlock Margin="5" VerticalAlignment="Center" Text="总数:" />
|
||||||
|
<TextBox Width="45" VerticalContentAlignment="Center" Text="{Binding CopterSum}" Margin="5,5,5,5" />
|
||||||
|
<Button Content="设置总数" Width="90" Margin="5,5,5,5" Command="{Binding Path=SendCommand}" />
|
||||||
|
<Button Content="切换写航点" Width="90" Margin="5,5,5,5" Command="{Binding Path=ChangeWriteMissionCommand}" />
|
||||||
|
<Button Content="通信状态" Width="90" Margin="5,5,5,5" Command="{Binding StateInquireCommand}"/>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Grid.Row="3"
|
||||||
Name="panel3" >
|
Name="panel3" >
|
||||||
<Button Content="空中升级" Width="90" Margin="5,5,5,5" Command="{Binding UpdateAllCopterCommand}"></Button>
|
<Button Content="空中升级" Width="90" Margin="5,5,5,5" Command="{Binding UpdateAllCopterCommand}"></Button>
|
||||||
<Button Content="搜索飞机" Width="90" Margin="5,5,5,5" Command="{Binding QueryAllCopterCommand}"/>
|
<Button Content="搜索飞机" Width="90" Margin="5,5,5,5" Command="{Binding QueryAllCopterCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Image Margin="0,0,0,0" x:Name="image1" Grid.RowSpan="2" Grid.Row="3" Source="/Resources/Logo_small.png" HorizontalAlignment="Left" />
|
|
||||||
<TextBlock Margin="5" Grid.Row="3" x:Name="about_ver" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="版本:V2.0.1213" />
|
|
||||||
<TextBlock Margin="5" Grid.Row="4" HorizontalAlignment="Right" x:Name="about_buildtm" VerticalAlignment="Bottom" Text="编译日期:2020.12.12" />
|
|
||||||
|
|
||||||
|
<Image Margin="0,0,0,0" x:Name="image1" Grid.RowSpan="2" Grid.Row="4" Source="/Resources/Logo_small.png" HorizontalAlignment="Left" />
|
||||||
|
<TextBlock Margin="5" Grid.Row="4" x:Name="about_ver" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="版本:V2.0.1213" />
|
||||||
|
<TextBlock Margin="5" Grid.Row="5" HorizontalAlignment="Right" x:Name="about_buildtm" VerticalAlignment="Bottom" Text="编译日期:2020.12.12" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user