Commit 7be513a7 authored by Nico Mack's avatar Nico Mack

Added flipTitleByQuadrant property to Sector Corona

parent 45a4e1cb
......@@ -67,6 +67,7 @@ FADING_ENABLED_NODE=fadingEnabled
FILL_COLOUR_ELEMENT=fillColour
FILL_COLOUR_NODE=fillColour
FILL_COLOUR_NUANCE_NODE=fillColourNuance
FLIP_TITLE_BY_QUADRANT_NODE=flipTitleByQuadrant
FONT_NODE=font
FONT_SIZE_NODE=fontSize
FULLSCREEN_NODE=fullScreen
......
......@@ -102,6 +102,7 @@ public class Externalization extends NLS {
public static String FILL_COLOUR_ELEMENT;
public static String FILL_COLOUR_NODE;
public static String FILL_COLOUR_NUANCE_NODE;
public static String FLIP_TITLE_BY_QUADRANT_NODE;
public static String FONT_NODE;
public static String FONT_SIZE_NODE;
public static String FULLSCREEN_NODE;
......
......@@ -55,6 +55,7 @@ public class Sector extends SelectableCorona {
protected Font textFont;
protected boolean centered;
protected boolean radialLayout;
protected boolean flipTitleByQuadrant;
protected TouchManager touchManager;
protected FontRenderContext renderingContext = new FontRenderContext(null, true, true);
......@@ -90,6 +91,7 @@ public class Sector extends SelectableCorona {
arcSpan = builder.arcSpan;
centered = builder.centered;
radialLayout = builder.radialLayout;
flipTitleByQuadrant = builder.flipTitleByQuadrant;
this.buildSectorFromProperties();
......@@ -122,6 +124,7 @@ public class Sector extends SelectableCorona {
arcSpan = original.arcSpan;
centered = original.centered;
radialLayout = original.radialLayout;
flipTitleByQuadrant = original.flipTitleByQuadrant;
this.buildSectorFromProperties();
......@@ -190,7 +193,7 @@ public class Sector extends SelectableCorona {
Shape labelPath;
if (!radialLayout) {
flipped = (quadrant == 2) || (quadrant == 3);
flipped = flipTitleByQuadrant && ((quadrant == 2) || (quadrant == 3));
double labelRadius = outerRadius - metrics.getAscent() / 2;
double start = (!flipped) ? angle - span : angle;
int length = (!flipped) ? span : -span;
......@@ -203,7 +206,7 @@ public class Sector extends SelectableCorona {
labelPath = new Arc2D.Double(bounds, start, length, Arc2D.OPEN);
} else {
angle = AngleUtils.moduloThreeSixty(startAngle + ((double) span / 2));
flipped = (quadrant == 1) || (quadrant == 2);
flipped = flipTitleByQuadrant && ((quadrant == 1) || (quadrant == 2));
double lineHeight = metrics.getAscent() / 2;
......
......@@ -71,6 +71,7 @@ public abstract class BaseSectorBuilder<B extends BaseSectorBuilder<B>> extends
/** */
public boolean centered;
public boolean radialLayout;
public boolean flipTitleByQuadrant;
// ***************************************************************************
// * Constants *
......@@ -144,7 +145,7 @@ public abstract class BaseSectorBuilder<B extends BaseSectorBuilder<B>> extends
Integer fontSize = BootstrappingUtils.getContentAsInteger(rootElement, Externalization.FONT_SIZE_NODE, BootstrappingUtils.OPTIONAL, 14, context);
centered = BootstrappingUtils.getContentAsBoolean(rootElement, Externalization.CENTRED_NODE, BootstrappingUtils.OPTIONAL, Boolean.TRUE, context);
radialLayout = BootstrappingUtils.getContentAsBoolean(rootElement, Externalization.RADIAL_LAYOUT_NODE, BootstrappingUtils.OPTIONAL, Boolean.FALSE, context);
flipTitleByQuadrant = BootstrappingUtils.getContentAsBoolean(rootElement, Externalization.FLIP_TITLE_BY_QUADRANT_NODE, BootstrappingUtils.OPTIONAL, Boolean.TRUE, context);
if ((fontName != null) && (fontName.length() > 0)) {
textFont = new Font(fontName, Font.BOLD, fontSize);
......
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