。
This commit is contained in:
@@ -732,6 +732,10 @@ classdef EDFMAppController < handle
|
||||
metricItems = obj.buildMetricItems();
|
||||
propertyItems = obj.buildPropertyItems(actionId);
|
||||
[stepMin, stepMax, stepValue] = obj.buildTimeStepRange(actionId);
|
||||
selectedLayer = obj.pickValidItem(obj.getDropDownValue('PlotLayerDropDown', layerItems{1}), layerItems);
|
||||
selectedWell = obj.pickValidItem(obj.getDropDownValue('PlotWellDropDown', wellItems{1}), wellItems);
|
||||
selectedMetric = obj.pickValidItem(obj.getDropDownValue('PlotMetricDropDown', metricItems{1}), metricItems);
|
||||
selectedProperty = obj.pickValidItem(obj.getDropDownValue('PlotPropertyDropDown', propertyItems{1}), propertyItems);
|
||||
|
||||
obj.setControlVisible('PlotLayerDropDown', ismember(actionId, ["plot_2d_layer", "plot_sp_dp", "plot_perm"]));
|
||||
obj.setControlVisible('PlotLayerDropDownLabel', ismember(actionId, ["plot_2d_layer", "plot_sp_dp", "plot_perm"]));
|
||||
@@ -745,10 +749,10 @@ classdef EDFMAppController < handle
|
||||
obj.setControlVisible('PlotMetricDropDown', actionId == "plot_well_response");
|
||||
obj.setControlVisible('PlotMetricDropDownLabel', actionId == "plot_well_response");
|
||||
|
||||
obj.setDropDownItems('PlotLayerDropDown', layerItems, layerItems{1});
|
||||
obj.setDropDownItems('PlotWellDropDown', wellItems, wellItems{1});
|
||||
obj.setDropDownItems('PlotMetricDropDown', metricItems, metricItems{1});
|
||||
obj.setDropDownItems('PlotPropertyDropDown', propertyItems, propertyItems{1});
|
||||
obj.setDropDownItems('PlotLayerDropDown', layerItems, selectedLayer);
|
||||
obj.setDropDownItems('PlotWellDropDown', wellItems, selectedWell);
|
||||
obj.setDropDownItems('PlotMetricDropDown', metricItems, selectedMetric);
|
||||
obj.setDropDownItems('PlotPropertyDropDown', propertyItems, selectedProperty);
|
||||
obj.configureTimeStepControl(stepMin, stepMax, stepValue);
|
||||
end
|
||||
|
||||
@@ -805,10 +809,16 @@ classdef EDFMAppController < handle
|
||||
function configureTimeStepControl(obj, minValue, maxValue, currentValue)
|
||||
if isprop(obj.App, 'PlotTimeStepSlider')
|
||||
slider = obj.App.PlotTimeStepSlider;
|
||||
slider.Limits = [minValue, maxValue];
|
||||
slider.MajorTicks = minValue:maxValue;
|
||||
if ~(isfinite(minValue) && isfinite(maxValue)) || maxValue <= minValue
|
||||
slider.Limits = [1, 2];
|
||||
slider.MajorTicks = [1, 2];
|
||||
slider.Value = 1;
|
||||
else
|
||||
slider.Limits = [minValue, maxValue];
|
||||
slider.MajorTicks = obj.buildSparseTicks(minValue, maxValue);
|
||||
slider.Value = currentValue;
|
||||
end
|
||||
slider.MinorTicks = [];
|
||||
slider.Value = currentValue;
|
||||
end
|
||||
if isprop(obj.App, 'PlotTimeStepValueLabel')
|
||||
obj.App.PlotTimeStepValueLabel.Text = sprintf('Step: %d', currentValue);
|
||||
@@ -1024,7 +1034,37 @@ classdef EDFMAppController < handle
|
||||
if ismember(actionId, ["plot_2d_layer", "plot_3d_distribution"]) ...
|
||||
&& isfield(obj.Results, 'OutputRs') && ~isempty(obj.Results.OutputRs)
|
||||
maxValue = numel(obj.Results.OutputRs);
|
||||
currentValue = maxValue;
|
||||
currentValue = obj.getTimeStepControlValue();
|
||||
currentValue = min(max(currentValue, minValue), maxValue);
|
||||
end
|
||||
end
|
||||
|
||||
function value = pickValidItem(~, candidate, items)
|
||||
if isempty(items)
|
||||
value = '';
|
||||
return;
|
||||
end
|
||||
candidate = char(string(candidate));
|
||||
if any(strcmp(items, candidate))
|
||||
value = candidate;
|
||||
else
|
||||
value = items{1};
|
||||
end
|
||||
end
|
||||
|
||||
function ticks = buildSparseTicks(~, minValue, maxValue)
|
||||
if maxValue <= minValue
|
||||
ticks = minValue;
|
||||
return;
|
||||
end
|
||||
|
||||
tickCount = min(6, maxValue - minValue + 1);
|
||||
ticks = unique(round(linspace(minValue, maxValue, tickCount)));
|
||||
if ticks(1) ~= minValue
|
||||
ticks = [minValue, ticks];
|
||||
end
|
||||
if ticks(end) ~= maxValue
|
||||
ticks = [ticks, maxValue];
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user