Commit 9fcdd9f9 authored by Emil Axelsson's avatar Emil Axelsson
Browse files

Merge branch 'master' of github.com:OpenSpace/OpenSpace into feature/domecasting

parents 848a6503 51b420f2
Showing with 134 additions and 66 deletions
+134 -66
Subproject commit c37ff8beb5b8825ecb67b121ae4deac34677e1bd
Subproject commit 200401261cba513fb1faa4b7e92bd213435625ad
......@@ -111,7 +111,7 @@ void DebugRenderer::renderVertices(const Vertices& clippingSpacePoints, GLenum m
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(clippingSpacePoints[0]), 0);
// Draw the vertices
glDrawArrays(mode, 0, clippingSpacePoints.size());
glDrawArrays(mode, 0, static_cast<GLsizei>(clippingSpacePoints.size()));
// Check for errors
GLenum error = glGetError();
......
......@@ -347,7 +347,7 @@ void RenderableModelProjection::attitudeParameters(double time) {
try {
_instrumentMatrix = SpiceManager::ref().positionTransformMatrix(_projectionComponent.instrumentId(), _destination, time);
}
catch (const SpiceManager::SpiceException& e) {
catch (const SpiceManager::SpiceException&) {
return;
}
......
......@@ -34,8 +34,6 @@
namespace {
const std::string _loggerCat = "RenderablePlane";
const char* KeyType = "TerminatorType";
const char* KeyLightSource = "LightSource";
const char* KeyObserver = "Observer";
......@@ -50,7 +48,7 @@ namespace openspace {
RenderableShadowCylinder::RenderableShadowCylinder(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _numberOfPoints("amountOfPoints", "Points", 190, 1, 300)
, _shadowLength("shadowLength", "Shadow Length", 0.1, 0.0, 0.5)
, _shadowLength("shadowLength", "Shadow Length", 0.1f, 0.0f, 0.5f)
, _shadowColor("shadowColor", "Shadow Color",
glm::vec4(1.f, 1.f, 1.f, 0.25f), glm::vec4(0.f), glm::vec4(1.f))
, _shader(nullptr)
......
......@@ -333,7 +333,9 @@ bool ImageSequencer::getImagePaths(std::vector<Image>& captures,
}
if (beforeDist < 1.0 || nextDist < 1.0) {
toDelete.push_back(std::distance(captures.begin(), it));
toDelete.push_back(
static_cast<int>(std::distance(captures.begin(), it))
);
}
}
}
......@@ -341,7 +343,7 @@ bool ImageSequencer::getImagePaths(std::vector<Image>& captures,
for (size_t i = 0; i < toDelete.size(); ++i) {
// We have to subtract i here as we already have deleted i value
// before this and we need to adjust the location
int v = toDelete[i] - i;
int v = toDelete[i] - static_cast<int>(i);
captures.erase(captures.begin() + v);
}
......
......@@ -27,6 +27,7 @@
#include <ghoul/misc/assert.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/dictionary.h>
namespace {
const std::string _loggerCat = "InstrumentDecoder";
const char* keyDetector = "DetectorType";
......@@ -40,11 +41,15 @@ InstrumentDecoder::InstrumentDecoder(const ghoul::Dictionary& dictionary)
{
bool success = dictionary.getValue(keyDetector, _type);
ghoul_assert(success, "Instrument has not provided detector type");
for_each(_type.begin(), _type.end(), [](char& in){ in = ::toupper(in); });
std::for_each(
_type.begin(),
_type.end(),
[](char& in){ in = static_cast<char>(toupper(in)); }
);
if (!dictionary.hasKeyAndValue<std::string>(keyStopCommand) && _type == "SCANNER"){
LWARNING("Scanner must provide stop command, please check mod file.");
}else{
} else {
dictionary.getValue(keyStopCommand, _stopCommand);
}
......
......@@ -35,6 +35,7 @@ public:
virtual std::string getDecoderType();
virtual std::vector<std::string> getTranslation();
std::string getStopCommand();
private:
std::string _type;
std::string _stopCommand;
......
......@@ -196,8 +196,8 @@ void ProjectionComponent::initialize(const ghoul::Dictionary& dictionary) {
_instrumentID = dictionary.value<std::string>(keyInstrument);
_projectorID = dictionary.value<std::string>(keyProjObserver);
_projecteeID = dictionary.value<std::string>(keyProjTarget);
_fovy = dictionary.value<double>(keyInstrumentFovy);
_aspectRatio = dictionary.value<double>(keyInstrumentAspect);
_fovy = static_cast<float>(dictionary.value<double>(keyInstrumentFovy));
_aspectRatio = static_cast<float>(dictionary.value<double>(keyInstrumentAspect));
_aberration = SpiceManager::AberrationCorrection(
dictionary.value<std::string>(keyProjAberration)
......
......@@ -602,7 +602,7 @@ void GUI::renderAndUpdatePropertyVisibility() {
// Array is sorted by importance
std::array<const char*, 4> items = { "None", "User", "Developer", "All"};
ImGui::Combo("PropertyVisibility", &t, items.data(), items.size());
ImGui::Combo("PropertyVisibility", &t, items.data(), static_cast<int>(items.size()));
_currentVisibility = static_cast<V>(t);
_globalProperty.setVisibility(_currentVisibility);
......
......@@ -39,7 +39,6 @@
namespace {
using json = nlohmann::json;
const std::string _loggerCat = "iSWAComponent";
const ImVec2 size = ImVec2(350, 500);
}
namespace openspace {
......
......@@ -89,9 +89,9 @@ void GuiPerformanceComponent::render() {
}
if (_sceneGraphIsEnabled) {
bool v = _sceneGraphIsEnabled;
ImGui::Begin("SceneGraph", &v);
_sceneGraphIsEnabled = v;
bool sge = _sceneGraphIsEnabled;
ImGui::Begin("SceneGraph", &sge);
_sceneGraphIsEnabled = sge;
// The indices correspond to the index into the average array further below
ImGui::Text("Sorting");
......@@ -399,9 +399,9 @@ void GuiPerformanceComponent::render() {
}
if (_functionsIsEnabled) {
bool v = _functionsIsEnabled;
ImGui::Begin("Functions", &v);
_functionsIsEnabled = v;
bool fe = _functionsIsEnabled;
ImGui::Begin("Functions", &fe);
_functionsIsEnabled = fe;
using namespace performance;
for (int i = 0; i < layout->nFunctionEntries; ++i) {
......@@ -422,9 +422,6 @@ void GuiPerformanceComponent::render() {
std::end(layout->functionEntries[i].time)
);
const PerformanceLayout::FunctionPerformanceLayout& f =
layout->functionEntries[i];
std::string renderTime = std::to_string(
entry.time[PerformanceLayout::NumberValues - 1]
) + "us";
......
......@@ -42,18 +42,18 @@ namespace {
int nVisibleProperties(const std::vector<properties::Property*>& properties,
properties::Property::Visibility visibility)
{
return std::count_if(
return static_cast<int>(std::count_if(
properties.begin(),
properties.end(),
[visibility](properties::Property* p) {
using V = properties::Property::Visibility;
return
static_cast<std::underlying_type_t<V>>(visibility) >=
static_cast<std::underlying_type_t<V>>(p->visibility());
}
);
}
using V = properties::Property::Visibility;
return
static_cast<std::underlying_type_t<V>>(visibility) >=
static_cast<std::underlying_type_t<V>>(p->visibility());
}
));
}
} // namespace
namespace gui {
......
......@@ -172,9 +172,9 @@ void renderDoubleProperty(properties::Property* prop, const std::string& ownerNa
std::string name = p->guiName();
ImGui::PushID((ownerName + "." + name).c_str());
float value = *p;
float min = p->minValue();
float max = p->maxValue();
float value = static_cast<float>(*p);
float min = static_cast<float>(p->minValue());
float max = static_cast<float>(p->maxValue());
ImGui::SliderFloat(name.c_str(), &value, min, max, "%.5f");
renderTooltip(prop);
......@@ -211,8 +211,8 @@ void renderIVec2Property(Property* prop, const std::string& ownerName) {
ImGui::PushID((ownerName + "." + name).c_str());
IVec2Property::ValueType value = *p;
float min = std::min(p->minValue().x, p->minValue().y);
float max = std::max(p->maxValue().x, p->maxValue().y);
int min = std::min(p->minValue().x, p->minValue().y);
int max = std::max(p->maxValue().x, p->maxValue().y);
ImGui::SliderInt2(
name.c_str(),
&value.x,
......@@ -237,8 +237,8 @@ void renderIVec3Property(Property* prop, const std::string& ownerName) {
ImGui::PushID((ownerName + "." + name).c_str());
IVec3Property::ValueType value = *p;
float min = std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z);
float max = std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z);
int min = std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z);
int max = std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z);
ImGui::SliderInt3(
name.c_str(),
......@@ -264,10 +264,10 @@ void renderIVec4Property(Property* prop, const std::string& ownerName) {
ImGui::PushID((ownerName + "." + name).c_str());
IVec4Property::ValueType value = *p;
float min = std::min(std::min(std::min(
int min = std::min(std::min(std::min(
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w
);
float max = std::max(std::max(std::max(
int max = std::max(std::max(std::max(
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w
);
......@@ -406,8 +406,8 @@ void renderDVec2Property(Property* prop, const std::string& ownerName) {
ImGui::PushID((ownerName + "." + name).c_str());
glm::vec2 value = glm::dvec2(*p);
float min = std::min(p->minValue().x, p->minValue().y);
float max = std::max(p->maxValue().x, p->maxValue().y);
float min = static_cast<float>(std::min(p->minValue().x, p->minValue().y));
float max = static_cast<float>(std::max(p->maxValue().x, p->maxValue().y));
ImGui::SliderFloat2(
name.c_str(),
&value.x,
......@@ -433,8 +433,12 @@ void renderDVec3Property(Property* prop, const std::string& ownerName) {
ImGui::PushID((ownerName + "." + name).c_str());
glm::vec3 value = glm::dvec3(*p);
float min = std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z);
float max = std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z);
float min = static_cast<float>(
std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z)
);
float max = static_cast<float>(
std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z)
);
bool changed = ImGui::SliderFloat3(
name.c_str(),
......@@ -463,10 +467,16 @@ void renderDVec4Property(Property* prop, const std::string& ownerName) {
ImGui::PushID((ownerName + "." + name).c_str());
glm::vec4 value = glm::dvec4(*p);
float min = std::min(std::min(std::min(
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w);
float max = std::max(std::max(std::max(
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w);
float min = static_cast<float>(
std::min(std::min(std::min(
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w
)
);
float max = static_cast<float>(
std::max(std::max(std::max(
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w
)
);
ImGui::SliderFloat4(
name.c_str(),
......
......@@ -64,7 +64,7 @@ void MissionManager::loadMission(const std::string& filename) {
ghoul_assert(FileSys.fileExists(filename), "filename must exist");
// Changing the values might invalidate the _currentMission iterator
std::string currentMission = _currentMission != _missionMap.end() ? _currentMission->first : "";
std::string currentMission = hasCurrentMission() ? _currentMission->first : "";
Mission mission = missionFromFile(filename);
std::string missionName = mission.name();
......
......@@ -78,14 +78,14 @@ int unloadKernel(lua_State* L) {
if (isString) {
std::string argument = lua_tostring(L, -1);
SpiceManager::ref().unloadKernel(argument);
return 0;
}
if (isNumber) {
unsigned int argument = static_cast<unsigned int>(lua_tonumber(L, -1));
SpiceManager::ref().unloadKernel(argument);
return 0;
}
return 0;
}
} // luascriptfunctions
......
......@@ -78,8 +78,9 @@ Time Time::now() {
Time now;
time_t secondsSince1970;
secondsSince1970 = time(nullptr);
time_t secondsInAYear = 365.25 * 24 * 60 * 60;
double secondsSince2000 = (double)(secondsSince1970 - 30*secondsInAYear);
const time_t secondsInAYear = static_cast<time_t>(365.25 * 24 * 60 * 60);
double secondsSince2000 = (double)(secondsSince1970 - 30 * secondsInAYear);
now.setTime(secondsSince2000);
return now;
}
......
......@@ -26,7 +26,9 @@
// When running the unit tests we don't want to be asked what to do in the case of an
// assertion
#ifndef GHL_THROW_ON_ASSERT
#define GHL_THROW_ON_ASSERT
#endif // GHL_THROW_ON_ASSERTGHL_THROW_ON_ASSERT
#include <ghoul/cmdparser/cmdparser>
#include <ghoul/filesystem/filesystem>
......
......@@ -151,7 +151,4 @@ TEST_F(ConcurrentJobManagerTest, JobCreation) {
{
auto product = finishedJob->product();
}
int a;
}
......@@ -46,11 +46,12 @@ protected:
#define TYPLEN 32
#define SRCLEN 128
const int nrMetaKernels = 9;
SpiceInt which, handle, count = 0;
char file[FILLEN], filtyp[TYPLEN], source[SRCLEN];
double abs_error = 0.00001;
namespace spicemanager_constants {
const int nrMetaKernels = 9;
SpiceInt which, handle, count = 0;
char file[FILLEN], filtyp[TYPLEN], source[SRCLEN];
double abs_error = 0.00001;
} // namespace spicemanager_constants
// In this testclass only a handset of the testfunctions require a single kernel.
// The remaining methods rely on multiple kernels, loaded as a SPICE 'meta-kernel'.
......@@ -132,7 +133,18 @@ TEST_F(SpiceManagerTest, loadSingleKernel) {
loadLSKKernel();
// naif0008.tls is a text file, check if loaded.
SpiceBoolean found;
kdata_c(0, "text", FILLEN, TYPLEN, SRCLEN, file, filtyp, source, &handle, &found);
kdata_c(
0,
"text",
FILLEN,
TYPLEN,
SRCLEN,
spicemanager_constants::file,
spicemanager_constants::filtyp,
spicemanager_constants::source,
&spicemanager_constants::handle,
&found
);
ASSERT_TRUE(found == SPICETRUE) << "Kernel not loaded";
}
......@@ -142,14 +154,36 @@ TEST_F(SpiceManagerTest, unloadKernelString) {
loadLSKKernel();
// naif0008.tls is a text file, check if loaded.
SpiceBoolean found;
kdata_c(0, "text", FILLEN, TYPLEN, SRCLEN, file, filtyp, source, &handle, &found);
kdata_c(
0,
"text",
FILLEN,
TYPLEN,
SRCLEN,
spicemanager_constants::file,
spicemanager_constants::filtyp,
spicemanager_constants::source,
&spicemanager_constants::handle,
&found
);
ASSERT_TRUE(found == SPICETRUE);
// unload using string keyword
openspace::SpiceManager::ref().unloadKernel(LSK);
found = SPICEFALSE;
kdata_c(0, "text", FILLEN, TYPLEN, SRCLEN, file, filtyp, source, &handle, &found);
kdata_c(
0,
"text",
FILLEN,
TYPLEN,
SRCLEN,
spicemanager_constants::file,
spicemanager_constants::filtyp,
spicemanager_constants::source,
&spicemanager_constants::handle,
&found
);
EXPECT_FALSE(found == SPICETRUE);
}
......@@ -158,14 +192,36 @@ TEST_F(SpiceManagerTest, unloadKernelInteger) {
int kernelID = loadLSKKernel();
// naif0008.tls is a text file, check if loaded.
SpiceBoolean found;
kdata_c(0, "text", FILLEN, TYPLEN, SRCLEN, file, filtyp, source, &handle, &found);
kdata_c(
0,
"text",
FILLEN,
TYPLEN,
SRCLEN,
spicemanager_constants::file,
spicemanager_constants::filtyp,
spicemanager_constants::source,
&spicemanager_constants::handle,
&found
);
ASSERT_TRUE(found == SPICETRUE);
// unload using unique int ID
openspace::SpiceManager::ref().unloadKernel(kernelID);
found = SPICEFALSE;
kdata_c(0, "text", FILLEN, TYPLEN, SRCLEN, file, filtyp, source, &handle, &found);
kdata_c(
0,
"text",
FILLEN,
TYPLEN,
SRCLEN,
spicemanager_constants::file,
spicemanager_constants::filtyp,
spicemanager_constants::source,
&spicemanager_constants::handle,
&found
);
EXPECT_FALSE(found == SPICETRUE) << "One or more kernels still present in kernel-pool";
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment