private FlatResultImageInfo getImageInfoFlat() { var flatResult = new FlatResultImageInfo(); flatResult.Image_Location = ImageLocation; flatResult.Image_From = ImageLocationType.ToString(); if (ImageLocationType == CVClientCommon.LocationType.Local) { var fileInfo = new FileInfo(ImageLocation); flatResult.Image_BaseName = fileInfo.Name; } else if (ImageLocationType == CVClientCommon.LocationType.Uri) { Uri fileUri = new Uri(ImageLocation); flatResult.Image_BaseName = fileUri.Segments.Last(); } return(flatResult); }
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 List <ImageLocationAndExtraInfo> FilterPassGoingDOWN(List <ImageLocationAndExtraInfo> ImageLocationList, ImageLocationType PassNum) { //select items at a set interval min double LastVal = 9999999; ImageLocationAndExtraInfo tmpLastValue = ImageLocationList.First(); bool firstHubSelected = false; bool LastHubSelected = false; foreach (ImageLocationAndExtraInfo ImageLoc in ImageLocationList) { // select last hub shot if ((ImageLoc.Type == PassNum) && (!firstHubSelected)) { firstHubSelected = true; LastVal = tmpLastValue.Altitude; } else if ((ImageLoc.Type == PassNum) && (firstHubSelected) && (!LastHubSelected)) { if (tmpLastValue.Altitude > LastVal) { LastVal = tmpLastValue.Altitude; } if (ImageLoc.Altitude < LastVal - .3) { tmpLastValue.selected = true; LastVal = tmpLastValue.Altitude; LastHubSelected = true; } } else if ((ImageLoc.Type == PassNum) && (ImageLoc.Altitude <= LastVal - VerticalImageDistribution)) { LastVal = tmpLastValue.Altitude; tmpLastValue.selected = true; } tmpLastValue = ImageLoc; } return(ImageLocationList); }
private List <ImageLocationAndExtraInfo> GetListOfPass(List <ImageLocationAndExtraInfo> ImageList, ImageLocationType passToSort) { List <ImageLocationAndExtraInfo> FilteredList = new List <ImageLocationAndExtraInfo>(); foreach (ImageLocationAndExtraInfo image in ImageList) { if (image.Type == passToSort) { FilteredList.Add(image); } } return(FilteredList); }
private List <ImageLocationAndExtraInfo> SortImagesByType(List <ImageLocationAndExtraInfo> ImageLocationList) { double hubHeight = FindHubHeight(ImageLocationList); double tipHeight = FindTipHeight(ImageLocationList); foreach (ImageLocationAndExtraInfo ImageLoc in ImageLocationList) { if ((ImageLoc.Altitude < 10)) { ImageLoc.Type = ImageLocationType.Ground; } else if (ImageLoc.Altitude > hubHeight - 8) { ImageLoc.Type = ImageLocationType.High; } else if ((ImageLoc.Altitude > 10) && (ImageLoc.Altitude < tipHeight + 8)) { ImageLoc.Type = ImageLocationType.Low; } } int hubCNT = 0; int tipCNT = 0; ImageLocationType tempType = ImageLocationType.Pass1; foreach (ImageLocationAndExtraInfo ImageLoc in ImageLocationList) { if (ImageLoc.Type == ImageLocationType.High) { hubCNT++; } else { hubCNT = 0; } if (ImageLoc.Type == ImageLocationType.Low) { tipCNT++; } else { tipCNT = 0; } if ((hubCNT > 4) && (tempType == ImageLocationType.Pass1) && (ImageLoc.VertVelocity < 0)) { tempType = ImageLocationType.Pass2; } if ((tipCNT > 4) && (tempType == ImageLocationType.Pass2) && (ImageLoc.VertVelocity > 0)) { tempType = ImageLocationType.Pass3; } if ((hubCNT > 4) && (tempType == ImageLocationType.Pass3) && (ImageLoc.VertVelocity < 0)) { tempType = ImageLocationType.Pass4; } if (ImageLoc.Type != ImageLocationType.Ground) { ImageLoc.Type = tempType; } } return(ImageLocationList); }