From e64149e154e717a19aa8f436a025be8b6223cd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABlle=20USSEGLIO?= <gaelle.usseglio@cnes.fr> Date: Thu, 12 Sep 2019 13:33:42 +0000 Subject: [PATCH] ENH : Handle geom versions with a new version number (4) --- .../include/ossim/ossimSarSensorModel.h | 2 ++ .../src/ossim/ossimSarSensorModel.cpp | 35 ++++++++++++++----- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Modules/ThirdParty/OssimPlugins/include/ossim/ossimSarSensorModel.h b/Modules/ThirdParty/OssimPlugins/include/ossim/ossimSarSensorModel.h index 01f48004fd..f6a4360e8d 100644 --- a/Modules/ThirdParty/OssimPlugins/include/ossim/ossimSarSensorModel.h +++ b/Modules/ThirdParty/OssimPlugins/include/ossim/ossimSarSensorModel.h @@ -522,6 +522,8 @@ protected: TimeType theFirstLineTime; TimeType theLastLineTime; + unsigned int theGeomVersion; // version of input geom + unsigned long theNumberOfLinesPerBurst; unsigned long theNumberOfSamplesPerBurst; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp index 110b44b681..01952209dd 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp @@ -107,7 +107,7 @@ namespace ossimplugins const double ossimSarSensorModel::C = 299792458; - const unsigned int ossimSarSensorModel::thePluginVersion = 3; + const unsigned int ossimSarSensorModel::thePluginVersion = 4; const unsigned int ossimSarSensorModel::thePluginVersionMin = 2; ossimSarSensorModel::ProductType::ProductType(string_view const& s) @@ -1187,7 +1187,11 @@ bool ossimSarSensorModel::worldToAzimuthRangeTime(const ossimGpt& worldPt, TimeT { get(kwl, burstPrefix + keyStartSample, burstRecord.startSample); get(kwl, burstPrefix + keyEndSample, burstRecord.endSample); - get(kwl, burstPrefix + keyAzimuthAnxTime, burstRecord.azimuthAnxTime); + + if (version >= 4) + { + get(kwl, burstPrefix + keyAzimuthAnxTime, burstRecord.azimuthAnxTime); + } } } catch (...) { @@ -1417,6 +1421,8 @@ bool ossimSarSensorModel::worldToAzimuthRangeTime(const ossimGpt& worldPt, TimeT theBurstRecords.clear(); get(kwl, theBurstRecords); + get(kwl, HEADER_PREFIX, "version", theGeomVersion); + if(theBurstRecords.size() > 1) { unsigned int version; @@ -1486,7 +1492,11 @@ bool ossimSarSensorModel::deburst(std::vector<std::pair<unsigned long, unsigned unsigned long currentStart = it->startLine; TimeType deburstAzimuthStartTime = it->azimuthStartTime; - double deburstAzimuthAnxTime = it->azimuthAnxTime; + double deburstAzimuthAnxTime = 0; + if (theGeomVersion >= 4) + { + deburstAzimuthAnxTime = it->azimuthAnxTime; + } unsigned long deburstEndLine = 0; @@ -1683,8 +1693,13 @@ ossimSarSensorModel::burstExtraction(const unsigned int burst_index, oneBurst.azimuthStopTime = burstAzimuthStopTime; oneBurst.startSample = 0; oneBurst.endSample = samples.second - samples.first; - oneBurst.azimuthAnxTime = burstInd_Record.azimuthAnxTime; - + + oneBurst.azimuthAnxTime = 0; + if (theGeomVersion >= 4) + { + oneBurst.azimuthAnxTime = burstInd_Record.azimuthAnxTime; + } + theBurstRecords.push_back(oneBurst); // Adapt general metadata : theNearRangeTime, first_time_line, last_time_line @@ -1775,10 +1790,14 @@ ossimSarSensorModel::deburstAndConcatenate(std::vector<std::pair<unsigned long,u std::vector<BurstRecordType>::const_iterator next = it+1; std::vector<BurstRecordType>::const_iterator itend = theBurstRecords.end(); - unsigned long currentStart = it->startLine; + unsigned long currentStart = it->startLine; TimeType deburstAzimuthStartTime = it->azimuthStartTime; - - double deburstAzimuthAnxTime = it->azimuthAnxTime; + + double deburstAzimuthAnxTime = 0; + if (theGeomVersion >= 4) + { + deburstAzimuthAnxTime = it->azimuthAnxTime; + } unsigned long deburstEndLine = 0; -- GitLab