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; }
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 !PRODUCTION Trace.Assert(reader.BaseStream.Position == reader.BaseStream.Length); #endif } int idx = -1; using (Stream data = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("OccuRec.Astrometry.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("OccuRec.Astrometry.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("OccuRec.Astrometry.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 !PRODUCTION Trace.Assert(reader.BaseStream.Position == reader.BaseStream.Length); #endif } }
public LoadPosition(UCAC2Index index, UCAC2BinIndexEntry entry, SearchZone zone) : this(index, entry, zone, false) { }