Newer
Older
EMS_SZ / FrmBSQDuoBianXingStreet.cs
root on 21 Mar 2016 2 KB first
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using GeoScene.Globe;
using GeoScene.Data;
using System.Windows.Forms.DataVisualization.Charting;

namespace Cyberpipe
{
    public partial class FrmBSQDuoBianXingStreet : Office2007Form
    {
        private Dictionary<string, int> bsq = new Dictionary<string, int>();
        private GSOGlobeControl globeControl1;
        private GSOFeatures feats;
        private static bool IS_OPEN = false;
        public FrmBSQDuoBianXingStreet(GSOGlobeControl glb, GSOFeatures feats)
        {
            InitializeComponent();
            globeControl1 = glb;
            this.feats = feats;
        }

        private void FrmBSQDuoBianXingStreet_FormClosing(object sender, FormClosingEventArgs e)
        {
            IS_OPEN = false;
            globeControl1.Globe.ClearAnalysis();
            globeControl1.Globe.MemoryLayer.RemoveAllFeature();
        }

        private void FrmBSQDuoBianXingStreet_Load(object sender, EventArgs e)
        {
            IS_OPEN = true;
            int count = 0;
            string street = "";
            for (int i = 0; i < feats.Length; i++)
            {
                street = feats[i].GetValue("所属道路").ToString();
                if (bsq.ContainsKey(street))
                {
                    count = bsq[street];
                    count++;
                    bsq.Remove(street);
                }
                else
                {
                    count = 1;
                }
                bsq.Add(street, count);
            }

            count = 0;
            chartStatis.Series.Add("标识器");
            chartStatis.ChartAreas["ChartArea1"].AxisY.Title = "标识器个数";
            chartStatis.ChartAreas["ChartArea1"].AxisX.Interval = 1;
            chartStatis.Series[0].ChartType = SeriesChartType.Column;
            chartStatis.Series[0]["DrawingStyle"] = "Cylinder";
            chartStatis.Series[0].Points.DataBindXY(bsq.Keys, bsq.Values);
            for (int m = 0; m < bsq.Values.Count; m++)
            {
                if (chartStatis.Series[0].Points[m].YValues[0].ToString().Trim() != "0")
                {
                    count += Convert.ToInt16(chartStatis.Series[0].Points[m].YValues[0].ToString());
                    chartStatis.Series[0].Points[m].Label = chartStatis.Series[0].Points[m].YValues[0].ToString();
                }
            }


            chartStatis.ChartAreas["ChartArea1"].AxisX.Title = "街道(总数:" + count + ")";
        }
    }
}