com.tensegrity.composite
Interface CompositeViewGrid

All Superinterfaces:
Attributable, AttributableOnSet, CompositeViewMeasurementObject

public interface CompositeViewGrid
extends CompositeViewMeasurementObject

A CompositeViewGrid builds up a set of lines intersecting at a right angle. The lines divide the view-area of the CompositeView into uniform rectangular sections. Composite objects lying within the view can be adjusted to lie on the intersection points of this grid.

Version:
$Id: CompositeViewGrid.java,v 1.22 2006/05/17 12:17:46 BurkhardWick Exp $
Author:
AndreasEbbert
See Also:
CompositeView, CompositeViewRuler

Field Summary
static java.lang.String CATEGORY_VIEW_GRID_DESC
          Constant holding the name of the ruler AttributeSet.
static java.lang.String DISTANCE_DESC
          Constant holding the name of the raster size Attribute.
static int SNAP_STRENGTH_100
          Constants specifying the different snap-strength values
static java.lang.String SNAP_STRENGTH_100_DESC
          Constants holding names for the various snap strength values
static int SNAP_STRENGTH_25
          Constants specifying the different snap-strength values
static java.lang.String SNAP_STRENGTH_25_DESC
          Constants holding names for the various snap strength values
static int SNAP_STRENGTH_50
          Constants specifying the different snap-strength values
static java.lang.String SNAP_STRENGTH_50_DESC
          Constants holding names for the various snap strength values
static java.lang.String SNAP_STRENGTH_DESC
          Constant holding a name for the snap-strength Attribute.
static java.lang.String SNAP_TO_GRID_DESC
          Constant holding a name for the snap-to-grid Attribute.
static java.lang.String STROKE_MAIN_DESC
          Constant holding a name for the division stroke Attribute.
static java.lang.String STROKE_SUBSECTIONS_DESC
          Constant holding a name for the subsection stroke Attribute.
static java.lang.String STYLE_DESC
          Constant holding the name of the style Attribute.
static int STYLE_LINE
          Constants specifying the different grid-styles
static java.lang.String STYLE_LINE_DESC
          Constants holding names for the various styles
static int STYLE_POINT
          Constants specifying the different grid-styles
static java.lang.String STYLE_POINT_DESC
          Constants holding names for the various styles
static java.lang.String SUBSECTIONS_DESC
          Constant holding the name of the raster size Attribute.
 
Fields inherited from interface com.tensegrity.composite.CompositeViewMeasurementObject
METRIC_UNIT_DESC, VISIBLE_DESC
 
Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
TREE_SUBSET_POSTFIX
 
Method Summary
 void draw(Renderer renderer, Device device)
          Draws the grid using the given renderer and device
 Transform2D getContextTransform()
          Returns the context transformation that is used for drawing instead of the default context transformation of the view.
 double getGridDistance()
          Returns the grid distance by means of the set metric.
 double getPrinterScale()
          Returns the factor used to scale the grid strokes when the device is a printer device.
 int getSnapStrength()
          Returns the currently set snap strength.
 StrokeFormat getStroke()
          REturns the StrokeFormat of the main grid lines.
 int getStyle()
          Returns the visual style of the grid.
 int getSubSections()
          Returns the number of subsections the grid is divided into.
 StrokeFormat getSubSectionStroke()
          Returns the StrokeFormat of the subsection lines.
 AttributeSet getWriteOutAttributes()
          Returns an AttributeSet that is the same as the one returned by AttributableOnSet.getAttributes() excepts for the Attributes holding formats.
 boolean isSnapEnabled()
          Determines whether grid snapping is enabled.
 void setContextTransform(Transform2D trans)
          Sets the context transformation that should be used instead of the default.
 void setGridDistance(double steps)
          Sets the grid distance by means of the set metric.
 void setPrinterScale(double scale)
          Sets a factor to scale the grid strokes when the device is a printer device.
 void setSnapEnabled(boolean b)
          Enables the snapping of object type InteractionRestriction.
 void setSnapStrength(int strength)
          Sets the strength of the snap the grid performs.
 void setSnapStrength(java.lang.String desc)
          Sets the snap strength of the grid.
 void setStroke(StrokeFormat format)
          Sets the StrokeFormat of the main grid lines.
 void setStyle(int style)
          Sets the grid style.
 void setStyle(java.lang.String desc)
          Sets the grid style.
 void setSubSections(int divisions)
          Sets the number of subsections of the grid raster.
 void setSubSectionStroke(StrokeFormat format)
          Sets the StrokeFormat of the subsection lines.
 void snap(int[] coords)
          Snaps the given coordinates to the next fitting point in the grid.
 
