Modify to Modern UI

This commit is contained in:
PeterZhong 2024-12-30 19:38:12 +08:00
parent 45943b7e55
commit 44d3491552
3 changed files with 20 additions and 27 deletions

View File

@ -11,6 +11,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Esri.ArcGISRuntime.Toolkit">
<Version>100.15.0</Version>
</PackageReference>
<PackageReference Include="Esri.ArcGISRuntime.WPF"> <PackageReference Include="Esri.ArcGISRuntime.WPF">
<Version>200.5.0</Version> <Version>200.5.0</Version>
</PackageReference> </PackageReference>

View File

@ -150,6 +150,8 @@
</Button> </Button>
</ToolBar> </ToolBar>
</Border> </Border>
<esri:MeasureToolbar HorizontalAlignment="Left" Margin="72,30,0,0" VerticalAlignment="Top" Height="85" 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}"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -51,6 +51,7 @@ enum CURRENTOPERATION
DelFeature, DelFeature,
AddPolygonFeature, AddPolygonFeature,
ModifyFeature, ModifyFeature,
SketchEdit
} }
namespace GisDevelop_Exp namespace GisDevelop_Exp
@ -92,17 +93,17 @@ namespace GisDevelop_Exp
private readonly Dictionary<string, Basemap> _basemapOptions = new Dictionary<string, Basemap>() private readonly Dictionary<string, Basemap> _basemapOptions = new Dictionary<string, Basemap>()
{ {
{ "Streets (Raster)", new Basemap(BasemapStyle.OSMStreets) }, { "OSMStreets", new Basemap(BasemapStyle.OSMStreets) },
{ "Streets (Vector)", new Basemap(BasemapStyle.OSMStreetsRelief) }, { "OSMStreetsRelief", new Basemap(BasemapStyle.OSMStreetsRelief) },
{ "Streets - Night (Vector)", new Basemap(BasemapStyle.ArcGISStreetsNight) }, { "ArcGISStreetsNight", new Basemap(BasemapStyle.ArcGISStreetsNight) },
{ "Imagery (Raster)", new Basemap(BasemapStyle.ArcGISImagery) }, { "ArcGISImagery", new Basemap(BasemapStyle.ArcGISImagery) },
{ "Imagery with Labels (Raster)", new Basemap(BasemapStyle.ArcGISImageryLabels) }, { "ArcGISImageryLabels", new Basemap(BasemapStyle.ArcGISImageryLabels) },
{ "Imagery with Labels (Vector)", new Basemap(BasemapStyle.ArcGISImageryStandard) }, { "ArcGISImageryStandard", new Basemap(BasemapStyle.ArcGISImageryStandard) },
{ "Dark Gray Canvas (Vector)", new Basemap(BasemapStyle.ArcGISDarkGray) }, { "ArcGISDarkGray", new Basemap(BasemapStyle.ArcGISDarkGray) },
{ "Light Gray Canvas (Raster)", new Basemap(BasemapStyle.ArcGISLightGray) }, { "ArcGISLightGray", new Basemap(BasemapStyle.ArcGISLightGray) },
{ "Light Gray Canvas (Vector)", new Basemap(BasemapStyle.ArcGISLightGrayBase) }, { "ArcGISLightGrayBase", new Basemap(BasemapStyle.ArcGISLightGrayBase) },
{ "Navigation (Vector)", new Basemap(BasemapStyle.ArcGISNavigation) }, { "ArcGISNavigation", new Basemap(BasemapStyle.ArcGISNavigation) },
{ "OpenStreetMap (Raster)", new Basemap(BasemapStyle.OSMNavigation) } { "OSMNavigation", new Basemap(BasemapStyle.OSMNavigation) }
}; };
private CURRENTOPERATION m_CurOper; private CURRENTOPERATION m_CurOper;
@ -951,8 +952,7 @@ namespace GisDevelop_Exp
aMap.InitialViewpoint = geodatabaseViewPoint; aMap.InitialViewpoint = geodatabaseViewPoint;
MainMapView.Map = aMap; MainMapView.Map = aMap;
} }
// AddLayerNameToList();
AddLayerNameToList();
} }
private void LayerListBox_OnPreviewMouseMove(object sender, MouseEventArgs e) private void LayerListBox_OnPreviewMouseMove(object sender, MouseEventArgs e)
@ -1456,11 +1456,8 @@ namespace GisDevelop_Exp
private async void SetClassBreaksRender(FeatureLayer pLayer, string sFieldName, int ClassifyCount = 5, private async void SetClassBreaksRender(FeatureLayer pLayer, string sFieldName, int ClassifyCount = 5,
List<Symbol> pSymbolList = null) List<Symbol> pSymbolList = null)
{ {
//ClassBreaksRenderer
ClassBreaksRenderer pCBRenderer = new ClassBreaksRenderer(); ClassBreaksRenderer pCBRenderer = new ClassBreaksRenderer();
//设置字段名
pCBRenderer.FieldName = sFieldName; pCBRenderer.FieldName = sFieldName;
//设置统计查询条件,
StatisticDefinition statDefinitionMin = new StatisticDefinition(sFieldName, StatisticType.Minimum, ""); StatisticDefinition statDefinitionMin = new StatisticDefinition(sFieldName, StatisticType.Minimum, "");
StatisticDefinition statDefinitionMax = new StatisticDefinition(sFieldName, StatisticType.Maximum, ""); StatisticDefinition statDefinitionMax = new StatisticDefinition(sFieldName, StatisticType.Maximum, "");
List<StatisticDefinition> statDefinitions = new List<StatisticDefinition> List<StatisticDefinition> statDefinitions = new List<StatisticDefinition>
@ -1469,13 +1466,10 @@ namespace GisDevelop_Exp
statDefinitionMax, statDefinitionMax,
}; };
StatisticsQueryParameters pQueryPara = new StatisticsQueryParameters(statDefinitions); StatisticsQueryParameters pQueryPara = new StatisticsQueryParameters(statDefinitions);
//执行统计查询
StatisticsQueryResult queryResult = await pLayer.FeatureTable.QueryStatisticsAsync(pQueryPara); StatisticsQueryResult queryResult = await pLayer.FeatureTable.QueryStatisticsAsync(pQueryPara);
//从统计结果中获取最大值,获取最小值
string str; string str;
object max = null, min = null; object max = null, min = null;
double dMax, dMin; double dMax, dMin;
//获取该字段的最大值,最小值,为后续分级做准备
IReadOnlyDictionary<string, object> sResult = queryResult.First().Statistics; IReadOnlyDictionary<string, object> sResult = queryResult.First().Statistics;
for (int i = 0; i < sResult.Count; i++) for (int i = 0; i < sResult.Count; i++)
{ {
@ -1485,14 +1479,11 @@ namespace GisDevelop_Exp
if (str.Contains("MIN")) if (str.Contains("MIN"))
min = sResult.Values.ElementAt(i); min = sResult.Values.ElementAt(i);
} }
dMax = (double)(max); dMax = (double)(max);
dMin = (double)(min); dMin = (double)(min);
//计算并设置分级中每一级别的范围,以及符号
for (int i = 0; i < ClassifyCount; i++) for (int i = 0; i < ClassifyCount; i++)
{ {
ClassBreak pClassBreak = new ClassBreak(); ClassBreak pClassBreak = new ClassBreak();
//每一级别范围的最大值、最小值
if (i == 0) if (i == 0)
pClassBreak.MinValue = dMin; pClassBreak.MinValue = dMin;
else else
@ -1500,16 +1491,12 @@ namespace GisDevelop_Exp
; ;
pClassBreak.MaxValue = dMin + (dMax - dMin) * (i + 1) / ClassifyCount; pClassBreak.MaxValue = dMin + (dMax - dMin) * (i + 1) / ClassifyCount;
Color tempColor = Color.FromArgb(i * 50 + 10, 255, 255); Color tempColor = Color.FromArgb(i * 50 + 10, 255, 255);
//创建符号,这里图层为面层,直接创建面符号,注意若图层为 点层、线层,需创建对应的点符号、线符号
SimpleLineSymbol tempSymbol2 = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Gray, SimpleLineSymbol tempSymbol2 = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Gray,
1); 1);
Symbol pSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, tempColor, tempSymbol2); Symbol pSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, tempColor, tempSymbol2);
pClassBreak.Symbol = pSymbol; pClassBreak.Symbol = pSymbol;
//将设置好的ClassBreak放入ClassBreaksRenderer中。
pCBRenderer.ClassBreaks.Add(pClassBreak); pCBRenderer.ClassBreaks.Add(pClassBreak);
} }
//将创建好的ClassBreaksRenderer 赋值给图层
pLayer.Renderer = pCBRenderer; pLayer.Renderer = pCBRenderer;
} }
@ -1639,6 +1626,7 @@ namespace GisDevelop_Exp
{ {
try try
{ {
m_CurOper = CURRENTOPERATION.SketchEdit;
BtnCancel.IsEnabled = true; BtnCancel.IsEnabled = true;
BtnRedo.IsEnabled = true; BtnRedo.IsEnabled = true;
BtnUndo.IsEnabled = true; BtnUndo.IsEnabled = true;