@@ -126,33 +126,64 @@ bool ClassFlowTakeImage::ReadParameter(FILE *pfile, string &aktparamgraph)
126
126
else if ((toUpper (splitted[0 ]) == " CAMGAINCEILING" ) && (splitted.size () > 1 ))
127
127
{
128
128
std::string _ImageGainceiling = toUpper (splitted[1 ]);
129
- if (_ImageGainceiling == " X4" )
130
- {
131
- CCstatus.ImageGainceiling = GAINCEILING_4X;
132
- }
133
- else if (_ImageGainceiling == " X8" )
134
- {
135
- CCstatus.ImageGainceiling = GAINCEILING_8X;
136
- }
137
- else if (_ImageGainceiling == " X16" )
138
- {
139
- CCstatus.ImageGainceiling = GAINCEILING_16X;
140
- }
141
- else if (_ImageGainceiling == " X32" )
142
- {
143
- CCstatus.ImageGainceiling = GAINCEILING_32X;
144
- }
145
- else if (_ImageGainceiling == " X64" )
146
- {
147
- CCstatus.ImageGainceiling = GAINCEILING_64X;
148
- }
149
- else if (_ImageGainceiling == " X128" )
129
+
130
+ if (isStringNumeric (_ImageGainceiling))
150
131
{
151
- CCstatus.ImageGainceiling = GAINCEILING_128X;
132
+ int _ImageGainceiling_ = std::stoi (_ImageGainceiling);
133
+ switch (_ImageGainceiling_)
134
+ {
135
+ case 1 :
136
+ CFstatus.ImageGainceiling = GAINCEILING_4X;
137
+ break ;
138
+ case 2 :
139
+ CFstatus.ImageGainceiling = GAINCEILING_8X;
140
+ break ;
141
+ case 3 :
142
+ CFstatus.ImageGainceiling = GAINCEILING_16X;
143
+ break ;
144
+ case 4 :
145
+ CFstatus.ImageGainceiling = GAINCEILING_32X;
146
+ break ;
147
+ case 5 :
148
+ CFstatus.ImageGainceiling = GAINCEILING_64X;
149
+ break ;
150
+ case 6 :
151
+ CFstatus.ImageGainceiling = GAINCEILING_128X;
152
+ break ;
153
+ default :
154
+ CFstatus.ImageGainceiling = GAINCEILING_2X;
155
+ }
152
156
}
153
157
else
154
158
{
155
- CCstatus.ImageGainceiling = GAINCEILING_2X;
159
+ if (_ImageGainceiling == " X4" )
160
+ {
161
+ CCstatus.ImageGainceiling = GAINCEILING_4X;
162
+ }
163
+ else if (_ImageGainceiling == " X8" )
164
+ {
165
+ CCstatus.ImageGainceiling = GAINCEILING_8X;
166
+ }
167
+ else if (_ImageGainceiling == " X16" )
168
+ {
169
+ CCstatus.ImageGainceiling = GAINCEILING_16X;
170
+ }
171
+ else if (_ImageGainceiling == " X32" )
172
+ {
173
+ CCstatus.ImageGainceiling = GAINCEILING_32X;
174
+ }
175
+ else if (_ImageGainceiling == " X64" )
176
+ {
177
+ CCstatus.ImageGainceiling = GAINCEILING_64X;
178
+ }
179
+ else if (_ImageGainceiling == " X128" )
180
+ {
181
+ CCstatus.ImageGainceiling = GAINCEILING_128X;
182
+ }
183
+ else
184
+ {
185
+ CCstatus.ImageGainceiling = GAINCEILING_2X;
186
+ }
156
187
}
157
188
}
158
189
@@ -216,58 +247,76 @@ bool ClassFlowTakeImage::ReadParameter(FILE *pfile, string &aktparamgraph)
216
247
else if ((toUpper (splitted[0 ]) == " CAMSPECIALEFFECT" ) && (splitted.size () > 1 ))
217
248
{
218
249
std::string _ImageSpecialEffect = toUpper (splitted[1 ]);
219
- if (_ImageSpecialEffect == " NEGATIVE" )
220
- {
221
- CCstatus.ImageSpecialEffect = 1 ;
222
- }
223
- else if (_ImageSpecialEffect == " GRAYSCALE" )
224
- {
225
- CCstatus.ImageSpecialEffect = 2 ;
226
- }
227
- else if (_ImageSpecialEffect == " RED" )
228
- {
229
- CCstatus.ImageSpecialEffect = 3 ;
230
- }
231
- else if (_ImageSpecialEffect == " GREEN" )
232
- {
233
- CCstatus.ImageSpecialEffect = 4 ;
234
- }
235
- else if (_ImageSpecialEffect == " BLUE" )
236
- {
237
- CCstatus.ImageSpecialEffect = 5 ;
238
- }
239
- else if (_ImageSpecialEffect == " RETRO" )
250
+
251
+ if (isStringNumeric (_ImageSpecialEffect))
240
252
{
241
- CCstatus.ImageSpecialEffect = 6 ;
253
+ int _ImageSpecialEffect_ = std::stoi (_ImageSpecialEffect);
254
+ CFstatus.ImageSpecialEffect = clipInt (_ImageSpecialEffect_, 6 , 0 );
242
255
}
243
256
else
244
257
{
245
- CCstatus.ImageSpecialEffect = 0 ;
258
+ if (_ImageSpecialEffect == " NEGATIVE" )
259
+ {
260
+ CCstatus.ImageSpecialEffect = 1 ;
261
+ }
262
+ else if (_ImageSpecialEffect == " GRAYSCALE" )
263
+ {
264
+ CCstatus.ImageSpecialEffect = 2 ;
265
+ }
266
+ else if (_ImageSpecialEffect == " RED" )
267
+ {
268
+ CCstatus.ImageSpecialEffect = 3 ;
269
+ }
270
+ else if (_ImageSpecialEffect == " GREEN" )
271
+ {
272
+ CCstatus.ImageSpecialEffect = 4 ;
273
+ }
274
+ else if (_ImageSpecialEffect == " BLUE" )
275
+ {
276
+ CCstatus.ImageSpecialEffect = 5 ;
277
+ }
278
+ else if (_ImageSpecialEffect == " RETRO" )
279
+ {
280
+ CCstatus.ImageSpecialEffect = 6 ;
281
+ }
282
+ else
283
+ {
284
+ CCstatus.ImageSpecialEffect = 0 ;
285
+ }
246
286
}
247
287
}
248
288
249
289
else if ((toUpper (splitted[0 ]) == " CAMWBMODE" ) && (splitted.size () > 1 ))
250
290
{
251
291
std::string _ImageWbMode = toUpper (splitted[1 ]);
252
- if (_ImageWbMode == " SUNNY" )
253
- {
254
- CCstatus.ImageWbMode = 1 ;
255
- }
256
- else if (_ImageWbMode == " CLOUDY" )
257
- {
258
- CCstatus.ImageWbMode = 2 ;
259
- }
260
- else if (_ImageWbMode == " OFFICE" )
261
- {
262
- CCstatus.ImageWbMode = 3 ;
263
- }
264
- else if (_ImageWbMode == " HOME" )
292
+
293
+ if (isStringNumeric (_ImageWbMode))
265
294
{
266
- CCstatus.ImageWbMode = 4 ;
295
+ int _ImageWbMode_ = std::stoi (_ImageWbMode);
296
+ CFstatus.ImageWbMode = clipInt (_ImageWbMode_, 4 , 0 );
267
297
}
268
298
else
269
299
{
270
- CCstatus.ImageWbMode = 0 ;
300
+ if (_ImageWbMode == " SUNNY" )
301
+ {
302
+ CCstatus.ImageWbMode = 1 ;
303
+ }
304
+ else if (_ImageWbMode == " CLOUDY" )
305
+ {
306
+ CCstatus.ImageWbMode = 2 ;
307
+ }
308
+ else if (_ImageWbMode == " OFFICE" )
309
+ {
310
+ CCstatus.ImageWbMode = 3 ;
311
+ }
312
+ else if (_ImageWbMode == " HOME" )
313
+ {
314
+ CCstatus.ImageWbMode = 4 ;
315
+ }
316
+ else
317
+ {
318
+ CCstatus.ImageWbMode = 0 ;
319
+ }
271
320
}
272
321
}
273
322
0 commit comments