Package org.eclipse.gef.geometry.convert.swt

# Class SWT2Geometry

java.lang.Object
org.eclipse.gef.geometry.convert.swt.SWT2Geometry

public class SWT2Geometry extends Object
Utility class to support conversions between SWT's geometry classes and GEF's geometry API.

## Method Summary

Modifier and Type
Method
Description
`static Object`
`toLine(int... swtPointArray)`
Converts the given integer array to a GEF `Line`.
`static Path`
`toPath(int windingRule, PathData pd)`
Converts the given SWT `PathData` to a GEF `Path` associated with the given windingRule.
`static Point`
`toPoint(Point swtPoint)`
Converts the given `SWT Point` to a GEF `Point`.
`static Polygon`
`toPolygon(int... swtPointArray)`
Converts the given integer array to a GEF `Polygon`.
`static Object`
`toPolyline(int... swtPointArray)`
Converts the given integer array to a GEF `Polyline`.
`static Rectangle`
`toRectangle(Rectangle swtRectangle)`
Converts the given `SWT Rectangle` to a GEF `Rectangle`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### toLine

public static Object toLine(int... swtPointArray)
Converts the given integer array to a GEF `Line`. The integer array has to consist of exactly 4 values which are interpreted as the x and y coordinates of the `Line`'s start `Point` and the x and y coordinates of the `Line`'s end point , respectively.

Parameters:
  `swtPointArray` - an integer array which contains the x0, y0, x1, y1 coordinates
Returns:
  a new `Line` at the specified position

### toPath

public static Path toPath(int windingRule, PathData pd)
Converts the given SWT `PathData` to a GEF `Path` associated with the given windingRule.

Parameters:
  `windingRule` - one of
  - `Path.WIND_NON_ZERO`
  - `Path.WIND_EVEN_ODD`
  `pd` - the `PathData` to convert
Returns:
  a new `Path` representing the given `PathData`

### toPoint

public static Point toPoint(Point swtPoint)
Converts the given `SWT Point` to a GEF `Point`.

Parameters:
  `swtPoint` - the `SWT Point` to convert
Returns:
  a new `Point` at the position of the given `SWT Point`

### toPolygon

public static Polygon toPolygon(int... swtPointArray)
Converts the given integer array to a GEF `Polygon`. The integer array is interpreted to consist of alternating x and y coordinates specifying the `Point`s used to construct the new GEF `Polygon`.

Parameters:
  `swtPointArray` - the integer array that specifies the `Point`s used to construct the new GEF `Polygon`
Returns:
  a new `Polygon` from the given coordinates

### toPolyline

public static Object toPolyline(int... swtPointArray)
Converts the given integer array to a GEF `Polyline`. The integer array is interpreted to consist of alternating x and y coordinates specifying the `Point`s used to construct the new GEF `Polyline`.

Parameters:
  `swtPointArray` - the integer array that specifies the `Point`s used to construct the new GEF `Polyline`
Returns:
  a new `Polyline` from the given coordinates

### toRectangle

public static Rectangle toRectangle(Rectangle swtRectangle)
Converts the given `SWT Rectangle` to a GEF `Rectangle`.

Parameters:
  `swtRectangle` - the `SWT Rectangle` to convert
Returns:
  a new `Rectangle` at the position of the given `SWT Rectangle`