rl.common.mapping
Class PlanetHexagon

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

public class PlanetHexagon
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
protected  java.util.Vector<PlanetHexagon> m_Offsets
           
(package private) static long serialVersionUID
           
 
Fields inherited from class java.awt.Polygon
bounds, npoints, xpoints, ypoints
 
Constructor Summary
PlanetHexagon()
           
PlanetHexagon(int xOffset, int yOffset)
           
 
Method Summary
 void addOffset(int xOffset, int yOffset)
           
 void addOffset(java.awt.Point offset)
           
 void draw(java.awt.Graphics comp)
           
 void draw(java.awt.Graphics comp, java.lang.String label)
           
 boolean equals(java.lang.Object o)
           
 void fill(java.awt.Graphics comp)
           
 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.
 PlanetHexagon getOffset(int index)
           
 PlanetHexagon getOffsetHex(int index)
           
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)
           
 void removeOffset(int index)
           
 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

m_Offsets

protected java.util.Vector<PlanetHexagon> m_Offsets
Constructor Detail

PlanetHexagon

public PlanetHexagon()

PlanetHexagon

public PlanetHexagon(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()

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 point

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

draw

public void draw(java.awt.Graphics comp)

draw

public void draw(java.awt.Graphics comp,
                 java.lang.String label)

fill

public void fill(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

addOffset

public void addOffset(java.awt.Point offset)

addOffset

public void addOffset(int xOffset,
                      int yOffset)

removeOffset

public void removeOffset(int index)

getOffset

public PlanetHexagon getOffset(int index)

getOffsetHex

public PlanetHexagon getOffsetHex(int index)