Package org.eclipse.gef.fx.utils
Class Shape2Geometry
- java.lang.Object
-
- org.eclipse.gef.fx.utils.Shape2Geometry
-
public class Shape2Geometry extends java.lang.ObjectThe utility classShape2Geometryprovides methods for the conversion of JavaFXShapeimplementations toIGeometryimplementations.
-
-
Constructor Summary
Constructors Constructor Description Shape2Geometry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ArctoArc(javafx.scene.shape.Arc arc)Converts the given JavaFXArcto aArc.static CubicCurvetoCubicCurve(javafx.scene.shape.CubicCurve cubic)Converts the given JavaFXCubicCurveto aCubicCurve.static EllipsetoEllipse(javafx.scene.shape.Circle circle)Converts the given JavaFXCircleto aEllipse.static EllipsetoEllipse(javafx.scene.shape.Ellipse ellipse)Converts the given JavaFXEllipseto aEllipse.static IGeometrytoGeometry(javafx.scene.shape.Shape visual)Returns anIGeometrythat describes the geometric outline of the givenShape, i.e. excluding the stroke.static LinetoLine(javafx.scene.shape.Line line)Converts the given JavaFXLineto aLine.static PathtoPath(javafx.scene.shape.Path path)Converts the given JavaFXPathto aPath.static PolygontoPolygon(javafx.scene.shape.Polygon polygon)Converts the given JavaFXPolygonto aPolygon.static PolylinetoPolyline(javafx.scene.shape.Polyline polyline)Converts the given JavaFXPolylineto aPolyline.static QuadraticCurvetoQuadraticCurve(javafx.scene.shape.QuadCurve quad)Converts the given JavaFXQuadCurveto aQuadraticCurve.static RectangletoRectangle(javafx.scene.shape.Rectangle rect)Converts the given JavaFXRectangleto aRectangle.static RoundedRectangletoRoundedRectangle(javafx.scene.shape.Rectangle rect)Converts the given JavaFXRectangleto aRoundedRectangle.
-
-
-
Method Detail
-
toArc
public static Arc toArc(javafx.scene.shape.Arc arc)
Converts the given JavaFXArcto aArc.- Parameters:
arc- The JavaFXArcto convert.- Returns:
- The newly created
Arcthat describes the givenArc.
-
toCubicCurve
public static CubicCurve toCubicCurve(javafx.scene.shape.CubicCurve cubic)
Converts the given JavaFXCubicCurveto aCubicCurve.- Parameters:
cubic- The JavaFXCubicCurveto convert.- Returns:
- The newly created
CubicCurvethat describes the givenCubicCurve.
-
toEllipse
public static Ellipse toEllipse(javafx.scene.shape.Circle circle)
Converts the given JavaFXCircleto aEllipse.- Parameters:
circle- The JavaFXCircleto convert.- Returns:
- The newly created
Ellipsethat describes the givenCircle.
-
toEllipse
public static Ellipse toEllipse(javafx.scene.shape.Ellipse ellipse)
Converts the given JavaFXEllipseto aEllipse.- Parameters:
ellipse- The JavaFXEllipseto convert.- Returns:
- The newly created
Ellipsethat describes the givenEllipse.
-
toGeometry
public static IGeometry toGeometry(javafx.scene.shape.Shape visual)
Returns anIGeometrythat describes the geometric outline of the givenShape, i.e. excluding the stroke.The conversion is supported for the following
Shapes:ArcCircleCubicCurveEllipseLinePathPolygonPolylineQuadCurveRectangle
Shapes cannot be converted, yet:TextSVGPath
-
toLine
public static Line toLine(javafx.scene.shape.Line line)
Converts the given JavaFXLineto aLine.- Parameters:
line- The JavaFXLineto convert.- Returns:
- The newly created
Linethat describes the givenLine.
-
toPath
public static final Path toPath(javafx.scene.shape.Path path)
Converts the given JavaFXPathto aPath.- Parameters:
path- The JavaFXPathto convert.- Returns:
- The newly created
Paththat describes the givenPath.
-
toPolygon
public static Polygon toPolygon(javafx.scene.shape.Polygon polygon)
Converts the given JavaFXPolygonto aPolygon.- Parameters:
polygon- The JavaFXPolygonto convert.- Returns:
- The newly created
Polygonthat describes the givenPolygon.
-
toPolyline
public static Polyline toPolyline(javafx.scene.shape.Polyline polyline)
Converts the given JavaFXPolylineto aPolyline.- Parameters:
polyline- The JavaFXPolylineto convert.- Returns:
- The newly created
Polylinethat describes the givenPolyline.
-
toQuadraticCurve
public static QuadraticCurve toQuadraticCurve(javafx.scene.shape.QuadCurve quad)
Converts the given JavaFXQuadCurveto aQuadraticCurve.- Parameters:
quad- The JavaFXQuadCurveto convert.- Returns:
- The newly created
QuadraticCurvethat describes the givenQuadCurve.
-
toRectangle
public static Rectangle toRectangle(javafx.scene.shape.Rectangle rect)
Converts the given JavaFXRectangleto aRectangle. Note, that the arc-width and arc-height of the givenRectanglewill not be preserved in the resulting geometry.- Parameters:
rect- The JavaFXRectangleto convert.- Returns:
- The newly created
Rectanglethat describes the givenRectangle(without its arc-width and arc-height).
-
toRoundedRectangle
public static RoundedRectangle toRoundedRectangle(javafx.scene.shape.Rectangle rect)
Converts the given JavaFXRectangleto aRoundedRectangle.- Parameters:
rect- The JavaFXRectangleto convert.- Returns:
- The newly created
RoundedRectanglethat describes the givenRectangle.
-
-