public class MapComponent
extends javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private static java.util.List<java.awt.geom.Point2D> |
CITY |
private static int |
CITY_ROOF_HEIGHT |
private static int |
CITY_WALL_HEIGHT |
private static int |
CITY_WIDTH |
private java.awt.event.ComponentAdapter |
componentAdapter |
private IMapController |
controller |
static int |
HEX_IMAGE_HEIGHT |
static int |
HEX_IMAGE_WIDTH |
private java.awt.event.MouseAdapter |
mouseAdapter |
private static java.util.List<java.awt.geom.Point2D> |
ROAD |
private static int |
ROAD_HEIGHT |
private static int |
ROAD_WIDTH |
private double |
scale |
private static java.util.List<java.awt.geom.Point2D> |
SETTLEMENT |
private static int |
SETTLEMENT_ROOF_HEIGHT |
private static int |
SETTLEMENT_WALL_HEIGHT |
private static int |
SETTLEMENT_WIDTH |
boolean |
temp |
private java.awt.geom.AffineTransform |
transform |
static int |
WORLD_HEIGHT |
static int |
WORLD_WIDTH |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
MapComponent() |
Modifier and Type | Method and Description |
---|---|
private static java.awt.geom.Point2D |
add(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2) |
private static java.awt.geom.Point2D |
average(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2) |
private void |
drawDisallowImage(java.awt.Graphics2D g2,
java.awt.geom.Point2D location) |
private void |
drawDropShape(java.awt.Graphics2D g2) |
private void |
drawGamePiece(java.awt.Graphics2D g2,
java.awt.Polygon polygon,
CatanColor color) |
private void |
drawHexes(java.awt.Graphics2D g2) |
private void |
drawImage(java.awt.Graphics2D g2,
java.awt.image.BufferedImage image,
java.awt.geom.Point2D location) |
private void |
drawImage(java.awt.Graphics2D g2,
java.awt.image.BufferedImage image,
java.awt.geom.Point2D location,
int width,
int height) |
private void |
drawNumbers(java.awt.Graphics2D g2) |
private void |
drawPorts(java.awt.Graphics2D g2) |
private void |
drawRoads(java.awt.Graphics2D g2) |
private void |
drawRoads(java.awt.Graphics2D g2,
Edge edge,
CatanColor color) |
private void |
drawRobber(java.awt.Graphics2D g2) |
private void |
drawVerticies(java.awt.Graphics2D g2) |
IMapController |
getController() |
private static double |
getEdgeAngle(Edge edge) |
private static java.awt.geom.Point2D |
getEdgeCenterPoint(Edge edge) |
private static java.awt.geom.Point2D |
getHexCenterPoint(Hex hex) |
private int |
getPortRotation(Hex hex,
Edge edge) |
double |
getScale() |
private static java.awt.geom.Point2D |
getVertexPoint(Coordinate point) |
protected void |
paintComponent(java.awt.Graphics g) |
private static java.util.List<java.awt.geom.Point2D> |
rotateShape(java.util.List<java.awt.geom.Point2D> points,
double radians) |
void |
setController(IController controller) |
private static java.awt.Polygon |
toPolygon(java.util.List<java.awt.geom.Point2D> points) |
private static java.util.List<java.awt.geom.Point2D> |
translateShape(java.util.List<java.awt.geom.Point2D> points,
java.awt.geom.Point2D delta) |
private void |
updateScale() |
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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
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, getAccessibleContext, 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 boolean temp
public static final int HEX_IMAGE_WIDTH
public static final int HEX_IMAGE_HEIGHT
public static final int WORLD_WIDTH
public static final int WORLD_HEIGHT
private static final int ROAD_HEIGHT
private static final int ROAD_WIDTH
private static final int SETTLEMENT_WIDTH
private static final int SETTLEMENT_WALL_HEIGHT
private static final int SETTLEMENT_ROOF_HEIGHT
private static final int CITY_WIDTH
private static final int CITY_WALL_HEIGHT
private static final int CITY_ROOF_HEIGHT
private static java.util.List<java.awt.geom.Point2D> SETTLEMENT
private static java.util.List<java.awt.geom.Point2D> CITY
private static java.util.List<java.awt.geom.Point2D> ROAD
private IMapController controller
private double scale
private java.awt.geom.AffineTransform transform
private java.awt.event.ComponentAdapter componentAdapter
private java.awt.event.MouseAdapter mouseAdapter
private void updateScale()
public IMapController getController()
public void setController(IController controller)
public double getScale()
protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
private void drawHexes(java.awt.Graphics2D g2)
private void drawNumbers(java.awt.Graphics2D g2)
private void drawRobber(java.awt.Graphics2D g2)
private void drawRoads(java.awt.Graphics2D g2)
private void drawRoads(java.awt.Graphics2D g2, Edge edge, CatanColor color)
private void drawVerticies(java.awt.Graphics2D g2)
private void drawGamePiece(java.awt.Graphics2D g2, java.awt.Polygon polygon, CatanColor color)
private void drawPorts(java.awt.Graphics2D g2)
private void drawDisallowImage(java.awt.Graphics2D g2, java.awt.geom.Point2D location)
private void drawDropShape(java.awt.Graphics2D g2)
private void drawImage(java.awt.Graphics2D g2, java.awt.image.BufferedImage image, java.awt.geom.Point2D location)
private void drawImage(java.awt.Graphics2D g2, java.awt.image.BufferedImage image, java.awt.geom.Point2D location, int width, int height)
private static java.awt.geom.Point2D getHexCenterPoint(Hex hex)
private static java.awt.geom.Point2D getEdgeCenterPoint(Edge edge)
private static double getEdgeAngle(Edge edge)
private static java.awt.Polygon toPolygon(java.util.List<java.awt.geom.Point2D> points)
private static java.util.List<java.awt.geom.Point2D> rotateShape(java.util.List<java.awt.geom.Point2D> points, double radians)
private static java.util.List<java.awt.geom.Point2D> translateShape(java.util.List<java.awt.geom.Point2D> points, java.awt.geom.Point2D delta)
private static java.awt.geom.Point2D average(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)
private static java.awt.geom.Point2D add(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)
private static java.awt.geom.Point2D getVertexPoint(Coordinate point)