ch.aplu.jcardgame
Class FanLayout

java.lang.Object
  extended by ch.aplu.jcardgame.HandLayout
      extended by ch.aplu.jcardgame.FanLayout

public class FanLayout
extends HandLayout

Class to store the fan layout options for a hand. Displays the cards in a arc with given center, radius, start and maximal end angle. The cards are drawn one on top others with the current card list order. If endDir is less or equal than startDir, the hand shows like stacked, but uses more memory than a when StackedLayout is used.

For negative endDir, the angle distance between cards is fixed to the absolute value of this parameter. This is useful to align cards.


Constructor Summary
FanLayout(Location center, double radius, double startDir, double endDir)
          Creates a FanLayout instance with given center, radius, start direction and end direction.
 
Method Summary
 FanLayout clone()
          Creates a new FanLayout instance with same options.
 Hand.CardAlignment getCardAlignment()
          Returns the current card alignment
 Location getCenter()
          Returns the current center.
 double getEndDir()
          Returns the current end direction.
 double getRadius()
          Returns the current radius.
 double getStartDir()
          Returns the current start direction.
 int getStepDelay()
          Returns the current step delay.
 void setCardAlignment(Hand.CardAlignment cardAlignment)
          Sets the current card alignment to the given alignment.
 void setCenter(Location center)
          Sets the current center to the given center
 void setEndDir(double endDir)
          Sets the current end direction to the given end direction For negative endDir, the angle distance between cards is fixed to the absolute value of this parameter.
 void setRadius(double radius)
          Sets the current radius to the given radius
 void setStartDir(double startDir)
          Sets the current start direction to the given start direction
 void setStepDelay(int stepDelay)
          Sets the current step delay to the given delay (in ms).
 
Methods inherited from class ch.aplu.jcardgame.HandLayout
getHandLocation, getScaleFactor, setHandLocation, setScaleFactor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FanLayout

public FanLayout(Location center,
                 double radius,
                 double startDir,
                 double endDir)
Creates a FanLayout instance with given center, radius, start direction and end direction. For negative endDir, the angle distance between cards is fixed to the absolute value of this parameter. This is useful to align cards.
(Because endDir >= startDir is assumed, fan to east: startDir = 360 - phi, endDir 360 + phi)

Defaults:
rotationAngle = 0
stepDelay = 0
cardAlignment = Hand.CardAlignment.MIDDLE

Parameters:
center - the center location of the arc
radius - the radius of the arc
startDir - the direction to the center of the first card (in degrees clockwise, zero to east)
endDir - the maximal direction of the last card (in degrees clockwise, zero to east)
Method Detail

clone

public FanLayout clone()
Creates a new FanLayout instance with same options.

Overrides:
clone in class java.lang.Object
Returns:
the new instance with same options

getCenter

public Location getCenter()
Returns the current center.

Returns:
the center

getRadius

public double getRadius()
Returns the current radius.

Returns:
the hand radius

getStartDir

public double getStartDir()
Returns the current start direction.

Returns:
the start direction (in degrees, clockwise, zero to east)

getEndDir

public double getEndDir()
Returns the current end direction.

Returns:
the end direction (in degrees, clockwise, zero to east)

getStepDelay

public int getStepDelay()
Returns the current step delay. If zero, no animation.

Returns:
the step delay (in ms)

getCardAlignment

public Hand.CardAlignment getCardAlignment()
Returns the current card alignment

Returns:
the card alignment

setCenter

public void setCenter(Location center)
Sets the current center to the given center

Parameters:
center - the new current center.

setRadius

public void setRadius(double radius)
Sets the current radius to the given radius

Parameters:
radius - the new current radius.

setStartDir

public void setStartDir(double startDir)
Sets the current start direction to the given start direction

Parameters:
startDir - the new current start direction (in degrees, clockwise, zero to east)

setEndDir

public void setEndDir(double endDir)
Sets the current end direction to the given end direction For negative endDir, the angle distance between cards is fixed to the absolute value of this parameter. This is useful to align cards.

Parameters:
endDir - the new current end direction (in degrees, clockwise, zero to east)

setStepDelay

public void setStepDelay(int stepDelay)
Sets the current step delay to the given delay (in ms).

Parameters:
stepDelay - the new current step delay

setCardAlignment

public void setCardAlignment(Hand.CardAlignment cardAlignment)
Sets the current card alignment to the given alignment.

Parameters:
cardAlignment - the new current card alignment