mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Update Ghoul and SGCT
Adapt to changes by using more string_view
This commit is contained in:
@@ -429,10 +429,7 @@ void DashboardItemAngle::render(glm::vec2& penPosition) {
|
||||
glm::vec2 DashboardItemAngle::size() const {
|
||||
constexpr const double Angle = 120;
|
||||
|
||||
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
"Angle: " + std::to_string(Angle)
|
||||
).boundingBox;
|
||||
return _font->boundingBox("Angle: " + std::to_string(Angle));
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -119,10 +119,9 @@ void DashboardItemDate::render(glm::vec2& penPosition) {
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemDate::size() const {
|
||||
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
return _font->boundingBox(
|
||||
fmt::format("Date: {} UTC", global::timeManager.time().UTC())
|
||||
).boundingBox;
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -463,10 +463,9 @@ glm::vec2 DashboardItemDistance::size() const {
|
||||
dist = { convertedD, nameForDistanceUnit(unit, convertedD != 1.0) };
|
||||
}
|
||||
|
||||
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
return _font->boundingBox(
|
||||
fmt::format("Distance from focus: {} {}", dist.first, dist.second)
|
||||
).boundingBox;
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -301,21 +301,14 @@ void DashboardItemFramerate::render(glm::vec2& penPosition) {
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemFramerate::size() const {
|
||||
FrametimeType frametimeType = FrametimeType(_frametimeType.value());
|
||||
const std::string output = format(
|
||||
frametimeType,
|
||||
_minDeltaTimeCache,
|
||||
_maxDeltaTimeCache
|
||||
);
|
||||
const FrametimeType t = FrametimeType(_frametimeType.value());
|
||||
const std::string output = format(t, _minDeltaTimeCache, _maxDeltaTimeCache);
|
||||
|
||||
if (output.empty()) {
|
||||
return { 0.f, 0.f };
|
||||
}
|
||||
|
||||
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
output
|
||||
).boundingBox;
|
||||
return _font->boundingBox(output);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -208,10 +208,7 @@ glm::vec2 DashboardItemParallelConnection::size() const {
|
||||
}
|
||||
|
||||
if (!connectionInfo.empty()) {
|
||||
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
connectionInfo
|
||||
).boundingBox;
|
||||
return _font->boundingBox(connectionInfo);
|
||||
}
|
||||
else {
|
||||
return { 0.f, 0.f };
|
||||
|
||||
@@ -166,10 +166,7 @@ void DashboardItemPropertyValue::render(glm::vec2& penPosition) {
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemPropertyValue::size() const {
|
||||
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
_displayString.value()
|
||||
).boundingBox;
|
||||
return _font->boundingBox(_displayString.value());
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -238,13 +238,12 @@ glm::vec2 DashboardItemSimulationIncrement::size() const {
|
||||
deltaTime = { convertedT, nameForTimeUnit(unit, convertedT != 1.0) };
|
||||
}
|
||||
|
||||
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
return _font->boundingBox(
|
||||
fmt::format(
|
||||
"Simulation increment: {:.1f} {:s} / second",
|
||||
deltaTime.first, deltaTime.second
|
||||
)
|
||||
).boundingBox;
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -229,10 +229,9 @@ glm::vec2 DashboardItemVelocity::size() const {
|
||||
dist = { convertedD, nameForDistanceUnit(unit, convertedD != 1.0) };
|
||||
}
|
||||
|
||||
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
return _font->boundingBox(
|
||||
fmt::format("Camera velocity: {} {}/s", dist.first, dist.second)
|
||||
).boundingBox;
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -75,7 +75,6 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/layer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/layeradjustment.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/layergroup.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/layergroupid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/layermanager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/layerrendersettings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/memoryawaretilecache.cpp
|
||||
|
||||
@@ -199,10 +199,9 @@ void DashboardItemGlobeLocation::render(glm::vec2& penPosition) {
|
||||
);
|
||||
}
|
||||
glm::vec2 DashboardItemGlobeLocation::size() const {
|
||||
return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
return _font->boundingBox(
|
||||
fmt::format("Position: {}, {} Altitude: {}", 1.f, 1.f, 1.f)
|
||||
).boundingBox;
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* 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/globebrowsing/src/layergroupid.h>
|
||||
|
||||
using namespace openspace::globebrowsing::layergroupid;
|
||||
|
||||
namespace ghoul {
|
||||
|
||||
template <>
|
||||
TypeID from_string(const std::string& string) {
|
||||
for (int i = 0; i < NUM_LAYER_TYPES; ++i) {
|
||||
if (string == LAYER_TYPE_NAMES[i]) {
|
||||
return static_cast<TypeID>(i);
|
||||
}
|
||||
}
|
||||
return TypeID::Unknown;
|
||||
}
|
||||
|
||||
template <>
|
||||
openspace::globebrowsing::layergroupid::GroupID from_string(const std::string& string) {
|
||||
for (int i = 0; i < NUM_LAYER_GROUPS; ++i) {
|
||||
if (string == LAYER_GROUP_IDENTIFIERS[i]) {
|
||||
return static_cast<GroupID>(i);
|
||||
}
|
||||
}
|
||||
return GroupID::Unknown;
|
||||
}
|
||||
|
||||
template <>
|
||||
openspace::globebrowsing::layergroupid::AdjustmentTypeID from_string(
|
||||
const std::string& string)
|
||||
{
|
||||
for (int i = 0; i < NUM_ADJUSTMENT_TYPES; ++i) {
|
||||
if (string == ADJUSTMENT_TYPE_NAMES[i]) {
|
||||
return static_cast<AdjustmentTypeID>(i);
|
||||
}
|
||||
}
|
||||
return AdjustmentTypeID::None;
|
||||
}
|
||||
|
||||
template <>
|
||||
openspace::globebrowsing::layergroupid::BlendModeID from_string(const std::string& string)
|
||||
{
|
||||
for (int i = 0; i < NUM_BLEND_MODES; ++i) {
|
||||
if (string == BLEND_MODE_NAMES[i]) {
|
||||
return static_cast<BlendModeID>(i);
|
||||
}
|
||||
}
|
||||
return BlendModeID::Normal;
|
||||
}
|
||||
|
||||
} // namespace ghoul
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
namespace openspace::globebrowsing::layergroupid {
|
||||
|
||||
static constexpr int NUM_LAYER_GROUPS = 5;
|
||||
static constexpr const int NUM_LAYER_GROUPS = 5;
|
||||
static constexpr const char* LAYER_GROUP_IDENTIFIERS[NUM_LAYER_GROUPS] = {
|
||||
"HeightLayers",
|
||||
"ColorLayers",
|
||||
@@ -56,7 +56,7 @@ enum GroupID {
|
||||
Unknown,
|
||||
};
|
||||
|
||||
static constexpr int NUM_LAYER_TYPES = 8;
|
||||
static constexpr const int NUM_LAYER_TYPES = 8;
|
||||
static constexpr const char* LAYER_TYPE_NAMES[NUM_LAYER_TYPES] = {
|
||||
"DefaultTileLayer",
|
||||
"SingleImageTileLayer",
|
||||
@@ -124,18 +124,52 @@ enum class BlendModeID {
|
||||
namespace ghoul {
|
||||
|
||||
template <>
|
||||
openspace::globebrowsing::layergroupid::TypeID from_string(const std::string& string);
|
||||
constexpr openspace::globebrowsing::layergroupid::TypeID from_string(
|
||||
std::string_view string)
|
||||
{
|
||||
for (int i = 0; i < openspace::globebrowsing::layergroupid::NUM_LAYER_TYPES; ++i) {
|
||||
if (string == openspace::globebrowsing::layergroupid::LAYER_TYPE_NAMES[i]) {
|
||||
return static_cast<openspace::globebrowsing::layergroupid::TypeID>(i);
|
||||
}
|
||||
}
|
||||
return openspace::globebrowsing::layergroupid::TypeID::Unknown;
|
||||
}
|
||||
|
||||
template <>
|
||||
openspace::globebrowsing::layergroupid::GroupID from_string(const std::string& string);
|
||||
constexpr openspace::globebrowsing::layergroupid::GroupID from_string(
|
||||
std::string_view string)
|
||||
{
|
||||
for (int i = 0; i < openspace::globebrowsing::layergroupid::NUM_LAYER_GROUPS; ++i) {
|
||||
if (string == openspace::globebrowsing::layergroupid::LAYER_GROUP_IDENTIFIERS[i]) {
|
||||
return static_cast<openspace::globebrowsing::layergroupid::GroupID>(i);
|
||||
}
|
||||
}
|
||||
return openspace::globebrowsing::layergroupid::GroupID::Unknown;
|
||||
}
|
||||
|
||||
template <>
|
||||
openspace::globebrowsing::layergroupid::AdjustmentTypeID from_string(
|
||||
const std::string& string);
|
||||
constexpr openspace::globebrowsing::layergroupid::AdjustmentTypeID from_string(
|
||||
std::string_view string)
|
||||
{
|
||||
for (int i = 0; i < openspace::globebrowsing::layergroupid::NUM_ADJUSTMENT_TYPES; ++i) {
|
||||
if (string == openspace::globebrowsing::layergroupid::ADJUSTMENT_TYPE_NAMES[i]) {
|
||||
return static_cast<openspace::globebrowsing::layergroupid::AdjustmentTypeID>(i);
|
||||
}
|
||||
}
|
||||
return openspace::globebrowsing::layergroupid::AdjustmentTypeID::None;
|
||||
}
|
||||
|
||||
template <>
|
||||
openspace::globebrowsing::layergroupid::BlendModeID from_string(
|
||||
const std::string& string);
|
||||
constexpr openspace::globebrowsing::layergroupid::BlendModeID from_string(
|
||||
std::string_view string)
|
||||
{
|
||||
for (int i = 0; i < openspace::globebrowsing::layergroupid::NUM_BLEND_MODES; ++i) {
|
||||
if (string == openspace::globebrowsing::layergroupid::BLEND_MODE_NAMES[i]) {
|
||||
return static_cast<openspace::globebrowsing::layergroupid::BlendModeID>(i);
|
||||
}
|
||||
}
|
||||
return openspace::globebrowsing::layergroupid::BlendModeID::Normal;
|
||||
}
|
||||
|
||||
} // ghoul
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
|
||||
namespace ghoul {
|
||||
template <>
|
||||
openspace::globebrowsing::tileprovider::TemporalTileProvider::TimeFormatType
|
||||
from_string(const std::string& string)
|
||||
constexpr openspace::globebrowsing::tileprovider::TemporalTileProvider::TimeFormatType
|
||||
from_string(std::string_view string)
|
||||
{
|
||||
using namespace openspace::globebrowsing::tileprovider;
|
||||
if (string == "YYYY-MM-DD") {
|
||||
@@ -66,7 +66,7 @@ namespace ghoul {
|
||||
return TemporalTileProvider::TimeFormatType::YYYYMMDD_hhmm;
|
||||
}
|
||||
else {
|
||||
throw ghoul::RuntimeError("Unknown timeformat " + string);
|
||||
throw ghoul::RuntimeError("Unknown timeformat '" + std::string(string) + "'");
|
||||
}
|
||||
}
|
||||
} // namespace ghoul
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <modules/multiresvolume/rendering/localerrorhistogrammanager.h>
|
||||
#include <openspace/rendering/transferfunction.h>
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace {
|
||||
bool compareSplitPoints(const openspace::BrickSelection& a,
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <openspace/rendering/transferfunction.h>
|
||||
#include <openspace/util/histogram.h>
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace {
|
||||
bool compareSplitPoints(const openspace::BrickSelection& a,
|
||||
|
||||
@@ -337,23 +337,21 @@ glm::vec2 DashboardItemInstruments::size() const {
|
||||
|
||||
size = addToBoundingbox(
|
||||
size,
|
||||
renderer.boundingBox(*_font, "Next instrument activity:").boundingBox
|
||||
_font->boundingBox("Next instrument activity:")
|
||||
);
|
||||
|
||||
size = addToBoundingbox(
|
||||
size,
|
||||
renderer.boundingBox(
|
||||
*_font,
|
||||
_font->boundingBox(
|
||||
fmt::format("{:.0f} s {:s} {:.1f} %", remaining, progress, t * 100.f)
|
||||
).boundingBox
|
||||
)
|
||||
);
|
||||
|
||||
size = addToBoundingbox(
|
||||
size,
|
||||
renderer.boundingBox(
|
||||
*_font,
|
||||
_font->boundingBox(
|
||||
fmt::format("Data acquisition time: {}", str)
|
||||
).boundingBox
|
||||
)
|
||||
);
|
||||
}
|
||||
std::pair<double, std::string> nextTarget = sequencer.nextTarget(currentTime);
|
||||
@@ -363,9 +361,6 @@ glm::vec2 DashboardItemInstruments::size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
using FR = ghoul::fontrendering::FontRenderer;
|
||||
FR& renderer = FR::defaultRenderer();
|
||||
|
||||
const int timeleft = static_cast<int>(nextTarget.first - currentTime);
|
||||
|
||||
const int hour = timeleft / 3600;
|
||||
@@ -393,20 +388,16 @@ glm::vec2 DashboardItemInstruments::size() const {
|
||||
|
||||
size = addToBoundingbox(
|
||||
size,
|
||||
renderer.boundingBox(
|
||||
*_font,
|
||||
_font->boundingBox(
|
||||
fmt::format("Data acquisition adjacency: [{}:{}:{}]", hh, mm, ss)
|
||||
).boundingBox
|
||||
)
|
||||
);
|
||||
|
||||
size.y += _font->height();
|
||||
|
||||
size = addToBoundingbox(
|
||||
size,
|
||||
ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
|
||||
*_font,
|
||||
"Active Instruments:"
|
||||
).boundingBox
|
||||
_font->boundingBox("Active Instruments:")
|
||||
);
|
||||
return size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user