 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.map.renderer;
22 import java.awt.Color;
23 import java.awt.Graphics;
24 import java.awt.Graphics2D;
25 import java.awt.Point;
26 import javax.swing.Icon;
41 import org.jetbrains.annotations.NotNull;
58 private final Color @NotNull []
highLightMask = {
new Color(1.0f, 0.0f, 0.0f, 0.33f),
new Color(0.0f, 1.0f, 0.0f, 0.33f),
new Color(0.0f, 1.0f, 1.0f, 0.33f), };
84 private final int @NotNull []
xPoints =
new int[4];
89 private final int @NotNull []
yPoints =
new int[4];
95 private final Point
point =
new Point();
119 public IsoMapRenderer(
final int spawnPointTypeNo, @NotNull
final MapViewSettings mapViewSettings, @NotNull
final FilterControl<G, A, R> filterControl, @NotNull
final MapModel<G, A, R> mapModel, @NotNull
final MapGrid mapGrid, @NotNull
final MultiPositionData multiPositionData, @NotNull
final IsoMapSquareInfo isoMapSquareInfo, @NotNull
final GridMapSquarePainter gridMapSquarePainter, @NotNull
final GameObjectParser<G, A, R> gameObjectParser, @NotNull
final ResourceIcons resourceIcons) {
120 super(
spawnPointTypeNo,
mapViewSettings,
mapModel,
mapGrid,
isoMapSquareInfo.
getXLen(), 2 *
isoMapSquareInfo.
getYLen(),
multiPositionData,
isoMapSquareInfo,
gridMapSquarePainter, gameObjectParser, resourceIcons.getResourceIcon(
ResourceIcons.
SQUARE_UNKNOWN));
145 point.setLocation(square.getMapX(), square.getMapY());
147 int highestSubLayer = 0;
148 for (
int subLayer = 0; subLayer < yOffsets.length; subLayer++) {
149 if (yOffsets[subLayer] < yOffsets[highestSubLayer]) {
150 highestSubLayer = subLayer;
154 if (square.isEmpty()) {
157 for (
final G node : square) {
160 final G head = node.getHead();
163 subLayer = highestSubLayer;
171 for (
int subLayer = 0; subLayer < yOffsets.length; subLayer++) {
178 final Color color = g.getColor();
184 yPoints[0] = y + yOffsets[subLayer];
final int[] yPoints
The y-coordinates for painting highlighted squares.
final FilterState filterState
The filter state instance for this map renderer.
A MapModel reflects the data of a map.
Default implementation for GameObject implementing classes.
void clearBackground(@NotNull final Graphics g)
boolean isGameObjectVisible(@NotNull final G gameObject)
void newSquare(@NotNull FilterState filterState)
final MultiPositionData multiPositionData
The MultiPositionData instance to query for multi-part objects.
Base package of all Gridarta classes.
The highlighted state while using a FilterControl instance.
int[] tileStretchingOffsets( @NotNull final Point point, final boolean @NotNull[] foundSubLayers)
Calculates the tile stretching Y offset.
final MapGrid mapGrid
The MapGrid to render.
Provides information about isometric map squares.
final IsoMapSquareInfo isoMapSquareInfo
The IsoMapSquareInfo to use.
final int[] xPoints
The x-coordinates for painting highlighted squares.
void paintGameObjectIfVisible( @NotNull final Graphics2D g, final int xStart, final int yStart, @NotNull final G gameObject)
Paints a single game object if it is visible according to current editor settings.
final FilterControl< G, A, R > filterControl
static final String SUB_LAYER
The name of the "sub_layer" attribute.
final Color[] highLightMask
static final String SQUARE_EMPTY
Container for settings that affect the rendering of maps.
final Point point
Used for calculations in paintSquare.
final int spawnPointTypeNo
The game object type number of spawn points.
Paints overlays for map grids.
Interface for listeners interested in FilterConfig related changes.
Graphical User Interface of Gridarta.
int getXLen()
Returns the horizontal size of a square.
GameObjects are the objects based on Archetypes found on maps.
final MapModel< G, A, R > mapModel
The MapModel to render.
static final long serialVersionUID
Serial Version UID.
boolean canShow(@NotNull G gameObject)
boolean isHighlightedSquare(@NotNull FilterState filterState, int path)
Interface for MapArchObjects.
boolean isEditType(int editType)
Get information on the current state of edit type.
void objectInSquare(@NotNull FilterState filterState, @NotNull G gameObject)
static final String LAYER
The name of the "layer" attribute.
Reading and writing of maps, handling of paths.
static final String SQUARE_UNKNOWN
2D-Grid containing flags for selection, pre-selection, cursor, warnings and errors.
IsoMapRenderer(final int spawnPointTypeNo, @NotNull final MapViewSettings mapViewSettings, @NotNull final FilterControl< G, A, R > filterControl, @NotNull final MapModel< G, A, R > mapModel, @NotNull final MapGrid mapGrid, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser< G, A, R > gameObjectParser, @NotNull final ResourceIcons resourceIcons)
Creates a new instance.
int getYLen()
Returns the vertical size of a square.
void paintSquare(@NotNull final Graphics2D g, final int x, final int y, @NotNull final MapSquare< G, A, R > square)
final boolean[] foundSubLayers
Boolean array for tileStretchingOffsets to avoid allocating lots of arrays.
void removeConfigListener(@NotNull FilterConfigListener listener)
Removes a FilterConfigListener to be notified about changes.
The MultiPositionData class stores an array of numbers which is required in order to calculate displa...
Creates ImageIcon instances from resources.
final FilterConfigListener filterConfigListener
The FilterConfigListener attached to filterControl to repaint all after config changes.
Interface for classes that read or write GameObject instances.
final GridMapSquarePainter gridMapSquarePainter
The GridMapSquarePainter to use.
A MapRenderer that renders isometric squares.
final MapViewSettings mapViewSettings
The map view settings instance.
A AbstractIsoMapRenderer to render map files.
final Icon emptySquareIcon