ilog.views.graphic
Class IlvGeneralPath

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvGeneralPath
All Implemented Interfaces:
IlvPolyPointsInterface, IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvDefaultCollapsedGraphic, IlvTextPath

public class IlvGeneralPath
extends IlvGraphic
implements IlvPolyPointsInterface

IlvGeneralPath is a graphic object that can take any two dimensional shape.

The shape of an IlvGeneralPath instance is controlled using a Java ShapeStroke and Paint objects; you can use gradient paint effects for IlvGeneralPath instances.

The default values for an IlvGeneralPath instance are as follows:

Example

The following code example shows how to use IlvGeneralPath in a simple Java application:

  int DEFAULT_WIDTH = 70;
  int DEFAULT_HEIGHT = 30;
  IlvPoint corner = new IlvPoint(50,50);
  
  IlvManager manager = new IlvManager();
  //Create a customized circle.
  Shape shape = new Rectangle2D.Float(corner.x, corner.y,
      DEFAULT_WIDTH, DEFAULT_HEIGHT);
  IlvGeneralPath path = new IlvGeneralPath(shape);
  path.setFillPaint(
      new GradientPaint(
            new Point((int)corner.x + DEFAULT_WIDTH/2,
            (int)corner.y),
            Color.yellow,
            new Point((int)corner.x + DEFAULT_WIDTH/2,
            (int)corner.y + DEFAULT_HEIGHT),
            Color.red));
  path.setStrokePaint(Color.blue);
  
  //Add the graphic objects to the manager.
  manager.addObject(path,true);
 

The following image shows the graphic object created in the code example:

IlvGeneralPath

About Graphic Objects

IlvGeneralPath is a custom graphic object, that is, a subclass of IlvGraphic. Graphic objects are controlled using an instance of IlvManager or one of its subclasses, and displayed using one or more IlvManagerView instances in a Java Swing application. For information about generic features for graphic objects, see IlvGraphic.

See Also:
IlvManager, IlvManagerView, Serialized Form

Constructor Summary
IlvGeneralPath()
          Creates an IlvGeneralPath instance with a Rectangle as shape.
IlvGeneralPath(IlvGeneralPath source)
          Creates a new IlvGeneralPath by copying an existing one.
