Compare commits

...

2 Commits

Author SHA1 Message Date
PeterZhong
60a74d2b29 加入日志远程记录能力 2025-01-10 15:39:38 +08:00
PeterZhong
a5c55fedc3 Modify to Modern UI 2024-12-30 19:38:12 +08:00
11 changed files with 341 additions and 156 deletions

View File

@ -3,8 +3,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GisDevelop_Exp"
Startup="Application_Startup"
StartupUri="MainWindow.xaml">
StartupUri="MainWindow.xaml"
xmlns:ui="http://schemas.modernwpf.com/2019">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemeResources />
<ui:XamlControlsResources />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -5,23 +5,27 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GisDevelop_Exp"
mc:Ignorable="d"
Title="按属性查询" Height="323" Width="422"
Loaded="AttributeQuery_OnLoaded">
ResizeMode="NoResize"
Title="按属性查询" Height="330" Width="422"
Loaded="AttributeQuery_OnLoaded"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True"
ui:ThemeManager.RequestedTheme="Light">
<Canvas Margin="0,0,370,0">
<Label Content="选择图层" Canvas.Left="50" Canvas.Top="36"/>
<ComboBox x:Name="comboBoxLayers" Canvas.Left="121" Canvas.Top="40" Width="243" HorizontalAlignment="Left" VerticalAlignment="Center" SelectionChanged="ComboBoxLayers_OnSelectionChanged"/>
<ListBox x:Name="listBoxFields" Height="108" Width="123" d:ItemsSource="{d:SampleData ItemCount=5}" HorizontalAlignment="Left" Canvas.Top="84" VerticalAlignment="Center" Canvas.Left="36" SelectionChanged="ListBoxFields_OnSelectionChanged" MouseDoubleClick="ListBoxFields_OnMouseDoubleClick"/>
<ListBox x:Name="listBoxFieldValue" Height="108" Width="124" d:ItemsSource="{d:SampleData ItemCount=5}" Canvas.Top="84" Canvas.Left="276" HorizontalAlignment="Left" VerticalAlignment="Center" MouseDoubleClick="ListBoxFieldValue_OnMouseDoubleClick"/>
<Button x:Name="buttonEqual" Content="=" Canvas.Left="179" Canvas.Top="105" HorizontalAlignment="Left" VerticalAlignment="Top" Width="21" Height="22" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonNotEqual" Content="&lt;&gt;" Canvas.Left="200" Canvas.Top="105" Width="21" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonLike" Content="Like" Canvas.Left="221" Canvas.Top="105" Width="30" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonLessThan" Content="&lt;" Canvas.Left="179" Canvas.Top="127" Width="21" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonLessEqual" Content="&lt;=" Canvas.Left="200" Canvas.Top="127" Width="21" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonAnd" Content="And" Canvas.Left="221" Canvas.Top="127" Width="30" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonGreaterThan" Content="&gt;" Canvas.Left="179" Canvas.Top="149" Width="21" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonGreaterEqual" Content="&gt;=" Canvas.Left="200" Canvas.Top="149" Width="21" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonOr" Content="Or" Canvas.Left="221" Canvas.Top="149" Width="30" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<TextBox x:Name="textBoxWhere" Canvas.Left="36" TextWrapping="Wrap" Text="TextBox" Canvas.Top="212" Width="364" HorizontalAlignment="Left" VerticalAlignment="Center" Height="29"/>
<ListBox x:Name="listBoxFieldValue" Height="108" Width="124" d:ItemsSource="{d:SampleData ItemCount=5}" Canvas.Top="84" Canvas.Left="285" HorizontalAlignment="Left" VerticalAlignment="Center" MouseDoubleClick="ListBoxFieldValue_OnMouseDoubleClick"/>
<Button x:Name="buttonEqual" Content="=" Canvas.Left="168" Canvas.Top="84" VerticalAlignment="Top" Width="32" Height="32" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonNotEqual" Content="&lt;&gt;" Canvas.Left="200" Canvas.Top="84" Width="32" Height="32" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonLike" Content="Like" Canvas.Left="232" Canvas.Top="84" Width="48" Height="32" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonLessThan" Content="&lt;" Canvas.Left="168" Canvas.Top="117" Width="32" Height="32" MouseDoubleClick="OperatorButtonClick" HorizontalAlignment="Center"/>
<Button x:Name="buttonLessEqual" Content="&lt;=" Canvas.Left="168" Canvas.Top="149" Width="32" Height="32" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonAnd" Content="And" Canvas.Left="232" Canvas.Top="117" Width="48" Height="32" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonGreaterThan" Content="&gt;" Canvas.Left="200" Canvas.Top="117" Width="32" Height="32" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<Button x:Name="buttonGreaterEqual" Content="&gt;=" Canvas.Left="200" Canvas.Top="149" Width="32" Height="32" MouseDoubleClick="OperatorButtonClick" VerticalAlignment="Top"/>
<Button x:Name="buttonOr" Content="Or" Canvas.Left="232" Canvas.Top="149" Width="48" Height="32" VerticalAlignment="Top" MouseDoubleClick="OperatorButtonClick"/>
<TextBox x:Name="textBoxWhere" Canvas.Left="36" TextWrapping="Wrap" Text="TextBox" Canvas.Top="216" Width="364" HorizontalAlignment="Center" VerticalAlignment="Top" Height="29"/>
<Button Content="确认" Canvas.Left="36" Canvas.Top="262" RenderTransformOrigin="-0.278,-0.098" HorizontalAlignment="Left" VerticalAlignment="Center" Width="72" Click="ButtonBase_OK_OnClick"/>
<Button Content="取消" Canvas.Left="328" Canvas.Top="262" RenderTransformOrigin="-0.278,-0.098" Width="72" HorizontalAlignment="Left" VerticalAlignment="Center" Click="ButtonBase_Cancel_OnClick"/>
</Canvas>

