This commit is contained in:
kk
2026-03-22 22:07:52 +08:00
parent b2d1787972
commit f3407af852
4 changed files with 84 additions and 16 deletions
Binary file not shown.
+48 -8
View File
@@ -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
Binary file not shown.
+36 -8
View File
@@ -497,42 +497,66 @@ classdef EDFM_Simulator_App < matlab.apps.AppBase
% Button pushed function: AddWell1RowButton
function AddWell1RowButtonPushed(app, event)
app.Controller.addTableRow('Well1Table');
end
% Button pushed function: DeleteWell1RowButton
function DeleteWell1RowButtonPushed(app, event)
app.Controller.deleteSelectedTableRow('Well1Table');
end
% Button pushed function: AddWell2RowButton
function AddWell2RowButtonPushed(app, event)
app.Controller.addTableRow('Well2Table');
end
% Button pushed function: DeleteWell2RowButton
function DeleteWell2RowButtonPushed(app, event)
app.Controller.deleteSelectedTableRow('Well2Table');
end
% Button pushed function: AddFracLocRowButton
function AddFracLocRowButtonPushed(app, event)
app.Controller.addTableRow('FractureWellLocationTable');
end
% Button pushed function: DeleteFracLocRowButton
function DeleteFracLocRowButtonPushed(app, event)
app.Controller.deleteSelectedTableRow('FractureWellLocationTable');
end
% Button pushed function: AddScheduleRowButton
function AddScheduleRowButtonPushed(app, event)
app.Controller.addTableRow('ScheduleTable');
end
% Button pushed function: DeleteScheduleRowButton
function DeleteScheduleRowButtonPushed(app, event)
app.Controller.deleteSelectedTableRow('ScheduleTable');
end
% Cell selection callback: Well1Table
function Well1TableCellSelection(app, event)
indices = event.Indices;
app.Controller.onTableSelectionChanged('Well1Table', event.Indices);
end
% Cell selection callback: Well2Table
function Well2TableCellSelection(app, event)
indices = event.Indices;
app.Controller.onTableSelectionChanged('Well2Table', event.Indices);
end
% Cell selection callback: FractureWellLocationTable
function FractureWellLocationTableCellSelection(app, event)
indices = event.Indices;
app.Controller.onTableSelectionChanged('FractureWellLocationTable', event.Indices);
end
% Cell selection callback: ScheduleTable
function ScheduleTableCellSelection(app, event)
indices = event.Indices;
app.Controller.onTableSelectionChanged('ScheduleTable', event.Indices);
end
end
@@ -2094,6 +2118,7 @@ classdef EDFM_Simulator_App < matlab.apps.AppBase
app.Well1Table.ColumnName = {'Well1'};
app.Well1Table.RowName = {};
app.Well1Table.ColumnEditable = true;
app.Well1Table.CellSelectionCallback = createCallbackFcn(app, @Well1TableCellSelection, true);
app.Well1Table.Position = [35 475 372 185];
% Create FractureWellLocationTable
@@ -2101,6 +2126,7 @@ classdef EDFM_Simulator_App < matlab.apps.AppBase
app.FractureWellLocationTable.ColumnName = {'FractureWellLocation'};
app.FractureWellLocationTable.RowName = {};
app.FractureWellLocationTable.ColumnEditable = true;
app.FractureWellLocationTable.CellSelectionCallback = createCallbackFcn(app, @FractureWellLocationTableCellSelection, true);
app.FractureWellLocationTable.Position = [44 179 366 185];
% Create Well2Table
@@ -2108,6 +2134,7 @@ classdef EDFM_Simulator_App < matlab.apps.AppBase
app.Well2Table.ColumnName = {'Well2'};
app.Well2Table.RowName = {};
app.Well2Table.ColumnEditable = true;
app.Well2Table.CellSelectionCallback = createCallbackFcn(app, @Well2TableCellSelection, true);
app.Well2Table.Position = [693 472 353 185];
% Create ScheduleTable
@@ -2115,6 +2142,7 @@ classdef EDFM_Simulator_App < matlab.apps.AppBase
app.ScheduleTable.ColumnName = {'Schedule'};
app.ScheduleTable.RowName = {};
app.ScheduleTable.ColumnEditable = true;
app.ScheduleTable.CellSelectionCallback = createCallbackFcn(app, @ScheduleTableCellSelection, true);
app.ScheduleTable.Position = [701 177 362 185];
% Create TimeTextAreaLabel