IlvGeneralPath(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvGeneralPath(Shape shape)
          Creates a new IlvGeneralPath.
 
Method Summary
protected  Paint adaptPaint(Shape shape, Paint paint)
          Returns a new Paint object that will fit the shape parameter according to the initial paint parameter.
 boolean allowsPointInsertion()
          Returns true if isPointEditionAllowed returns true and false otherwise.
 boolean allowsPointMove(int index)
          Returns true ifisPointEditionAllowed returns true and false otherwise.
 boolean allowsPointRemoval()
          Returns true if isPointEditionAllowed returns true and false otherwise.
 void applyTransform(IlvTransformer t)
          Applies a transformation to the shape of the object.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of the object.
protected  IlvRect calcBoundingBox(IlvTransformer t)
          Calculates the bounding rectangle of the object.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests if a point lies within the shape.
 IlvGraphic copy()
          Copies the objects.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
 float getAlpha()
          Returns the alpha value of this graphic object.
 Shape getClip()
          Returns the shape that will clip the object.
 Paint getFillPaint()
          Returns the paint object set to fill the shape.
 IlvPoint getIntersectionWithOutline(IlvPoint innerPoint, IlvPoint outerPoint, IlvTransformer t)
          Returns the intersection of the line segment from inner point to outer point with the shape of the graphic object.
 float getMaximumStrokeWidth()
          Returns the maximum stroke width used if a BasicStroke is set.
 IlvPoint getPointAt(int index, IlvTransformer t)
          Returns the point at the specified index.
 int getPointsCardinal()
          Returns the number of points defining the IlvGeneralPath.
 Shape getShape()
          Returns the shape of the object.
 IlvRect getShapeBounds(IlvTransformer t)
          Returns the bounding rectangle of the Shape of the object.
 Stroke getStroke()
          Returns the stroke object used to stroke the shape.
 Paint getStrokePaint()
          Returns the paint object set to stroke the path.
 IlvTransformer getTransformer()
          Returns the additional transformer that is applied to the Graphics2D before displaying the IlvGeneralPath.
 void insertPoint(int index, float x, float y, IlvTransformer t)
          Inserts a new point in the IlvGeneralPath if allowsPointInsertion returns true.
 boolean isContainsWhenNotFilled()
          Returns true when the method contains will return true for a point inside the shape even if the object is not filled.
 boolean isFillOn()
          Returns true if the inside of the object will be filled.
 boolean isMovePointAllowed()
          Deprecated. Beginning with ILOG JViews 5.0, use the method isPointEditionAllowed() instead.
 boolean isPaintAbsolute()
          Returns false if the TexturePaint or GradientPaint will be adapted to the bounding rectangle of the object.
 boolean isPaintZoomed()
          Returns true if the texture or gradient will be zoomed according to the shape when the object is zoomed.
 boolean isPointEditionAllowed()
          Returns true if it is allowed to move, insert, or remove a point of the IlvGeneralPath.
 boolean isStrokeOn()
          Returns true if the shape of the object is stroked.
 boolean isTransformedShapeMode()
          Returns true if the object is in transformed shape mode.
 IlvSelection makeSelection()
          Creates the selection object for this IlvGeneralPath instance.
 void movePoint(int index, float x, float y, IlvTransformer t)
          Changes the position of a point if isPointEditionAllowed returns true.
 void moveResize(IlvRect rect)
          Resizes the object.
 boolean pointsInBBox()
          Returns false since all points are not contained inside the bounding rectangle of the object.
 void removePoint(int index, IlvTransformer t)
          Removes a point from the IlvGeneralPath if allowsPointRemoval returns true.
 void resize(float neww, float newh)
          Resizes the object.
 void setAlpha(float alpha)
          Changes the alpha value of this graphic object.
 void setBackground(Color c)
          Changes the background color of the object.
 void setClip(Shape clip)
          Changes the shape that will clip the object.
 void setContainsWhenNotFilled(boolean set)
          When set to true, specifies that the method contains will return true for a point inside the shape even if the object is not filled.
 void setFillOn(boolean set)
          If true, specifies that the inside of the object will be filled.
 void setFillPaint(Paint paint)
          Changes the paint object used to fill the shape.
 void setForeground(Color c)
          Changes the foreground color of the object.
protected  void setInternalShape(Shape shape)
          Sets the internal shape.
 void setMaximumStrokeWidth(float value)
          Allows you to set the maximum stroke width if a BasicStroke is used.
 void setMovePointAllowed(boolean set)
          Deprecated. Beginning with ILOG JViews 5.0, use the method setPointEditionAllowed(boolean) instead.
 void setPaintAbsolute(boolean set)
          When set to false, specifies that the TexturePaint or GradientPaint will be adapted to the bounding rectangle of the object.
 void setPaintZoomed(boolean set)
          When set to true, specifies that the texture or gradient will be zoomed according to the shape when the object is zoomed.
 void setPointEditionAllowed(boolean set)
          Allows you to change the value returned by the method isPointEditionAllowed().
 void setShape(Shape shape)
          Changes the shape of the object.
 void setShapeBounds(IlvRect rect)
          Resizes the bounding rectangle of the Shape of the object.
 void setStroke(Stroke stroke)
          Changes the stroke object used to stroke the shape.
 void setStrokeOn(boolean set)
          When set to true, specifies that the shape of the object is stroked.
 void setStrokePaint(Paint paint)
          Changes the paint object used when stroking the path.
 void setTransformedShapeMode(boolean transformedShapeMode)
          Sets the transformed shape mode.
 void setTransformer(IlvTransformer t)
          Sets the additional transformer that is applied to the Graphics2D before displaying the IlvGeneralPath.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, isVisible, move, move, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, rotate, scale, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setToolTipText, setVisible, toString, translate, zoomable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvGeneralPath

public IlvGeneralPath()
Creates an IlvGeneralPath instance with a Rectangle as shape.

Since:
JViews 6.0

IlvGeneralPath

public IlvGeneralPath(Shape shape)
Creates a new IlvGeneralPath.

Parameters:
shape - The initial shape of the general path.

IlvGeneralPath

public IlvGeneralPath(IlvGeneralPath source)
Creates a new IlvGeneralPath by copying an existing one.

Parameters:
source - The origin object for the copy.

IlvGeneralPath

public IlvGeneralPath(IlvInputStream stream)
               throws IlvReadFileException
Reads the object from an IlvInputStream.

Parameters:
stream - The input stream.
Throws:
IlvReadFileException - if the format is not correct.
Method Detail

getShape

public Shape getShape()
Returns the shape of the object. You should not modify the shape of the object directly because this may modify the bounding rectangle of the IlvGeneralPath. If you need to change the shape of the object, use the setShape method.

See Also:
setShape(java.awt.Shape)

setShape

public void setShape(Shape shape)
Changes the shape of the object. Note that changing the shape of the object may change its bounding rectangle. For this reason, if the object is contained inside a manager you should modify the shape using the applyToObject method of the manager.

See Also:
getShape(), IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)

