Package org.eclipse.gef.fx.utils
Class Shape2Geometry
- java.lang.Object
-
- org.eclipse.gef.fx.utils.Shape2Geometry
-
public class Shape2Geometry extends java.lang.Object
The utility classShape2Geometry
provides methods for the conversion of JavaFXShape
implementations toIGeometry
implementations.
-
-
Constructor Summary
Constructors Constructor Description Shape2Geometry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Arc
toArc(javafx.scene.shape.Arc arc)
Converts the given JavaFXArc
to aArc
.static CubicCurve
toCubicCurve(javafx.scene.shape.CubicCurve cubic)
Converts the given JavaFXCubicCurve
to aCubicCurve
.static Ellipse
toEllipse(javafx.scene.shape.Circle circle)
Converts the given JavaFXCircle
to aEllipse
.static Ellipse
toEllipse(javafx.scene.shape.Ellipse ellipse)
Converts the given JavaFXEllipse
to aEllipse
.static IGeometry
toGeometry(javafx.scene.shape.Shape visual)
Returns anIGeometry
that describes the geometric outline of the givenShape
, i.e. excluding the stroke.static Line
toLine(javafx.scene.shape.Line line)
Converts the given JavaFXLine
to aLine
.static Path
toPath(javafx.scene.shape.Path path)
Converts the given JavaFXPath
to aPath
.static Polygon
toPolygon(javafx.scene.shape.Polygon polygon)
Converts the given JavaFXPolygon
to aPolygon
.static Polyline
toPolyline(javafx.scene.shape.Polyline polyline)
Converts the given JavaFXPolyline
to aPolyline
.static QuadraticCurve
toQuadraticCurve(javafx.scene.shape.QuadCurve quad)
Converts the given JavaFXQuadCurve
to aQuadraticCurve
.static Rectangle
toRectangle(javafx.scene.shape.Rectangle rect)
Converts the given JavaFXRectangle
to aRectangle
.static RoundedRectangle
toRoundedRectangle(javafx.scene.shape.Rectangle rect)
Converts the given JavaFXRectangle
to aRoundedRectangle
.
-
-
-
Method Detail
-
toArc
public static Arc toArc(javafx.scene.shape.Arc arc)
Converts the given JavaFXArc
to aArc
.- Parameters:
arc
- The JavaFXArc
to convert.- Returns:
- The newly created
Arc
that describes the givenArc
.
-
toCubicCurve
public static CubicCurve toCubicCurve(javafx.scene.shape.CubicCurve cubic)
Converts the given JavaFXCubicCurve
to aCubicCurve
.- Parameters:
cubic
- The JavaFXCubicCurve
to convert.- Returns:
- The newly created
CubicCurve
that describes the givenCubicCurve
.
-
toEllipse
public static Ellipse toEllipse(javafx.scene.shape.Circle circle)
Converts the given JavaFXCircle
to aEllipse
.- Parameters:
circle
- The JavaFXCircle
to convert.- Returns:
- The newly created
Ellipse
that describes the givenCircle
.
-
toEllipse
public static Ellipse toEllipse(javafx.scene.shape.Ellipse ellipse)
Converts the given JavaFXEllipse
to aEllipse
.- Parameters:
ellipse
- The JavaFXEllipse
to convert.- Returns:
- The newly created
Ellipse
that describes the givenEllipse
.
-
toGeometry
public static IGeometry toGeometry(javafx.scene.shape.Shape visual)
Returns anIGeometry
that describes the geometric outline of the givenShape
, i.e. excluding the stroke.The conversion is supported for the following
Shape
s:Arc
Circle
CubicCurve
Ellipse
Line
Path
Polygon
Polyline
QuadCurve
Rectangle
Shape
s cannot be converted, yet:Text
SVGPath
-
toLine
public static Line toLine(javafx.scene.shape.Line line)
Converts the given JavaFXLine
to aLine
.- Parameters:
line
- The JavaFXLine
to convert.- Returns:
- The newly created
Line
that describes the givenLine
.
-
toPath
public static final Path toPath(javafx.scene.shape.Path path)
Converts the given JavaFXPath
to aPath
.- Parameters:
path
- The JavaFXPath
to convert.- Returns:
- The newly created
Path
that describes the givenPath
.
-
toPolygon
public static Polygon toPolygon(javafx.scene.shape.Polygon polygon)
Converts the given JavaFXPolygon
to aPolygon
.- Parameters:
polygon
- The JavaFXPolygon
to convert.- Returns:
- The newly created
Polygon
that describes the givenPolygon
.
-
toPolyline
public static Polyline toPolyline(javafx.scene.shape.Polyline polyline)
Converts the given JavaFXPolyline
to aPolyline
.- Parameters:
polyline
- The JavaFXPolyline
to convert.- Returns:
- The newly created
Polyline
that describes the givenPolyline
.
-
toQuadraticCurve
public static QuadraticCurve toQuadraticCurve(javafx.scene.shape.QuadCurve quad)
Converts the given JavaFXQuadCurve
to aQuadraticCurve
.- Parameters:
quad
- The JavaFXQuadCurve
to convert.- Returns:
- The newly created
QuadraticCurve
that describes the givenQuadCurve
.
-
toRectangle
public static Rectangle toRectangle(javafx.scene.shape.Rectangle rect)
Converts the given JavaFXRectangle
to aRectangle
. Note, that the arc-width and arc-height of the givenRectangle
will not be preserved in the resulting geometry.- Parameters:
rect
- The JavaFXRectangle
to convert.- Returns:
- The newly created
Rectangle
that describes the givenRectangle
(without its arc-width and arc-height).
-
toRoundedRectangle
public static RoundedRectangle toRoundedRectangle(javafx.scene.shape.Rectangle rect)
Converts the given JavaFXRectangle
to aRoundedRectangle
.- Parameters:
rect
- The JavaFXRectangle
to convert.- Returns:
- The newly created
RoundedRectangle
that describes the givenRectangle
.
-
-