diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 0d834206aa..ae92241bf0 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -92,6 +92,7 @@ public: private: OpenSpaceEngine(std::string programName); ~OpenSpaceEngine(); + OpenSpaceEngine(const OpenSpaceEngine& rhs) = delete; void clearAllWindows(); bool gatherCommandlineArguments(); diff --git a/include/openspace/interface/interface.h b/include/openspace/interface/interface.h deleted file mode 100644 index f41e6b104a..0000000000 --- a/include/openspace/interface/interface.h +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2015 * - * * - * 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. * - ****************************************************************************************/ - -#ifndef INTERFACE_H_ -#define INTERFACE_H_ -#include - -#include -#include -#include - -namespace openspace { -class Interface { - struct Node { - std::string _key; - std::string _value; - std::vector _children; - Node(std::string key, std::string value) { - _key = key; - _value = value; - _children = std::vector(); - } - Node(std::string key) { - _key = key; - _value = ""; - _children = std::vector(); - } - - inline bool operator==(const Node& rhs){ - return (strcmp(_key.c_str(), rhs._key.c_str()) == 0); - } - inline bool operator==(const std::string& rhs){ - return (strcmp(_key.c_str(), rhs.c_str()) == 0); - } - }; - -public: - Interface(OpenSpaceEngine* engine); - ~Interface(); - - void callback(const char * receivedChars); - -private: - - void handleNodes(); - void loadIntoNodes(const boost::property_tree::ptree& tree, std::string parent = "", const int depth = 0); - - // OpenSpaceEngine* _engine; - std::vector _nodes; -}; - -} // namespace openspace - -#endif /* INTERFACE_H_ */ diff --git a/include/openspace/properties/numericalproperty.inl b/include/openspace/properties/numericalproperty.inl index bdd3ae03fe..e1bd5b77e1 100644 --- a/include/openspace/properties/numericalproperty.inl +++ b/include/openspace/properties/numericalproperty.inl @@ -208,7 +208,7 @@ std::string NumericalProperty::className() const { template bool NumericalProperty::setLua(lua_State* state) { - bool success; + bool success = false; T value = PropertyDelegate>::template fromLuaValue(state, success); if (success) TemplateProperty::setValue(value); diff --git a/include/openspace/properties/templateproperty.inl b/include/openspace/properties/templateproperty.inl index f898292b86..2b57f5b099 100644 --- a/include/openspace/properties/templateproperty.inl +++ b/include/openspace/properties/templateproperty.inl @@ -192,7 +192,7 @@ const std::type_info& TemplateProperty::type() const { template bool TemplateProperty::setLua(lua_State* state) { - bool success; + bool success = false; T thisValue = PropertyDelegate>::template fromLuaValue(state, success); if (success) set(boost::any(thisValue)); diff --git a/include/openspace/util/imagesequencer.h b/include/openspace/util/imagesequencer.h index 723d28f902..44dc42a636 100644 --- a/include/openspace/util/imagesequencer.h +++ b/include/openspace/util/imagesequencer.h @@ -36,8 +36,10 @@ namespace openspace { class ImageSequencer { public: + ImageSequencer(); + static ImageSequencer& ref(); - bool loadSequence(const std::string dir); + bool loadSequence(const std::string& dir); bool parsePlaybook(const std::string& dir, const std::string& type, std::string year = "2015"); bool parsePlaybookFile(const std::string& fileName, std::string year = "2015"); diff --git a/include/openspace/util/spicemanager.h b/include/openspace/util/spicemanager.h index 1f4784da50..5e9a050f2d 100644 --- a/include/openspace/util/spicemanager.h +++ b/include/openspace/util/spicemanager.h @@ -219,7 +219,7 @@ public: std::vector& v) const; - bool spacecraftClockToET(const std::string craftIdCode, double& craftTicks, double& et); + bool spacecraftClockToET(const std::string& craftIdCode, double& craftTicks, double& et); /** * Converts the timeString representing a date to a double precision @@ -261,7 +261,7 @@ public: * \param to The frame to be converted to * \param ephemerisTime Time at which to get rotational matrix that transforms vector */ - void frameConversion(glm::dvec3& v, const std::string from, const std::string to, double ephemerisTime) const; + void frameConversion(glm::dvec3& v, const std::string& from, const std::string& to, double ephemerisTime) const; /** * Finds the projection of one vector onto another vector. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4dcd2ba88d..6976e276c2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -128,13 +128,6 @@ file(GLOB FLARE_HEADER ${HEADER_ROOT_DIR}/openspace/flare/*.h) set(OPENSPACE_HEADER ${OPENSPACE_HEADER} ${FLARE_HEADER}) source_group(Flare FILES ${FLARE_SOURCE} ${FLARE_HEADER}) -file(GLOB INTERFACE_SOURCE ${SOURCE_ROOT_DIR}/interface/*.cpp) -set(OPENSPACE_SOURCE ${OPENSPACE_SOURCE} ${INTERFACE_SOURCE}) -file(GLOB INTERFACE_HEADER ${HEADER_ROOT_DIR}/openspace/interface/*.h) -set(OPENSPACE_HEADER ${OPENSPACE_HEADER} ${INTERFACE_HEADER}) -source_group(Interface FILES ${INTERFACE_SOURCE} ${INTERFACE_HEADER}) - - include_directories(${HEADER_ROOT_DIR}) include_directories(${GHOUL_ROOT_DIR}/ext/boost) diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 429c6c2112..067dfaff12 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -155,7 +155,6 @@ bool OpenSpaceEngine::create(int argc, char** argv, return false; // Parse commandline arguments - std::vector remainingArguments; _engine->_commandlineParser->setCommandLine(argc, argv, &sgctArguments); const bool executeSuccess = _engine->_commandlineParser->execute(); if (!executeSuccess) diff --git a/src/interaction/interactionhandler.cpp b/src/interaction/interactionhandler.cpp index c649c179d0..11a3131491 100644 --- a/src/interaction/interactionhandler.cpp +++ b/src/interaction/interactionhandler.cpp @@ -193,7 +193,7 @@ namespace luascriptfunctions { */ int setOrigin(lua_State* L) { using ghoul::lua::luaTypeToString; - const std::string _loggerCat = "LuaInteractionHandler"; + const std::string _loggerCat = "lua.setOrigin"; int nArguments = lua_gettop(L); if (nArguments != 1) @@ -223,7 +223,7 @@ int setOrigin(lua_State* L) { */ int bindKey(lua_State* L) { using ghoul::lua::luaTypeToString; - const std::string _loggerCat = "LuaInteractionHandler"; + const std::string _loggerCat = "lua.bindKey"; int nArguments = lua_gettop(L); if (nArguments != 2) @@ -256,7 +256,7 @@ int bindKey(lua_State* L) { */ int clearKeys(lua_State* L) { using ghoul::lua::luaTypeToString; - const std::string _loggerCat = "LuaInteractionHandler"; + const std::string _loggerCat = "lua.clearKeys"; int nArguments = lua_gettop(L); if (nArguments != 0) @@ -438,6 +438,8 @@ namespace interaction { InteractionHandler::InteractionHandler() : _camera(nullptr) , _focusNode(nullptr) + , _deltaTime(0.0) + , _validKeyLua(false) , _controllerSensitivity(10.f) , _invertRoll(false) , _invertRotation(false) diff --git a/src/interaction/keyboardcontroller.cpp b/src/interaction/keyboardcontroller.cpp index fcb8be764d..213392f5df 100644 --- a/src/interaction/keyboardcontroller.cpp +++ b/src/interaction/keyboardcontroller.cpp @@ -43,9 +43,9 @@ namespace interaction { void KeyboardControllerFixed::keyPressed(KeyAction action, Key key, KeyModifier modifier) { // TODO package in script - const float speed = 2.75; const float dt = static_cast( _handler->deltaTime()); if(action == KeyAction::Press|| action == KeyAction::Repeat) { + const float speed = 2.75; if (key == Key::S) { glm::vec3 euler(speed * dt, 0.0, 0.0); glm::quat rot = glm::quat(euler); diff --git a/src/interface/interface.cpp b/src/interface/interface.cpp deleted file mode 100644 index d167734326..0000000000 --- a/src/interface/interface.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2015 * - * * - * 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 -/* -#include - -#include -#include - -#include -*/ -namespace openspace { - -Interface::Interface(OpenSpaceEngine* ) {} -Interface::~Interface() {} - -void Interface::callback(const char* receivedChars) { -/* - std::cout << receivedChars; - - boost::property_tree::ptree pt; - std::stringstream input(receivedChars); - boost::property_tree::json_parser::read_json(input, pt); - _nodes = std::vector(); - - loadIntoNodes(pt); - handleNodes(); // Issue commands - _nodes.clear(); // Clean up after commands are issued - */ -} - -void Interface::handleNodes() { -/* - for (int i = 0; i < _nodes.size(); ++i) { - Node node = _nodes.at(i); - if (node == "stats") { - sgct::Engine::instance()->setDisplayInfoVisibility(atoi(node._value.c_str())); - } else if (node == "graph") { - sgct::Engine::instance()->setStatsGraphVisibility(atoi(node._value.c_str())); - } - } - */ -} - -// http://duck-wrath.blogspot.com/2012/02/how-to-recursive-parse.html -void Interface::loadIntoNodes(const boost::property_tree::ptree& tree, std::string parent, const int depth) { -/* - BOOST_FOREACH( boost::property_tree::ptree::value_type const&v, tree.get_child("") ) { - boost::property_tree::ptree subtree = v.second; - std::string value = v.second.data(); - std::string key = v.first; - - // classify and store nodes - if ( key.length() > 0 ) { // value - _nodes.push_back(Node(key, value)); - } else { // array - // Find parent and add to its children vector - std::vector::iterator it = std::find(_nodes.begin(), _nodes.end(), Node(parent)); - if (it != _nodes.end()) { - (*it)._children.push_back(Node(parent, value)); - } else { - std::cout << "Parent not found" << std::endl; - } - } - - // recursive go down the hierarchy - loadIntoNodes(subtree,key,depth+1); - } -*/ -} - -} // namespace openspace - diff --git a/src/util/imagesequencer.cpp b/src/util/imagesequencer.cpp index bc721ffa39..f2e2da91e1 100644 --- a/src/util/imagesequencer.cpp +++ b/src/util/imagesequencer.cpp @@ -58,24 +58,27 @@ auto cmp = [](const ImageParams &a, const ImageParams &b)->bool{ std::vector _timeStamps; +ImageSequencer::ImageSequencer() + : _nextCapture(0.0) + , _defaultCaptureImage(absPath("${OPENSPACE_DATA}/scene/common/textures/placeholder.png")) +{} + + ImageSequencer& ImageSequencer::ref() { assert(_sequencer != nullptr); return *_sequencer; } -void ImageSequencer::initialize(){ +void ImageSequencer::initialize() { assert(_sequencer == nullptr); _sequencer = new ImageSequencer; - - _sequencer->_nextCapture = 0.0; - _sequencer->_defaultCaptureImage = absPath("${OPENSPACE_DATA}/scene/common/textures/placeholder.png"); } -void ImageSequencer::deinitialize(){ +void ImageSequencer::deinitialize() { delete _sequencer; _sequencer = nullptr; } -void ImageSequencer::createImage(double t1, double t2, std::string instrument, std::string path){ +void ImageSequencer::createImage(double t1, double t2, std::string instrument, std::string path) { // insert ImageParams image; image.startTime = t1; @@ -318,7 +321,7 @@ bool ImageSequencer::parsePlaybookFile(const std::string& fileName, std::string return true; } -bool ImageSequencer::loadSequence(const std::string dir){ +bool ImageSequencer::loadSequence(const std::string& dir) { ghoul::filesystem::Directory sequenceDir(dir, true); std::vector sequencePaths = sequenceDir.read(true, false); // check inputs for (auto path : sequencePaths){ diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index acdd4213d1..86d04d3784 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -239,7 +239,7 @@ bool SpiceManager::getValue(const std::string& body, const std::string& value, return !hasError; } -bool SpiceManager::spacecraftClockToET(const std::string craftIdCode, double& craftTicks, double& et){ +bool SpiceManager::spacecraftClockToET(const std::string& craftIdCode, double& craftTicks, double& et){ int craftID; getNaifId(craftIdCode, craftID); sct2e_c(craftID, craftTicks, &et); @@ -321,7 +321,7 @@ bool SpiceManager::getTargetPosition(const std::string& target, } // do NOT remove this method. -void SpiceManager::frameConversion(glm::dvec3& v, const std::string from, const std::string to, double ephemerisTime) const{ +void SpiceManager::frameConversion(glm::dvec3& v, const std::string& from, const std::string& to, double ephemerisTime) const{ glm::dmat3 transform; // get rotation matrix from frame A - frame B pxform_c(from.c_str(), to.c_str(), ephemerisTime, (double(*)[3])glm::value_ptr(transform));