|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.swtlayeredgraph.GCTransformer
public class GCTransformer
This class provides for applying a coordinate system to a GC object. It provides functions that allow mapping from GC (device) to coordinate system (coordinate) coordinates as well as the reverse. NOTE: All translations are assumed to be given from the coordinate level, not from the device level.
Field Summary | |
---|---|
protected org.eclipse.swt.graphics.Point |
dpi
|
protected SwtGC |
gc
|
protected java.lang.Integer |
height
|
protected CoordinateType |
translateCoordinateType
|
protected java.lang.Integer |
width
|
protected java.lang.Double |
xScaleFactor
|
protected java.lang.Double |
xTranslateFactor
|
protected java.lang.Double |
yScaleFactor
|
protected java.lang.Double |
yTranslateFactor
|
Constructor Summary | |
---|---|
GCTransformer()
Default constructor. |
|
GCTransformer(java.lang.Double xScaleFactor,
java.lang.Double yScaleFactor,
java.lang.Double xTranslateFactor,
java.lang.Double yTranslateFactor,
CoordinateType translationSystem,
java.lang.Integer width,
java.lang.Integer height,
SwtGC gc)
Generates a usable transformer. |
Method Summary | |
---|---|
org.eclipse.swt.graphics.Point |
coordinate2Device(GraphPoint coordinate)
Converts from a GraphPoint to local device coordinate (for GC). |
GraphPoint |
device2Coordinate(java.lang.Integer x,
java.lang.Integer y,
CoordinateType type)
Converts a given XY pair and coordinate type to it's correct graph point. |
GraphPoint |
device2Coordinate(org.eclipse.swt.graphics.Point point,
CoordinateType type)
Converts a given point and coordinate type to it's correct graph point. |
GraphPoint |
getDPI()
Gets the transformed DPI for this canvas. |
SwtGC |
getGC()
Gets the GC object for this transformer. |
java.lang.Integer |
getHeight()
|
CoordinateType |
getTranslateCoordinateType()
Gets the type of unit used for translation. |
java.lang.Integer |
getWidth()
|
java.lang.Integer |
getXIncrement(GraphPoint point)
|
java.lang.Double |
getXScaleFactor()
Gets the scale factor for the X axis. |
java.lang.Double |
getXTranslateFactor()
Gets the translation factor for the X axis. |
java.lang.Integer |
getYIncrement(GraphPoint point)
|
java.lang.Double |
getYScaleFactor()
Gets the scale factor for the Y axis. |
java.lang.Double |
getYTranslateFactor()
Gets the translation factor for the Y axis. |
void |
setGC(SwtGC gc)
Sets the GC object to use as the device. |
void |
setHeight(java.lang.Integer height)
Sets the height of the viewable window in pixels. |
void |
setTranslateCoordinateType(CoordinateType type)
Sets the coordinate system used for translation. |
void |
setWidth(java.lang.Integer width)
Sets the width of the viewable window in pixels. |
void |
setXScaleFactor(java.lang.Double scaleFactor)
Sets the scale factor for the X axis. |
void |
setXTranslateFactor(java.lang.Double translateFactor)
Sets the translation factor for the X axis. |
void |
setYScaleFactor(java.lang.Double scaleFactor)
Sets the scale factor for the Y axis. |
void |
setYTranslateFactor(java.lang.Double translateFactor)
Sets the translation factor for the Y axis. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Double xScaleFactor
protected java.lang.Double yScaleFactor
protected java.lang.Double xTranslateFactor
protected java.lang.Double yTranslateFactor
protected CoordinateType translateCoordinateType
protected SwtGC gc
protected java.lang.Integer width
protected java.lang.Integer height
protected org.eclipse.swt.graphics.Point dpi
Constructor Detail |
---|
public GCTransformer()
public GCTransformer(java.lang.Double xScaleFactor, java.lang.Double yScaleFactor, java.lang.Double xTranslateFactor, java.lang.Double yTranslateFactor, CoordinateType translationSystem, java.lang.Integer width, java.lang.Integer height, SwtGC gc)
xScaleFactor
- Scale factor for the X axis.yScaleFactor
- Scale factor for the Y axis.xTranslateFactor
- Translation factor for the X axis.yTranslateFactor
- Translation factor for the Y axis.translationSystem
- The coordinate system the translation is in.width
- The width of the viewable windowheight
- The height of the viewable window.gc
- The GC proxy object to use as the device system.Method Detail |
---|
public org.eclipse.swt.graphics.Point coordinate2Device(GraphPoint coordinate)
coordinate
- GraphPoint to convert.
public GraphPoint device2Coordinate(java.lang.Integer x, java.lang.Integer y, CoordinateType type)
x
- The X coordinate value.y
- The Y coordinate value.type
- The coordinate type to use.
public GraphPoint device2Coordinate(org.eclipse.swt.graphics.Point point, CoordinateType type)
point
- The point to convert from.type
- The coordinate type to use.
public SwtGC getGC()
public java.lang.Integer getHeight()
public CoordinateType getTranslateCoordinateType()
public java.lang.Integer getWidth()
public java.lang.Integer getXIncrement(GraphPoint point)
public java.lang.Double getXScaleFactor()
public java.lang.Double getXTranslateFactor()
public java.lang.Integer getYIncrement(GraphPoint point)
public java.lang.Double getYScaleFactor()
public java.lang.Double getYTranslateFactor()
public void setGC(SwtGC gc)
gc
- The gc proxy to use for the device. Cannot be null.public void setHeight(java.lang.Integer height)
height
- Number of vertical viewable pixels.public void setTranslateCoordinateType(CoordinateType type)
type
- The type of coordinate system used for translation.public void setWidth(java.lang.Integer width)
width
- Number of horizontal viewable pixels.public void setXScaleFactor(java.lang.Double scaleFactor)
scaleFactor
- the xScaleFactor to setpublic void setXTranslateFactor(java.lang.Double translateFactor)
translateFactor
- the xTranslateFactor to setpublic void setYScaleFactor(java.lang.Double scaleFactor)
scaleFactor
- the yScaleFactor to setpublic void setYTranslateFactor(java.lang.Double translateFactor)
translateFactor
- the yTranslateFactor to setpublic GraphPoint getDPI()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |