예제 #1
0
        /// <summary>
        /// 随机删除num个元素
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public List <int> RandomRemove(int remove_num)
        {
            List <int> remove_list = new List <int>();

            Random r = new Random(DateTime.Now.Millisecond);

            int     index = 0;
            int     count = 0;
            FxImage temp  = null;


            while (count < remove_num)
            {
                index = r.Next(0, m_fx_image_num);

                if (!remove_list.Contains(index) && index != 0 && index != m_fx_image_num - 1)
                {
                    temp = m_fx_list[index];
                    if (!temp.FIRST_FLAG && !temp.LAST_FLAG && !temp.STUDY_FLAG)
                    {
                        remove_list.Add(index);
                        temp.SHOW_FLAG = false;

                        count++;
                    }
                }
            }

            return(remove_list);
        }
예제 #2
0
        /***
         *
         * 根据目录,读取分形图片,加入分形图片列表中
         *
         * Todo:读取每张图片的参数值
         **/
        public void InitFxImages()
        {
            for (int i = 1; i <= m_fx_image_num; i++)
            {
                String  pic_name      = String.Format("{0}{1}\\{2}{3}", m_base_dir, m_fx_id, i.ToString("D3"), ".jpg");
                String  blur_pic_name = String.Format("{0}{1}\\{2}{3}", m_base_dir, m_fx_id, i.ToString("D3"), "_blur.jpg");
                FxImage img           = new FxImage(pic_name, blur_pic_name, i, i * 2, i * 3);

                //初始化fx图片数据
                //Todo: 对第一张图片和最后一张图片处理
                if (i == 1)
                {
                    img.STUDY_FLAG = true;//默认第一张和最后一张图片学习
                    img.FIRST_FLAG = true;
                    img.SHOW_FLAG  = false;
                }
                if (i == 1 || i == m_fx_image_num)
                {
                    img.STUDY_FLAG = true; //默认第一张和最后一张图片学习
                    img.LAST_FLAG  = true; //
                    img.SHOW_FLAG  = false;
                }

                m_fx_list.Add(img);
            }
        }
예제 #3
0
        /**
         * 载入图片,根据页面调整图片,每页20张图片,起始页图片编号001-020,第二页 021-040,依次类推
         * 每页图片编号开始001+ (page_num-1)*20,结尾020 + (page_num-1) * 20
         * */
        public void LoadFxPicture(int page_num)
        {
            int pic_box_num = m_pic_col * m_pic_row;//PictureBox控件数量

            //初始化所有图片框背景色
            for (int i = 1; i <= pic_box_num; i++)
            {
                m_pic_list[i - 1].BackColor = Color.Transparent;
            }

            InitPictureBox();

            //
            for (int i = 1; i <= pic_box_num; i++)
            {
                FxImage fx_img = m_img_list.GetFxImage(i + (page_num - 1) * pic_box_num);

                String pic_name = fx_img.IMAGE_NAME;
                m_pic_list[i - 1].Load(pic_name);
                m_pic_list[i - 1].Show();

                //选手学过的图片高亮显示
                if (fx_img.STUDY_FLAG == true)
                {
                    m_pic_list[i - 1].BackColor       = Color.Green;
                    m_label_fx_param_list[i - 1].Text = String.Format("x: {0}, y: {1}", fx_img.FX_X, fx_img.FX_Y);
                }
                else
                {
                    m_pic_list[i - 1].BackColor       = Color.Transparent;
                    m_label_fx_param_list[i - 1].Text = "";
                }

                m_label_fx_seq_list[i - 1].Text = fx_img.SEQ_NUM.ToString();
            }

            /*
             * String pic1_name = String.Format("{0}{1}{2}", m_pic_dir, page_num.ToString("D3"), ".jpg");
             *
             * pictureBox1.Load(m_pic_dir + "001.jpg");
             * pictureBox1.Show();
             *
             */
        }
예제 #4
0
        public static int Compare(FxImage left, FxImage right)
        {
            int ret = 0;

            if (left.SEQ_NUM == right.SEQ_NUM)
            {
                ret = 0;
            }
            else if (left.SEQ_NUM < right.SEQ_NUM)
            {
                ret = -1;
            }
            else
            {
                ret = 1;
            }

            return(ret);
        }
예제 #5
0
        /**
         *
         *将分形图片打乱展示
         **/
        public void ShuffleFxImages()
        {
            Random r = new Random(DateTime.Now.Millisecond);

            int     index = 0;
            FxImage temp  = null;

            for (int i = 0; i < m_fx_image_num; i++)
            {
                index = r.Next(0, m_fx_image_num);

                if (index != i)
                {
                    temp             = m_fx_list[i];
                    m_fx_list[i]     = m_fx_list[index];
                    m_fx_list[index] = temp;
                }
            }
        }