View File

@ -131,34 +131,34 @@ namespace GisDevelop_Exp
private void OperatorButtonClick(object sender, RoutedEventArgs e)
{
Button btn = (Button)sender;//获取button按钮对象
switch (btn.Name)//根据button对象的名称来判断当前按下的按钮
Button btn = (Button)sender;
switch (btn.Name)
{
case "buttonEqual"://等于
case "buttonEqual":
textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "= ''");
break;
case "buttonNotEqual"://不等
case "buttonNotEqual":
textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "<> ''");
break;
case "buttonLike"://模糊谓词like
case "buttonLike":
textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "like '%%'");
break;
case "buttonLessThan"://小于
case "buttonLessThan":
textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "< ''");
break;
case "buttonLessEqual"://小于等于
case "buttonLessEqual":
textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "<= ''");
break;
case "buttonAnd"://与谓词and
case "buttonAnd":
textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "and");
break;
case "buttonGreaterThan"://大于
case "buttonGreaterThan":
textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "> ''");
break;
case "buttonGreaterEqual"://大于等于
case "buttonGreaterEqual":
textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", ">= ''");
break;
case "buttonOr"://或谓词or
case "buttonOr":
textBoxWhere.Text = string.Concat(textBoxWhere.Text, " ", "or");
break;
}

View File

@ -6,11 +6,15 @@
xmlns:local="clr-namespace:GisDevelop_Exp"
mc:Ignorable="d"
Title="拉框选择结果窗口" Height="450" Width="316"
Activated="LocationQueryResultsWindow_OnActivated">
Activated="LocationQueryResultsWindow_OnActivated"
ResizeMode="NoResize"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True"
ui:ThemeManager.RequestedTheme="Light">
<Canvas>
<ComboBox x:Name="comboBoxLayer" Canvas.Left="10" Canvas.Top="10" Width="164" HorizontalAlignment="Left" VerticalAlignment="Center" SelectionChanged="ComboBoxLayer_OnSelectionChanged"/>
<ComboBox x:Name="comboBoxRecord" Canvas.Left="174" Canvas.Top="10" Width="132" HorizontalAlignment="Left" VerticalAlignment="Center" SelectionChanged="ComboBoxRecord_OnSelectionChanged"/>
<DataGrid x:Name="dataGridContent" Height="377" Width="286" d:ItemsSource="{d:SampleData ItemCount=5}" HorizontalAlignment="Center" Canvas.Top="37" VerticalAlignment="Top" Canvas.Left="20"/>
<DataGrid x:Name="dataGridContent" Height="355" Width="296" d:ItemsSource="{d:SampleData ItemCount=5}" HorizontalAlignment="Left" Canvas.Top="59" VerticalAlignment="Center" Canvas.Left="10"/>
</Canvas>
</Window>

View File

@ -11,9 +11,16 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Esri.ArcGISRuntime.Toolkit">
<Version>100.15.0</Version>
</PackageReference>
<PackageReference Include="Esri.ArcGISRuntime.WPF">
<Version>200.5.0</Version>
</PackageReference>
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>

View File

@ -7,11 +7,15 @@
mc:Ignorable="d"
Title="LocationQueryResultsWindow" Height="450" Width="316"
Activated="LocationQueryResultsWindow_OnActivated"
Closed="LocationQueryResultsWindow_OnClosed">
Closed="LocationQueryResultsWindow_OnClosed"
xmlns:ui="http://schemas.modernwpf.com/2019"
ResizeMode="NoResize"
ui:WindowHelper.UseModernWindowStyle="True"
ui:ThemeManager.RequestedTheme="Light">
<Canvas>
<ComboBox x:Name="comboBoxLayer" Canvas.Left="10" Canvas.Top="10" Width="164" HorizontalAlignment="Left" VerticalAlignment="Center" SelectionChanged="ComboBoxLayer_OnSelectionChanged"/>
<ComboBox x:Name="comboBoxRecord" Canvas.Left="174" Canvas.Top="10" Width="132" HorizontalAlignment="Left" VerticalAlignment="Center" SelectionChanged="ComboBoxRecord_OnSelectionChanged"/>
<DataGrid x:Name="dataGridContent" Height="377" Width="286" d:ItemsSource="{d:SampleData ItemCount=5}" HorizontalAlignment="Center" Canvas.Top="37" VerticalAlignment="Top" Canvas.Left="20"/>
<DataGrid x:Name="dataGridContent" Height="355" Width="296" d:ItemsSource="{d:SampleData ItemCount=5}" HorizontalAlignment="Left" Canvas.Top="59" VerticalAlignment="Center" Canvas.Left="10"/>
</Canvas>
</Window>

