From: <aki...@us...> - 2006-12-17 16:06:36
|
Revision: 1150 http://svn.sourceforge.net/gridarta/?rev=1150&view=rev Author: akirschbaum Date: 2006-12-17 08:06:35 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 15:57:52 UTC (rev 1149) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-17 16:06:35 UTC (rev 1150) @@ -32,6 +32,7 @@ import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.map.MapControl; +import cfeditor.map.MapModel; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -68,8 +69,6 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - private final MapControl mapControl; - private final CMapViewBasic mapViewBasic; // 32x32 Image and Icon for temprary storing tiles before drawing @@ -100,6 +99,8 @@ private final AffineTransform renderTransform; + private MapModel mapModel; + private Size2D mapSize = new Size2D(1, 1); private final MapGrid mapGrid; @@ -115,8 +116,8 @@ public DefaultLevelRenderer(final CMapViewBasic mapViewBasic, final CMainControl mainControl, final MapControl mapControl, final boolean pickmap, final MapGrid mapGrid) { this.mapViewBasic = mapViewBasic; this.mainControl = mainControl; - this.mapControl = mapControl; - mapSize = mapControl.getMapModel().getMapSize(); + mapModel = mapControl.getMapModel(); + mapSize = mapModel.getMapSize(); this.mapGrid = mapGrid; final AttributeFilter af = new AttributeFilter(); @@ -169,7 +170,6 @@ /** {@inheritDoc} */ @Override public BufferedImage getFullImage() { - final Size2D mapSize = mapControl.getMapSize(); final int mapWidth = 32 * mapSize.getWidth(); final int mapHeight = 32 * mapSize.getHeight(); @@ -250,7 +250,7 @@ for (point.y = 0; point.y < mapGrid.getSize().getHeight(); point.y++) { for (point.x = 0; point.x < mapGrid.getSize().getWidth(); point.x++) { filter.newSquare(); - if (!mapControl.getMapModel().containsArchObject(point)) { + if (!mapModel.containsArchObject(point)) { // empty square if (isPickmap) { grfx.fillRect(point.x * 32 + borderOffset, point.y * 32 + borderOffset, 32, 32); @@ -258,7 +258,7 @@ CMainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32 + borderOffset, point.y * 32 + borderOffset); } } else { - for (final GameObject node : mapControl.getMapModel().getMapSquare(point)) { + for (final GameObject node : mapModel.getMapSquare(point)) { filter.objectInSquare(node); if (!filter.canShow(node)) { continue; @@ -330,7 +330,7 @@ final CFilterControl filter = mainControl.getFilterControl(); filter.newSquare(); // first, draw the object's faces: - if (!mapControl.getMapModel().containsArchObject(point)) { + if (!mapModel.containsArchObject(point)) { // draw the empty-tile icon (direcly to the mapview) if (isPickmap) { grfx.setColor(IGUIConstants.BG_COLOR); @@ -341,7 +341,7 @@ } else { tmpGrfx.fillRect(0, 0, 32, 32); // loop through all arches on that square and draw em - for (final GameObject node : mapControl.getMapModel().getMapSquare(point)) { + for (final GameObject node : mapModel.getMapSquare(point)) { filter.objectInSquare(node); if (!filter.canShow(node)) { continue; @@ -379,7 +379,7 @@ } // We have been drawing to the tmp. buffer, now convert it to // an ImageIcon and paint it into the mapview: - if (mapControl.getMapModel().containsArchObject(point)) { + if (mapModel.containsArchObject(point)) { tmpIcon.setImage(tmpImage); tmpIcon.paintIcon(this, grfx, point.x * 32, point.y * 32); } @@ -481,7 +481,6 @@ } catch (final NoninvertibleTransformException e) { } - final Size2D mapSize = mapViewBasic.getMapControl().getMapSize(); final int xm, ym; if (point.x >= 0 && point.x < mapSize.getWidth() * 32 && point.y >= 0 && point.y < mapSize.getHeight() * 32) { xm = point.x / 32; @@ -518,7 +517,6 @@ return false; } - final Size2D mapSize = mapControl.getMapSize(); final Dimension size = new Dimension(mapSize.getWidth() * 32, mapSize.getHeight() * 32); if (bufferedSize.equals(size)) { return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |