async private void BUTT_REFRESH_Click(object sender, EventArgs e) { ImageListView CurrentView = GetCurrentView(); if (CurrentView.SelectedItems.Count == 0) { foreach (ImageListViewItem item in CurrentView.Items) { ImageLocationAndExtraInfo tmpinfo = ImageGroup.FullImageList.Find(x => x.PathToSmallImage.Contains(Path.GetFileName(item.FileName))); tmpinfo = await this.ParentForm.CreateSmallImages(tmpinfo); tmpinfo = await this.ParentForm.SaveGrayedOutImage(tmpinfo, tmpinfo.LeftCrop, tmpinfo.RightCrop, tmpinfo.brightnessCorrection); item.Update(); } } else { foreach (ImageListViewItem item in CurrentView.SelectedItems) { ImageLocationAndExtraInfo tmpinfo = ImageGroup.FullImageList.Find(x => x.PathToSmallImage.Contains(Path.GetFileName(item.FileName))); tmpinfo = await this.ParentForm.CreateSmallImages(tmpinfo); tmpinfo = await this.ParentForm.SaveGrayedOutImage(tmpinfo, tmpinfo.LeftCrop, tmpinfo.RightCrop, tmpinfo.brightnessCorrection); item.Update(); } } }
async private void RemapSingleAltDialog(object sender, EventArgs e) { ImageListView CurrentView = GetCurrentView(); using (var form = new AltRemapSingleDialog()) { //determine which view is open var result = form.ShowDialog(); if (result == DialogResult.OK) { float newalt = form.newValue; foreach (ImageListViewItem Item in CurrentView.SelectedItems) { ImageLocationAndExtraInfo tmpinfo = ImageGroup.FullImageList.Find(x => x.PathToSmallImage.Contains(Path.GetFileName(Item.FileName))); tmpinfo.Altitude = newalt; tmpinfo = await this.ParentForm.SaveGrayedOutImage(tmpinfo, tmpinfo.LeftCrop, tmpinfo.RightCrop, tmpinfo.brightnessCorrection); Item.Update(); } } } SaveProgress(); }
async private void BUTT_RR_Click(object sender, EventArgs e) { try{ ImageListView CurrentView = GetCurrentView(); foreach (ImageListViewItem im in CurrentView.SelectedItems) { ImageLocationAndExtraInfo tmpinfo = ImageGroup.FullImageList.Find(x => x.PathToSmallImage.Contains(Path.GetFileName(im.FileName))); tmpinfo.RightCrop = tmpinfo.RightCrop + 50; if (tmpinfo.RightCrop >= 795) { tmpinfo.RightCrop = 794; } else if (tmpinfo.RightCrop <= tmpinfo.LeftCrop) { tmpinfo.RightCrop = tmpinfo.LeftCrop; } tmpinfo = await this.ParentForm.SaveGrayedOutImage(tmpinfo, tmpinfo.LeftCrop, tmpinfo.RightCrop, tmpinfo.brightnessCorrection); im.Update(); } SaveProgress(); } catch (Exception error) { this.ParentForm.AppendLogTextBox("\n\n****ERROR***\n" + error.Message); } }
async private void CropImageLeft(object sender, EventArgs e) { try { MenuItem MI = (MenuItem)sender; ImageListView CurrentView = GetCurrentView(); foreach (ImageListViewItem im in CurrentView.SelectedItems) { ImageLocationAndExtraInfo tmpinfo = ImageGroup.FullImageList.Find(x => x.PathToSmallImage.Contains(Path.GetFileName(im.FileName))); tmpinfo.LeftCrop = tmpinfo.LeftCrop + int.Parse(MI.Text) / 10;; if (tmpinfo.LeftCrop >= tmpinfo.RightCrop) { tmpinfo.LeftCrop = tmpinfo.RightCrop - 1; } else if (tmpinfo.LeftCrop < 0) { tmpinfo.LeftCrop = 0; } tmpinfo = await this.ParentForm.SaveGrayedOutImage(tmpinfo, tmpinfo.LeftCrop, tmpinfo.RightCrop, tmpinfo.brightnessCorrection); im.Update(); } SaveProgress(); } catch (Exception ER) { this.ParentForm.AppendLogTextBox("FAILED to recrop images \n***ERROR***\n" + ER.Message); } }
async public void populatePassImages() { try{ foreach (ImageLocationAndExtraInfo imgInfo in ImageGroup.FullImageList) { try { if (imgInfo.selected) { if (!File.Exists(imgInfo.PathToGreyImage)) { ImageLocationAndExtraInfo tmpInfo = await this.ParentForm.SaveGrayedOutImage(imgInfo, imgInfo.LeftCrop, imgInfo.RightCrop, imgInfo.brightnessCorrection); imgInfo.PathToGreyImage = tmpInfo.PathToGreyImage; } switch (imgInfo.Type) { case ImageLocationType.Pass1: Images_pass1.Items.Add(imgInfo.PathToGreyImage); break; case ImageLocationType.Pass2: Images_pass2.Items.Add(imgInfo.PathToGreyImage); break; case ImageLocationType.Pass3: Images_pass3.Items.Add(imgInfo.PathToGreyImage); break; case ImageLocationType.Pass4: Images_pass4.Items.Add(imgInfo.PathToGreyImage); break; case ImageLocationType.Pass5: Images_pass5.Items.Add(imgInfo.PathToGreyImage); break; } } else { Images_extra.Items.Add(imgInfo.PathToSmallImage); } } catch { } } SortPassImagesbyName(Images_pass1); SortPassImagesbyName(Images_pass2); SortPassImagesbyName(Images_pass3); SortPassImagesbyName(Images_pass4); SortPassImagesbyName(Images_pass5); } catch (Exception ER) { this.ParentForm.AppendLogTextBox("FAILED to populate images into pass tabs \n***ERROR***\n" + ER.Message); } UpdateImageNumber(); }
private void MoveImageToPass(object sender, EventArgs e) { try { MenuItem MI = (MenuItem)sender; ImageListView CurrentView = GetCurrentView(); foreach (ImageListViewItem im in CurrentView.SelectedItems) { ImageLocationAndExtraInfo tmpinfo = ImageGroup.FullImageList.Find(x => x.PathToSmallImage.Contains(Path.GetFileName(im.FileName))); tmpinfo.selected = true; this.ParentForm.SaveGrayedOutImage(tmpinfo, tmpinfo.LeftCrop, tmpinfo.RightCrop, tmpinfo.brightnessCorrection); switch (MI.Text) { case "1": tmpinfo.Type = ImageLocationType.Pass1; Images_pass1.Items.Add(tmpinfo.PathToGreyImage); SortPassImagesbyName(Images_pass1); break; case "2": tmpinfo.Type = ImageLocationType.Pass2; Images_pass2.Items.Add(tmpinfo.PathToGreyImage); SortPassImagesbyName(Images_pass2); break; case "3": tmpinfo.Type = ImageLocationType.Pass3; Images_pass3.Items.Add(tmpinfo.PathToGreyImage); SortPassImagesbyName(Images_pass3); break; case "4": tmpinfo.Type = ImageLocationType.Pass4; Images_pass4.Items.Add(tmpinfo.PathToGreyImage); SortPassImagesbyName(Images_pass4); break; case "5": tmpinfo.Type = ImageLocationType.Pass5; Images_pass5.Items.Add(tmpinfo.PathToGreyImage); SortPassImagesbyName(Images_pass5); break; } CurrentView.Items.Remove(im); } SaveProgress(); UpdateImageNumber(); } catch (Exception ER) { this.ParentForm.AppendLogTextBox("FAILED while moving images to pass tab " + this.ImageGroup.BaseDirectory + "\n***ERROR***\n" + ER.Message); } }
private List <ImageLocationAndExtraInfo> FilterPassGoingUP(List <ImageLocationAndExtraInfo> ImageLocationList, ImageLocationType PassNum) { //select items at a set vertical interval min double LastVal = 0; List <ImageLocationAndExtraInfo> tmpList = new List <ImageLocationAndExtraInfo>(); ImageLocationAndExtraInfo tmpLastValue = ImageLocationList.First(); bool firstTipSelected = false; bool LastTipSelected = false; foreach (ImageLocationAndExtraInfo ImageLoc in ImageLocationList) { // select last hub shot if ((ImageLoc.Type == PassNum) && (!firstTipSelected)) { firstTipSelected = true; LastVal = tmpLastValue.Altitude; } else if ((ImageLoc.Type == PassNum) && (firstTipSelected) && (!LastTipSelected)) { if (tmpLastValue.Altitude < LastVal) { LastVal = tmpLastValue.Altitude; } if (ImageLoc.Altitude > LastVal + .4) { tmpLastValue.selected = true; LastVal = tmpLastValue.Altitude; LastTipSelected = true; } } else if ((ImageLoc.Type == PassNum) && (ImageLoc.Altitude >= LastVal + this.VerticalImageDistribution)) { LastVal = tmpLastValue.Altitude; tmpLastValue.selected = true; } tmpLastValue = ImageLoc; } return(ImageLocationList); }
async private void RemapAltsforPass(ImageListView view, float start, float end) { if (!(view.Items.Count > 0)) { return; } float count = view.Items.Count; float step = (end - start) / count; float alt = start; foreach (ImageListViewItem Item in view.Items) { ImageLocationAndExtraInfo tmpinfo = ImageGroup.FullImageList.Find(x => x.PathToSmallImage.Contains(Path.GetFileName(Item.FileName))); tmpinfo.Altitude = alt; tmpinfo = await this.ParentForm.SaveGrayedOutImage(tmpinfo, tmpinfo.LeftCrop, tmpinfo.RightCrop, tmpinfo.brightnessCorrection); Item.Update(); alt = alt + step; } }
private void MoveImageToExtra(object sender, EventArgs e) { try { MenuItem MI = (MenuItem)sender; ImageListView CurrentView = GetCurrentView(); foreach (ImageListViewItem im in CurrentView.SelectedItems) { ImageLocationAndExtraInfo tmpinfo = ImageGroup.FullImageList.Find(x => x.PathToSmallImage.Contains(Path.GetFileName(im.FileName))); tmpinfo.selected = false; Images_extra.Items.Add(tmpinfo.PathToSmallImage); SortPassImagesbyName(Images_extra); CurrentView.Items.Remove(im); } SaveProgress(); } catch (Exception ER) { this.ParentForm.AppendLogTextBox("FAILED to move images to extra tab" + this.ImageGroup.BaseDirectory + "\n***ERROR***\n" + ER.Message); } UpdateImageNumber(); }
private List <ImageLocationAndExtraInfo> MiddleOutSelect(List <ImageLocationAndExtraInfo> ImageList, ImageLocationType passToSort) { List <ImageLocationAndExtraInfo> FilteredList = GetListOfPass(ImageList, passToSort); //split list in middle List <ImageLocationAndExtraInfo> FilteredListFirstHalf = FilteredList.GetRange(0, FilteredList.Count / 2); FilteredListFirstHalf.Reverse(); List <ImageLocationAndExtraInfo> FilteredListSecondHalf = FilteredList.GetRange((FilteredList.Count / 2) - 1, FilteredList.Count / 2);; if ((passToSort == ImageLocationType.Pass1) || (passToSort == ImageLocationType.Pass3)) { //Filter first half in reverse down double LastVal = 99999999; ImageLocationAndExtraInfo LastSelected = FilteredListFirstHalf.First(); ImageLocationAndExtraInfo tmpLastValue = FilteredListFirstHalf.First(); foreach (ImageLocationAndExtraInfo ImageLoc in FilteredListFirstHalf) { // select last hub shot if ((ImageLoc.Type == passToSort) && (ImageLoc.Altitude <= LastVal - VerticalImageDistribution)) { LastSelected = ImageLoc; LastVal = tmpLastValue.Altitude; tmpLastValue.selected = true; } tmpLastValue = ImageLoc; } FilteredListFirstHalf.Last().selected = true; //filter second half forward up LastVal = 0; tmpLastValue = FilteredListSecondHalf.First(); foreach (ImageLocationAndExtraInfo ImageLoc in FilteredListSecondHalf) { if ((ImageLoc.Type == passToSort) && (ImageLoc.Altitude >= LastVal + VerticalImageDistribution)) { LastSelected = ImageLoc; LastVal = tmpLastValue.Altitude; tmpLastValue.selected = true; } tmpLastValue = ImageLoc; } LastSelected.selected = true; } else if ((passToSort == ImageLocationType.Pass2) || (passToSort == ImageLocationType.Pass4)) { //Filter first half in reverse up double LastVal = 0; ImageLocationAndExtraInfo LastSelected = FilteredListFirstHalf.First(); ImageLocationAndExtraInfo tmpLastValue = FilteredListFirstHalf.First(); foreach (ImageLocationAndExtraInfo ImageLoc in FilteredListFirstHalf) { if ((ImageLoc.Type == passToSort) && (ImageLoc.Altitude >= LastVal + VerticalImageDistribution)) { LastSelected = ImageLoc; LastVal = tmpLastValue.Altitude; tmpLastValue.selected = true; } tmpLastValue = ImageLoc; } LastSelected.selected = true; //filter second half forward down LastVal = 99999999; tmpLastValue = FilteredListSecondHalf.First(); foreach (ImageLocationAndExtraInfo ImageLoc in FilteredListSecondHalf) { // select last hub shot if ((ImageLoc.Type == passToSort) && (ImageLoc.Altitude <= LastVal - VerticalImageDistribution)) { LastSelected = ImageLoc; LastVal = tmpLastValue.Altitude; tmpLastValue.selected = true; } tmpLastValue = ImageLoc; } LastSelected.selected = true; } //for each element in the two half lists update the main list foreach (ImageLocationAndExtraInfo ImageLoc in FilteredListFirstHalf) { if (ImageLoc.selected) { ImageList.Find(x => x.PathToOrigionalImage == ImageLoc.PathToOrigionalImage).selected = true; } } foreach (ImageLocationAndExtraInfo ImageLoc in FilteredListSecondHalf) { if (ImageLoc.selected) { ImageList.Find(x => x.PathToOrigionalImage == ImageLoc.PathToOrigionalImage).selected = true; } } return(ImageList); }
private void ListBoxDoubleClick(object sender, ItemClickEventArgs Args) { ImageLocationAndExtraInfo tmpinfo = ImageGroup.FullImageList.Find(x => x.PathToSmallImage.Contains(Path.GetFileName(Args.Item.FileName))); Process.Start(tmpinfo.PathToOrigionalImage); }