mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 06:19:57 -05:00
Adding DocumentationEngine
This commit is contained in:
@@ -33,8 +33,11 @@ namespace documentation {
|
||||
class DocumentationEngine {
|
||||
public:
|
||||
|
||||
void addDocumentation(Documentation doc);
|
||||
|
||||
private:
|
||||
std::vector<Documentation> _documentations;
|
||||
|
||||
};
|
||||
|
||||
} // namespace documentation
|
||||
|
||||
@@ -55,6 +55,7 @@ class ModuleEngine;
|
||||
class WindowWrapper;
|
||||
class SettingsEngine;
|
||||
|
||||
namespace documentation { class DocumentationEngine; }
|
||||
namespace interaction { class InteractionHandler; }
|
||||
namespace gui { class GUI; }
|
||||
//namespace scripting { class ScriptEngine; }
|
||||
@@ -77,6 +78,7 @@ public:
|
||||
|
||||
// Guaranteed to return a valid pointer
|
||||
ConfigurationManager& configurationManager();
|
||||
documentation::DocumentationEngine& documentationEngine();
|
||||
interaction::InteractionHandler& interactionHandler();
|
||||
RenderEngine& renderEngine();
|
||||
scripting::ScriptEngine& scriptEngine();
|
||||
@@ -135,6 +137,7 @@ private:
|
||||
|
||||
// Components
|
||||
std::unique_ptr<ConfigurationManager> _configurationManager;
|
||||
std::unique_ptr<documentation::DocumentationEngine> _documentationEngine;
|
||||
std::unique_ptr<interaction::InteractionHandler> _interactionHandler;
|
||||
std::unique_ptr<RenderEngine> _renderEngine;
|
||||
std::unique_ptr<scripting::ScriptEngine> _scriptEngine;
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -64,6 +66,8 @@ public:
|
||||
*/
|
||||
void deinitialize();
|
||||
|
||||
virtual std::vector<Documentation> documentations() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Customization point for each derived class. The internalInitialize method is called
|
||||
|
||||
@@ -119,4 +119,10 @@ void BaseModule::internalInitialize() {
|
||||
fModelGeometry->registerClass<modelgeometry::MultiModelGeometry>("MultiModelGeometry");
|
||||
}
|
||||
|
||||
std::vector<Documentation> BaseModule::documentations() const {
|
||||
return {
|
||||
StaticScale::Documentation()
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -33,6 +33,8 @@ class BaseModule : public OpenSpaceModule {
|
||||
public:
|
||||
BaseModule();
|
||||
|
||||
std::vector<Documentation> documentations() const override;
|
||||
|
||||
protected:
|
||||
void internalInitialize() override;
|
||||
};
|
||||
|
||||
@@ -24,10 +24,16 @@
|
||||
|
||||
#include <openspace/documentation/documentationengine.h>
|
||||
|
||||
#include <ghoul/misc/assert.h>
|
||||
|
||||
namespace openspace {
|
||||
namespace documentation {
|
||||
|
||||
|
||||
|
||||
void DocumentationEngine::addDocumentation(Documentation doc) {
|
||||
_documentations.push_back(std::move(doc));
|
||||
}
|
||||
|
||||
} // namespace documentation
|
||||
} // namespace openspace
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <openspace/openspace.h>
|
||||
|
||||
#include <openspace/documentation/documentationengine.h>
|
||||
#include <openspace/engine/configurationmanager.h>
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
#include <openspace/engine/logfactory.h>
|
||||
@@ -120,6 +121,7 @@ OpenSpaceEngine* OpenSpaceEngine::_engine = nullptr;
|
||||
OpenSpaceEngine::OpenSpaceEngine(std::string programName,
|
||||
std::unique_ptr<WindowWrapper> windowWrapper)
|
||||
: _configurationManager(new ConfigurationManager)
|
||||
, _documentationEngine(new documentation::DocumentationEngine)
|
||||
, _interactionHandler(new interaction::InteractionHandler)
|
||||
, _renderEngine(new RenderEngine)
|
||||
, _scriptEngine(new scripting::ScriptEngine)
|
||||
@@ -147,6 +149,7 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
|
||||
_interactionHandler->setPropertyOwner(_globalPropertyNamespace.get());
|
||||
_globalPropertyNamespace->addPropertySubOwner(_interactionHandler.get());
|
||||
_globalPropertyNamespace->addPropertySubOwner(_settingsEngine.get());
|
||||
|
||||
FactoryManager::initialize();
|
||||
FactoryManager::ref().addFactory(
|
||||
std::make_unique<ghoul::TemplateFactory<Renderable>>()
|
||||
@@ -158,6 +161,8 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
|
||||
Time::initialize();
|
||||
ghoul::systemcapabilities::SystemCapabilities::initialize();
|
||||
TransformationManager::initialize();
|
||||
|
||||
_documentationEngine->addDocumentation(ConfigurationManager::Documentation());
|
||||
}
|
||||
|
||||
OpenSpaceEngine::~OpenSpaceEngine() {
|
||||
@@ -292,6 +297,14 @@ bool OpenSpaceEngine::create(int argc, char** argv,
|
||||
// Register modules
|
||||
_engine->_moduleEngine->initialize();
|
||||
|
||||
// After registering the modules, the documentations for the available classes
|
||||
// can be added as well
|
||||
for (OpenSpaceModule* m : _engine->_moduleEngine->modules()) {
|
||||
for (auto&& doc : m->documentations()) {
|
||||
_engine->_documentationEngine->addDocumentation(doc);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the cachemanager
|
||||
FileSys.createCacheManager(
|
||||
absPath("${" + ConfigurationManager::KeyCache + "}"), CacheVersion
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <openspace/performance/performancemanager.h>
|
||||
|
||||
#include <openspace/documentation/documentationengine.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/interaction/interactionhandler.h>
|
||||
#include <openspace/scene/scene.h>
|
||||
@@ -136,6 +137,8 @@ RenderEngine::RenderEngine()
|
||||
12,
|
||||
-1
|
||||
};
|
||||
|
||||
OsEng.documentationEngine().addDocumentation(Scene::Documentation());
|
||||
}
|
||||
|
||||
RenderEngine::~RenderEngine() {
|
||||
@@ -493,8 +496,7 @@ void RenderEngine::toggleFrametimeType(int t) {
|
||||
}
|
||||
|
||||
Scene* RenderEngine::scene() {
|
||||
// TODO custom assert (ticket #5)
|
||||
assert(_sceneGraph);
|
||||
ghoul_assert(_sceneGraph, "Scenegraph not initialized");
|
||||
return _sceneGraph;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,10 @@ void OpenSpaceModule::deinitialize() {
|
||||
internalDeinitialize();
|
||||
}
|
||||
|
||||
std::vector<Documentation> OpenSpaceModule::documentations() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string OpenSpaceModule::modulePath() const {
|
||||
std::string moduleName = name();
|
||||
std::transform(moduleName.begin(), moduleName.end(), moduleName.begin(), tolower);
|
||||
|
||||
Reference in New Issue
Block a user