ilog.views.graphic
Class IlvMarker

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvMarker
All Implemented Interfaces:
IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvMapMarker

public class IlvMarker
extends IlvGraphic

IlvMarker displays a specific graphic symbol at a given location.

The default values for an IlvMarker instance are as follows:

Note: an IlvMarker instance is a nonzoomable graphic object.

Example

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

   IlvManager manager = new IlvManager();
   IlvMarker myMarker = new IlvMarker(
        new IlvPoint(120,100), IlvMarker.IlvMarkerFilledDiamond);
   myMarker.setForeground(Color.cyan);
   myMarker.setSize(20);
   manager.addObject( myMarker, true);
 

The following image shows the different types of marker available with this class:

The marker types

About Graphic Objects

IlvMarker is a custom graphic object, that is, a subclass of IlvGraphic. Graphic objects are controlled using an IlvManager instance 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:
IlvPoint, IlvManager, IlvManagerView, Serialized Form

Field Summary
static int IlvMarkerCircle
          The Circle marker type.
static int IlvMarkerCross
          The Cross marker type.
static int IlvMarkerDiamond
          The Diamond marker type.
static int IlvMarkerFilledCircle
          The Filled Circle marker type.
static int IlvMarkerFilledDiamond
          The Filled Diamond marker type.
static int IlvMarkerFilledSquare
          The Filled Square marker type.
static int IlvMarkerFilledTriangle
          The Filled Triangle marker type.
static int IlvMarkerPlus
          The Plus marker type.
static int IlvMarkerSquare
          The Square marker type.
static int IlvMarkerTriangle
          The Triangle marker type.
 
Constructor Summary
IlvMarker()
          Creates a new IlvMarker centered in (0, 0) of type IlvMarkerSquare.
