Gridarta Editor
AbstractIsoMapRenderer.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 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.renderer;
21 
22 import java.awt.AlphaComposite;
23 import java.awt.Color;
24 import java.awt.Composite;
25 import java.awt.Dimension;
26 import java.awt.Graphics;
27 import java.awt.Graphics2D;
28 import java.awt.Point;
29 import java.awt.Rectangle;
30 import java.awt.geom.AffineTransform;
31 import java.awt.image.BufferedImage;
32 import java.util.Arrays;
33 import java.util.Set;
34 import javax.swing.Icon;
55 import net.sf.gridarta.utils.Size2D;
56 import org.jetbrains.annotations.NotNull;
57 import org.jetbrains.annotations.Nullable;
58 
66 public abstract class AbstractIsoMapRenderer<G extends DefaultIsoGameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractMapRenderer<G, A, R> {
67 
71  private static final long serialVersionUID = 1L;
72 
76  @NotNull
77  private static final Color BACKGROUND_COLOR = new Color(255, 255, 255, 0);
78 
82  private final int spawnPointTypeNo;
83 
88  @NotNull
89  private final Point borderOffset;
90 
94  @NotNull
95  private final Point origin = new Point();
96 
100  @NotNull
102 
106  @NotNull
107  private Size2D mapSize;
108 
112  @NotNull
113  private final MapGrid mapGrid;
114 
118  @NotNull
119  private final Icon unknownSquareIcon;
120 
124  @NotNull
125  private final Point tmpPoint = new Point();
126 
130  private final Rectangle tmpRec = new Rectangle();
131 
135  @NotNull
137 
141  @NotNull
143 
147  @NotNull
149 
153  @NotNull
155 
159  private int minYOffset;
160 
164  private int maxYOffset;
165 
170  protected final boolean @NotNull [] foundSubLayers = new boolean[DefaultIsoGameObject.MAX_SUB_LAYERS];
171 
176  @NotNull
178 
179  @Override
180  public void gridVisibleChanged(final boolean gridVisible) {
181  forceRepaint();
182  }
183 
184  @Override
185  public void lightVisibleChanged(final boolean lightVisible) {
186  forceRepaint();
187  }
188 
189  @Override
190  public void smoothingChanged(final boolean smoothing) {
191  // does not render smoothed faces
192  }
193 
194  @Override
195  public void tileStretchingChanged(final boolean tileStretching) {
196  resizeFromModel();
197  forceRepaint();
198  }
199 
200  @Override
201  public void doubleFacesChanged(final boolean doubleFaces) {
202  forceRepaint();
203  }
204 
205  @Override
206  public void alphaTypeChanged(final int alphaType) {
207  forceRepaint();
208  }
209 
210  @Override
211  public void editTypeChanged(final int editType) {
212  // changed game objects will be rendered
213  }
214 
215  @Override
216  public void autojoinChanged(final boolean autojoin) {
217  // ignore
218  }
219 
220  };
221 
225  @NotNull
227 
228  @Override
229  public void mapSizeChanged(@NotNull final Size2D newSize) {
230  // ignore: will trigger an mapGridChanged() callback
231  }
232 
233  @Override
234  public void mapSquaresChanged(@NotNull final Set<MapSquare<G, A, R>> mapSquares) {
235  repaint(); // TODO: only repaint a specific region
236  }
237 
238  @Override
239  public void mapObjectsChanged(@NotNull final Set<G> gameObjects, @NotNull final Set<G> transientGameObjects) {
241  boolean resize = false;
242  for (final G gameObject : gameObjects) {
243  if (!gameObject.isStretched(true)) {
244  continue;
245  }
246 
247  if (!resize && gameObject.getAttributeInt(DefaultIsoGameObject.LAYER) == 1) {
248  final int yOffset = gameObject.getAttributeInt(DefaultIsoGameObject.Z);
249 
250  if (yOffset > maxYOffset || yOffset < minYOffset) {
251  resize = true;
252  }
253  }
254 
255  final MapSquare<G, A, R> mapSquare = gameObject.getMapSquareOptional();
256  if (mapSquare == null) {
257  continue;
258  }
259 
260  final MapModel<G, A, R> mapModel = mapSquare.getMapModel();
261  final int subLayer = gameObject.getAttributeInt(DefaultIsoGameObject.SUB_LAYER);
262 
263  for (final Direction direction : Direction.values()) {
264  if (direction.getDz() != 0) {
265  continue;
266  }
267 
268  mapSquare.getMapLocation(tmpPoint, direction.getDx(), direction.getDy());
269  final MapSquare<G, A, R> mapSquareAdjacent;
270  try {
271  mapSquareAdjacent = mapModel.getMapSquare(tmpPoint);
272  } catch (final IndexOutOfBoundsException ignored) {
273  continue;
274  }
275  for (final G gameObjectAdjacent : mapSquareAdjacent) {
276  if (!gameObjectAdjacent.isStretched(true)) {
277  continue;
278  }
279 
280  if (gameObjectAdjacent.getAttributeInt(DefaultIsoGameObject.SUB_LAYER) != subLayer) {
281  continue;
282  }
283 
284  gameObjectAdjacent.refreshStretchFactor();
285  }
286  }
287 
288  gameObject.refreshStretchFactor();
289  }
290 
291  if (resize) {
292  resizeFromModel();
293  }
294  }
295 
296  repaint(); // TODO: only repaint a specific region
297  }
298 
299  @Override
300  public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) {
301  // ignore
302  }
303 
304  @Override
305  public void mapFileChanged(@Nullable final MapFile oldMapFile) {
306  // ignore
307  }
308 
309  @Override
310  public void modifiedChanged() {
311  // ignore
312  }
313 
314  };
315 
319  @NotNull
321 
322  @Override
323  public void mapGridChanged(@NotNull final MapGridEvent e) {
324  repaint();
325  }
326 
327  @Override
328  public void mapGridResized(@NotNull final MapGridEvent e) {
329  mapSize = e.getSource().getSize();
330  calculateOrigin();
331  resizeFromModel();
332  repaint();
333  }
334 
335  };
336 
353  protected AbstractIsoMapRenderer(final int spawnPointTypeNo, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModel<G, A, R> mapModel, @NotNull final MapGrid mapGrid, final int borderOffsetX, final int borderOffsetY, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final Icon unknownSquareIcon) {
354  super(mapModel, gameObjectParser);
355  this.spawnPointTypeNo = spawnPointTypeNo;
356  this.mapViewSettings = mapViewSettings;
357  this.multiPositionData = multiPositionData;
358  this.isoMapSquareInfo = isoMapSquareInfo;
359  this.gridMapSquarePainter = gridMapSquarePainter;
360  borderOffset = new Point(borderOffsetX, borderOffsetY);
361  this.mapModel = mapModel;
362  mapSize = this.mapModel.getMapArchObject().getMapSize();
363  this.mapGrid = mapGrid;
364  this.unknownSquareIcon = unknownSquareIcon;
365 
367 
368  setToolTipText("dummy");
369  setFocusable(true);
370  calculateOrigin();
371  resizeFromModel();
374  }
375 
376  @Override
377  public void closeNotify() {
381  }
382 
387  private void calculateOrigin() {
389  }
390 
399  private void setBorderOffset(final int x, final int y) {
400  borderOffset.setLocation(x, y);
401  calculateOrigin();
402  }
403 
404  @NotNull
405  @Override
406  public Size2D getImageSize() {
407  throw new IllegalStateException("operation not supported");
408  }
409 
410  @NotNull
411  @Override
412  public BufferedImage getFullImage() {
413  // set map dimensions for iso view
414  final int mapWidth = mapSize.getWidth();
415  final int mapHeight = mapSize.getHeight();
416  final int sum = mapWidth + mapHeight;
417  final int viewWidth = sum * isoMapSquareInfo.getXLen2();
418  final int viewHeight = sum * isoMapSquareInfo.getYLen2();
419 
420  // first create a storing place for the image
421  final BufferedImage image = new BufferedImage(viewWidth, viewHeight, BufferedImage.TYPE_INT_ARGB);
422  final Graphics2D graphics = image.createGraphics();
423  graphics.setColor(BACKGROUND_COLOR);
424  graphics.fillRect(0, 0, viewWidth, viewHeight);
425 
426  // paint the map view into the image
427  final Point storeOffset = new Point(borderOffset);
428  setBorderOffset(0, 0);
429 
430  clearBackground(graphics);
431  final Point pos = new Point();
432  for (pos.y = 0; pos.y < mapHeight; pos.y++) {
433  int xStart = origin.x - (pos.y + 1) * isoMapSquareInfo.getXLen2();
434  int yStart = origin.y + pos.y * isoMapSquareInfo.getYLen2();
435  for (pos.x = 0; pos.x < mapWidth; pos.x++) {
436  paintSquare(graphics, xStart, yStart, mapModel.getMapSquare(pos));
437  xStart += isoMapSquareInfo.getXLen2();
438  yStart += isoMapSquareInfo.getYLen2();
439  }
440  }
441 
442  paintMapGrid(graphics);
443  paintMapSelection(graphics);
444 
445  setBorderOffset(storeOffset.x, storeOffset.y);
446  return image;
447  }
448 
449  @Override
450  public void paintComponent(@NotNull final Graphics g) {
451  paintComponent2((Graphics2D) g);
452  }
453 
454  @Override
455  public void forceRepaint() {
456  repaint();
457  }
458 
459  @NotNull
460  @Override
461  public Rectangle getSquareBounds(@NotNull final Point p) {
462  tmpRec.x = origin.x - (p.y + 1) * isoMapSquareInfo.getXLen2() + p.x * isoMapSquareInfo.getXLen2();
464  tmpRec.width = isoMapSquareInfo.getXLen();
465  tmpRec.height = isoMapSquareInfo.getYLen();
466  return tmpRec;
467  }
468 
473  protected abstract void clearBackground(@NotNull Graphics g);
474 
482  protected abstract void paintSquare(@NotNull Graphics2D g, int x, int y, @NotNull MapSquare<G, A, R> square);
483 
488  private void paintComponent2(@NotNull final Graphics2D g) {
489  clearBackground(g);
490  final Rectangle rec = getRepaintRec(getVisibleRect());
491  final Point pos = new Point();
492  final Point endPos = rec.getLocation();
493  endPos.translate(rec.width, rec.height);
494  for (pos.y = rec.y; pos.y < endPos.y; pos.y++) {
495  int xStart = origin.x - (pos.y - rec.x + 1) * isoMapSquareInfo.getXLen2();
496  int yStart = origin.y + (pos.y + rec.x) * isoMapSquareInfo.getYLen2();
497  for (pos.x = rec.x; pos.x < endPos.x; pos.x++) {
498  if (g.hitClip(xStart, yStart - isoMapSquareInfo.getYLen() * 4 - minYOffset, isoMapSquareInfo.getXLen(), isoMapSquareInfo.getYLen() * 5 + maxYOffset)) {
499  paintSquare(g, xStart, yStart, mapModel.getMapSquare(pos));
500  }
501  xStart += isoMapSquareInfo.getXLen2();
502  yStart += isoMapSquareInfo.getYLen2();
503  }
504  }
505 
506  paintMapGrid(g);
508  }
509 
515  private Rectangle getRepaintRec(@NotNull final Rectangle visibleRectangle) {
516  // This Rectangle will be returned
517  final Rectangle rec = new Rectangle();
518  // Upper left corner of viewport
519  final Point posUL = visibleRectangle.getLocation();
520  // Dimension of viewport
521  final Dimension visDim = visibleRectangle.getSize();
522  // Other positions of viewport corners
523  final Point posUR = new Point(posUL.x + visDim.width, posUL.y);
524  final Point posDL = new Point(posUL.x, posUL.y + visDim.height);
525  final Point posDR = new Point(posUR.x, posDL.y);
526  // Calculate map positions of corners and from them properties of Rectangle
527  rec.x = getSquareLocationAt(posUL, tmpPoint) ? tmpPoint.x : 0;
528  rec.y = getSquareLocationAt(posUR, tmpPoint) ? tmpPoint.y : 0;
529  rec.height = getSquareLocationAt(posDL, tmpPoint) ? tmpPoint.y - rec.y + 1 : mapSize.getHeight() - rec.y;
530  rec.width = getSquareLocationAt(posDR, tmpPoint) ? tmpPoint.x - rec.x + 1 : mapSize.getWidth() - rec.x;
531  return rec;
532  }
533 
540  protected abstract boolean isGameObjectVisible(@NotNull G gameObject);
541 
550  protected void paintGameObjectIfVisible(@NotNull final Graphics2D g, final int xStart, final int yStart, @NotNull final G gameObject) {
551  final G head = gameObject.getHead();
552  if (isGameObjectVisible(head)) {
553  paintGameObject(g, xStart, yStart, gameObject, false);
554  }
555  }
556 
565  private void paintGameObject(@NotNull final Graphics2D g, final int xStart, final int yStart, @NotNull final G gameObject, final boolean inSpawnPoint) {
566  final G head = gameObject.getHead();
567  final Icon icon;
568  if ("trans.101".equals(head.getFaceObjName())) {
569  icon = unknownSquareIcon;
570  } else {
571  final boolean drawDouble = head.isDrawDouble(mapViewSettings.isDoubleFaces());
572  final boolean isStretched = head.isStretched(mapViewSettings.isTileStretching());
573  if (mapViewSettings.isAlphaType(head.getEditType())) {
574  icon = drawDouble ? head.getTransparentDoubleImage() : head.getTransparentImage();
575  } else {
576  if (isStretched) {
577  final long stretchFactor = head.getStretchFactor();
578  if (stretchFactor != 0) {
579  icon = head.getStretchedImage(stretchFactor);
580  } else if (drawDouble) {
581  icon = head.getDoubleImage();
582  } else {
583  icon = head.getNormalImage();
584  }
585  } else if (drawDouble) {
586  icon = head.getDoubleImage();
587  } else {
588  icon = head.getNormalImage();
589  }
590  }
591  }
592  final int xOffset = head.getAttributeInt(DefaultIsoGameObject.ALIGN);
593  final int yOffset = head.getYOffset();
594  final int zoom = head.getAttributeInt(DefaultIsoGameObject.ZOOM);
595  final double rotate = getRotate(head);
596  final int alpha = head.getAttributeInt(DefaultIsoGameObject.ALPHA);
597  final int tmpIconWidth;
598  final int tmpIconHeight;
599  if (zoom == 0 || zoom == 100) {
600  tmpIconWidth = icon.getIconWidth();
601  tmpIconHeight = icon.getIconHeight();
602  } else {
603  tmpIconWidth = (icon.getIconWidth() * zoom + 50) / 100;
604  tmpIconHeight = (icon.getIconHeight() * zoom + 50) / 100;
605  }
606  final int iconWidth;
607  final int iconHeight;
608  if (rotate < 0.001) {
609  iconWidth = tmpIconWidth;
610  iconHeight = tmpIconHeight;
611  } else {
612  iconWidth = (int) (Math.abs(Math.cos(rotate) * tmpIconWidth) + 0.5) + (int) (Math.abs(Math.sin(rotate) * tmpIconHeight) + 0.5);
613  iconHeight = (int) (Math.abs(Math.sin(rotate) * tmpIconWidth) + 0.5) + (int) (Math.abs(Math.cos(rotate) * tmpIconHeight) + 0.5);
614  }
615  if (head.getMultiRefCount() > 0) {
616  final R archetype = gameObject.getArchetype();
617  if (inSpawnPoint || archetype.isLowestPart()) {
618  final int headMultiShapeID = head.getArchetype().getMultiShapeID();
619  final int multiPartNr = archetype.getMultiPartNr();
620  final int x = xStart - multiPositionData.getXOffset(headMultiShapeID, multiPartNr) + multiPositionData.getWidth(headMultiShapeID) / 2 - iconWidth / 2;
621  final int y = yStart - multiPositionData.getYOffset(headMultiShapeID, multiPartNr) + isoMapSquareInfo.getYLen() - iconHeight;
622  paintScaledIcon(g, icon, x + xOffset, y - yOffset, zoom, alpha, rotate, tmpIconWidth, tmpIconHeight, iconWidth, iconHeight);
623  }
624  } else {
625  final int x = xStart + (iconWidth > isoMapSquareInfo.getXLen() ? isoMapSquareInfo.getXLen2() - iconWidth / 2 : 0);
626  final int y = yStart + isoMapSquareInfo.getYLen() - iconHeight;
627  paintScaledIcon(g, icon, x + xOffset, y - yOffset, zoom, alpha, rotate, tmpIconWidth, tmpIconHeight, iconWidth, iconHeight);
628  }
629 
630  // Paint first object (most likely a mob) in spawn points.
631  if (!inSpawnPoint && isSpawnPoint(head)) {
632  final G mob = head.getFirst();
633  if (mob != null) {
634  paintGameObject(g, xStart, yStart, mob, true);
635  }
636  }
637  }
638 
644  private static double getRotate(@NotNull final Attributes head) {
645  final int rotate = -head.getAttributeInt(DefaultIsoGameObject.ROTATE) % 360;
646  return (rotate < 0 ? rotate + 360 : rotate) * 2 * Math.PI / 360;
647  }
648 
663  private void paintScaledIcon(@NotNull final Graphics2D g, @NotNull final Icon icon, final int x, final int y, final int zoom, final int alpha, final double rotate, final int oldIconWidth, final int oldIconHeight, final int newIconWidth, final int newIconHeight) {
664  if (zoom <= 0 || zoom == 100) {
665  paintAlphaIcon(g, icon, x, y, alpha, rotate, oldIconWidth, oldIconHeight, newIconWidth, newIconHeight);
666  } else {
667  final AffineTransform savedTransform = g.getTransform();
668  try {
669  g.translate(x, y);
670  g.scale(zoom / 100.0, zoom / 100.0);
671  paintAlphaIcon(g, icon, 0, 0, alpha, rotate, oldIconWidth, oldIconHeight, newIconWidth, newIconHeight);
672  } finally {
673  g.setTransform(savedTransform);
674  }
675  }
676  }
677 
691  private void paintAlphaIcon(@NotNull final Graphics2D g, @NotNull final Icon icon, final int x, final int y, final int alpha, final double rotate, final int oldIconWidth, final int oldIconHeight, final int newIconWidth, final int newIconHeight) {
692  if (alpha <= 0 || alpha >= 255) {
693  paintRotatedIcon(g, icon, x, y, rotate, oldIconWidth, oldIconHeight, newIconWidth, newIconHeight);
694  } else {
695  final Composite savedComposite = g.getComposite();
696  try {
697  g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha / 255.0F));
698  paintRotatedIcon(g, icon, x, y, rotate, oldIconWidth, oldIconHeight, newIconWidth, newIconHeight);
699  } finally {
700  g.setComposite(savedComposite);
701  }
702  }
703  }
704 
717  private void paintRotatedIcon(@NotNull final Graphics2D g, @NotNull final Icon icon, final int x, final int y, final double rotate, final int oldIconWidth, final int oldIconHeight, final int newIconWidth, final int newIconHeight) {
718  if (rotate < 0.001) {
719  g.translate(x, y);
720  try {
721  paintIcon(g, icon);
722  } finally {
723  g.translate(-x, -y);
724  }
725  } else {
726  final AffineTransform savedTransform = g.getTransform();
727  try {
728  g.translate(x + newIconWidth / 2, y + newIconHeight / 2);
729  g.rotate(rotate);
730  g.translate(-oldIconWidth / 2, -oldIconHeight / 2);
731  paintIcon(g, icon);
732  } finally {
733  g.setTransform(savedTransform);
734  }
735  }
736  }
737 
743  protected void paintIcon(@NotNull final Graphics2D g, @NotNull final Icon icon) {
744  icon.paintIcon(this, g, 0, 0);
745  }
746 
752  private boolean isSpawnPoint(@NotNull final BaseObject<G, A, R, ?> gameObject) {
753  return gameObject.getTypeNo() == spawnPointTypeNo;
754  }
755 
762  private void paintMapSelection(@NotNull final Graphics g) {
764  final Point point = new Point();
765  for (int y = 0; y < mapSize.getHeight(); y++) {
766  int xStart = origin.x - (y + 1) * isoMapSquareInfo.getXLen2();
767  int yStart = origin.y + y * isoMapSquareInfo.getYLen2();
768  point.y = y;
769  for (int x = 0; x < mapSize.getWidth(); x++) {
770  point.x = x;
771  final int[] offsets = tileStretchingOffsets(point, foundSubLayers);
772 
773  for (int subLayer = 0; subLayer < offsets.length; subLayer++) {
774  if (!foundSubLayers[subLayer]) {
775  continue;
776  }
777  final int yStart2 = yStart + offsets[subLayer];
778  if (g.hitClip(xStart, yStart2, isoMapSquareInfo.getXLen(), isoMapSquareInfo.getYLen())) {
779  final int gridFlags = mapGrid.getFlags(x, y);
780  final boolean light = lightVisible && mapModel.getMapSquare(point).isLight();
781  gridMapSquarePainter.paint(g, gridFlags, light, xStart, yStart2, this);
782  } else {
783  /* DO NOTHING if outside clip region.
784  * DO NOT use continue. xStart and yStart are recalculated at the end of the loop.
785  */
786  }
787  }
788  xStart += isoMapSquareInfo.getXLen2();
789  yStart += isoMapSquareInfo.getYLen2();
790  }
791  }
792  }
793 
800  private void paintMapGrid(@NotNull final Graphics g) {
802  // draw iso grid
803  g.setColor(Color.black);
804 
805  final int mapWidth = mapSize.getWidth();
806  final int mapHeight = mapSize.getHeight();
807  for (int x = 0; x <= mapWidth; x++) {
808  g.drawLine(origin.x + x * isoMapSquareInfo.getXLen2() - 1, origin.y + x * isoMapSquareInfo.getYLen2() - 1, origin.x - (mapHeight - x) * isoMapSquareInfo.getXLen2() - 1, origin.y + (mapHeight + x) * isoMapSquareInfo.getYLen2() - 1);
809  }
810  for (int y = 0; y <= mapHeight; y++) {
811  g.drawLine(origin.x - y * isoMapSquareInfo.getXLen2() - 1, origin.y + y * isoMapSquareInfo.getYLen2() - 1, origin.x + (mapWidth - y) * isoMapSquareInfo.getXLen2() - 1, origin.y + (mapWidth + y) * isoMapSquareInfo.getYLen2() - 1);
812  }
813  }
814  }
815 
823  protected int @NotNull [] tileStretchingOffsets(@NotNull final Point point, final boolean @NotNull [] foundSubLayers) {
824  Arrays.fill(foundSubLayers, false);
825 
826  final int[] offsets = new int[DefaultIsoGameObject.MAX_SUB_LAYERS];
827  boolean foundAny = false;
829  for (final G gameObject : mapModel.getMapSquare(point)) {
830  final G head = gameObject.getHead();
831  if (head.isStretched(true) && head.getAttributeInt(DefaultIsoGameObject.LAYER) == 1) {
832  final int yOffset = head.getAttributeInt(DefaultIsoGameObject.Z);
833  final int subLayer = head.getAttributeInt(DefaultIsoGameObject.SUB_LAYER);
834  if (yOffset > offsets[subLayer]) {
835  offsets[subLayer] = yOffset;
836  }
837  foundSubLayers[subLayer] = true;
838  foundAny = true;
839  }
840  }
841  }
842 
843  if (!foundAny) {
844  foundSubLayers[0] = true;
845  }
846 
847  for (int subLayer = 0; subLayer < offsets.length; subLayer++) {
848  offsets[subLayer] = maxYOffset - offsets[subLayer];
849  }
850 
851  return offsets;
852  }
853 
854  @Override
855  public boolean getSquareLocationAt(@NotNull final Point point, @NotNull final Point retPoint) {
856  if (maxYOffset == 0 && minYOffset == 0) {
857  final int x0 = point.x - origin.x;
858  final int y0 = point.y - origin.y;
859  final int yt = (2 * y0 - x0) / 2;
860  final int xt = yt + x0;
861  final int xm = xt / isoMapSquareInfo.getXLen2();
862  final int ym = yt / isoMapSquareInfo.getYLen2() / 2;
863  if (xm < 0 || xm >= mapSize.getWidth() || ym < 0 || ym >= mapSize.getHeight()) {
864  return false;
865  }
866 
867  retPoint.setLocation(xm, ym);
868  return true;
869  }
870 
872 
873  boolean retval = false;
874  for (int y = 0; y < mapSize.getHeight(); y++) {
875  int xStart = origin.x - (y + 1) * isoMapSquareInfo.getXLen2();
876  int yStart = origin.y + y * isoMapSquareInfo.getYLen2();
877  for (int x = 0; x < mapSize.getWidth(); x++) {
878  tmpPoint.setLocation(x, y);
879  final int[] offsets = tileStretchingOffsets(tmpPoint, foundSubLayers);
880 
881  for (int subLayer = 0; subLayer < offsets.length; subLayer++) {
882  if (!foundSubLayers[subLayer]) {
883  continue;
884  }
885  final int yPos = yStart + offsets[subLayer];
886  long stretch = 0;
887 
888  for (final G gameObject : mapModel.getMapSquare(tmpPoint)) {
889  final G head = gameObject.getHead();
890  if (head.isStretched(true) && head.getAttributeInt(DefaultIsoGameObject.LAYER) == 1 && head.getAttributeInt(DefaultIsoGameObject.SUB_LAYER) == subLayer) {
891  stretch = head.getStretchFactor();
892  break;
893  }
894  }
895 
896  if (point.x >= xStart && point.x <= xStart + isoMapSquareInfo.getXLen() && point.y >= yPos && point.y <= yPos + isoMapSquareInfo.getYLen() + ((stretch >> 24) & 0xff)) {
897  if (StretchedImageFilter.coordsInTile(stretch, point.x - xStart, point.y - yPos)) {
898  retPoint.setLocation(tmpPoint);
899  retval = true;
900  }
901  }
902  }
903 
904  xStart += isoMapSquareInfo.getXLen2();
905  yStart += isoMapSquareInfo.getYLen2();
906  }
907  }
908 
909  return retval;
910  }
911 
915  private void resizeFromModel() {
916  final Point pos = new Point();
917  final int mapWidth = mapSize.getWidth();
918  final int mapHeight = mapSize.getHeight();
919  minYOffset = 0;
920  maxYOffset = 0;
922  for (pos.y = 0; pos.y < mapHeight; pos.y++) {
923  for (pos.x = 0; pos.x < mapWidth; pos.x++) {
924  for (final G gameObject : mapModel.getMapSquare(pos)) {
925  final G head = gameObject.getHead();
926  if (head.isStretched(true) && head.getAttributeInt(DefaultIsoGameObject.LAYER) == 1) {
927  final int yOffset = head.getAttributeInt(DefaultIsoGameObject.Z);
928 
929  if (yOffset > maxYOffset) {
930  maxYOffset = yOffset;
931  } else if (yOffset < minYOffset) {
932  minYOffset = yOffset;
933  }
934  }
935  }
936  }
937  }
938  }
939  // define how much drawing space we need for the map
940  final int sum = mapWidth + mapHeight;
941  final Dimension forcedSize = new Dimension(2 * borderOffset.x + sum * isoMapSquareInfo.getXLen2(), 2 * borderOffset.y + sum * isoMapSquareInfo.getYLen2() + maxYOffset + Math.abs(minYOffset));
942  setPreferredSize(forcedSize);
943  setMinimumSize(forcedSize);
944  revalidate();
945  }
946 
947 }
net.sf.gridarta.model.mapgrid.MapGrid.addMapGridListener
void addMapGridListener(@NotNull final MapGridListener listener)
Registers a MapGridListener.
Definition: MapGrid.java:190
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.unknownSquareIcon
final Icon unknownSquareIcon
The Icon drawn into squares without game objects.
Definition: AbstractIsoMapRenderer.java:119
net.sf.gridarta.utils.Size2D.getWidth
int getWidth()
Returns the width of the area.
Definition: Size2D.java:96
net.sf.gridarta.model.direction.Direction
A direction.
Definition: Direction.java:28
net.sf.gridarta.model.mapmodel.MapModel
A MapModel reflects the data of a map.
Definition: MapModel.java:75
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.BACKGROUND_COLOR
static final Color BACKGROUND_COLOR
The background color for created images.
Definition: AbstractIsoMapRenderer.java:77
net.sf.gridarta.model.gameobject.MultiPositionData.getXOffset
int getXOffset(final int shapeID, final int positionID)
Calculate the x-offset from the leftmost pixel of the big face image and the default x-position (The ...
Definition: MultiPositionData.java:161
net.sf.gridarta.model.mapgrid.MapGrid.getFlags
int getFlags(final int x, final int y)
Returns the flags of a square.
Definition: MapGrid.java:476
net.sf.gridarta.model.mapmodel.MapSquare.getMapSquareOptional
MapSquare< G, A, R > getMapSquareOptional()
Returns the MapSquare this game object is part of.
Definition: MapSquare.java:156
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintSquare
abstract void paintSquare(@NotNull Graphics2D g, int x, int y, @NotNull MapSquare< G, A, R > square)
Paints one square.
net.sf.gridarta.model.gameobject.DefaultIsoGameObject
Default implementation for GameObject implementing classes.
Definition: DefaultIsoGameObject.java:38
net.sf.gridarta.model.mapmodel.MapSquare.getMapLocation
Point getMapLocation()
Returns the coordinate on the map.
Definition: MapSquare.java:124
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.clearBackground
abstract void clearBackground(@NotNull Graphics g)
Clears the window to background color if necessary.
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.multiPositionData
final MultiPositionData multiPositionData
The MultiPositionData instance to query for multi-part objects.
Definition: AbstractIsoMapRenderer.java:142
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.model.mapviewsettings.MapViewSettings.isLightVisible
boolean isLightVisible()
Get the visibility of the light.
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.resizeFromModel
void resizeFromModel()
Refreshes the data in the view from the model.
Definition: AbstractIsoMapRenderer.java:915
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.tileStretchingOffsets
int[] tileStretchingOffsets(@NotNull final Point point, final boolean @NotNull[] foundSubLayers)
Calculates the tile stretching Y offset.
Definition: AbstractIsoMapRenderer.java:823
net.sf.gridarta.model.mapmodel.MapSquare
A single Map Square.
Definition: MapSquare.java:45
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.mapGrid
final MapGrid mapGrid
The MapGrid to render.
Definition: AbstractIsoMapRenderer.java:113
net.sf.gridarta.model.face.StretchedImageFilter.coordsInTile
static boolean coordsInTile(final long stretch, final int x, final int y)
Checks whether the specified coordinates are inside a (possibly stretched) isometric tile.
Definition: StretchedImageFilter.java:145
net.sf.gridarta.model.mapviewsettings.MapViewSettings.isGridVisible
boolean isGridVisible()
Get the visibility of the grid.
net.sf.gridarta.model.mapviewsettings.MapViewSettings.isAlphaType
boolean isAlphaType(int v)
Returns whether the specified edit type is to be shown transparent.
net.sf.gridarta.model.mapviewsettings
Definition: AbstractMapViewSettings.java:20
net.sf.gridarta.model.gameobject.IsoMapSquareInfo
Provides information about isometric map squares.
Definition: IsoMapSquareInfo.java:26
net.sf.gridarta.model.mapviewsettings.MapViewSettings.isTileStretching
boolean isTileStretching()
Returns the tile-stretching setting.
net.sf.gridarta.model.mapviewsettings.MapViewSettings.addMapViewSettingsListener
void addMapViewSettingsListener(@NotNull MapViewSettingsListener listener)
Register a MapViewSettingsListener.
net.sf.gridarta.gui.map.renderer.AbstractMapRenderer< G, A, R >::lightVisible
boolean lightVisible
Whether the setting for lighted map squares is inverted.
Definition: AbstractMapRenderer.java:80
net.sf
net.sf.gridarta.model.gameobject.MultiPositionData.getYOffset
int getYOffset(final int shapeID, final int positionID)
Calculate the y-offset from the topmost pixel of the big face image and the default y-position (The d...
Definition: MultiPositionData.java:175
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintComponent
void paintComponent(@NotNull final Graphics g)
Definition: AbstractIsoMapRenderer.java:450
net.sf.gridarta.model.mapmodel
Definition: AboveFloorInsertionMode.java:20
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintComponent2
void paintComponent2(@NotNull final Graphics2D g)
Paints this component.
Definition: AbstractIsoMapRenderer.java:488
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintGameObjectIfVisible
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.
Definition: AbstractIsoMapRenderer.java:550
net.sf.gridarta.model.gameobject.DefaultIsoGameObject.SUB_LAYER
static final String SUB_LAYER
The name of the "sub_layer" attribute.
Definition: DefaultIsoGameObject.java:67
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.isGameObjectVisible
abstract boolean isGameObjectVisible(@NotNull G gameObject)
Checks whether a game object is visible according to current editor settings.
net.sf.gridarta.model.mapviewsettings.MapViewSettings
Container for settings that affect the rendering of maps.
Definition: MapViewSettings.java:30
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.getRotate
static double getRotate(@NotNull final Attributes head)
Returns the rotation angle of a game object.
Definition: AbstractIsoMapRenderer.java:644
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.maxYOffset
int maxYOffset
Maximum Y offset.
Definition: AbstractIsoMapRenderer.java:164
net.sf.gridarta.model.mapmodel.MapModel.addMapModelListener
void addMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Register a map listener.
net.sf.gridarta.gui.map.renderer.GridMapSquarePainter.paint
void paint(@NotNull final Graphics graphics, final int gridFlags, final boolean light, final int x, final int y, @NotNull final ImageObserver imageObserver)
Paints overlay images for one grid square.
Definition: GridMapSquarePainter.java:108
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintGameObject
void paintGameObject(@NotNull final Graphics2D g, final int xStart, final int yStart, @NotNull final G gameObject, final boolean inSpawnPoint)
Paints a single game object.
Definition: AbstractIsoMapRenderer.java:565
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintMapGrid
void paintMapGrid(@NotNull final Graphics g)
Paints the grid of the whole map.
Definition: AbstractIsoMapRenderer.java:800
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.mapSize
Size2D mapSize
The size of the map to render.
Definition: AbstractIsoMapRenderer.java:107
net.sf.gridarta.model.gameobject.DefaultIsoGameObject.ALPHA
static final String ALPHA
The name of the "alpha" attribute.
Definition: DefaultIsoGameObject.java:103
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.mapGridListener
final MapGridListener mapGridListener
The MapGridListener to track changes in mapGrid.
Definition: AbstractIsoMapRenderer.java:320
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.getSquareBounds
Rectangle getSquareBounds(@NotNull final Point p)
Definition: AbstractIsoMapRenderer.java:461
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.spawnPointTypeNo
final int spawnPointTypeNo
The game object type number of spawn points.
Definition: AbstractIsoMapRenderer.java:82
net.sf.gridarta.gui.map.renderer.GridMapSquarePainter
Paints overlays for map grids.
Definition: GridMapSquarePainter.java:34
net.sf.gridarta.model.gameobject.MultiPositionData.getWidth
int getWidth(final int shapeID)
Returns the total width for a multi-square image.
Definition: MultiPositionData.java:185
net.sf.gridarta.model.gameobject.IsoMapSquareInfo.getXLen
int getXLen()
Returns the horizontal size of a square.
Definition: IsoMapSquareInfo.java:66
net.sf.gridarta.gui.map.renderer.AbstractMapRenderer
Abstract base class for classes implementing MapRenderer.
Definition: AbstractMapRenderer.java:45
net.sf.gridarta.model.face.StretchedImageFilter
An ImageFilter that produces stretched faces.
Definition: StretchedImageFilter.java:32
net.sf.gridarta.gui.map.renderer.AbstractMapRenderer< G, A, R >::gameObjectParser
final GameObjectParser< G, A, R > gameObjectParser
The GameObjectParser for creating tooltip information or.
Definition: AbstractMapRenderer.java:75
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.mapViewSettings
final MapViewSettings mapViewSettings
The MapViewSettings instance to use.
Definition: AbstractIsoMapRenderer.java:136
net.sf.gridarta.model.mapviewsettings.MapViewSettings.removeMapViewSettingsListener
void removeMapViewSettingsListener(@NotNull MapViewSettingsListener listener)
Unregister a MapViewSettingsListener.
net.sf.gridarta.model.baseobject.Attributes
A set of key/value pairs.
Definition: Attributes.java:28
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.calculateOrigin
void calculateOrigin()
Calculates the origin which is located in the NORTH_WEST-corner of the map.
Definition: AbstractIsoMapRenderer.java:387
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.minYOffset
int minYOffset
Minimum Y offset.
Definition: AbstractIsoMapRenderer.java:159
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintIcon
void paintIcon(@NotNull final Graphics2D g, @NotNull final Icon icon)
Paints an icon.
Definition: AbstractIsoMapRenderer.java:743
net.sf.gridarta.model.gameobject
GameObjects are the objects based on Archetypes found on maps.
Definition: AbstractGameObject.java:20
net.sf.gridarta.gui.map.renderer.AbstractMapRenderer< G, A, R >::isLightVisible
boolean isLightVisible()
Returns whether the setting for lighted map squares should be inverted.
Definition: AbstractMapRenderer.java:150
net.sf.gridarta.model.gameobject.DefaultIsoGameObject.ALIGN
static final String ALIGN
The name of the "align" attribute.
Definition: DefaultIsoGameObject.java:91
net
net.sf.gridarta.utils.Size2D.getHeight
int getHeight()
Returns the height of the area.
Definition: Size2D.java:104
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.mapModel
final MapModel< G, A, R > mapModel
The MapModel to render.
Definition: AbstractIsoMapRenderer.java:101
net.sf.gridarta.model.gameobject.IsoMapSquareInfo.getXLen2
int getXLen2()
Returns the horizontal center of a square.
Definition: IsoMapSquareInfo.java:74
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.mapModelListener
final MapModelListener< G, A, R > mapModelListener
The MapModelListener to track changes in mapModel.
Definition: AbstractIsoMapRenderer.java:226
errors
errors
Definition: ArchetypeTypeSetParserTest-ignoreDefaultAttribute1-result.txt:1
net.sf.gridarta.model.gameobject.DefaultIsoGameObject.ZOOM
static final String ZOOM
The name of the "zoom" attribute.
Definition: DefaultIsoGameObject.java:97
net.sf.gridarta.model.mapmodel.MapModel.removeMapModelListener
void removeMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Unregister a map listener.
net.sf.gridarta.model.maparchobject.MapArchObject
Interface for MapArchObjects.
Definition: MapArchObject.java:40
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.closeNotify
void closeNotify()
Definition: AbstractIsoMapRenderer.java:377
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.setBorderOffset
void setBorderOffset(final int x, final int y)
Sets the offset to map borders (32 for std.
Definition: AbstractIsoMapRenderer.java:399
net.sf.gridarta.model.mapmodel.MapSquare.isLight
boolean isLight()
Returns whether this map square is affected by any light emitting game objects.
Definition: MapSquare.java:391
net.sf.gridarta.model.validation.ErrorCollector
An interface for classes that collect errors.
Definition: ErrorCollector.java:33
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintRotatedIcon
void paintRotatedIcon(@NotNull final Graphics2D g, @NotNull final Icon icon, final int x, final int y, final double rotate, final int oldIconWidth, final int oldIconHeight, final int newIconWidth, final int newIconHeight)
Paints an icon at a given rotation angle.
Definition: AbstractIsoMapRenderer.java:717
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.tmpRec
final Rectangle tmpRec
Temporary rectangle.
Definition: AbstractIsoMapRenderer.java:130
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintMapSelection
void paintMapSelection(@NotNull final Graphics g)
Paints the selection for the whole map.
Definition: AbstractIsoMapRenderer.java:762
net.sf.gridarta.model.mapgrid.MapGrid.removeMapGridListener
void removeMapGridListener(@NotNull final MapGridListener listener)
Removes a MapGridListener.
Definition: MapGrid.java:198
net.sf.gridarta.model.validation
This package contains the framework for validating maps.
Definition: AbstractValidator.java:20
net.sf.gridarta.model.gameobject.DefaultIsoGameObject.Z
static final String Z
The name of the "z" attribute.
Definition: DefaultIsoGameObject.java:55
net.sf.gridarta.model.baseobject.BaseObject
Definition: BaseObject.java:34
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.getSquareLocationAt
boolean getSquareLocationAt(@NotNull final Point point, @NotNull final Point retPoint)
Definition: AbstractIsoMapRenderer.java:855
net.sf.gridarta.model.gameobject.DefaultIsoGameObject.LAYER
static final String LAYER
The name of the "layer" attribute.
Definition: DefaultIsoGameObject.java:61
net.sf.gridarta.model.mapmodel.MapFile
The location of a map file with a map directory.
Definition: MapFile.java:31
net.sf.gridarta.model.io
Reading and writing of maps, handling of paths.
Definition: AbstractAnimationObjectsReader.java:20
net.sf.gridarta.model.mapmodel.MapSquare.getMapModel
MapModel< G, A, R > getMapModel()
Returns the MapModel this map square is part of.
Definition: MapSquare.java:99
net.sf.gridarta.model.gameobject.DefaultIsoGameObject.ROTATE
static final String ROTATE
The name of the "rotate" attribute.
Definition: DefaultIsoGameObject.java:109
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintScaledIcon
void paintScaledIcon(@NotNull final Graphics2D g, @NotNull final Icon icon, final int x, final int y, final int zoom, final int alpha, final double rotate, final int oldIconWidth, final int oldIconHeight, final int newIconWidth, final int newIconHeight)
Paints an icon at a given zoom factor and alpha value.
Definition: AbstractIsoMapRenderer.java:663
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.serialVersionUID
static final long serialVersionUID
The serial version UID.
Definition: AbstractIsoMapRenderer.java:71
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.getFullImage
BufferedImage getFullImage()
Definition: AbstractIsoMapRenderer.java:412
net.sf.gridarta.model.mapmodel.MapModelListener
Interface for listeners listening on MapModel events.
Definition: MapModelListener.java:36
net.sf.gridarta.model.mapgrid.MapGrid
2D-Grid containing flags for selection, pre-selection, cursor, warnings and errors.
Definition: MapGrid.java:46
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.forceRepaint
void forceRepaint()
Definition: AbstractIsoMapRenderer.java:455
net.sf.gridarta.model.gameobject.IsoMapSquareInfo.getYLen
int getYLen()
Returns the vertical size of a square.
Definition: IsoMapSquareInfo.java:82
net.sf.gridarta.model.mapmodel.MapModel.getMapSquare
MapSquare< G, A, R > getMapSquare(@NotNull Point pos)
Get the square at a specified location.
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.getRepaintRec
Rectangle getRepaintRec(@NotNull final Rectangle visibleRectangle)
Returns smallest Rectangle on the map that needs to be repaint.
Definition: AbstractIsoMapRenderer.java:515
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.mapViewSettingsListener
final MapViewSettingsListener mapViewSettingsListener
The MapViewSettingsListener attached to {}.
Definition: AbstractIsoMapRenderer.java:177
net.sf.gridarta.model.mapgrid
Definition: MapGrid.java:20
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.isoMapSquareInfo
final IsoMapSquareInfo isoMapSquareInfo
The IsoMapSquareInfo to use.
Definition: AbstractIsoMapRenderer.java:148
net.sf.gridarta.model.mapviewsettings.MapViewSettings.isDoubleFaces
boolean isDoubleFaces()
Get whether double faces are drawn double height.
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.foundSubLayers
final boolean[] foundSubLayers
Boolean array for tileStretchingOffsets to avoid allocating lots of arrays.
Definition: AbstractIsoMapRenderer.java:170
net.sf.gridarta.model
net.sf.gridarta.model.archetype.Archetype
Reflects an Archetype.
Definition: Archetype.java:41
net.sf.gridarta.model.baseobject
Definition: AbstractBaseObject.java:20
net.sf.gridarta.model.mapviewsettings.MapViewSettingsListener
Interface for event listeners that are interested in changes on {}.
Definition: MapViewSettingsListener.java:31
net.sf.gridarta.model.face
The face is the appearance of an object.
Definition: AbstractFaceObjects.java:20
net.sf.gridarta.model.gameobject.MultiPositionData
The MultiPositionData class stores an array of numbers which is required in order to calculate displa...
Definition: MultiPositionData.java:44
net.sf.gridarta.model.mapgrid.MapGridListener
Interface for listeners listening to MapGridEvents.
Definition: MapGridListener.java:29
net.sf.gridarta.model.gameobject.IsoMapSquareInfo.getYLen2
int getYLen2()
Returns the vertical center of a square.
Definition: IsoMapSquareInfo.java:90
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.paintAlphaIcon
void paintAlphaIcon(@NotNull final Graphics2D g, @NotNull final Icon icon, final int x, final int y, final int alpha, final double rotate, final int oldIconWidth, final int oldIconHeight, final int newIconWidth, final int newIconHeight)
Paints an icon at a given alpha value.
Definition: AbstractIsoMapRenderer.java:691
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.borderOffset
final Point borderOffset
The offset to map borders (32 for std.
Definition: AbstractIsoMapRenderer.java:89
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.tmpPoint
final Point tmpPoint
Temporary point.
Definition: AbstractIsoMapRenderer.java:125
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.getImageSize
Size2D getImageSize()
Definition: AbstractIsoMapRenderer.java:406
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.AbstractIsoMapRenderer
AbstractIsoMapRenderer(final int spawnPointTypeNo, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModel< G, A, R > mapModel, @NotNull final MapGrid mapGrid, final int borderOffsetX, final int borderOffsetY, @NotNull final MultiPositionData multiPositionData, @NotNull final IsoMapSquareInfo isoMapSquareInfo, @NotNull final GridMapSquarePainter gridMapSquarePainter, @NotNull final GameObjectParser< G, A, R > gameObjectParser, @NotNull final Icon unknownSquareIcon)
Creates a new instance.
Definition: AbstractIsoMapRenderer.java:353
net.sf.gridarta.model.mapgrid.MapGridEvent
This event is created by MapGrid.
Definition: MapGridEvent.java:29
net.sf.gridarta.model.io.GameObjectParser
Interface for classes that read or write GameObject instances.
Definition: GameObjectParser.java:37
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.gridMapSquarePainter
final GridMapSquarePainter gridMapSquarePainter
The GridMapSquarePainter to use.
Definition: AbstractIsoMapRenderer.java:154
net.sf.gridarta.utils.Size2D
The class Size2D represents a 2d rectangular area.
Definition: Size2D.java:30
net.sf.gridarta.utils
Definition: ActionBuilderUtils.java:20
net.sf.gridarta.model.gameobject.DefaultIsoGameObject.MAX_SUB_LAYERS
static final int MAX_SUB_LAYERS
Definition: DefaultIsoGameObject.java:49
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer
A MapRenderer that renders isometric squares.
Definition: AbstractIsoMapRenderer.java:66
net.sf.gridarta.model.direction
Definition: Direction.java:20
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.origin
final Point origin
The origin is the point in the north-west corner.
Definition: AbstractIsoMapRenderer.java:95
net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer.isSpawnPoint
boolean isSpawnPoint(@NotNull final BaseObject< G, A, R, ?> gameObject)
Returns whether the given BaseObject is a spawn point.
Definition: AbstractIsoMapRenderer.java:752