Methods inherited from interface com.tensegrity.composite.CompositeViewMeasurementObject
getMetric, getUnit, isVisible, setMetric, setUnit, setVisible
 
Methods inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
addAttributableOnSetListener, areAttributableEventsEnabled, disableAttributableEvents, enableAttributableEvents, getAttributes, getAttributesTree, removeAttributableOnSetListener, setAttributes, setAttributesTree
 
Methods inherited from interface com.tensegrity.generic.attribute.Attributable
getAttribute, getAttributeType, getAttributeValue, setAttribute, setAttributeValue
 

Field Detail

CATEGORY_VIEW_GRID_DESC

public static final java.lang.String CATEGORY_VIEW_GRID_DESC
Constant holding the name of the ruler AttributeSet.

See Also:
Constant Field Values

DISTANCE_DESC

public static final java.lang.String DISTANCE_DESC
Constant holding the name of the raster size Attribute.

See Also:
Constant Field Values

SUBSECTIONS_DESC

public static final java.lang.String SUBSECTIONS_DESC
Constant holding the name of the raster size Attribute.

See Also:
Constant Field Values

STYLE_DESC

public static final java.lang.String STYLE_DESC
Constant holding the name of the style Attribute.

See Also:
Constant Field Values

SNAP_TO_GRID_DESC

public static final java.lang.String SNAP_TO_GRID_DESC
Constant holding a name for the snap-to-grid Attribute.

See Also:
Constant Field Values

SNAP_STRENGTH_DESC

public static final java.lang.String SNAP_STRENGTH_DESC
Constant holding a name for the snap-strength Attribute.

See Also:
Constant Field Values

STROKE_MAIN_DESC

public static final java.lang.String STROKE_MAIN_DESC
Constant holding a name for the division stroke Attribute.

See Also:
Constant Field Values

STROKE_SUBSECTIONS_DESC

public static final java.lang.String STROKE_SUBSECTIONS_DESC
Constant holding a name for the subsection stroke Attribute.

See Also:
Constant Field Values

STYLE_LINE_DESC

public static final java.lang.String STYLE_LINE_DESC
Constants holding names for the various styles

See Also:
Constant Field Values

STYLE_POINT_DESC

public static final java.lang.String STYLE_POINT_DESC
Constants holding names for the various styles

See Also:
Constant Field Values

STYLE_LINE

public static final int STYLE_LINE
Constants specifying the different grid-styles

See Also:
Constant Field Values

STYLE_POINT

public static final int STYLE_POINT
Constants specifying the different grid-styles

See Also:
Constant Field Values

SNAP_STRENGTH_25_DESC

public static final java.lang.String SNAP_STRENGTH_25_DESC
Constants holding names for the various snap strength values

See Also:
Constant Field Values

SNAP_STRENGTH_50_DESC

public static final java.lang.String SNAP_STRENGTH_50_DESC
Constants holding names for the various snap strength values

See Also:
Constant Field Values

SNAP_STRENGTH_100_DESC

public static final java.lang.String SNAP_STRENGTH_100_DESC
Constants holding names for the various snap strength values

See Also:
Constant Field Values

SNAP_STRENGTH_25

public static final int SNAP_STRENGTH_25
Constants specifying the different snap-strength values

See Also:
Constant Field Values

SNAP_STRENGTH_50

public static final int SNAP_STRENGTH_50
Constants specifying the different snap-strength values

See Also:
Constant Field Values

SNAP_STRENGTH_100

public static final int SNAP_STRENGTH_100
Constants specifying the different snap-strength values

See Also:
Constant Field Values
Method Detail

setGridDistance

public void setGridDistance(double steps)
Sets the grid distance by means of the set metric.

Parameters:
steps - the distance of the main grid lines.

getGridDistance

public double getGridDistance()
Returns the grid distance by means of the set metric.

