|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJLogView_.utils.LGDrawingStylesUtils
public class LGDrawingStylesUtils
LGDrawingStyleUtils is a class that contains all sorts of useful static methods. It is static so that you can call the methods from anywhere without having to instantiate the object. All the methods are to do with the personalisation of drawing, colours, line styles, symbols for data points. Saving and loading personalised styles.
Field Summary | |
---|---|
static float[][] |
available_strokes
This is the fixed set of 8 available line styles (aka strokes), the personalised styles just mix and match within 8 colours, 8 strokes and 8 symbols |
static java.awt.Color[] |
colours_available
This is the fixed set of 8 available colours, the personalised styles just mix and match within 8 colours, 8 strokes and 8 symbols |
Constructor Summary | |
---|---|
LGDrawingStylesUtils()
|
Method Summary | |
---|---|
static void |
drawSymbol(java.awt.Graphics2D g,
int symbstyle,
int x,
int y,
int size)
This methods draw the requested symbol on a graphics context, with the specified size in pixels and at the given coordinates (in pixels as well). |
static java.awt.BasicStroke |
getBasicStroke(int i)
This methods gives the array representing the line style (aka stroke) of the personalised drawing style at the given index. |
static java.awt.Color |
getColour(int i)
This methods gives the Color object representing the colour of the personalised drawing style at the given index |
static java.awt.Color |
getColour(java.lang.String colname)
given a colour name, this methods returns the appropriate Color object that correspond to it |
static int |
getColourIndex(java.awt.Color c)
Given a Color object this methods tells you at which index in the array of the 8 available colours this colour is. |
static int |
getColourIndex(int ind)
Given an index from the array of personalised colours, this methods tells you which index in the array of the 8 available colours this colour corresponds to. |
static int |
getNStyles()
This methods tells how many personalised drawing styles there are. |
static float[] |
getStroke(int i)
This methods gives the array representing the line style (aka stroke) of the personalised drawing style at the given index. |
static int |
getStrokeIndex(int ind)
Given an index from the array of personalised strokes, this methods tells you which index in the array of the 8 available strokes this stroke corresponds to. |
static int |
getStrokeWidth(int i)
This methods gives the line width in pixels representing the line style (aka stroke) of the drawing style at the given index |
static int |
getSymbol(int i)
This methods gives the type (between 0 and 7) of symbol used for the personalised drawing style at the given index. |
static int |
getSymbolSize(int i)
This methods gives the size of symbol used for the personalised drawing style at the given index. |
static void |
loadDrawingStyles()
This methods initialises the personalised drawing styles. |
static void |
saveDrawingStyles()
This methods saves the personalised drawing styles in an file called 'JLogView_.prefs' situated in $CCP4I_TOP/JLogView_ all details are saved in this file as binary information for two reasons,1) it is much smaller, 2) user can not mess it up |
static void |
setDrawingParameters(java.awt.Color[] cols,
float[][] lines,
int[] widths,
int[] symbs,
int[] sizes)
This methods sets all the parameteres of the personalised drawing styles. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.awt.Color[] colours_available
public static float[][] available_strokes
Constructor Detail |
---|
public LGDrawingStylesUtils()
Method Detail |
---|
public static void setDrawingParameters(java.awt.Color[] cols, float[][] lines, int[] widths, int[] symbs, int[] sizes)
cols
- an array of Color, representing the colour for each drawing stylelines
- an 2-dimension array of float, each entry is an array representing
the line pattern for each drawing stylewidths
- an array of integer giving the line width in pixels of each drawing stylesymbs
- an array of integer giving the symbol type for each drawing style.sizes
- an array of integer giving the symbol size in pixels for each drawing style.Color
public static int getNStyles()
public static int getColourIndex(int ind)
ind
- an integer representing the index in the personalised colour array.
public static int getColourIndex(java.awt.Color c)
c
- a Color object.
Color
public static int getStrokeIndex(int ind)
ind
- an integer representing the index in the personalised stroke array.
public static java.awt.Color getColour(int i)
i
- the index of the personalised drawing style
Color
public static float[] getStroke(int i)
i
- the index of the personalised drawing style
public static int getStrokeWidth(int i)
i
- the index of the personalised drawing style
public static int getSymbol(int i)
i
- the index of the personalised drawing style
public static int getSymbolSize(int i)
i
- the index of the personalised drawing style
public static java.awt.BasicStroke getBasicStroke(int i)
i
- the index of the personalised drawing style
public static java.awt.Color getColour(java.lang.String colname)
colname
- a String representing the colour name
Color
public static void drawSymbol(java.awt.Graphics2D g, int symbstyle, int x, int y, int size)
g
- a Graphics2D object, the graphics context of the canvas on which we will drawsymbstyle
- the type of symbol we want to draw (0<->7)x
- the x coordinate in pixels on the canvasy
- the y coordinate in pixels on the canvassize
- the size of the symbol in pixelsGraphics2D
public static void loadDrawingStyles()
public static void saveDrawingStyles()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |