23
23
#include " RimReservoirView.h"
24
24
#include " RigReservoir.h"
25
25
26
+ #include " cafPdmUiSliderEditor.h"
27
+
26
28
27
29
CAF_PDM_SOURCE_INIT (RimCellRangeFilter, " CellRangeFilter" );
28
30
@@ -35,13 +37,24 @@ RimCellRangeFilter::RimCellRangeFilter()
35
37
CAF_PDM_InitObject (" Cell Range Filter" , " :/CellFilter_Range.png" , " " , " " );
36
38
37
39
CAF_PDM_InitField (&startIndexI, " StartIndexI" , 1 , " Start index I" , " " , " " ," " );
40
+ startIndexI.setUiEditorTypeName (caf::PdmUiSliderEditor::uiEditorTypeName ());
41
+
38
42
CAF_PDM_InitField (&cellCountI, " CellCountI" , 1 , " Cell Count I" , " " , " " ," " );
43
+ cellCountI.setUiEditorTypeName (caf::PdmUiSliderEditor::uiEditorTypeName ());
44
+
39
45
CAF_PDM_InitField (&startIndexJ, " StartIndexJ" , 1 , " Start index J" , " " , " " ," " );
46
+ startIndexJ.setUiEditorTypeName (caf::PdmUiSliderEditor::uiEditorTypeName ());
47
+
40
48
CAF_PDM_InitField (&cellCountJ, " CellCountJ" , 1 , " Cell Count J" , " " , " " ," " );
49
+ cellCountJ.setUiEditorTypeName (caf::PdmUiSliderEditor::uiEditorTypeName ());
50
+
41
51
CAF_PDM_InitField (&startIndexK, " StartIndexK" , 1 , " Start index K" , " " , " " ," " );
52
+ startIndexK.setUiEditorTypeName (caf::PdmUiSliderEditor::uiEditorTypeName ());
53
+
42
54
CAF_PDM_InitField (&cellCountK, " CellCountK" , 1 , " Cell Count K" , " " , " " ," " );
55
+ cellCountK.setUiEditorTypeName (caf::PdmUiSliderEditor::uiEditorTypeName ());
56
+
43
57
updateIconState ();
44
-
45
58
}
46
59
47
60
// --------------------------------------------------------------------------------------------------
@@ -118,22 +131,11 @@ void RimCellRangeFilter::setDefaultValues()
118
131
max.z () = max.z () + 1 ;
119
132
120
133
startIndexI = min.x ();
121
- startIndexI.setUiName (QString (" I Start (%1)" ).arg (min.x ()));
122
-
123
134
startIndexJ = min.y ();
124
- startIndexJ.setUiName (QString (" J Start (%1)" ).arg (min.y ()));
125
-
126
135
startIndexK = min.z ();
127
- startIndexK.setUiName (QString (" K Start (%1)" ).arg (min.z ()));
128
-
129
136
cellCountI = max.x () - min.x () + 1 ;
130
- cellCountI.setUiName (QString (" Width (%1)" ).arg (max.x () - min.x () + 1 ));
131
-
132
137
cellCountJ = max.y () - min.y () + 1 ;
133
- cellCountJ.setUiName (QString (" Width (%1)" ).arg (max.y () - min.y () + 1 ));
134
-
135
138
cellCountK = max.z () - min.z () + 1 ;
136
- cellCountK.setUiName (QString (" Width (%1)" ).arg (max.z () - min.z () + 1 ));
137
139
}
138
140
}
139
141
@@ -145,3 +147,54 @@ RimCellRangeFilterCollection* RimCellRangeFilter::parentContainer()
145
147
return m_parentContainer;
146
148
}
147
149
150
+ // --------------------------------------------------------------------------------------------------
151
+ // /
152
+ // --------------------------------------------------------------------------------------------------
153
+ void RimCellRangeFilter::defineEditorAttribute (const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
154
+ {
155
+ caf::PdmUiSliderEditorAttribute* myAttr = static_cast <caf::PdmUiSliderEditorAttribute*>(attribute);
156
+ if (!myAttr || !m_parentContainer)
157
+ {
158
+ return ;
159
+ }
160
+
161
+ RigMainGrid* mainGrid = m_parentContainer->mainGrid ();
162
+ if (mainGrid)
163
+ {
164
+ cvf::Vec3st min, max;
165
+ mainGrid->activeCellsBoundingBox (min, max);
166
+
167
+ // Adjust to Eclipse indexing
168
+ min.x () = min.x () + 1 ;
169
+ min.y () = min.y () + 1 ;
170
+ min.z () = min.z () + 1 ;
171
+
172
+ max.x () = max.x () + 1 ;
173
+ max.y () = max.y () + 1 ;
174
+ max.z () = max.z () + 1 ;
175
+
176
+ startIndexI.setUiName (QString (" I Start (%1)" ).arg (min.x ()));
177
+ startIndexJ.setUiName (QString (" J Start (%1)" ).arg (min.y ()));
178
+ startIndexK.setUiName (QString (" K Start (%1)" ).arg (min.z ()));
179
+ cellCountI.setUiName (QString (" Width (%1)" ).arg (max.x () - min.x () + 1 ));
180
+ cellCountJ.setUiName (QString (" Width (%1)" ).arg (max.y () - min.y () + 1 ));
181
+ cellCountK.setUiName (QString (" Width (%1)" ).arg (max.z () - min.z () + 1 ));
182
+
183
+ if (field == &startIndexI || field == &cellCountI)
184
+ {
185
+ myAttr->m_minimum = 1 ;
186
+ myAttr->m_maximum = mainGrid->cellCountI ();
187
+ }
188
+ else if (field == &startIndexJ || field == &cellCountJ)
189
+ {
190
+ myAttr->m_minimum = 1 ;
191
+ myAttr->m_maximum = mainGrid->cellCountJ ();
192
+ }
193
+ else if (field == &startIndexK || field == &cellCountK)
194
+ {
195
+ myAttr->m_minimum = 1 ;
196
+ myAttr->m_maximum = mainGrid->cellCountK ();
197
+ }
198
+ }
199
+ }
200
+
0 commit comments