##// END OF EJS Templates
Removed CMake scripts :)
Removed CMake scripts :)

File last commit:

r25:5f4f9560990b
r93:63c6ae3895dd
Show More
DateTimeRangeHelper.h
86 lines | 2.9 KiB | text/x-c | CLexer
/ include / Data / DateTimeRangeHelper.h
Added more features in DateTimeRange to prepare variable synchronization...
r8 #ifndef SCIQLOP_DATETIMERANGEHELPER_H
#define SCIQLOP_DATETIMERANGEHELPER_H
Added missing headers...
r23 #include <optional>
Added more features in DateTimeRange to prepare variable synchronization...
r8 #include <cmath>
Added true single threshold cache strategy and it behaves as expected...
r12 #include <variant>
Added more features in DateTimeRange to prepare variable synchronization...
r8 #include <QObject>
#include <QDebug>
#include <opaque/numeric_typedef.hpp>
#include <Common/DateUtils.h>
#include <Common/MetaTypes.h>
#include <Common/Numeric.h>
#include <Data/DateTimeRange.h>
Few methods added to ease integration in existing GUI...
r25 enum class TransformationType { ZoomOut, ZoomIn, PanRight, PanLeft, Unknown };
Added more features in DateTimeRange to prepare variable synchronization...
r8 namespace DateTimeRangeHelper {
Followed Clazy and Clang advises and disabled few old tests...
r14 inline bool isnan(const DateTimeRange& range)
Added basic usage of cache in VC, not tested yet...
r10 {
return std::isnan(range.m_TStart) && std::isnan(range.m_TEnd);
}
Followed Clazy and Clang advises and disabled few old tests...
r14 inline bool hasnan(const DateTimeRange& range)
Added basic usage of cache in VC, not tested yet...
r10 {
return std::isnan(range.m_TStart) || std::isnan(range.m_TEnd);
}
Added more features in DateTimeRange to prepare variable synchronization...
r8
Followed Clazy and Clang advises and disabled few old tests...
r14 inline bool isPureShift(const DateTimeRange& range1, const DateTimeRange& range2)
Added more features in DateTimeRange to prepare variable synchronization...
r8 {
Many fixes plus implemented var synchronization...
r9 return SciQLop::numeric::almost_equal<double>(range1.delta(), range2.delta(), 1)
&& !SciQLop::numeric::almost_equal(range1.m_TStart, range2.m_TStart, 1);
Added more features in DateTimeRange to prepare variable synchronization...
r8 }
Followed Clazy and Clang advises and disabled few old tests...
r14 inline bool isPureZoom(const DateTimeRange& range1, const DateTimeRange& range2)
Added more features in DateTimeRange to prepare variable synchronization...
r8 {
Many fixes plus implemented var synchronization...
r9 return !SciQLop::numeric::almost_equal<double>(range1.delta(),range2.delta(),1)&&
SciQLop::numeric::almost_equal<double>(range1.center(), range2.center(),1);
Added more features in DateTimeRange to prepare variable synchronization...
r8 }
Few methods added to ease integration in existing GUI...
r25
Added more features in DateTimeRange to prepare variable synchronization...
r8 /**
* @brief computeTransformation such as range2 = zoom*range1 + shift
* @param range1
* @param range2
Many fixes plus implemented var synchronization...
r9 * @return trnaformation applied to range1 to get range2 or an object of type
* InvalidDateTimeRangeTransformation if the transformation has NaN or forbiden values
Added more features in DateTimeRange to prepare variable synchronization...
r8 */
Some refactoring on Variable class...
r15 inline std::optional<DateTimeRangeTransformation>
Many fixes plus implemented var synchronization...
r9 computeTransformation(const DateTimeRange& range1, const DateTimeRange& range2)
Added more features in DateTimeRange to prepare variable synchronization...
r8 {
Some refactoring on Variable class...
r15 std::optional<DateTimeRangeTransformation> transformation;
Many fixes plus implemented var synchronization...
r9 double zoom = range2.delta()/range1.delta();
Seconds<double> shift = range2.center() - (range1*zoom).center();
bool zoomValid = zoom!=0. && !std::isnan(zoom) && !std::isinf(zoom);
bool shiftValid = !std::isnan(shift.value) && !std::isinf(shift.value);
if(zoomValid && shiftValid)
Some refactoring on Variable class...
r15 transformation = DateTimeRangeTransformation{zoom, shift};
return transformation;
Added more features in DateTimeRange to prepare variable synchronization...
r8 }
Few methods added to ease integration in existing GUI...
r25 inline TransformationType getTransformationType(const DateTimeRange& range1, const DateTimeRange& range2)
{
auto transformation = computeTransformation (range1,range2);
if(transformation.has_value ())
{
if(SciQLop::numeric::almost_equal(transformation->zoom,1.))
{
if(transformation->shift > 0.)
return TransformationType::PanRight;
return TransformationType::PanLeft;
}
if(transformation->zoom > 0.)
return TransformationType::ZoomOut;
return TransformationType::ZoomIn;
}
return TransformationType::Unknown;
}
Added more features in DateTimeRange to prepare variable synchronization...
r8 }
#endif // SCIQLOP_DATETIMERANGEHELPER_H