mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#632) Improved colors used for selection and time history curves
This commit is contained in:
@@ -94,6 +94,8 @@ set( USER_INTERFACE_FILES
|
||||
UserInterface/RiuTimeHistoryQwtPlot.cpp
|
||||
UserInterface/RiuSelectionManager.h
|
||||
UserInterface/RiuSelectionManager.cpp
|
||||
UserInterface/RiuSelectionColors.h
|
||||
UserInterface/RiuSelectionColors.cpp
|
||||
)
|
||||
|
||||
set( SOCKET_INTERFACE_FILES
|
||||
|
57
ApplicationCode/UserInterface/RiuSelectionColors.cpp
Normal file
57
ApplicationCode/UserInterface/RiuSelectionColors.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiuSelectionColors.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
static const int RI_SELECTION_COLOR_COUNT = 7;
|
||||
static const int RI_SELECTION_COLOR[] =
|
||||
{
|
||||
Qt::magenta,
|
||||
Qt::cyan,
|
||||
Qt::blue,
|
||||
Qt::red,
|
||||
Qt::green,
|
||||
Qt::yellow,
|
||||
Qt::gray
|
||||
};
|
||||
|
||||
static int riuSelectionColorIndex = 0;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Pick default curve color from an index based palette
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RiuSelectionColors::curveColorFromTable()
|
||||
{
|
||||
QColor color = QColor(Qt::GlobalColor(RI_SELECTION_COLOR[riuSelectionColorIndex % RI_SELECTION_COLOR_COUNT]));
|
||||
++riuSelectionColorIndex;
|
||||
cvf::Color3f cvfColor(color.redF(), color.greenF(), color.blueF());
|
||||
return cvfColor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Color rarely present in result value colors
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RiuSelectionColors::singleCurveColor()
|
||||
{
|
||||
riuSelectionColorIndex = 0;
|
||||
|
||||
return curveColorFromTable();
|
||||
}
|
33
ApplicationCode/UserInterface/RiuSelectionColors.h
Normal file
33
ApplicationCode/UserInterface/RiuSelectionColors.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiuSelectionColors
|
||||
{
|
||||
public:
|
||||
static cvf::Color3f curveColorFromTable();
|
||||
static cvf::Color3f singleCurveColor();
|
||||
};
|
@@ -69,6 +69,14 @@ void RiuSelectionManager::deleteAllItems()
|
||||
m_selection.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuSelectionManager::isEmpty() const
|
||||
{
|
||||
return m_selection.size() == 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -54,6 +54,8 @@ public:
|
||||
// Deletes all items in the SelectionManager
|
||||
void deleteAllItems();
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
private:
|
||||
std::vector < RiuSelectionItem* > m_selection;
|
||||
};
|
||||
|
@@ -21,10 +21,9 @@
|
||||
|
||||
#include "RigCurveDataTools.h"
|
||||
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
|
@@ -25,13 +25,14 @@
|
||||
#include "Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h"
|
||||
#include "Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h"
|
||||
|
||||
#include "RigCaseData.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartGrid.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "RigFemTimeHistoryResultAccessor.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
@@ -50,13 +51,15 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimView.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellLogFile.h"
|
||||
|
||||
#include "RiuFemResultTextBuilder.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuResultTextBuilder.h"
|
||||
#include "RiuSelectionColors.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "RiuTimeHistoryQwtPlot.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
@@ -77,9 +80,6 @@
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QStatusBar>
|
||||
#include "RigFemTimeHistoryResultAccessor.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@@ -570,7 +570,6 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t
|
||||
std::vector<double> timeHistoryValues = timeHistResultAccessor.timeHistoryValues();
|
||||
CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size());
|
||||
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
||||
|
||||
std::vector<RiuSelectionItem*> items;
|
||||
RiuSelectionManager::instance()->selectedItems(items);
|
||||
@@ -596,6 +595,12 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t
|
||||
RiuSelectionManager::instance()->deleteAllItems();
|
||||
}
|
||||
|
||||
cvf::Color3f curveColor = RiuSelectionColors::curveColorFromTable();
|
||||
if (RiuSelectionManager::instance()->isEmpty())
|
||||
{
|
||||
curveColor = RiuSelectionColors::singleCurveColor();
|
||||
}
|
||||
|
||||
RiuSelectionManager::instance()->appendItemToSelection(new RiuEclipseSelectionItem(eclipseView, gridIndex, cellIndex, curveColor));
|
||||
|
||||
mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, timeStepDates, timeHistoryValues);
|
||||
@@ -639,7 +644,7 @@ void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t
|
||||
|
||||
CVF_ASSERT(frameTimes.size() == timeHistoryValues.size());
|
||||
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
||||
cvf::Color3f curveColor = RiuSelectionColors::curveColorFromTable();
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
|
||||
|
Reference in New Issue
Block a user