Draw line and line symbol settings
This commit is contained in:
parent
6ba632e8fe
commit
510274879b
@ -38,7 +38,7 @@
|
||||
<MenuItem x:Name="Menu_Layers_Options" Header="符号系统" Click="Menu_Layers_Options_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"/>
|
||||
<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,37,0,13" HorizontalAlignment="Left" PreviewMouseMove="LayerListBox_OnPreviewMouseMove" Drop="LayerListBox_OnDrop" ItemStringFormat="删除">
|
||||
<ListBox.ContextMenu>
|
||||
<ContextMenu/>
|
||||
|
||||
@ -24,6 +24,7 @@ using Esri.ArcGISRuntime.UI.Controls;
|
||||
using Color = System.Drawing.Color;
|
||||
using Geometry = Esri.ArcGISRuntime.Geometry.Geometry;
|
||||
using Polygon = Esri.ArcGISRuntime.Geometry.Polygon;
|
||||
using Polyline = Esri.ArcGISRuntime.Geometry.Polyline;
|
||||
|
||||
enum CURRENTOPERATION
|
||||
{
|
||||
@ -668,6 +669,23 @@ namespace GisDevelop_Exp
|
||||
Graphic gPT = new Graphic(location, pointSymbol);
|
||||
MainMapView.GraphicsOverlays[0].Graphics.Add(gPT);
|
||||
}
|
||||
else if (m_CurOper == CURRENTOPERATION.DrawLine)
|
||||
{
|
||||
linePoints.Add(location);
|
||||
if (linePoints.Count > 1)
|
||||
{
|
||||
if (linesList.Count > 0)
|
||||
{
|
||||
Graphic curGraphic = linesList[linesList.Count - 1];
|
||||
MainMapView.GraphicsOverlays[0].Graphics.Remove(curGraphic);
|
||||
linesList.Remove(curGraphic);
|
||||
}
|
||||
Polyline line = new Polyline(linePoints);
|
||||
Graphic lineGraphic = new Graphic(line, lineSymbol);
|
||||
MainMapView.GraphicsOverlays[0].Graphics.Add(lineGraphic);
|
||||
linesList.Add(lineGraphic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_Layers_Options_OnClick(object sender, RoutedEventArgs e)
|
||||
@ -682,11 +700,17 @@ namespace GisDevelop_Exp
|
||||
private void Menu_Point_Draw_Line_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
m_CurOper = CURRENTOPERATION.DrawLine;
|
||||
linePoints.Clear();
|
||||
}
|
||||
|
||||
private void Menu_Point_Draw_Polygon_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
m_CurOper = CURRENTOPERATION.DrawPolygon;
|
||||
}
|
||||
|
||||
private void MainMapView_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
m_CurOper = CURRENTOPERATION.NullOpe;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -34,9 +34,10 @@
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="线符号">
|
||||
<TabItem Header="线符号" Loaded="FrameworkElement_OnLoaded">
|
||||
<Grid Background="#FFE5E5E5">
|
||||
<ComboBox HorizontalAlignment="Left" Margin="24,49,0,0" VerticalAlignment="Top" Width="305">
|
||||
<Label Content="线型:" HorizontalAlignment="Left" Margin="24,25,0,0" VerticalAlignment="Top"></Label>
|
||||
<ComboBox x:Name="ComboBox_Line_Style" HorizontalAlignment="Left" Margin="24,49,0,0" VerticalAlignment="Top" Width="305" SelectionChanged="ComboBox_Line_Style_OnSelected">
|
||||
<ComboBoxItem x:Name="ComboBoxItem_Line_Solid" Content="实线"/>
|
||||
<ComboBoxItem x:Name="ComboBoxItem_Line_Dash" Content="虚线"/>
|
||||
<ComboBoxItem x:Name="ComboBoxItem_Line_Dot" Content="点线"/>
|
||||
@ -44,13 +45,13 @@
|
||||
<ComboBoxItem x:Name="ComboBoxItem_Line_DashDotDot" Content="虚-点-点线"/>
|
||||
<ComboBoxItem x:Name="ComboBoxItem_Line_Null" Content="空"/>
|
||||
</ComboBox>
|
||||
<Label Content="宽度:" HorizontalAlignment="Left" Margin="24,97,0,0" VerticalAlignment="Top"/>
|
||||
<Slider x:Name="Slider_Line_Width" HorizontalAlignment="Left" Margin="24,128,0,0" VerticalAlignment="Top" Width="305"/>
|
||||
<Label Content="颜色:" HorizontalAlignment="Left" Margin="24,179,0,0" VerticalAlignment="Top"/>
|
||||
<Label x:Name="Label_Line_Color" Content="" HorizontalAlignment="Left" Margin="28,210,0,0" VerticalAlignment="Top" Width="301" Background="White"/>
|
||||
<Button x:Name="Btn_Line_Confirm" Content="确定" HorizontalAlignment="Left" Margin="28,285,0,0" VerticalAlignment="Top" Height="20" Width="75"/>
|
||||
<Button x:Name="Btn_Line_Apply" Content="应用" HorizontalAlignment="Left" Margin="128,285,0,0" VerticalAlignment="Top" Height="20" Width="75"/>
|
||||
<Button x:Name="Btn_Line_Cancel" Content="取消" HorizontalAlignment="Left" Margin="236,285,0,0" VerticalAlignment="Top" Height="20" Width="75"/>
|
||||
<Label x:Name="Label_Line_Width" Content="宽度:" HorizontalAlignment="Left" Margin="24,97,0,0" VerticalAlignment="Top"/>
|
||||
<Slider x:Name="Slider_Line_Width" HorizontalAlignment="Left" Margin="24,128,0,0" VerticalAlignment="Top" Width="305" ValueChanged="Slider_Line_Width_OnValueChanged"/>
|
||||
<Label Content="颜色:" HorizontalAlignment="Left" Margin="24,179,0,0" VerticalAlignment="Top" MouseLeftButtonUp="UIElement_OnMouseLeftButtonUp"/>
|
||||
<Label x:Name="Label_Line_Color" Content="" HorizontalAlignment="Left" Margin="28,210,0,0" VerticalAlignment="Top" Width="301" Background="White" MouseLeftButtonUp="UIElement_OnMouseLeftButtonUp"/>
|
||||
<Button x:Name="Btn_Line_Confirm" Content="确定" HorizontalAlignment="Left" Margin="28,285,0,0" VerticalAlignment="Top" Height="20" Width="75" Click="Btn_Line_Confirm_OnClick"/>
|
||||
<Button x:Name="Btn_Line_Apply" Content="应用" HorizontalAlignment="Left" Margin="128,285,0,0" VerticalAlignment="Top" Height="20" Width="75" Click="Btn_Line_Apply_OnClick"/>
|
||||
<Button x:Name="Btn_Line_Cancel" Content="取消" HorizontalAlignment="Left" Margin="236,285,0,0" VerticalAlignment="Top" Height="20" Width="75" Click="Btn_Line_Cancel_OnClick"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="面符号">
|
||||
|
||||
@ -188,6 +188,9 @@ namespace GisDevelop_Exp
|
||||
|
||||
private void Btn_Point_Confirm_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PointSymbol.Color = pointColor;
|
||||
PointSymbol.Style = pointStyle;
|
||||
PointSymbol.Size = pointSize;
|
||||
this.DialogResult = true;
|
||||
}
|
||||
|
||||
@ -204,5 +207,97 @@ namespace GisDevelop_Exp
|
||||
{
|
||||
this.DialogResult = false;
|
||||
}
|
||||
|
||||
private void FrameworkElement_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
System.Windows.Media.Color color = System.Windows.Media.Color.FromArgb(lineColor.A, lineColor.R, lineColor.G, lineColor.B);
|
||||
Label_Line_Color.Background = new SolidColorBrush(color);
|
||||
Slider_Line_Width.Value = Convert.ToInt32(lineSymbol.Width);
|
||||
switch (lineStyle)
|
||||
{
|
||||
case SimpleLineSymbolStyle.Solid:
|
||||
ComboBox_Line_Style.SelectedIndex = 0;
|
||||
break;
|
||||
case SimpleLineSymbolStyle.Dash:
|
||||
ComboBox_Line_Style.SelectedIndex = 1;
|
||||
break;
|
||||
case SimpleLineSymbolStyle.Dot:
|
||||
ComboBox_Line_Style.SelectedIndex = 2;
|
||||
break;
|
||||
case SimpleLineSymbolStyle.DashDot:
|
||||
ComboBox_Line_Style.SelectedIndex = 3;
|
||||
break;
|
||||
case SimpleLineSymbolStyle.DashDotDot:
|
||||
ComboBox_Line_Style.SelectedIndex = 4;
|
||||
break;
|
||||
case SimpleLineSymbolStyle.Null:
|
||||
ComboBox_Line_Style.SelectedIndex = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void Slider_Line_Width_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
Label_Line_Width.Content="宽度:"+e.NewValue.ToString();
|
||||
lineSize = e.NewValue;
|
||||
}
|
||||
|
||||
private void UIElement_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
|
||||
SolidColorBrush colorBrush = (SolidColorBrush)Label_Line_Color.Background;
|
||||
colorDialog.Color = System.Drawing.Color.FromArgb(colorBrush.Color.A, colorBrush.Color.R, colorBrush.Color.G, colorBrush.Color.B);
|
||||
if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
lineColor = colorDialog.Color;
|
||||
System.Windows.Media.Color color = System.Windows.Media.Color.FromArgb(pointColor.A, pointColor.R, pointColor.G, pointColor.B);
|
||||
Label_Line_Color.Background = new SolidColorBrush(color);
|
||||
}
|
||||
}
|
||||
|
||||
private void Btn_Line_Confirm_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LineSymbol.Style = lineStyle;
|
||||
LineSymbol.Color = lineColor;
|
||||
LineSymbol.Width = lineSize;
|
||||
this.DialogResult = true;
|
||||
}
|
||||
|
||||
private void Btn_Line_Apply_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LineSymbol.Style = lineStyle;
|
||||
LineSymbol.Color = lineColor;
|
||||
LineSymbol.Width = lineSize;
|
||||
}
|
||||
|
||||
private void Btn_Line_Cancel_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
}
|
||||
|
||||
private void ComboBox_Line_Style_OnSelected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
switch (ComboBox_Line_Style.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
lineStyle = SimpleLineSymbolStyle.Solid;
|
||||
break;
|
||||
case 1:
|
||||
lineStyle = SimpleLineSymbolStyle.Dash;
|
||||
break;
|
||||
case 2:
|
||||
lineStyle = SimpleLineSymbolStyle.Dot;
|
||||
break;
|
||||
case 3:
|
||||
lineStyle = SimpleLineSymbolStyle.DashDot;
|
||||
break;
|
||||
case 4:
|
||||
lineStyle = SimpleLineSymbolStyle.DashDotDot;
|
||||
break;
|
||||
case 5:
|
||||
lineStyle = SimpleLineSymbolStyle.Null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user