Introduction of new Dictionary class (#1446)

* Adapting to introduction of new Dictionary class in Ghoul
 * Mainly replacing usage of float instead of doubles as expected
 * Adjust to the lack of the hasKeyAndValue function
This commit is contained in:
Alexander Bock
2021-01-02 15:07:11 +01:00
committed by GitHub
parent 7bf7a25401
commit 067c0f4b27
121 changed files with 2299 additions and 2160 deletions

View File

@@ -378,27 +378,32 @@ RenderableOrbitalKepler::RenderableOrbitalKepler(const ghoul::Dictionary& dict)
_path = dict.value<std::string>(PathInfo.identifier);
_segmentQuality = static_cast<int>(dict.value<double>(SegmentQualityInfo.identifier));
if (dict.hasKeyAndValue<glm::vec3>(LineColorInfo.identifier)) {
_appearance.lineColor = dict.value<glm::vec3>(LineColorInfo.identifier);
if (dict.hasValue<glm::dvec3>(LineColorInfo.identifier)) {
_appearance.lineColor = dict.value<glm::dvec3>(LineColorInfo.identifier);
}
_appearance.lineFade = dict.hasKeyAndValue<double>(TrailFadeInfo.identifier) ?
_appearance.lineFade =
dict.hasValue<double>(TrailFadeInfo.identifier) ?
static_cast<float>(dict.value<double>(TrailFadeInfo.identifier)) :
20.f;
_upperLimit = dict.hasKeyAndValue<double>(UpperLimitInfo.identifier) ?
_upperLimit =
dict.hasValue<double>(UpperLimitInfo.identifier) ?
static_cast<unsigned int>(dict.value<double>(UpperLimitInfo.identifier)) :
0u;
_startRenderIdx = dict.hasKeyAndValue<double>(StartRenderIdxInfo.identifier) ?
_startRenderIdx =
dict.hasValue<double>(StartRenderIdxInfo.identifier) ?
static_cast<unsigned int>(dict.value<double>(StartRenderIdxInfo.identifier)) :
0u;
_sizeRender = dict.hasKeyAndValue<double>(RenderSizeInfo.identifier) ?
_sizeRender =
dict.hasValue<double>(RenderSizeInfo.identifier) ?
static_cast<unsigned int>(dict.value<double>(RenderSizeInfo.identifier)) :
0u;
_appearance.lineWidth = dict.hasKeyAndValue<double>(LineWidthInfo.identifier) ?
_appearance.lineWidth =
dict.hasValue<double>(LineWidthInfo.identifier) ?
static_cast<float>(dict.value<double>(LineWidthInfo.identifier)) :
2.f;
@@ -418,12 +423,13 @@ RenderableOrbitalKepler::RenderableOrbitalKepler(const ghoul::Dictionary& dict)
_startRenderIdxCallbackHandle = _startRenderIdx.onChange(_updateStartRenderIdxSelect);
_sizeRenderCallbackHandle = _sizeRender.onChange(_updateRenderSizeSelect);
if (dict.hasKeyAndValue<std::string>(RenderBinModeInfo.identifier)) {
openspace::Renderable::RenderBin cfgRenderBin = RenderBinConversion.at(
if (dict.hasValue<std::string>(RenderBinModeInfo.identifier)) {
Renderable::RenderBin cfgRenderBin = RenderBinConversion.at(
dict.value<std::string>(RenderBinModeInfo.identifier)
);
setRenderBin(cfgRenderBin);
} else {
}
else {
setRenderBin(Renderable::RenderBin::PostDeferredTransparent);
}
}

View File

@@ -152,8 +152,8 @@ RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
_texturePath = absPath(dictionary.value<std::string>(TextureInfo.identifier));
_textureFile = std::make_unique<File>(_texturePath);
if (dictionary.hasKeyAndValue<glm::vec2>(OffsetInfo.identifier)) {
_offset = dictionary.value<glm::vec2>(OffsetInfo.identifier);
if (dictionary.hasValue<glm::dvec2>(OffsetInfo.identifier)) {
_offset = dictionary.value<glm::dvec2>(OffsetInfo.identifier);
}
addProperty(_offset);
@@ -162,14 +162,14 @@ RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
_textureFile->setCallback([&](const File&) { _textureIsDirty = true; });
if (dictionary.hasKeyAndValue<double>(NightFactorInfo.identifier)) {
if (dictionary.hasValue<double>(NightFactorInfo.identifier)) {
_nightFactor = static_cast<float>(
dictionary.value<double>(NightFactorInfo.identifier)
);
}
addProperty(_nightFactor);
if (dictionary.hasKeyAndValue<double>(ColorFilterInfo.identifier)) {
if (dictionary.hasValue<double>(ColorFilterInfo.identifier)) {
_colorFilter = static_cast<float>(
dictionary.value<double>(ColorFilterInfo.identifier)
);

View File

@@ -694,7 +694,7 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
addPropertySubOwner(_moffatMethodOwner);
if (dictionary.hasKey(FadeInDistancesInfo.identifier)) {
glm::vec2 v = dictionary.value<glm::vec2>(FadeInDistancesInfo.identifier);
glm::vec2 v = dictionary.value<glm::dvec2>(FadeInDistancesInfo.identifier);
_fadeInDistance = v;
_disableFadeInDistance = false;
addProperty(_fadeInDistance);

View File

@@ -78,14 +78,14 @@ SimpleSphereGeometry::SimpleSphereGeometry(const ghoul::Dictionary& dictionary)
"SimpleSphereGeometry"
);
if (dictionary.hasKeyAndValue<double>(RadiusInfo.identifier)) {
if (dictionary.hasValue<double>(RadiusInfo.identifier)) {
const float r = static_cast<float>(
dictionary.value<double>(RadiusInfo.identifier)
);
_radius = { r, r, r };
}
else {
_radius = dictionary.value<glm::vec3>(RadiusInfo.identifier);
_radius = dictionary.value<glm::dvec3>(RadiusInfo.identifier);
}
_segments = static_cast<int>(dictionary.value<double>(SegmentsInfo.identifier));