View File

@ -6,12 +6,18 @@
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
xmlns:local="clr-namespace:GisDevelop_Exp"
mc:Ignorable="d"
Title="GIS开发实验" Height="450" Width="800"
MouseLeftButtonDown="LayerListBox_OnPreviewMouseLeftButtonDown">
Title="GIS开发实验" Height="500" Width="800"
MaxHeight="500" MaxWidth="800"
ResizeMode="CanMinimize"
MouseLeftButtonDown="LayerListBox_OnPreviewMouseLeftButtonDown"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True"
ui:ThemeManager.RequestedTheme="Light"
Loaded="MainWindow_OnLoaded">
<Window.Resources>
<local:MapViewModel x:Key="MapViewModel" />
</Window.Resources>
<Grid>
<ui:SimpleStackPanel>
<Menu x:Name="MenuContainer" Margin="0,0,0,0">
<MenuItem x:Name="Menu_File" Header="文件">
<MenuItem x:Name="Menu_OpenShp" Header="打开Shp" Click="Menu_OpenShp_Click" />
@ -68,15 +74,76 @@
<MenuItem x:Name="Menu_Add" Header="增加面" Click="Menu_Add_OnClick"></MenuItem>
<MenuItem x:Name="Menu_Modify" Header="修改" Click="Menu_Modify_OnClick"></MenuItem>
</MenuItem>
<MenuItem Header="测试">
<MenuItem x:Name="Menu_Test1" Header="Test1" Click="Menu_Test1_OnClick"></MenuItem>
</MenuItem>
</Menu>
<esri:MapView x:Name="MainMapView" Map="{Binding Map, Source={StaticResource MapViewModel}}" Margin="0,19,0,0"
ViewpointChanged="MainMapView_OnViewpointChanged" GeoViewTapped="MainMapView_OnGeoViewTapped"
MouseLeftButtonDown="MainMapView_OnMouseLeftButtonDown"
MouseRightButtonDown="MainMapView_OnMouseRightButtonDown"/>
<ListBox x:Name="LayerListBox" Width="143" SelectedIndex="0" RenderTransformOrigin="0.451,1.105"
Margin="0,56,0,13" HorizontalAlignment="Left" PreviewMouseMove="LayerListBox_OnPreviewMouseMove"
Drop="LayerListBox_OnDrop" PreviewMouseRightButtonDown="LayerListBox_OnPreviewMouseRightButtonDown"
PreviewMouseLeftButtonDown="LayerListBox_OnPreviewMouseLeftButtonDown">
<Grid Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="32">
</RowDefinition>
<RowDefinition Height="400">
</RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"></ColumnDefinition>
<ColumnDefinition Width="650"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1">
<esri:MapView x:Name="MainMapView" Map="{Binding Map, Source={StaticResource MapViewModel}}"
Margin="0,0,0,0"
ViewpointChanged="MainMapView_OnViewpointChanged"
GeoViewTapped="MainMapView_OnGeoViewTapped"
MouseLeftButtonDown="MainMapView_OnMouseLeftButtonDown"
MouseRightButtonDown="MainMapView_OnMouseRightButtonDown" />
<Border BorderBrush="#FF8B1D76" BorderThickness="2,2,2,2" HorizontalAlignment="Right" Height="180"
Width="180"
VerticalAlignment="Top" IsEnabled="False">
<esri:MapView x:Name="EagleMapView" />
</Border>
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom">
<ToolBar HorizontalAlignment="Left" Height="32" VerticalAlignment="Top" Width="150"
Margin="0,0,10,10"
x:Name="MovableToolbar">
<Button x:Name="Btn_Add_Shp" Height="32" Width="32" Click="Menu_OpenShp_Click">
<Button.Background>
<ImageBrush
ImageSource="D:\01_Development\10_Visual_Studio_Project\GisDevelop\GisDevelop_Exp\GisDevelop_Exp\add.png" />
</Button.Background>
</Button>
<Button x:Name="Btn_Add_Online" Height="32" Width="32" Click="Btn_Add_Online_OnClick">
<Button.Background>
<ImageBrush
ImageSource="D:\01_Development\10_Visual_Studio_Project\GisDevelop\GisDevelop_Exp\GisDevelop_Exp\online.png" />
</Button.Background>
</Button>
</ToolBar>
</Border>
<esri:MeasureToolbar HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top"
Height="32" MapView="{Binding ElementName=MainMapView, Mode=OneWay}" />
<esri:Compass HorizontalAlignment="Left" Margin="155,300,0,0"
GeoView="{Binding ElementName=MainMapView, Mode=OneWay}" />
<esri:ScaleLine Margin="155,350,0,0" VerticalAlignment="Top" Width="124" Height="47"
MapView="{Binding ElementName=MainMapView, Mode=OneWay}" />
<Border BorderBrush="#000000" BorderThickness="0" HorizontalAlignment="Right" Height="32"
Width="202"
VerticalAlignment="Top" IsEnabled="True" Margin="420,210,0,0">
<ComboBox x:Name="BasemapChooser" HorizontalAlignment="Right" Height="32" Margin="0,0,0,0"
VerticalAlignment="Top" Width="182"
SelectionChanged="BasemapChooser_OnSelectionChanged"
IsEnabled="True" />
</Border>
</Grid>
<ListBox x:Name="LayerListBox" Width="143" SelectedIndex="0" RenderTransformOrigin="0.451,1.105"
Margin="0,0,0,0" HorizontalAlignment="Left"
PreviewMouseMove="LayerListBox_OnPreviewMouseMove"
Drop="LayerListBox_OnDrop"
PreviewMouseRightButtonDown="LayerListBox_OnPreviewMouseRightButtonDown"
PreviewMouseLeftButtonDown="LayerListBox_OnPreviewMouseLeftButtonDown" Grid.Column="0">
</ListBox>
</Grid>
<!-- <ListBox.ContextMenu> -->
<!-- <ContextMenu> -->
<!-- <MenuItem Header="删除" x:Name="Context_Menu_Delete" Click="Context_Menu_Delete_OnClick"/> -->
@ -84,72 +151,60 @@
<!-- <MenuItem Header="图层符号化" x:Name="Context_Menu_Symbology" Click="Context_Menu_Symbology_OnClick"/> -->
<!-- </ContextMenu> -->
<!-- </ListBox.ContextMenu> -->
</ListBox>
<Popup x:Name="Layer_Popup" Placement="MousePoint" StaysOpen="True">
<Border Background="White" BorderBrush="Gray" BorderThickness="0.5">
<StackPanel>
<MenuItem Header="删除" x:Name="Context_Menu_Delete" Click="Context_Menu_Delete_OnClick" />
<MenuItem Header="缩放至图层" x:Name="Context_Menu_Fit" Click="Context_Menu_Fit_OnClick" />
<MenuItem Header="图层符号化" x:Name="Context_Menu_Symbology" Click="Context_Menu_Symbology_OnClick" />
</StackPanel>
</Border>
</Popup>
<Border BorderBrush="#FF8B1D76" BorderThickness="2,2,2,2" HorizontalAlignment="Right" Height="180" Width="202"
VerticalAlignment="Top" IsEnabled="False">
<esri:MapView x:Name="EagleMapView" />
</Border>
<Border BorderBrush="#000000" BorderThickness="1" HorizontalAlignment="Right" Height="24" Width="202"
VerticalAlignment="Top" IsEnabled="True" Margin="580,210,0,0"
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
<ComboBox x:Name="BasemapChooser" HorizontalAlignment="Left" Height="24" Margin="9,-1,0,-1"
VerticalAlignment="Top" Width="182" SelectionChanged="BasemapChooser_OnSelectionChanged"
IsEnabled="True" />
</Border>
<Grid Margin="0,18,0,350" Background="White">
<Button x:Name="BtnDraw" Content="开始绘制" HorizontalAlignment="Left" Height="26"
Margin="169,4,0,0" VerticalAlignment="Top" Width="68" Click="BtnDraw_Click" IsEnabled="False" />
<Label Content="类型" HorizontalAlignment="Left" Margin="51,4,0,0"
VerticalAlignment="Top" RenderTransformOrigin="1.618,0.654" />
<ComboBox x:Name="SketchModeComboBox" HorizontalAlignment="Left" Margin="90,4,0,0"
VerticalAlignment="Top" Width="62" IsEnabled="False" />
<Button x:Name="BtnEdit" Content="编辑 " HorizontalAlignment="Left" Height="26"
Margin="257,4,0,0" VerticalAlignment="Top" Width="68" IsEnabled="False" Click="BtnEdit_Click" />
<Button x:Name="BtnUndo" Content="撤销 " HorizontalAlignment="Left" Height="26"
Margin="349,4,0,0" VerticalAlignment="Top" Width="68" Command="{Binding UndoCommand}"
IsEnabled="False" />
<Button x:Name="BtnRedo" Content="恢复" HorizontalAlignment="Left" Height="26"
Margin="440,4,0,0" VerticalAlignment="Top" Width="68" Command="{Binding RedoCommand}"
IsEnabled="False" />
<Button x:Name="BtnComplete" Content="完成" HorizontalAlignment="Left" Height="26"
Margin="525,4,0,0" VerticalAlignment="Top" Width="68" RenderTransformOrigin="1.412,0.308"
Command="{Binding CompleteCommand}" IsEnabled="False" />
<Button x:Name="BtnCancel" Content="取消" HorizontalAlignment="Left" Height="26"
Margin="610,4,0,0" VerticalAlignment="Top" Width="68" RenderTransformOrigin="1.412,0.308"
Command="{Binding CancelCommand}" IsEnabled="False" />
<Button x:Name="BtnClear" Content="清空" HorizontalAlignment="Left" Height="26"
Margin="695,4,0,0" VerticalAlignment="Top" Width="68" RenderTransformOrigin="1.412,0.308"
IsEnabled="False" Click="BtnClear_Click" />
<CheckBox x:Name="CBEditBegin" Content="开始" HorizontalAlignment="Left"
Margin="5,9,0,0" VerticalAlignment="Top" RenderTransformOrigin="1.073,1.812"
Checked="CBEditBegin_Checked" />
</Grid>
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom">
<ToolBar HorizontalAlignment="Left" Height="32" VerticalAlignment="Top" Width="150" Margin="0,0,10,10"
x:Name="MovableToolbar">
<Button x:Name="Btn_Add_Shp" Height="32" Width="32" Click="Menu_OpenShp_Click">
<Button.Background>
<ImageBrush
ImageSource="D:\01_Development\10_Visual_Studio_Project\GisDevelop\GisDevelop_Exp\GisDevelop_Exp\add.png" />
</Button.Background>
</Button>
<Button x:Name="Btn_Add_Online" Height="32" Width="32" Click="Btn_Add_Online_OnClick">
<Button.Background>
<ImageBrush
ImageSource="D:\01_Development\10_Visual_Studio_Project\GisDevelop\GisDevelop_Exp\GisDevelop_Exp\online.png" />
</Button.Background>
</Button>
</ToolBar>
</Border>
</Grid>
<Popup x:Name="Layer_Popup" Placement="MousePoint" StaysOpen="True">
<Border Background="White" BorderBrush="Gray" BorderThickness="0.5">
<StackPanel>
<MenuItem Header="删除" x:Name="Context_Menu_Delete" Click="Context_Menu_Delete_OnClick" />
<MenuItem Header="缩放至图层" x:Name="Context_Menu_Fit" Click="Context_Menu_Fit_OnClick" />
<MenuItem Header="图层符号化" x:Name="Context_Menu_Symbology" Click="Context_Menu_Symbology_OnClick" />
</StackPanel>
</Border>
</Popup>
<Grid Margin="0,0,0,0" Grid.Row="0" MaxHeight="48" Height="48">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="32"></ColumnDefinition>
<ColumnDefinition Width="150"></ColumnDefinition>
<ColumnDefinition Width="95"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button x:Name="BtnDraw" Content="开始绘制" HorizontalAlignment="Left" Height="32"
Margin="0,0,0,0" VerticalAlignment="Top" Width="84" Click="BtnDraw_Click" IsEnabled="False"
Grid.Column="3" />
<Label Content="类型" HorizontalAlignment="Left" Margin="0,5,0,0"
VerticalAlignment="Top" RenderTransformOrigin="1.618,0.654" Grid.Column="1" />
<ComboBox x:Name="SketchModeComboBox" HorizontalAlignment="Left" Margin="0,0,0,0"
VerticalAlignment="Top" Width="150" IsEnabled="False" Grid.Column="2" />
<Button x:Name="BtnEdit" Content="编辑 " HorizontalAlignment="Left" Height="32"
Margin="0,0,0,0" VerticalAlignment="Top" Width="68" IsEnabled="False" Click="BtnEdit_Click"
Grid.Column="4" />
<Button x:Name="BtnUndo" Content="撤销 " HorizontalAlignment="Left" Height="32"
Margin="0,0,0,0" VerticalAlignment="Top" Width="68" Command="{Binding UndoCommand}"
IsEnabled="False" Grid.Column="5" />
<Button x:Name="BtnRedo" Content="恢复" HorizontalAlignment="Left" Height="32"
Margin="0,0,0,0" VerticalAlignment="Top" Width="68" Command="{Binding RedoCommand}"
IsEnabled="False" Grid.Column="6" />
<Button x:Name="BtnComplete" Content="完成" HorizontalAlignment="Left" Height="32"
Margin="0,0,0,0" VerticalAlignment="Top" Width="68" RenderTransformOrigin="1.412,0.308"
Command="{Binding CompleteCommand}" IsEnabled="False" Grid.Column="7" />
<Button x:Name="BtnCancel" Content="取消" HorizontalAlignment="Left" Height="32"
Margin="0,0,0,0" VerticalAlignment="Top" Width="68" RenderTransformOrigin="1.412,0.308"
Command="{Binding CancelCommand}" IsEnabled="False" Grid.Column="8" />
<Button x:Name="BtnClear" Content="清空" HorizontalAlignment="Left" Height="32"
Margin="0,0,0,0" VerticalAlignment="Top" Width="68" RenderTransformOrigin="1.412,0.308"
IsEnabled="False" Click="BtnClear_Click" Grid.Column="9" />
<CheckBox x:Name="CBEditBegin" Content="开始" HorizontalAlignment="Left"
Margin="0,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="1.073,1.812"
Checked="CBEditBegin_Checked" Grid.Column="0" />
</Grid>
</Grid>
</ui:SimpleStackPanel>
</Window>

