A JGrass colorrule
76777879808182
/** * */ protected void addColorRule( int cat, int r, int g, int b ) { insertRule(cat, new ColorRule(cat, r, g, b)); }
84858687888990
/** * */ protected void addColorRule( float cat0, int r0, int g0, int b0, float cat1, int r1, int g1, int b1 ) { insertRule(cat0, new ColorRule(cat0, r0, g0, b0, cat1, r1, g1, b1)); }
179180181182183184185186187188189190
int low = 0; int high = rules.size() - 1; while( low <= high ) { i = (low + high) / 2; ColorRule crule = (ColorRule) rules.elementAt(i); int c = crule.compare(cat); // System.out.println("C="+c+", I="+i+", cat="+cat+", // CRULE="+crule); if (c == 0) { /* * Attribute found with equal value so break and insert using this index.
207208209210211212213214215216217218
int low = 0; int high = rules.size() - 1; while( low <= high ) { int i = (low + high) / 2; ColorRule crule = (ColorRule) rules.elementAt(i); int c = crule.compare(cat); // System.out.println("C="+c+", I="+i+", cat="+cat+", // CRULE="+crule); if (c == 0) { return crule; } else if (c < 0) {
227228229230231232233234235
/** * */ public byte[] getColor( float x ) { ColorRule crule = get(x); return crule == null ? blank : crule.getColor(x); }