示例#1
0
        //private Thread fireDetectThread = new Thread(new ThreadStart(fireDetect));
        public Form1()
        {
            InitializeComponent();
            comboBox1.SelectedIndex = 0;
            this.statusLabel.ForeColor = Color.Green;

            pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
            CurvePaint cp = new CurvePaint();
            cp.XkeduCount = 10;
            cp.YkeduCount = 10;
            cp.XvalueStrMoveleft = 15;
            pictureBox1.Image = cp.drawCurve(new float[] { 1.0f }, new float[] { 1.0f }, "火灾参数曲线图", "时间(S)", "量(像素)");
        }
示例#2
0
        private void showButton_Click(object sender, EventArgs e)
        {
            isShow = !isShow;
            if (isShow)
            {
                showButton.Text = "关闭曲线图";

                index = this.comboBox1.SelectedIndex;
                if (!isDrawing)
                {
                    float[] d = null;
                    if (index == 0)
                    {
                        d = FileOperation.readFromFile("Width.txt");
                    }
                    else if (index == 1)
                    {
                        d = FileOperation.readFromFile("Area.txt");
                    }
                    else if (index == 2)
                    {
                        d = FileOperation.readFromFile("Height.txt");
                    }

                    if (d == null)
                        return;

                    float[] month = new float[d.Length];
                    for (int i = 0; i < d.Length; i++)
                    {
                        month[i] = i + 1;
                    }

                    //float[] d = new float[13] { 20.5f, 60, 10.8f, 15.6f, 30, 70.9f, 50.3f, 30.7f, 70, 50.4f, 30.8f, 20f, 5.6f };
                    pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
                    CurvePaint cp = new CurvePaint();
                    cp.XkeduCount = 10;
                    cp.YkeduCount = 10;
                    cp.XvalueStrMoveleft = 15;
                    pictureBox1.Image = cp.drawCurve(month, d, "火灾参数曲线图", "时间(S)", "量");
                }

            }
            else
            {
                showButton.Text = "显示曲线图";
                pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
                CurvePaint cp = new CurvePaint();
                cp.XkeduCount = 10;
                cp.YkeduCount = 10;
                cp.XvalueStrMoveleft = 15;
                pictureBox1.Image = cp.drawCurve(new float[] { 1.0f }, new float[] { 1.0f }, "火灾参数曲线图", "时间(S)", "量(像素)");
            }
        }
示例#3
0
        private void getCharButton_Click(object sender, EventArgs e)
        {
            /*
            Curve2D cuv2D = new Curve2D();
            cuv2D.Fit();
            pictureBox1.Image = cuv2D.CreateImage();
             * */

            float [] d = FileOperation.readFromFile("Height.txt");

            float[] month = new float[d.Length];
            for (int i = 0; i < d.Length; i++)
            {
                month[i] = i + 1;
            }

            //float[] d = new float[13] { 20.5f, 60, 10.8f, 15.6f, 30, 70.9f, 50.3f, 30.7f, 70, 50.4f, 30.8f, 20f, 5.6f };
            pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
            CurvePaint cp = new CurvePaint();
            cp.XkeduCount = 10;
            cp.YkeduCount = 10;
            cp.XvalueStrMoveleft = 15;
            pictureBox1.Image = cp.drawCurve(month, d, "火灾参数曲线图", "时间(S)", "百分比(%)");
        }
示例#4
0
        //画曲线图线程
        private void drawLine()
        {
            float[] d = null;
            float[] width = null;
            float[] height = null;
            float[] area = null;
            isFire = false;
            int totalSecond = 0;
            while (isDetecting)
            {
                width = FileOperation.readFromFile("Width.txt");
                height = FileOperation.readFromFile("Height.txt");
                area = FileOperation.readFromFile("Area.txt");
                if (index == 0)
                {
                    d = width;
                }
                else if (index == 1)
                {
                    d = area;
                }
                else if (index == 2)
                {
                    d = height;
                }

                if (width == null || height == null || area == null)
                {
                    Thread.Sleep(2000);
                    continue;
                }

                if (width[width.Length - 1] * height[height.Length - 1] >= 24)
                {
                    isFire = true;
                }
                else
                {
                    isFire = false;
                }

                totalSecond = 0;
                for(int i = 0; i < width.Length-1; i++)
                {
                    if (width[i] * height[i] >= 24)
                    {
                        totalSecond++;
                    }
                }

                if (isFire)
                {
                    if (d != null)
                    {
                        statusLabelSetValue("发现火情!");
                        scaleLabelSetValue(area[area.Length - 1].ToString() + "%");
                        widthLabelSetValue(width[width.Length - 1].ToString()+"像素");
                        heightLabelSetValue(height[height.Length - 1].ToString()+"像素");
                        timeLabelSetValue(totalSecond.ToString()+"秒");
                    }
                }
                else
                {
                    statusLabelSetValue("正常");
                    scaleLabelSetValue("----");
                    widthLabelSetValue("----");
                    heightLabelSetValue("----");
                }

                if (d == null || !isShow)
                {
                    Thread.Sleep(2000);
                    continue;
                }
                float[] month = new float[d.Length];
                for (int i = 0; i < d.Length; i++)
                {
                    month[i] = i + 1;
                }

                //float[] d = new float[13] { 20.5f, 60, 10.8f, 15.6f, 30, 70.9f, 50.3f, 30.7f, 70, 50.4f, 30.8f, 20f, 5.6f };
                pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
                CurvePaint cp = new CurvePaint();
                cp.XkeduCount = 10;
                cp.YkeduCount = 10;
                cp.XvalueStrMoveleft = 15;
                pictureBox1.Image = cp.drawCurve(month, d, "火灾参数曲线图", "时间", "量(像素)");
                Thread.Sleep(2000);
            }
            isDrawing = false;
        }
 public static Bitmap drawCurveOnImage(float[] X_array, float[] Y_array, string chartTitle, string X_title, string Y_title, int X_KeduCount, int Y_KeduCount, float X_valueStrMoveleft, float Y_valueStrMoveleft, bool X_DirectionVertical)
 {
     CurvePaint CI = new CurvePaint();
         CI.XkeduCount = X_KeduCount;
         CI.YkeduCount = Y_KeduCount;
         CI.XvalueStrMoveleft = X_valueStrMoveleft;
         CI.YvalueStrMoveleft = Y_valueStrMoveleft;
         CI._X_DirectionVertical = X_DirectionVertical;
         return CI.drawCurve(X_array, Y_array, chartTitle, X_title, Y_title);
 }
 public static Bitmap drawCurveOnImage(float[] X_array, float[] Y_array, string chartTitle, string X_title, string Y_title, int X_KeduCount, int Y_KeduCount)
 {
     CurvePaint CI = new CurvePaint();
         CI.XkeduCount = X_KeduCount;
         CI.YkeduCount = Y_KeduCount;
         return CI.drawCurve(X_array, Y_array, chartTitle, X_title, Y_title);
 }
 public static Bitmap drawCurveOnImage(float[] X_array, float[] Y_array, string chartTitle, string X_title, string Y_title)
 {
     CurvePaint CI = new CurvePaint();
         return CI.drawCurve(X_array, Y_array, chartTitle, X_title, Y_title);
 }