Ejemplo n.º 1
0
        public SEFileData ReadConsts()
        {
            var data = new SEFileData(this)
            {
                FileType  = FileType,
                Version   = ReadString(),
                FileName  = ReadString(),
                Copyright = ReadString(),
            };

            // orbital elements, if single asteroid
            if (FileType == SEFileType.AdditionalAsteroid)
            {
                var asteroidData = ReadString();
                // TODO Parse data
            }
            ReadBytesOrder();
            CheckFileLength();
            data.DENumber = ReadDENumber();
            (data.StartDate, data.EndDate) = ReadFilePeriod();
            data.PlanetNumbers             = ReadPlanetNumbers();
            if (FileType == SEFileType.AdditionalAsteroid)
            {
                ReadAsteroidName();
            }
            CheckCRC();
            ReadGeneralConsts();
            ReadPlanetConstants(data);

            return(data);
        }
Ejemplo n.º 2
0
        private void ReadPlanetConstants(SEFileData data)
        {
            foreach (var ipli in data.PlanetNumbers)
            {
                var pdp = new PlanetData();

                pdp.InternalBodyNumber = ipli;
                pdp.FileIndexStart     = ReadInt32();
                pdp.Flags = (PlanetFlags)_stream.ReadByte();
                pdp.CoefficientsNumber  = _stream.ReadByte();
                pdp.NormalizationFactor = ReadInt32() / 1000.0;
                var doubles = ReadDoubles(10);
                pdp.StartDate         = JulianDayNumber.FromRaw(doubles[0]);
                pdp.EndDate           = JulianDayNumber.FromRaw(doubles[1]);
                pdp.SegmentSize       = doubles[2];
                pdp.IndexEntriesCount = (int)((doubles[1] - doubles[0] + 0.1) / doubles[2]);
                pdp.ElementsEpoch     = doubles[3];
                pdp.Prot     = doubles[4];
                pdp.Dprot    = doubles[5];
                pdp.Qrot     = doubles[6];
                pdp.Dqrot    = doubles[7];
                pdp.Perigee  = doubles[8];
                pdp.DPerigee = doubles[9];
                if (pdp.Flags.HasFlag(PlanetFlags.Ellipse))
                {
                    pdp.ReferenceEllipseCoefficients = ReadDoubles(2 * pdp.CoefficientsNumber);
                }

                var index = ipli >= SEConsts.AseroidOffset
                                        ? InternalPlanets.AnyBody
                                        : (InternalPlanets)ipli;
                data.PlanetsData[index] = pdp;
            }
        }