ilog.views.graphic
Class IlvPointArray

java.lang.Object
  extended by ilog.views.graphic.IlvPointArray
All Implemented Interfaces:
IlvPersistentObject, Serializable

public class IlvPointArray
extends Object
implements Serializable, IlvPersistentObject

An IlvPointArray is a class that encapsulates an array of IlvPoint so that you can more easily manipulate the array.

See Also:
Serialized Form

Constructor Summary
IlvPointArray()
          Creates an empty IlvPointArray.
IlvPointArray(IlvInputStream stream)
          Reads an IlvPointArray from an IlvInputStream.
IlvPointArray(IlvPoint[] points, boolean copy)
          Creates an IlvPointArray.
IlvPointArray(IlvPointArray source)
          Creates a new IlvPointArray by copying another one.
 
Method Summary
 void addPoints(IlvPoint[] pts, int where)
          Adds the specified array of IlvPoint at the specified index.
 void applyTransform(IlvTransformer t)
          Applies the transformer to each point of the array.
 void boundingBox(IlvRect rect, IlvTransformer t)
          Computes a rectangle obtained by applying the specified transformer to the bounding box of the IlvPointArray.
static void DrawPaths(Graphics dst, Color color, IlvPointArray[] paths)
          Strokes in the specified path using the specified Graphics.
static void FillPaths(Graphics dst, Color color, IlvPointArray[] paths)
          Fills in the specified path using the specified Graphics.
 int getNumberOfPoints()
          Returns the number of IlvPoint in the internal array.
 IlvPoint getPoint(int index)
          Returns the IlvPoint stored at the specified index.
 IlvPoint[] getPoints()
          Returns the internal array of IlvPoint.
 void movePoint(int index, float x, float y)
          Changes the position of the point at the specified index.
 int nbHorizontalIntersection(IlvPoint p)
          Returns the number of times an infinite horizontal ray intersects the polyline formed by the array of IlvPoint of the object.
 boolean outlineContains(IlvPoint p)
          Returns true if the point p lies on the segment of the polyline formed by the array of IlvPoint of the object.
 void removePoints(int start, int count)
          Removes points starting at the specified index.
 void setPoints(IlvPoint[] pts, boolean copy)
          Changes the points of the IlvPointArray.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvPointArray

public IlvPointArray()
Creates an empty IlvPointArray.


IlvPointArray

public IlvPointArray(IlvPoint[] points,
                     boolean copy)
Creates an IlvPointArray.

Parameters:
points - the array of points.
copy - if true the array of points will be copied before being used by the object, otherwise, the array will be used internally by the object and you must not use it anymore.

IlvPointArray

public IlvPointArray(IlvInputStream stream)
              throws IlvReadFileException
Reads an IlvPointArray from an IlvInputStream.

Parameters:
stream - the input stream.
Throws:
IlvReadFileException - when an error occurs while reading.

IlvPointArray

public IlvPointArray(IlvPointArray source)
Creates a new IlvPointArray by copying another one.

Parameters:
source - the array to copy.
Method Detail

getNumberOfPoints

public int getNumberOfPoints()
Returns the number of IlvPoint in the internal array.


getPoints

public IlvPoint[] getPoints()
Returns the internal array of IlvPoint. This array must not be modified.


getPoint

public IlvPoint getPoint(int index)
Returns the IlvPoint stored at the specified index.

Parameters:
index - the index.

movePoint

public void movePoint(int index,
                      float x,
                      float y)
Changes the position of the point at the specified index.

Parameters:
index - the index of the point.
x - the new x.
y - the new y.

addPoints

public void addPoints(IlvPoint[] pts,
                      int where)
Adds the specified array of IlvPoint at the specified index.


removePoints

public void removePoints(int start,
                         int count)
Removes points starting at the specified index. Removes count consecutive points starting at the index start.


boundingBox

public void boundingBox(IlvRect rect,
                        IlvTransformer t)
Computes a rectangle obtained by applying the specified transformer to the bounding box of the IlvPointArray.

Parameters:
rect - a rectangle to store the result.
t - the transformer.

setPoints

public void setPoints(IlvPoint[] pts,
                      boolean copy)
Changes the points of the IlvPointArray.

Parameters:
pts - the new points.
copy - if true, a copy of the array of points is made, otherwise the user must no longer modify it.

outlineContains

public boolean outlineContains(IlvPoint p)
Returns true if the point p lies on the segment of the polyline formed by the array of IlvPoint of the object.


nbHorizontalIntersection

public int nbHorizontalIntersection(IlvPoint p)
Returns the number of times an infinite horizontal ray intersects the polyline formed by the array of IlvPoint of the object. The ray starts at p and goes toward positive x.


applyTransform

public void applyTransform(IlvTransformer t)
Applies the transformer to each point of the array.

Parameters:
t - the transformer to apply.

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Parameters:
stream - the output stream.
Throws:
IOException - thrown when an exception occurs during the write operation for this object.

FillPaths

public static void FillPaths(Graphics dst,
                             Color color,
                             IlvPointArray[] paths)
Fills in the specified path using the specified Graphics.

Parameters:
dst - the destination Graphics.
color - the color to fill the path with.
paths - the path to fill.

DrawPaths

public static void DrawPaths(Graphics dst,
                             Color color,
                             IlvPointArray[] paths)
Strokes in the specified path using the specified Graphics.

Parameters:
dst - the destination Graphics.
color - the color to draw the path with.
paths - the path to draw.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.