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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 final 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.
-
Constructor Details
-
Shape2Geometry
public Shape2Geometry()
-
-
Method Details
-
toArc
Converts the given JavaFXArcto aArc.- Parameters:
arc- The JavaFXArcto convert.- Returns:
- The newly created
Arcthat describes the givenArc.
-
toCubicCurve
Converts the given JavaFXCubicCurveto aCubicCurve.- Parameters:
cubic- The JavaFXCubicCurveto convert.- Returns:
- The newly created
CubicCurvethat describes the givenCubicCurve.
-
toEllipse
Converts the given JavaFXCircleto aEllipse.- Parameters:
circle- The JavaFXCircleto convert.- Returns:
- The newly created
Ellipsethat describes the givenCircle.
-
toEllipse
Converts the given JavaFXEllipseto aEllipse.- Parameters:
ellipse- The JavaFXEllipseto convert.- Returns:
- The newly created
Ellipsethat describes the givenEllipse.
-
toGeometry
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
- Parameters:
visual- TheShapefor which anIGeometryis determined.- Returns:
- The newly created
IGeometrythat best describes the geometric outline of the givenShape. - Throws:
IllegalStateException- if the givenShapeis not supported.
-
toLine
Converts the given JavaFXLineto aLine.- Parameters:
line- The JavaFXLineto convert.- Returns:
- The newly created
Linethat describes the givenLine.
-
toPath
Converts the given JavaFXPathto aPath.- Parameters:
path- The JavaFXPathto convert.- Returns:
- The newly created
Paththat describes the givenPath.
-
toPolygon
Converts the given JavaFXPolygonto aPolygon.- Parameters:
polygon- The JavaFXPolygonto convert.- Returns:
- The newly created
Polygonthat describes the givenPolygon.
-
toPolyline
Converts the given JavaFXPolylineto aPolyline.- Parameters:
polyline- The JavaFXPolylineto convert.- Returns:
- The newly created
Polylinethat describes the givenPolyline.
-
toQuadraticCurve
Converts the given JavaFXQuadCurveto aQuadraticCurve.- Parameters:
quad- The JavaFXQuadCurveto convert.- Returns:
- The newly created
QuadraticCurvethat describes the givenQuadCurve.
-
toRectangle
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
Converts the given JavaFXRectangleto aRoundedRectangle.- Parameters:
rect- The JavaFXRectangleto convert.- Returns:
- The newly created
RoundedRectanglethat describes the givenRectangle.
-