From 393ff1f71d8cef0927fd0e00dc4e8abbb250e021 Mon Sep 17 00:00:00 2001 From: rinkk <karsten.rink@ufz.de> Date: Tue, 28 Jun 2016 12:19:21 +0200 Subject: [PATCH] moved Color class to DataHolderLib --- Applications/DataExplorer/Base/CMakeLists.txt | 3 --- .../DataExplorer/DataView/ColorTableModel.cpp | 6 +++--- .../DataExplorer/DataView/ColorTableModel.h | 7 ++++--- .../DataView/DiagramView/DetailWindow.cpp | 10 +++++----- .../DataExplorer/DataView/StationTreeView.cpp | 4 ++-- .../DataExplorer/DataView/StratView/StratBar.cpp | 4 ++-- .../DataExplorer/DataView/StratView/StratBar.h | 11 ++++++----- .../DataExplorer/DataView/StratView/StratScene.cpp | 4 ++-- .../DataExplorer/DataView/StratView/StratScene.h | 9 +++++---- .../DataExplorer/DataView/StratView/StratView.cpp | 2 +- .../DataExplorer/DataView/StratView/StratView.h | 2 +- .../DataView/StratView/StratWindow.cpp | 2 +- .../DataExplorer/DataView/StratView/StratWindow.h | 2 +- .../DataExplorer/VtkVis/VtkColorLookupTable.cpp | 3 ++- .../DataExplorer/VtkVis/VtkPointsSource.cpp | 8 +++----- .../DataExplorer/VtkVis/VtkPolylinesSource.cpp | 11 ++++++----- .../DataExplorer/VtkVis/VtkStationSource.cpp | 2 +- .../DataExplorer/VtkVis/VtkStationSource.h | 14 ++++++-------- .../DataExplorer/VtkVis/VtkSurfacesSource.cpp | 4 ++-- Applications/DataExplorer/VtkVis/VtkVisPipeline.h | 10 ++++------ .../{DataExplorer/Base => DataHolderLib}/Color.cpp | 6 +++--- .../{DataExplorer/Base => DataHolderLib}/Color.h | 10 +++++----- 22 files changed, 65 insertions(+), 69 deletions(-) rename Applications/{DataExplorer/Base => DataHolderLib}/Color.cpp (98%) rename Applications/{DataExplorer/Base => DataHolderLib}/Color.h (76%) diff --git a/Applications/DataExplorer/Base/CMakeLists.txt b/Applications/DataExplorer/Base/CMakeLists.txt index c1b28107f1f..9be3da3231e 100644 --- a/Applications/DataExplorer/Base/CMakeLists.txt +++ b/Applications/DataExplorer/Base/CMakeLists.txt @@ -7,10 +7,8 @@ set(SOURCES TreeModel.cpp ColorPickerPushButton.cpp TreeModelIterator.cpp - # modeltest.cpp # Not needed CheckboxDelegate.cpp QValueTooltipSlider.cpp - Color.cpp ) # Header files @@ -24,7 +22,6 @@ set(HEADERS RecentFiles.h TreeModel.h ColorPickerPushButton.h - # modeltest.h # Not needed CheckboxDelegate.h QValueTooltipSlider.h ) diff --git a/Applications/DataExplorer/DataView/ColorTableModel.cpp b/Applications/DataExplorer/DataView/ColorTableModel.cpp index 2a516fb3323..94f8750867f 100644 --- a/Applications/DataExplorer/DataView/ColorTableModel.cpp +++ b/Applications/DataExplorer/DataView/ColorTableModel.cpp @@ -14,7 +14,7 @@ #include "ColorTableModel.h" -ColorTableModel::ColorTableModel( const std::map<std::string, GeoLib::Color*> &colorLookupTable, +ColorTableModel::ColorTableModel( const std::map<std::string, DataHolderLib::Color*> &colorLookupTable, QObject* parent /*= 0*/ ) { Q_UNUSED(parent) @@ -77,12 +77,12 @@ QVariant ColorTableModel::data( const QModelIndex& index, int role ) const return QVariant(); } -bool ColorTableModel::buildTable(const std::map<std::string, GeoLib::Color*> &colorLookupTable) +bool ColorTableModel::buildTable(const std::map<std::string, DataHolderLib::Color*> &colorLookupTable) { int count = 0; beginInsertRows(QModelIndex(), 0, colorLookupTable.size() - 1); - for (std::map<std::string, GeoLib::Color*>::const_iterator it = colorLookupTable.begin(); + for (std::map<std::string, DataHolderLib::Color*>::const_iterator it = colorLookupTable.begin(); it != colorLookupTable.end(); ++it) { QColor color((*(it->second))[0], (*(it->second))[1], (*(it->second))[2]); diff --git a/Applications/DataExplorer/DataView/ColorTableModel.h b/Applications/DataExplorer/DataView/ColorTableModel.h index 06ff58a60a8..0ee68d0a69b 100644 --- a/Applications/DataExplorer/DataView/ColorTableModel.h +++ b/Applications/DataExplorer/DataView/ColorTableModel.h @@ -15,10 +15,11 @@ #ifndef COLORTABLEMODEL_H #define COLORTABLEMODEL_H -#include "Color.h" #include <QAbstractTableModel> #include <QColor> +#include "Applications/DataHolderLib/Color.h" + /** * The PolylinesModel is a Qt model which represents Polylines. */ @@ -27,7 +28,7 @@ class ColorTableModel : public QAbstractTableModel Q_OBJECT public: - ColorTableModel( const std::map<std::string, GeoLib::Color*> &colorLookupTable, + ColorTableModel( const std::map<std::string, DataHolderLib::Color*> &colorLookupTable, QObject* parent = 0 ); ~ColorTableModel(); @@ -45,7 +46,7 @@ public: int role /*= Qt::DisplayRole*/ ) const; private: - bool buildTable( const std::map<std::string, GeoLib::Color*> &colorLookupTable ); + bool buildTable( const std::map<std::string, DataHolderLib::Color*> &colorLookupTable ); QList< QPair<QString, QColor> > _listOfPairs; }; diff --git a/Applications/DataExplorer/DataView/DiagramView/DetailWindow.cpp b/Applications/DataExplorer/DataView/DiagramView/DetailWindow.cpp index 841fede57d7..016e544f025 100644 --- a/Applications/DataExplorer/DataView/DiagramView/DetailWindow.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/DetailWindow.cpp @@ -12,13 +12,13 @@ * */ -#include "Color.h" -#include "DetailWindow.h" -#include "DiagramPrefsDialog.h" - #include <QFileDialog> #include <QSettings> +#include "Applications/DataHolderLib/Color.h" +#include "DetailWindow.h" +#include "DiagramPrefsDialog.h" + DetailWindow::DetailWindow(QWidget* parent) : QWidget(parent) { setupUi(this); @@ -124,7 +124,7 @@ void DetailWindow::resizeWindow() void DetailWindow::addList(DiagramList* list) { - GeoLib::Color const c = GeoLib::getRandomColor(); + DataHolderLib::Color const c = DataHolderLib::getRandomColor(); QColor colour(c[0], c[1], c[2]); this->addList(list, colour); resizeWindow(); diff --git a/Applications/DataExplorer/DataView/StationTreeView.cpp b/Applications/DataExplorer/DataView/StationTreeView.cpp index 371d6ae1bcf..8ac712100bb 100644 --- a/Applications/DataExplorer/DataView/StationTreeView.cpp +++ b/Applications/DataExplorer/DataView/StationTreeView.cpp @@ -144,7 +144,7 @@ void StationTreeView::displayStratigraphy() static_cast<StationTreeModel*>(model())->stationFromIndex( this->selectionModel()->currentIndex(), temp_name); // get color table (horrible way to do it but there you go ...) - std::map<std::string, GeoLib::Color> colorLookupTable = + std::map<std::string, DataHolderLib::Color> colorLookupTable = static_cast<VtkStationSource*>(static_cast<StationTreeModel*> (model())->vtkSource(temp_name.toStdString()))->getColorLookupTable(); StratWindow* stratView = new StratWindow(static_cast<GeoLib::StationBorehole*> @@ -237,7 +237,7 @@ void StationTreeView::showDiagramPrefsDialog() void StationTreeView::writeStratigraphiesAsImages(QString listName) { - std::map<std::string, GeoLib::Color> colorLookupTable = + std::map<std::string, DataHolderLib::Color> colorLookupTable = static_cast<VtkStationSource*>(static_cast<StationTreeModel*> (model())->vtkSource(listName.toStdString()))->getColorLookupTable(); std::vector<ModelTreeItem*> lists = static_cast<StationTreeModel*>(model())->getLists(); diff --git a/Applications/DataExplorer/DataView/StratView/StratBar.cpp b/Applications/DataExplorer/DataView/StratView/StratBar.cpp index 9ef02f386cc..ee1c55131d4 100644 --- a/Applications/DataExplorer/DataView/StratView/StratBar.cpp +++ b/Applications/DataExplorer/DataView/StratView/StratBar.cpp @@ -16,7 +16,7 @@ #include <QPainter> StratBar::StratBar(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors, + std::map<std::string, DataHolderLib::Color>* stratColors, QGraphicsItem* parent) : QGraphicsItem(parent), _station(station) { @@ -61,7 +61,7 @@ void StratBar::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, top += height; height = logHeight(((*(profile[i - 1]))[2] - (*(profile[i]))[2])); QRectF layer(0, top, BARWIDTH, height); - GeoLib::Color const& c (GeoLib::getColor(soilNames[i], _stratColors)); + DataHolderLib::Color const& c (DataHolderLib::getColor(soilNames[i], _stratColors)); QBrush brush(QColor((int)c[0], (int)c[1], (int)c[2], 127), Qt::SolidPattern); painter->setBrush(brush); diff --git a/Applications/DataExplorer/DataView/StratView/StratBar.h b/Applications/DataExplorer/DataView/StratView/StratBar.h index 95dd63f5d12..de459c604cc 100644 --- a/Applications/DataExplorer/DataView/StratView/StratBar.h +++ b/Applications/DataExplorer/DataView/StratView/StratBar.h @@ -15,11 +15,12 @@ #ifndef STRATBAR_H #define STRATBAR_H -#include "StationBorehole.h" -#include "Color.h" -#include <QGraphicsItem> #include <cmath> +#include <QGraphicsItem> + +#include "StationBorehole.h" +#include "Applications/DataHolderLib/Color.h" /** * \brief A 2D bar visualisation of a borehole stratigraphy. @@ -36,7 +37,7 @@ public: * \param parent The parent QGraphicsItem. */ StratBar(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors = nullptr, + std::map<std::string, DataHolderLib::Color>* stratColors = nullptr, QGraphicsItem* parent = 0); ~StratBar(); @@ -60,7 +61,7 @@ private: static const int BARWIDTH = 50; GeoLib::StationBorehole* _station; - std::map<std::string, GeoLib::Color> _stratColors; + std::map<std::string, DataHolderLib::Color> _stratColors; }; #endif //STRATBAR_H diff --git a/Applications/DataExplorer/DataView/StratView/StratScene.cpp b/Applications/DataExplorer/DataView/StratView/StratScene.cpp index 9d8953e9295..8902e86ddf1 100644 --- a/Applications/DataExplorer/DataView/StratView/StratScene.cpp +++ b/Applications/DataExplorer/DataView/StratView/StratScene.cpp @@ -23,7 +23,7 @@ #include "StratScene.h" StratScene::StratScene(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors, + std::map<std::string, DataHolderLib::Color>* stratColors, QObject* parent) : QGraphicsScene(parent) { QRectF textBounds; @@ -115,7 +115,7 @@ void StratScene::addSoilNameLabels(std::vector<std::string> soilNames, } StratBar* StratScene::addStratBar(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors) + std::map<std::string, DataHolderLib::Color>* stratColors) { StratBar* b = new StratBar(station, stratColors); addItem(b); diff --git a/Applications/DataExplorer/DataView/StratView/StratScene.h b/Applications/DataExplorer/DataView/StratView/StratScene.h index 6970f645ec7..0a81cd9e222 100644 --- a/Applications/DataExplorer/DataView/StratView/StratScene.h +++ b/Applications/DataExplorer/DataView/StratView/StratScene.h @@ -15,10 +15,11 @@ #ifndef STRATSCENE_H #define STRATSCENE_H -#include "StationBorehole.h" -#include "Color.h" #include <QGraphicsScene> +#include "StationBorehole.h" +#include "Applications/DataHolderLib/Color.h" + class StratBar; class QNonScalableGraphicsTextItem; @@ -30,7 +31,7 @@ class StratScene : public QGraphicsScene public: /// Constructor StratScene(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors = nullptr, + std::map<std::string, DataHolderLib::Color>* stratColors = nullptr, QObject* parent = 0); ~StratScene(); @@ -52,7 +53,7 @@ private: /// Add a stratigraphy-bar to the scene. StratBar* addStratBar(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors = nullptr); + std::map<std::string, DataHolderLib::Color>* stratColors = nullptr); }; #endif //STRATSCENE_H diff --git a/Applications/DataExplorer/DataView/StratView/StratView.cpp b/Applications/DataExplorer/DataView/StratView/StratView.cpp index de56ef45a45..6ff4043593e 100644 --- a/Applications/DataExplorer/DataView/StratView/StratView.cpp +++ b/Applications/DataExplorer/DataView/StratView/StratView.cpp @@ -22,7 +22,7 @@ StratView::~StratView() } void StratView::setStation(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors) + std::map<std::string, DataHolderLib::Color>* stratColors) { _scene = new StratScene(station, stratColors); setScene(_scene); diff --git a/Applications/DataExplorer/DataView/StratView/StratView.h b/Applications/DataExplorer/DataView/StratView/StratView.h index 244ae7bea32..f54d5f01bfc 100644 --- a/Applications/DataExplorer/DataView/StratView/StratView.h +++ b/Applications/DataExplorer/DataView/StratView/StratView.h @@ -39,7 +39,7 @@ public: /// Sets the Borehole whose data should be visualised. void setStation(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors = nullptr); + std::map<std::string, DataHolderLib::Color>* stratColors = nullptr); /// Returns the height of the bounding rectangle of all objects within the scene. int getHeight() { return static_cast<int>((_scene->itemsBoundingRect()).height()); } diff --git a/Applications/DataExplorer/DataView/StratView/StratWindow.cpp b/Applications/DataExplorer/DataView/StratView/StratWindow.cpp index 603602eecaf..5d7152c2b1a 100644 --- a/Applications/DataExplorer/DataView/StratView/StratWindow.cpp +++ b/Applications/DataExplorer/DataView/StratView/StratWindow.cpp @@ -16,7 +16,7 @@ #include "StratWindow.h" StratWindow::StratWindow(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors, + std::map<std::string, DataHolderLib::Color>* stratColors, QWidget* parent) : QWidget(parent) { setupUi(this); diff --git a/Applications/DataExplorer/DataView/StratView/StratWindow.h b/Applications/DataExplorer/DataView/StratView/StratWindow.h index 921c13dcaa4..0d9294278e1 100644 --- a/Applications/DataExplorer/DataView/StratView/StratWindow.h +++ b/Applications/DataExplorer/DataView/StratView/StratWindow.h @@ -38,7 +38,7 @@ public: * \param parent The parent QWidget. */ StratWindow(GeoLib::StationBorehole* station, - std::map<std::string, GeoLib::Color>* stratColors = nullptr, + std::map<std::string, DataHolderLib::Color>* stratColors = nullptr, QWidget* parent = 0); ~StratWindow(void) { this->destroy(); } diff --git a/Applications/DataExplorer/VtkVis/VtkColorLookupTable.cpp b/Applications/DataExplorer/VtkVis/VtkColorLookupTable.cpp index e5c906b0004..348ee8b1f80 100644 --- a/Applications/DataExplorer/VtkVis/VtkColorLookupTable.cpp +++ b/Applications/DataExplorer/VtkVis/VtkColorLookupTable.cpp @@ -19,9 +19,10 @@ #include <logog/include/logog.hpp> -#include <Color.h> #include <vtkObjectFactory.h> +#include "Applications/DataHolderLib/Color.h" + vtkStandardNewMacro(VtkColorLookupTable); VtkColorLookupTable::VtkColorLookupTable() diff --git a/Applications/DataExplorer/VtkVis/VtkPointsSource.cpp b/Applications/DataExplorer/VtkVis/VtkPointsSource.cpp index a193787abee..c351fdb0afb 100644 --- a/Applications/DataExplorer/VtkVis/VtkPointsSource.cpp +++ b/Applications/DataExplorer/VtkVis/VtkPointsSource.cpp @@ -12,10 +12,6 @@ * */ -// ** INCLUDES ** -// GeoLib -#include "Color.h" - #include "VtkPointsSource.h" #include <logog/include/logog.hpp> @@ -32,6 +28,8 @@ #include <vtkCellData.h> #include <vtkProperty.h> +#include "Applications/DataHolderLib/Color.h" + vtkStandardNewMacro(VtkPointsSource); VtkPointsSource::VtkPointsSource() @@ -40,7 +38,7 @@ VtkPointsSource::VtkPointsSource() _removable = false; // From VtkAlgorithmProperties this->SetNumberOfInputPorts(0); - const GeoLib::Color c = GeoLib::getRandomColor(); + const DataHolderLib::Color c = DataHolderLib::getRandomColor(); GetProperties()->SetColor(c[0] / 255.0,c[1] / 255.0,c[2] / 255.0); } diff --git a/Applications/DataExplorer/VtkVis/VtkPolylinesSource.cpp b/Applications/DataExplorer/VtkVis/VtkPolylinesSource.cpp index 7195b540214..b3ee6905d07 100644 --- a/Applications/DataExplorer/VtkVis/VtkPolylinesSource.cpp +++ b/Applications/DataExplorer/VtkVis/VtkPolylinesSource.cpp @@ -17,10 +17,6 @@ #include <logog/include/logog.hpp> -// GeoLib -#include "Color.h" -#include "Polyline.h" - #include <vtkCellArray.h> #include <vtkCellData.h> #include <vtkInformation.h> @@ -33,6 +29,11 @@ #include <vtkSmartPointer.h> #include <vtkStreamingDemandDrivenPipeline.h> +#include "Polyline.h" + +#include "Applications/DataHolderLib/Color.h" + + vtkStandardNewMacro(VtkPolylinesSource); VtkPolylinesSource::VtkPolylinesSource() @@ -41,7 +42,7 @@ VtkPolylinesSource::VtkPolylinesSource() _removable = false; // From VtkAlgorithmProperties this->SetNumberOfInputPorts(0); - const GeoLib::Color c = GeoLib::getRandomColor(); + const DataHolderLib::Color c = DataHolderLib::getRandomColor(); GetProperties()->SetColor(c[0] / 255.0, c[1] / 255.0, c[2] / 255.0); } diff --git a/Applications/DataExplorer/VtkVis/VtkStationSource.cpp b/Applications/DataExplorer/VtkVis/VtkStationSource.cpp index 91af14ed642..2e31e4d21a5 100644 --- a/Applications/DataExplorer/VtkVis/VtkStationSource.cpp +++ b/Applications/DataExplorer/VtkVis/VtkStationSource.cpp @@ -41,7 +41,7 @@ VtkStationSource::VtkStationSource() _removable = false; // From VtkAlgorithmProperties this->SetNumberOfInputPorts(0); - const GeoLib::Color c = GeoLib::getRandomColor(); + const DataHolderLib::Color c = DataHolderLib::getRandomColor(); GetProperties()->SetColor(c[0] / 255.0, c[1] / 255.0, c[2] / 255.0); } diff --git a/Applications/DataExplorer/VtkVis/VtkStationSource.h b/Applications/DataExplorer/VtkVis/VtkStationSource.h index 01515a22f77..3bb149304e9 100644 --- a/Applications/DataExplorer/VtkVis/VtkStationSource.h +++ b/Applications/DataExplorer/VtkVis/VtkStationSource.h @@ -15,13 +15,11 @@ #ifndef VTKSTATIONSOURCE_H #define VTKSTATIONSOURCE_H -// ** INCLUDES ** -#include "VtkAlgorithmProperties.h" #include <vtkPolyDataAlgorithm.h> -// GeoLib -#include "Color.h" #include "Station.h" +#include "Applications/DataHolderLib/Color.h" +#include "VtkAlgorithmProperties.h" /** * \brief VTK source object for the visualisation of station data (including boreholes) @@ -36,7 +34,7 @@ public: /// Returns the colour lookup table generated for boreholes. /// This method should only be called after the colour lookup table has actually been build (via RequestData() or setColorLookupTable()). - const std::map<std::string, GeoLib::Color>& getColorLookupTable() const + const std::map<std::string, DataHolderLib::Color>& getColorLookupTable() const { return _colorLookupTable; } /// Returns the type of observation site represented in this source object @@ -44,8 +42,8 @@ public: { return static_cast<GeoLib::Station*>((*_stations)[0])->type(); }; /// Sets a predefined color lookup table for the colouring of borehole stratigraphies - int setColorLookupTable(const std::string &filename) - { return GeoLib::readColorLookupTable(_colorLookupTable, filename); } +// int setColorLookupTable(const std::string &filename) +// { return GeoLib::readColorLookupTable(_colorLookupTable, filename); } /// Sets the stations as a vector void setStations(const std::vector<GeoLib::Point*>* stations) { _stations = stations; } @@ -72,7 +70,7 @@ protected: /// The colour table for stratigraphic data. This table is either set using the setColorLookupTable() method or is generated /// automatically with random colours while creating the VtkStationSource-object. - std::map<std::string, GeoLib::Color> _colorLookupTable; + std::map<std::string, DataHolderLib::Color> _colorLookupTable; private: std::size_t GetIndexByName( std::string const& name ); diff --git a/Applications/DataExplorer/VtkVis/VtkSurfacesSource.cpp b/Applications/DataExplorer/VtkVis/VtkSurfacesSource.cpp index adb6aaaf381..c5dedac1d2b 100644 --- a/Applications/DataExplorer/VtkVis/VtkSurfacesSource.cpp +++ b/Applications/DataExplorer/VtkVis/VtkSurfacesSource.cpp @@ -27,8 +27,8 @@ #include <vtkStreamingDemandDrivenPipeline.h> #include <vtkProperty.h> -#include "Applications/DataExplorer/Base/Color.h" #include "GeoLib/Triangle.h" +#include "Applications/DataHolderLib/Color.h" vtkStandardNewMacro(VtkSurfacesSource); @@ -39,7 +39,7 @@ VtkSurfacesSource::VtkSurfacesSource() this->SetNumberOfInputPorts(0); //this->SetColorBySurface(true); - const GeoLib::Color c = GeoLib::getRandomColor(); + const DataHolderLib::Color c = DataHolderLib::getRandomColor(); vtkProperty* vtkProps = GetProperties(); vtkProps->SetColor(c[0] / 255.0,c[1] / 255.0,c[2] / 255.0); vtkProps->SetEdgeVisibility(0); diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipeline.h b/Applications/DataExplorer/VtkVis/VtkVisPipeline.h index 7623720650e..4360f4e5714 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipeline.h +++ b/Applications/DataExplorer/VtkVis/VtkVisPipeline.h @@ -15,17 +15,15 @@ #ifndef VTKVISPIPELINE_H #define VTKVISPIPELINE_H -// ** INCLUDES ** -#include "BaseLib/Histogram.h" +#include <QMap> +#include <QVector> -#include "Color.h" +#include "BaseLib/Histogram.h" #include "GeoType.h" #include "MeshEnums.h" #include "Point.h" #include "TreeModel.h" - -#include <QMap> -#include <QVector> +#include "Applications/DataHolderLib/Color.h" class vtkAlgorithm; class vtkDataSet; diff --git a/Applications/DataExplorer/Base/Color.cpp b/Applications/DataHolderLib/Color.cpp similarity index 98% rename from Applications/DataExplorer/Base/Color.cpp rename to Applications/DataHolderLib/Color.cpp index 1159b8d0e64..6604d7150be 100644 --- a/Applications/DataExplorer/Base/Color.cpp +++ b/Applications/DataHolderLib/Color.cpp @@ -21,7 +21,7 @@ #include "BaseLib/StringTools.h" -namespace GeoLib { +namespace DataHolderLib { Color getRandomColor() { @@ -31,7 +31,7 @@ Color getRandomColor() col[2] = static_cast<unsigned char>((rand()%5)*50); return col; } - +/* int readColorLookupTable(std::map<std::string, Color> &colors, const std::string &filename) { std::ifstream in( filename.c_str() ); @@ -63,7 +63,7 @@ int readColorLookupTable(std::map<std::string, Color> &colors, const std::string return 1; } - +*/ Color const getColor(const std::string &id, std::map<std::string, Color> &colors) { for (std::map<std::string, Color>::const_iterator it=colors.begin(); it !=colors.end(); ++it) diff --git a/Applications/DataExplorer/Base/Color.h b/Applications/DataHolderLib/Color.h similarity index 76% rename from Applications/DataExplorer/Base/Color.h rename to Applications/DataHolderLib/Color.h index aa68db85788..6e59d79240e 100644 --- a/Applications/DataExplorer/Base/Color.h +++ b/Applications/DataHolderLib/Color.h @@ -20,22 +20,22 @@ #include <map> #include <string> -namespace GeoLib +namespace DataHolderLib { -using Color = std::array<unsigned char, 3>; +using Color = std::array<unsigned char, 4>; /// Returns a random RGB colour. Color getRandomColor(); /// Reads a color-lookup-table from a file and writes it to a map. -int readColorLookupTable(std::map<std::string, GeoLib::Color> &colors, const std::string &filename); +//int readColorLookupTable(std::map<std::string, GeoLib::Color> &colors, const std::string &filename); /// Uses a color-lookup-table (in form of a map) to return a colour for a specified name. If the name is not /// in the colortable a new entry is created with the new name and a random colour. -Color const getColor(const std::string &id, std::map<std::string, GeoLib::Color> &colors); +Color const getColor(const std::string &id, std::map<std::string, DataHolderLib::Color> &colors); /// Convenience function to use the getColor method with numbers as identifiers. -Color const getColor(double id, std::map<std::string, GeoLib::Color> &colors); +Color const getColor(double id, std::map<std::string, DataHolderLib::Color> &colors); } // namespace #endif /* COLOR_H_ */ -- GitLab