#3104 More sensible variable width for users: drop down list of narrow, normal, wide, etc.

This commit is contained in:
Gaute Lindkvist 2018-06-26 16:23:06 +02:00
parent 6ae2fbe9d3
commit 20a145d760
4 changed files with 49 additions and 20 deletions

View File

@ -33,6 +33,7 @@
#include "RiuWellLogPlot.h"
#include "RiuWellLogTrack.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cvfAssert.h"
#include <math.h>
@ -79,9 +80,10 @@ RimWellLogPlot::RimWellLogPlot()
CAF_PDM_InitField(&m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "");
CAF_PDM_InitField(&m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "");
m_isAutoScaleDepthEnabled.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_showTitleInPlot, "ShowTitleInPlot", false, "Show Title in Plot", "", "", "");
CAF_PDM_InitField(&m_showTitleInPlot, "ShowTitleInPlot", false, "Show Title", "", "", "");
CAF_PDM_InitField(&m_showTrackLegends, "ShowTrackLegends", true, "Show Legends", "", "", "");
CAF_PDM_InitField(&m_trackLegendsHorizontal, "TrackLegendsHorizontal", false, "Horizontal Legends", "", "", "");
CAF_PDM_InitField(&m_trackLegendsHorizontal, "TrackLegendsHorizontal", false, "Legend Orientation", "", "", "");
m_trackLegendsHorizontal.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", "");
m_tracks.uiCapability()->setUiHidden(true);
@ -191,6 +193,11 @@ QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions(const caf::P
options.push_back(caf::PdmOptionItemInfo(UnitAppEnum::uiText(RiaDefines::UNIT_METER), RiaDefines::UNIT_METER));
options.push_back(caf::PdmOptionItemInfo(UnitAppEnum::uiText(RiaDefines::UNIT_FEET), RiaDefines::UNIT_FEET));
}
else if (fieldNeedingOptions == &m_trackLegendsHorizontal)
{
options.push_back(caf::PdmOptionItemInfo("Vertical", false));
options.push_back(caf::PdmOptionItemInfo("Horizontal", true));
}
(*useOptionsOnly) = true;
return options;
@ -607,8 +614,8 @@ void RimWellLogPlot::depthZoomMinMax(double* minimumDepth, double* maximumDepth)
void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_userName);
uiOrderingForPlotSettings(uiOrdering);
uiOrderingForDepthAxis(uiOrdering);
uiOrderingForPlotSettings(uiOrdering);
uiOrdering.skipRemainingFields(true);
}

View File

@ -104,6 +104,17 @@ namespace caf
addItem(RigWellPathFormations::LEVEL10, "LEVEL10", "Formation 10");
setDefault(RigWellPathFormations::ALL);
}
template<>
void AppEnum< RimWellLogTrack::WidthScaleFactor >::setUp()
{
addItem(RimWellLogTrack::EXTRA_NARROW_TRACK, "EXTRA_NARROW_TRACK", "Extra Narrow");
addItem(RimWellLogTrack::NARROW_TRACK, "NARROW_TRACK", "Narrow");
addItem(RimWellLogTrack::NORMAL_TRACK, "NORMAL_TRACK", "Normal");
addItem(RimWellLogTrack::WIDE_TRACK, "WIDE_TRACK", "Wide");
addItem(RimWellLogTrack::EXTRA_WIDE_TRACK, "EXTRA_WIDE_TRACK", "Extra wide");
setDefault(RimWellLogTrack::NORMAL_TRACK);
}
}
@ -155,7 +166,7 @@ RimWellLogTrack::RimWellLogTrack()
CAF_PDM_InitField(&m_showformationFluids, "ShowFormationFluids", false, "Show Fluids", "", "", "");
CAF_PDM_InitField(&m_widthScaleFactor, "WidthScaleFactor", 1, "Width", "", "Set width of track. ", "");
CAF_PDM_InitFieldNoDefault(&m_widthScaleFactor, "Width", "Track Width", "", "Set width of track. ", "");
m_formationsForCaseWithSimWellOnly = false;
}
@ -227,11 +238,6 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
}
else if (changedField == &m_widthScaleFactor)
{
if (m_widthScaleFactor < 1 && m_widthScaleFactor > 10)
{
m_widthScaleFactor = cvf::Math::clamp(m_widthScaleFactor(), 1, 10);
updateEditors();
}
updateParentPlotLayout();
}
@ -661,13 +667,13 @@ QString RimWellLogTrack::depthPlotTitle() const
//--------------------------------------------------------------------------------------------------
int RimWellLogTrack::widthScaleFactor() const
{
return m_widthScaleFactor();
return static_cast<int>(m_widthScaleFactor());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setWidthScaleFactor(int scaleFactor)
void RimWellLogTrack::setWidthScaleFactor(WidthScaleFactor scaleFactor)
{
m_widthScaleFactor = scaleFactor;
}
@ -898,10 +904,6 @@ RimWellLogCurve* RimWellLogTrack::curveDefinitionFromCurve(const QwtPlotCurve* c
void RimWellLogTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_userName);
// Hidden option that may still be useful for testing: enables you to control the width of tracks.
#ifdef ENABLE_WIDTHWEIGHT_GUI
uiOrdering.add(&m_widthScaleFactor);
#endif
caf::PdmUiGroup* formationGroup = uiOrdering.addNewGroup("Zonation/Formation Names");
formationGroup->add(&m_showFormations);
@ -951,6 +953,9 @@ void RimWellLogTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrderingForVisibleXRange(uiOrdering);
caf::PdmUiGroup* trackSettingsGroup = uiOrdering.addNewGroup("Track Settings");
trackSettingsGroup->add(&m_widthScaleFactor);
uiOrdering.skipRemainingFields(true);
}

