You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							205 lines
						
					
					
						
							7.4 KiB
						
					
					
				
			
		
		
	
	
							205 lines
						
					
					
						
							7.4 KiB
						
					
					
				using ESRI.ArcGIS.Carto; | 
						|
using ESRI.ArcGIS.Geometry; | 
						|
//using Kingo.Plugin.EngineEditor.ViewModel; | 
						|
using System.Collections.Generic; | 
						|
using System.Data; | 
						|
using System.Windows; | 
						|
using System.Windows.Controls; | 
						|
using System.Windows.Input; | 
						|
using System.Windows.Media; | 
						|
 | 
						|
namespace Kingo.Plugin.EngineEditor.View | 
						|
{ | 
						|
    /// <summary> | 
						|
    /// FrmInterData2.xaml 的交互逻辑 | 
						|
    /// </summary> | 
						|
    public partial class FrmInterData2 : Window | 
						|
    { | 
						|
        private IFeatureLayer _featureLayer; | 
						|
        private IGeometry _geometry; | 
						|
        SolidColorBrush foregroundColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF6C8FD6")); | 
						|
        SolidColorBrush lableColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF")); | 
						|
        public Dictionary<string, string> Dic { get; set; } | 
						|
        public FrmInterData2() | 
						|
        { | 
						|
            InitializeComponent(); | 
						|
        } | 
						|
        public IGeometry Geometry | 
						|
        { | 
						|
            get => _geometry; | 
						|
            set | 
						|
            { | 
						|
                _geometry = value; | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        public void DataInfStyle(Dictionary<string, System.Data.DataTable> Keys) | 
						|
        { | 
						|
            spResult.Children.Clear(); | 
						|
            DataTable data = Keys["图斑压盖"]; | 
						|
            int i = 1; | 
						|
            Border border = new Border(); | 
						|
            border.BorderBrush = Brushes.AliceBlue; | 
						|
            border.BorderThickness = new Thickness(1,1,1,1); | 
						|
            border.Margin = new Thickness(10,0,10,10); | 
						|
            Border Checkborder = new Border(); | 
						|
            Checkborder.BorderBrush = Brushes.AliceBlue; | 
						|
            Checkborder.BorderThickness = new Thickness(1, 1, 1, 1); | 
						|
            Checkborder.Margin = new Thickness(10, 0, 10, 10); | 
						|
            Grid GeoOverInfor = new Grid(); | 
						|
            Grid CheckContext = new Grid(); | 
						|
            GeoOverInfor.Children.Clear(); | 
						|
            CheckContext.Children.Clear(); | 
						|
            if (GeoOverInfor.RowDefinitions.Count > 1) | 
						|
                GeoOverInfor.RowDefinitions.RemoveRange(1, GeoOverInfor.RowDefinitions.Count - 1); | 
						|
            if (CheckContext.RowDefinitions.Count > 1) | 
						|
                CheckContext.RowDefinitions.RemoveRange(1, CheckContext.RowDefinitions.Count - 1); | 
						|
            if (GeoOverInfor.ColumnDefinitions.Count > 1) | 
						|
                GeoOverInfor.ColumnDefinitions.RemoveRange(1, GeoOverInfor.ColumnDefinitions.Count - 1); | 
						|
            if (CheckContext.ColumnDefinitions.Count > 1) | 
						|
                CheckContext.ColumnDefinitions.RemoveRange(1, CheckContext.ColumnDefinitions.Count - 1); | 
						|
            TableTitle(GeoOverInfor, data.Columns, foregroundColor, lableColor); | 
						|
            foreach (DataRow row in data.Rows) | 
						|
            { | 
						|
                GeoOverInfor.RowDefinitions.Add(new RowDefinition()); | 
						|
                for (int ii = 0; ii < data.Columns.Count; ii++) | 
						|
                { | 
						|
                    SetStyle(GeoOverInfor, row[ii].ToString(), i, ii); | 
						|
                } | 
						|
                i++; | 
						|
            } | 
						|
            border.Child = GeoOverInfor; | 
						|
            spResult.Children.Add(border); | 
						|
            data = Keys["图形规范性"]; | 
						|
            i = 1; | 
						|
            TableTitle(CheckContext, data.Columns, foregroundColor, lableColor); | 
						|
            foreach (DataRow row in data.Rows) | 
						|
            { | 
						|
                CheckContext.RowDefinitions.Add(new RowDefinition()); | 
						|
                for (int ii = 0; ii < data.Columns.Count; ii++) | 
						|
                { | 
						|
                    if (data.Columns[ii].ColumnName == "检查项") | 
						|
                    { | 
						|
                        SetStyle(CheckContext, row[ii].ToString(), i, ii, foregroundColor, lableColor); | 
						|
                    } | 
						|
                    else | 
						|
                    { | 
						|
                        SetStyle(CheckContext, row[ii].ToString(), i, ii); | 
						|
                    } | 
						|
 | 
						|
                } | 
						|
                i++; | 
						|
            } | 
						|
            Checkborder.Child = CheckContext; | 
						|
 | 
						|
        } | 
						|
        public void TableTitle(Grid grid, DataColumnCollection columns, SolidColorBrush foregroundColor, SolidColorBrush LableColor) | 
						|
        { | 
						|
            grid.RowDefinitions.Add(new RowDefinition()); | 
						|
            for (int i = 0; i < columns.Count ; i++) | 
						|
            { | 
						|
                grid.ColumnDefinitions.Add(new ColumnDefinition()); | 
						|
            } | 
						|
            for (int i = 0; i < columns.Count; i++) | 
						|
            { | 
						|
                Border border = new Border(); | 
						|
                border.BorderThickness = new Thickness(0.5, 0.5, 0.5, 0.5); | 
						|
                border.BorderBrush = Brushes.White; | 
						|
                border.SetValue(Grid.RowSpanProperty, 1); | 
						|
                border.SetValue(Grid.ColumnProperty, i); | 
						|
                Label label = new Label(); | 
						|
                label.Background = foregroundColor; | 
						|
                label.Foreground = LableColor; | 
						|
                label.Content = Dic[columns[i].ColumnName]; | 
						|
                label.Margin = new Thickness(1,0,0,0); | 
						|
                Grid.SetColumn(label, i); | 
						|
                Grid.SetRow(label, 0); | 
						|
                grid.Children.Add(label); | 
						|
                grid.Children.Add(border); | 
						|
 | 
						|
            } | 
						|
 | 
						|
        } | 
						|
 | 
						|
 | 
						|
        private void SetStyle(Grid grid, string value, int RowIndex, int ColumnIndex) | 
						|
        { | 
						|
            Border border = new Border(); | 
						|
            border.BorderThickness = new Thickness(0.5, 0.5, 0.5, 0.5); | 
						|
            //border.BorderBrush = Brushes.Gray; | 
						|
            border.SetValue(Grid.RowSpanProperty, RowIndex + 1); | 
						|
            border.SetValue(Grid.ColumnProperty, ColumnIndex); | 
						|
            grid.Children.Add(border); | 
						|
            Label label = new Label(); | 
						|
            label.Content = value; | 
						|
            if (RowIndex % 2 == 0) | 
						|
            { | 
						|
                label.Background = Brushes.AliceBlue; | 
						|
            } | 
						|
            else | 
						|
                label.Background = Brushes.White; | 
						|
            grid.Children.Add(label); | 
						|
            Grid.SetColumn(label, ColumnIndex); | 
						|
            Grid.SetRow(label, RowIndex); | 
						|
        } | 
						|
 | 
						|
        private void SetStyle(Grid grid, string value, int RowIndex, int ColumnIndex, SolidColorBrush foregroundColor, SolidColorBrush labelcolor) | 
						|
        { | 
						|
            Border border = new Border(); | 
						|
            border.BorderThickness = new Thickness(0.5, 0.5, 0.5, 0.5); | 
						|
            Label label = new Label(); | 
						|
            label.Background = foregroundColor; | 
						|
            label.Foreground = labelcolor; | 
						|
            label.Content = value; | 
						|
            Grid.SetColumn(label, ColumnIndex); | 
						|
            Grid.SetRow(label, RowIndex); | 
						|
            grid.Children.Add(label); | 
						|
            grid.Children.Add(border); | 
						|
        } | 
						|
 | 
						|
        public void ShowData() | 
						|
        { | 
						|
            this.Show(); | 
						|
        } | 
						|
 | 
						|
        public void GeoDealWith(IGeometry geometry, IFeatureLayer layer) | 
						|
        { | 
						|
            FeatureLayer = layer; | 
						|
            Geometry = geometry; | 
						|
        } | 
						|
 | 
						|
        public IFeatureLayer FeatureLayer | 
						|
        { | 
						|
            get => _featureLayer; | 
						|
            set | 
						|
            { | 
						|
                _featureLayer = value; | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        private void Button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) | 
						|
        { | 
						|
            this.DragMove(); | 
						|
        } | 
						|
 | 
						|
        private void Button_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) | 
						|
        { | 
						|
            if (popContent.Visibility == Visibility.Collapsed) | 
						|
            { | 
						|
                popContent.Visibility = Visibility.Visible; | 
						|
            } | 
						|
            else | 
						|
                popContent.Visibility = Visibility.Collapsed; | 
						|
        } | 
						|
 | 
						|
        private void btnClose_Click(object sender, RoutedEventArgs e) | 
						|
        { | 
						|
            this.Close(); | 
						|
        } | 
						|
 | 
						|
        private void btnClosePage_Click(object sender, RoutedEventArgs e) | 
						|
        { | 
						|
            popContent.Visibility = Visibility.Collapsed; | 
						|
        } | 
						|
    } | 
						|
}
 | 
						|
 |