diff --git a/GisDevelop_Exp/App.xaml b/GisDevelop_Exp/App.xaml
index f7b302e..5b345a8 100644
--- a/GisDevelop_Exp/App.xaml
+++ b/GisDevelop_Exp/App.xaml
@@ -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">
-
+
+
+
+
+
+
diff --git a/GisDevelop_Exp/AttributeQuery.xaml b/GisDevelop_Exp/AttributeQuery.xaml
index d5c96d8..77afc7d 100644
--- a/GisDevelop_Exp/AttributeQuery.xaml
+++ b/GisDevelop_Exp/AttributeQuery.xaml
@@ -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">
diff --git a/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml b/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml
index 91cf60c..eb5e506 100644
--- a/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml
+++ b/GisDevelop_Exp/ExtentLocationQueryResultsWindow.xaml
@@ -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">
diff --git a/GisDevelop_Exp/GisDevelop_Exp.csproj b/GisDevelop_Exp/GisDevelop_Exp.csproj
index a4d043f..ed99797 100644
--- a/GisDevelop_Exp/GisDevelop_Exp.csproj
+++ b/GisDevelop_Exp/GisDevelop_Exp.csproj
@@ -11,9 +11,13 @@
+
+ 100.15.0
+
200.5.0
+
diff --git a/GisDevelop_Exp/LocationQueryResultsWindow.xaml b/GisDevelop_Exp/LocationQueryResultsWindow.xaml
index dd4a428..24442e9 100644
--- a/GisDevelop_Exp/LocationQueryResultsWindow.xaml
+++ b/GisDevelop_Exp/LocationQueryResultsWindow.xaml
@@ -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">
diff --git a/GisDevelop_Exp/MainWindow.xaml b/GisDevelop_Exp/MainWindow.xaml
index 9e2f539..214504b 100644
--- a/GisDevelop_Exp/MainWindow.xaml
+++ b/GisDevelop_Exp/MainWindow.xaml
@@ -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">
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,72 +147,60 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GisDevelop_Exp/MainWindow.xaml.cs b/GisDevelop_Exp/MainWindow.xaml.cs
index 85d0dd0..fff338c 100644
--- a/GisDevelop_Exp/MainWindow.xaml.cs
+++ b/GisDevelop_Exp/MainWindow.xaml.cs
@@ -51,6 +51,7 @@ enum CURRENTOPERATION
DelFeature,
AddPolygonFeature,
ModifyFeature,
+ SketchEdit
}
namespace GisDevelop_Exp
@@ -92,17 +93,17 @@ namespace GisDevelop_Exp
private readonly Dictionary _basemapOptions = new Dictionary()
{
- { "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
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();
if (linesList == null)
linesList = new List();
- 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 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 statDefinitions = new List
@@ -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 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;
diff --git a/GisDevelop_Exp/OptionsWindow.xaml b/GisDevelop_Exp/OptionsWindow.xaml
index 22e66ee..a08ced9 100644
--- a/GisDevelop_Exp/OptionsWindow.xaml
+++ b/GisDevelop_Exp/OptionsWindow.xaml
@@ -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">
diff --git a/GisDevelop_Exp/QueryResultWindow.xaml b/GisDevelop_Exp/QueryResultWindow.xaml
index dbd1507..cb076c3 100644
--- a/GisDevelop_Exp/QueryResultWindow.xaml
+++ b/GisDevelop_Exp/QueryResultWindow.xaml
@@ -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">