mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 12:39:24 -05:00
Update Ghoul and SGCT
Adapt to changes by using more string_view
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user