添加了google中国和高德地图的切换

备份给中科浩电版本 限定时间为2019-06-20之前
This commit is contained in:
zxd 2018-11-13 11:21:00 +08:00
parent 039f2a57af
commit de05946d2c
11 changed files with 107 additions and 44 deletions

View File

@ -19,6 +19,19 @@ namespace Plane.FormationCreator.Formation
/// <param name="baseSemObjects"></param>
public int AddCopter(ICopter entityObject)
{
DateTime dateTime2019 = DateTime.Parse("2019-06-20");
if (DateTime.UtcNow > dateTime2019)
{
throw new NotImplementedException();
}
if (this.Count >= 50)
{
return 0;
}
int _index = 0;
if (this.Count == 0)
{

View File

@ -13,7 +13,7 @@
WindowTransitionsEnabled="False"
FontFamily="Microsoft YaHei"
WindowState="Maximized"
Title="无人机编队控制中心-飞行魔方科技"
Title="无人机编队控制中心"
PreviewKeyDown="MetroWindow_PreviewKeyDown"
PreviewKeyUp="MetroWindow_PreviewKeyUp"
Style="{StaticResource VSWindowStyleKey}"
@ -42,12 +42,14 @@
<c:MetroWindow.RightWindowCommands>
<c:WindowCommands>
<Button Content="切换地图" Command="{Binding ChangeMapModeCommand}"></Button>
<Button Content="切换地图" Visibility="Collapsed" Command="{Binding ChangeMapModeCommand}"></Button>
<Button Content="{Binding AppEx.ShowModifyTaskView, Converter={StaticResource ShowModifyTaskViewButtonContentConverter}}"
Command="{Binding ShowOrHideModifyTaskViewCommand}" />
<Button Content="重启监听"
Visibility="Collapsed"
Command="{Binding RestartListeningCommand}" />
<Button Content="{Binding SwitchVelocityModeButtonContent}"
Visibility="Collapsed"
Command="{Binding SwitchVelocityModeCommand}" />
<!--// 林俊清, 20150930, 不分这些模式了。
<Button Content="进入任务模式"
@ -60,16 +62,20 @@
Visibility="{Binding Source={x:Static local:AppEx.Current}, Path=AppMode, Converter={StaticResource AppModeToVisibilityConverter}, ConverterParameter=SwitchToControllingCoptersModeButton}" />-->
<Button Name="btnShowLog"
Content="日志"
Visibility="Collapsed"
Click="btnShowLog_Click"
/>
<Button Content="地图透明"
Visibility="Collapsed"
Click="Map_Opacity_Click"
/>
<Button Name="btnGoHome"
Content="回家"
Visibility="Collapsed"
Click="btnGoHome_Click" />
<Button Name="btnRefreshMap"
Content="刷新地图"
Visibility="Collapsed"
Click="btnRefreshMap_Click" />
<Button Name="btnConnect"
Content="连接"
@ -133,7 +139,7 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--
<TabControl SelectedIndex="{Binding MapMode,UpdateSourceTrigger=PropertyChanged}">
<TabItem Visibility="Collapsed">
<v:MapView x:Name="map"/>
@ -142,12 +148,12 @@
<v:View3D/>
</TabItem>
</TabControl>
-->
<!--
<v:MapView x:Name="map"/>
-->
<v:TaskBarView

View File

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Plane.FormationCreator"
mc:Ignorable="d"
Title="修改参数" Height="457.765" Width="669.987" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
Title="修改参数" Height="242.765" Width="618.987" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid Margin="0,0,5,3.5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@ -13,7 +13,7 @@
</Grid.ColumnDefinitions>
<WrapPanel>
<StackPanel Orientation="Horizontal" Margin="2" >
<StackPanel Orientation="Horizontal" Margin="2" Visibility="Collapsed">
<Button Content="检测通信" Tag="FS_GCS_ENABLE" Click="Modify_Select" Width="130"/>
<Label Content="_FS_GCS_ENABLE 0:关闭 1开启"/>
</StackPanel>
@ -28,42 +28,42 @@
<Label Content="_NTF_LED_BRIGHT 1-3"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<StackPanel Orientation="Horizontal" Margin="2" Visibility="Collapsed">
<Button Content="GPS类型灯光" Tag="NTF_G_RTKTEST" Click="Modify_Select" Width="130"/>
<Label Content="_NTF_G_RTKTEST 0:关闭 1:开启"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<StackPanel Orientation="Horizontal" Margin="2" Visibility="Collapsed">
<Button Content="š‹气压计‹GPS类型" Tag="EK2_ALT_GPS" Click="Modify_Select" Width="130"/>
<Label Content="_EK2_ALT_GPS 1-6"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<StackPanel Orientation="Horizontal" Margin="2" Visibility="Collapsed">
<Button Content="š最低解锁电压" Tag="ARMING_VOLT_MIN" Click="Modify_Select" Width="130"/>
<Label Content="_ARMING_VOLT_MIN"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<StackPanel Orientation="Horizontal" Margin="2" >
<Button Content="š返航灯光" Tag="NTF_G_RTLOFF" Click="Modify_Select" Width="130"/>
<Label Content="_NTF_G_RTLOFF"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<StackPanel Orientation="Horizontal" Margin="2" Visibility="Collapsed">
<Button Content="š航点灯光" Tag="WAYPOINT_GLED" Click="Modify_Select" Width="130"/>
<Label Content="_WAYPOINT_GLED"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<StackPanel Orientation="Horizontal" Margin="2" Visibility="Collapsed">
<Button Content="š解锁检查" Tag="ARMING_CHECK" Click="Modify_Select" Width="130"/>
<Label Content="_ARMING_CHECK 414"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<StackPanel Orientation="Horizontal" Margin="2" Visibility="Collapsed">
<Button Content="š解锁GPS类型" Tag="ARMING_GPS_LEVEL" Click="Modify_Select" Width="130"/>
<Label Content="_ARMING_GPS_LEVEL 1-6"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<StackPanel Orientation="Horizontal" Margin="2" Visibility="Collapsed">
<Button Content="š返航GPS类型" Tag="FS_GPS_RTL" Click="Modify_Select" Width="130"/>
<Label Content="_FS_GPS_RTL 1-6"/>
</StackPanel>
@ -77,7 +77,7 @@
<StackPanel Grid.Column="1" HorizontalAlignment="Center" Orientation ="Horizontal">
<WrapPanel VerticalAlignment="Center" Orientation="Vertical" >
<Label x:Name="label" Content="参数名称" Margin="5,0,5,5"/>
<TextBox x:Name="textParamName" Width="160" Margin="5"/>
<TextBox x:Name="textParamName" Width="160" Margin="5" IsReadOnly="True"/>
<Label x:Name="label_Copy" Content="参数值" Margin="5"/>
<TextBox x:Name="textParamValue" Margin="5"/>
<Button x:Name="btnModify" Content="修改" Width="100" Margin="10" Click="btnModify_Click"/>

View File

@ -128,6 +128,11 @@ namespace Plane.FormationCreator.ViewModels
{
return _AddVirtualCopterCommand ?? (_AddVirtualCopterCommand = new RelayCommand<int>(async addcount =>
{
if (_copterManager.Copters.Count() >= 50)
{
return;
}
var center = _mapManager.Center;
string id;

View File

@ -380,7 +380,7 @@ namespace Plane.FormationCreator.ViewModels
double minlat = 0;
double avgl = 0;
/*
if (_copterManager.SelectedCopters.Count() > 2)
{
List<FlightTaskSingleCopterInfo> selectTaskInfos = new List<FlightTaskSingleCopterInfo>();
@ -400,8 +400,8 @@ namespace Plane.FormationCreator.ViewModels
selectTaskInfos[i].TargetLat = minlat + i * tlat;
}
}
*/
/*
if (Alert.Show("本操作将导致飞机位置重新排列,编号最小的飞机在最上边,您确定要继续吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning)
== MessageBoxResult.OK)
{
@ -462,7 +462,7 @@ namespace Plane.FormationCreator.ViewModels
// await Task.Delay(100); // 如果不等待一段时间,很可能会再触发 DataStreamReceived 事件导致飞行器重新出现在地图上。
}
}*/
}
}));
}
}