Returns:
the set distance of the main grid lines.

setSubSections

public void setSubSections(int divisions)
Sets the number of subsections of the grid raster.

Parameters:
divisions - the number of sub-sections.

getSubSections

public int getSubSections()
Returns the number of subsections the grid is divided into.

Returns:
the number of subsections the grid is divided into.

setStyle

public void setStyle(int style)
Sets the grid style. Valid values are: as specified in this interface.

Parameters:
style - the style to set.

setStyle

public void setStyle(java.lang.String desc)
Sets the grid style. Valid values are: as specified in this interface.

Parameters:
desc - the description of the style to set.

getStyle

public int getStyle()
Returns the visual style of the grid.

Returns:
the visual style of the grid.
See Also:
setStyle(int)

snap

public void snap(int[] coords)
Snaps the given coordinates to the next fitting point in the grid. The given coordinates are supposed to be given in internal units, but they are snapped under consideration of the set unit (by means of the set CoordinateSystemMetric).

Parameters:
coords - an array holding the coordinate-pairs to snap to the grid.
Throws:
InvalidArgumentException - if the number of given coordinates is not dividable by 2 or the argument is null

setSnapEnabled

public void setSnapEnabled(boolean b)
Enables the snapping of object type InteractionRestriction.

Parameters:
b - true to enable grid snapping.
See Also:
InteractionRestriction

isSnapEnabled

public boolean isSnapEnabled()
Determines whether grid snapping is enabled.

Returns:
true, if snapping is enabled.

setSnapStrength

public void setSnapStrength(int strength)
Sets the strength of the snap the grid performs. It can be seen as the attraction the grid lines have during a drag of a node.

Parameters:
strength - the attraction of the grid lines. Valid values are:

setSnapStrength

public void setSnapStrength(java.lang.String desc)
Sets the snap strength of the grid. It can be seen as the attraction the grid lines have during a drag of a node implementing interface InteractionRestriction.

Parameters:
desc - the description of the attraction of the grid lines. Valid values are: .
See Also:
InteractionRestriction

getSnapStrength

public int getSnapStrength()
Returns the currently set snap strength. The returned value will be one of the following list:

Returns:
the currently set snap strength.

setStroke

public void setStroke(StrokeFormat format)
Sets the StrokeFormat of the main grid lines.

Parameters:
format - the StrokeFormat to set.

getStroke

public StrokeFormat getStroke()
REturns the StrokeFormat of the main grid lines.

Returns:
the StrokeFormat of the main grid lines.

setSubSectionStroke

public void setSubSectionStroke(StrokeFormat format)
Sets the StrokeFormat of the subsection lines.

Parameters:
format - the StrokeFormat to set.

getSubSectionStroke

public StrokeFormat getSubSectionStroke()
Returns the StrokeFormat of the subsection lines.

Returns:
the StrokeFormat of the subsection lines.

getWriteOutAttributes

public AttributeSet getWriteOutAttributes()
Returns an AttributeSet that is the same as the one returned by AttributableOnSet.getAttributes() excepts for the Attributes holding formats. Every format will be returned in an own AttributeSet and is thus ready to be used for graph document write out.

Returns:
an AttributeSet ready for document write out.
See Also:
AttributableOnSet.getAttributes()

draw

public void draw(Renderer renderer,
                 Device device)
Draws the grid using the given renderer and device

Parameters:
renderer - The renderer to use for drawing
device - The device to draw to

setContextTransform

public void setContextTransform(Transform2D trans)
Sets the context transformation that should be used instead of the default. This is used during printing, because the view uses a different context transformation as well in this mode.

Parameters:
trans - The transformation to use or null to use the default

getContextTransform

public Transform2D getContextTransform()
Returns the context transformation that is used for drawing instead of the default context transformation of the view. A value of null means that the default will be used.

Returns:
null, if the default view context transformation is used or the transformation that is used instead.

setPrinterScale

public void setPrinterScale(double scale)
Sets a factor to scale the grid strokes when the device is a printer device.

Parameters:
scale - The scale to set

getPrinterScale

public double getPrinterScale()
Returns the factor used to scale the grid strokes when the device is a printer device.

Returns:
the scale factor for strokes used for printer devices


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.