public class IlvHalfZoomingRenderer extends IlvFilterSDMRenderer
IlvHalfZoomingRenderer
is a
filtering renderer that prevents the nodes of the
graph to zoom in and/or out beyond given limits.
The half-zooming renderer wraps each graphic node created
by the filtered renderer in an
IlvHalfZoomingGraphic
.
The minimum zoom, maximum zoom, initial zoom and rotatable flag are fetched
from the style sheet using the rendering properties
MinZoom
, MaxZoom
, InitialZoom
,
and Rotatable
.
When the view is zoomed in and the zoom level becomes greater than the maximum zoom, the nodes keep a fixed size.
When the view is zoomed out and the zoom level becomes smaller than the minimum zoom, the nodes are replaced by gray boxes. The gray boxes keep getting smaller as the view is zoomed out.
If the minimum zoom is 0
, the objects are zoomed out normally, as if the
half-zooming renderer was not present. Similarly, if the maximum zoom is 0
,
the objects always get bigger when the view is zoomed in, as if the
half-zooming renderer was not present.
For example, with the following CSS rule, the nodes will no longer grow
as soon as the zoom level becomes larger than 4
, and they are grayed out
when the zoom becomes smaller than 0.25
:
SDM { HalfZooming : "true"; } node { MaxZoom : "4"; MinZoom : "0.25"; }
The zoom thresholds can also be set globally for all the nodes
by setting the minZoom
and maxZoom
directly on the renderer, as follows:
SDM { HalfZooming : "true"; } HalfZooming { maxZoom : "4"; minZoom : "0.25"; }
The half zooming renderer supports node alpha transparency. Use this feature to add transparency to specific nodes without changing the individual foreground, background and stroke colors for the node.
For any node, the alpha transparency value must be between 0 and 1. The following CSS rule specifies that certain nodes must appear transparent with an alpha value of 0.3:
SDM { HalfZooming : "true"; } node.MyType { MaxZoom : "4"; MinZoom : "0.25"; Alpha: "0.3"; }
The following CSS rule sets the default alpha transparency for all nodes:
SDM { HalfZooming : "true"; } HalfZooming { alpha : "0.4"; }
IlvHalfZoomingGraphic
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
IlvHalfZoomingRenderer.HalfZoomingGraphic
This subclass of
IlvHalfZoomingGraphic
is used internally by the IlvHalfZoomingRenderer . |
_renderer
PSEUDOCLASS_PREFIX
Constructor and Description |
---|
IlvHalfZoomingRenderer()
Creates a new half-zooming renderer with a
null
filtered renderer. |
IlvHalfZoomingRenderer(IlvSDMRenderer renderer)
Creates a new half-zooming renderer for a specified
filtered renderer.
|
Modifier and Type | Method and Description |
---|---|
IlvGraphic |
createNodeGraphic(IlvSDMEngine engine,
Object node)
Wraps the graphic node created by the filtered renderer
in an instance of
IlvHalfZoomingGraphic . |
void |
customize(IlvSDMEngine engine,
Object object,
IlvGraphic g,
String[] pseudoClass)
Customizes the graphic object
encapsulated in the half-zooming graphic.
|
float |
getAlpha()
Returns the alpha transparency value for the objects.
|
IlvGraphic |
getEncapsulatedGraphic(IlvGraphic graphic)
Returns the graphic object
encapsulated in the half-zooming graphic.
|
double |
getInitialZoom()
Returns the initial zoom level.
|
IlvRect |
getLinkConnectionRectangle(IlvSDMEngine engine,
IlvGraphic graphic,
IlvTransformer t,
IlvLinkConnector lc)
Computes the rectangle on which the connection points
of the links to/from this node should be located,
taking into account that the
nodes do not always zoom according to the view
transformer.
|
double |
getMaxZoom()
Returns the maximum zoom level above which the objects
stop zooming.
|
double |
getMinZoom()
Returns the minimum zoom level below which the objects
are replaced by gray boxes.
|
Color |
getUnzoomedBackground()
Returns the background color used to fill
the nodes
below the minimum zoom level.
|
Color |
getUnzoomedForeground()
Returns the foreground color used to draw the
outline of the nodes
below the minimum zoom level.
|
boolean |
isGrayedWhenUnzoomed()
Returns the flag specifying whether half-zooming objects are drawn as
gray boxes when the zoom level is less than the minimum zoom,
or if they are drawn at their minimum size.
|
boolean |
isRotatable()
Tests if the objects support rotation.
|
protected void |
moveResizeNodeGraphic(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
IlvRect newBBox,
int anchor)
Move the graphic to its final position
|
void |
propertiesChanged(IlvSDMEngine engine,
Object object,
Collection<String> propertyNames,
IlvGraphic graphic)
Updates the properties of the graphic object
encapsulated in the half-zooming graphic.
|
void |
setAlpha(float alpha)
Changes the alpha transparency value for the objects.
|
void |
setGrayedWhenUnzoomed(boolean grayedWhenUnzoomed)
Specifies whether half-zooming objects are drawn as gray boxes
when the zoom level is less than the minimum zoom, or if
they are drawn at their minimum size.
|
void |
setInitialZoom(double initialZoom)
Changes the initial zoom level.
|
void |
setMaxZoom(double maxZoom)
Changes the maximum zoom level above which the objects
stop zooming.
|
void |
setMinZoom(double minZoom)
Changes the minimum zoom level below which the objects
are replaced by gray boxes.
|
void |
setRotatable(boolean rotatable)
Sets whether the objects support rotation.
|
void |
setUnzoomedBackground(Color unzoomedBackground)
Sets the background color used to fill
the nodes
below the minimum zoom level.
|
void |
setUnzoomedForeground(Color unzoomedForeground)
Sets the foreground color used to draw the
outline of the nodes
below the minimum zoom level.
|
addLinkGraphic, addNodeGraphic, computeBBox, createLinkGraphic, getFilteredRenderer, getGraphicProperty, linkGraphicAdded, nodeGraphicAdded, nodeGraphicBBoxChanged, prepareRendering, processServerAction, removeAll, removeLinkGraphic, removeNodeGraphic, renderingDone, setFilteredRenderer, updateObjectProperties
addViewListeners, callMoveResizeNodeGraphic, convert, convert, getAlias, getAuxiliaryBean, getAuxiliaryBeans, getEngine, getLinkConnectionRectangle, getLocation, getParameter, needsViewListeners, propertyChanged, removeViewListeners, setAlias, setEngine, setLayerName, setParameter
public IlvHalfZoomingRenderer(IlvSDMRenderer renderer)
renderer
- The filtered renderer.public IlvHalfZoomingRenderer()
null
filtered renderer.public double getMinZoom()
public void setMinZoom(double minZoom)
This global minimum zoom level is used as a default
when no MinZoom
property has been set
in the CSS rules for the nodes.
minZoom
- The minimum zoom level.public double getMaxZoom()
public void setMaxZoom(double maxZoom)
This global maximum zoom level is used as a default
when no MaxZoom
property has been set
in the CSS rules for the nodes.
maxZoom
- The maximum zoom level.public double getInitialZoom()
public void setInitialZoom(double initialZoom)
This global initial zoom level is used as a default
when no InitialZoom
property has been set
in the CSS rules for the nodes.
initialZoom
- The initial zoom level.public float getAlpha()
public void setAlpha(float alpha)
This global alpha transparency value is used as a default
when the Alpha
property has not been set
in the CSS rules for the nodes.
alpha
- The new alpha transparency level.public void setRotatable(boolean rotatable)
The rotation setting is not delegated to the wrapped object:
rotatable
- Set to true
to enable rotation. The default value is
true
.isRotatable()
public boolean isRotatable()
The rotation setting is not delegated to the wrapped object:
true
is returned.setRotatable(boolean)
public void setUnzoomedForeground(Color unzoomedForeground)
unzoomedForeground
- The new outline color for the unzoomed boxes.public Color getUnzoomedForeground()
public void setUnzoomedBackground(Color unzoomedBackground)
unzoomedBackground
- The new fill color for the unzoomed boxes.public Color getUnzoomedBackground()
public void setGrayedWhenUnzoomed(boolean grayedWhenUnzoomed)
The default value of true
.
grayedWhenUnzoomed
- If true
, half-zooming objects
are drawn as gray boxes when the zoom level is less than the
minimum zoom, and the gray boxes keep unzooming as the zoom
level decreases. If false
, the objects are always
drawn at their minimum size whenever the zoom level is below
the minimum zoom.public boolean isGrayedWhenUnzoomed()
public IlvGraphic createNodeGraphic(IlvSDMEngine engine, Object node)
IlvHalfZoomingGraphic
.createNodeGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in
which the graphic object will be added.node
- The data node to translate into an IlvGraphic
.public void propertiesChanged(IlvSDMEngine engine, Object object, Collection<String> propertyNames, IlvGraphic graphic)
propertiesChanged
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in
which the graphic object is displayed.object
- The data object whose property has changed.propertyNames
- The names of the properties that have been modified.graphic
- The graphic object associated with object
.public void customize(IlvSDMEngine engine, Object object, IlvGraphic g, String[] pseudoClass)
customize
in class IlvFilterSDMRenderer
engine
- The SDM engine.object
- The data object that the graphic object represents.g
- The graphic object to customize.pseudoClass
- The pseudo-classes of the object. This parameter
can be null
.public IlvRect getLinkConnectionRectangle(IlvSDMEngine engine, IlvGraphic graphic, IlvTransformer t, IlvLinkConnector lc)
getLinkConnectionRectangle
in class IlvFilterSDMRenderer
engine
- The SDM engine.graphic
- The graphic object returned by createNodeGraphic
.t
- The transformer of the view.lc
- The link connector from which this is called.public IlvGraphic getEncapsulatedGraphic(IlvGraphic graphic)
getEncapsulatedGraphic
in class IlvFilterSDMRenderer
graphic
- A graphic object returned by createNodeGraphic
.protected void moveResizeNodeGraphic(IlvSDMEngine engine, Object node, IlvGraphic graphic, IlvRect newBBox, int anchor)
moveResizeNodeGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine.node
- The data node that the graphic object represents.graphic
- The graphic object that to be moved and/or resized.newBBox
- An IlvRectangle
initialized with the "x"
, "y"
,
"width"
and "height"
graphic properties.
If the width or height of the rectangle are non-zero, the graphic object
is moved and resized, otherwise the graphic object is only moved.
The final position must be stored in this parameter.anchor
- see IlvDirection
for the possible values© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.