示例#1
0
        /// <summary>
        /// Gets amplitude in the provided point
        /// </summary>
        /// <param name="file">File to get amplitude from</param>
        /// <param name="p">Point to get amplitude at</param>
        /// <returns></returns>
        public virtual bool Analyze(RlViewer.Files.LocatorFile file, System.Drawing.Point location)
        {
            bool hasLocationChanged = false;
            if (_isMouseDown)
            {
                if (location.X >= 0 && location.X < file.Width && location.Y >= 0 && location.Y < file.Height)
                {
                    if (_currentLocation != location)
                    {
                        _currentLocation = location;
                        hasLocationChanged = true;

                        try
                        {
                            Amplitude = file.GetSample(location).ToFileSample(file.Properties.Type, file.Header.BytesPerSample);
                        }
                        catch (Exception)
                        {
                            _isMouseDown = false;
                            throw;
                        }
                    }
                }
            }

            return hasLocationChanged;
        }
 public override Navigation.NavigationContainer Create(RlViewer.Files.FileProperties properties, Headers.Abstract.LocatorFileHeader header)
 {
     var brl4header = header as RlViewer.Headers.Concrete.Brl4.Brl4Header;
     if (brl4header == null) throw new ArgumentException("brl4header");
     return new Brl4NavigationContainer(properties.FilePath, brl4header.HeaderStruct.synthParams.D0, brl4header.HeaderStruct.rlParams.flipType, brl4header.HeaderStruct.rlParams.width,
         brl4header.HeaderStruct.rlParams.dx, brl4header.HeaderStruct.synthParams.board, brl4header.FileHeaderLength, brl4header.HeaderStruct.rlParams.width * brl4header.BytesPerSample,
         brl4header.HeaderStruct.rlParams.sx, brl4header.HeaderStruct.rlParams.sy);
 }
示例#3
0
 public ItemDrawer(PointSelector.PointSelector pointSelector,
     AreaSelector.AreaSelector areaSelector, RlViewer.Behaviors.Scaling.Scaler scaler,
     AreaSelector.AreaSelectorsAlignerContainer areaAlignerWrapper) : base(scaler)
 {
     _pointSelector = pointSelector;
     _areaSelector = areaSelector;
     _areaAlignerWrapper = areaAlignerWrapper;
 }
 public override Navigation.NavigationContainer Create(RlViewer.Files.FileProperties properties, Headers.Abstract.LocatorFileHeader header)
 {
     var rHeader = header as RlViewer.Headers.Concrete.R.RHeader;
     if (rHeader == null) throw new ArgumentException("rHeader");
     return new RNavigationContainer(properties.FilePath, rHeader.HeaderStruct.synthesisHeader.initialRange, 0, (int)rHeader.HeaderStruct.lineInfoHeader.lineLength,
         rHeader.HeaderStruct.synthesisHeader.dx, rHeader.HeaderStruct.synthesisHeader.sideObservation,
         rHeader.FileHeaderLength, (int)rHeader.HeaderStruct.lineInfoHeader.lineLength * rHeader.BytesPerSample);
 }
 public override Navigation.NavigationContainer Create(RlViewer.Files.FileProperties properties, Headers.Abstract.LocatorFileHeader header)
 {
     var kHeader = header as RlViewer.Headers.Concrete.K.KHeader;
     if (kHeader == null) throw new ArgumentException("kHeader");
     return new KNavigationContainer(properties.FilePath, kHeader.HeaderStruct.synchronizerHeader.initialRange, 0, 0,
         0, (byte)kHeader.HeaderStruct.synchronizerHeader.board, header.FileHeaderLength,
         (int)kHeader.HeaderStruct.lineInfoHeader.lineLength * header.BytesPerSample);
 }