View File

@ -3,6 +3,7 @@ using Esri.ArcGISRuntime.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@ -22,6 +23,7 @@ using Esri.ArcGISRuntime.Security;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using Esri.ArcGISRuntime.UI.Controls;
using Newtonsoft.Json;
using Color = System.Drawing.Color;
using Geometry = Esri.ArcGISRuntime.Geometry.Geometry;
using Polygon = Esri.ArcGISRuntime.Geometry.Polygon;
@ -51,6 +53,7 @@ enum CURRENTOPERATION
DelFeature,
AddPolygonFeature,
ModifyFeature,
SketchEdit
}
namespace GisDevelop_Exp
@ -92,17 +95,17 @@ namespace GisDevelop_Exp
private readonly Dictionary<string, Basemap> _basemapOptions = new Dictionary<string, Basemap>()
{
{ "Streets (Raster)", new Basemap(BasemapStyle.OSMStreets) },
{ "Streets (Vector)", new Basemap(BasemapStyle.OSMStreetsRelief) },
{ "Streets - Night (Vector)", new Basemap(BasemapStyle.ArcGISStreetsNight) },
{ "Imagery (Raster)", new Basemap(BasemapStyle.ArcGISImagery) },
{ "Imagery with Labels (Raster)", new Basemap(BasemapStyle.ArcGISImageryLabels) },
{ "Imagery with Labels (Vector)", new Basemap(BasemapStyle.ArcGISImageryStandard) },
{ "Dark Gray Canvas (Vector)", new Basemap(BasemapStyle.ArcGISDarkGray) },
{ "Light Gray Canvas (Raster)", new Basemap(BasemapStyle.ArcGISLightGray) },
{ "Light Gray Canvas (Vector)", new Basemap(BasemapStyle.ArcGISLightGrayBase) },
{ "Navigation (Vector)", new Basemap(BasemapStyle.ArcGISNavigation) },
{ "OpenStreetMap (Raster)", new Basemap(BasemapStyle.OSMNavigation) }
{ "OSMStreets", new Basemap(BasemapStyle.OSMStreets) },
{ "OSMStreetsRelief", new Basemap(BasemapStyle.OSMStreetsRelief) },
{ "ArcGISStreetsNight", new Basemap(BasemapStyle.ArcGISStreetsNight) },
{ "ArcGISImagery", new Basemap(BasemapStyle.ArcGISImagery) },
{ "ArcGISImageryLabels", new Basemap(BasemapStyle.ArcGISImageryLabels) },
{ "ArcGISImageryStandard", new Basemap(BasemapStyle.ArcGISImageryStandard) },
{ "ArcGISDarkGray", new Basemap(BasemapStyle.ArcGISDarkGray) },
{ "ArcGISLightGray", new Basemap(BasemapStyle.ArcGISLightGray) },
{ "ArcGISLightGrayBase", new Basemap(BasemapStyle.ArcGISLightGrayBase) },
{ "ArcGISNavigation", new Basemap(BasemapStyle.ArcGISNavigation) },
{ "OSMNavigation", new Basemap(BasemapStyle.OSMNavigation) }
};
private CURRENTOPERATION m_CurOper;
@ -137,6 +140,28 @@ namespace GisDevelop_Exp
listOfClipGraphics = new List<Graphic>();
}
public static async Task LogCheck()
{
string webhookUrl = "https://open.feishu.cn/open-apis/bot/v2/hook/83e1c04c-b22b-4407-a861-02ab14ff0389";
HttpClient client = new HttpClient();
try
{
PcLog pcLog = new PcLog("Open windows");
string jsonPayload = JsonConvert.SerializeObject(pcLog);
Console.WriteLine(pcLog.ToString());
string requestBody = "{\"msg_type\": \"text\",\"content\": {\"text\": \""+pcLog.ToString()+"\"}}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(webhookUrl, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
}
catch (HttpRequestException e)
{
MessageBox.Show("网络错误,请检查网络连接!");
}
}
private void Initialize()
{
MainMapView.Map = new Map(_basemapOptions.Values.First());
@ -176,6 +201,7 @@ namespace GisDevelop_Exp
await MainMapView.SetViewpointGeometryAsync(openedFeature.Extent);
}
}
AddLayerNameToList();
}
@ -211,6 +237,7 @@ namespace GisDevelop_Exp
MainMapView.Map.InitialViewpoint = geodatabaseViewPoint;
// MainMapView.Map = geodatabaseMap;
}
AddLayerNameToList();
}
@ -230,7 +257,7 @@ namespace GisDevelop_Exp
Color fillColor = Color.FromArgb(0, 0, 0, 0);
SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, fillColor, lineSymbol);
var graphicOverlay = new Esri.ArcGISRuntime.UI.GraphicsOverlay();
var envGraphic = new Esri.ArcGISRuntime.UI.Graphic(eagleViewEnvelop, fillSymbol);
var envGraphic = new Esri.ArcGISRuntime.UI.Graphic(vExtent, fillSymbol);
graphicOverlay.Graphics.Add(envGraphic);
EagleMapView.GraphicsOverlays.Add(graphicOverlay);
}
@ -710,32 +737,35 @@ namespace GisDevelop_Exp
{
MessageBox.Show(ex.ToString(), "There was a problem.");
}
}else if ( m_CurOper == CURRENTOPERATION.AddPolygonFeature)
}
else if (m_CurOper == CURRENTOPERATION.AddPolygonFeature)
{
if (linePoints == null)
linePoints = new List<MapPoint>();
if (linesList == null)
linesList = new List<Graphic>();
linePoints.Add(e.Location);//将当前点加入点集
if (linePoints.Count >= 2)//如果点集中点数足够
linePoints.Add(e.Location); //将当前点加入点集
if (linePoints.Count >= 2) //如果点集中点数足够
{
if (linesList.Count > 0 && linePoints.Count > 2)//已有加入的线图形,则移除当前的图形,重新加入新的图形
if (linesList.Count > 0 && linePoints.Count > 2) //已有加入的线图形,则移除当前的图形,重新加入新的图形
{
Graphic curGraphic = linesList[linesList.Count - 1];
MainMapView.GraphicsOverlays[0].Graphics.Remove(curGraphic);
linesList.Remove(curGraphic);
}
//SimpleLineSymbol lineSymbol = new SimpleLineSymbol();
//lineSymbol.Color = Color.Blue;
//lineSymbol.Style = SimpleLineSymbolStyle.Dash;
//lineSymbol.Width = 3;
Esri.ArcGISRuntime.Geometry.Polygon line = new
Esri.ArcGISRuntime.Geometry.Polygon(linePoints);//由点集构造线
Graphic lineGraphic = new Graphic(line, fillSymbol);//由线创建图形
MainMapView.GraphicsOverlays[0].Graphics.Add(lineGraphic);//加入该图形元素到覆盖层中
linesList.Add(lineGraphic);//同时,将该图形加入链表
Esri.ArcGISRuntime.Geometry.Polygon(linePoints); //由点集构造线
Graphic lineGraphic = new Graphic(line, fillSymbol); //由线创建图形
MainMapView.GraphicsOverlays[0].Graphics.Add(lineGraphic); //加入该图形元素到覆盖层中
linesList.Add(lineGraphic); //同时,将该图形加入链表
}
}else if (m_CurOper== CURRENTOPERATION.ModifyFeature)
}
else if (m_CurOper == CURRENTOPERATION.ModifyFeature)
{
if (_featureLayer == null)
return;
@ -951,8 +981,7 @@ namespace GisDevelop_Exp
aMap.InitialViewpoint = geodatabaseViewPoint;
MainMapView.Map = aMap;
}
AddLayerNameToList();
// AddLayerNameToList();
}
private void LayerListBox_OnPreviewMouseMove(object sender, MouseEventArgs e)
@ -1024,7 +1053,8 @@ namespace GisDevelop_Exp
Top = 5,
Right = 0,
Bottom = 5
}
},
Height = 32
};
Console.WriteLine(pLayers[i].Name);
cb.Content = pLayers[i].Name;
@ -1054,7 +1084,7 @@ namespace GisDevelop_Exp
CheckBox cb = sender as CheckBox;
cb.IsChecked = true;
int index = GetLayerIndex(cb.ToolTip as string);
MainMapView.Map.OperationalLayers[index-1].IsVisible = true;
MainMapView.Map.OperationalLayers[index - 1].IsVisible = true;
}
internal static class Utils
@ -1292,15 +1322,16 @@ namespace GisDevelop_Exp
private void MainMapView_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
if (m_CurOper== CURRENTOPERATION.AddPolygonFeature && linePoints != null)
if (m_CurOper == CURRENTOPERATION.AddPolygonFeature && linePoints != null)
{
Polygon poly = new Polygon(linePoints);//由点集构造线
Polygon poly = new Polygon(linePoints); //由点集构造线
AddFeature(poly, _featureLayer);
if (linePoints != null)
linePoints.Clear();
if (linesList != null)
linesList.Clear();
}
m_CurOper = CURRENTOPERATION.NullOpe;
}
@ -1313,6 +1344,7 @@ namespace GisDevelop_Exp
MessageBox.Show("几何类型和图层要素类型不匹配");
return;
}
// 创建要素
Feature feature = (Feature)pFeatureL.FeatureTable.CreateFeature();
feature.Geometry = pGeo;
@ -1456,11 +1488,8 @@ namespace GisDevelop_Exp
private async void SetClassBreaksRender(FeatureLayer pLayer, string sFieldName, int ClassifyCount = 5,
List<Symbol> pSymbolList = null)
{
//ClassBreaksRenderer
ClassBreaksRenderer pCBRenderer = new ClassBreaksRenderer();
//设置字段名
pCBRenderer.FieldName = sFieldName;
//设置统计查询条件,
StatisticDefinition statDefinitionMin = new StatisticDefinition(sFieldName, StatisticType.Minimum, "");
StatisticDefinition statDefinitionMax = new StatisticDefinition(sFieldName, StatisticType.Maximum, "");
List<StatisticDefinition> statDefinitions = new List<StatisticDefinition>
@ -1469,13 +1498,10 @@ namespace GisDevelop_Exp
statDefinitionMax,
};
StatisticsQueryParameters pQueryPara = new StatisticsQueryParameters(statDefinitions);
//执行统计查询
StatisticsQueryResult queryResult = await pLayer.FeatureTable.QueryStatisticsAsync(pQueryPara);
//从统计结果中获取最大值,获取最小值
string str;
object max = null, min = null;
double dMax, dMin;
//获取该字段的最大值,最小值,为后续分级做准备
IReadOnlyDictionary<string, object> sResult = queryResult.First().Statistics;
for (int i = 0; i < sResult.Count; i++)
{
@ -1488,11 +1514,9 @@ namespace GisDevelop_Exp
dMax = (double)(max);
dMin = (double)(min);
//计算并设置分级中每一级别的范围,以及符号
for (int i = 0; i < ClassifyCount; i++)
{
ClassBreak pClassBreak = new ClassBreak();
//每一级别范围的最大值、最小值
if (i == 0)
pClassBreak.MinValue = dMin;
else
@ -1500,16 +1524,13 @@ namespace GisDevelop_Exp
;
pClassBreak.MaxValue = dMin + (dMax - dMin) * (i + 1) / ClassifyCount;
Color tempColor = Color.FromArgb(i * 50 + 10, 255, 255);
//创建符号,这里图层为面层,直接创建面符号,注意若图层为 点层、线层,需创建对应的点符号、线符号
SimpleLineSymbol tempSymbol2 = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Gray,
1);
Symbol pSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, tempColor, tempSymbol2);
pClassBreak.Symbol = pSymbol;
//将设置好的ClassBreak放入ClassBreaksRenderer中。
pCBRenderer.ClassBreaks.Add(pClassBreak);
}
//将创建好的ClassBreaksRenderer 赋值给图层
pLayer.Renderer = pCBRenderer;
}
@ -1583,7 +1604,6 @@ namespace GisDevelop_Exp
pSymbol = null;
SetSimpleRender((FeatureLayer)symbologyLayer, null);
}
e.Handled = true;
}
@ -1639,6 +1659,7 @@ namespace GisDevelop_Exp
{
try
{
m_CurOper = CURRENTOPERATION.SketchEdit;
BtnCancel.IsEnabled = true;
BtnRedo.IsEnabled = true;
BtnUndo.IsEnabled = true;
@ -1860,5 +1881,18 @@ namespace GisDevelop_Exp
{
_featureLayer.ClearSelection();
}
private async void Menu_Test1_OnClick(object sender, RoutedEventArgs e)
{
QueryParameters qp = new QueryParameters();
qp.WhereClause = "FID = 1";
FeatureQueryResult qr = await _featureLayer.FeatureTable.QueryFeaturesAsync(qp);
List<Feature> list = qr.ToList();
}
private async void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
{
await LogCheck();
}
}
}

