001/* 002 * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. 003 * Copyright (C) 2000-2011 The Gridarta Developers. 004 * 005 * This program is free software; you can redistribute it and/or modify 006 * it under the terms of the GNU General Public License as published by 007 * the Free Software Foundation; either version 2 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU General Public License along 016 * with this program; if not, write to the Free Software Foundation, Inc., 017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 018 */ 019 020package net.sf.gridarta.gui.map.mapview; 021 022import java.awt.Point; 023import net.sf.gridarta.model.archetype.TestArchetype; 024import net.sf.gridarta.model.gameobject.TestGameObject; 025import net.sf.gridarta.model.maparchobject.TestMapArchObject; 026import net.sf.gridarta.model.mapcontrol.MapControl; 027import net.sf.gridarta.model.mapcursor.MapCursor; 028import net.sf.gridarta.model.mapgrid.MapGrid; 029import net.sf.gridarta.model.mapmodel.MapModel; 030import org.jetbrains.annotations.NotNull; 031import org.jetbrains.annotations.Nullable; 032 033/** 034 * A {@link MapViewFactory} implementation for testing purposes. 035 * @author Andreas Kirschbaum 036 */ 037public class TestMapViewFactory implements MapViewFactory<TestGameObject, TestMapArchObject, TestArchetype> { 038 039 /** 040 * {@inheritDoc} 041 */ 042 @NotNull 043 @Override 044 public MapView<TestGameObject, TestMapArchObject, TestArchetype> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @Nullable final Point viewPosition, final int viewCounter) { 045 final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); 046 final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize()); 047 return new TestMapView(mapControl, mapGrid, new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(mapGrid, mapModel)); 048 } 049 050}