mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#436) Refactored curve creation features
Moved common code to new base class.
This commit is contained in:
parent
e4212a1135
commit
e81a1c69c0
@ -47,6 +47,8 @@ ${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.h
|
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.h
|
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.h
|
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicWellLogPlotCurveFeatureImpl.h
|
||||||
|
|
||||||
|
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
|
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
|
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
|
||||||
@ -106,6 +108,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicWellLogPlotCurveFeatureImpl.cpp
|
||||||
|
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
|
||||||
|
@ -73,11 +73,16 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
|
|||||||
wellLog->firstAnchestorOrThisOfType(lasFileInfo);
|
wellLog->firstAnchestorOrThisOfType(lasFileInfo);
|
||||||
if (lasFileInfo)
|
if (lasFileInfo)
|
||||||
{
|
{
|
||||||
|
size_t curveIdx = plotTrace->curveCount();
|
||||||
|
|
||||||
RimWellLogFileCurve* curve = new RimWellLogFileCurve;
|
RimWellLogFileCurve* curve = new RimWellLogFileCurve;
|
||||||
plotTrace->addCurve(curve);
|
plotTrace->addCurve(curve);
|
||||||
|
|
||||||
curve->setCurveData(lasFileInfo->logValues(wellLog->name()), lasFileInfo->depthValues());
|
cvf::Color3f curveColor = curveColorFromIndex(curveIdx);
|
||||||
|
curve->setColor(curveColor);
|
||||||
curve->setDescription(wellLog->name());
|
curve->setDescription(wellLog->name());
|
||||||
|
curve->setCurveData(lasFileInfo->logValues(wellLog->name()), lasFileInfo->depthValues());
|
||||||
|
|
||||||
curve->updatePlotData();
|
curve->updatePlotData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ namespace caf
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RicAddWellLogToPlotFeature : public CmdFeature
|
class RicAddWellLogToPlotFeature : public CmdFeature, RicWellLogPlotCurveFeatureImpl
|
||||||
{
|
{
|
||||||
CAF_CMD_HEADER_INIT;
|
CAF_CMD_HEADER_INIT;
|
||||||
protected:
|
protected:
|
||||||
|
@ -25,41 +25,11 @@
|
|||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
#include "cafPdmFieldCvfColor.h"
|
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QColor>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
static const int RI_LOGPLOT_CURVECOLORSCOUNT = 15;
|
|
||||||
static const int RI_LOGPLOT_CURVECOLORS[] =
|
|
||||||
{
|
|
||||||
Qt::blue,
|
|
||||||
Qt::red,
|
|
||||||
Qt::green,
|
|
||||||
Qt::yellow,
|
|
||||||
Qt::magenta,
|
|
||||||
Qt::cyan,
|
|
||||||
Qt::gray,
|
|
||||||
Qt::darkBlue,
|
|
||||||
Qt::darkRed,
|
|
||||||
Qt::darkGreen,
|
|
||||||
Qt::darkYellow,
|
|
||||||
Qt::darkMagenta,
|
|
||||||
Qt::darkCyan,
|
|
||||||
Qt::darkGray,
|
|
||||||
Qt::black
|
|
||||||
};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
/// Pick default curve color from an index based palette
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
static QColor sg_curveColorFromIndex(size_t curveIndex)
|
|
||||||
{
|
|
||||||
return QColor(Qt::GlobalColor(RI_LOGPLOT_CURVECOLORS[curveIndex % RI_LOGPLOT_CURVECOLORSCOUNT]));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicNewWellLogPlotCurveFeature, "RicNewWellLogPlotCurveFeature");
|
CAF_CMD_SOURCE_INIT(RicNewWellLogPlotCurveFeature, "RicNewWellLogPlotCurveFeature");
|
||||||
|
|
||||||
@ -113,8 +83,7 @@ void RicNewWellLogPlotCurveFeature::addCurve(RimWellLogPlotTrace* plotTrace)
|
|||||||
RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve();
|
RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve();
|
||||||
plotTrace->addCurve(curve);
|
plotTrace->addCurve(curve);
|
||||||
|
|
||||||
QColor curveColorQt = sg_curveColorFromIndex(curveIndex);
|
cvf::Color3f curveColor = curveColorFromIndex(curveIndex);
|
||||||
cvf::Color3f curveColor(curveColorQt.redF(), curveColorQt.greenF(), curveColorQt.blueF());
|
|
||||||
curve->setColor(curveColor);
|
curve->setColor(curveColor);
|
||||||
|
|
||||||
curve->setDescription(QString("Curve %1").arg(plotTrace->curveCount()));
|
curve->setDescription(QString("Curve %1").arg(plotTrace->curveCount()));
|
||||||
|
@ -20,13 +20,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
||||||
|
|
||||||
class RimWellLogPlotTrace;
|
class RimWellLogPlotTrace;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RicNewWellLogPlotCurveFeature : public caf::CmdFeature
|
class RicNewWellLogPlotCurveFeature : public caf::CmdFeature, RicWellLogPlotCurveFeatureImpl
|
||||||
{
|
{
|
||||||
CAF_CMD_HEADER_INIT;
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
53
ApplicationCode/Commands/RicWellLogPlotCurveFeatureImpl.cpp
Normal file
53
ApplicationCode/Commands/RicWellLogPlotCurveFeatureImpl.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicWellLogPlotCurveFeatureImpl.h"
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
|
||||||
|
static const int RI_LOGPLOT_CURVECOLORSCOUNT = 15;
|
||||||
|
static const int RI_LOGPLOT_CURVECOLORS[] =
|
||||||
|
{
|
||||||
|
Qt::blue,
|
||||||
|
Qt::red,
|
||||||
|
Qt::green,
|
||||||
|
Qt::yellow,
|
||||||
|
Qt::magenta,
|
||||||
|
Qt::cyan,
|
||||||
|
Qt::gray,
|
||||||
|
Qt::darkBlue,
|
||||||
|
Qt::darkRed,
|
||||||
|
Qt::darkGreen,
|
||||||
|
Qt::darkYellow,
|
||||||
|
Qt::darkMagenta,
|
||||||
|
Qt::darkCyan,
|
||||||
|
Qt::darkGray,
|
||||||
|
Qt::black
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Pick default curve color from an index based palette
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::Color3f RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(size_t curveIndex)
|
||||||
|
{
|
||||||
|
QColor color = QColor(Qt::GlobalColor(RI_LOGPLOT_CURVECOLORS[curveIndex % RI_LOGPLOT_CURVECOLORSCOUNT]));
|
||||||
|
|
||||||
|
cvf::Color3f cvfColor(color.redF(), color.greenF(), color.blueF());
|
||||||
|
return cvfColor;
|
||||||
|
}
|
32
ApplicationCode/Commands/RicWellLogPlotCurveFeatureImpl.h
Normal file
32
ApplicationCode/Commands/RicWellLogPlotCurveFeatureImpl.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "cafPdmFieldCvfColor.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicWellLogPlotCurveFeatureImpl
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static cvf::Color3f curveColorFromIndex(size_t curveIndex);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user