Exemplo n.º 1
0
        // Cree un onglet avec la carte scrollables
        private void ouvrirScrollMap()
        {
            if (pages.TabCount >= 1)
                for (int i = 0; i < pages.TabCount; i++)
                    if (pages.TabPages[i].Text.Equals("Carte Scrollable"))
                        return;

            if (mapScroll == null)
            {
                mapScroll = new ScrollableMaps(true);
            }
            mapScroll.mapBox.Controls.Add(mapScroll.initTrackBar());
            mapScroll.mapBox.Controls.Add(mapScroll.legend());
            pages.ClientAdd(mapScroll.mapBox, "Carte Scrollable", null, true);
        }
Exemplo n.º 2
0
        // K-Means
        private void Kmeans(Dictionary<int, Dictionary<int, double>> data, int clusters, string type, string codage)
        {
            double[,] db = null;
            if (data.Count > 1)
                if (codage != "Binaire")
                    db = convertData(data);
                else
                    db = convertDataBin(data);
            else
                return;

            Console.WriteLine("Donnees convertie");

            cluster = KMeans.ClusterDataSet(clusters, db, type);
            //MessageBox.Show(this,"Nombre de cluster : " + cluster.Count);
            Console.WriteLine("Kmeans calcule");
            //Dictionary<int, int> stationCluster = new Dictionary<int, int>();
            stationCluster = new Dictionary<int, int>();
            for (int i = 0; i < cluster.Count; i++)
            {
                Console.WriteLine("Cluster : " + i + " - Taille : " + cluster[i].Count);
                //string s = "Cluster " + i + ", taille = " + cluster[i].getValues.Count + " : ";
                foreach (int z in cluster[i].getValues)
                {
                    //Console.WriteLine(stations[z]);
                    int temp = stations[z];
                    stationCluster.Add(temp, i);
                    //string s = stations[z] + " : " + i ;
                }
            }
            ScrollableMaps maps = new ScrollableMaps();
            maps.drawClusters(stationCluster);
            PictureBox map = maps.mapBox;
            map.SizeMode = PictureBoxSizeMode.Zoom;
            map.Dock = DockStyle.Fill;
            Panel tempPanel = new Panel();
            tempPanel.Dock = DockStyle.Fill;

            combo1 = new ComboBox();
            combo1.Text = "Affichage des statistiques pour les clusters";
            combo1.Items.Add("Tous les clusters");
            combo1.Items.Add("Altitudes");
            combo1.Items.Add("Point of Interest");
            for (int i = 0; i < cluster.Count; i++)
                combo1.Items.Add(i);
            combo1.SelectedIndexChanged += changeCluster;
            combo1.Dock = DockStyle.Top;

            tempPanel.Controls.Add(combo1);
            tempPanel.Controls.Add(map);

            panel.addControls(tempPanel);
        }