View File

@ -7,7 +7,11 @@
mc:Ignorable="d"
Title="符号系统" Height="453" Width="399"
Loaded="Window_Loaded"
x:Name="Options_Window">
x:Name="Options_Window"
ResizeMode="NoResize"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True"
ui:ThemeManager.RequestedTheme="Light">
<Grid Margin="0,0,30,70">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="726*"/>

63
GisDevelop_Exp/PcLog.cs Normal file
View File

@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace GisDevelop_Exp;
public class PcLog
{
private string time_now;
private List<string> ip;
private string mac;
private string user;
private string action;
public PcLog(string action)
{
this.action = action;
this.time_now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
string hostName = Dns.GetHostName();
IPHostEntry ipEntry = Dns.GetHostEntry(hostName);
this.ip = new List<string>();
foreach (var ip in ipEntry.AddressList) {
this.ip.Add(ip.ToString());
}
this.mac = GetMacByNetworkInterface();
this.user = Environment.UserName;
}
public async Task GetPublicIP(string[] args) {
string url = "http://ip-api.com/json/?fields=query";
using (HttpClient client = new HttpClient()) {
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
}
}
public string GetMacByNetworkInterface() {
string macAddress = string.Empty;
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) {
if (nic.NetworkInterfaceType == NetworkInterfaceType.Ethernet && nic.OperationalStatus == OperationalStatus.Up) {
macAddress = nic.GetPhysicalAddress().ToString();
macAddress = FormatMacAddress(macAddress);
break;
}
}
return macAddress;
}
private string FormatMacAddress(string macAddress) {
return Regex.Replace(macAddress, @"(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})", "$1:$2:$3:$4:$5:$6");
}
public string ToString()
{
string content = "Time: " + this.time_now + "%%" + "IP: " + string.Join(", ", this.ip) + "%%" + "MAC: " + this.mac + "%%" + "User: " + this.user + "%%" + "Action: " + this.action;
return content;
}
}

