Esempio n. 1
0
        private UCAC2Index(string ucac2Folder)
        {
            string indexFile = Path.Combine(ucac2Folder, "u2index.da");

            using (FileStream fs = new FileStream(indexFile, FileMode.Open, FileAccess.Read))
            {
                BinaryReader reader = new BinaryReader(fs);
                for (int i = 0; i < 288; i++)
                {
                    for (int j = 0; j < 240; j++)
                    {
                        RAIndexPerZone[i, j] = reader.ReadUInt32();
                    }
                }

#if ASTROMETRY_DEBUG
                Trace.Assert(reader.BaseStream.Position == reader.BaseStream.Length);
#endif
            }

            int idx = -1;
            using (Stream data = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.StarCatalogues.UCAC2", "ucac2.idx"))
            {
                BinaryReader rdr = new BinaryReader(data);

                while (rdr.BaseStream.Position < rdr.BaseStream.Length)
                {
                    idx++;
                    ZoneIndex[idx] = new UCAC2BinIndexEntry(rdr);
                }
            }

            idx = -1;
            using (Stream data = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.StarCatalogues.UCAC2", "bss2.idx"))
            {
                BinaryReader rdr = new BinaryReader(data);

                while (rdr.BaseStream.Position < rdr.BaseStream.Length)
                {
                    idx++;
                    BSSZoneIndex[idx] = new UCAC2BinIndexEntry(rdr);
                }
            }

            using (Stream data = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.StarCatalogues.UCAC2", "bsindex.da"))
            {
                BinaryReader reader = new BinaryReader(data);
                for (int i = 0; i < 36; i++)
                {
                    for (int j = 0; j < 240; j++)
                    {
                        BSSRAIndexPerZone[i, j] = reader.ReadUInt32();
                    }
                }

#if ASTROMETRY_DEBUG
                Trace.Assert(reader.BaseStream.Position == reader.BaseStream.Length);
#endif
            }
        }
Esempio n. 2
0
        public LoadPosition(UCAC2Index index, UCAC2BinIndexEntry entry, SearchZone zone, bool bss)
        {
            this.ZoneId      = entry.ZoneId;
            FirstStarNoInBin = entry.LastStarNo - entry.TotalStarsInBin;

            if (bss)
            {
                if (zone.RADeciHoursFrom == 0)
                {
                    this.FromRecordId = 1;
                }
                else
                {
                    this.FromRecordId = index.BSSRAIndexPerZone[entry.ZoneId - 1, zone.RADeciHoursFrom - 1] -
                                        FirstStarNoInBin;
                }

                if (zone.RADeciHoursTo == 0)
                {
                    this.ToRecordId = 1;
                }
                else
                {
                    this.ToRecordId = index.BSSRAIndexPerZone[entry.ZoneId - 1, zone.RADeciHoursTo - 1] -
                                      (entry.LastStarNo - entry.TotalStarsInBin);
                }
            }
            else
            {
                if (zone.RADeciHoursFrom == 0)
                {
                    this.FromRecordId = 1;
                }
                else
                {
                    this.FromRecordId = index.RAIndexPerZone[entry.ZoneId - 1, zone.RADeciHoursFrom - 1] -
                                        FirstStarNoInBin;
                }

                if (zone.RADeciHoursTo == 0)
                {
                    this.ToRecordId = 1;
                }
                else
                {
                    this.ToRecordId = index.RAIndexPerZone[entry.ZoneId - 1, zone.RADeciHoursTo - 1] -
                                      (entry.LastStarNo - entry.TotalStarsInBin);
                }
            }
            BSS = bss;
        }
Esempio n. 3
0
 public LoadPosition(UCAC2Index index, UCAC2BinIndexEntry entry, SearchZone zone)
     : this(index, entry, zone, false)
 {
 }
Esempio n. 4
0
        internal List <LoadPosition> GetLoadPositions(SearchZone zone)
        {
            List <LoadPosition> searchPositions = new List <LoadPosition>();

            UCAC2BinIndexEntry lastEntry = null;

            for (int i = 0; i < ZoneIndex.Length; i++)
            {
                UCAC2BinIndexEntry entry = ZoneIndex[i];

                if (zone.DEFrom > entry.DEFrom)
                {
                    lastEntry = entry;
                    continue;
                }

                if (lastEntry != null)
                {
                    entry = lastEntry;
                }

                // Add one position
                LoadPosition pos = new LoadPosition(this, entry, zone);
                searchPositions.Add(pos);

                while (zone.DETo > entry.DETo)
                {
                    if (entry.ZoneId < ZoneIndex.Length)
                    {
                        entry = ZoneIndex[entry.ZoneId];
                        // Add another position
                        LoadPosition pos2 = new LoadPosition(this, entry, zone);
                        searchPositions.Add(pos2);
                    }
                }

                break;
            }

            lastEntry = null;
            for (int i = 0; i < BSSZoneIndex.Length; i++)
            {
                UCAC2BinIndexEntry entry = BSSZoneIndex[i];

                if (zone.DEFrom > entry.DEFrom)
                {
                    lastEntry = entry;
                    continue;
                }

                if (lastEntry != null)
                {
                    entry = lastEntry;
                }

                // Add one position
                LoadPosition pos = new LoadPosition(this, entry, zone, true);
                searchPositions.Add(pos);

                while (zone.DETo > entry.DETo)
                {
                    if (entry.ZoneId < BSSZoneIndex.Length)
                    {
                        entry = BSSZoneIndex[entry.ZoneId];
                        // Add another position
                        LoadPosition pos2 = new LoadPosition(this, entry, zone, true);
                        searchPositions.Add(pos2);
                    }
                }

                break;
            }

            return(searchPositions);
        }
Esempio n. 5
0
        private UCAC2Index(string ucac2Folder)
        {
            string indexFile = Path.Combine(ucac2Folder, "u2index.da");

            using(FileStream fs = new FileStream(indexFile, FileMode.Open, FileAccess.Read))
            {
                BinaryReader reader = new BinaryReader(fs);
                for (int i = 0; i < 288; i++)
                for (int j = 0; j < 240; j++)
                {
                    RAIndexPerZone[i, j] = reader.ReadUInt32();
                }

            #if ASTROMETRY_DEBUG
                Trace.Assert(reader.BaseStream.Position == reader.BaseStream.Length);
            #endif
            }

            int idx = -1;
            using (Stream data = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.StarCatalogues.UCAC2", "ucac2.idx"))
            {
                BinaryReader rdr = new BinaryReader(data);

                while (rdr.BaseStream.Position < rdr.BaseStream.Length)
                {
                    idx++;
                    ZoneIndex[idx] = new UCAC2BinIndexEntry(rdr);
                }
            }

            idx = -1;
            using (Stream data = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.StarCatalogues.UCAC2", "bss2.idx"))
            {
                BinaryReader rdr = new BinaryReader(data);

                while (rdr.BaseStream.Position < rdr.BaseStream.Length)
                {
                    idx++;
                    BSSZoneIndex[idx] = new UCAC2BinIndexEntry(rdr);
                }
            }

            using (Stream data = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.StarCatalogues.UCAC2", "bsindex.da"))
            {
                BinaryReader reader = new BinaryReader(data);
                for (int i = 0; i < 36; i++)
                for (int j = 0; j < 240; j++)
                {
                    BSSRAIndexPerZone[i, j] = reader.ReadUInt32();
                }

            #if ASTROMETRY_DEBUG
                Trace.Assert(reader.BaseStream.Position == reader.BaseStream.Length);
            #endif
            }
        }
Esempio n. 6
0
        public LoadPosition(UCAC2Index index, UCAC2BinIndexEntry entry, SearchZone zone, bool bss)
        {
            this.ZoneId = entry.ZoneId;
            FirstStarNoInBin = entry.LastStarNo - entry.TotalStarsInBin;

            if (bss)
            {
                if (zone.RADeciHoursFrom == 0)
                    this.FromRecordId = 1;
                else
                    this.FromRecordId = index.BSSRAIndexPerZone[entry.ZoneId - 1, zone.RADeciHoursFrom - 1] -
                                        FirstStarNoInBin;

                if (zone.RADeciHoursTo == 0)
                    this.ToRecordId = 1;
                else
                    this.ToRecordId = index.BSSRAIndexPerZone[entry.ZoneId - 1, zone.RADeciHoursTo - 1] -
                                      (entry.LastStarNo - entry.TotalStarsInBin);
            }
            else
            {
                if (zone.RADeciHoursFrom == 0)
                    this.FromRecordId = 1;
                else
                    this.FromRecordId = index.RAIndexPerZone[entry.ZoneId - 1, zone.RADeciHoursFrom - 1] -
                                        FirstStarNoInBin;

                if (zone.RADeciHoursTo == 0)
                    this.ToRecordId = 1;
                else
                    this.ToRecordId = index.RAIndexPerZone[entry.ZoneId - 1, zone.RADeciHoursTo - 1] -
                                      (entry.LastStarNo - entry.TotalStarsInBin);
            }
            BSS = bss;
        }
Esempio n. 7
0
 public LoadPosition(UCAC2Index index, UCAC2BinIndexEntry entry, SearchZone zone)
     : this(index, entry, zone, false)
 {
 }