/**************************************************************************** Copyright (C) 2010-2012 the Office National des Forêts (ONF), France and the Association de Recherche Technologie et Sciences (ARTS), Ecole Nationale Suprieure d'Arts et Métiers (ENSAM), Cluny, France. All rights reserved. Contact : alexandre.piboule@onf.fr Developers : Michaël KREBS (ARTS/ENSAM) This file is part of Computree version 2.0. Computree is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Computree is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Computree. If not, see . *****************************************************************************/ #include "dm_graphicsview.h" #include "dm_documentmanager.h" #include DM_GraphicsView::DM_GraphicsView() { _options = new DM_GraphicsViewOptions(); _options->load(); _document = nullptr; m_attributesManager = nullptr; } DM_GraphicsView::~DM_GraphicsView() { delete _options; } void DM_GraphicsView::setDocumentView(const DM_DocumentView *doc) { _document = (DM_DocumentView*)doc; } DM_DocumentView* DM_GraphicsView::getDocumentView() const { return _document; } void DM_GraphicsView::setAttributesManager(const DM_AttributesManager *manager) { m_attributesManager = (DM_AttributesManager*)manager; } DM_AttributesManager* DM_GraphicsView::attributesManager() const { return m_attributesManager; } DocumentInterface* DM_GraphicsView::document() const { return _document; } void DM_GraphicsView::setOptions(const GraphicsViewOptionsInterface *options) { const DM_GraphicsViewOptions *optionsDM = dynamic_cast(options); if (optionsDM != nullptr) { setOptions(*optionsDM); } else { qDebug() << "DM_GraphicsView::setOptions - Le dynamic_cast a échoué."; } } void DM_GraphicsView::setOptions(const DM_GraphicsViewOptions &newOptions) { _options->updateFromOtherOptions(newOptions); } GraphicsViewOptionsInterface& DM_GraphicsView::getOptions() { return *_options; } const DM_GraphicsViewOptions& DM_GraphicsView::constGetOptionsInternal() const { return *_options; } QColor DM_GraphicsView::intermediateColorFromSelectedGradient(double key) { return _document->getManager()->intermediateColorFromSelectedGradient(key); }