2018-04-07 08:44:39 +00:00
|
|
|
#include <cmath>
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
QString valueOfKeyInMapOrEmpty(const std::map<QString, QString> &map, const QString &key)
|
|
|
|
{
|
|
|
|
auto it = map.find(key);
|
|
|
|
if (it == map.end())
|
|
|
|
return QString();
|
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isTrueValueString(const QString &str)
|
|
|
|
{
|
|
|
|
return "true" == str || "True" == str || "1" == str;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isFloatEqual(float a, float b)
|
|
|
|
{
|
|
|
|
return fabs(a - b) <= 0.000001;
|
|
|
|
}
|
2018-04-13 00:04:18 +00:00
|
|
|
|
|
|
|
void qNormalizeAngle(int &angle)
|
|
|
|
{
|
|
|
|
while (angle < 0)
|
|
|
|
angle += 360 * 16;
|
|
|
|
while (angle > 360 * 16)
|
|
|
|
angle -= 360 * 16;
|
|
|
|
}
|
|
|
|
|