|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrl.common.mapping.HexGrid
public class HexGrid
Title: Legatus
Copyright: Copyright Daniel Cleyne (c) 2004-2006
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
| Field Summary | |
|---|---|
static double |
HEXSIDE
|
protected Hexagon[] |
m_HexList
|
(package private) static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
HexGrid()
|
|
HexGrid(int gridWidth,
int gridHeight,
int xOffset,
int yOffset)
|
|
| Method Summary | |
|---|---|
protected void |
buildHexGrid(int xOff,
int yOff,
int GridWidth,
int GridHeight)
|
int |
degree(Coordinate s,
Coordinate d)
Code from Megamek Returns the degree direction of another Coordinate. |
int |
direction(Coordinate c,
Coordinate d)
Code from Megamek Returns the direction in which another coordinate lies; 0 if the coordinates are equal. |
int |
distance(Coordinate src,
Coordinate dst)
Code from Megamek Returns the distance to another coordinate. |
Coordinate |
getCoordinateFromHex(Hexagon hex)
|
Coordinate |
getCoordinateFromPoint(java.awt.Point p)
|
java.awt.Dimension |
getGridDimension()
|
Hexagon |
getHex(Coordinate c)
|
Hexagon |
getHex(int HexNo)
|
Hexagon |
getHex(int x,
int y)
|
Hexagon |
getHexFromPoint(java.awt.Point p)
|
java.awt.Dimension |
getHexSize()
|
java.awt.Point |
getOffset()
|
int |
getSize()
|
java.util.Vector<Coordinate> |
intervening(Coordinate src,
Coordinate dest)
This code taken from Megamek class IdealHex Returns an array of the Coordinate of hexes that are crossed by a straight line from the center of src to the center of dest, including src & dest. |
java.util.Vector<Coordinate> |
intervening(Coordinate src,
Coordinate dest,
boolean split)
|
boolean |
isValidCoordinate(Coordinate c)
|
double |
radian(Coordinate srcCoord,
Coordinate destCoord)
Code from Megamek Returns the radian direction of another Coordinate. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final long serialVersionUID
public static final double HEXSIDE
protected Hexagon[] m_HexList
| Constructor Detail |
|---|
public HexGrid()
public HexGrid(int gridWidth,
int gridHeight,
int xOffset,
int yOffset)
| Method Detail |
|---|
public Hexagon getHex(int HexNo)
public Hexagon getHex(int x,
int y)
public Hexagon getHex(Coordinate c)
public java.awt.Point getOffset()
public java.awt.Dimension getGridDimension()
public java.awt.Dimension getHexSize()
protected void buildHexGrid(int xOff,
int yOff,
int GridWidth,
int GridHeight)
public int getSize()
public Hexagon getHexFromPoint(java.awt.Point p)
public Coordinate getCoordinateFromPoint(java.awt.Point p)
public Coordinate getCoordinateFromHex(Hexagon hex)
public double radian(Coordinate srcCoord,
Coordinate destCoord)
srcCoord - the source coordinate.destCoord - the destination coordinate.
public int degree(Coordinate s,
Coordinate d)
s - the source coordinate.d - the destination coordinate.
public int direction(Coordinate c,
Coordinate d)
c - the source coordinate.d - the destination coordinate.
public int distance(Coordinate src,
Coordinate dst)
src - the source coordinatedst - the destination coordinate
public java.util.Vector<Coordinate> intervening(Coordinate src,
Coordinate dest)
public java.util.Vector<Coordinate> intervening(Coordinate src,
Coordinate dest,
boolean split)
public boolean isValidCoordinate(Coordinate c)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||