public class DOTNeedlePainter extends JPanel implements DisplayObjectPainter
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
DOTNeedlePainter() |
Modifier and Type | Method and Description |
---|---|
private List<Path2D.Double> |
cutPathToRectangle(Path2D path2D,
Rectangle bounds) |
private void |
drawPoint(Graphics2D g2D,
Point2D point,
MapPane mapPane,
DisplayObject displayObject,
boolean selected) |
Rectangle |
getBoundingRectangle(DisplayObject displayObject,
int type)
Diese Methode gibt das umgebende Rechteck des DisplayObjects für den angebenen Typen zurück.
|
List<Object> |
getCoordinates(List<Object> coordinates,
int type)
Diese Methode berechnet aus den übergebenen Koordinaten die Koordinaten zu dem übergebenen Typ.
|
private Point2D.Double |
getIntersectionPoint(Point2D.Double pointInRect,
Point2D.Double pointOutsideRect,
Rectangle rect) |
private List<Point2D.Double> |
getIntersectionPoints(Rectangle bounds,
Point2D.Double point0,
Point2D.Double point1) |
private double |
getPathLength(Path2D.Double path) |
private Point2D.Double |
getPathMidPoint(Path2D.Double path) |
private Collection<Point2D> |
getPointLocations(MapPane mapPane,
DisplayObject displayObject) |
private Collection<Point2D> |
getPointLocations(MapPane mapPane,
Object o) |
private double |
getScale(MapPane mapPane) |
private double |
n(Point2D.Double p1,
Point2D.Double p2,
Point2D.Double p3,
Point2D.Double p4) |
private Point2D.Double |
nearestPointOnLine(Point2D point0,
Point2D point1,
Point2D centerPoint) |
void |
paintDisplayObject(MapPane mapPane,
Graphics2D g2D,
DisplayObject displayObject,
boolean selected)
Implementationen dieser Methode werden aufgerufen, wenn das DisplayObject gezeichnet werden soll.
|
private double |
s(Point2D.Double p1,
Point2D.Double p2,
Point2D.Double p3,
Point2D.Double p4) |
private double |
t(Point2D.Double p1,
Point2D.Double p2,
Point2D.Double p3,
Point2D.Double p4) |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public void paintDisplayObject(MapPane mapPane, Graphics2D g2D, DisplayObject displayObject, boolean selected)
DisplayObjectPainter
displayObject
die Methode
DisplayObject.getCoordinates(int type)
aufgerufen werden. Diese bewerkstelligt einen lazy Cache; sind die Daten nicht vorhanden, so wird die
Erzeugung an die Methode DisplayObjectPainter.getCoordinates(java.util.List<java.lang.Object>, int)
delegiert, wo auch die Auswertung des Integer-Wertes
stattfindet.paintDisplayObject
in interface DisplayObjectPainter
mapPane
- die Kartenansichtg2D
- ein Graphics2D-Objekt zum ZeichnendisplayObject
- das DisplayObjectselected
- true genau dann, wenn das DisplayObject selektiert ist
private Collection<Point2D> getPointLocations(MapPane mapPane, DisplayObject displayObject)
private Collection<Point2D> getPointLocations(MapPane mapPane, Object o)
private Point2D.Double getPathMidPoint(Path2D.Double path)
private double getPathLength(Path2D.Double path)
private List<Path2D.Double> cutPathToRectangle(Path2D path2D, Rectangle bounds)
private List<Point2D.Double> getIntersectionPoints(Rectangle bounds, Point2D.Double point0, Point2D.Double point1)
private Point2D.Double getIntersectionPoint(Point2D.Double pointInRect, Point2D.Double pointOutsideRect, Rectangle rect)
private double t(Point2D.Double p1, Point2D.Double p2, Point2D.Double p3, Point2D.Double p4)
private double s(Point2D.Double p1, Point2D.Double p2, Point2D.Double p3, Point2D.Double p4)
private double n(Point2D.Double p1, Point2D.Double p2, Point2D.Double p3, Point2D.Double p4)
private Point2D.Double nearestPointOnLine(Point2D point0, Point2D point1, Point2D centerPoint)
private void drawPoint(Graphics2D g2D, Point2D point, MapPane mapPane, DisplayObject displayObject, boolean selected)
private double getScale(MapPane mapPane)
public List<Object> getCoordinates(List<Object> coordinates, int type)
DisplayObjectPainter
In der 4 Standard-Plugins wird nur bei Linien von verschiedenen Typen Gebrauch gemacht: der Typ stellt hier die Verschiebung der Koordinaten dar. Alle anderen Implementation rufen die Methode nur mit dem Wert 0 auf.
getCoordinates
in interface DisplayObjectPainter
coordinates
- die Originalkoordinatentype
- der gewünschte Koordinatentyppublic Rectangle getBoundingRectangle(DisplayObject displayObject, int type)
DisplayObjectPainter
type
wird in DisplayObjectPainter.getCoordinates(java.util.List<java.lang.Object>, int)
informiert.
Diese Methode wird nur aus DisplayObject.getBoundingRectangle( int type) heraus aufgerufen,
wo bereits ein lazy Cache für die Rückgabewerte installiert ist.getBoundingRectangle
in interface DisplayObjectPainter
displayObject
- das DisplayObject