Packagecom.yworks.canvas.drawing
Classpublic class PathCursor
InheritancePathCursor Inheritance Object

A class that is used by GeneralPath to iterate over the elements the path is made up of.

After creation or after calling reset(), the current position is before the first element. One has to call next() or toFirst() before accessing the current element.



Public Properties
 PropertyDefined By
  index : int
[read-only] Returns the current position of the cursor.
PathCursor
Public Methods
 MethodDefined By
  
PathCursor
  
getCurrent(coordinates:Array):uint
Places the coordinates for the current type into the given array.
PathCursor
  
getCurrentEndPoint(coordinates:Array):uint
Places the current end coordinates of the last path element into the array.
PathCursor
  
Returns the current x coordinate of the last path element.
PathCursor
  
Returns the current y coordinate of the last path element.
PathCursor
  
Returns the type of the path at the position of the cursor.
PathCursor
  
next():Boolean
Advances the cursor to the next position if possible.
PathCursor
  
previous():Boolean
Moves the cursor to the previous position in the path.
PathCursor
  
reset():void
Reset the cursor to point to the beginning of the path.
PathCursor
  
toFirst():Boolean
Sets the cursor to point to the first element in the path.
PathCursor
  
toLast():Boolean
Sets the cursor to point to the last element in the path.
PathCursor
Property Detail
indexproperty
index:int  [read-only]

Returns the current position of the cursor.


Implementation
    public function get index():int
Constructor Detail
PathCursor()Constructor
public function PathCursor(path:GeneralPath)



Parameters
path:GeneralPath
Method Detail
getCurrent()method
public function getCurrent(coordinates:Array):uint

Places the coordinates for the current type into the given array.

Parameters

coordinates:Array

Returns
uint — The current PathType of the path element.
getCurrentEndPoint()method 
public function getCurrentEndPoint(coordinates:Array):uint

Places the current end coordinates of the last path element into the array.

Parameters

coordinates:Array

Returns
uint — The PathType of the current element.
getCurrentEndPointX()method 
public function getCurrentEndPointX():Number

Returns the current x coordinate of the last path element.

Returns
Number — The x coordinate or 0 if the element is of type PathType.CLOSE.
getCurrentEndPointY()method 
public function getCurrentEndPointY():Number

Returns the current y coordinate of the last path element.

Returns
Number — The y coordinate or 0 if the element is of type PathType.CLOSE.
getPathType()method 
public function getPathType():uint

Returns the type of the path at the position of the cursor.

Returns
uint — The current PathType
next()method 
public function next():Boolean

Advances the cursor to the next position if possible.

Returns
Boolean — Whether the cursor has been moved successfully. false if the cursor has been moved beyond the end of the path.
previous()method 
public function previous():Boolean

Moves the cursor to the previous position in the path.

If the cursor is already at the first element it will remain there.

Returns
Boolean — Whether the move was successful.
reset()method 
public function reset():void

Reset the cursor to point to the beginning of the path.

This moves the current position before the first element. One has to call next() before accessing the current element.

toFirst()method 
public function toFirst():Boolean

Sets the cursor to point to the first element in the path.

Returns
Boolean — Whether the cursor has been moved successfully.
toLast()method 
public function toLast():Boolean

Sets the cursor to point to the last element in the path.

Returns
Boolean — Whether the cursor has been moved successfully.