//new constructor
 public DatasetImageElements(DatasetElements datasetElementsObj) :
     base(datasetElementsObj.GetFilename(), datasetElementsObj.GetShortFilename())
 {
     this.charater = DatasetImageElements.Charater.unset;
     //Setting code vector of image
     this.pictureStringFormat = SetPictureStringFormat(datasetElementsObj.GetFilename());
 }
예제 #2
0
        private void buttonOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog openDialog = new OpenFileDialog();                                                            //create OpenDialog

            openDialog.Filter      = "Image Files(*.BMP;*.JPG;*.GIF;*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG|All files (*.*)|*.*"; //Make imageFilter
            openDialog.Multiselect = true;

            //Show OpenDialog and adding files
            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                StringBuilder imageSizeErr  = new StringBuilder();
                StringBuilder imageOtherErr = new StringBuilder();
                //Making list of files path
                foreach (String fileName in openDialog.FileNames)
                {
                    //if this fileimage doesn't have errors
                    if (DatasetElementsMethods.isImageNoErrors(fileName))
                    {
                        //Size of image checking
                        if (DatasetElementsMethods.isImageSizeOk(fileName))
                        {
                            DatasetElements imageElement = new DatasetElements(fileName);
                            imageDataset.Add(imageElement);
                        }
                        else
                        {
                            //Making list of size error files
                            imageSizeErr.Append(fileName + Environment.NewLine);
                        }
                    }
                    else
                    {
                        //Making list of other errors files
                        imageOtherErr.Append(fileName + Environment.NewLine);
                    }
                }

                if (imageSizeErr.Length != 0)
                {
                    MessageBox.Show("These images are not " + DatasetImageElements.ImageWidthConst + "x" + DatasetImageElements.ImageHeightConst
                                    + " pixels and were ignored:" + Environment.NewLine + imageSizeErr.ToString(), "Error: Incorrect size",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                if (imageOtherErr.Length != 0)
                {
                    MessageBox.Show("These images have errors:" + Environment.NewLine + imageOtherErr.ToString(), "Errors in files",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                DatasetElementsMethods.updateListBoxMain(listBoxImages, imageDataset, labelStatusPre);
            }
        }
예제 #3
0
        public override bool Equals(object obj)
        {
            DatasetElements DatasetElementsObj = obj as DatasetElements;

            if (DatasetElementsObj == null)
            {
                return(false);
            }
            else
            {
                return(filename.Equals(DatasetElementsObj.filename));
            }
        }