eu.hansolo.steelseries.tools.Section Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SteelSeries Show documentation
Show all versions of SteelSeries Show documentation
The SteelSeries is a javabeans component library that contains gauges.
You will find linear and radial gauges. In addition you will also find
digital displays, indicators from cars and some instruments from airplanes and
sailboats.
package eu.hansolo.steelseries.tools;
import java.awt.Color;
import java.awt.Paint;
import java.awt.geom.Arc2D;
import java.awt.geom.Area;
/**
*
* @author hansolo
*/
public class Section {
//
private double start;
private double stop;
private Color color;
private Color transparentColor;
private Color highlightColor;
private Color transparentHighlightColor;
private Paint paint;
private Area sectionArea;
private Arc2D filledArea;
//
//
public Section() {
this(-1, -1, Color.RED, null, null);
}
public Section(final double START, final double STOP, final Color COLOR) {
this(START, STOP, COLOR, null, null);
}
public Section(final double START, final double STOP, final Color COLOR, final Color HIGHLIGHT_COLOR) {
this(START, STOP, COLOR, HIGHLIGHT_COLOR, null, null);
}
public Section(final double START, final double STOP, final Color COLOR, final Arc2D FILLED_AREA) {
this(START, STOP, COLOR, null, FILLED_AREA);
}
public Section(final double START, final double STOP, final Color COLOR, final Area SECTION_AREA, final Arc2D FILLED_AREA) {
this(START, STOP, COLOR, COLOR.brighter().brighter(), SECTION_AREA, FILLED_AREA);
}
public Section(final double START, final double STOP, final Color COLOR, final Color HIGHLIGHT_COLOR, final Area SECTION_AREA, final Arc2D FILLED_AREA) {
start = START;
stop = STOP;
color = COLOR;
transparentColor = Util.INSTANCE.setAlpha(COLOR, 0.25f);
highlightColor = HIGHLIGHT_COLOR;
transparentHighlightColor = Util.INSTANCE.setAlpha(HIGHLIGHT_COLOR, 0.5f);
sectionArea = SECTION_AREA;
filledArea = FILLED_AREA;
paint = COLOR;
}
//
//
public double getStart() {
return start;
}
public void setStart(final double START) {
start = START;
}
public double getStop() {
return stop;
}
public void setStop(final double STOP) {
stop = STOP;
}
public Color getColor() {
return color;
}
public Color getTransparentColor() {
return transparentColor;
}
public void setColor(final Color COLOR) {
color = COLOR;
transparentColor = Util.INSTANCE.setAlpha(COLOR, 0.25f);
}
public Color getHighlightColor() {
return highlightColor;
}
public Color getTransparentHighlightColor() {
return transparentHighlightColor;
}
public void setHighlightColor(final Color HIGHLIGHT_COLOR) {
highlightColor = HIGHLIGHT_COLOR;
transparentHighlightColor = Util.INSTANCE.setAlpha(HIGHLIGHT_COLOR, 0.5f);
}
public Area getSectionArea() {
return sectionArea;
}
public void setSectionArea(final Area SECTION_AREA) {
sectionArea = SECTION_AREA;
}
public Arc2D getFilledArea() {
return filledArea;
}
public void setFilledArea(final Arc2D FILLED_AREA) {
filledArea = FILLED_AREA;
}
public Paint getPaint() {
return paint;
}
public void setPaint(final Paint PAINT) {
paint = PAINT;
}
//
//
public boolean contains(final double VALUE) {
return ((Double.compare(VALUE, start) >= 0 && Double.compare(VALUE, stop) <= 0)) ? true : false;
}
//
@Override
public String toString() {
return "Section";
}
}