mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Move loading of data error handling
This commit is contained in:
@@ -81,7 +81,7 @@ RenderableConstellationBounds::RenderableConstellationBounds(
|
||||
|
||||
// Avoid reading files here, instead do it in multithreaded initialize()
|
||||
_vertexFilename = absPath(p.file.string()).string();
|
||||
_vertexFilename.onChange([&](){ loadVertexFile(); });
|
||||
_vertexFilename.onChange([&](){ loadData(); });
|
||||
addProperty(_vertexFilename);
|
||||
|
||||
_color.setViewOption(properties::Property::ViewOptions::Color);
|
||||
@@ -92,7 +92,7 @@ RenderableConstellationBounds::RenderableConstellationBounds(
|
||||
void RenderableConstellationBounds::initialize() {
|
||||
RenderableConstellationsBase::initialize();
|
||||
|
||||
loadVertexFile();
|
||||
loadData();
|
||||
|
||||
if (!_assetSelection.empty()) {
|
||||
const std::vector<std::string> options = _selection.options();
|
||||
@@ -198,6 +198,14 @@ void RenderableConstellationBounds::render(const RenderData& data, RendererTasks
|
||||
|
||||
void RenderableConstellationBounds::update(const UpdateData& data) { }
|
||||
|
||||
bool RenderableConstellationBounds::loadData() {
|
||||
bool success = loadVertexFile();
|
||||
if (!success) {
|
||||
throw ghoul::RuntimeError("Error loading data");
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bool RenderableConstellationBounds::loadVertexFile() {
|
||||
if (_vertexFilename.value().empty()) {
|
||||
return false;
|
||||
|
||||
@@ -75,6 +75,7 @@ private:
|
||||
* \return \c true if the loading succeeded, \c false otherwise
|
||||
*/
|
||||
bool loadVertexFile();
|
||||
bool loadData();
|
||||
|
||||
/**
|
||||
* Callback method that gets triggered when <code>_constellationSelection</code>
|
||||
|
||||
@@ -101,6 +101,7 @@ RenderableConstellationLines::RenderableConstellationLines(
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
_speckFile = absPath(p.file);
|
||||
|
||||
addProperty(_drawElements);
|
||||
|
||||
if (p.lineUnit.has_value()) {
|
||||
@@ -150,10 +151,7 @@ bool RenderableConstellationLines::isReady() const {
|
||||
void RenderableConstellationLines::initialize() {
|
||||
RenderableConstellationsBase::initialize();
|
||||
|
||||
bool success = loadData();
|
||||
if (!success) {
|
||||
throw ghoul::RuntimeError("Error loading data");
|
||||
}
|
||||
loadData();
|
||||
|
||||
if (!_assetSelection.empty()) {
|
||||
const std::vector<std::string> options = _selection.options();
|
||||
@@ -268,7 +266,11 @@ void RenderableConstellationLines::update(const UpdateData&) {
|
||||
}
|
||||
|
||||
bool RenderableConstellationLines::loadData() {
|
||||
return readSpeckFile();
|
||||
bool success = readSpeckFile();
|
||||
if (!success) {
|
||||
throw ghoul::RuntimeError("Error loading data");
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bool RenderableConstellationLines::readSpeckFile() {
|
||||
|
||||
Reference in New Issue
Block a user