GRASS
Class Colors
java.lang.Object
|
+--GRASS.Colors
- public class Colors
- extends java.lang.Object
Class to mimic behaviour of original struct Colors from gis.h
It holds red, green, blue intensities for raster categories.
See the GRASS 4.2 Programmer's Manual,
Section 12.20.3 struct Colors
- See Also:
libgis
|
Constructor Summary |
Colors()
Constructs an empty object and allocates memory for GRASS struct Colors. |
Colors(java.lang.String name,
java.lang.String mapset)
Reads and creates color table for the raster or vector file in the
specified mapset. |
|
Method Summary |
java.awt.Color |
G_get_color(int cat)
Extracts color associated with category value. |
int |
intColor(int cat)
Extracts color associated with category value. |
java.lang.String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Colors
public Colors()
- Constructs an empty object and allocates memory for GRASS struct Colors.
Colors
public Colors(java.lang.String name,
java.lang.String mapset)
throws GRASSException
- Reads and creates color table for the raster or vector file in the
specified mapset.
Wraps GRASS library routine:
G_read_colors (name, mapset, colors)
char *name;
char *mapset;
struct Colors *colors;
See the GRASS 4.2 Programmer's Manual,
Section 12.10.3.1 Reading and Writing Raster Color File
- Parameters:
name - GRASS raster or vector file namemapset - Name of mapset where raster or vector file should reside- Throws:
- GRASSException - Exception with an appropriate error message
is thrown if some error occured while reading color
table.
G_get_color
public java.awt.Color G_get_color(int cat)
- Extracts color associated with category value. Wraps GRASS library
routine:
G_get_color (cat, red, green, blue, colors)
CELL cat;
int *red;
int *green;
int *blue;
struct Colors *colors;
See the GRASS 4.2 Programmer's Manual,
Section 12.10.3.2 Lookup Up Raster Colors
- Parameters:
cat - category value- Returns:
- Color associated with provided category value
- See Also:
Color
intColor
public int intColor(int cat)
- Extracts color associated with category value. Wraps GRASS library
routine:
G_get_color (cat, red, green, blue, colors)
CELL cat;
int *red;
int *green;
int *blue;
struct Colors *colors;
See the GRASS 4.2 Programmer's Manual,
Section 12.10.3.2 Lookup Up Raster Colors
- Parameters:
cat - category value- Returns:
- Color associated with provided category value as an integer
value
- See Also:
Color
toString
public java.lang.String toString()
- Returns a string representation of the object.
- Returns:
- String that represents this object (only its location in memory)
- Overrides:
- toString in class java.lang.Object
GRASS-JNI Home Page