Package org.gephi.utils
Class TimeIntervalGraphics
- java.lang.Object
-
- org.gephi.utils.TimeIntervalGraphics
-
public class TimeIntervalGraphics extends Object
Class to draw time intervals as graphics, being able to indicate the colors to use (or default colors).The result graphics are like: |{background color}|time-interval{fill color}|{background color}|
- Author:
- Eduardo Ramos
-
-
Field Summary
Fields Modifier and Type Field Description static ColorDEFAULT_BORDERstatic ColorDEFAULT_FILLprivate doublemaxprivate doubleminprivate doublerange
-
Constructor Summary
Constructors Constructor Description TimeIntervalGraphics(double min, double max)Create a new TimeIntervalGraphics with the given minimum and maximum times to render intervals later.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcalculateRange()BufferedImagecreateTimeIntervalImage(double[] starts, double[] ends, int width, int height, Color fill, Color border, Color background)Creates a time interval graphic representation with the indicated fill, border and background colors (or null to use default colors).BufferedImagecreateTimeIntervalImage(double start, double end, int width, int height)Creates a time interval graphic representation with default colors.BufferedImagecreateTimeIntervalImage(double start, double end, int width, int height, Color fill, Color border)Creates a time interval graphic representation with the indicated fill and border colors (or null to use default colors).BufferedImagecreateTimeIntervalImage(double start, double end, int width, int height, Color fill, Color border, Color background)Creates a time interval graphic representation with the indicated fill and border colors (or null to use default colors).doublegetMax()doublegetMin()private doublenormalize(double d)private doublenormalizeToRange(double d)voidsetMax(double max)voidsetMin(double min)voidsetMinMax(double min, double max)
-
-
-
Method Detail
-
calculateRange
private void calculateRange()
-
createTimeIntervalImage
public BufferedImage createTimeIntervalImage(double start, double end, int width, int height)
Creates a time interval graphic representation with default colors. If starts or ends are infinite, they will be normalized to the min or max values range.- Parameters:
start- Start of the interval (must be greater or equal than minimum time)end- End of the interval (must be lesser or equal than maximum time)width- Image widthheight- Image height- Returns:
- Generated image for the interval
-
createTimeIntervalImage
public BufferedImage createTimeIntervalImage(double start, double end, int width, int height, Color fill, Color border)
Creates a time interval graphic representation with the indicated fill and border colors (or null to use default colors). If starts or ends are infinite, they will be normalized to the min or max values range.- Parameters:
start- Start of the interval (must be greater or equal than minimum time)end- End of the interval (must be lesser or equal than maximum time)width- Image widthheight- Image heightfill- Fill color for the intervalborder- Border color for the interval- Returns:
- Generated image for the interval
-
createTimeIntervalImage
public BufferedImage createTimeIntervalImage(double start, double end, int width, int height, Color fill, Color border, Color background)
Creates a time interval graphic representation with the indicated fill and border colors (or null to use default colors). If starts or ends are infinite, they will be normalized to the min or max values range.- Parameters:
start- Start of the interval (must be greater or equal than minimum time)end- End of the interval (must be lesser or equal than maximum time)width- Image widthheight- Image heightfill- Fill color for the intervalborder- Border color for the intervalbackground- Background color- Returns:
- Generated image for the interval
-
createTimeIntervalImage
public BufferedImage createTimeIntervalImage(double[] starts, double[] ends, int width, int height, Color fill, Color border, Color background)
Creates a time interval graphic representation with the indicated fill, border and background colors (or null to use default colors). If starts or ends are infinite, they will be normalized to the min or max values range.- Parameters:
starts- Starts of the intervals (must be greater or equal than minimum time)ends- Ends of the intervals (must be lesser or equal than maximum time)width- Image widthheight- Image heightfill- Fill color for the intervalborder- Border color for the intervalbackground- Background color- Returns:
- Generated image for the interval
-
getMax
public double getMax()
-
setMax
public void setMax(double max)
-
getMin
public double getMin()
-
setMin
public void setMin(double min)
-
normalize
private double normalize(double d)
-
normalizeToRange
private double normalizeToRange(double d)
-
setMinMax
public void setMinMax(double min, double max)
-
-