26 #include "math-extension.hh"
32 using namespace GMap3d;
34 CParameterDart::CParameterDart(
int ANbSelectionLevels,
int ANbRef) :
36 FNbSelectionLevels(ANbSelectionLevels)
38 assert(FNbSelectionLevels>0);
40 FCLUnsel =
new float * [FNbSelectionLevels];
41 FCLSel =
new float * [FNbSelectionLevels];
42 FCLLastSel =
new float * [FNbSelectionLevels];
43 FCL0Remove =
new float * [FNbSelectionLevels];
44 FCL1Remove =
new float * [FNbSelectionLevels];
46 for (
int i=0; i<FNbSelectionLevels; ++i)
48 FCLUnsel[i] =
new float[3];
49 FCLSel[i] =
new float[3];
50 FCLLastSel[i] =
new float[3];
51 FCL0Remove[i] =
new float[3];
52 FCL1Remove[i] =
new float[3];
60 FNbSelectionLevels(AParam.FNbSelectionLevels),
61 FLWDarts (AParam.FLWDarts),
62 FSAloneDarts (AParam.FSAloneDarts)
64 assert(FNbSelectionLevels>0);
66 FCLUnsel =
new float * [FNbSelectionLevels];
67 FCLSel =
new float * [FNbSelectionLevels];
68 FCLLastSel =
new float * [FNbSelectionLevels];
69 FCL0Remove =
new float * [FNbSelectionLevels];
70 FCL1Remove =
new float * [FNbSelectionLevels];
72 for (
int i=0; i<FNbSelectionLevels; ++i)
74 FCLUnsel[i] =
new float[3];
77 FCLSel[i] =
new float[3];
80 FCLLastSel[i] =
new float[3];
83 FCL0Remove[i] =
new float[3];
86 FCL1Remove[i] =
new float[3];
93 for (
int i=0; i<FNbSelectionLevels; ++i)
95 delete [] FCLUnsel [i];
97 delete [] FCLLastSel[i];
98 delete [] FCL0Remove [i];
99 delete [] FCL1Remove [i];
104 delete [] FCLLastSel;
105 delete [] FCL0Remove;
106 delete [] FCL1Remove;
113 { AStream<<(*this); }
116 { AStream>>(*this); }
120 assert (FNbSelectionLevels>0);
148 if (FNbSelectionLevels==1)
return;
171 if (FNbSelectionLevels==2)
return;
194 for (
int i=3; i<FNbSelectionLevels; ++i)
224 AStream<<
"CParameterDart:"<<endl;
226 AStream<<
" LineWidth: "<<AParameter.FLWDarts<<endl;
228 AStream<<
" SizeAlone: "<<AParameter.FSAloneDarts<<endl;
230 AStream<<
" SelectionLevelNumber: "<<AParameter.FNbSelectionLevels<<endl;
232 for (
int i=0; i<AParameter.FNbSelectionLevels; ++i)
234 AStream<<
" ColorUnsel "<<i<<
": "<<AParameter.FCLUnsel[i][0]<<
" "
235 <<AParameter.FCLUnsel[i][1]<<
" "<<AParameter.FCLUnsel[i][2]<<endl;
237 AStream<<
" ColorSel "<<i<<
": "<<AParameter.FCLSel[i][0]<<
" "
238 <<AParameter.FCLSel[i][1]<<
" "<<AParameter.FCLSel[i][2]<<endl;
240 AStream<<
" ColorLast "<<i<<
": "<<AParameter.FCLLastSel[i][0]<<
" "
241 <<AParameter.FCLLastSel[i][1]<<
" "<<AParameter.FCLLastSel[i][2]<<endl;
243 AStream<<
" Color0Remove "<<i<<
": "<<AParameter.FCL0Remove[i][0]<<
" "
244 <<AParameter.FCL0Remove[i][1]<<
" "<<AParameter.FCL0Remove[i][2]<<endl;
246 AStream<<
" Color1Remove "<<i<<
": "<<AParameter.FCL1Remove[i][0]<<
" "
247 <<AParameter.FCL1Remove[i][1]<<
" "<<AParameter.FCL1Remove[i][2]<<endl;
259 AStream>>tmp; assert ( !strcmp(tmp,
"CParameterDart:") );
261 AStream>>tmp; assert ( !strcmp(tmp,
"LineWidth:") );
262 AStream>>AParameter.FLWDarts;
264 AStream>>tmp; assert ( !strcmp(tmp,
"SizeAlone:") );
265 AStream>>AParameter.FSAloneDarts;
267 int nb, toRead, toIgnore;
268 AStream>>tmp; assert ( !strcmp(tmp,
"SelectionLevelNumber:") );
271 toRead = MIN(nb,AParameter.FNbSelectionLevels);
272 toIgnore = nb - AParameter.FNbSelectionLevels;
275 for (i=0; i<toRead; ++i)
277 AStream>>tmp; assert( !strcmp(tmp,
"ColorUnsel") ); AStream>>tmp;
278 AStream>>AParameter.FCLUnsel[i][0]
279 >>AParameter.FCLUnsel[i][1]>>AParameter.FCLUnsel[i][2];
281 AStream>>tmp; assert( !strcmp(tmp,
"ColorSel") ); AStream>>tmp;
282 AStream>>AParameter.FCLSel[i][0]
283 >>AParameter.FCLSel[i][1]>>AParameter.FCLSel[i][2];
285 AStream>>tmp; assert( !strcmp(tmp,
"ColorLast") ); AStream>>tmp;
286 AStream>>AParameter.FCLLastSel[i][0]
287 >>AParameter.FCLLastSel[i][1]>>AParameter.FCLLastSel[i][2];
289 AStream>>tmp; assert( !strcmp(tmp,
"Color0Remove") ); AStream>>tmp;
290 AStream>>AParameter.FCL0Remove[i][0]
291 >>AParameter.FCL0Remove[i][1]>>AParameter.FCL0Remove[i][2];
293 AStream>>tmp; assert( !strcmp(tmp,
"Color1Remove") ); AStream>>tmp;
294 AStream>>AParameter.FCL1Remove[i][0]
295 >>AParameter.FCL1Remove[i][1]>>AParameter.FCL1Remove[i][2];
298 for (i=0; i<toIgnore; ++i)
301 AStream>>tmp; assert( !strcmp(tmp,
"ColorUnsel") ); AStream>>tmp;
302 AStream>>dummy>>dummy>>dummy;
303 AStream>>tmp; assert( !strcmp(tmp,
"ColorSel") ); AStream>>tmp;
304 AStream>>dummy>>dummy>>dummy;
305 AStream>>tmp; assert( !strcmp(tmp,
"ColorLast") ); AStream>>tmp;
306 AStream>>dummy>>dummy>>dummy;
307 AStream>>tmp; assert( !strcmp(tmp,
"Color0Remove") ); AStream>>tmp;
308 AStream>>dummy>>dummy>>dummy;
309 AStream>>tmp; assert( !strcmp(tmp,
"Color1Remove") ); AStream>>tmp;
310 AStream>>dummy>>dummy>>dummy;
325 if (FLWDarts!=AValue)
333 {
return FSAloneDarts; }
337 if (FSAloneDarts!=AValue)
340 FSAloneDarts= AValue;
346 assert(0<=ALevel && ALevel<FNbSelectionLevels);
347 assert(0<=AIndice && AIndice<=2);
348 return FCLUnsel[ALevel][AIndice];
353 assert(0<=ALevel && ALevel<FNbSelectionLevels);
354 assert(0<=AIndice && AIndice<=2);
355 if (FCLUnsel[ALevel][AIndice]!=AValue)
358 FCLUnsel[ALevel][AIndice]= AValue;
364 assert(0<=ALevel && ALevel<FNbSelectionLevels);
365 return FCLUnsel[ALevel];
369 float AValue0,
float AValue1,
float AValue2)
371 assert(0<=ALevel && ALevel<FNbSelectionLevels);
372 if ( FCLUnsel[ALevel][0]!=AValue0 ||
373 FCLUnsel[ALevel][1]!=AValue1 ||
374 FCLUnsel[ALevel][2]!=AValue2 )
377 FCLUnsel[ALevel][0]= AValue0;
378 FCLUnsel[ALevel][1]= AValue1;
379 FCLUnsel[ALevel][2]= AValue2;
383 {
setCLUnsel(ALevel,ATab[0],ATab[1],ATab[2]); }
387 assert(0<=ALevel && ALevel<FNbSelectionLevels);
388 assert(0<=AIndice && AIndice<=2);
389 return FCLSel[ALevel][AIndice];
393 assert(0<=ALevel && ALevel<FNbSelectionLevels);
394 assert(0<=AIndice && AIndice<=2);
395 if (FCLSel[ALevel][AIndice]!=AValue)
398 FCLSel[ALevel][AIndice]= AValue;
403 assert(0<=ALevel && ALevel<FNbSelectionLevels);
404 return FCLSel[ALevel];
407 float AValue0,
float AValue1,
float AValue2)
409 assert(0<=ALevel && ALevel<FNbSelectionLevels);
410 if ( FCLSel[ALevel][0]!=AValue0 ||
411 FCLSel[ALevel][1]!=AValue1 ||
412 FCLSel[ALevel][2]!=AValue2 )
415 FCLSel[ALevel][0]= AValue0;
416 FCLSel[ALevel][1]= AValue1;
417 FCLSel[ALevel][2]= AValue2;
421 {
setCLSel(ALevel,ATab[0],ATab[1],ATab[2]); }
425 assert(0<=ALevel && ALevel<FNbSelectionLevels);
426 assert(0<=AIndice && AIndice<=2);
427 return FCLLastSel[ALevel][AIndice];
431 assert(0<=ALevel && ALevel<FNbSelectionLevels);
432 assert(0<=AIndice && AIndice<=2);
433 if (FCLLastSel[ALevel][AIndice]!=AValue)
436 FCLLastSel[ALevel][AIndice]= AValue;
441 assert(0<=ALevel && ALevel<FNbSelectionLevels);
442 return FCLLastSel[ALevel];
445 float AValue0,
float AValue1,
float AValue2)
447 assert(0<=ALevel && ALevel<FNbSelectionLevels);
448 if ( FCLLastSel[ALevel][0]!=AValue0 ||
449 FCLLastSel[ALevel][1]!=AValue1 ||
450 FCLLastSel[ALevel][2]!=AValue2 )
453 FCLLastSel[ALevel][0]= AValue0;
454 FCLLastSel[ALevel][1]= AValue1;
455 FCLLastSel[ALevel][2]= AValue2;
463 assert(0<=ALevel && ALevel<FNbSelectionLevels);
464 assert(0<=AIndice && AIndice<=2);
465 return FCL0Remove[ALevel][AIndice];
470 assert(0<=ALevel && ALevel<FNbSelectionLevels);
471 assert(0<=AIndice && AIndice<=2);
472 if (FCL0Remove[ALevel][AIndice]!=AValue)
475 FCL0Remove[ALevel][AIndice]= AValue;
481 assert(0<=ALevel && ALevel<FNbSelectionLevels);
482 return FCL0Remove[ALevel];
486 float AValue0,
float AValue1,
float AValue2)
488 assert(0<=ALevel && ALevel<FNbSelectionLevels);
489 if ( FCL0Remove[ALevel][0]!=AValue0 ||
490 FCL0Remove[ALevel][1]!=AValue1 ||
491 FCL0Remove[ALevel][2]!=AValue2 )
494 FCL0Remove[ALevel][0]= AValue0;
495 FCL0Remove[ALevel][1]= AValue1;
496 FCL0Remove[ALevel][2]= AValue2;
504 assert(0<=ALevel && ALevel<FNbSelectionLevels);
505 assert(0<=AIndice && AIndice<=2);
506 return FCL1Remove[ALevel][AIndice];
511 assert(0<=ALevel && ALevel<FNbSelectionLevels);
512 assert(0<=AIndice && AIndice<=2);
513 if (FCL1Remove[ALevel][AIndice]!=AValue)
516 FCL1Remove[ALevel][AIndice]= AValue;
522 assert(0<=ALevel && ALevel<FNbSelectionLevels);
523 return FCL1Remove[ALevel];
527 float AValue0,
float AValue1,
float AValue2)
529 assert(0<=ALevel && ALevel<FNbSelectionLevels);
530 if ( FCL1Remove[ALevel][0]!=AValue0 ||
531 FCL1Remove[ALevel][1]!=AValue1 ||
532 FCL1Remove[ALevel][2]!=AValue2 )
535 FCL1Remove[ALevel][0]= AValue0;
536 FCL1Remove[ALevel][1]= AValue1;
537 FCL1Remove[ALevel][2]= AValue2;