示例#1
0
文件: Form1.cs 项目: Baffawuah/IDWE
        public double IDWE(double x, double y, double t, double P, ArrayList points)
        {
            double Answer = 0;
            dataPt holder = new dataPt(x, y, t, 0);
            double d1     = 0;
            double d2     = 0;
            double w      = 0;
            double top    = 0;
            double bottom = 0;


            for (int i = 0; i < points.Count; i++)
            {
                d1 = findD((dataPt)points[i], holder, globC);
                d2 = findD((dataPt)points[i], holder, globC);
                w  = ((dataPt)points[i]).getMeasure();

                top    += w / (Math.Pow(d1, P));
                bottom += 1 / (Math.Pow(d2, P));
            }

            Answer = top / bottom;

            return(Answer);
        }
示例#2
0
文件: Form1.cs 项目: Baffawuah/IDWE
        //Lesser functions that add up to form the larger one to make the code more modular
        //Check math sequence:

        public double findD(dataPt x1, dataPt x, double C)
        {
            double d = 0;

            d = Math.Sqrt((Math.Pow((x1.getX() - x.getX()), 2.0)) + (Math.Pow((x1.getY() - x.getY()), 2)) + (Math.Pow(globC, 2.0) * (Math.Pow((x1.getTime() - x.getTime()), 2.0))));

            return(d);
        }
示例#3
0
文件: Form1.cs 项目: Baffawuah/IDWE
        private void openPointsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Text files|*.txt|All files|*.*";
            openFileDialog1.Title  = "Open the Captured Packets";
            openFileDialog1.ShowDialog();

            //Check to see if a filename was given

            if (openFileDialog1.FileName != "")
            {
                try
                {
                    {
                        readOut = System.IO.File.ReadAllText(openFileDialog1.FileName);
                        //textBox1.Text = System.IO.File.ReadAllText(openFileDialog1.FileName);
                        dataChain = readOut.Split(new String[] { "\r\n", "\n" }, StringSplitOptions.None);

                        //Read out Code
                        string[] link; //dataChain[0].Split(null);



                        for (int i = 0; i < dataChain.Length - 1; i++)
                        {
                            link = dataChain[i].Split(null);
                            //textBox1.AppendText(link[0] + "         " + link[1] + "         " + link[2] + "         "+ link[3] + "\r\n");
                            dataPt Temp = new dataPt(Convert.ToDouble(link[0]), Convert.ToDouble(link[1]), Convert.ToDouble(link[2]), Convert.ToDouble(link[3]));

                            dataList.Add(Temp);
                            //ptDisplay.Items.Add(Temp.ToString());
                        }
                    }
                    ptDisplay.Items.Add(" Data Loading: Finished");
                    button2.Enabled = true;
                    globC           = findC(dataList);
                    dataPt temp = (dataPt)dataList[dataList.Count - 1];
                    ptDisplay.Items.Add("--------------------------------------");
                    ptDisplay.Items.Add("The Maximum X value of this list is: " + findMaxX(dataList));
                    ptDisplay.Items.Add("The Minimum X value of this list is: " + findMinX(dataList));
                    ptDisplay.Items.Add("The Maximum Y value of this list is: " + findMaxY(dataList));
                    ptDisplay.Items.Add("the Minimum Y value of this list is: " + findMinY(dataList));
                    ptDisplay.Items.Add("The C for this List is " + findC(dataList));
                    //ptDisplay.Items.Add("A sample distance for the Test Data is " + findD((dataPt)dataList[0],(dataPt)dataList[1],globC));
                    //ptDisplay.Items.Add("The Value for the test data is " + IDWE(-80,26,359,2));
                    errTag.Text = "";
                }
                catch
                {
                    errTag.Text      = "The file format you attempted to load is incorrect";
                    errTag.ForeColor = Color.Red;
                }
            }
        }
示例#4
0
文件: Form1.cs 项目: Baffawuah/IDWE
 public void delete(dataPt entry)
 {
     // foreach()
 }
示例#5
0
文件: Form1.cs 项目: Baffawuah/IDWE
            public void add(double Nx, double Ny, double NtimeInt, double Nmeasure)
            {
                dataPt temp = new dataPt(Nx, Ny, NtimeInt, Nmeasure);

                add(temp);
            }
示例#6
0
文件: Form1.cs 项目: Baffawuah/IDWE
 public void add(dataPt entry)
 {
     list.Add(entry);
 }