IlvMarker(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvMarker(IlvMarker source)
          Creates a marker by copying an existing one.
IlvMarker(IlvPoint p, int type)
          Creates a new marker.
IlvMarker(IlvPoint p, int type, int size)
          Creates a new marker.
 
Method Summary
 void applyTransform(IlvTransformer t)
          Applies a transformation to the object.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of the object.
 IlvGraphic copy()
          Copies the object.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
static void DrawMarker(Graphics dst, IlvPoint p, int type, int size)
          Draws the marker.
 Color getForeground()
          Returns the color of the marker.
 IlvPoint getPoint()
          Returns the center point of the marker.
 int getSize()
          Returns the size of the marker.
 int getType()
          Returns the type of the marker.
 IlvSelection makeSelection()
          Creates a selection object for this graphic object.
 void setForeground(Color color)
          Changes the color of the marker.
 void setPoint(IlvPoint p)
          Changes the center point of the marker.
 void setSize(int size)
          Changes the size of the marker.
 void setType(int type)
          Changes the type of the marker.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 boolean zoomable()
          Overrides the method of IlvGraphic to return false, because this object is not zoomable.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, contains, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, isVisible, move, move, moveResize, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setEditable, setFillOn, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IlvMarkerSquare

public static final int IlvMarkerSquare
The Square marker type.

See Also:
Constant Field Values

IlvMarkerDiamond

public static final int IlvMarkerDiamond
The Diamond marker type.

See Also:
Constant Field Values

IlvMarkerCircle

public static final int IlvMarkerCircle
The Circle marker type.

See Also:
Constant Field Values

IlvMarkerCross

public static final int IlvMarkerCross
The Cross marker type.

See Also:
Constant Field Values

IlvMarkerPlus

public static final int IlvMarkerPlus
The Plus marker type.

See Also:
Constant Field Values

IlvMarkerFilledSquare

public static final int IlvMarkerFilledSquare
The Filled Square marker type.

See Also:
Constant Field Values

IlvMarkerFilledCircle

public static final int IlvMarkerFilledCircle
The Filled Circle marker type.

See Also:
Constant Field Values

IlvMarkerFilledDiamond

public static final int IlvMarkerFilledDiamond
The Filled Diamond marker type.

See Also:
Constant Field Values

IlvMarkerTriangle

public static final int IlvMarkerTriangle
The Triangle marker type.

See Also:
Constant Field Values

IlvMarkerFilledTriangle

public static final int IlvMarkerFilledTriangle
The Filled Triangle marker type.

See Also:
Constant Field Values
Constructor Detail

IlvMarker

public IlvMarker()
Creates a new IlvMarker centered in (0, 0) of type IlvMarkerSquare.

Since:
JViews 6.0
See Also:
IlvMarker(IlvPoint, int)

IlvMarker

public IlvMarker(IlvPoint p,
                 int type,
                 int size)
Creates a new marker.

Parameters:
p - The location of the marker. It defines the center point of the marker.
type - The type of the marker. The type of the marker defines the way the marker is drawn. Valid values are one of the predefined marker types (IlvMarkerSquare, IlvMarkerDiamond, and so on). You can combine marker types (such as IlvMarkerSquare & IlvMarkerDiamond) to create more complex markers.
size - The size of the marker. A marker is defined by its center point p and its size. The marker will then be drawn in the square located at (p.x-size, p.y -size) and of size 2*size.

IlvMarker

public IlvMarker(IlvPoint p,
                 int type)
Creates a new marker. This constructor corresponds to the call of the constructor with 3 parameters with a size to 4.


IlvMarker

public IlvMarker(IlvMarker source)
Creates a marker by copying an existing one.

Parameters:
source - The source marker.

IlvMarker

public IlvMarker(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

copy

public IlvGraphic copy()
Copies the object. This method copies the object by calling the copy constructor.

Specified by:
copy in class IlvGraphic
Returns:
A copy of the object.
See Also:
IlvGraphic

getPoint

public IlvPoint getPoint()
Returns the center point of the marker.

See Also:
setPoint(ilog.views.IlvPoint)

setPoint

public void setPoint(IlvPoint p)
Changes the center point of the marker. Doing so modifies the bounding box of the marker.

Parameters:
p - The new center point.
See Also:
getPoint()

getType

public int getType()
Returns the type of the marker. The type of the marker defines the way the marker is drawn.

See Also:
setType(int)

setType

public void setType(int type)
Changes the type of the marker.

Parameters:
type - The new type. Valid values are one of the predefined marker types (IlvMarkerSquare, IlvMarkerDiamond, and so on). You can combine marker types (such as IlvMarkerSquare & IlvMarkerDiamond) to create a more complex marker.
See Also:
getType(), IlvMarkerSquare, IlvMarkerDiamond, IlvMarkerCircle, IlvMarkerCross, IlvMarkerPlus, IlvMarkerFilledSquare, IlvMarkerFilledCircle, IlvMarkerFilledDiamond, IlvMarkerTriangle, IlvMarkerFilledTriangle

getSize

public int getSize()
Returns the size of the marker.

See Also:
setSize(int)

setSize

public void setSize(int size)
Changes the size of the marker. A marker is defined by its center point (see getPoint()) and its size. A marker is drawn in a square of size 2*size located at (p.x-size, p.y-size), where p is the center point.

Parameters:
size - The size of the marker.
See Also:
getSize()

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

boundingBox

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

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

applyTransform

public void applyTransform(IlvTransformer t)
Applies a transformation to the object. The implementation of this method simply applies the transformation to the center point of the marker (see getPoint()).

Specified by:
applyTransform in class IlvGraphic
Parameters:
t - The transformer to be applied.
See Also:
IlvGraphic

makeSelection

public IlvSelection makeSelection()
Creates a selection object for this graphic object. Because this object cannot be resized using the interactor, the implementation of this method creates an instance of the class IlvUnresizeableDrawSelection.

Overrides:
makeSelection in class IlvGraphic
Since:
JViews 5.0
See Also:
IlvDrawSelection

setForeground

public void setForeground(Color color)
Changes the color of the marker.

Overrides:
setForeground in class IlvGraphic
Parameters:
color - The new color.
See Also:
IlvGraphic.draw(Graphics, IlvTransformer), IlvGraphic.setBackground(Color), IlvGraphic.setFillOn(boolean), IlvGraphic.setStrokeOn(boolean), IlvGraphic

getForeground

public Color getForeground()
Returns the color of the marker.

Returns:
The color of the object.

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.

zoomable

public boolean zoomable()
Overrides the method of IlvGraphic to return false, because this object is not zoomable.

Overrides:
zoomable in class IlvGraphic
See Also:
IlvGraphic, IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.boundingBox(IlvTransformer), IlvManager

DrawMarker

public static void DrawMarker(Graphics dst,
                              IlvPoint p,
                              int type,
                              int size)
Draws the marker. This static method is used to draw a marker at a specified location, with a specified type and size.

Parameters:
dst - The destination Graphics to draw the marker.
p - The center point of the marker.
type - The type of the marker.
size - The size of the marker.


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