Create OverlayTracker as a prent of MarkerTracker to allow tracking of other objects.
This commit is contained in:
@@ -38,10 +38,7 @@ public class BasicDrawing extends JPanel implements Drawing {
|
||||
*/
|
||||
private static final long serialVersionUID = 96779785877771827L;
|
||||
|
||||
public class BasicMarkerTracker implements MarkerTracker {
|
||||
|
||||
// Point of the marker.
|
||||
private Point point;
|
||||
public class BasicOverlayTracker implements OverlayTracker {
|
||||
|
||||
// Image of the marker
|
||||
protected BufferedImage image;
|
||||
@@ -49,23 +46,11 @@ public class BasicDrawing extends JPanel implements Drawing {
|
||||
// Visible?
|
||||
protected boolean visible;
|
||||
|
||||
public BasicMarkerTracker(Point point, BufferedImage image) {
|
||||
this.point = point;
|
||||
public BasicOverlayTracker(BufferedImage image) {
|
||||
this.image = image;
|
||||
this.visible = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveTo(Point point) {
|
||||
this.point = point;
|
||||
BasicDrawing.this.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
@@ -80,6 +65,29 @@ public class BasicDrawing extends JPanel implements Drawing {
|
||||
|
||||
};
|
||||
|
||||
public class BasicMarkerTracker extends BasicOverlayTracker implements MarkerTracker {
|
||||
|
||||
// Point of the marker.
|
||||
private Point point;
|
||||
|
||||
public BasicMarkerTracker(Point point, BufferedImage image) {
|
||||
super(image);
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveTo(Point point) {
|
||||
this.point = point;
|
||||
BasicDrawing.this.repaint();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Default path color.
|
||||
public static final Color DEFAULT_PATH_COLOR = new Color(255, 0, 255);
|
||||
|
||||
|
Reference in New Issue
Block a user