View File

@ -75,16 +75,17 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Target="{Binding ElementName=txtIPs}"
<Label Target="{Binding ElementName=txtIPs}" Visibility="Collapsed"
Content="IP" />
<TextBox Name="txtIPs"
Grid.Column="2"
AcceptsReturn="True"
MinHeight="200"
ScrollViewer.VerticalScrollBarVisibility="Auto"
Visibility="Collapsed"
Text="{Binding IPs, UpdateSourceTrigger=PropertyChanged}" />
<StackPanel Orientation="Horizontal"
<StackPanel Orientation="Horizontal" Visibility="Collapsed"
HorizontalAlignment="Center"
Grid.Row="1"
Grid.ColumnSpan="3">
@ -124,7 +125,7 @@
CommandParameter="UDP" />-->
<Button Content="关闭TCP" Margin="5" Command="{Binding CloseCommand}"/>
</StackPanel>
<StackPanel Orientation="Horizontal"
<StackPanel Orientation="Horizontal" Visibility="Collapsed"
HorizontalAlignment="Center"
Grid.Row="2"
Grid.ColumnSpan="3">
@ -139,12 +140,12 @@
Grid.Row="3"
Grid.ColumnSpan="3">
<TextBox Margin="2,5,5,5" Width="30" Text="{Binding CopterNum}"></TextBox>
<Button Content="广播编号" Margin="5,5,0,5" Command="{Binding Path=WriteIdCommand}" />
<Button Content="闪灯" Margin="5" Command="{Binding CommDataAsync}"/>
<Button Content="搜索飞机" Margin="5" Command="{Binding QueryAllCopterCommand}"/>
<Button Content="对频" Margin="5,5,0,5" Command="{Binding Path=WriteIdCommand}" />
<Button Content="闪灯" Visibility="Collapsed" Margin="5" Command="{Binding CommDataAsync}"/>
<Button Content="搜索飞机" Visibility="Collapsed" Margin="5" Command="{Binding QueryAllCopterCommand}"/>
</StackPanel>
<StackPanel Orientation="Horizontal"
<StackPanel Orientation="Horizontal" Visibility="Collapsed"
HorizontalAlignment="Center"
Grid.Row="4"
Grid.ColumnSpan="3">

View File

@ -40,13 +40,13 @@
Command="{Binding GuidAsyncCommand}" />
<Button Content="悬停"
Command="{Binding HoverCommand}" />
<Button Content="手动"
<Button Content="手动" Visibility="Collapsed"
Command="{Binding FloatCommand}" />
<Button Content="参数"
Command="{Binding ParamModify}" />
<Button Content="参数文件"
<Button Content="参数文件" Visibility="Collapsed"
Command="{Binding LoadParamfile}" />
<Button Content="版本"
<Button Content="版本" Visibility="Collapsed"
Command="{Binding GetVersionsCommand}" />
</WrapPanel>
<WrapPanel>
@ -62,13 +62,14 @@
Command="{Binding LEDFlickerCommand}" />
<Button Content="测试" Visibility="Collapsed"
Command="{Binding TestCommand}" />
<Button Content="开灯"
<Button Content="开灯" Visibility="Collapsed"
Command="{Binding LEDOnOffCommand}"
CommandParameter="0"/>
<Button Content="关灯"
<Button Content="关灯" Visibility="Collapsed"
Command="{Binding LEDOnOffCommand}"
CommandParameter="1"/>
<Button Content="电机"
Visibility="Collapsed"
Command="{Binding MotorTestCommand}" />
<TextBox Width="50"
@ -78,7 +79,7 @@
<WrapPanel>
<Button Content="选写航点"
Command="{Binding WriteMissionSingleCommand}" />
<Button Content="统计模块"
<Button Content="统计模块" Visibility="Collapsed"
Command="{Binding DetectionCommModuleVersion}" />
</WrapPanel>
<Separator/>

View File

@ -59,13 +59,13 @@
Margin="5,0,0,0"
VerticalAlignment="Top"
SelectionChanged="MapSelectionComboBox_SelectionChanged">
<ComboBoxItem Content="卫星地图"
Tag="卫星地图"
<ComboBoxItem Content="Bing地图"
Tag="Bing地图"
IsSelected="True" />
<ComboBoxItem Content="道路"
Tag="道路" />
<ComboBoxItem Content="OpenStreet"
Tag="OpenStreet" />
<ComboBoxItem Content="谷歌地图"
Tag="谷歌地图" />
<ComboBoxItem Content="高德地图"
Tag="高德地图" />
</ComboBox>

