Feature/alex is flying (#729)

* Correctly specify maximum text sizes for grids
 * Use StaticScale transformations in grids and remove fixed radius
 * Fix Verifier to let grids accept non-integer min and max sizes
 * Add a new scale that changes it's value based on the current time and a reference time
 * Add a proper radiosphere that grows in real time (closes #728)
 * Add default globe customization folders to the assets (closes #724)
 * Add new dashboarditem that shows the current camera velocity (closes #702)
 * Add ability to add interesting times to a scene (closes #715)
 * Reenable keybindings gui element
 * Add ShortcutManager
 * Add ability to bind keyless keybinds to use as arbitrary shortcuts (closes #710)
This commit is contained in:
Alexander Bock
2018-10-08 03:00:35 -04:00
committed by GitHub
parent 53eebb05ba
commit 8ddc794cda
31 changed files with 1063 additions and 53 deletions
+105
View File
@@ -0,0 +1,105 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/base/scale/timedependentscale.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/util/time.h>
#include <openspace/util/updatestructures.h>
namespace {
constexpr openspace::properties::Property::PropertyInfo ReferenceDateInfo = {
"ReferenceDate",
"Reference Date",
"The date at which this scale will be 0. The current value of the scale is "
"computed by taking the difference between the current time and the reference "
"date and multiplying it by the speed. This field must be formatted as: "
"YYYY-MM-DDThh:mm:ss.uuu where h is a 24h clock and u microseconds."
};
constexpr openspace::properties::Property::PropertyInfo SpeedInfo = {
"Speed",
"Speed",
"The speed at which the value grows or shrinks. The units for this are meters "
"per second. The default value is 1 m/s."
};
} // namespace
namespace openspace {
documentation::Documentation TimeDependentScale::Documentation() {
using namespace openspace::documentation;
return {
"Timedependent Scaling",
"base_scale_timedependent",
{
{
ReferenceDateInfo.identifier,
new StringVerifier,
Optional::No,
ReferenceDateInfo.description
},
{
SpeedInfo.identifier,
new DoubleVerifier,
Optional::Yes,
SpeedInfo.description
}
}
};
}
TimeDependentScale::TimeDependentScale(const ghoul::Dictionary& dictionary)
: _referenceDate(ReferenceDateInfo, "")
, _speed(SpeedInfo, 1.0, 0.0, 1e12)
{
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"TimeDependentScale"
);
_referenceDate = dictionary.value<std::string>(ReferenceDateInfo.identifier);
_referenceDate.onChange([this]() { _cachedReferenceDirty = true; });
addProperty(_referenceDate);
if (dictionary.value<double>(SpeedInfo.identifier)) {
_speed = dictionary.value<double>(SpeedInfo.identifier);
}
addProperty(_speed);
}
double TimeDependentScale::scaleValue(const UpdateData& data) const {
if (_cachedReferenceDirty) {
_cachedReference = Time::convertTime(_referenceDate);
_cachedReferenceDirty = false;
}
const double now = data.time.j2000Seconds();
const double dt = now - _cachedReference;
return dt * _speed;
}
} // namespace openspace
+54
View File
@@ -0,0 +1,54 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_BASE___TIMEDEPENDENTSCALE___H__
#define __OPENSPACE_MODULE_BASE___TIMEDEPENDENTSCALE___H__
#include <openspace/scene/scale.h>
#include <openspace/properties/scalar/doubleproperty.h>
#include <openspace/properties/stringproperty.h>
namespace openspace {
namespace documentation { struct Documentation; }
class TimeDependentScale : public Scale {
public:
TimeDependentScale(const ghoul::Dictionary& dictionary);
double scaleValue(const UpdateData& data) const override;
static documentation::Documentation Documentation();
private:
properties::StringProperty _referenceDate;
properties::DoubleProperty _speed;
mutable bool _cachedReferenceDirty = true;
mutable double _cachedReference = 0.0; // in seconds past the J2000 epoch
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_BASE___TIMEDEPENDENTSCALE___H__