fpreclass.c

Go to the documentation of this file.
00001 /**********************************************************************
00002  *
00003  *  G_fpreclass_init (r)
00004  *
00005  *       struct FPReclass *r;
00006  *
00007  *  initializes new reclassification structure. calls
00008  *  G_fpreclass_clear() before it returns.
00009  *  
00010  **********************************************************************
00011  *
00012  *  void
00013  *  G_fpreclass_reset (r)
00014  *  
00015  *       struct FPReclass *r;
00016  *
00017  *  resets the number of defined rules to 0 and free's space allocated
00018  *  for rules. calls G_fpreclass_clear ().
00019  *
00020  **********************************************************************
00021  *
00022  *  void
00023  *  G_fpreclass_clear (r)
00024  *  
00025  *       struct FPReclass *r;
00026  *
00027  *  resets the number of defined rules to 0. Resets default Min and Max
00028  *  to be unknown. (see G_fpreclass_set_domain (), G_fpreclass_set_range ()).
00029  *  deactivates default mapping.
00030  *
00031  **********************************************************************
00032  *
00033  *  void
00034  *  G_fpreclass_set_domain (r, dLow, dHigh)
00035  *
00036  *       struct FPReclass *r;
00037  *       DCELL dLow, dHigh;
00038  *
00039  *  defines the domain for the default mapping and 
00040  *  activates default mapping. (see G_fpreclass_perform_d ()).
00041  *  
00042  *  note: dHigh < dLow is valid.
00043  *
00044  **********************************************************************
00045  *
00046  *  void
00047  *  G_fpreclass_set_range (r, low, high)
00048  *
00049  *       struct FPReclass *r;
00050  *       DCELL low, high;
00051  *
00052  *  defines the range for the default mapping. does NOT
00053  *  activate default mapping. (see G_fpreclass_perform_d ()).
00054  *  
00055  **********************************************************************
00056  *
00057  *  int
00058  *  G_fpreclass_get_limits (r, dMin, dMax, rMin, rmax)
00059  *  
00060  *       struct FPReclass *r;
00061  *       DCELL *dMin, *dMax;
00062  *       DCELL *rMin, *rmax;
00063  *
00064  *  returns the minimum and maximum values of all the rules defined.
00065  *  
00066  *  returns: -1 if after G_fpreclass_init (), or any call to 
00067  *                 G_fpreclass_clear () or G_fpreclass_reset () neither 
00068  *                 G_fpreclass_add_rule () nor G_fpreclass_set_domain () is
00069  *                 used. in this case the returned minimum and maximum 
00070  *                 range and domain values are undefined.
00071  *            0 if the default rule values are returned.domain values
00072  *                 are identical to those set with G_fpreclass_set_domain ().
00073  *                 range values are either reclassification internal default,
00074  *                 or the values set with G_fpreclass_set_range ().
00075  *            1 otherwise. in this case the values returned correspond
00076  *                 to the extreme values of the defined rules (they need 
00077  *                 not be identical to the values set with
00078  *                 G_fpreclass_set_domain ()).
00079  *
00080  **********************************************************************
00081  *  
00082  *  int
00083  *  G_fpreclass_nof_rules (r)
00084  *  
00085  *       struct FPReclass *r;
00086  *  
00087  *  returns the number of reclassification rules defined. This number does
00088  *  not include the 2 infinite intervals.
00089  *  
00090  **********************************************************************
00091  *  
00092  *  void
00093  *  G_fpreclass_get_ith_rule (r, i, dLow, dHigh, rLow, rHigh)
00094  *  
00095  *       struct FPReclass *r;
00096  *       int i;
00097  *       DCELL *dLow, *dHigh;
00098  *       DCELL *rLow, *rHigh;
00099  *  
00100  *  returns the i'th reclassification rule, for 
00101  *  0 <= i < G_fpreclass_nof_rules().
00102  *  a larger value for i means that the rule has been added later.
00103  *  
00104  **********************************************************************
00105  *   void
00106  *   G_fpreclass_set_neg_infinite_rule (r, dLeft, c)
00107  *
00108  *       struct FPReclass *r;
00109  *       DCELL dLeft;
00110  *       DCELL c;
00111  *
00112  *   defines a rule for values "dLeft" and smaller. values in this range
00113  *   are mapped to "c" if none of the "finite" reclassification rules applies.
00114  *
00115  * **********************************************************************
00116  *
00117  *  int
00118  *  G_fpreclass_get_neg_infinite_rule (r, dLeft, c)
00119  *
00120  *       struct FPReclass *r;
00121  *       DCELL *dLeft;
00122  *       DCELL *c;
00123  *
00124  *  returns in "dLeft" and "c" the rule values for the negative infinite
00125  *  interval (see G_fpreclass_set_neg_infinite_rule ()).
00126  *
00127  *  returns: 0 if this rule is not defined
00128  *           1 otherwise.
00129  *
00130  **********************************************************************
00131  *   void
00132  *   G_fpreclass_set_pos_infinite_rule (r, dRight, c)
00133  *
00134  *       struct FPReclass *r;
00135  *       DCELL dRight;
00136  *       DCELL c;
00137  *
00138  *   defines a rule for values "dRight" and larger. values in this range
00139  *   are mapped to "c" if neither any of the "finite" reclassification
00140  *   rules nor the negative infinite rule applies.
00141  *
00142  * **********************************************************************
00143  *
00144  *  int
00145  *  G_fpreclass_get_pos_infinite_rule (r, dRight, c)
00146  *
00147  *       struct FPReclass *r;
00148  *       DCELL *dRight;
00149  *       DCELL *c;
00150  *
00151  *  returns in "dRight" and "c" the rule values for the positive infinite
00152  *  interval (see G_fpreclass_set_pos_infinite_rule ()).
00153  *
00154  *  returns: 0 if this rule is not defined
00155  *           1 otherwise.
00156  *
00157  **********************************************************************
00158  *  
00159  *  void
00160  *  G_fpreclass_reverse_rule_order (r)
00161  *
00162  *        struct FPReclass *r;
00163  *
00164  *  reverses the order in which the reclassification rules are stored. (see
00165  *  also G_fpreclass_get_ith_rule () and G_fpreclass_perform_XY ()).
00166  *  
00167  **********************************************************************
00168  *  
00169  *  void
00170  *  G_fpreclass_add_rule (r, dLow, dHigh, rLow, rHigh)
00171  *  
00172  *       struct FPReclass *r;
00173  *       DCELL dLow, dHigh;
00174  *       DCELL rLow, rHigh;
00175  *  
00176  *  adds a new rule to the set of reclassification rules. if dLow > dHigh
00177  *  the rule will be stored with the low and high values interchanged.
00178  *  
00179  *  Note: currently no cleanup of rules is performed, i.e. redundant
00180  *        rules are not removed.
00181  *  
00182  **********************************************************************
00183  *  
00184  *  DCELL
00185  *  G_fpreclass_get_cell_value (r, cellValue)
00186  *  
00187  *       struct FPReclass *r;
00188  *       DCELL *cellValue;
00189  *  
00190  *  returns the reclassified value corresponding to "cellValue".
00191  *
00192  *  if several reclassification rules apply for cellValue, the one which has 
00193  *  been inserted latest (i.e. the one of them which is returned by 
00194  *  G_fpreclass_get_ith_rule() for the largest i) is used. if no such rule
00195  *  applies the cellValue is first tested against the negative infinite
00196  *  rule, and finally against the positive infinite rule. if none of
00197  *  these rules apply, NO_DATA is returned. the actual value of NO_DATA 
00198  *  is found by calling G_set_d_null_value()
00199  *  
00200  *  if after G_fpreclass_init (), or any call to G_fpreclass_clear () or 
00201  *  G_fpreclass_reset () neither G_fpreclass_add_rule (),
00202  *  G_fpreclass_set_neg_infinite_rule (),  
00203  *  G_fpreclass_set_pos_infinite_rule (), *  nor  G_fpreclass_set_domain () 
00204  *  is used NO_DATA is returned independently of the cellValue.
00205  *
00206  *  if G_fpreclass_set_domain () is called but no explicit reclassification
00207  *  rule is set, the default mapping to the cell range set with 
00208  *  G_fpreclass_set_range () or, if the cell range is not set, 
00209  *  to the default CELL range [0,256 - 1] is applied.
00210  *  
00211  **********************************************************************
00212  *  
00213  *  void
00214  *  G_fpreclass_perform_XY (r, xcell, ycell, n)
00215  *  
00216  *       struct FPReclass *r;
00217  *       XCELL *xcell;
00218  *       YCELL *ycell;
00219  *       int n;
00220  *  
00221  *  "X" and "Y" in the function name can be any of "d", "f", or "i". These
00222  *  correspond to "DCELL", "FCELL", and "CELL", respectively, and denote
00223  *  the type of the domain and range values.
00224  *  
00225  *  returns in "ycell" the reclassified YCELL values corresponding to the
00226  *  XCELL values stored in "xcell". the number of elements reclassified
00227  *  is n. reclassification is performed by repeated application of 
00228  *  G_fpreclass_get_cell_value ().
00229  *  
00230  **********************************************************************/
00231 
00232 /*--------------------------------------------------------------------------*/
00233 
00234 /*
00235  the reclassification table is stored as a linear array. rules are added 
00236  starting from index 0. redundant rules are not eliminated. rules are tested 
00237  from the highest index downto 0. there are two "infinite" rules. support is 
00238  provided to reverse the order of the rules.
00239 */
00240 
00241 /*--------------------------------------------------------------------------*/
00242 
00243 #include "gis.h"
00244 
00245 /*--------------------------------------------------------------------------*/
00246 
00247 #define MIN(a,b) (a < b ? a : b)
00248 #define MAX(a,b) (a > b ? a : b)
00249 
00250 #define NO_DEFAULT_RULE (! r->defaultDRuleSet)
00251 #define NO_LEFT_INFINITE_RULE (! r->infiniteLeftSet)
00252 #define NO_RIGHT_INFINITE_RULE (! r->infiniteRightSet)
00253 #define NO_FINITE_RULE (r->nofRules <= 0)
00254 #define NO_EXPLICIT_RULE (NO_FINITE_RULE && \
00255                           NO_LEFT_INFINITE_RULE && NO_RIGHT_INFINITE_RULE)
00256 
00257 #define DEFAULT_MIN ((DCELL) 1)
00258 #define DEFAULT_MAX ((DCELL) 255)  
00259 
00260 /*--------------------------------------------------------------------------*/
00261 
00262 void
00263 G_fpreclass_clear (r)
00264 
00265      struct FPReclass *r;
00266 
00267 {
00268   r->nofRules = 0;
00269   r->defaultDRuleSet = 0;
00270   r->defaultRRuleSet = 0;
00271   r->infiniteRightSet = r->infiniteLeftSet = 0;
00272 }
00273 
00274 /*--------------------------------------------------------------------------*/
00275 
00276 void
00277 G_fpreclass_reset (r)
00278 
00279      struct FPReclass *r;
00280 
00281 {
00282   G_fpreclass_clear (r);
00283 
00284   if (r->maxNofRules > 0) G_free (r->table);
00285 
00286   r->maxNofRules = 0;
00287 }
00288 
00289 /*--------------------------------------------------------------------------*/
00290 
00291 int G_fpreclass_init (r)
00292 
00293      struct FPReclass *r;
00294 
00295 {
00296   r->maxNofRules = 0;
00297   G_fpreclass_reset (r);
00298   
00299   return 1;
00300 }
00301 
00302 /*--------------------------------------------------------------------------*/
00303 
00304 void
00305 G_fpreclass_set_domain (r, dLow, dHigh)
00306 
00307      struct FPReclass *r;
00308      DCELL dLow, dHigh;
00309 
00310 {
00311   r->defaultDMin = dLow;
00312   r->defaultDMax = dHigh;
00313   r->defaultDRuleSet = 1;
00314 }
00315 
00316 /*--------------------------------------------------------------------------*/
00317 
00318 void
00319 G_fpreclass_set_range (r, low, high)
00320 
00321      struct FPReclass *r;
00322      DCELL low, high;
00323 
00324 {
00325   r->defaultRMin = low;
00326   r->defaultRMax = high;
00327   r->defaultRRuleSet = 1;
00328 }
00329 
00330 /*--------------------------------------------------------------------------*/
00331 
00332 static void
00333 fpreclass_set_limits (r, dLow, dHigh, rLow, rHigh)
00334 
00335      struct FPReclass *r;
00336      DCELL dLow, dHigh;
00337      DCELL rLow, rHigh;
00338 
00339 {
00340   r->dMin = dLow;
00341   r->dMax = dHigh;
00342   r->rMin = rLow;
00343   r->rMax = rHigh;
00344 }
00345 
00346 /*--------------------------------------------------------------------------*/
00347 
00348 static void
00349 fpreclass_update_limits (r, dLow, dHigh, rLow, rHigh)
00350 
00351      struct FPReclass *r;
00352      DCELL dLow, dHigh;
00353      DCELL rLow, rHigh;
00354 
00355 {
00356   if (NO_EXPLICIT_RULE) {
00357     fpreclass_set_limits (r, dLow, dHigh, rLow, rHigh);
00358     return;
00359   }
00360 
00361   r->dMin = MIN (r->dMin, MIN (dLow, dHigh));
00362   r->dMax = MAX (r->dMax, MAX (dLow, dHigh));
00363   r->rMin = MIN (r->rMin, MIN (rLow, rHigh));
00364   r->rMax = MAX (r->rMax, MAX (rLow, rHigh));
00365 }
00366 
00367 /*--------------------------------------------------------------------------*/
00368 
00369 int
00370 G_fpreclass_get_limits (r, dMin, dMax, rMin, rMax)
00371 
00372      struct FPReclass *r;
00373      DCELL *dMin, *dMax;
00374      DCELL *rMin, *rMax;
00375 
00376 {
00377   if (NO_EXPLICIT_RULE) {
00378     if (NO_DEFAULT_RULE) return -1;
00379 
00380     *dMin = r->defaultDMin; *dMax = r->defaultDMax;
00381 
00382     if (r->defaultRRuleSet) {
00383       *rMin = r->defaultRMin; *rMax = r->defaultRMax;
00384     } else {
00385       *rMin = DEFAULT_MIN; *rMax = DEFAULT_MAX;
00386     }
00387 
00388     return 0;
00389   }
00390 
00391   *dMin = r->dMin; *dMax = r->dMax;
00392   *rMin = r->rMin; *rMax = r->rMax;
00393 
00394   return 1;
00395 }
00396 
00397 /*--------------------------------------------------------------------------*/
00398 
00399 int
00400 G_fpreclass_nof_rules (r)
00401 
00402      struct FPReclass *r;
00403 
00404 {
00405   return r->nofRules;
00406 }
00407 
00408 /*--------------------------------------------------------------------------*/
00409 
00410 void
00411 G_fpreclass_get_ith_rule (r, i, dLow, dHigh, rLow, rHigh)
00412 
00413      struct FPReclass *r;
00414      int i;
00415      DCELL *dLow, *dHigh;
00416      DCELL *rLow, *rHigh;
00417 
00418 {
00419   *dLow = r->table[i].dLow;
00420   *dHigh = r->table[i].dHigh;
00421   *rLow = r->table[i].rLow;
00422   *rHigh = r->table[i].rHigh;
00423 }
00424 
00425 /*--------------------------------------------------------------------------*/
00426 
00427 static void
00428 fpreclass_table_increase (r)
00429 
00430      struct FPReclass *r;
00431 
00432 {
00433   if (r->nofRules < r->maxNofRules) return;
00434 
00435   if (r->maxNofRules == 0) {
00436     r->maxNofRules = 50;
00437     r->table = (struct FPReclass_table *) 
00438                  G_malloc (r->maxNofRules * sizeof (struct FPReclass_table));
00439   } else {
00440     r->maxNofRules += 50;
00441     r->table = (struct FPReclass_table *) 
00442         G_realloc ((char *) r->table, r->maxNofRules * sizeof (struct FPReclass_table));
00443   }
00444 }
00445 
00446 /*--------------------------------------------------------------------------*/
00447 
00448 void
00449 G_fpreclass_set_neg_infinite_rule (r, dLeft, c)
00450 
00451      struct FPReclass *r;
00452      DCELL dLeft;
00453      DCELL c;
00454 
00455 {
00456   r->infiniteDLeft = dLeft;
00457   r->infiniteRLeft = c;
00458   fpreclass_update_limits (r, dLeft, dLeft, c, c); 
00459   r->infiniteLeftSet = 1;
00460 }
00461 
00462 /*--------------------------------------------------------------------------*/
00463 
00464 int
00465 G_fpreclass_get_neg_infinite_rule (r, dLeft, c)
00466 
00467      struct FPReclass *r;
00468      DCELL *dLeft;
00469      DCELL *c;
00470 
00471 {
00472   if (r->infiniteLeftSet == 0) return 0;
00473 
00474   *dLeft = r->infiniteDLeft;
00475   *c = r->infiniteRLeft;
00476 
00477   return 1;
00478 }
00479 
00480 /*--------------------------------------------------------------------------*/
00481 
00482 void
00483 G_fpreclass_set_pos_infinite_rule (r, dRight, c)
00484 
00485      struct FPReclass *r;
00486      DCELL dRight;
00487      DCELL c;
00488 
00489 {
00490   r->infiniteDRight = dRight;
00491   r->infiniteRRight = c;
00492   fpreclass_update_limits (r, dRight, dRight, c, c); 
00493   r->infiniteRightSet = 1;
00494 }
00495 
00496 /*--------------------------------------------------------------------------*/
00497 
00498 int
00499 G_fpreclass_get_pos_infinite_rule (r, dRight, c)
00500 
00501      struct FPReclass *r;
00502      DCELL *dRight;
00503      DCELL *c;
00504 
00505 {
00506   if (r->infiniteRightSet == 0) return 0;
00507 
00508   *dRight = r->infiniteDRight;
00509   *c = r->infiniteRRight;
00510 
00511   return 1;
00512 }
00513 
00514 /*--------------------------------------------------------------------------*/
00515 
00516 void
00517 G_fpreclass_add_rule (r, dLow, dHigh, rLow, rHigh)
00518 
00519      struct FPReclass *r;
00520      DCELL dLow, dHigh;
00521      DCELL rLow, rHigh;
00522 
00523 {
00524   int i;
00525   struct FPReclass_table *p;
00526 
00527   fpreclass_table_increase (r);
00528 
00529   i = r->nofRules;
00530 
00531   p = &(r->table[i]);
00532   if (dHigh >= dLow) {
00533     p->dLow = dLow; p->dHigh = dHigh; p->rLow = rLow; p->rHigh = rHigh;  
00534   } else {
00535     p->dLow = dHigh; p->dHigh = dLow; p->rLow = rHigh; p->rHigh = rLow;  
00536   }
00537 
00538   fpreclass_update_limits (r, dLow, dHigh, rLow, rHigh);
00539 
00540   r->nofRules++;
00541 }
00542 
00543 /*--------------------------------------------------------------------------*/
00544 
00545 void
00546 G_fpreclass_reverse_rule_order (r)
00547 
00548      struct FPReclass *r;
00549 
00550 {
00551   struct FPReclass_table tmp;
00552   struct FPReclass_table *pLeft, *pRight;
00553 
00554   pLeft = r->table;
00555   pRight = &(r->table [r->nofRules - 1]);
00556 
00557   while (pLeft < pRight) {
00558     tmp.dLow = pLeft->dLow; tmp.dHigh = pLeft->dHigh;
00559     tmp.rLow = pLeft->rLow; tmp.rHigh = pLeft->rHigh;
00560 
00561     pLeft->dLow = pRight->dLow; pLeft->dHigh = pRight->dHigh;
00562     pLeft->rLow = pRight->rLow; pLeft->rHigh = pRight->rHigh;
00563 
00564     pRight->dLow = tmp.dLow; pRight->dHigh = tmp.dHigh;
00565     pRight->rLow = tmp.rLow; pRight->rHigh = tmp.rHigh;
00566 
00567     pLeft++; pRight--;
00568   }    
00569 }
00570 
00571 /*--------------------------------------------------------------------------*/
00572 
00573 static DCELL
00574 fpreclass_interpolate (dLow, dHigh, rLow, rHigh, dValue)
00575 
00576      DCELL dLow, dHigh;
00577      DCELL rLow, rHigh;
00578      DCELL dValue;
00579 
00580 {
00581   if (rLow == rHigh) return rLow;
00582   if (dLow == dHigh) return rLow;
00583 
00584   return ((dValue - dLow) / (dHigh - dLow) * (rHigh - rLow) + rLow); 
00585 }
00586 
00587 /*--------------------------------------------------------------------------*/
00588 
00589 static DCELL
00590 fpreclass_get_default_cell_value (r, cellVal)
00591 
00592      struct FPReclass *r;
00593      DCELL cellVal;
00594 
00595 {
00596   DCELL tmp;
00597   G_set_d_null_value(&tmp, 1);
00598 
00599   if ((cellVal < MIN (r->defaultDMin, r->defaultDMax)) ||
00600       (cellVal > MAX (r->defaultDMin, r->defaultDMax))) return tmp;
00601 
00602   if (r->defaultRRuleSet)
00603     return fpreclass_interpolate (r->defaultDMin, r->defaultDMax,
00604                               r->defaultRMin, r->defaultRMax, cellVal);
00605   else
00606     return fpreclass_interpolate (r->defaultDMin, r->defaultDMax,
00607                               DEFAULT_MIN, DEFAULT_MAX, cellVal);
00608 }
00609 
00610 /*--------------------------------------------------------------------------*/
00611 
00612 DCELL
00613 G_fpreclass_get_cell_value (r, cellVal)
00614 
00615      struct FPReclass *r;
00616      DCELL cellVal;
00617 
00618 {
00619   DCELL tmp;
00620   struct FPReclass_table *p;
00621 
00622   G_set_d_null_value(&tmp, 1);
00623   if (NO_EXPLICIT_RULE) {
00624 
00625     if (NO_DEFAULT_RULE) return tmp;
00626     return fpreclass_get_default_cell_value (r, cellVal);
00627   }
00628 
00629   if (! NO_FINITE_RULE)
00630     for (p = &(r->table [r->nofRules - 1]); p >= r->table; p--)
00631       if ((cellVal >= p->dLow) && (cellVal <= p->dHigh)) 
00632         return fpreclass_interpolate (p->dLow, p->dHigh, p->rLow, p->rHigh,
00633                                       cellVal);
00634   
00635   if ((! NO_LEFT_INFINITE_RULE) && (cellVal <= r->infiniteDLeft))
00636     return r->infiniteRLeft;
00637 
00638   if ((NO_RIGHT_INFINITE_RULE) || (cellVal < r->infiniteDRight)) 
00639     return tmp;
00640 
00641   return r->infiniteRRight;
00642 }
00643 
00644 /*--------------------------------------------------------------------------*/
00645 
00646 void
00647 G_fpreclass_perform_di (r, dcell, cell, n)
00648 
00649      struct FPReclass *r;
00650      DCELL *dcell;
00651      CELL *cell;
00652      int n;
00653 
00654 {
00655   int i;
00656 
00657   for (i = 0; i < n; i++, dcell++)
00658     if (! G_is_d_null_value (dcell))
00659       *cell++ = G_fpreclass_get_cell_value (r, *dcell);
00660     else
00661       G_set_c_null_value (cell++, 1);
00662 }
00663 
00664 /*--------------------------------------------------------------------------*/
00665 
00666 void
00667 G_fpreclass_perform_df (r, dcell, cell, n)
00668 
00669      struct FPReclass *r;
00670      DCELL *dcell;
00671      FCELL *cell;
00672      int n;
00673 
00674 {
00675   int i;
00676 
00677   for (i = 0; i < n; i++, dcell++)
00678     if (! G_is_d_null_value (dcell))
00679       *cell++ = G_fpreclass_get_cell_value (r, *dcell);
00680     else
00681       G_set_f_null_value (cell++, 1);
00682 }
00683 
00684 /*--------------------------------------------------------------------------*/
00685 
00686 void
00687 G_fpreclass_perform_dd (r, dcell, cell, n)
00688 
00689      struct FPReclass *r;
00690      DCELL *dcell;
00691      DCELL *cell;
00692      int n;
00693 
00694 {
00695   int i;
00696 
00697   for (i = 0; i < n; i++, dcell++)
00698     if (! G_is_d_null_value (dcell))
00699       *cell++ = G_fpreclass_get_cell_value (r, *dcell);
00700     else
00701       G_set_d_null_value (cell++, 1);
00702 }
00703 
00704 /*--------------------------------------------------------------------------*/
00705 
00706 void
00707 G_fpreclass_perform_fi (r, fcell, cell, n)
00708 
00709      struct FPReclass *r;
00710      FCELL *fcell;
00711      CELL *cell;
00712      int n;
00713 
00714 {
00715   int i;
00716 
00717   for (i = 0; i < n; i++, fcell++)
00718     if (! G_is_f_null_value (fcell))
00719       *cell++ = G_fpreclass_get_cell_value (r, (DCELL) *fcell);
00720     else
00721       G_set_c_null_value (cell++, 1);
00722 }
00723 
00724 /*--------------------------------------------------------------------------*/
00725 
00726 void
00727 G_fpreclass_perform_ff (r, fcell, cell, n)
00728 
00729      struct FPReclass *r;
00730      FCELL *fcell;
00731      FCELL *cell;
00732      int n;
00733 
00734 {
00735   int i;
00736 
00737   for (i = 0; i < n; i++, fcell++)
00738     if (! G_is_f_null_value (fcell))
00739       *cell++ = G_fpreclass_get_cell_value (r, (DCELL) *fcell);
00740     else
00741       G_set_f_null_value (cell++, 1);
00742 }
00743 
00744 /*--------------------------------------------------------------------------*/
00745 
00746 void
00747 G_fpreclass_perform_fd (r, fcell, cell, n)
00748 
00749      struct FPReclass *r;
00750      FCELL *fcell;
00751      DCELL *cell;
00752      int n;
00753 
00754 {
00755   int i;
00756 
00757   for (i = 0; i < n; i++, fcell++)
00758     if (! G_is_f_null_value (fcell))
00759       *cell++ = G_fpreclass_get_cell_value (r, (DCELL) *fcell);
00760     else
00761       G_set_d_null_value (cell++, 1);
00762 }
00763 
00764 /*--------------------------------------------------------------------------*/
00765 
00766 void
00767 G_fpreclass_perform_ii (r, icell, cell, n)
00768 
00769      struct FPReclass *r;
00770      CELL *icell;
00771      CELL *cell;
00772      int n;
00773 
00774 {
00775   int i;
00776 
00777   for (i = 0; i < n; i++, icell++)
00778     if (! G_is_c_null_value (icell))
00779       *cell++ = G_fpreclass_get_cell_value (r, (DCELL) *icell);
00780     else
00781       G_set_c_null_value (cell++, 1);
00782 }
00783 
00784 /*--------------------------------------------------------------------------*/
00785 
00786 void
00787 G_fpreclass_perform_if (r, icell, cell, n)
00788 
00789      struct FPReclass *r;
00790      CELL *icell;
00791      FCELL *cell;
00792      int n;
00793 
00794 {
00795   int i;
00796 
00797   for (i = 0; i < n; i++, icell++)
00798     if (! G_is_c_null_value (icell))
00799       *cell++ = G_fpreclass_get_cell_value (r, (DCELL) *icell);
00800     else
00801       G_set_f_null_value (cell++, 1);
00802 }
00803 
00804 /*--------------------------------------------------------------------------*/
00805 
00806 void
00807 G_fpreclass_perform_id (r, icell, cell, n)
00808 
00809      struct FPReclass *r;
00810      CELL *icell;
00811      DCELL *cell;
00812      int n;
00813 
00814 {
00815   int i;
00816 
00817   for (i = 0; i < n; i++, icell++)
00818     if (! G_is_c_null_value (icell))
00819       *cell++ = G_fpreclass_get_cell_value (r, (DCELL) *icell);
00820     else
00821       G_set_d_null_value (cell++, 1);
00822 }
00823 
00824 /*--------------------------------------------------------------------------*/
00825 /*--------------------------------------------------------------------------*/
00826 /*--------------------------------------------------------------------------*/
00827 

Generated on Sat Jul 22 22:06:14 2006 for GRASS by  doxygen 1.4.7