Compare commits

...

2 Commits

Author SHA1 Message Date
PeterZhong
31bb59de16 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	GisDevelop_Exp/MainWindow.xaml
#	GisDevelop_Exp/MainWindow.xaml.cs
2025-01-10 16:04:45 +08:00
PeterZhong
44d3491552 Modify to Modern UI 2024-12-30 19:38:12 +08:00

View File

@ -201,7 +201,6 @@ namespace GisDevelop_Exp
await MainMapView.SetViewpointGeometryAsync(openedFeature.Extent); await MainMapView.SetViewpointGeometryAsync(openedFeature.Extent);
} }
} }
AddLayerNameToList(); AddLayerNameToList();
} }
@ -237,7 +236,6 @@ namespace GisDevelop_Exp
MainMapView.Map.InitialViewpoint = geodatabaseViewPoint; MainMapView.Map.InitialViewpoint = geodatabaseViewPoint;
// MainMapView.Map = geodatabaseMap; // MainMapView.Map = geodatabaseMap;
} }
AddLayerNameToList(); AddLayerNameToList();
} }
@ -257,7 +255,7 @@ namespace GisDevelop_Exp
Color fillColor = Color.FromArgb(0, 0, 0, 0); Color fillColor = Color.FromArgb(0, 0, 0, 0);
SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, fillColor, lineSymbol); SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, fillColor, lineSymbol);
var graphicOverlay = new Esri.ArcGISRuntime.UI.GraphicsOverlay(); var graphicOverlay = new Esri.ArcGISRuntime.UI.GraphicsOverlay();
var envGraphic = new Esri.ArcGISRuntime.UI.Graphic(vExtent, fillSymbol); var envGraphic = new Esri.ArcGISRuntime.UI.Graphic(eagleViewEnvelop, fillSymbol);
graphicOverlay.Graphics.Add(envGraphic); graphicOverlay.Graphics.Add(envGraphic);
EagleMapView.GraphicsOverlays.Add(graphicOverlay); EagleMapView.GraphicsOverlays.Add(graphicOverlay);
} }
@ -581,10 +579,10 @@ namespace GisDevelop_Exp
{ {
MessageBox.Show("两个图形不相交!"); MessageBox.Show("两个图形不相交!");
} }
m_CurOper = CURRENTOPERATION.NullOpe; m_CurOper = CURRENTOPERATION.NullOpe;
IReadOnlyList<Geometry> IReadOnlyList<Geometry>
resultGeometry = GeometryEngine.Intersections(g1.Geometry, g2.Geometry); //执行求交点操作 resultGeometry = GeometryEngine.Intersections(g1.Geometry, g2.Geometry); //执行求交点操作
// Geometry resultGeometry = GeometryEngine.Intersection(g1.Geometry, g2.Geometry); //执行求交操作 // Geometry resultGeometry = GeometryEngine.Intersection(g1.Geometry, g2.Geometry); //执行求交操作
@ -592,13 +590,13 @@ namespace GisDevelop_Exp
{ {
_pGraphicsOverLay.Graphics.Remove(g1); _pGraphicsOverLay.Graphics.Remove(g1);
_pGraphicsOverLay.Graphics.Remove(g2); _pGraphicsOverLay.Graphics.Remove(g2);
foreach (var pointGeometry in resultGeometry) foreach (var pointGeometry in resultGeometry)
{ {
Graphic clipedGraphic = new Graphic(pointGeometry, fillSymbol); //利用求交结果构建新的图形 Graphic clipedGraphic = new Graphic(pointGeometry, fillSymbol); //利用求交结果构建新的图形
_pGraphicsOverLay.Graphics.Add(clipedGraphic); _pGraphicsOverLay.Graphics.Add(clipedGraphic);
} }
m_CurOper = CURRENTOPERATION.NullOpe; m_CurOper = CURRENTOPERATION.NullOpe;
} }
@ -744,10 +742,10 @@ namespace GisDevelop_Exp
linePoints = new List<MapPoint>(); linePoints = new List<MapPoint>();
if (linesList == null) if (linesList == null)
linesList = new List<Graphic>(); linesList = new List<Graphic>();
linePoints.Add(e.Location); //将当前点加入点集 linePoints.Add(e.Location);//将当前点加入点集
if (linePoints.Count >= 2) //如果点集中点数足够 if (linePoints.Count >= 2)//如果点集中点数足够
{ {
if (linesList.Count > 0 && linePoints.Count > 2) //已有加入的线图形,则移除当前的图形,重新加入新的图形 if (linesList.Count > 0 && linePoints.Count > 2)//已有加入的线图形,则移除当前的图形,重新加入新的图形
{ {
Graphic curGraphic = linesList[linesList.Count - 1]; Graphic curGraphic = linesList[linesList.Count - 1];
MainMapView.GraphicsOverlays[0].Graphics.Remove(curGraphic); MainMapView.GraphicsOverlays[0].Graphics.Remove(curGraphic);
@ -759,13 +757,12 @@ namespace GisDevelop_Exp
//lineSymbol.Style = SimpleLineSymbolStyle.Dash; //lineSymbol.Style = SimpleLineSymbolStyle.Dash;
//lineSymbol.Width = 3; //lineSymbol.Width = 3;
Esri.ArcGISRuntime.Geometry.Polygon line = new Esri.ArcGISRuntime.Geometry.Polygon line = new
Esri.ArcGISRuntime.Geometry.Polygon(linePoints); //由点集构造线 Esri.ArcGISRuntime.Geometry.Polygon(linePoints);//由点集构造线
Graphic lineGraphic = new Graphic(line, fillSymbol); //由线创建图形 Graphic lineGraphic = new Graphic(line, fillSymbol);//由线创建图形
MainMapView.GraphicsOverlays[0].Graphics.Add(lineGraphic); //加入该图形元素到覆盖层中 MainMapView.GraphicsOverlays[0].Graphics.Add(lineGraphic);//加入该图形元素到覆盖层中
linesList.Add(lineGraphic); //同时,将该图形加入链表 linesList.Add(lineGraphic);//同时,将该图形加入链表
} }
} }else if (m_CurOper== CURRENTOPERATION.ModifyFeature)
else if (m_CurOper == CURRENTOPERATION.ModifyFeature)
{ {
if (_featureLayer == null) if (_featureLayer == null)
return; return;
@ -981,7 +978,8 @@ 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)
@ -1084,7 +1082,7 @@ namespace GisDevelop_Exp
CheckBox cb = sender as CheckBox; CheckBox cb = sender as CheckBox;
cb.IsChecked = true; cb.IsChecked = true;
int index = GetLayerIndex(cb.ToolTip as string); 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 internal static class Utils
@ -1322,19 +1320,18 @@ namespace GisDevelop_Exp
private void MainMapView_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e) 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); AddFeature(poly, _featureLayer);
if (linePoints != null) if (linePoints != null)
linePoints.Clear(); linePoints.Clear();
if (linesList != null) if (linesList != null)
linesList.Clear(); linesList.Clear();
} }
m_CurOper = CURRENTOPERATION.NullOpe; m_CurOper = CURRENTOPERATION.NullOpe;
} }
private async void AddFeature(Geometry pGeo, FeatureLayer pFeatureL) private async void AddFeature(Geometry pGeo, FeatureLayer pFeatureL)
{ {
try try
@ -1604,6 +1601,7 @@ namespace GisDevelop_Exp
pSymbol = null; pSymbol = null;
SetSimpleRender((FeatureLayer)symbologyLayer, null); SetSimpleRender((FeatureLayer)symbologyLayer, null);
} }
e.Handled = true; e.Handled = true;
} }