Exemplo n.º 1
0
        //This Will set the trackbars on the CAST tab
        private void button16_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                trackBar3.Enabled = false;
                trackBar4.Enabled = false;
                button17.Enabled  = false;

                textBox6.Text     = openFileDialog1.FileName;
                textBox4.Text     = openFileDialog1.FileName;
                textBox3.Text     = openFileDialog1.FileName;
                textBox2.Text     = openFileDialog1.FileName;
                textBox1.Text     = openFileDialog1.FileName;
                pointSetFile      = textBox6.Text;
                pointSetFileShort = openFileDialog1.SafeFileName;

                points = new PointSet(pointSetFile);

                //Now we set the Distance
                //Distance matrix
                distMatrix = points.GetDistanceMatrix();
                distances  = distMatrix.GetSortedDistanceList();

                //Find minimum Connectivity (can make this binary search)
                minConnectIndex = LightWeightGraph.BinSearchGeoMinConnectivity(0, distances.Count - 1, distMatrix.Count, distMatrix, distances);

                label25.Text = String.Format("Minimum Connectivity:({0})={1}", minConnectIndex, distances[minConnectIndex]);

                float sum = distances.Sum();
                sum         /= distances.Count;
                label22.Text = "Mean Dist:" + sum;

                //Set the track bars
                trackBar4.Minimum = 0;
                trackBar4.Maximum = minConnectIndex;
                trackBar3.Minimum = minConnectIndex;
                trackBar3.Maximum = distances.Count - 1;

                trackBar4.Value = trackBar3.Value = minConnectIndex;
                label24.Text    = String.Format("Min:({0}) {1}", trackBar4.Value, distances[trackBar4.Value]);
                label23.Text    = String.Format("Max:({0}) {1}", trackBar3.Value, distances[trackBar3.Value]);

                trackBar3.Enabled = true;
                trackBar4.Enabled = true;
                button17.Enabled  = true;
            }
        }
Exemplo n.º 2
0
        //this calculates the distance list
        private void CalculateMinConnectivityGeoGraph(KPoint.DistType distType)
        {
            points = new PointSet(pointSetFile);

            graphPrefix = pointSetFileShort.Substring(0, pointSetFileShort.IndexOf('.')) + "_" + distType.ToString() + "_";

            //Now we set the Distance
            //Distance matrix
            distMatrix = points.GetDistanceMatrix(distType);
            distances  = distMatrix.GetSortedDistanceList();

            //Find minimum Connectivity (can make this binary search)
            int pointCount = points.Count;

            minConnectIndex = LightWeightGraph.BinSearchGeoMinConnectivity(0, distances.Count - 1, pointCount, distMatrix, distances);

            label1.Text = String.Format("Minimum Connectivity:({0})={1}", minConnectIndex, distances[minConnectIndex]);

            float sum = 0;

            foreach (float dist in distances)
            {
                sum += dist;
            }
            sum        /= distances.Count;
            label4.Text = "Mean Dist:" + sum;

            //Set the track bars
            trackBar1.Minimum = 0;
            trackBar1.Maximum = minConnectIndex;
            trackBar2.Minimum = minConnectIndex;
            trackBar2.Maximum = distances.Count - 1;

            trackBar1.Value = trackBar2.Value = minConnectIndex;
            distMin.Text    = String.Format("Min:({0}) {1}", trackBar1.Value, distances[trackBar1.Value]);
            distMax.Text    = String.Format("Max:({0}) {1}", trackBar2.Value, distances[trackBar2.Value]);
        }