View File

@ -6,9 +6,13 @@
xmlns:local="clr-namespace:GisDevelop_Exp"
mc:Ignorable="d"
Title="QueryResultWindow" Height="450" Width="319"
Loaded="QueryResultWindow_OnLoaded">
Loaded="QueryResultWindow_OnLoaded"
xmlns:ui="http://schemas.modernwpf.com/2019"
ResizeMode="NoResize"
ui:WindowHelper.UseModernWindowStyle="True"
ui:ThemeManager.RequestedTheme="Light">
<Canvas>
<ComboBox x:Name="comboBoxSelectionCount" Canvas.Left="23" Canvas.Top="21" Width="273" HorizontalAlignment="Left" VerticalAlignment="Center" SelectionChanged="ComboBoxSelectionCount_OnSelectionChanged"/>
<DataGrid x:Name="dataGridResult" Height="356" Width="276" d:ItemsSource="{d:SampleData ItemCount=5}" HorizontalAlignment="Center" Canvas.Top="58" VerticalAlignment="Top" Canvas.Left="20"/>
<DataGrid x:Name="dataGridResult" Height="343" Width="276" d:ItemsSource="{d:SampleData ItemCount=5}" HorizontalAlignment="Center" Canvas.Top="71" VerticalAlignment="Top" Canvas.Left="20"/>
</Canvas>
</Window>