forked from LupusNobilis/java-org.hwo.ui
added MultiPlotPainter
parent
ac96878a66
commit
49871c0fb3
|
@ -0,0 +1,46 @@
|
|||
package org.hwo.ui.diagram;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class MultiPlotPainter implements PlotPainter{
|
||||
|
||||
private LinkedList<PlotPainter> painters;
|
||||
|
||||
public MultiPlotPainter(PlotPainter[] painters) {
|
||||
this.painters = new LinkedList<>();
|
||||
for(PlotPainter p : painters) {
|
||||
this.painters.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
for(PlotPainter p : this.painters) {
|
||||
p.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintPoint(Graphics2D g, Color color, int x, int y, boolean isSelected) {
|
||||
for(PlotPainter p : this.painters) {
|
||||
p.paintPoint(g, color, x, y, isSelected);
|
||||
}
|
||||
}
|
||||
|
||||
public PlotPainter getPainter(int index) {
|
||||
return this.painters.get(index);
|
||||
}
|
||||
public void removePainter(int index) {
|
||||
this.painters.remove(index);
|
||||
}
|
||||
public void removePainter(PlotPainter painter) {
|
||||
this.painters.remove(painter);
|
||||
}
|
||||
|
||||
public void addPainter(PlotPainter painter) {
|
||||
this.painters.add(painter);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue