#ifndef PERMANENTRENDERER_H #define PERMANENTRENDERER_H #include "abstractpermanentrenderer.h" #include "context/icontextaccessor.h" #include "renderer/object/iobjectsrendererattributesaccessor.h" #include "tools/objectattributesprovider.h" template class PermanentRenderer : public AbstractPermanentRenderer, public IContextAccessor, public IObjectsRendererAttributesAccessor { public: PermanentRenderer(); virtual ~PermanentRenderer() {} /** * @brief Return the type of object draw by this renderer */ virtual Scene::ObjectType getTypeOfObjectDrawn() const = 0; /** * @brief Call this method when you add this renderer to * your graphics view and pass it your opengl context */ virtual void addedTo(const IGraphicsDocument *doc, const QOpenGLContext* newContext) { IContextAccessor::addedTo(doc, newContext); ObjectAttributesProvider *provider = getAnyElementsAttributesProvider()->getObjectsAttributeProvider(this->getTypeOfObjectDrawn()); provider->setObjectsRendererAttributesAccessor(this); } /** * @brief Call this method when you remove this renderer from * your graphics view and pass it your opengl context */ virtual void removedFrom(const IGraphicsDocument* doc, const QOpenGLContext* newContext) { IContextAccessor::removedFrom(doc, newContext); } /** * @brief Returns all contexts */ const typename IContextAccessor::ContextCollection& getContexts() const { return IContextAccessor::getContexts(); } /** * @brief Returns the current context */ RendererContextT* getCurrentContext() const { return IContextAccessor::getCurrentContext(); } /** * @brief Returns the current document */ IGraphicsDocument* getCurrentDocument() const { return IContextAccessor::getCurrentDocument(); } }; #include "permanentrenderer.hpp" #endif // PERMANENTRENDERER_H