setInternalShape

protected void setInternalShape(Shape shape)
Sets the internal shape.

Internal method or field: do not use!

getTransformer

public final IlvTransformer getTransformer()
Returns the additional transformer that is applied to the Graphics2D before displaying the IlvGeneralPath.

Since:
JViews 3.5
See Also:
setTransformer(ilog.views.IlvTransformer)

setTransformer

public final void setTransformer(IlvTransformer t)
Sets the additional transformer that is applied to the Graphics2D before displaying the IlvGeneralPath. This allows you to transform the drawing without modifying the real shape of the object.

Since:
JViews 3.5
See Also:
applyTransform(ilog.views.IlvTransformer)

isFillOn

public boolean isFillOn()
Returns true if the inside of the object will be filled.

See Also:
setFillPaint(java.awt.Paint), setFillOn(boolean)

setFillOn

public void setFillOn(boolean set)
If true, specifies that the inside of the object will be filled.

Overrides:
setFillOn in class IlvGraphic
Parameters:
set - Set to true to enable the fill style for this graphic object.
See Also:
isFillOn(), setFillPaint(java.awt.Paint)

isStrokeOn

public boolean isStrokeOn()
Returns true if the shape of the object is stroked.

See Also:
setStroke(java.awt.Stroke), setStrokePaint(java.awt.Paint), setStrokeOn(boolean)

setStrokeOn

public void setStrokeOn(boolean set)
When set to true, specifies that the shape of the object is stroked. Note that this may change its bounding rectangle. For this reason, if the object is contained inside a manager, you should modify the shape using the applyToObject method of the manager.

Overrides:
setStrokeOn in class IlvGraphic
Parameters:
set - Set to true to enable the stroke in your customized graphic object.
See Also:
setStroke(java.awt.Stroke), setStrokePaint(java.awt.Paint), isStrokeOn()

setStroke

public void setStroke(Stroke stroke)
Changes the stroke object used to stroke the shape. You may set the value to null to remove the stroke. Note that changing the stroke may modify the bounding rectangle of the object. For this reason, if the object is contained inside a manager, you should modify the shape using the applyToObject method of the manager.

See Also:
getStrokePaint(), getStroke(), isStrokeOn()

getStroke

public Stroke getStroke()
Returns the stroke object used to stroke the shape. This method may return null if there is no stroke specified.

See Also:
getStrokePaint(), setStroke(java.awt.Stroke), isStrokeOn()

setMaximumStrokeWidth

public void setMaximumStrokeWidth(float value)
Allows you to set the maximum stroke width if a BasicStroke is used. If the maximum stroke width is specified and not equal to zero, then the width of the basic stroke will stop zooming when the maximum stroke width is reached. A value of zero means that there is no limit. The default value is zero.

Since:
JViews 3.5
See Also:
getMaximumStrokeWidth(), getStroke()

getMaximumStrokeWidth

