Class Shape2Geometry

java.lang.Object
org.eclipse.gef.fx.utils.Shape2Geometry

public class Shape2Geometry extends Object
The utility class Shape2Geometry provides methods for the conversion of JavaFX Shape implementations to IGeometry implementations.
  • Constructor Details

    • Shape2Geometry

      public Shape2Geometry()
  • Method Details

    • toArc

      public static Arc toArc(javafx.scene.shape.Arc arc)
      Converts the given JavaFX Arc to a Arc.
      Parameters:
      arc - The JavaFX Arc to convert.
      Returns:
      The newly created Arc that describes the given Arc.
    • toCubicCurve

      public static CubicCurve toCubicCurve(javafx.scene.shape.CubicCurve cubic)
      Converts the given JavaFX CubicCurve to a CubicCurve.
      Parameters:
      cubic - The JavaFX CubicCurve to convert.
      Returns:
      The newly created CubicCurve that describes the given CubicCurve.
    • toEllipse

      public static Ellipse toEllipse(javafx.scene.shape.Circle circle)
      Converts the given JavaFX Circle to a Ellipse.
      Parameters:
      circle - The JavaFX Circle to convert.
      Returns:
      The newly created Ellipse that describes the given Circle.
    • toEllipse

      public static Ellipse toEllipse(javafx.scene.shape.Ellipse ellipse)
      Converts the given JavaFX Ellipse to a Ellipse.
      Parameters:
      ellipse - The JavaFX Ellipse to convert.
      Returns:
      The newly created Ellipse that describes the given Ellipse.
    • toGeometry

      public static IGeometry toGeometry(javafx.scene.shape.Shape visual)
      Returns an IGeometry that describes the geometric outline of the given Shape, i.e. excluding the stroke.

      The conversion is supported for the following Shapes:

      • Arc
      • Circle
      • CubicCurve
      • Ellipse
      • Line
      • Path
      • Polygon
      • Polyline
      • QuadCurve
      • Rectangle
      The following Shapes cannot be converted, yet:
      • Text
      • SVGPath
      Parameters:
      visual - The Shape for which an IGeometry is determined.
      Returns:
      The newly created IGeometry that best describes the geometric outline of the given Shape.
      Throws:
      IllegalStateException - if the given Shape is not supported.
    • toLine

      public static Line toLine(javafx.scene.shape.Line line)
      Converts the given JavaFX Line to a Line.
      Parameters:
      line - The JavaFX Line to convert.
      Returns:
      The newly created Line that describes the given Line.
    • toPath

      public static final Path toPath(javafx.scene.shape.Path path)
      Converts the given JavaFX Path to a Path.
      Parameters:
      path - The JavaFX Path to convert.
      Returns:
      The newly created Path that describes the given Path.
    • toPolygon

      public static Polygon toPolygon(javafx.scene.shape.Polygon polygon)
      Converts the given JavaFX Polygon to a Polygon.
      Parameters:
      polygon - The JavaFX Polygon to convert.
      Returns:
      The newly created Polygon that describes the given Polygon.
    • toPolyline

      public static Polyline toPolyline(javafx.scene.shape.Polyline polyline)
      Converts the given JavaFX Polyline to a Polyline.
      Parameters:
      polyline - The JavaFX Polyline to convert.
      Returns:
      The newly created Polyline that describes the given Polyline.
    • toQuadraticCurve

      public static QuadraticCurve toQuadraticCurve(javafx.scene.shape.QuadCurve quad)
      Converts the given JavaFX QuadCurve to a QuadraticCurve.
      Parameters:
      quad - The JavaFX QuadCurve to convert.
      Returns:
      The newly created QuadraticCurve that describes the given QuadCurve.
    • toRectangle

      public static Rectangle toRectangle(javafx.scene.shape.Rectangle rect)
      Converts the given JavaFX Rectangle to a Rectangle. Note, that the arc-width and arc-height of the given Rectangle will not be preserved in the resulting geometry.
      Parameters:
      rect - The JavaFX Rectangle to convert.
      Returns:
      The newly created Rectangle that describes the given Rectangle (without its arc-width and arc-height).
    • toRoundedRectangle

      public static RoundedRectangle toRoundedRectangle(javafx.scene.shape.Rectangle rect)
      Converts the given JavaFX Rectangle to a RoundedRectangle.
      Parameters:
      rect - The JavaFX Rectangle to convert.
      Returns:
      The newly created RoundedRectangle that describes the given Rectangle.