View File

@ -32,6 +32,7 @@ using Plane.Windows.Messages;
using GMap.NET;
using GMap.NET.WindowsPresentation;
using GMap.NET.MapProviders;
using System.Globalization;
namespace Plane.FormationCreator.Views
{
@ -292,7 +293,7 @@ namespace Plane.FormationCreator.Views
gmap.Zoom = 19;
//map.Center = new Location(40.0559055, 116.322233);
//gmap.Position = new LatLng(40.6801557090282, 114.670060030638).ToGCJ02();
gmap.Position = new PointLatLng(40.1484605429763, 116.293929666281);
gmap.Position = new PointLatLng(38.973616, 117.200116);
}
@ -476,6 +477,25 @@ namespace Plane.FormationCreator.Views
private void MapSelectionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch ((e.AddedItems[0] as FrameworkElement).Tag.ToString())
{
case "Bing地图":
gmap.MapProvider = GMapProviders.BingHybridMap;
break;
case "谷歌地图":
gmap.MapProvider = GMapProviders.GoogleChinaHybridMap;
break;
case "高德地图":
gmap.MapProvider = GMapProviders.AMapStatelite;
break;
}
gmap.MinZoom = 2; //最小缩放
gmap.MaxZoom = 30; //最大缩放
gmap.Zoom = 19; //当前缩放
gmap.ShowCenter = false; //不显示中心十字点
gmap.DragButton = MouseButton.Left; //左键拖拽地图
/*
switch ((e.AddedItems[0] as FrameworkElement).Tag.ToString())
{
@ -502,6 +522,8 @@ namespace Plane.FormationCreator.Views
*/
}
private void showallpoint_Checked(object sender, RoutedEventArgs e)
{
CheckBox chk = (CheckBox)sender;
@ -604,4 +626,6 @@ namespace Plane.FormationCreator.Views
return GeographyUtils.CalcDistance(loc1.Latitude, loc1.Longitude, loc1.Altitude, loc2.Latitude, loc2.Longitude, loc2.Altitude);
}
}
}

View File

@ -8,7 +8,7 @@
xmlns:m="clr-namespace:Plane.FormationCreator.Formation"
mc:Ignorable="d"
d:DesignWidth="300" Height="420">
<TabControl>
<TabControl Margin="0,0,-120,-11">
<TabItem Header="航点设计">
<TabControl SelectedIndex="{Binding FlightTaskManager.SelectedTask.TaskTypeIndex,UpdateSourceTrigger=PropertyChanged}">
@ -287,6 +287,19 @@
</TabItem>
<TabItem Header="灯光设计">
<StackPanel DataContext="{Binding FlightTaskManager.SelectedTask.ModifyingSingleCopterInfo}">
<StackPanel Visibility="Collapsed">
<TextBlock Margin="5,5,0,0" Text="跑马灯"/>
<Separator/>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5,5,0,0" Text="起始时间"/>
<TextBox Margin="5,3,0,3" Width="50"/>
<TextBlock Margin="10,5,0,0" Text="结束时间"/>
<TextBox Margin="5,3,0,3" Width="50" />
<TextBlock Margin="10,5,0,0" Text="等分数量"/>
<TextBox Margin="5,3,0,3" Width="50" />
<Button Margin="10,3,0,3" Width="80" Content="设置"/>
</StackPanel>
</StackPanel>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@ -294,7 +307,7 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="灯光控制: " Margin="5, 10, 5, 0" VerticalAlignment="Center"/>
<TextBlock Text="灯光控制" Margin="5, 10, 5, 0" VerticalAlignment="Center"/>
<Grid Grid.Column="1" Grid.ColumnSpan="3" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition />

View File

@ -18,7 +18,7 @@
<ModelVisual3D Content="{Binding Model, UpdateSourceTrigger=PropertyChanged}">
</ModelVisual3D>
<HelixToolkit:PanoramaCube3D Source="E:\test\3DView\3DView\Models\Opera\"/>
<HelixToolkit:PanoramaCube3D Source="Models\Opera\"/>
</HelixToolkit:HelixViewport3D>
<StackPanel HorizontalAlignment="Left" Margin="2"