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>
<ItemGroup>
<PackageReference Include="Esri.ArcGISRuntime.Toolkit">
<Version>100.15.0</Version>
</PackageReference>
<PackageReference Include="Esri.ArcGISRuntime.WPF">
<Version>200.5.0</Version>
</PackageReference>

View File

@ -150,6 +150,8 @@
</Button>
</ToolBar>
</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>
</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;
@ -951,8 +952,7 @@ namespace GisDevelop_Exp
aMap.InitialViewpoint = geodatabaseViewPoint;
MainMapView.Map = aMap;
}
AddLayerNameToList();
// AddLayerNameToList();
}
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,
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 +1466,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++)
{
@ -1485,14 +1479,11 @@ namespace GisDevelop_Exp
if (str.Contains("MIN"))
min = sResult.Values.ElementAt(i);
}
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 +1491,12 @@ 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 +1626,7 @@ namespace GisDevelop_Exp
{
try
{
m_CurOper = CURRENTOPERATION.SketchEdit;
BtnCancel.IsEnabled = true;
BtnRedo.IsEnabled = true;
BtnUndo.IsEnabled = true;