mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Add abstract class to handle Handlebar-based documentation file generation
Apply Documented class to the InteractionHandler Update Ghoul
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/util/documented.h>
|
||||
#include <openspace/util/mouse.h>
|
||||
#include <openspace/util/keys.h>
|
||||
|
||||
@@ -48,8 +49,7 @@ class SceneGraphNode;
|
||||
namespace interaction {
|
||||
|
||||
|
||||
class InteractionHandler : public properties::PropertyOwner
|
||||
{
|
||||
class InteractionHandler : public properties::PropertyOwner, public Documented {
|
||||
public:
|
||||
InteractionHandler();
|
||||
~InteractionHandler();
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
|
||||
void saveCameraStateToFile(const std::string& filepath);
|
||||
void restoreCameraStateFromFile(const std::string& filepath);
|
||||
void writeKeyboardDocumentation(const std::string& type, const std::string& file);
|
||||
// void writeKeyboardDocumentation(const std::string& type, const std::string& file);
|
||||
|
||||
private:
|
||||
using Synchronized = ghoul::Boolean;
|
||||
@@ -131,6 +131,8 @@ private:
|
||||
Synchronized synchronization;
|
||||
std::string documentation;
|
||||
};
|
||||
|
||||
std::string generateJson() const override;
|
||||
|
||||
void setInteractionMode(std::shared_ptr<InteractionMode> interactionMode);
|
||||
|
||||
|
||||
57
include/openspace/util/documented.h
Normal file
57
include/openspace/util/documented.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2017 *
|
||||
* *
|
||||
* 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 __OPENSPACE_CORE___DOCUMENTED___H__
|
||||
#define __OPENSPACE_CORE___DOCUMENTED___H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class Documented {
|
||||
public:
|
||||
struct HandlebarTemplate {
|
||||
std::string name;
|
||||
std::string filename;
|
||||
};
|
||||
|
||||
Documented(std::string name, std::string jsonName, std::vector<HandlebarTemplate> handlebarTemplates,
|
||||
std::string javascriptFilename);
|
||||
|
||||
void writeDocumentation(const std::string& filename);
|
||||
|
||||
protected:
|
||||
virtual std::string generateJson() const = 0;
|
||||
|
||||
private:
|
||||
const std::string _name;
|
||||
const std::string _jsonName;
|
||||
const std::vector<HandlebarTemplate> _handlebarTemplates;
|
||||
const std::string _javascriptFile;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___DOCUMENTED___H__
|
||||
Reference in New Issue
Block a user