示例#6
0
        public override byte[] ResampleImage(RlViewer.Files.LocatorFile file, System.Drawing.Rectangle area)
        {
            float[] image = new float[area.Width * area.Height];

            float[] imageArea = file.GetArea(area).ToArea<float>(file.Header.BytesPerSample);

            int toInclusiveX = area.Location.X + area.Width;
            toInclusiveX = toInclusiveX > file.Width ? file.Width : toInclusiveX;

            int toInclusiveY = area.Location.Y + area.Height;
            toInclusiveY = toInclusiveY > file.Height ? file.Height : toInclusiveY;
            int counter = 0;

         
            //Parallel.For(area.Location.X, toInclusiveX, (i, loopState) =>
            //{
            for (int i = area.Location.X; i < toInclusiveX; i++)
            {
                for (int j = area.Location.Y; j < toInclusiveY; j++)
                {
                    var oldAmplVal = imageArea[(j - area.Location.Y) * area.Width + (i - area.Location.X)];
                    var newAmplVal = GetPlaneValue(i / Selector.RangeCompressionCoef, j / Selector.AzimuthCompressionCoef,
                        PointToPlane(new System.Drawing.Point(i / Selector.RangeCompressionCoef, j / Selector.AzimuthCompressionCoef),
                        AmplitudeSolution));
                    var newRcsVal = GetPlaneValue(i / Selector.RangeCompressionCoef, j / Selector.AzimuthCompressionCoef,
                        PointToPlane(new System.Drawing.Point(i / Selector.RangeCompressionCoef,
                            j / Selector.AzimuthCompressionCoef), RcsSolution));

                    var diff = oldAmplVal / newAmplVal * newRcsVal;

                    diff = diff < 0 ? 0 : diff;

                    image[(j - area.Location.Y) * area.Width + (i - area.Location.X)] = diff;
                }

                System.Threading.Interlocked.Increment(ref counter);
                OnProgressReport((int)(counter / Math.Ceiling((double)(toInclusiveX - area.Location.X)) * 100));

                if (OnCancelWorker())
                {
                    break;
                    // loopState.Break();
                }

            }
            //});

            if (Cancelled)
            {
                return null;
            }

            byte[] imageB = new byte[image.Length * 4];

            Buffer.BlockCopy(image, 0, imageB, 0, imageB.Length);

            return imageB;
        }
示例#7
0
 public static Tuple<string, string>[] NaviInfo(this NavigationString s, int sampleNum, RlViewer.Behaviors.Navigation.NavigationComputing computer)
 {
     return new Tuple<string, string>[] 
     {
         new Tuple<string, string>("Широта", ParseLatitude(computer.InterpolateLatitude(sampleNum, s.AircraftLatitude, s.AircraftHeight, s.Track, s.Board))),
         new Tuple<string, string>("Долгота",ParseLongitude(computer.InterpolateLongtitude(sampleNum, s.AircraftLongitude, s.AircraftLatitude, s.AircraftHeight, s.Track, s.Board))),
         new Tuple<string, string>("Курс", ParseToDegrees(s.Track)),
         new Tuple<string, string>("Время",    s.TimeArm.ToString())
     };
 }
 public static Factories.NavigationChanger.Abstract.NavigationChangerFactory GetFactory(RlViewer.Files.FileProperties properties)
 {
     switch (properties.Type)
     {
         case FileType.rl4:
             return new Factories.NavigationChanger.Concrete.Rl4NavigationChangerFactory();
         case FileType.brl4:
             return new Factories.NavigationChanger.Concrete.Brl4NavigationChangerFactory();
         default:
             throw new ArgumentException("Navigation changer type");
     }
 }
