com.sencha.gxt.chart.client.draw.path
Class PathCommand

java.lang.Object
  extended by com.sencha.gxt.chart.client.draw.path.PathCommand
Direct Known Subclasses:
ClosePath, EndPointCommand, LineToHorizontal, LineToVertical

public abstract class PathCommand
extends Object

A command that represents a segment of a path.


Constructor Summary
PathCommand()
          Creates a path command.
PathCommand(boolean relative)
          Creates a path command.
PathCommand(PathCommand command)
          Creates a copy of the given command.
 
Method Summary
abstract  PathCommand copy()
          Returns a copy of the path command.
 boolean isRelative()
          Returns true if the command is relative.
abstract  boolean nearEqual(PathCommand command)
          Determines equality of two commands using rounded values.
 void setRelative(boolean relative)
          Sets the command to relative or absolute
 void toAbsolute(PrecisePoint currentPoint, PrecisePoint movePoint)
          Converts the path commands to absolute coordinates using the given frame of reference and the last move.
abstract  PathCommand toCurve(PrecisePoint currentPoint, PrecisePoint movePoint, PrecisePoint curvePoint, PrecisePoint quadraticPoint)
          Converts the PathCommand to a CurveTo command.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathCommand

public PathCommand()
Creates a path command. Defaults to absolute.


PathCommand

public PathCommand(boolean relative)
Creates a path command.

Parameters:
relative - true if the command is relative

PathCommand

public PathCommand(PathCommand command)
Creates a copy of the given command.

Parameters:
command - the command to be copied
Method Detail

copy

public abstract PathCommand copy()
Returns a copy of the path command.

Returns:
a copy of the path command

isRelative

public boolean isRelative()
Returns true if the command is relative.

Returns:
true if the command is relative

nearEqual

public abstract boolean nearEqual(PathCommand command)
Determines equality of two commands using rounded values.

Parameters:
command - the command to compare
Returns:
true if equal and false otherwise

setRelative

public void setRelative(boolean relative)
Sets the command to relative or absolute

Parameters:
relative - true if relative

toAbsolute

public void toAbsolute(PrecisePoint currentPoint,
                       PrecisePoint movePoint)
Converts the path commands to absolute coordinates using the given frame of reference and the last move.

Parameters:
currentPoint - frame of reference
movePoint - last move point

toCurve

public abstract PathCommand toCurve(PrecisePoint currentPoint,
                                    PrecisePoint movePoint,
                                    PrecisePoint curvePoint,
                                    PrecisePoint quadraticPoint)
Converts the PathCommand to a CurveTo command. If a MoveTo no conversion takes place, but the current move point is updated.

Parameters:
currentPoint - the current point of the path
movePoint - the frame of reference for the path
curvePoint - the frame of reference for the Bézier
quadraticPoint - the beginning of the last quadratic curve
Returns:
the converted command


Copyright © 2011. All Rights Reserved.