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.graph.Point;
import org.insa.graphics.drawing.Drawing; import org.insa.graphics.drawing.Drawing;
import org.insa.graphics.drawing.DrawingClickListener; 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 { public class NodesInputPanel extends JPanel implements DrawingClickListener {
@ -64,7 +64,7 @@ public class NodesInputPanel extends JPanel implements DrawingClickListener {
// Node inputs and markers. // Node inputs and markers.
private ArrayList<JTextField> nodeInputs = new ArrayList<>(); 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. // Component that can be enabled/disabled.
private ArrayList<JComponent> components = new ArrayList<>(); private ArrayList<JComponent> components = new ArrayList<>();
@ -176,7 +176,7 @@ public class NodesInputPanel extends JPanel implements DrawingClickListener {
// Draw marker if possible // Draw marker if possible
Node curnode = getNodeForInput(textField); Node curnode = getNodeForInput(textField);
MarkerTracker tracker = markerTrackers.getOrDefault(textField, null); MarkerOverlay tracker = markerTrackers.getOrDefault(textField, null);
if (curnode != null) { if (curnode != null) {
if (tracker == null) { if (tracker == null) {
tracker = drawing.drawMarker(curnode.getPoint(), markerColor); 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.Node;
import org.insa.graph.Path; import org.insa.graph.Path;
import org.insa.graph.Point; 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.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 * 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; private static final long serialVersionUID = 96779785877771827L;
public abstract class BasicOverlay implements OverlayTracker { public abstract class BasicOverlay implements Overlay {
// Visible? // Visible?
protected boolean 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. // Point of the marker.
private Point point; private Point point;
@ -296,12 +296,12 @@ public class BasicDrawing extends JPanel implements Drawing {
} }
@Override @Override
public MarkerTracker drawMarker(Point point) { public MarkerOverlay drawMarker(Point point) {
return drawMarker(point, this.overlayGraphics.getColor()); return drawMarker(point, this.overlayGraphics.getColor());
} }
@Override @Override
public MarkerTracker drawMarker(Point point, Color color) { public MarkerOverlay drawMarker(Point point, Color color) {
BasicMarker marker = new BasicMarker(point, color); BasicMarker marker = new BasicMarker(point, color);
this.overlays.add(marker); this.overlays.add(marker);
this.repaint(); this.repaint();

View File

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

View File

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

View File

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