Gridarta Editor
TestMapControlCreatorUtils.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2015 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.gui.map.test;
21 
22 import java.awt.Image;
23 import java.awt.image.BufferedImage;
44 import org.jetbrains.annotations.NotNull;
45 
51 
56  }
57 
63  @NotNull
65  final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel();
66  final MapGrid mapGrid = new MapGrid(mapModel.getMapArchObject().getMapSize());
67  return new TestMapView(mapControl, mapGrid, new MapCursor<>(mapGrid, mapModel));
68  }
69 
75  @NotNull
77  final TestMapModelCreator mapModelCreator = mapControlCreator.getMapModelCreator();
78  return new CopyBuffer<>(mapModelCreator.getMapViewSettings(), mapModelCreator.getGameObjectFactory(), mapControlCreator.getMapArchObjectFactory(), mapControlCreator.getMapModelFactory(), mapModelCreator.getInsertionModeSet());
79  }
80 
86  @NotNull
89  return new MapViewsManager<>(mapControlCreator.getMapModelCreator().getMapViewSettings(), mapViewFactory, mapControlCreator.getMapManager(), mapControlCreator.getPickmapManager(), mapControlCreator.getPathManager());
90  }
91 
97  @NotNull
100  final Image defaultIcon = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
101  final Image defaultPreview = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
102  final CacheFiles cacheFiles = new TestCacheFiles();
103  return new MapImageCache<>(mapControlCreator.getMapManager(), defaultIcon, defaultPreview, rendererFactory, cacheFiles);
104  }
105 
106 }
A MapModel reflects the data of a map.
Definition: MapModel.java:75
Graphical User Interface of Gridarta.
Reading and writing of maps, handling of paths.
Helper class for regression tests to create MapModel instances.
An RendererFactory implementation for testing purposes.
Helper class for creating MapControl instances for regression tests.
Creates derived files for caching files.
Definition: CacheFiles.java:30
MapCursor provides methods to move and drag on map.
Definition: MapCursor.java:57
A MapArchObject implementation for testing purposes.
InsertionModeSet< TestGameObject, TestMapArchObject, TestArchetype > getInsertionModeSet()
Returns the InsertionModeSet instance.
static MapImageCache< TestGameObject, TestMapArchObject, TestArchetype > newMapImageCache(@NotNull final TestMapControlCreator mapControlCreator)
Creates a new MapImageCache instance.
Helper class for creating MapControl instances for regression tests.
Base package of all Gridarta classes.
A CacheFiles implementation for regression test.
GameObjects are the objects based on Archetypes found on maps.
static CopyBuffer< TestGameObject, TestMapArchObject, TestArchetype > newCopyBuffer(@NotNull final TestMapControlCreator mapControlCreator)
Returns a new CopyBuffer instance.
A MapViewFactory implementation for testing purposes.
2D-Grid containing flags for selection, pre-selection, cursor, warnings and errors.
Definition: MapGrid.java:45
Caches icon and preview images for map files.
Base classes for rendering maps.
Factory for creating MapRenderer instances.
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
static MapView< TestGameObject, TestMapArchObject, TestArchetype > newMapView(@NotNull final MapControl< TestGameObject, TestMapArchObject, TestArchetype > mapControl)
Creates a new MapView instance.
Currently nothing more than a marker interface for unification.
Definition: MapControl.java:35
A map view consists of a map grid and a map cursor, and is attached to a map control.
Definition: MapView.java:43
MapViewSettings getMapViewSettings()
Returns the MapViewSettings instance.
An Archetype implementation for testing purposes.
A GameObject implementation for testing purposes.
TestMapControlCreatorUtils()
Private constructor to prevent instantiation.
GameObjectFactory< TestGameObject, TestMapArchObject, TestArchetype > getGameObjectFactory()
Returns the GameObjectFactory instance.
Common base implementation of CopyBuffer.
Definition: CopyBuffer.java:52
A MapView implementation for regression tests.
A factory for creating MapView instances.
static MapViewsManager< TestGameObject, TestMapArchObject, TestArchetype > newMapViewsManager(@NotNull final TestMapControlCreator mapControlCreator)
Creates a new MapViewsManager instance.