Removed cppcheck warnings

Removed unused Interface file
This commit is contained in:
Alexander Bock
2015-02-23 19:08:15 +01:00
parent ec9010a6e9
commit fb2c99b5ed
13 changed files with 26 additions and 196 deletions

View File

@@ -92,6 +92,7 @@ public:
private:
OpenSpaceEngine(std::string programName);
~OpenSpaceEngine();
OpenSpaceEngine(const OpenSpaceEngine& rhs) = delete;
void clearAllWindows();
bool gatherCommandlineArguments();

View File

@@ -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 <openspace/engine/openspaceengine.h>
#include <boost/property_tree/ptree.hpp>
#include <openspace/engine/openspaceengine.h>
#include <vector>
namespace openspace {
class Interface {
struct Node {
std::string _key;
std::string _value;
std::vector<Node> _children;
Node(std::string key, std::string value) {
_key = key;
_value = value;
_children = std::vector<Node>();
}
Node(std::string key) {
_key = key;
_value = "";
_children = std::vector<Node>();
}
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<Node> _nodes;
};
} // namespace openspace
#endif /* INTERFACE_H_ */

View File

@@ -208,7 +208,7 @@ std::string NumericalProperty<T>::className() const {
template <typename T>
bool NumericalProperty<T>::setLua(lua_State* state)
{
bool success;
bool success = false;
T value = PropertyDelegate<NumericalProperty<T>>::template fromLuaValue<T>(state, success);
if (success)
TemplateProperty<T>::setValue(value);

View File

@@ -192,7 +192,7 @@ const std::type_info& TemplateProperty<T>::type() const {
template <typename T>
bool TemplateProperty<T>::setLua(lua_State* state)
{
bool success;
bool success = false;
T thisValue = PropertyDelegate<TemplateProperty<T>>::template fromLuaValue<T>(state, success);
if (success)
set(boost::any(thisValue));

View File

@@ -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");

View File

@@ -219,7 +219,7 @@ public:
std::vector<double>& v) const;
bool spacecraftClockToET(const std::string craftIdCode, double& craftTicks, double& et);
bool spacecraftClockToET(const std::string& craftIdCode, double& craftTicks, double& et);
/**
* Converts the <code>timeString</code> 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.

View File

@@ -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)

View File

@@ -155,7 +155,6 @@ bool OpenSpaceEngine::create(int argc, char** argv,
return false;
// Parse commandline arguments
std::vector<std::string> remainingArguments;
_engine->_commandlineParser->setCommandLine(argc, argv, &sgctArguments);
const bool executeSuccess = _engine->_commandlineParser->execute();
if (!executeSuccess)

View File

@@ -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)

View File

@@ -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<float>( _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);

View File

@@ -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 <openspace/interface/interface.h>
/*
#include <sgct.h>
#include <boost/property_tree/json_parser.hpp>
#include <boost/foreach.hpp>
#include <algorithm>
*/
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<Node>();
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<Node>::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

View File

@@ -58,24 +58,27 @@ auto cmp = [](const ImageParams &a, const ImageParams &b)->bool{
std::vector<ImageParams> _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<std::string> sequencePaths = sequenceDir.read(true, false); // check inputs
for (auto path : sequencePaths){

View File

@@ -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));