Changeset 11066 in ntrip for trunk/BNC/src/bncantex.cpp


Ignore:
Timestamp:
Oct 5, 2026, 12:31:32 PM (5 days ago)
Author:
stuerze
Message:

further fixes and initial import for ssr qc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncantex.cpp

    r11047 r11066  
    6868  }
    6969  _maps.clear();
     70  QMapIterator<QString, QVector<t_antMap*> > itSat(_satMaps);
     71  while (itSat.hasNext()) {
     72    itSat.next();
     73    for (int ii = 0; ii < itSat.value().size(); ii++) {
     74      delete itSat.value()[ii];
     75    }
     76  }
     77  _satMaps.clear();
    7078}
    7179
    … …  
    141149t_irc bncAntex::readFile(const QString& fileName) {
    142150
     151  _fileName = fileName;
    143152  QFile inFile(fileName);
    144153  inFile.open(QIODevice::ReadOnly | QIODevice::Text);
    … …  
    176185          _satBlocks[newAntMap->antName].append(satBlock);
    177186        }
    178         if (_maps.contains(newAntMap->antName)) {
    179           delete _maps[newAntMap->antName];
    180         }
    181         _maps[newAntMap->antName] = newAntMap;
     187        if (newAntMap->isSat) {
     188          _satMaps[newAntMap->antName].append(newAntMap);
     189        }
     190        else {
     191          if (_maps.contains(newAntMap->antName)) {
     192            delete _maps[newAntMap->antName];
     193          }
     194          _maps[newAntMap->antName] = newAntMap;
     195        }
    182196        newAntMap = 0;
    183197      }
    … …  
    199213            line.indexOf("NavIC") == 0 ){
    200214          newAntMap->antName = line.mid(20,3);
     215          newAntMap->isSat   = true;
    201216          if (line.indexOf("BLOCK I") == 0) {
    202217            // Extract GPS block type: "BLOCK IIF   " → "IIF"
    … …  
    789804  }
    790805
    791   QMap<QString, t_antMap*>::const_iterator it = _maps.find(prn.mid(0,3));
    792   if (it != _maps.end()) {
    793     t_antMap* map = it.value();
     806  bncTime epoch;
     807  epoch.setmjd(Mjd);
     808  const t_antMap* map = satMap(prn, epoch);
     809  if (map) {
    794810    if (map->frqMap.find(frqType) != map->frqMap.end()) {
    795811
    796       double* neu = map->frqMap[frqType]->neu;
     812      const double* neu = map->frqMap[frqType]->neu;
    797813
    798814      // Unit Vectors sz, sy, sx
    … …  
    879895////////////////////////////////////////////////////////////////////////////
    880896double bncAntex::satCorr(const QString& prn, t_frequency::type frqType,
    881                          double elTx, double azTx, bool& found) const {
    882 
    883   if (_maps.find(prn.mid(0,3)) == _maps.end()) {
     897                         double elTx, double azTx, bool& found,
     898                         const bncTime& epoch) const {
     899
     900  const t_antMap* map = satMap(prn, epoch);
     901  if (!map) {
    884902    found = false;
    885903    return 0.0;
    886904  };
    887 
    888   t_antMap* map = _maps[prn.mid(0,3)];
    889905
    890906  if (map->frqMap.find(frqType) == map->frqMap.end()) {
    … …  
    964980}
    965981
     982// Satellite antenna entry valid at the given epoch (the last entry of the
     983// PRN if the epoch is not valid), 0 if there is none
     984////////////////////////////////////////////////////////////////////////////
     985const bncAntex::t_antMap* bncAntex::satMap(const QString& prn, const bncTime& epoch) const {
     986  QMap<QString, QVector<t_antMap*> >::const_iterator it = _satMaps.find(prn.mid(0,3));
     987  if (it == _satMaps.end() || it.value().isEmpty()) {
     988    return 0;
     989  }
     990  const QVector<t_antMap*>& maps = it.value();
     991  if (!epoch.valid()) {
     992    return maps.last();
     993  }
     994  for (int ii = maps.size() - 1; ii >= 0; ii--) {
     995    const t_antMap* map = maps[ii];
     996    if ((!map->validFrom.valid() || !(epoch < map->validFrom)) &&
     997        (!map->validTo.valid()   || epoch < map->validTo)) {
     998      return map;
     999    }
     1000  }
     1001  return 0;
     1002}
     1003
     1004// File name, number of satellite entries and the latest satellite entry,
     1005// which identifies the version of the file
     1006////////////////////////////////////////////////////////////////////////////
     1007QString bncAntex::info() const {
     1008  int     numSat = 0;
     1009  bncTime latest;
     1010  QString latestPrn;
     1011  QMapIterator<QString, QVector<t_antMap*> > it(_satMaps);
     1012  while (it.hasNext()) {
     1013    it.next();
     1014    for (int ii = 0; ii < it.value().size(); ii++) {
     1015      const t_antMap* map = it.value()[ii];
     1016      ++numSat;
     1017      if (map->validFrom.valid() && (!latest.valid() || latest < map->validFrom)) {
     1018        latest    = map->validFrom;
     1019        latestPrn = it.key();
     1020      }
     1021    }
     1022  }
     1023  QString str = QString("ANTEX file %1: %2 receiver and %3 satellite antenna entries")
     1024                .arg(_fileName).arg(_maps.size()).arg(numSat);
     1025  if (latest.valid()) {
     1026    str += QString(", latest satellite entry %1 valid from %2").arg(latestPrn)
     1027           .arg(QString::fromStdString(latest.datestr()));
     1028  }
     1029  return str;
     1030}
     1031
     1032// True if a missing satellite antenna entry has to be reported (at most once
     1033// per hour and PRN)
     1034////////////////////////////////////////////////////////////////////////////
     1035bool bncAntex::warnNoSatEntry(const QString& prn, const bncTime& epoch) const {
     1036  bncTime& warned = _noSatEntryWarned[prn.mid(0,3)];
     1037  if (!warned.valid() || !epoch.valid() || epoch - warned >= 3600.0) {
     1038    warned = epoch;
     1039    return true;
     1040  }
     1041  return false;
     1042}
     1043
    9661044// Satellite block type valid at the given epoch
    9671045////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.