From: Freek D. <mac...@us...> - 2010-01-31 22:22:44
|
Update of /cvsroot/rails/18xx/rails/ui/swing/hexmap In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv382/rails/ui/swing/hexmap Modified Files: EWHexMap.java GUIHex.java GUITile.java HexMap.java NSHexMap.java Log Message: Fix indentation: Java files contain 4 spaces, not tabs Index: NSHexMap.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/NSHexMap.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** NSHexMap.java 15 Dec 2009 18:56:11 -0000 1.11 --- NSHexMap.java 31 Jan 2010 22:22:36 -0000 1.12 *************** *** 23,27 **** @Override ! protected void setupHexesGUI() { hexes = new ArrayList<GUIHex>(); --- 23,27 ---- @Override ! protected void setupHexesGUI() { hexes = new ArrayList<GUIHex>(); *************** *** 55,65 **** preferredSize = new Dimension( ! (int) Math.round((hexArray.length + 1) * 3 * scale * zoomFactor), (int) Math.round((hexArray[0].length + 1) * 2 * GUIHex.SQRT3 * scale * zoomFactor)); } ! @Override ! protected void scaleHexesGUI() { hexArray = mapManager.getHexes(); --- 55,65 ---- preferredSize = new Dimension( ! (int) Math.round((hexArray.length + 1) * 3 * scale * zoomFactor), (int) Math.round((hexArray[0].length + 1) * 2 * GUIHex.SQRT3 * scale * zoomFactor)); } ! @Override ! protected void scaleHexesGUI() { hexArray = mapManager.getHexes(); *************** *** 79,85 **** @Override ! public void paint(Graphics g) { ! super.paint(g); Graphics2D g2 = (Graphics2D) g; String label; --- 79,85 ---- @Override ! public void paint(Graphics g) { ! super.paint(g); Graphics2D g2 = (Graphics2D) g; String label; *************** *** 93,117 **** for (int i = 1; i < hexArray.length; i++) { ! label = lettersGoHorizontal ! ? String.valueOf((char)('@'+i)) ! : String.valueOf(i); ! g2.drawString(label, ! (cx - 30 -3*label.length() + 3 * scale * (i + xOffset)), ! yTop); ! g2.drawString(label, ! (cx - 30 -3*label.length() + 3 * scale * (i + xOffset)), ! yBottom); } for (int j = 1; j < 2 * hexArray[0].length; j++) { ! label = lettersGoHorizontal ! ? String.valueOf(j) ! : String.valueOf((char)('@'+j)); ! g2.drawString(label, ! xLeft, ! (int)(cy + 56 + j * GUIHex.SQRT3 * scale)); ! g2.drawString(label, ! xRight, ! (int)(cy + 56 + j * GUIHex.SQRT3 * scale)); } } --- 93,117 ---- for (int i = 1; i < hexArray.length; i++) { ! label = lettersGoHorizontal ! ? String.valueOf((char)('@'+i)) ! : String.valueOf(i); ! g2.drawString(label, ! (cx - 30 -3*label.length() + 3 * scale * (i + xOffset)), ! yTop); ! g2.drawString(label, ! (cx - 30 -3*label.length() + 3 * scale * (i + xOffset)), ! yBottom); } for (int j = 1; j < 2 * hexArray[0].length; j++) { ! label = lettersGoHorizontal ! ? String.valueOf(j) ! : String.valueOf((char)('@'+j)); ! g2.drawString(label, ! xLeft, ! (int)(cy + 56 + j * GUIHex.SQRT3 * scale)); ! g2.drawString(label, ! xRight, ! (int)(cy + 56 + j * GUIHex.SQRT3 * scale)); } } Index: EWHexMap.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/EWHexMap.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** EWHexMap.java 15 Dec 2009 18:56:11 -0000 1.12 --- EWHexMap.java 31 Jan 2010 22:22:36 -0000 1.13 *************** *** 16,20 **** public EWHexMap() { ! scale = defaultScale = 2 * Scale.get(); cx = scale / 2; cy = 0; --- 16,20 ---- public EWHexMap() { ! scale = defaultScale = 2 * Scale.get(); cx = scale / 2; cy = 0; *************** *** 22,26 **** @Override ! protected void setupHexesGUI() { hexes = new ArrayList<GUIHex>(); --- 22,26 ---- @Override ! protected void setupHexesGUI() { hexes = new ArrayList<GUIHex>(); *************** *** 61,66 **** ! @Override ! protected void scaleHexesGUI () { hexArray = mapManager.getHexes(); --- 61,66 ---- ! @Override ! protected void scaleHexesGUI () { hexArray = mapManager.getHexes(); *************** *** 79,88 **** setSize(); ! } @Override ! public void paint(Graphics g) { ! super.paint(g); Graphics2D g2 = (Graphics2D) g; String label; --- 79,88 ---- setSize(); ! } @Override ! public void paint(Graphics g) { ! super.paint(g); Graphics2D g2 = (Graphics2D) g; String label; *************** *** 96,120 **** for (int i = 1; i < 2*hexArray.length; i++) { ! label = lettersGoHorizontal ! ? String.valueOf((char)('@'+i)) ! : String.valueOf(i); ! g2.drawString(label, ! (int) (cx + (26-3*label.length()) + scale * (GUIHex.SQRT3/2 * (i + xOffset))), ! yTop); ! g2.drawString(label, ! (int) (cx + (26-3*label.length()) + scale * (GUIHex.SQRT3/2 * (i + xOffset))), ! yBottom); } for (int j = 1; j < hexArray[0].length; j++) { ! label = lettersGoHorizontal ! ? String.valueOf(j) ! : String.valueOf((char)('@'+j)); ! g2.drawString(label, ! xLeft, ! (int)(cy - 10 + j * 1.5 * scale)); ! g2.drawString(label, ! xRight, ! (int)(cy - 10 + j * 1.5 * scale)); } --- 96,120 ---- for (int i = 1; i < 2*hexArray.length; i++) { ! label = lettersGoHorizontal ! ? String.valueOf((char)('@'+i)) ! : String.valueOf(i); ! g2.drawString(label, ! (int) (cx + (26-3*label.length()) + scale * (GUIHex.SQRT3/2 * (i + xOffset))), ! yTop); ! g2.drawString(label, ! (int) (cx + (26-3*label.length()) + scale * (GUIHex.SQRT3/2 * (i + xOffset))), ! yBottom); } for (int j = 1; j < hexArray[0].length; j++) { ! label = lettersGoHorizontal ! ? String.valueOf(j) ! : String.valueOf((char)('@'+j)); ! g2.drawString(label, ! xLeft, ! (int)(cy - 10 + j * 1.5 * scale)); ! g2.drawString(label, ! xRight, ! (int)(cy - 10 + j * 1.5 * scale)); } Index: HexMap.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/HexMap.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** HexMap.java 15 Dec 2009 18:56:11 -0000 1.20 --- HexMap.java 31 Jan 2010 22:22:36 -0000 1.21 *************** *** 78,90 **** public void setupBars() { ! List<Integer> barSides; ! for (GUIHex hex : hexes) { ! barSides = hex.getHexModel().getImpassableSides(); ! if (barSides != null) { ! for (int k : barSides) { ! if (k < 3) hex.addBar (k); ! } ! } ! } } --- 78,90 ---- public void setupBars() { ! List<Integer> barSides; ! for (GUIHex hex : hexes) { ! barSides = hex.getHexModel().getImpassableSides(); ! if (barSides != null) { ! for (int k : barSides) { ! if (k < 3) hex.addBar (k); ! } ! } ! } } *************** *** 104,108 **** @Override ! public void paintComponent(Graphics g) { super.paintComponent(g); --- 104,108 ---- @Override ! public void paintComponent(Graphics g) { super.paintComponent(g); *************** *** 139,167 **** public void zoomIn () { ! zoomStep++; ! zoom(); } public void zoomOut() { ! zoomStep--; ! zoom(); } protected void zoom() { ! zoomFactor = GameUIManager.getImageLoader().getZoomFactor(zoomStep); ! setScale(); ! scaleHexesGUI(); ! revalidate(); } protected void setScale() { ! scale = (int)(defaultScale * zoomFactor); } public int getZoomStep () { ! return zoomStep; } @Override ! public Dimension getMinimumSize() { Dimension dim = new Dimension(); Rectangle r = (h[h.length][h[0].length]).getBounds(); --- 139,167 ---- public void zoomIn () { ! zoomStep++; ! zoom(); } public void zoomOut() { ! zoomStep--; ! zoom(); } protected void zoom() { ! zoomFactor = GameUIManager.getImageLoader().getZoomFactor(zoomStep); ! setScale(); ! scaleHexesGUI(); ! revalidate(); } protected void setScale() { ! scale = (int)(defaultScale * zoomFactor); } public int getZoomStep () { ! return zoomStep; } @Override ! public Dimension getMinimumSize() { Dimension dim = new Dimension(); Rectangle r = (h[h.length][h[0].length]).getBounds(); *************** *** 172,176 **** @Override ! public Dimension getPreferredSize() { return preferredSize; } --- 172,176 ---- @Override ! public Dimension getPreferredSize() { return preferredSize; } *************** *** 328,346 **** */ public PhaseI getPhase () { ! if (orUIManager != null) { ! //return orUIManager.getGameUIManager().getGameManager().getPhaseManager().getCurrentPhase(); ! GameUIManager u = orUIManager.getGameUIManager(); ! GameManagerI g = u.getGameManager(); ! PhaseManager p = g.getPhaseManager(); ! return p.getCurrentPhase(); ! } ! return null; } public MapManager getMapManager() { ! return mapManager; ! } ! public void mouseClicked(MouseEvent arg0) { Point point = arg0.getPoint(); GUIHex clickedHex = getHexContainingPoint(point); --- 328,346 ---- */ public PhaseI getPhase () { ! if (orUIManager != null) { ! //return orUIManager.getGameUIManager().getGameManager().getPhaseManager().getCurrentPhase(); ! GameUIManager u = orUIManager.getGameUIManager(); ! GameManagerI g = u.getGameManager(); ! PhaseManager p = g.getPhaseManager(); ! return p.getCurrentPhase(); ! } ! return null; } public MapManager getMapManager() { ! return mapManager; ! } ! public void mouseClicked(MouseEvent arg0) { Point point = arg0.getPoint(); GUIHex clickedHex = getHexContainingPoint(point); Index: GUITile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/GUITile.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** GUITile.java 19 Dec 2009 16:48:32 -0000 1.21 --- GUITile.java 31 Jan 2010 22:22:36 -0000 1.22 *************** *** 49,53 **** public GUITile(int tileId, GUIHex guiHex) { ! this.guiHex = guiHex; this.tileId = tileId; this.hex = (MapHex)guiHex.getModel(); --- 49,53 ---- public GUITile(int tileId, GUIHex guiHex) { ! this.guiHex = guiHex; this.tileId = tileId; this.hex = (MapHex)guiHex.getModel(); *************** *** 239,246 **** public void paintTile(Graphics2D g2, int x, int y) { ! int zoomStep = guiHex.getHexMap().getZoomStep(); tileImage = imageLoader.getTile(tileId, zoomStep); ! if (tileImage != null) { double radians = baseRotation + rotation * DEG60; --- 239,246 ---- public void paintTile(Graphics2D g2, int x, int y) { ! int zoomStep = guiHex.getHexMap().getZoomStep(); tileImage = imageLoader.getTile(tileId, zoomStep); ! if (tileImage != null) { double radians = baseRotation + rotation * DEG60; *************** *** 248,252 **** * SVG_X_CENTER_LOC * tileScale); int yCenter = (int) Math.round(tileImage.getHeight() ! * SVG_Y_CENTER_LOC * tileScale); af = AffineTransform.getRotateInstance(radians, xCenter, yCenter); --- 248,252 ---- * SVG_X_CENTER_LOC * tileScale); int yCenter = (int) Math.round(tileImage.getHeight() ! * SVG_Y_CENTER_LOC * tileScale); af = AffineTransform.getRotateInstance(radians, xCenter, yCenter); Index: GUIHex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/GUIHex.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** GUIHex.java 9 Jan 2010 13:30:24 -0000 1.35 --- GUIHex.java 31 Jan 2010 22:22:36 -0000 1.36 *************** *** 105,110 **** public void scaleHex (double cx, double cy, int scale, double zoomFactor) { ! this.zoomFactor = zoomFactor; ! tokenDiameter = (int)Math.round(NORMAL_TOKEN_SIZE * zoomFactor); if (hexMap.getMapManager().getTileOrientation() == MapHex.EW) { --- 105,110 ---- public void scaleHex (double cx, double cy, int scale, double zoomFactor) { ! this.zoomFactor = zoomFactor; ! tokenDiameter = (int)Math.round(NORMAL_TOKEN_SIZE * zoomFactor); if (hexMap.getMapManager().getTileOrientation() == MapHex.EW) { *************** *** 176,180 **** public HexMap getHexMap() { ! return hexMap; } --- 176,180 ---- public HexMap getHexMap() { ! return hexMap; } *************** *** 194,199 **** public void addBar (int orientation) { ! orientation %= 6; ! if (barStartPoints == null) barStartPoints = new ArrayList<Integer>(2); int offset = hexMap.getMapManager().getTileOrientation() == MapHex.EW ? 0 : 4; barStartPoints.add((offset+5-orientation)%6); --- 194,199 ---- public void addBar (int orientation) { ! orientation %= 6; ! if (barStartPoints == null) barStartPoints = new ArrayList<Integer>(2); int offset = hexMap.getMapManager().getTileOrientation() == MapHex.EW ? 0 : 4; barStartPoints.add((offset+5-orientation)%6); *************** *** 351,369 **** for (PrivateCompanyI p : privates) { List<MapHex> blocked = p.getBlockedHexes(); ! if (blocked != null) { ! for (MapHex hex : blocked) { ! if (getHexModel().equals(hex)) { ! g2.drawString( ! "(" + p.getName() + ")", ! rectBound.x ! + (rectBound.width - fontMetrics.stringWidth("(" ! + p.getName() ! + ")")) ! * 1 / 2, ! rectBound.y ! + ((fontMetrics.getHeight() + rectBound.height) * 5 / 15)); ! } ! } ! } } } --- 351,369 ---- for (PrivateCompanyI p : privates) { List<MapHex> blocked = p.getBlockedHexes(); ! if (blocked != null) { ! for (MapHex hex : blocked) { ! if (getHexModel().equals(hex)) { ! g2.drawString( ! "(" + p.getName() + ")", ! rectBound.x ! + (rectBound.width - fontMetrics.stringWidth("(" ! + p.getName() ! + ")")) ! * 1 / 2, ! rectBound.y ! + ((fontMetrics.getHeight() + rectBound.height) * 5 / 15)); ! } ! } ! } } } *************** *** 380,392 **** public void paintBars(Graphics g) { ! if (barStartPoints == null) return; Graphics2D g2 = (Graphics2D) g; ! for (int startPoint : barStartPoints) { ! drawBar(g2, ! (int)Math.round(xVertex[startPoint]), ! (int)Math.round(yVertex[startPoint]), ! (int)Math.round(xVertex[(startPoint+1)%6]), ! (int)Math.round(yVertex[(startPoint+1)%6])); ! } } --- 380,392 ---- public void paintBars(Graphics g) { ! if (barStartPoints == null) return; Graphics2D g2 = (Graphics2D) g; ! for (int startPoint : barStartPoints) { ! drawBar(g2, ! (int)Math.round(xVertex[startPoint]), ! (int)Math.round(yVertex[startPoint]), ! (int)Math.round(xVertex[(startPoint+1)%6]), ! (int)Math.round(yVertex[(startPoint+1)%6])); ! } } *************** *** 470,474 **** center.x, center.y, diameter); token.setBounds(center.x-(int)(0.5*diameter), center.y-(int)(0.5*diameter), ! diameter, diameter); token.drawToken(g2); --- 470,474 ---- center.x, center.y, diameter); token.setBounds(center.x-(int)(0.5*diameter), center.y-(int)(0.5*diameter), ! diameter, diameter); token.drawToken(g2); |