Rename some classes.

This commit is contained in:
Holt59 2018-02-25 18:34:48 +01:00
parent ae460ff454
commit 71202409b8
6 changed files with 20 additions and 20 deletions

View File

@ -26,7 +26,7 @@ import org.insa.graph.Node;
import org.insa.graph.Point;
import org.insa.graphics.drawing.Drawing;
import org.insa.graphics.drawing.DrawingClickListener;
import org.insa.graphics.drawing.overlays.MarkerTracker;
import org.insa.graphics.drawing.overlays.MarkerOverlay;
public class NodesInputPanel extends JPanel implements DrawingClickListener {
@ -64,7 +64,7 @@ public class NodesInputPanel extends JPanel implements DrawingClickListener {
// Node inputs and markers.
private ArrayList<JTextField> nodeInputs = new ArrayList<>();
private Map<JTextField, MarkerTracker> markerTrackers = new IdentityHashMap<JTextField, MarkerTracker>();
private Map<JTextField, MarkerOverlay> markerTrackers = new IdentityHashMap<JTextField, MarkerOverlay>();
// Component that can be enabled/disabled.
private ArrayList<JComponent> components = new ArrayList<>();
@ -176,7 +176,7 @@ public class NodesInputPanel extends JPanel implements DrawingClickListener {
// Draw marker if possible
Node curnode = getNodeForInput(textField);
MarkerTracker tracker = markerTrackers.getOrDefault(textField, null);
MarkerOverlay tracker = markerTrackers.getOrDefault(textField, null);
if (curnode != null) {
if (tracker == null) {
tracker = drawing.drawMarker(curnode.getPoint(), markerColor);

View File

@ -24,9 +24,9 @@ import org.insa.graph.Graph;
import org.insa.graph.Node;
import org.insa.graph.Path;
import org.insa.graph.Point;
import org.insa.graphics.drawing.overlays.MarkerTracker;
import org.insa.graphics.drawing.overlays.MarkerOverlay;
import org.insa.graphics.drawing.overlays.MarkerUtils;
import org.insa.graphics.drawing.overlays.OverlayTracker;
import org.insa.graphics.drawing.overlays.Overlay;
/**
* Cette implementation de la classe Dessin produit vraiment un affichage (au
@ -40,7 +40,7 @@ public class BasicDrawing extends JPanel implements Drawing {
*/
private static final long serialVersionUID = 96779785877771827L;
public abstract class BasicOverlay implements OverlayTracker {
public abstract class BasicOverlay implements Overlay {
// Visible?
protected boolean visible;
@ -68,7 +68,7 @@ public class BasicDrawing extends JPanel implements Drawing {
};
public class BasicMarker extends BasicOverlay implements MarkerTracker {
public class BasicMarker extends BasicOverlay implements MarkerOverlay {
// Point of the marker.
private Point point;
@ -296,12 +296,12 @@ public class BasicDrawing extends JPanel implements Drawing {
}
@Override
public MarkerTracker drawMarker(Point point) {
public MarkerOverlay drawMarker(Point point) {
return drawMarker(point, this.overlayGraphics.getColor());
}
@Override
public MarkerTracker drawMarker(Point point, Color color) {
public MarkerOverlay drawMarker(Point point, Color color) {
BasicMarker marker = new BasicMarker(point, color);
this.overlays.add(marker);
this.repaint();

View File

@ -5,7 +5,7 @@ import java.awt.Color;
import org.insa.graph.Graph;
import org.insa.graph.Path;
import org.insa.graph.Point;
import org.insa.graphics.drawing.overlays.MarkerTracker;
import org.insa.graphics.drawing.overlays.MarkerOverlay;
public interface Drawing {
@ -33,14 +33,14 @@ public interface Drawing {
*
* @param point
*/
public MarkerTracker drawMarker(Point point);
public MarkerOverlay drawMarker(Point point);
/**
* Draw the given point with the given color.
*
* @param point
*/
public MarkerTracker drawMarker(Point point, Color color);
public MarkerOverlay drawMarker(Point point, Color color);
/**
* Draw a point width the given width and color. Do not use this to mark

View File

@ -14,9 +14,9 @@ import org.insa.graph.Arc;
import org.insa.graph.Graph;
import org.insa.graph.Path;
import org.insa.graph.Point;
import org.insa.graphics.drawing.overlays.MarkerTracker;
import org.insa.graphics.drawing.overlays.MarkerOverlay;
import org.insa.graphics.drawing.overlays.MarkerUtils;
import org.insa.graphics.drawing.overlays.OverlayTracker;
import org.insa.graphics.drawing.overlays.Overlay;
import org.insa.graphics.drawing.overlays.PolylineAutoScaling;
import org.mapsforge.core.graphics.Bitmap;
import org.mapsforge.core.graphics.GraphicFactory;
@ -48,7 +48,7 @@ public class MapViewDrawing extends MapView implements Drawing {
*/
private static final long serialVersionUID = 8606967833704938092L;
public class MapViewOverlayTracker implements OverlayTracker {
public class MapViewOverlayTracker implements Overlay {
// Marker associated.
protected Layer layer;
@ -69,7 +69,7 @@ public class MapViewDrawing extends MapView implements Drawing {
};
public class MapViewMarkerTracker extends MapViewOverlayTracker implements MarkerTracker {
public class MapViewMarkerTracker extends MapViewOverlayTracker implements MarkerOverlay {
public MapViewMarkerTracker(Marker marker) {
super(marker);
@ -190,12 +190,12 @@ public class MapViewDrawing extends MapView implements Drawing {
}
@Override
public MarkerTracker drawMarker(Point point) {
public MarkerOverlay drawMarker(Point point) {
return drawMarker(point, Color.GREEN);
}
@Override
public MarkerTracker drawMarker(Point point, Color color) {
public MarkerOverlay drawMarker(Point point, Color color) {
Bitmap bitmap = new AwtBitmap(MarkerUtils.getMarkerForColor(color));
Marker marker = new Marker(convertPoint(point), bitmap, 0, -bitmap.getHeight() / 2);
getLayerManager().getLayers().add(marker);

View File

@ -2,7 +2,7 @@ package org.insa.graphics.drawing.overlays;
import org.insa.graph.Point;
public interface MarkerTracker extends OverlayTracker {
public interface MarkerOverlay extends Overlay {
/**
* @return The point associated with this marker.

View File

@ -1,6 +1,6 @@
package org.insa.graphics.drawing.overlays;
public interface OverlayTracker {
public interface Overlay {
/**
* Show or hide this marker - A marker should be visible when created.