示例#9
0
        public override byte[] ResampleImage(RlViewer.Files.LocatorFile file, System.Drawing.Rectangle area)
        {
            float[] image = new float[area.Width * area.Height];
           
            int toInclusiveX = area.Location.X + area.Width;
            toInclusiveX = toInclusiveX > file.Width ? file.Width : toInclusiveX;

            int toInclusiveY = area.Location.Y + area.Height;
            toInclusiveY = toInclusiveY > file.Height ? file.Height : toInclusiveY;
            int counter = 0;


            float[] imageArea = file.GetArea(area).ToArea<float>(file.Header.BytesPerSample);

            Parallel.For(area.Location.X, toInclusiveX, (i, loopState) =>
            {
                var zValues = _zCoefficients.Select(x => Extrapolate(i, x)).ToArray();
                var yValues = _yCoefficients.Select(x => Extrapolate(i, x)).ToArray();
                var _zCoefs = LinearEquation.SolveEquation(yValues, zValues);

                for (int j = area.Location.Y; j < toInclusiveY; j++)
                {
                    var oldVal = imageArea[(j - area.Location.Y)
                        * area.Width + (i - area.Location.X)];
                    var newAmplVal = Extrapolate(j, _zCoefs);
                    var rcsVal = RcsProvider.GetValueAt(oldVal);

                    var diff = oldVal / newAmplVal * rcsVal;
                    diff = diff < 0 ? 0 : diff;

                    image[(j - area.Location.Y) * area.Width + (i - area.Location.X)] = diff;
                }

                System.Threading.Interlocked.Increment(ref counter);
                OnProgressReport((int)(counter / Math.Ceiling((double)(toInclusiveX - area.Location.X)) * 100));
                if (OnCancelWorker())
                {
                    loopState.Break();
                }

            });

            if (Cancelled)
            {
                return null;
            }

            byte[] imageB = new byte[image.Length * 4];

            Buffer.BlockCopy(image, 0, imageB, 0, imageB.Length);

            return imageB;
        }
        public override NavigationString[] ConvertToCommonNavigation(RlViewer.Headers.Abstract.IStrHeader[] strCollection)
        {
            RlViewer.Headers.Concrete.Rl4.Rl4StrHeaderStruct[] rStrColl = strCollection.Select(x => (RlViewer.Headers.Concrete.Rl4.Rl4StrHeaderStruct)x).ToArray();
            IEnumerable<NavigationString> naviStrings;

            try
            {
                naviStrings = rStrColl.Select
                    (x => new NavigationString((float)x.longtitude, (float)x.latitude, (float)x.H, (float)x.a, _board, x.time[0] == 0 ? default(DateTime) : x.time.ToDateTime()));
            }
            catch (ArgumentNullException)
            {
                throw;
            }
            return naviStrings.ToArray();
        }
示例#11
0
        public override NavigationString[] ConvertToCommonNavigation(RlViewer.Headers.Abstract.IStrHeader[] strCollection)
        {
            RlViewer.Headers.Concrete.K.KStrHeaderStruct[] rStrColl = strCollection.Select(x => (RlViewer.Headers.Concrete.K.KStrHeaderStruct)x).ToArray();
            IEnumerable<NavigationString> naviStrings;

            try
            {  
                naviStrings = rStrColl.Select
                    (x => new NavigationString((float)(x.navigationHeader.longtitudeInsSns / 180f * Math.PI),
                        (float)(x.navigationHeader.latitudeInsSns / 180f * Math.PI), (float)x.navigationHeader.heightInsSns,
                        (float)(x.navigationHeader.realTraceInsSns / 180f * Math.PI), _board, new DateTime().AddYears(1970).AddMilliseconds(x.navigationHeader.timeArm)));
            }
            catch (ArgumentNullException)
            {
                throw;
            }
            return naviStrings.ToArray();
        }
示例#12
0
 public static PointFinderFactory GetFactory(RlViewer.Files.FileProperties properties)
 {
     switch (properties.Type)
     {
         case FileType.brl4:
             return new Concrete.Brl4PointFinderFactory();
         case FileType.rl4:
             return new Concrete.Rl4PointFinderFactory();
         case FileType.r:
             return new Concrete.RPointFinderFactory();
         case FileType.raw:
             return new Concrete.RawPointFinderFactory();
         case FileType.rl8:
             return new Concrete.Rl8PointFinderFactory();
         case FileType.k:
             Logging.Logger.Log(Logging.SeverityGrades.Internal, ".k point finder not implemented");
             return new Concrete.KPointFinderFactory();
         default: throw new ArgumentException();
     }
 }
示例#13
0
        public static PointSharerFactory GetFactory(RlViewer.Files.FileProperties properties)
        {
            switch (properties.Type)
            {
                case FileType.brl4:
                    return new Concrete.Brl4PointSharerFactory();
                case FileType.k:
                    return new Concrete.KPointSharerFactory();
                case FileType.raw:
                    return new Concrete.RawPointSharerFactory();
                case FileType.rl4:
                    return new Concrete.Rl4PointSharerFactory();
                case FileType.r:
                    return new Concrete.RPointSharerFactory();
                case FileType.rl8:
                    return new Concrete.Rl8PointSharerFactory();

                default: throw new ArgumentException();
            }
        }
示例#14
0
        public override IEnumerable<PointF> GetValues(RlViewer.Files.LocatorFile file, Point p1)
        {
            var coordPairList = new List<PointF>();

            for (int i = p1.X - SectionLength / 2; i < p1.X + SectionLength / 2; i++)
            {
                if (i < 0 || i >= file.Width || p1.Y < 0 || p1.Y >= file.Height) continue;

                try
                { 
                    coordPairList.Add(new PointF(i, file.GetSample(new Point(i, p1.Y)).ToFileSample(file.Properties.Type, file.Header.BytesPerSample)));
                }
                catch(Exception)
                {
                    throw;
                }
            }

            return coordPairList;
        }
示例#15
0
        public static CornerCoordFactory GetFactory(RlViewer.Files.FileProperties properties)
        {
            switch (properties.Type)
            {
                case FileType.brl4:
                    return new Concrete.Brl4CornerCoordFactory();
                case FileType.k:
                    return new Concrete.KCornerCoordFactory();
                case FileType.raw:
                    return new Concrete.RawCornerCoordFactory();
                case FileType.rl4:
                    return new Concrete.Rl4CornerCoordFactory();
                case FileType.r:
                    return new Concrete.RCornerCoordFactory();
                case FileType.rl8:
                    return new Concrete.Rl8CornerCoordFactory();

                default: throw new ArgumentException();
            }
        }
示例#16
0
 public static FilePreviewFactory GetFactory(RlViewer.Files.FileProperties properties)
 {
     switch (properties.Type)
     {
         case FileType.brl4:
             return new Concrete.Brl4FilePreviewFactory();
         case FileType.rl4:
             return new Concrete.Rl4FilePreviewFactory();
         case FileType.raw:
             return new Concrete.RawFilePreviewFactory();
         case FileType.k:
             return new Concrete.KFilePreviewFactory();
         case FileType.r:
             return new Concrete.RFilePreviewFactory();
         case FileType.rl8:
             return new Concrete.Rl8FilePreviewFactory();
         default:
             throw new NotSupportedException("Unsupported file type");
     }
 }
 public static NavigationContainerFactory GetFactory(RlViewer.Files.FileProperties properties)
 {
     switch (properties.Type)
     {
         case FileType.brl4:
             return new Concrete.Brl4NavigationContainerFactory();
         case FileType.k:
             return new Concrete.KNavigationContainerFactory();
         case FileType.raw:
             return new Concrete.RawNavigationContainerFactory();
         case FileType.rl4:
             return new Concrete.Rl4NavigationContainerFactory();
         case FileType.r:
             return new Concrete.RNavigationContainerFactory();
         case FileType.rl8:
             return new Concrete.Rl8NavigationContainerFactory();
         case FileType.ba:
             return new Concrete.BaNavigationContainerFactory();
         default: throw new ArgumentException();
     }
 }