View File

@ -70,6 +70,7 @@ public:
enum TrajectoryType { WELL_PATH, SIMULATION_WELL };
enum FormationSource { CASE, WELL_PICK_FILTER };
enum WidthScaleFactor { EXTRA_NARROW_TRACK = 2, NARROW_TRACK = 3, NORMAL_TRACK = 4, WIDE_TRACK = 6, EXTRA_WIDE_TRACK = 8};
void setDescription(const QString& description);
bool isVisible();
@ -83,7 +84,7 @@ public:
void setXAxisTitle(const QString& text);
QString depthPlotTitle() const;
int widthScaleFactor() const;
void setWidthScaleFactor(int scaleFactor);
void setWidthScaleFactor(WidthScaleFactor scaleFactor);
void setFormationWellPath(RimWellPath* wellPath);
void setFormationSimWellName(const QString& simWellName);
@ -183,7 +184,7 @@ private:
caf::PdmField<int> m_formationBranchIndex;
caf::PdmField<caf::AppEnum<RigWellPathFormations::FormationLevel>> m_formationLevel;
caf::PdmField<bool> m_showformationFluids;
caf::PdmField<int> m_widthScaleFactor;
caf::PdmField<caf::AppEnum<WidthScaleFactor>> m_widthScaleFactor;
caf::PdmField<bool> m_formationBranchDetection;
bool m_formationsForCaseWithSimWellOnly;

View File

@ -324,9 +324,17 @@ std::map<int, int> RiuWellLogPlot::calculateTrackWidths(int frameWidth)
int trackCount = m_trackPlots.size();
int visibleTrackCount = 0;
int firstTrackAxisOffset = 0; // Account for first track having the y-axis labels and markers
for (int tIdx = 0; tIdx < trackCount; ++tIdx)
{
if (m_trackPlots[tIdx]->isVisible()) ++visibleTrackCount;
if (m_trackPlots[tIdx]->isVisible())
{
if (visibleTrackCount == 0)
{
firstTrackAxisOffset = static_cast<int>(m_trackPlots[tIdx]->plotLayout()->canvasRect().left());
}
++visibleTrackCount;
}
}
int scrollBarWidth = 0;
@ -336,8 +344,8 @@ std::map<int, int> RiuWellLogPlot::calculateTrackWidths(int frameWidth)
if (visibleTrackCount)
{
int totalTrackWidth = (frameWidth - scrollBarWidth);
int trackWidthExtra = (frameWidth - scrollBarWidth) % visibleTrackCount;
int totalTrackWidth = (frameWidth - firstTrackAxisOffset - scrollBarWidth);
int trackWidthExtra = (frameWidth - firstTrackAxisOffset - scrollBarWidth) % visibleTrackCount;
int totalWidthWeights = 0;
for (int tIdx = 0; tIdx < trackCount; ++tIdx)
@ -348,11 +356,19 @@ std::map<int, int> RiuWellLogPlot::calculateTrackWidths(int frameWidth)
}
}
bool firstVisible = true;
for (int tIdx = 0; tIdx < trackCount; ++tIdx)
{
if (m_trackPlots[tIdx]->isVisible())
{
int realTrackWidth = (totalTrackWidth * m_trackPlots[tIdx]->widthScaleFactor()) / totalWidthWeights;
if (firstVisible)
{
realTrackWidth += firstTrackAxisOffset;
firstVisible = false;
}
if (trackWidthExtra > 0)
{
realTrackWidth += 1;