IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14289


Ignore:
Timestamp:
Jul 18, 2007, 8:48:29 AM (19 years ago)
Author:
eugene
Message:

do not allow duplicate regions in SkyListFromBounds

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/src/skyregion_ops.c

    r10931 r14289  
    200200SkyList *SkyListByBounds (SkyTable *table, int depth, double Rmin, double Rmax, double Dmin, double Dmax) {
    201201
    202   int i, Ns;
     202  int i, j, Ns;
    203203  SkyList *list, *extra;
    204204
     
    219219    Ns = list[0].Nregions;
    220220    for (i = 0; i < extra[0].Nregions; i++) {
    221       list[0].regions[i + Ns] = extra[0].regions[i];
    222       list[0].filename[i + Ns] = extra[0].filename[i];
    223     }
    224     list[0].Nregions += extra[0].Nregions;
     221      // search for pre-existing match
     222      for (j = 0; j < list[0].Nregions; j++) {
     223        if (list[0].regions[j] == extra[0].regions[i]) {
     224          goto skip;
     225        }
     226      }
     227      list[0].regions[Ns] = extra[0].regions[i];
     228      list[0].filename[Ns] = extra[0].filename[i];
     229      Ns ++;
     230    skip:
     231      continue;
     232    }
     233    list[0].Nregions = Ns;
    225234    SkyListFree (extra, FALSE);
    226235  } else {
Note: See TracChangeset for help on using the changeset viewer.