Example #1
0
        internal static TrackedObjectConfig Load(BinaryReader reader)
        {
            TrackedObjectConfig instance = new TrackedObjectConfig();

            byte version = reader.ReadByte();

            if (version > 0)
            {
                instance.TrackingType = (TrackingType)reader.ReadInt32();

                instance.MeasureThisObject    = reader.ReadBoolean();
                instance.ApertureInPixels     = reader.ReadSingle();
                instance.PsfFitMatrixSize     = reader.ReadInt32();
                instance.ApertureStartingX    = reader.ReadSingle();
                instance.ApertureStartingY    = reader.ReadSingle();
                instance.OriginalFieldCenterX = reader.ReadInt32();
                instance.OriginalFieldCenterY = reader.ReadInt32();

                bool hasGaussian = reader.ReadBoolean();
                if (hasGaussian)
                {
                    instance.Gaussian = PSFFit.Load(reader);
                }

                instance.PositionTolerance  = reader.ReadSingle();
                instance.IsWeakSignalObject = reader.ReadBoolean();
                instance.ApertureMatrixX0   = reader.ReadSingle();
                instance.ApertureMatrixY0   = reader.ReadSingle();
                instance.ApertureDX         = reader.ReadSingle();
                instance.ApertureDY         = reader.ReadSingle();

                instance.AutoStarsInArea = new List <PSFFit>();
                int autoStarsInArea = reader.ReadInt32();
                for (int i = 0; i < autoStarsInArea; i++)
                {
                    instance.AutoStarsInArea.Add(PSFFit.Load(reader));
                }

                if (version > 1)
                {
                    instance.RefinedFWHM = reader.ReadSingle();

                    if (version > 2)
                    {
                        instance.IsFixedAperture = reader.ReadBoolean();

                        if (version > 3)
                        {
                            instance.GroupId = reader.ReadInt32();
                        }
                    }
                }
            }

            return(instance);
        }
Example #2
0
        public PSFFit GetGaussian2()
        {
            using (MemoryStream memStr = new MemoryStream())
            {
                var wrt = new BinaryWriter(memStr);
                BinarySerialize2(wrt);

                memStr.Position = 0;

                var rdr = new BinaryReader(memStr);
                return(PSFFit.Load(rdr));
            }
        }