public float getMaximumStrokeWidth()
Returns the maximum stroke width used if a BasicStroke is set. If the maximum stroke width is specified and not equal to zero, then the width of the basic stroke will stop zooming when the maximum stroke width is reached. A value of zero means that there is no limit. The default value is zero.

Since:
JViews 3.5
See Also:
setMaximumStrokeWidth(float), getStroke()

getFillPaint

public Paint getFillPaint()
Returns the paint object set to fill the shape.

See Also:
setFillPaint(java.awt.Paint)

setFillPaint

public void setFillPaint(Paint paint)
Changes the paint object used to fill the shape.

Parameters:
paint - The new filling object.
See Also:
getFillPaint(), isFillOn()

setStrokePaint

public void setStrokePaint(Paint paint)
Changes the paint object used when stroking the path.

See Also:
getStrokePaint(), isStrokeOn(), setStroke(java.awt.Stroke)

getStrokePaint

public Paint getStrokePaint()
Returns the paint object set to stroke the path.

See Also:
setStrokePaint(java.awt.Paint), isStrokeOn(), setStroke(java.awt.Stroke)

isPaintZoomed

public boolean isPaintZoomed()
Returns true if the texture or gradient will be zoomed according to the shape when the object is zoomed. The default value is true.

See Also:
setPaintZoomed(boolean), setFillPaint(java.awt.Paint), setStrokePaint(java.awt.Paint)

setPaintZoomed

public void setPaintZoomed(boolean set)
When set to true, specifies that the texture or gradient will be zoomed according to the shape when the object is zoomed.

See Also:
isPaintZoomed(), setFillPaint(java.awt.Paint), setStrokePaint(java.awt.Paint)

isPaintAbsolute

public boolean isPaintAbsolute()
Returns false if the TexturePaint or GradientPaint will be adapted to the bounding rectangle of the object. The default value is false. This value does not affect automatically adjusted Paint such as ilog.views.java2d.IlvLinearGradientPaint.

See Also:
setPaintAbsolute(boolean), setPaintZoomed(boolean), setFillPaint(java.awt.Paint), setStrokePaint(java.awt.Paint), adaptPaint(java.awt.Shape, java.awt.Paint)

setPaintAbsolute

public void setPaintAbsolute(boolean set)
When set to false, specifies that the TexturePaint or GradientPaint will be adapted to the bounding rectangle of the object. The default value is false. This value does not affect automatically adjusted Paint such as ilog.views.java2d.IlvLinearGradientPaint.

See Also:
isPaintAbsolute(), setPaintZoomed(boolean), setFillPaint(java.awt.Paint), setStrokePaint(java.awt.Paint), adaptPaint(java.awt.Shape, java.awt.Paint)

isContainsWhenNotFilled

public boolean isContainsWhenNotFilled()
Returns true when the method contains will return true for a point inside the shape even if the object is not filled.

See Also:
contains(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvTransformer), isFillOn(), setContainsWhenNotFilled(boolean)

setContainsWhenNotFilled

public void setContainsWhenNotFilled(boolean set)
When set to true, specifies that the method contains will return true for a point inside the shape even if the object is not filled.

See Also:
isFillOn(), isContainsWhenNotFilled()

setForeground

public void setForeground(Color c)
Changes the foreground color of the object. It calls setStrokePaint on the object. This method is here for compatibility reasons for the non Java 2 IlvGraphic.

Overrides:
setForeground in class IlvGraphic
Parameters:
c - The new color.
See Also:
setStrokePaint(java.awt.Paint)

setBackground

public void setBackground(Color c)
Changes the background color of the object. It calls setFillPaint on the object. This method is here for compatibility reasons for the non Java 2 IlvGraphic.

Overrides:
setBackground in class IlvGraphic
Parameters:
c - The new color.
See Also:
setFillPaint(java.awt.Paint)

setClip

public void setClip(Shape clip)
Changes the shape that will clip the object. The value may be null if no clip is applied. The clipping shape will follow the transformation applied to the object.

Parameters:
clip - The new clip.
Since:
JViews 3.5
See Also:
applyTransform(ilog.views.IlvTransformer)