示例#18
0
        public static SaverFactory GetFactory(RlViewer.Files.FileProperties properties)
        {
            switch (properties.Type)
            {
                case FileType.brl4:
                    return new Brl4SaverFactory();
                case FileType.rl4:
                    return new Rl4SaverFactory();
                case FileType.raw:
                    return new RawSaverFactory();
                case FileType.k:
                    return new KSaverFactory();
                case FileType.r:
                    return new RSaverFactory();
                case FileType.rl8:
                    return new Rl8SaverFactory();

                default:
                    throw new NotSupportedException("Unsupported file format");
            }
        }
示例#19
0
 public static HeaderFactory GetFactory(RlViewer.Files.FileProperties properties)
 {
     switch (properties.Type)
     {
         case FileType.brl4:                 
             return new Brl4HeaderFactory();
         case FileType.rl4:
             return new Rl4HeaderFactory(); 
         case FileType.raw:
             return new RawHeaderFactory(); 
         case FileType.k:
             return new KHeaderFactory(); 
         case FileType.r:
             return new RHeaderFactory();
         case FileType.rl8:
             return new Rl8HeaderFactory();
         case FileType.ba:
             return new BaHeaderFactory();
         default:
             throw new NotSupportedException("Unsupported file type");
     }
 }
示例#20
0
 public override LocatorFile Create(FileProperties properties,
     Headers.Abstract.LocatorFileHeader header, RlViewer.Navigation.NavigationContainer navi)
 {
     return new K(properties, header, navi);
 }
示例#21
0
 public override RlViewer.Behaviors.TileCreator.Abstract.ITileCreator Create(RlViewer.Files.LocatorFile locatorFile, Behaviors.TileCreator.TileOutputType type)
 {
     return new RTileCreator(locatorFile, type);
 }
示例#22
0
 public abstract LocatorFile Create(FileProperties properties, Headers.Abstract.LocatorFileHeader header, RlViewer.Navigation.NavigationContainer navi);
示例#23
0
文件: Ba.cs 项目: worstward/rlviewer
 public Ba(FileProperties properties, Headers.Abstract.LocatorFileHeader header, RlViewer.Navigation.NavigationContainer navi)
     : base(properties, header, navi)
 {
     _header = header as Headers.Concrete.Ba.BaHeader;
     _navi = navi;
 }
示例#24
0
文件: Rl8.cs 项目: worstward/rlviewer
 /// <summary>
 /// Incapsulates radiolocation image file of a ".rl8" format
 /// </summary>
 public Rl8(FileProperties properties, Headers.Abstract.LocatorFileHeader header, RlViewer.Navigation.NavigationContainer navi)
     : base(properties, header, navi)
 {
     _header = header as RlViewer.Headers.Concrete.Rl8.Rl8Header;
 }
 public override Navigation.NavigationContainer Create(RlViewer.Files.FileProperties properties, Headers.Abstract.LocatorFileHeader header)
 {
     return new BaNavigationContainer(properties.FilePath);
 }
示例#26
0
 /// <summary>
 /// Changes image amplitudes with prebuilt surface
 /// </summary>
 /// <param name="file">Image file</param>
 /// <param name="area">Working area</param>
 /// <returns>Resampled area</returns>
 public abstract byte[] ResampleImage(RlViewer.Files.LocatorFile file, System.Drawing.Rectangle area);
示例#27
0
 public TileDrawer(RlViewer.Behaviors.Filters.Abstract.ImageFiltering filter,
     RlViewer.Behaviors.Scaling.Scaler scaler) : base(scaler)
 {
     _filter = filter;
 }
示例#28
0
 public abstract IEnumerable<PointF> GetValues(RlViewer.Files.LocatorFile file, Point p1);
示例#29
0
 public SelectedPoint(RlViewer.Files.LocatorFile file, Point location)
 {      
     _location = location;
     _value = file.GetSample(location).ToFileSample(file.Properties.Type, file.Header.BytesPerSample);
 }
示例#30
0
        protected RliFile(FileProperties properties, Headers.Abstract.LocatorFileHeader header,
            RlViewer.Navigation.NavigationContainer navi) : base(properties, header, navi)
        {

        }