public class TLspIndexColorModelStyle extends ALspStyle
Builder
design pattern mechanism.
TLspShapePainter
Modifier and Type | Class and Description |
---|---|
static class |
TLspIndexColorModelStyle.Builder<B extends TLspIndexColorModelStyle.Builder<B>>
Builder for index color model styles.
|
Modifier | Constructor and Description |
---|---|
protected |
TLspIndexColorModelStyle(TLspIndexColorModelStyle.Builder aBuilder)
Creates a new style with the properties that are set on the builder
|
Modifier and Type | Method and Description |
---|---|
TLspIndexColorModelStyle.Builder<?> |
asBuilder()
Creates a new builder initialized with all the properties of this style.
|
boolean |
equals(Object aO) |
IndexColorModel |
getIndexColorModel()
Gets the index color model.
|
float |
getScaleFactor()
Returns the scale factor with which values are multiplied prior to looking
them up in the color model.
|
int |
hashCode() |
boolean |
isTransparent()
Determines whether this style is transparent.
|
static TLspIndexColorModelStyle.Builder<?> |
newBuilder()
Creates a new builder with the default values.
|
addStyleChangeListener, getZOrder, isCompatible, removeStyleChangeListener, style
protected TLspIndexColorModelStyle(TLspIndexColorModelStyle.Builder aBuilder)
aBuilder
- a builder which will be used to initialize this style.public static TLspIndexColorModelStyle.Builder<?> newBuilder()
public TLspIndexColorModelStyle.Builder<?> asBuilder()
public boolean isTransparent()
ALspStyle
isTransparent
in class ALspStyle
public IndexColorModel getIndexColorModel()
null
.
This indexed color model should never be modified. To change the indexed color model you should
create a new style with a different indexed color model instance.public float getScaleFactor()
Example use-case:
Assume you want to visualize a density plot for a layer containing cities, each represented by a point. The density should be based on the population of the city: cities with a large population should have a larger contribution to the density plot compared to cities with a small population.
This can be done by associating a weight to each city, based on the population.
However, the weight should be a factor between 0 and 1.
We could for example use as weight: city population / max population in the dataset
.
If you want to use a color model which maps population values onto colors (and not the weighted values), you
can use this method to rescale the weights back to populations.
In this example, the scale factor would be max population in the dataset
.
ALspDensityStyle.getWeight()