getClip

public Shape getClip()
Returns the shape that will clip the object. The value may be null if no clip is applied. The shape of the clip is modified when a transformation is applied to the object.

Since:
JViews 3.5
See Also:
setClip(java.awt.Shape)

setAlpha

public void setAlpha(float alpha)
Changes the alpha value of this graphic object. The alpha composition value is used to render the graphic object in a transparent way. The value must be in the range of [0.0, 1.0], the value of 1 meaning that the graphic object is not transparent.

If the containers of the graphic object (manager layer, graphic set) have their own alpha value, the object draws with a composed alpha value.

The default value is 1.

Parameters:
alpha - The new transparency level in the range [0.0, 1.0].
Since:
JViews 8.0
See Also:
getAlpha(), IlvManagerLayer.setAlpha(float)

getAlpha

public float getAlpha()
Returns the alpha value of this graphic object. The alpha composition value is used to render this graphic object in a transparent way. The value is in the range of [0.0, 1.0], the value of 1 meaning that the graphic object is not transparent.

Since:
JViews 8.0
See Also:
setAlpha(float), IlvManagerLayer.getAlpha()

draw

public void draw(Graphics dst,
                 IlvTransformer t)
Draws the object.

Specified by:
draw in class IlvGraphic
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
See Also:
IlvGraphic.boundingBox(ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

adaptPaint

protected Paint adaptPaint(Shape shape,
                           Paint paint)
Returns a new Paint object that will fit the shape parameter according to the initial paint parameter. This method is called only if isPaintAbsolute() returns false. By default, it deals with GradientPaint and TexturePaint instances to adapt them correctly because they do not automatically fit the shape of the object on which they are drawn. You can override this method to manage your own Paint subclasses if they do not take the shape of the object into account. You will generally call the superclass method for GradientPaint and TexturePaint instances. Other Paint objects deriving from IlvMultipleGradientPaint automatically take into account the shape of the object if their IlvMultipleGradientPaint.isAdapting() method returns true and thus are not modified by this method.

Parameters:
shape - The shape parameter that the returned Paint should fit.
paint - The initial Paint object.
See Also:
isPaintAbsolute()

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests if a point lies within the shape.

Overrides:
contains in class IlvGraphic
Parameters:
p - The point to be tested.
tp - The point p transformed by the transformer t.
t - The transformation that was applied to the object when it was drawn.
Returns:
true if the point lies inside this graphic object.
See Also:
isContainsWhenNotFilled()

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object. First checks whether the bounding rectangle is cached. If it is not cached it calls calcBoundingBox(ilog.views.IlvTransformer) to recalculate the bounding box.

Specified by:
boundingBox in interface IlvPolyPointsInterface
Specified by:
boundingBox in class IlvGraphic
Parameters:
t - The transformer used to draw the object.
See Also:
getShapeBounds(IlvTransformer)

calcBoundingBox

protected IlvRect calcBoundingBox(IlvTransformer t)
Calculates the bounding rectangle of the object. This method is used by boundingBox(ilog.views.IlvTransformer) if the current bounding box is not cached.

Parameters:
t - The transformer used to draw the object.
Since:
JViews 8.1
See Also:
getShapeBounds(IlvTransformer)

getShapeBounds

public IlvRect getShapeBounds(IlvTransformer t)
Returns the bounding rectangle of the Shape of the object.

Parameters:
t - The transformer used to draw the object.
Since:
JViews 5.0
See Also:
boundingBox(IlvTransformer)

getIntersectionWithOutline

public IlvPoint getIntersectionWithOutline(IlvPoint innerPoint,
                                           IlvPoint outerPoint,
                                           IlvTransformer t)
Returns the intersection of the line segment from inner point to outer point with the shape of the graphic object. This method is used the clip links against the shape of the node. The implementation of this method must be robust with respect to the input points: Even if innerPoint is not inside the graphic object, or if outerPoint is not outside the graphic object, it must return a valid point. For instance, if there is no intersection, it can return the start point.

This implementation works precise if the stroke is off or if the stroke is a basic stroke with small stroke size. If the stroke is not a basic stroke, the stroke width cannot be determined and a stroke width 0 is assumed.

Overrides:
getIntersectionWithOutline in class IlvGraphic
Parameters:
innerPoint - A point usually inside the graphic object, given in manager view coordinates.
outerPoint - A point usually outside of the graphic object, given in manager view coordinates.
t - The transformation used to draw the object.
Since:
JViews 8.1
See Also:
IlvClippingLinkConnector

moveResize

public void moveResize(IlvRect rect)
Resizes the object. The method sets the bounding rectangle of the object to the IlvRect parameter. This method calls the applyTransform(ilog.views.IlvTransformer) method.

Overrides:
moveResize in class IlvGraphic
Parameters:
rect - The new bounding rectangle of the object.
See Also:
setShapeBounds(ilog.views.IlvRect)

resize

public void resize(float neww,
                   float newh)
Resizes the object. The bounding rectangle of the object is modified. It sets its new size as (neww, newh). This method calls the applyTransform method.

Overrides:
resize in class IlvGraphic
Parameters:
neww - The new horizontal width.
newh - The new horizontal height.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

setShapeBounds

public void setShapeBounds(IlvRect rect)
Resizes the bounding rectangle of the Shape of the object. The method sets the bounding rectangle of the shape to the IlvRect parameter. This method calls the applyTransform(ilog.views.IlvTransformer) method.

Parameters:
rect - The new bounding rectangle of the shape of the object.
Since:
JViews 5.0
See Also:
moveResize(ilog.views.IlvRect)

applyTransform

public void applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object. The transformation is also applied to the shape of the clipping region.

Specified by:
applyTransform in class IlvGraphic
Parameters:
t - The transformer to be applied.
See Also:
setClip(java.awt.Shape)

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an IlvOutputStream. You should not call this method directly; instead, you should use the write methods of the manager.

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

copy

public IlvGraphic copy()
Copies the objects.

Specified by:
copy in class IlvGraphic
Returns:
A new IlvGeneralPath.
See Also:
IlvGraphic

isMovePointAllowed

public boolean isMovePointAllowed()
Deprecated. Beginning with ILOG JViews 5.0, use the method isPointEditionAllowed() instead.

Returns true if it is allowed to move, insert, or remove a point of the IlvGeneralPath. The default value is true except for an IlvGeneralPath created with java.awt.geom.RectangularShape. This value can be changed with setMovePointAllowed.

See Also:
setPointEditionAllowed(boolean), allowsPointInsertion(), allowsPointRemoval()

setMovePointAllowed

public void setMovePointAllowed(boolean set)
Deprecated. Beginning with ILOG JViews 5.0, use the method setPointEditionAllowed(boolean) instead.

Allows you to change the value returned by isMovePointAllowed.

See Also:
isMovePointAllowed()

isPointEditionAllowed

public boolean isPointEditionAllowed()
Returns true if it is allowed to move, insert, or remove a point of the IlvGeneralPath. The default value is true except for an IlvGeneralPath created with java.awt.geom.RectangularShape. This value can be changed with setPointEditionAllowed.

Since:
JViews 5.0
See Also:
setPointEditionAllowed(boolean), allowsPointInsertion(), allowsPointRemoval(), allowsPointMove(int)

setPointEditionAllowed

public void setPointEditionAllowed(boolean set)
Allows you to change the value returned by the method isPointEditionAllowed().

Since:
JViews 5.0
See Also:
isPointEditionAllowed()

makeSelection

public IlvSelection makeSelection()
Creates the selection object for this IlvGeneralPath instance. The default implementation creates an instance of IlvPolyPointsSelection if the object is in allow move point mode. In other cases it returns an instance of IlvReshapeSelection.

Overrides:
makeSelection in class IlvGraphic
See Also:
isPointEditionAllowed(), IlvPolyPointsSelection

allowsPointInsertion

public boolean allowsPointInsertion()
Returns true if isPointEditionAllowed returns true and false otherwise.

Specified by:
allowsPointInsertion in interface IlvPolyPointsInterface
See Also:
isPointEditionAllowed(), insertPoint(int, float, float, ilog.views.IlvTransformer)

allowsPointRemoval

public boolean allowsPointRemoval()
Returns true if isPointEditionAllowed returns true and false otherwise.

Specified by:
allowsPointRemoval in interface IlvPolyPointsInterface
See Also:
isPointEditionAllowed(), removePoint(int, ilog.views.IlvTransformer)

allowsPointMove

public boolean allowsPointMove(int index)
Returns true ifisPointEditionAllowed returns true and false otherwise.

Specified by:
allowsPointMove in interface IlvPolyPointsInterface
Parameters:
index - The index of the point.
Since:
JViews 5.0
See Also:
isPointEditionAllowed(), movePoint(int, float, float, ilog.views.IlvTransformer)

getPointAt

public IlvPoint getPointAt(int index,
                           IlvTransformer t)
Returns the point at the specified index.

Specified by:
getPointAt in interface IlvPolyPointsInterface
Parameters:
index - The index.
t - The transformer used to draw the object.

getPointsCardinal

public int getPointsCardinal()
Returns the number of points defining the IlvGeneralPath.

Specified by:
getPointsCardinal in interface IlvPolyPointsInterface

insertPoint

public void insertPoint(int index,
                        float x,
                        float y,
                        IlvTransformer t)
Inserts a new point in the IlvGeneralPath if allowsPointInsertion returns true.

Specified by:
insertPoint in interface IlvPolyPointsInterface
Parameters:
index - The index where to insert the point.
x - The x location.
y - The y location.
t - The transformer used to draw the object. Note that the x, y coordinates are not transformed by the transformer.
See Also:
allowsPointInsertion()

movePoint

public void movePoint(int index,
                      float x,
                      float y,
                      IlvTransformer t)
Changes the position of a point if isPointEditionAllowed returns true.

Specified by:
movePoint in interface IlvPolyPointsInterface
Parameters:
index - The index of the point to be moved.
x - The new x location.
y - The new y location.
t - The transformer used to draw the object. Note that the x, y coordinates are not transformed by the transformer.
See Also:
isPointEditionAllowed()

pointsInBBox

public boolean pointsInBBox()
Returns false since all points are not contained inside the bounding rectangle of the object.

Specified by:
pointsInBBox in interface IlvPolyPointsInterface

removePoint

public void removePoint(int index,
                        IlvTransformer t)
Removes a point from the IlvGeneralPath if allowsPointRemoval returns true.

Specified by:
removePoint in interface IlvPolyPointsInterface
Parameters:
index - The index of the point to be removed.
t - The transformer used to draw the object.
See Also:
isPointEditionAllowed()

setTransformedShapeMode

public void setTransformedShapeMode(boolean transformedShapeMode)
Sets the transformed shape mode. If the transformed shape mode is enabled, the method setShape(java.awt.Shape) receives a shape in a coordinate system independent from the current position. That is, the shape is automatically transformed according to the current position of the object.

If the transformed shape mode is disabled, the method setShape(java.awt.Shape) receives a shape in a coordinate system dependent from the current position.

The difference is visible if you set a shape after moving the node:

 IlvGeneralPath gp = new IlvGeneralPath(shape);
 gp.move(100,100);
 gp.setShape(shape);
 
In transformed shape mode, resetting the original shape does not move the node back to the original position. In untransformed mode, it moves the node back to the original position.

Note that the method getShape() always returns the transformed shape in the coordinate system dependent from the current position. That is, the following statement affects the shape in transformed shape mode, while it has no effect in untransformed shape mode:

 gp.setShape(gp.getShape());
 
If IlvGeneralPath is specified by CSS, it is recommended to use the transformed shape mode.

Parameters:
transformedShapeMode -
Since:
JViews 7.5
See Also:
isTransformedShapeMode()

isTransformedShapeMode

public boolean isTransformedShapeMode()
Returns true if the object is in transformed shape mode.

Since:
JViews 7.5
See Also:
setTransformedShapeMode(boolean)


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