Dear users, Please note that, from Monday, August 16, 2019, RSA keys shorter than 2048bit will no longer be accepted for security reasons. Please update your keys as needed before this date. If you need assistance with regard to this process, please contact sia@list.lu

Thank you for your understanding.

Commit ee493ab8 authored by Nico Mack's avatar Nico Mack

Added ellipse shape to ShapeFactory

Fixed minor bug in style lookup for Font nodes
parent cf5898cb
......@@ -1009,7 +1009,7 @@ public class BootstrappingUtils {
if (!AVAILABLE_FONTS.contains(fontName)) {
logAndThrowBuildException(new BuildException(StringUtils.build("Specified font {} is unknown!", fontName)), rootElement, childName); //$NON-NLS-1$
}
if (!FONT_STYLES.containsKey(fontStyle)) {
if (!FONT_STYLES.containsKey(fontStyle.toLowerCase())) {
logAndThrowBuildException(new BuildException(StringUtils.build("Specified font style {} does match accepted values. Accepted values are {}!", fontStyle, FONT_STYLES.keySet())), rootElement, childName); //$NON-NLS-1$
}
......
......@@ -48,8 +48,8 @@ import java.awt.geom.AffineTransform;
public class ShapeBootstrapper {
/**
* Method used to build a {@link Shape} instance given an archetype. The method will delegate
* the construction of the shape to the given public static non-arg build method found in the
* Method used to build a {@link Shape} instance given an archetype. The method will delegate the
* construction of the shape to the given public static non-arg build method found in the
* {@link ShapeFactory}.
*
* @param shapeNode
......@@ -110,6 +110,10 @@ public class ShapeBootstrapper {
dimensions.setLocation(circleSize, circleSize);
dimensions.toCoordinates(ScreenCoordinates.class);
return ShapeFactory.buildCircle((int) dimensions.getX());
case "ellipse": //$NON-NLS-1$
dimensions.setLocation(width, height);
dimensions.toCoordinates(ScreenCoordinates.class);
return ShapeFactory.buildEllipse((int) dimensions.getX(), (int) dimensions.getY());
case "square": //$NON-NLS-1$
dimensions.setLocation(squareSize, squareSize);
dimensions.toCoordinates(ScreenCoordinates.class);
......
......@@ -55,13 +55,35 @@ public class ShapeFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(ShapeFactory.class.getSimpleName());
/**
* Method for building a circle.
*
* @param circleSize
* The diameter of the circle to build.
* @return An instance of {@link java.awt.geom.Ellipse2D.Float}.
*/
public static Ellipse2D.Float buildCircle(float circleSize) {
return new Ellipse2D.Float(-circleSize / 2f, -circleSize / 2f, circleSize, circleSize);
}
/**
* Method for building a circle and setting it for the shape field. The size will de defaulted
* to the calibration's default size.
* Method for building a ellipse.
*
* @param horizontalSize
* The width of the ellipse to build.
* @param verticalSize
* The height of the ellipse to build.
* @return An instance of {@link java.awt.geom.Ellipse2D.Float}.
*/
public static Ellipse2D.Float buildEllipse(float horizontalSize, float verticalSize) {
return new Ellipse2D.Float(-horizontalSize / 2f, -verticalSize / 2f, horizontalSize, verticalSize);
}
/**
* Method for building a circle and setting it for the shape field. The size will de defaulted to
* the calibration's default size.
*
* @return An instance of {@link java.awt.geom.Ellipse2D.Float}.
*/
......@@ -212,15 +234,15 @@ public class ShapeFactory {
}
/**
* Method for building an arc taking a ratio for the base bounding rectangle from the default
* square size given by the calibration and with a standard round form. The arc type can be
* specified to either give only an arc or build, for example, a pie.
* Method for building an arc taking a ratio for the base bounding rectangle from the default square
* size given by the calibration and with a standard round form. The arc type can be specified to
* either give only an arc or build, for example, a pie.
*
* @param radius
* The ratio of the bounding rectangle to draw the arc in.
* @param arcStart
* The angle at which the arc will commence. <b>Note</b>: The 0 angle is horizontal. See
* here http://kodejava.org/how-do-i-draw-an-arc-in-java-2d/.
* The angle at which the arc will commence. <b>Note</b>: The 0 angle is horizontal. See here
* http://kodejava.org/how-do-i-draw-an-arc-in-java-2d/.
* @param arcLength
* The length of the arc as given by degrees.
* @param arcType
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment