samples.preview_new_graphdraw.transform
Class SlightMarginTransformer

java.lang.Object
  extended by samples.preview_new_graphdraw.transform.SlightMarginTransformer
All Implemented Interfaces:
LayoutTransformer

public class SlightMarginTransformer
extends Object
implements LayoutTransformer

This resizer ensures that there's a little space at the margins. This is done by percentage rather than by absolute numbers. created March 20, 2004

Author:
danyelf

Constructor Summary
SlightMarginTransformer()
          Creates an instance of a slight margin transformer.
SlightMarginTransformer(double percentage)
          Creates an instance of a slight margin transformer with the given percentage.
 
Method Summary
 void adjustSize(Dimension d)
          Adjusts this transformer to be working in this size a space
 Coordinates invert(Coordinates in)
          This does the *reverse* of the trasformation, for a given point.
 boolean supportsInvert()
          Most functions should support invert.
 EmittedLayout transform(EmittedLayout el)
          Transforms the given layout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlightMarginTransformer

public SlightMarginTransformer()
Creates an instance of a slight margin transformer. By default, starts at 90% of size (= 5% margins on all sides)


SlightMarginTransformer

public SlightMarginTransformer(double percentage)
Creates an instance of a slight margin transformer with the given percentage.

Parameters:
percentage - the value (should be between 0 and 1; 1 means no margin; 0.5 means the graph is half the size of its window).
Method Detail

transform

public EmittedLayout transform(EmittedLayout el)
Description copied from interface: LayoutTransformer
Transforms the given layout. May (but needn't) return the same layout object, albeit somewhat stomped-upon.

Specified by:
transform in interface LayoutTransformer
See Also:
LayoutTransformer.transform(samples.preview_new_graphdraw.EmittedLayout)

adjustSize

public void adjustSize(Dimension d)
Description copied from interface: LayoutTransformer
Adjusts this transformer to be working in this size a space

Specified by:
adjustSize in interface LayoutTransformer
See Also:
LayoutTransformer.adjustSize(java.awt.Dimension)

supportsInvert

public boolean supportsInvert()
Description copied from interface: LayoutTransformer
Most functions should support invert. If your layout transformer can't be inverted, this should return false. Note that having even one layout be un-invertible makes the whole pipeline un-invertble.

Specified by:
supportsInvert in interface LayoutTransformer
Returns:
true if the layout can be inverted.
See Also:
LayoutTransformer.supportsInvert()

invert

public Coordinates invert(Coordinates in)
Description copied from interface: LayoutTransformer
This does the *reverse* of the trasformation, for a given point. This should be quite fast, as it's done in interactive time (e.g. while a user is dragging around a vertex).

Specified by:
invert in interface LayoutTransformer
See Also:
LayoutTransformer.invert(samples.preview_new_graphdraw.Coordinates)