From: Erik V. <ev...@us...> - 2009-12-18 20:05:09
|
Update of /cvsroot/rails/18xx/rails/ui/swing/hexmap In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5921/rails/ui/swing/hexmap Modified Files: GUITile.java Log Message: Adapted code for correct working with new set of SVG tiles. Removed support for GIF tiles. Index: GUITile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/GUITile.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** GUITile.java 15 Dec 2009 18:56:11 -0000 1.19 --- GUITile.java 18 Dec 2009 20:04:31 -0000 1.20 *************** *** 23,26 **** --- 23,29 ---- protected TileI tile = null; + protected String tileType = null; + //protected double xCenterRelativeLocation = SVG_X_CENTER_LOC; + //protected double yCenterRelativeLocation = SVG_Y_CENTER_LOC; protected BufferedImage tileImage = null; *************** *** 41,44 **** --- 44,52 ---- public static final double DEG60 = Math.PI / 3; + //public static final double DFLT_X_CENTER_LOC = 0.5; + //public static final double DFLT_Y_CENTER_LOC = 0.5; + public static final double SVG_X_CENTER_LOC = 0.489; + public static final double SVG_Y_CENTER_LOC = 0.426; + protected static Logger log = Logger.getLogger(GUITile.class.getPackage().getName()); *************** *** 237,248 **** int zoomStep = guiHex.getHexMap().getZoomStep(); tileImage = imageLoader.getTile(tileId, zoomStep); if (tileImage != null) { double radians = baseRotation + rotation * DEG60; ! int xCenter = ! (int) Math.round(tileImage.getWidth() * 0.5 * tileScale); ! int yCenter = ! (int) Math.round(tileImage.getHeight() * 0.5 * tileScale); af = AffineTransform.getRotateInstance(radians, xCenter, yCenter); --- 245,263 ---- int zoomStep = guiHex.getHexMap().getZoomStep(); tileImage = imageLoader.getTile(tileId, zoomStep); + //if (tileType == null) { + // tileType = imageLoader.getTileType(tileId); + // if (tileType.equalsIgnoreCase("svg")) { + // xCenterRelativeLocation = SVG_X_CENTER_LOC; + // yCenterRelativeLocation = SVG_Y_CENTER_LOC; + // } + //} if (tileImage != null) { double radians = baseRotation + rotation * DEG60; ! int xCenter = (int) Math.round(tileImage.getWidth() ! * SVG_X_CENTER_LOC * tileScale); ! int yCenter = (int) Math.round(tileImage.getHeight() ! * SVG_Y_CENTER_LOC * tileScale); af = AffineTransform.getRotateInstance(radians, xCenter, yCenter); |