Modify to Modern UI

This commit is contained in:
PeterZhong 2024-12-30 19:38:12 +08:00
parent 45943b7e55
commit a5c55fedc3
9 changed files with 222 additions and 143 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

@ -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,13 @@
</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" />
</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,17 @@
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">
<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" />
@ -69,14 +74,72 @@
<MenuItem x:Name="Menu_Modify" Header="修改" Click="Menu_Modify_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 +147,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

@ -51,6 +51,7 @@ enum CURRENTOPERATION
DelFeature,
AddPolygonFeature,
ModifyFeature,
SketchEdit
}
namespace GisDevelop_Exp
@ -92,17 +93,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;
@ -176,6 +177,7 @@ namespace GisDevelop_Exp
await MainMapView.SetViewpointGeometryAsync(openedFeature.Extent);
}
}
AddLayerNameToList();
}
@ -211,6 +213,7 @@ namespace GisDevelop_Exp
MainMapView.Map.InitialViewpoint = geodatabaseViewPoint;
// MainMapView.Map = geodatabaseMap;
}
AddLayerNameToList();
}
@ -554,10 +557,10 @@ namespace GisDevelop_Exp
{
MessageBox.Show("两个图形不相交!");
}
m_CurOper = CURRENTOPERATION.NullOpe;
IReadOnlyList<Geometry>
resultGeometry = GeometryEngine.Intersections(g1.Geometry, g2.Geometry); //执行求交点操作
// Geometry resultGeometry = GeometryEngine.Intersection(g1.Geometry, g2.Geometry); //执行求交操作
@ -565,13 +568,13 @@ namespace GisDevelop_Exp
{
_pGraphicsOverLay.Graphics.Remove(g1);
_pGraphicsOverLay.Graphics.Remove(g2);
foreach (var pointGeometry in resultGeometry)
{
Graphic clipedGraphic = new Graphic(pointGeometry, fillSymbol); //利用求交结果构建新的图形
_pGraphicsOverLay.Graphics.Add(clipedGraphic);
}
m_CurOper = CURRENTOPERATION.NullOpe;
}
@ -710,32 +713,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 +957,7 @@ namespace GisDevelop_Exp
aMap.InitialViewpoint = geodatabaseViewPoint;
MainMapView.Map = aMap;
}
AddLayerNameToList();
// AddLayerNameToList();
}
private void LayerListBox_OnPreviewMouseMove(object sender, MouseEventArgs e)
@ -1024,7 +1029,8 @@ namespace GisDevelop_Exp
Top = 5,
Right = 0,
Bottom = 5
}
},
Height = 32
};
Console.WriteLine(pLayers[i].Name);
cb.Content = pLayers[i].Name;
@ -1054,7 +1060,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,18 +1298,19 @@ 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;
}
private async void AddFeature(Geometry pGeo, FeatureLayer pFeatureL)
{
try
@ -1313,6 +1320,7 @@ namespace GisDevelop_Exp
MessageBox.Show("几何类型和图层要素类型不匹配");
return;
}
// 创建要素
Feature feature = (Feature)pFeatureL.FeatureTable.CreateFeature();
feature.Geometry = pGeo;
@ -1456,11 +1464,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 +1474,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 +1490,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 +1500,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;
}
@ -1639,6 +1636,7 @@ namespace GisDevelop_Exp
{
try
{
m_CurOper = CURRENTOPERATION.SketchEdit;
BtnCancel.IsEnabled = true;
BtnRedo.IsEnabled = true;
BtnUndo.IsEnabled = true;

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*"/>

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>