Package pamViewFX.fxNodes.utilsFX
Class ColourArray
java.lang.Object
pamViewFX.fxNodes.utilsFX.ColourArray
- All Implemented Interfaces:
Serializable
,Cloneable
A colour map contains information to create a colour map and the correct CSS to colour components.
- Author:
- Doug Gillespie, modified by Jamie Macaulay to use JavaFX classes
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ColourArray
createBlackToWhiteArray
(int nPoints) static ColourArray
createFireArray
(int nPoints) static ColourArray
createHotArray
(int nPoints) static ColourArray
createMergedArray
(int nPoints, javafx.scene.paint.Color c1, javafx.scene.paint.Color c2) static ColourArray
createMultiColouredArray
(int nPoints, javafx.scene.paint.Color... colourList) Create a multicoloured array of colours that merges in turn between each of the colours given in the list.static ColourArray
createPatrioticArray
(int nPoints) static ColourArray
createStandardColourArray
(int nPoints, ColourArray.ColourArrayType type) static ColourArray
createWhiteToBlackArray
(int nPoints) static ColourArray.ColourArrayType
getColorArrayType
(String name) Get the color array type from it's string name.static javafx.scene.paint.Color[]
Get a list of colours which make up a colour arrayjavafx.scene.paint.Color
getColour
(double iCol) Get a colour from the colour arrayjavafx.scene.paint.Color
getColour
(int iCol) Get a colour from the colour arraystatic ColourArray.ColourArrayType
getColourArrayType
(String name) Get the ColourArrayType from it's string namejavafx.scene.paint.Color[]
javafx.scene.paint.Color
Return a contrasting colour which is different to ALL of the colours in the array.static String
Get the CSS linear gradient for colouring Nodes by the selected colourmap.int[]
getIntColourArray
(int iCol) static javafx.scene.paint.LinearGradient
getLinerGradient
(javafx.geometry.Orientation orientation, double size, ColourArray.ColourArrayType colourArrayType) Get the linear gradient to display on a node node for a colour array.static String
int
void
void
setContrastingColour
(javafx.scene.paint.Color contrastingColor) Set a contrasting colour which is different to ALL of the colours in the array.
-
Method Details
-
getName
-
getColorArrayType
Get the color array type from it's string name.- Parameters:
name
- - string name of color array- Returns:
-
getColourArrayType
Get the ColourArrayType from it's string name- Parameters:
name
- - the string name of the colour array type- Returns:
- the ColourArrayType for the string name. Null if no ColourArrayType found.
-
createStandardColourArray
-
getCSSColourArray
Get the CSS linear gradient for colouring Nodes by the selected colourmap.- Parameters:
type
-- Returns:
- CSS string for a linear gradient representing a colour map.
-
getColorList
Get a list of colours which make up a colour array- Returns:
- the linear gradient
-
createWhiteToBlackArray
-
createBlackToWhiteArray
-
createHotArray
-
createFireArray
-
createPatrioticArray
-
createMultiColouredArray
public static ColourArray createMultiColouredArray(int nPoints, javafx.scene.paint.Color... colourList) Create a multicoloured array of colours that merges in turn between each of the colours given in the list.- Parameters:
nPoints
- total number of colour pointscolourList
- variable number of colours.- Returns:
- a new ColourArray object.
-
createMergedArray
public static ColourArray createMergedArray(int nPoints, javafx.scene.paint.Color c1, javafx.scene.paint.Color c2) -
getColours
public javafx.scene.paint.Color[] getColours() -
getColour
public javafx.scene.paint.Color getColour(double iCol) Get a colour from the colour array- Parameters:
iCol
- - the colour index between 0 and 1 on the colour array.- Returns:
- the colour at at percentage iCol within the array
-
getColour
public javafx.scene.paint.Color getColour(int iCol) Get a colour from the colour array- Parameters:
iCol
- - the colour index. i.e. 0 to N colours- Returns:
- the colour at index iCol;
-
getIntColourArray
public int[] getIntColourArray(int iCol) -
getNumbColours
public int getNumbColours() -
reverseArray
public void reverseArray() -
getContrastingColour
public javafx.scene.paint.Color getContrastingColour()Return a contrasting colour which is different to ALL of the colours in the array. This can be used to draw additional lines over 3D plots made with the array colours.- Returns:
- the contrastingColor
-
setContrastingColour
public void setContrastingColour(javafx.scene.paint.Color contrastingColor) Set a contrasting colour which is different to ALL of the colours in the array. This can be used to draw additional lines over 3D plots made with the array colours.- Parameters:
contrastingColor
- the contrastingColor to set
-
getLinerGradient
public static javafx.scene.paint.LinearGradient getLinerGradient(javafx.geometry.Orientation orientation, double size, ColourArray.ColourArrayType colourArrayType) Get the linear gradient to display on a node node for a colour array.- Parameters:
orientation
- - orientation of the colour gradinet, vertical or horizontal.size
- - size in pixels of the gradient.colourArrayType
- - colour array- Returns:
- the linear graident for the a ColourArrayType.
-