rl.common.mapping
Class Hexagon

java.lang.Object
  extended by java.awt.Polygon
      extended by rl.common.mapping.Hexagon
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable

public class Hexagon
extends java.awt.Polygon

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.

Version:
0.1
Author:
Daniel Cleyne
See Also:
Serialized Form

Field Summary
(package private) static long serialVersionUID
           
 
Fields inherited from class java.awt.Polygon
bounds, npoints, xpoints, ypoints
 
Constructor Summary
Hexagon()
           
Hexagon(int xOffset, int yOffset)
           
 
Method Summary
 void draw(java.awt.Graphics comp)
           
 boolean equals(java.lang.Object o)
           
 java.awt.Rectangle getBounds()
           
 java.awt.Point getCenter()
           
static int getHeight()
           
 java.awt.Point getHexSideEndPoint(int hexSide)
           
 java.awt.Point getHexSideMidPoint(int hexSide)
          Returns the point that represents the 'mid' point fo a hex side.
 java.awt.Point getHexSideStartPoint(int hexSide)
          Returns the point the represents the 'start' point fo a hex side.
static int getReverseFacing(int facing)
           
static int getWidth()
           
static int getXIncrement()
           
static int getYIncrement()
           
 int hashCode()
           
 boolean isIntersectedBy(int x0, int y0, int x1, int y1)
          Returns true if this hex is intersected by the line Changed arguments to int : DC
(package private)  void offset(int XOffset, int YOffset)
           
(package private)  void offset(java.awt.Point aPoint)
           
 java.lang.String toString()
           
static int turns(int x0, int y0, int x1, int y1, int x2, int y2)
          From Megamek class IdealHex Tests whether a line intersects a point or the point passes to the left or right of the line.
 
Methods inherited from class java.awt.Polygon
addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, invalidate, reset, translate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Hexagon

public Hexagon()

Hexagon

public Hexagon(int xOffset,
               int yOffset)
Method Detail

getBounds

public java.awt.Rectangle getBounds()
Specified by:
getBounds in interface java.awt.Shape
Overrides:
getBounds in class java.awt.Polygon

getWidth

public static int getWidth()

getHeight

public static int getHeight()

getXIncrement

public static int getXIncrement()

getYIncrement

public static int getYIncrement()

getReverseFacing

public static int getReverseFacing(int facing)

offset

void offset(java.awt.Point aPoint)

offset

void offset(int XOffset,
            int YOffset)

getCenter

public java.awt.Point getCenter()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

isIntersectedBy

public boolean isIntersectedBy(int x0,
                               int y0,
                               int x1,
                               int y1)
Returns true if this hex is intersected by the line Changed arguments to int : DC


turns

public static int turns(int x0,
                        int y0,
                        int x1,
                        int y1,
                        int x2,
                        int y2)
From Megamek class IdealHex Tests whether a line intersects a point or the point passes to the left or right of the line. Changed arguments to int : DC


getHexSideStartPoint

public java.awt.Point getHexSideStartPoint(int hexSide)
Returns the point the represents the 'start' point fo a hex side. These progress clockwise from the top left point

Parameters:
hexSide -
Returns:
The start point of the hexSide

getHexSideEndPoint

public java.awt.Point getHexSideEndPoint(int hexSide)

getHexSideMidPoint

public java.awt.Point getHexSideMidPoint(int hexSide)
Returns the point that represents the 'mid' point fo a hex side. These progress clockwise from the top left point

Parameters:
hexSide -
Returns:
The mid point of the hexSide

draw

public void draw(java.awt.Graphics comp)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object