コード例 #1
0
        private void _applyImgDtoToUi(BitmapImageSuccessDto inImgDto, double inUiToFileRatio)
        {
            if (inImgDto.Img != null)
            {
                CurrentImage = inImgDto.Img;
            }
            CurrentImageOf     = inImgDto.ImgNoOf;
            CurrentDirectoryOf = inImgDto.DirNoOf;
            CurrentImageName   = inImgDto.ImageName;

            ObservableCollection <double> tmpFindableLeft =
                new ObservableCollection <double>();
            ObservableCollection <double> tmpFindableTop =
                new ObservableCollection <double>();

            for (int i = 0; i < 3; i++)
            {
                double radius = inImgDto.FileImageRadiuses[i];
                tmpFindableLeft.Add(inImgDto.FileImageCenters[i].X * inUiToFileRatio - radius * inUiToFileRatio);
                tmpFindableTop.Add(inImgDto.FileImageCenters[i].Y * inUiToFileRatio - radius * inUiToFileRatio);
                _findableCenter[i] = new Point(
                    inImgDto.FileImageCenters[i].X * inUiToFileRatio,
                    inImgDto.FileImageCenters[i].Y * inUiToFileRatio);
            }
            FindableLeft = tmpFindableLeft;
            FindableTop  = tmpFindableTop;

            FindableWidthHeight =
                new ObservableCollection <double>(
                    inImgDto.FileImageRadiuses.Select(x => x * 2 * inUiToFileRatio)
                    .ToList());
            IsUsedFindable =
                new ObservableCollection <bool>(inImgDto.KnownMarkings);
        }
コード例 #2
0
        public BitmapImageSuccessDto LoadNextImage()
        {
            // This entire algo may only be execute if not at the end
            if (_currentSetIndex >= _allSetMarkingsContainers.Count)
            {
                BitmapImageSuccessDto retLast = new BitmapImageSuccessDto();
                retLast.LastDirFinished = true;
                return(retLast);
            }

            // Cycle through the sets without any images until one is found.
            while (!_allSetMarkingsContainers[_currentSetIndex].HasNextImage())
            {
                // Delete temp archive folder, serialize markings
                // and remove markings from memory
                _allSetMarkingsContainers[_currentSetIndex].Cleanup();

                _currentSetIndex++;
                // If the new current does exist because
                // the prev was the last one
                if (_currentSetIndex >= _allSetMarkingsContainers.Count)
                {
                    BitmapImageSuccessDto retLast = new BitmapImageSuccessDto();
                    retLast.LastDirFinished = true;
                    return(retLast);
                }
            }
            BitmapImageSuccessDto ret =
                _allSetMarkingsContainers[_currentSetIndex].LoadNextImage();

            ret.DirNoOf = (_currentSetIndex + 1).ToString() +
                          "/" + _allSetMarkingsContainers.Count.ToString();
            return(ret);
        }
コード例 #3
0
        public BitmapImageSuccessDto GetCurrentFileImgMarkingsDto()
        {
            BitmapImageSuccessDto ret =
                _allSetMarkingsContainers[_currentSetIndex].GetCurrentFileImgMarkingsDto();

            ret.DirNoOf = (_currentSetIndex + 1).ToString() +
                          "/" + _allSetMarkingsContainers.Count.ToString();
            return(ret);
        }
コード例 #4
0
        public void LoadPrevImage()
        {
            BitmapImageSuccessDto imgDto =
                _globalMarkingsManager.LoadPrevImage();

            if (imgDto.Success)
            {
                double ratio = _getUiToFileSizeRatio(imgDto.Img.PixelWidth, imgDto.Img.PixelHeight);
                _applyImgDtoToUi(imgDto, ratio);
                CurrentDir = _globalMarkingsManager.GetCurrentDir();
            }
        }
コード例 #5
0
        public void ResizingDone()
        {
            BitmapImageSuccessDto imgDto =
                _globalMarkingsManager.GetCurrentFileImgMarkingsDto();
            double ratio = 0;

            if (imgDto.Img != null)
            {
                ratio = _getUiToFileSizeRatio(imgDto.Img.PixelWidth, imgDto.Img.PixelHeight);
            }
            else
            {
                ratio = _getUiToFileSizeRatio(FileImageWidth, FileImageHeight);
            }
            _applyImgDtoToUi(imgDto, ratio);
        }
コード例 #6
0
        public void LoadNextImage()
        {
            BitmapImageSuccessDto imgDto =
                _globalMarkingsManager.LoadNextImage();

            if (imgDto.Success)
            {
                double ratio = _getUiToFileSizeRatio(imgDto.Img.PixelWidth, imgDto.Img.PixelHeight);
                _applyImgDtoToUi(imgDto, ratio);
                CurrentDir = _globalMarkingsManager.GetCurrentDir();
            }
            else if (imgDto.LastDirFinished)
            {
                //TODO(Simon): Don't do this, arghhhh
                Application.Current.Shutdown();
            }
            else
            {
                MessageBox.Show("Couldn't load image.");
            }
        }