Package org.eclipse.gef.fx.utils
Class Shape2Geometry
java.lang.Object
org.eclipse.gef.fx.utils.Shape2Geometry
The utility class
Shape2Geometry
provides methods for the conversion
of JavaFX Shape
implementations to IGeometry
implementations.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 final 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
.
-
Constructor Details
-
Shape2Geometry
public Shape2Geometry()
-
-
Method Details
-
toArc
Converts the given JavaFXArc
to aArc
.- Parameters:
arc
- The JavaFXArc
to convert.- Returns:
- The newly created
Arc
that describes the givenArc
.
-
toCubicCurve
Converts the given JavaFXCubicCurve
to aCubicCurve
.- Parameters:
cubic
- The JavaFXCubicCurve
to convert.- Returns:
- The newly created
CubicCurve
that describes the givenCubicCurve
.
-
toEllipse
Converts the given JavaFXCircle
to aEllipse
.- Parameters:
circle
- The JavaFXCircle
to convert.- Returns:
- The newly created
Ellipse
that describes the givenCircle
.
-
toEllipse
Converts the given JavaFXEllipse
to aEllipse
.- Parameters:
ellipse
- The JavaFXEllipse
to convert.- Returns:
- The newly created
Ellipse
that describes the givenEllipse
.
-
toGeometry
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
- Parameters:
visual
- TheShape
for which anIGeometry
is determined.- Returns:
- The newly created
IGeometry
that best describes the geometric outline of the givenShape
. - Throws:
IllegalStateException
- if the givenShape
is not supported.
-
toLine
Converts the given JavaFXLine
to aLine
.- Parameters:
line
- The JavaFXLine
to convert.- Returns:
- The newly created
Line
that describes the givenLine
.
-
toPath
Converts the given JavaFXPath
to aPath
.- Parameters:
path
- The JavaFXPath
to convert.- Returns:
- The newly created
Path
that describes the givenPath
.
-
toPolygon
Converts the given JavaFXPolygon
to aPolygon
.- Parameters:
polygon
- The JavaFXPolygon
to convert.- Returns:
- The newly created
Polygon
that describes the givenPolygon
.
-
toPolyline
Converts the given JavaFXPolyline
to aPolyline
.- Parameters:
polyline
- The JavaFXPolyline
to convert.- Returns:
- The newly created
Polyline
that describes the givenPolyline
.
-
toQuadraticCurve
Converts the given JavaFXQuadCurve
to aQuadraticCurve
.- Parameters:
quad
- The JavaFXQuadCurve
to convert.- Returns:
- The newly created
QuadraticCurve
that describes the givenQuadCurve
.
-
toRectangle
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
Converts the given JavaFXRectangle
to aRoundedRectangle
.- Parameters:
rect
- The JavaFXRectangle
to convert.- Returns:
- The newly created
RoundedRectangle
that describes the givenRectangle
.
-