mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-07 04:49:00 -06:00
Support new TemporalTileProvider time format
This commit is contained in:
@@ -301,6 +301,16 @@ std::string YYYYMMDD_hhmmss::stringify(const Time& t) const {
|
||||
return ts;
|
||||
}
|
||||
|
||||
std::string YYYYMMDD_hhmm::stringify(const Time& t) const {
|
||||
std::string ts = t.ISO8601().substr(0, 16);
|
||||
|
||||
// YYYY_MM_DDThh_mm -> YYYYMMDD_hhmm
|
||||
ts.erase(std::remove(ts.begin(), ts.end(), '-'), ts.end());
|
||||
ts.erase(std::remove(ts.begin(), ts.end(), ':'), ts.end());
|
||||
replace(ts.begin(), ts.end(), 'T', '_');
|
||||
return ts;
|
||||
}
|
||||
|
||||
std::string YYYY_MM_DDThhColonmmColonssZ::stringify(const Time& t) const {
|
||||
return t.ISO8601().substr(0, 19) + "Z";
|
||||
}
|
||||
@@ -328,7 +338,10 @@ void TimeIdProviderFactory::init() {
|
||||
{ "YYYY-MM-DDThh_mm_ssZ", std::make_unique<YYYY_MM_DDThh_mm_ssZ>() }
|
||||
));
|
||||
_timeIdProviderMap.insert(std::pair<std::string, std::unique_ptr<TimeFormat>>(
|
||||
{ "YYYYMMDD_hhmmss", std::make_unique<YYYYMMDD_hhmmss>() }
|
||||
{ "YYYYMMDD_hhmmss", std::make_unique<YYYYMMDD_hhmmss>() }
|
||||
));
|
||||
_timeIdProviderMap.insert(std::pair<std::string, std::unique_ptr<TimeFormat>>(
|
||||
{ "YYYYMMDD_hhmm" , std::make_unique<YYYYMMDD_hhmm>() }
|
||||
));
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,15 @@ struct YYYYMMDD_hhmmss : public TimeFormat {
|
||||
virtual std::string stringify(const Time& t) const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stringifies OpenSpace to the format "YYYYMMDD_hhmm"
|
||||
* Example: 20160908_2305
|
||||
*/
|
||||
struct YYYYMMDD_hhmm : public TimeFormat {
|
||||
virtual ~YYYYMMDD_hhmm() override = default;
|
||||
virtual std::string stringify(const Time& t) const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stringifies OpenSpace to the format "YYYY-MM-DDThh:mm:ssZ"
|
||||
* Example: 2016-09-08T23:05:05Z
|
||||
|
||||
Reference in New Issue
Block a user