2015-09-15 08:58:22 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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"
|
|
|
|
|
2017-02-07 02:34:11 -06:00
|
|
|
#include "RimWellAllocationPlot.h"
|
2016-12-17 09:29:36 -06:00
|
|
|
#include "RimWellLogCurve.h"
|
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
2015-09-15 08:58:22 -05:00
|
|
|
#include <QColor>
|
|
|
|
|
|
|
|
static const int RI_LOGPLOT_CURVECOLORSCOUNT = 15;
|
|
|
|
static const int RI_LOGPLOT_CURVECOLORS[] =
|
|
|
|
{
|
2015-10-31 17:35:18 -05:00
|
|
|
Qt::black,
|
2015-09-15 08:58:22 -05:00
|
|
|
Qt::darkBlue,
|
|
|
|
Qt::darkRed,
|
|
|
|
Qt::darkGreen,
|
|
|
|
Qt::darkYellow,
|
|
|
|
Qt::darkMagenta,
|
|
|
|
Qt::darkCyan,
|
|
|
|
Qt::darkGray,
|
2015-10-31 17:35:18 -05:00
|
|
|
Qt::blue,
|
|
|
|
Qt::red,
|
|
|
|
Qt::green,
|
|
|
|
Qt::yellow,
|
|
|
|
Qt::magenta,
|
|
|
|
Qt::cyan,
|
|
|
|
Qt::gray
|
2015-09-15 08:58:22 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Pick default curve color from an index based palette
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-10-31 17:35:18 -05:00
|
|
|
cvf::Color3f RicWellLogPlotCurveFeatureImpl::curveColorFromTable()
|
2015-09-15 08:58:22 -05:00
|
|
|
{
|
2015-10-31 17:35:18 -05:00
|
|
|
static int colorIndex = 0;
|
|
|
|
QColor color = QColor(Qt::GlobalColor(RI_LOGPLOT_CURVECOLORS[colorIndex % RI_LOGPLOT_CURVECOLORSCOUNT]));
|
|
|
|
++colorIndex;
|
2015-09-15 08:58:22 -05:00
|
|
|
cvf::Color3f cvfColor(color.redF(), color.greenF(), color.blueF());
|
|
|
|
return cvfColor;
|
|
|
|
}
|
2016-12-17 09:29:36 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<RimWellLogCurve*> RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves()
|
|
|
|
{
|
|
|
|
std::set<RimWellLogCurve*> curveSet;
|
|
|
|
|
|
|
|
{
|
|
|
|
std::vector<caf::PdmUiItem*> selectedItems;
|
|
|
|
caf::SelectionManager::instance()->selectedItems(selectedItems);
|
|
|
|
|
|
|
|
for (caf::PdmUiItem* selectedItem : selectedItems)
|
|
|
|
{
|
|
|
|
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(selectedItem);
|
|
|
|
if (objHandle)
|
|
|
|
{
|
|
|
|
std::vector<RimWellLogCurve*> childCurves;
|
|
|
|
objHandle->descendantsIncludingThisOfType(childCurves);
|
|
|
|
|
|
|
|
for (RimWellLogCurve* curve : childCurves)
|
|
|
|
{
|
|
|
|
curveSet.insert(curve);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<RimWellLogCurve*> allCurves;
|
|
|
|
for (RimWellLogCurve* curve : curveSet)
|
|
|
|
{
|
|
|
|
allCurves.push_back(curve);
|
|
|
|
}
|
|
|
|
|
|
|
|
return allCurves;
|
|
|
|
}
|
2017-02-07 02:34:11 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellAllocationPlot* RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()
|
|
|
|
{
|
|
|
|
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
|
|
|
|
if (!destinationObject) return nullptr;
|
|
|
|
|
|
|
|
RimWellAllocationPlot* wellAllocationPlot = nullptr;
|
|
|
|
destinationObject->firstAncestorOrThisOfType(wellAllocationPlot);
|
|
|
|
|
|
|
|
return wellAllocationPlot;
|
|
|
|
}
|