public class IlvCircularScale extends IlvScale implements IlvDefinitionRectInterface
IlvCircularScale
represents a circular scale.
The default values for an IlvCircularScale
instance are as
follows:
IlvRect(0,0,100,100)
"0"
, see java.text.DecimalFormat
0
100
200
-220
true
5
2
5
2
Color.black
java.awt.Font("Dialog", Font.PLAIN, 12)
The following code example shows how to use an IlvCircularScale
in a simple Java application:
IlvManager manager = new IlvManager(); IlvCircularScale myDefaultScale = new IlvCircularScale(); IlvCircularScale myCustomScale = new IlvCircularScale(new IlvRect(160, 80, 40, 40), "#", 0, 76, 0, 200, false, 5, 2, 5, 5); myCustomScale.setForeground(Color.blue); myCustomScale.setFont(new Font("SansSerif", Font.BOLD, 14)); manager.addObject(myDefaultScale, true); manager.addObject(myCustomScale, true);
The following image shows the graphic objects created in the code example:
>
IlvCircularScale
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.
IlvRect
,
IlvPoint
,
IlvConstants
,
IlvManager
,
IlvManagerView
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
BOTH
Both first and the last label are visible.
|
static int |
FIRST
The first label must be visible.
|
static int |
LAST
The last label must be visible.
|
Constructor and Description |
---|
IlvCircularScale()
Creates a new
IlvCircularScale with default values. |
IlvCircularScale(IlvCircularScale source)
Creates a new
IlvCircularScale by copying an existing one. |
IlvCircularScale(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvCircularScale(IlvRect rect,
String[] labels,
float start,
float range,
boolean inside,
int numberOfSubSteps,
float stepSize,
float subStepSize)
Creates a new
IlvCircularScale by specifying the labels to be
displayed. |
IlvCircularScale(IlvRect rect,
String format,
float min,
float max,
float start,
float range,
boolean inside,
int numberOfSteps,
int numberOfSubSteps,
float stepSize,
float subStepSize)
Creates a new
IlvCircularScale with numeric labels by
specifying a minimum and maximum value for the labels. |
Modifier and Type | Method and Description |
---|---|
void |
applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.
|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the outline of the object.
|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
IlvPoint |
getCenter(IlvTransformer t)
Returns the center point of the graphic object.
|
IlvRect |
getDefinitionRect()
Returns the rectangle that contains the ellipse defining the arc.
|
IlvTransformer |
getDefinitionTransformer()
This function returns
null to indicate that there is no
definition transformation. |
int |
getLabelPolicy()
|
boolean |
getLabelsInside()
Returns the
true if the labels are drawn inside the scale;
false if the labels are drawn outside the scale. |
float |
getRange()
Returns the angle range of the scale.
|
float |
getStart()
Returns the start angle of the scale.
|
void |
moveResize(IlvRect rect)
Resizes the object.
|
void |
setDefinitionRect(IlvRect drawrect)
Note that, if this circular scale is contained inside an
IlvManager , this method can be called only using the method
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean) of the manager. |
void |
setLabelPolicy(int policy)
Sets the label visibility policy.
|
void |
setLabelsInside(boolean inside)
Changes the way the labels are drawn.
|
void |
setRange(float range)
Sets the angle range of the scale.
|
void |
setStart(float start)
Sets the start range of the scale.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
boolean |
zoomable()
Returns
true if the object is zoomable. |
baseTextDirectionChanged, componentOrientationChanged, getFont, getForeground, getFormat, getLabels, getMax, getMin, getNumberOfSteps, getNumberOfSubSteps, getStepSize, getSubStepSize, isAntialiasing, isBaseTextDirectionSensitive, isLocaleSensitive, localeChanged, setAntialiasing, setFont, setForeground, setFormat, setLabel, setLabels, setMax, setMin, setNumberOfSteps, setNumberOfSubSteps, setStepSize, setSubStepSize
calcResolvedBaseTextDirection, getBaseTextDirection, getComponentOrientation, getResolvedBaseTextDirection, getULocale, invalidateBidiCache, setBaseTextDirection, setBaseTextDirection, setBaseTextDirectionDuringConstruction
addActionListener, addNamedPropertyListener, allViewsRemoved, blinkingStateOn, boundingBox, callDraw, getAndAssociateObjectInteractor, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, isVisible, makeSelection, move, move, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved
public static int FIRST
public static int LAST
public static int BOTH
public IlvCircularScale()
IlvCircularScale
with default values.public IlvCircularScale(IlvRect rect, String format, float min, float max, float start, float range, boolean inside, int numberOfSteps, int numberOfSubSteps, float stepSize, float subStepSize)
IlvCircularScale
with numeric labels by
specifying a minimum and maximum value for the labels.rect
- the location and size of the ellipse that defines the scale. The
scale is defined as a portion of the ellipse defined by this
parameter, by its starting angle (the start parameter as
well as the angle range it uses (the range parameter).format
- a format used to display the labels of the scale. (See the class
java.text.DecimalFormat
for a description of this
parameter).min
- the minimum value of the labels of the scale.max
- the maximum value of the labels of the scale.start
- the start angle in degrees.range
- the angle range in degrees.inside
- if true
then labels are displayed inside the arc;
otherwise they are displayed outside.numberOfSteps
- the number of major steps.numberOfSubSteps
- the number of minor steps between two major steps.stepSize
- the size of the major ticks.subStepSize
- the size of the minor ticks.public IlvCircularScale(IlvRect rect, String[] labels, float start, float range, boolean inside, int numberOfSubSteps, float stepSize, float subStepSize)
IlvCircularScale
by specifying the labels to be
displayed.rect
- the location and size of the ellipse that defines the scale. The
scale is defined as a portion of the ellipse defined by this
parameter, by its starting angle (the start parameter as
well as the angle range it uses (the range parameter).labels
- the labels of the scale.start
- the start angle in degrees.range
- the angle range in degrees.inside
- if true
the labels are displayed inside the arc;
otherwise they are displayed outside.numberOfSubSteps
- the number of minor steps between two major steps.stepSize
- the size of the major ticks.subStepSize
- the size of the minor ticks.public IlvCircularScale(IlvCircularScale source)
IlvCircularScale
by copying an existing one.source
- the origin object for the copy.public IlvCircularScale(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- the input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
copy
in class IlvGraphic
IlvGraphic
public final IlvRect getDefinitionRect()
getDefinitionRect
in interface IlvDefinitionRectInterface
public final void setDefinitionRect(IlvRect drawrect)
IlvManager
, this method can be called only using the method
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
of the manager.setDefinitionRect
in interface IlvDefinitionRectInterface
drawrect
- The new definition rectangle.public IlvTransformer getDefinitionTransformer()
null
to indicate that there is no
definition transformation.getDefinitionTransformer
in interface IlvDefinitionRectInterface
null
.IlvDefinitionRectInterface
public final float getStart()
public final void setStart(float start)
start
- the new angle in degrees.public final float getRange()
public final void setRange(float range)
range
- the new angle range in degrees.public final boolean getLabelsInside()
true
if the labels are drawn inside the scale;
false
if the labels are drawn outside the scale.public final void setLabelsInside(boolean inside)
inside
- if this parameter is set to true
, the labels are
drawn inside the scale; otherwise, they are drawn outside.public void setLabelPolicy(int policy)
range
of the scale is 360 degrees.public IlvRect boundingBox(IlvTransformer t)
boundingBox
in class IlvScale
t
- The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public IlvPoint getCenter(IlvTransformer t)
getCenter
in class IlvGraphic
t
- The transformer used to draw the object. The value
null
can be used for the identity transformer.IlvGraphic
public void draw(Graphics dst, IlvTransformer t)
draw
in class IlvGraphic
dst
- The destination Graphics.t
- The transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains
in class IlvGraphic
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.true
if the point lies inside this graphic object.IlvGraphic
public void applyTransform(IlvTransformer t)
applyTransform
in class IlvScale
t
- The transformer to be applied.IlvGraphic
public void moveResize(IlvRect rect)
IlvRect
parameter. This method calls the
applyTransform(ilog.views.IlvTransformer)
method.moveResize
in class IlvGraphic
rect
- The new bounding rectangle of the object.setDefinitionRect(IlvRect)
public boolean zoomable()
true
if the object is zoomable. Otherwise it returns
false
.zoomable
in class IlvGraphic
IlvGraphic
,
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvManager
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
. Note that even if
this is a public method, you should not call it directly, you should use
the write
methods of the manager.write
in interface IlvPersistentObject
write
in class IlvScale
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.