diff --git a/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt b/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt index 8fb1f90b4ed54ca69a1117f3033875be63492cc0..3a6c5d758a0664dfd47dd46240fde5a335605cb0 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt +++ b/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt @@ -5,7 +5,6 @@ set( INCLUDE_FILES inc/MantidVatesSimpleGuiViewWidgets/AutoScaleRangeGenerator.h inc/MantidVatesSimpleGuiViewWidgets/CameraManager.h inc/MantidVatesSimpleGuiViewWidgets/BackgroundRgbProvider.h - inc/MantidVatesSimpleGuiViewWidgets/ColorMapManager.h inc/MantidVatesSimpleGuiViewWidgets/ColorMapEditorPanel.h inc/MantidVatesSimpleGuiViewWidgets/ColorSelectionWidget.h inc/MantidVatesSimpleGuiViewWidgets/ColorUpdater.h @@ -32,7 +31,6 @@ set( SOURCE_FILES src/AutoScaleRangeGenerator.cpp src/CameraManager.cpp src/BackgroundRgbProvider.cpp - src/ColorMapManager.cpp src/ColorMapEditorPanel.cpp src/ColorSelectionWidget.cpp src/ColorUpdater.cpp @@ -54,7 +52,6 @@ set( SOURCE_FILES ) set( TEST_FILES - test/unitTests/ColorMapManagerTest.h ) # These are the headers to be preprocessed using diff --git a/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ColorMapManager.h b/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ColorMapManager.h deleted file mode 100644 index 7cd2b3b441a1a1fde84c038f851c0faa6be94345..0000000000000000000000000000000000000000 --- a/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ColorMapManager.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef COLORMAP_MANAGER_H_ -#define COLORMAP_MANAGER_H_ - -#include "MantidVatesSimpleGuiViewWidgets/WidgetDllOption.h" -#include "MantidQtAPI/MdSettings.h" -#include <string> -#include <map> - - -namespace Mantid -{ - namespace Vates - { - namespace SimpleGui - { - /** - * - This class handles the colormaps which are loaded into the - - @date 10/12/2014 - - Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory - - This file is part of Mantid. - - Mantid 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. - - Mantid 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 this program. If not, see <http://www.gnu.org/licenses/>. - - File change history is stored at: <https://github.com/mantidproject/mantid> - Code Documentation is available at: <http://doxygen.mantidproject.org> - */ - - class EXPORT_OPT_MANTIDVATES_SIMPLEGUI_VIEWWIDGETS ColorMapManager - { - public: - ColorMapManager(); - - virtual ~ColorMapManager(); - - /** - * Get default color map - * @param useCurrentColorMap If we should use the current color map. - * @returns index The index of the default color map in the list of color maps. - */ - int getDefaultColorMapIndex(bool useCurrentColorMap); - - /** - * Read in and store the available color maps - * @param xml The path to the colormap. - */ - void readInColorMap(std::string xml); - - /** - * Get index for colormap - * @param colorMap The name of the color map. - * @returns The index of the colormap in the Paraview store. - */ - int getColorMapIndex(std::string colorMap); - - /** - * Check if a color map already has been recorded. - * @param colorMap The name of the color map. - * @returns True if the name already exists - */ - bool isRecordedColorMap(std::string colorMap); - - /** - * Record the new active color map when the user selected a new one. - * @param index The index of the color map in the color map list. - */ - void setNewActiveColorMap(int index); - - private: - int m_indexCounter; - std::map<std::string, int> m_nameToIndex; - std::map<int, std::string> m_indexToName; - - MantidQt::API::MdSettings m_mdSettings; - }; - } - } -} -#endif \ No newline at end of file diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/ColorMapManager.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/ColorMapManager.cpp deleted file mode 100644 index b775d9fb08dcb9d7e1031839b8c8164e4b2069d6..0000000000000000000000000000000000000000 --- a/Vates/VatesSimpleGui/ViewWidgets/src/ColorMapManager.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "MantidVatesSimpleGuiViewWidgets/ColorMapManager.h" -#include "MantidQtAPI/MdSettings.h" -#include "MantidKernel/ConfigService.h" -#include <map> -#include <string> - - -namespace Mantid -{ - namespace Vates - { - namespace SimpleGui - { - ColorMapManager::ColorMapManager() : m_indexCounter(0) - { - } - - ColorMapManager::~ColorMapManager() - { - } - - int ColorMapManager::getDefaultColorMapIndex(bool useCurrentColorMap) - { - QString defaultColorMap; - - // If the view has switched or the VSI is loaded use the last color map index - if (useCurrentColorMap) - { - defaultColorMap = m_mdSettings.getLastSessionColorMap(); - } - else - { - // Check if the user wants a general MD color map - if (m_mdSettings.getUsageGeneralMdColorMap()) - { - // The name is sufficient for the VSI to find the color map - defaultColorMap = m_mdSettings.getGeneralMdColorMapName(); - } - else - { - // Check if the user wants to use the last session - if (m_mdSettings.getUsageLastSession()) - { - defaultColorMap = m_mdSettings.getLastSessionColorMap(); - } - else - { - defaultColorMap = m_mdSettings.getUserSettingColorMap(); - } - } - } - - // Set the default colormap - int defaultColorMapIndex = 0; - - if (!defaultColorMap.isEmpty()) - { - m_mdSettings.setLastSessionColorMap(defaultColorMap); - defaultColorMapIndex = this->getColorMapIndex(defaultColorMap.toStdString()); - } - - return defaultColorMapIndex; - } - - void ColorMapManager::readInColorMap(std::string name) - { - // Add the name to the colormap map and increment the index counter - if (!name.empty()) - { - m_nameToIndex.insert(std::pair<std::string, int>(name, m_indexCounter)); - m_indexToName.insert(std::pair<int,std::string>(m_indexCounter, name)); - m_indexCounter = m_indexCounter + 1; - } - } - - int ColorMapManager::getColorMapIndex(std::string colorMap) - { - if (m_nameToIndex.count(colorMap) == 1 ) - { - return m_nameToIndex[colorMap]; - } - else - { - return 0; - } - } - - bool ColorMapManager::isRecordedColorMap(std::string colorMap) - { - if (m_nameToIndex.count(colorMap) > 0) - { - return true; - } - else - { - return false; - } - } - - void ColorMapManager::setNewActiveColorMap(int index) - { - // Persist the new value of the color map in the QSettings object. - if (m_indexToName.count(index) > 0) - { - m_mdSettings.setLastSessionColorMap(QString::fromStdString(m_indexToName[index])); - } - } - } - } -} \ No newline at end of file diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp index 9a933896b4b38c40853ff240d28d91974bfb4f5d..ec0b40bc29a4071fad4a1a466928bea24d6fb532 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp +++ b/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp @@ -289,7 +289,6 @@ void ViewBase::onColorMapChange(const Json::Value &model) { // Workaround for colormap but when changing the visbility of a source this->m_currentColorMapModel = model; - cout << "default:" << m_currentColorMapModel << "\n"; } /**