Java Examples for javafx.scene.shape.ArcType
The following java examples will help you to understand the usage of javafx.scene.shape.ArcType. These source code samples are taken from different open source projects.
Example 1
| Project: cirqwizard-master File: CircularShape.java View source code |
@Override
public void render(GraphicsContext g) {
g.setLineCap(getAperture() instanceof CircularAperture ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
g.setLineWidth(getAperture().getWidth());
g.strokeArc(getArc().getCenter().getX() - getArc().getRadius(), getArc().getCenter().getY() - getArc().getRadius(), getArc().getRadius() * 2, getArc().getRadius() * 2, -Math.toDegrees(getArc().getStart()), Math.toDegrees(getArc().getAngle()) * (getArc().isClockwise() ? 1 : -1), ArcType.OPEN);
}Example 2
| Project: FxProjects-master File: RadialMenu.java View source code |
private Group generateMenus() {
Group menuGroup = new Group();
int menuLength = 360 / menuCount.get() - menuGap;
for (int i = 0; i < menuCount.get(); i++) {
Arc outerArc = ArcBuilder.create().centerX(centerX).centerY(centerY).radiusX(menuOuterRadius.get()).radiusY(menuOuterRadius.get()).type(ArcType.ROUND).startAngle(startAngle).length(menuLength).transforms(RotateBuilder.create().pivotX(centerX).pivotY(centerY).pivotZ(0).angle(i * (menuLength + menuGap)).axis(Rotate.Z_AXIS).build()).build();
Arc innerArc = ArcBuilder.create().centerX(centerX).centerY(centerY).radiusX(menuInnerRadius.get()).radiusY(menuInnerRadius.get()).type(ArcType.ROUND).startAngle(startAngle).length(menuLength).transforms(RotateBuilder.create().pivotX(centerX).pivotY(centerY).pivotZ(0).angle(i * (menuLength + menuGap)).axis(Rotate.Z_AXIS).build()).build();
final Shape menuItem = Shape.subtract(outerArc, innerArc);
menuItem.setFill(Color.SEAGREEN);
menuItem.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
menuItem.setFill(Color.ALICEBLUE);
menuItem.setCursor(Cursor.MOVE);
}
});
menuItem.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
menuItem.setFill(Color.SEAGREEN);
menuItem.setCursor(Cursor.DEFAULT);
}
});
menuGroup.getChildren().addAll(menuItem);
}
final Circle center = new Circle(centerX, centerY, menuInnerRadius.get() - 10);
center.setFill(Color.SEAGREEN);
center.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
center.setFill(Color.ALICEBLUE);
center.setCursor(Cursor.MOVE);
}
});
center.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
center.setFill(Color.SEAGREEN);
center.setCursor(Cursor.DEFAULT);
}
});
menuGroup.getChildren().addAll(center);
return menuGroup;
}Example 3
| Project: gef-master File: ButtonFXControlAdapterSnippet.java View source code |
@Override
public Scene createScene() {
HBox hbox = new HBox();
VBox col1 = new VBox();
VBox col2 = new VBox();
HBox.setMargin(col1, new Insets(10.0));
HBox.setMargin(col2, new Insets(10.0));
hbox.getChildren().addAll(col1, col2);
HBox.setHgrow(col1, Priority.ALWAYS);
HBox.setHgrow(col2, Priority.ALWAYS);
col1.getChildren().addAll(new Button("JavaFX Button 1"), shape(new Arc(0, 0, 50, 50, 15, 120) {
{
setType(ArcType.ROUND);
}
}, 0.52, 0.49, 0.15), createButtonAdapter("SWT Button 1"));
col2.getChildren().addAll(shape(new Rectangle(0, 0, 100, 50), 0.49, 0.36, 0.20), createButtonAdapter("SWT Button 2"), shape(new Rectangle(0, 0, 100, 100) {
{
setArcHeight(20);
setArcWidth(20);
}
}, 0.87, 0.83, 0.49), new Button("JavaFX Button 2"));
return new Scene(hbox, 400, 300);
}Example 4
| Project: aima-master File: VacuumEnvironmentViewCtrl.java View source code |
protected Node createAgentRep(boolean suck) {
Arc arc = new Arc();
arc.setRadiusX(0.3 * envStateView.getWidth() / locations.size());
arc.setRadiusY(0.3 * envStateView.getWidth() / locations.size());
arc.setStartAngle(45.0f);
arc.setLength(suck ? 360.0f : 270.0f);
arc.setType(ArcType.ROUND);
arc.setFill(Color.RED);
return arc;
}Example 5
| Project: MinimaxSimulator-master File: MultiplexerSprite.java View source code |
@Override
public void paint(GraphicsContext gc) {
Bounds b = mux.getBounds();
debugBounds(gc, b);
FontMetrics fm = Toolkit.getToolkit().getFontLoader().getFontMetrics(gc.getFont());
double textHeight = fm.getAscent() - 3;
// upper / lower arc
gc.strokeArc(b.x + 0.5, b.y + 0.5, b.w, b.w, 0, 180, ArcType.OPEN);
gc.strokeArc(b.x + 0.5, b.y + b.h - b.w + 0.5, b.w, b.w, 180, 180, ArcType.OPEN);
// left / right line
gc.strokeLine(b.x + 0.5, b.y + b.w / 2 + 0.5, b.x + 0.5, b.y + b.h - b.w / 2 + 0.5);
gc.strokeLine(b.x + b.w + 0.5, b.y + b.w / 2 + 0.5, b.x + b.w + 0.5, b.y + b.h - b.w / 2 + 0.5);
// pin addresses
int labelX = b.x + b.w / 2;
int labelY = 0;
List<IngoingPin> pins = mux.getDataInputs();
if (!pins.isEmpty()) {
int addr = 0;
for (Pin pin : pins) {
String nrStr = intToStr(addr);
double textWidth = fm.computeStringWidth(nrStr);
labelY = pin.getY();
gc.fillText(nrStr, labelX - textWidth / 2, labelY + textHeight / 2);
addr++;
}
}
for (Pin pin : pins) {
debugPin(gc, pin);
}
debugPin(gc, mux.getDataOut());
debugPin(gc, mux.getSelectPin());
}Example 6
| Project: XR3Player-master File: DJDisc.java View source code |
/**
* Repaints the disc.
*/
public void repaint() {
//Calculate here to use less cpu
double prefWidth = getPrefWidth();
double prefHeight = getPrefHeight();
canvas.gc.setLineCap(StrokeLineCap.ROUND);
//Clear the outer rectangle
canvas.gc.clearRect(0, 0, prefWidth, prefHeight);
canvas.gc.setFill(Color.WHITE);
canvas.gc.fillRect(0, 0, prefWidth, prefHeight);
// Arc Background Oval
canvas.gc.setLineWidth(7);
canvas.gc.setStroke(Color.WHITE);
canvas.gc.strokeArc(5, 5, prefWidth - 10, prefHeight - 10, 90, 360.00 + angle, ArcType.OPEN);
// Foreground Arc
canvas.gc.setStroke(arcColor);
canvas.gc.strokeArc(5, 5, prefWidth - 10, prefHeight - 10, 90, angle, ArcType.OPEN);
// Volume Arc
canvas.gc.setLineCap(StrokeLineCap.SQUARE);
canvas.gc.setLineDashes(6);
canvas.gc.setLineWidth(3);
canvas.gc.setStroke(Color.FIREBRICK);
int value = this.getVolume() == 0 ? 0 : (int) (((double) this.getVolume() / (double) this.maximumVolume) * 180);
//System.out.println(value)
canvas.gc.setFill(Color.BLACK);
canvas.gc.fillArc(11, 11, prefWidth - 22, prefHeight - 22, 90, 360, ArcType.OPEN);
canvas.gc.strokeArc(13, 13, prefWidth - 26, prefHeight - 26, -90, -value, ArcType.OPEN);
canvas.gc.strokeArc(13, 13, prefWidth - 26, prefHeight - 26, -90, +value, ArcType.OPEN);
canvas.gc.setLineDashes(0);
canvas.gc.setLineCap(StrokeLineCap.ROUND);
// --------------------------Maths to find the point on the circle
// circumference
// draw the progress oval
// here i add + 89 to the angle cause the Java has where i have 0
// degrees the 90 degrees.
// I am counting the 0 degrees from the top center of the circle and
// Java calculates them from the right mid of the circle and it is
// going left , i calculate them clock wise
int angle2 = this.angle + 89;
int minus = 8;
// Find the point on the circle circumference
circlePointX = Math.round(((int) (prefWidth - minus)) / 2 + Math.cos(Math.toRadians(-angle2)) * ((int) (prefWidth - minus) / 2));
circlePointY = Math.round(((int) (prefHeight - minus)) / 2 + Math.sin(Math.toRadians(-angle2)) * ((int) (prefHeight - minus) / 2));
// System.out.println("Width:" + canvas.getWidth() + " , Height:" + canvas.getHeight() + " , Angle: " + this.angle)
// System.out.println(circlePointX + "," + circlePointY)
int ovalWidth = 7;
int ovalHeight = 7;
// fix the circle position
if (-angle >= 0 && -angle <= 90) {
circlePointX = circlePointX - ovalWidth / 2 + 2;
circlePointY = circlePointY + 1;
} else if (-angle > 90 && -angle <= 180) {
circlePointX = circlePointX - ovalWidth / 2 + 3;
circlePointY = circlePointY - ovalWidth / 2 + 2;
} else if (-angle > 180 && -angle <= 270) {
circlePointX = circlePointX + 2;
circlePointY = circlePointY - ovalWidth / 2 + 2;
} else if (-angle > 270) {
circlePointX = circlePointX + 2;
// previousY = previousY - 7
}
canvas.gc.setLineWidth(5);
canvas.gc.setStroke(Color.BLACK);
canvas.gc.strokeOval(circlePointX, circlePointY, ovalWidth, ovalHeight);
canvas.gc.setFill(Color.MEDIUMVIOLETRED);
canvas.gc.fillOval(circlePointX, circlePointY, ovalWidth, ovalHeight);
// System.out.println("Angle is:" + ( -this.angle ))
// System.out.println("FormatedX is: " + previousX + ", FormatedY is: "
// + previousY)
// System.out.println("Relative Mouse X: " + m.getX() + " , Relative
// Mouse Y: " + m.getY())
// Draw the drag able rectangle
// gc.setFill(Color.WHITE)
// gc.fillOval(getWidth() / 2, 0, 20, 20)
// ----------------------------------------------------------------------------------------------
// Refresh the timeField
timeField.setText(time);
}Example 7
| Project: teamearth-master File: GameWorldInitializer.java View source code |
private void initItems() {
Arc arc = new Arc();
arc.setRadiusX(5.0f);
arc.setRadiusY(5.0f);
arc.setStartAngle(45.0f);
arc.setLength(270.0f);
arc.setVisible(false);
arc.setId("Cup");
arc.setType(ArcType.ROUND);
List<Node> itemsList = new ArrayList<Node>();
itemsList.add(arc);
List<GameObject> objectsList = new ArrayList<GameObject>();
GameObject item = new Cup();
item.setNode(arc);
item.setPosition(new Point2D(200, 200));
objectsList.add(item);
getGameObjectManager().addObjects(objectsList);
root.getChildren().addAll(itemsList);
}Example 8
| Project: medusa-master File: QuarterSkin.java View source code |
private void drawTickMarks() {
tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
double sinValue;
double cosValue;
double scaledSize = size * 1.95;
int tickLabelDecimals = gauge.getTickLabelDecimals();
String tickLabelFormatString = "%." + tickLabelDecimals + "f";
double minorTickSpace = gauge.getMinorTickSpace();
double tmpAngleStep = angleStep * minorTickSpace;
TickLabelOrientation tickLabelOrientation = gauge.getTickLabelOrientation();
TickLabelLocation tickLabelLocation = gauge.getTickLabelLocation();
BigDecimal minorTickSpaceBD = BigDecimal.valueOf(minorTickSpace);
BigDecimal majorTickSpaceBD = BigDecimal.valueOf(gauge.getMajorTickSpace());
BigDecimal mediumCheck2 = BigDecimal.valueOf(2 * minorTickSpace);
BigDecimal mediumCheck5 = BigDecimal.valueOf(5 * minorTickSpace);
BigDecimal counterBD = BigDecimal.valueOf(minValue);
double counter = minValue;
List<Section> tickMarkSections = gauge.getTickMarkSections();
List<Section> tickLabelSections = gauge.getTickLabelSections();
Color tickMarkColor = gauge.getTickMarkColor();
Color majorTickMarkColor = gauge.getMajorTickMarkColor().equals(tickMarkColor) ? tickMarkColor : gauge.getMajorTickMarkColor();
Color mediumTickMarkColor = gauge.getMediumTickMarkColor().equals(tickMarkColor) ? tickMarkColor : gauge.getMediumTickMarkColor();
Color minorTickMarkColor = gauge.getMinorTickMarkColor().equals(tickMarkColor) ? tickMarkColor : gauge.getMinorTickMarkColor();
Color tickLabelColor = gauge.getTickLabelColor();
Color zeroColor = gauge.getZeroColor();
boolean isNotZero = true;
TickMarkType majorTickMarkType = gauge.getMajorTickMarkType();
TickMarkType mediumTickMarkType = gauge.getMediumTickMarkType();
TickMarkType minorTickMarkType = gauge.getMinorTickMarkType();
boolean tickMarkSectionsVisible = gauge.getTickMarkSectionsVisible();
boolean tickLabelSectionsVisible = gauge.getTickLabelSectionsVisible();
boolean majorTickMarksVisible = gauge.getMajorTickMarksVisible();
boolean mediumTickMarksVisible = gauge.getMediumTickMarksVisible();
boolean minorTickMarksVisible = gauge.getMinorTickMarksVisible();
boolean tickLabelsVisible = gauge.getTickLabelsVisible();
boolean onlyFirstAndLastLabelVisible = gauge.isOnlyFirstAndLastTickLabelVisible();
boolean customTickLabelsEnabled = gauge.getCustomTickLabelsEnabled();
List<String> customTickLabels = customTickLabelsEnabled ? gauge.getCustomTickLabels() : null;
double textDisplacementFactor = majorTickMarkType == TickMarkType.DOT ? (TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.95 : 1.05) : 1.0;
double majorDotSize;
double majorHalfDotSize;
double mediumDotSize;
double mediumHalfDotSize;
double minorDotSize;
double minorHalfDotSize;
double orthTextFactor;
if (TickLabelLocation.OUTSIDE == tickLabelLocation) {
// TickLabelOrientation.ORTHOGONAL == tickLabelOrientation ? 0.45 * textDisplacementFactor : 0.45 * textDisplacementFactor;
orthTextFactor = 0.45 * textDisplacementFactor;
majorDotSize = 0.02 * size;
majorHalfDotSize = majorDotSize * 0.5;
mediumDotSize = 0.01375 * size;
mediumHalfDotSize = mediumDotSize * 0.5;
minorDotSize = 0.0075 * size;
minorHalfDotSize = minorDotSize * 0.5;
} else {
orthTextFactor = TickLabelOrientation.ORTHOGONAL == tickLabelOrientation ? 0.40 * textDisplacementFactor : 0.39 * textDisplacementFactor;
majorDotSize = 0.025 * size;
majorHalfDotSize = majorDotSize * 0.5;
mediumDotSize = 0.01875 * size;
mediumHalfDotSize = mediumDotSize * 0.5;
minorDotSize = 0.0125 * size;
minorHalfDotSize = minorDotSize * 0.5;
}
;
boolean fullRange = (minValue < 0 && maxValue > 0);
double tickLabelFontSize = tickLabelDecimals == 0 ? 0.074 * size : 0.071 * size;
double tickMarkFontSize = tickLabelDecimals == 0 ? 0.067 * size : 0.064 * size;
double tickLabelOrientationFactor = TickLabelOrientation.HORIZONTAL == tickLabelOrientation ? 0.9 : 1.0;
Font tickLabelFont = Fonts.robotoCondensedRegular(tickLabelFontSize * tickLabelOrientationFactor);
Font tickMarkFont = Fonts.robotoCondensedRegular(tickMarkFontSize * tickLabelOrientationFactor);
Font tickLabelZeroFont = fullRange ? Fonts.robotoCondensedBold(tickLabelFontSize * tickLabelOrientationFactor) : tickLabelFont;
Font tickMarkZeroFont = fullRange ? Fonts.robotoCondensedBold(tickMarkFontSize * tickLabelOrientationFactor) : tickMarkFont;
// Variables needed for tickmarks
double innerPointX;
double innerPointY;
double innerMediumPointX;
double innerMediumPointY;
double innerMinorPointX;
double innerMinorPointY;
double outerPointX;
double outerPointY;
double outerMediumPointX;
double outerMediumPointY;
double outerMinorPointX;
double outerMinorPointY;
double textPointX;
double textPointY;
double dotCenterX;
double dotCenterY;
double dotMediumCenterX;
double dotMediumCenterY;
double dotMinorCenterX;
double dotMinorCenterY;
double tickLabelTickMarkX;
double tickLabelTickMarkY;
double trapezoidMajorInnerAngle1;
double trapezoidMajorInnerAngle2;
double trapezoidMajorOuterAngle1;
double trapezoidMajorOuterAngle2;
double trapezoidMajorInnerPoint1X;
double trapezoidMajorInnerPoint1Y;
double trapezoidMajorInnerPoint2X;
double trapezoidMajorInnerPoint2Y;
double trapezoidMajorOuterPoint1X;
double trapezoidMajorOuterPoint1Y;
double trapezoidMajorOuterPoint2X;
double trapezoidMajorOuterPoint2Y;
double trapezoidMediumInnerAngle1;
double trapezoidMediumInnerAngle2;
double trapezoidMediumOuterAngle1;
double trapezoidMediumOuterAngle2;
double trapezoidMediumInnerPoint1X;
double trapezoidMediumInnerPoint1Y;
double trapezoidMediumInnerPoint2X;
double trapezoidMediumInnerPoint2Y;
double trapezoidMediumOuterPoint1X;
double trapezoidMediumOuterPoint1Y;
double trapezoidMediumOuterPoint2X;
double trapezoidMediumOuterPoint2Y;
double trapezoidMinorInnerAngle1;
double trapezoidMinorInnerAngle2;
double trapezoidMinorOuterAngle1;
double trapezoidMinorOuterAngle2;
double trapezoidMinorInnerPoint1X;
double trapezoidMinorInnerPoint1Y;
double trapezoidMinorInnerPoint2X;
double trapezoidMinorInnerPoint2Y;
double trapezoidMinorOuterPoint1X;
double trapezoidMinorOuterPoint1Y;
double trapezoidMinorOuterPoint2X;
double trapezoidMinorOuterPoint2Y;
ScaleDirection scaleDirection = gauge.getScaleDirection();
// Draw tickmark ring
if (gauge.isTickMarkRingVisible()) {
Pos knobPosition = gauge.getKnobPosition();
double xy = TickLabelLocation.INSIDE == tickLabelLocation ? scaledSize * 0.0125 : scaledSize * 0.1285;
double wh = TickLabelLocation.INSIDE == tickLabelLocation ? scaledSize * 0.948 : scaledSize * 0.716;
double offset = -90 + startAngle;
tickMarkCtx.setLineWidth(scaledSize * 0.004);
tickMarkCtx.setLineCap(StrokeLineCap.SQUARE);
tickMarkCtx.save();
tickMarkCtx.setStroke(tickMarkColor);
switch(knobPosition) {
case BOTTOM_LEFT:
tickMarkCtx.strokeArc((-scaledSize * 0.46) + xy, xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN);
break;
case TOP_LEFT:
tickMarkCtx.strokeArc((-scaledSize * 0.46) + xy, (-scaledSize * 0.46) + xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN);
break;
case TOP_RIGHT:
tickMarkCtx.strokeArc(xy, (-scaledSize * 0.46) + xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN);
break;
default:
tickMarkCtx.strokeArc(xy, xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN);
break;
}
tickMarkCtx.restore();
if (tickMarkSections.size() > 0) {
tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
int listSize = tickMarkSections.size();
double sectionStartAngle;
for (int i = 0; i < listSize; i++) {
Section section = tickMarkSections.get(i);
if (Double.compare(section.getStart(), minValue) < 0 && Double.compare(section.getStop(), maxValue) < 0) {
sectionStartAngle = 0;
} else {
sectionStartAngle = ScaleDirection.CLOCKWISE == scaleDirection ? (section.getStart() - minValue) * angleStep : -(section.getStart() - minValue) * angleStep;
}
double sectionAngleExtend;
if (Double.compare(section.getStop(), maxValue) > 0) {
sectionAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? (maxValue - section.getStart()) * angleStep : -(maxValue - section.getStart()) * angleStep;
} else {
sectionAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? (section.getStop() - section.getStart()) * angleStep : -(section.getStop() - section.getStart()) * angleStep;
}
tickMarkCtx.save();
tickMarkCtx.setStroke(section.getColor());
switch(knobPosition) {
case BOTTOM_LEFT:
tickMarkCtx.strokeArc((-scaledSize * 0.46) + xy, xy, wh, wh, offset - sectionStartAngle, -sectionAngleExtend, ArcType.OPEN);
break;
case TOP_LEFT:
tickMarkCtx.strokeArc((-scaledSize * 0.46) + xy, (-scaledSize * 0.46) + xy, wh, wh, offset - sectionStartAngle, -sectionAngleExtend, ArcType.OPEN);
break;
case TOP_RIGHT:
tickMarkCtx.strokeArc(xy, (-scaledSize * 0.46) + xy, wh, wh, offset - sectionStartAngle, -sectionAngleExtend, ArcType.OPEN);
break;
default:
tickMarkCtx.strokeArc(xy, xy, wh, wh, offset - sectionStartAngle, -sectionAngleExtend, ArcType.OPEN);
break;
}
tickMarkCtx.restore();
}
}
}
// Main loop
BigDecimal tmpStepBD = new BigDecimal(tmpAngleStep);
tmpStepBD = tmpStepBD.setScale(3, BigDecimal.ROUND_HALF_UP);
double tmpStep = tmpStepBD.doubleValue();
double angle = 0;
int customTickLabelCounter = 0;
for (double i = 0; Double.compare(-ANGLE_RANGE - tmpStep, i) <= 0; i -= tmpStep) {
sinValue = Math.sin(Math.toRadians(angle + startAngle));
cosValue = Math.cos(Math.toRadians(angle + startAngle));
switch(tickLabelLocation) {
case OUTSIDE:
innerPointX = centerX + scaledSize * 0.3585 * sinValue;
innerPointY = centerY + scaledSize * 0.3585 * cosValue;
innerMediumPointX = centerX + scaledSize * 0.3585 * sinValue;
innerMediumPointY = centerY + scaledSize * 0.3585 * cosValue;
innerMinorPointX = centerX + scaledSize * 0.3585 * sinValue;
innerMinorPointY = centerY + scaledSize * 0.3585 * cosValue;
outerPointX = centerX + scaledSize * 0.4105 * sinValue;
outerPointY = centerY + scaledSize * 0.4105 * cosValue;
outerMediumPointX = centerX + scaledSize * 0.4045 * sinValue;
outerMediumPointY = centerY + scaledSize * 0.4045 * cosValue;
outerMinorPointX = centerX + scaledSize * 0.3975 * sinValue;
outerMinorPointY = centerY + scaledSize * 0.3975 * cosValue;
textPointX = centerX + scaledSize * orthTextFactor * sinValue;
textPointY = centerY + scaledSize * orthTextFactor * cosValue;
dotCenterX = centerX + scaledSize * 0.3685 * sinValue;
dotCenterY = centerY + scaledSize * 0.3685 * cosValue;
dotMediumCenterX = centerX + scaledSize * 0.365375 * sinValue;
dotMediumCenterY = centerY + scaledSize * 0.365375 * cosValue;
dotMinorCenterX = centerX + scaledSize * 0.36225 * sinValue;
dotMinorCenterY = centerY + scaledSize * 0.36225 * cosValue;
tickLabelTickMarkX = centerX + scaledSize * 0.3805 * sinValue;
tickLabelTickMarkY = centerY + scaledSize * 0.3805 * cosValue;
trapezoidMajorInnerAngle1 = Math.toRadians(angle - 1.2 + startAngle);
trapezoidMajorInnerAngle2 = Math.toRadians(angle + 1.2 + startAngle);
trapezoidMajorOuterAngle1 = Math.toRadians(angle - 0.8 + startAngle);
trapezoidMajorOuterAngle2 = Math.toRadians(angle + 0.8 + startAngle);
trapezoidMajorInnerPoint1X = centerX + scaledSize * 0.3585 * Math.sin(trapezoidMajorInnerAngle1);
trapezoidMajorInnerPoint1Y = centerY + scaledSize * 0.3585 * Math.cos(trapezoidMajorInnerAngle1);
trapezoidMajorInnerPoint2X = centerX + scaledSize * 0.3585 * Math.sin(trapezoidMajorInnerAngle2);
trapezoidMajorInnerPoint2Y = centerY + scaledSize * 0.3585 * Math.cos(trapezoidMajorInnerAngle2);
trapezoidMajorOuterPoint1X = centerX + scaledSize * 0.4105 * Math.sin(trapezoidMajorOuterAngle1);
trapezoidMajorOuterPoint1Y = centerY + scaledSize * 0.4105 * Math.cos(trapezoidMajorOuterAngle1);
trapezoidMajorOuterPoint2X = centerX + scaledSize * 0.4105 * Math.sin(trapezoidMajorOuterAngle2);
trapezoidMajorOuterPoint2Y = centerY + scaledSize * 0.4105 * Math.cos(trapezoidMajorOuterAngle2);
trapezoidMediumInnerAngle1 = Math.toRadians(angle - 1.0 + startAngle);
trapezoidMediumInnerAngle2 = Math.toRadians(angle + 1.0 + startAngle);
trapezoidMediumOuterAngle1 = Math.toRadians(angle - 0.7 + startAngle);
trapezoidMediumOuterAngle2 = Math.toRadians(angle + 0.7 + startAngle);
trapezoidMediumInnerPoint1X = centerX + scaledSize * 0.3585 * Math.sin(trapezoidMediumInnerAngle1);
trapezoidMediumInnerPoint1Y = centerY + scaledSize * 0.3585 * Math.cos(trapezoidMediumInnerAngle1);
trapezoidMediumInnerPoint2X = centerX + scaledSize * 0.3585 * Math.sin(trapezoidMediumInnerAngle2);
trapezoidMediumInnerPoint2Y = centerY + scaledSize * 0.3585 * Math.cos(trapezoidMediumInnerAngle2);
trapezoidMediumOuterPoint1X = centerX + scaledSize * 0.3985 * Math.sin(trapezoidMajorOuterAngle1);
trapezoidMediumOuterPoint1Y = centerY + scaledSize * 0.3985 * Math.cos(trapezoidMediumOuterAngle1);
trapezoidMediumOuterPoint2X = centerX + scaledSize * 0.3985 * Math.sin(trapezoidMediumOuterAngle2);
trapezoidMediumOuterPoint2Y = centerY + scaledSize * 0.3985 * Math.cos(trapezoidMediumOuterAngle2);
trapezoidMinorInnerAngle1 = Math.toRadians(angle - 0.8 + startAngle);
trapezoidMinorInnerAngle2 = Math.toRadians(angle + 0.8 + startAngle);
trapezoidMinorOuterAngle1 = Math.toRadians(angle - 0.6 + startAngle);
trapezoidMinorOuterAngle2 = Math.toRadians(angle + 0.6 + startAngle);
trapezoidMinorInnerPoint1X = centerX + scaledSize * 0.3585 * Math.sin(trapezoidMinorInnerAngle1);
trapezoidMinorInnerPoint1Y = centerY + scaledSize * 0.3585 * Math.cos(trapezoidMinorInnerAngle1);
trapezoidMinorInnerPoint2X = centerX + scaledSize * 0.3585 * Math.sin(trapezoidMinorInnerAngle2);
trapezoidMinorInnerPoint2Y = centerY + scaledSize * 0.3585 * Math.cos(trapezoidMinorInnerAngle2);
trapezoidMinorOuterPoint1X = centerX + scaledSize * 0.3975 * Math.sin(trapezoidMinorOuterAngle1);
trapezoidMinorOuterPoint1Y = centerY + scaledSize * 0.3975 * Math.cos(trapezoidMinorOuterAngle1);
trapezoidMinorOuterPoint2X = centerX + scaledSize * 0.3975 * Math.sin(trapezoidMinorOuterAngle2);
trapezoidMinorOuterPoint2Y = centerY + scaledSize * 0.3975 * Math.cos(trapezoidMinorOuterAngle2);
break;
case INSIDE:
default:
innerPointX = centerX + scaledSize * 0.423 * sinValue;
innerPointY = centerY + scaledSize * 0.423 * cosValue;
innerMediumPointX = centerX + scaledSize * 0.43 * sinValue;
innerMediumPointY = centerY + scaledSize * 0.43 * cosValue;
innerMinorPointX = centerX + scaledSize * 0.436 * sinValue;
innerMinorPointY = centerY + scaledSize * 0.436 * cosValue;
outerPointX = centerX + scaledSize * 0.475 * sinValue;
outerPointY = centerY + scaledSize * 0.475 * cosValue;
outerMediumPointX = centerX + scaledSize * 0.475 * sinValue;
outerMediumPointY = centerY + scaledSize * 0.475 * cosValue;
outerMinorPointX = centerX + scaledSize * 0.475 * sinValue;
outerMinorPointY = centerY + scaledSize * 0.475 * cosValue;
textPointX = centerX + scaledSize * orthTextFactor * sinValue;
textPointY = centerY + scaledSize * orthTextFactor * cosValue;
dotCenterX = centerX + scaledSize * 0.4625 * sinValue;
dotCenterY = centerY + scaledSize * 0.4625 * cosValue;
dotMediumCenterX = centerX + scaledSize * 0.465625 * sinValue;
dotMediumCenterY = centerY + scaledSize * 0.465625 * cosValue;
dotMinorCenterX = centerX + scaledSize * 0.46875 * sinValue;
dotMinorCenterY = centerY + scaledSize * 0.46875 * cosValue;
tickLabelTickMarkX = centerX + scaledSize * 0.445 * sinValue;
tickLabelTickMarkY = centerY + scaledSize * 0.445 * cosValue;
trapezoidMajorInnerAngle1 = Math.toRadians(angle - 0.8 + startAngle);
trapezoidMajorInnerAngle2 = Math.toRadians(angle + 0.8 + startAngle);
trapezoidMajorOuterAngle1 = Math.toRadians(angle - 1.2 + startAngle);
trapezoidMajorOuterAngle2 = Math.toRadians(angle + 1.2 + startAngle);
trapezoidMajorInnerPoint1X = centerX + scaledSize * 0.423 * Math.sin(trapezoidMajorInnerAngle1);
trapezoidMajorInnerPoint1Y = centerY + scaledSize * 0.423 * Math.cos(trapezoidMajorInnerAngle1);
trapezoidMajorInnerPoint2X = centerX + scaledSize * 0.423 * Math.sin(trapezoidMajorInnerAngle2);
trapezoidMajorInnerPoint2Y = centerY + scaledSize * 0.423 * Math.cos(trapezoidMajorInnerAngle2);
trapezoidMajorOuterPoint1X = centerX + scaledSize * 0.475 * Math.sin(trapezoidMajorOuterAngle1);
trapezoidMajorOuterPoint1Y = centerY + scaledSize * 0.475 * Math.cos(trapezoidMajorOuterAngle1);
trapezoidMajorOuterPoint2X = centerX + scaledSize * 0.475 * Math.sin(trapezoidMajorOuterAngle2);
trapezoidMajorOuterPoint2Y = centerY + scaledSize * 0.475 * Math.cos(trapezoidMajorOuterAngle2);
trapezoidMediumInnerAngle1 = Math.toRadians(angle - 0.7 + startAngle);
trapezoidMediumInnerAngle2 = Math.toRadians(angle + 0.7 + startAngle);
trapezoidMediumOuterAngle1 = Math.toRadians(angle - 1.0 + startAngle);
trapezoidMediumOuterAngle2 = Math.toRadians(angle + 1.0 + startAngle);
trapezoidMediumInnerPoint1X = centerX + scaledSize * 0.435 * Math.sin(trapezoidMediumInnerAngle1);
trapezoidMediumInnerPoint1Y = centerY + scaledSize * 0.435 * Math.cos(trapezoidMediumInnerAngle1);
trapezoidMediumInnerPoint2X = centerX + scaledSize * 0.435 * Math.sin(trapezoidMediumInnerAngle2);
trapezoidMediumInnerPoint2Y = centerY + scaledSize * 0.435 * Math.cos(trapezoidMediumInnerAngle2);
trapezoidMediumOuterPoint1X = centerX + scaledSize * 0.475 * Math.sin(trapezoidMajorOuterAngle1);
trapezoidMediumOuterPoint1Y = centerY + scaledSize * 0.475 * Math.cos(trapezoidMediumOuterAngle1);
trapezoidMediumOuterPoint2X = centerX + scaledSize * 0.475 * Math.sin(trapezoidMediumOuterAngle2);
trapezoidMediumOuterPoint2Y = centerY + scaledSize * 0.475 * Math.cos(trapezoidMediumOuterAngle2);
trapezoidMinorInnerAngle1 = Math.toRadians(angle - 0.6 + startAngle);
trapezoidMinorInnerAngle2 = Math.toRadians(angle + 0.6 + startAngle);
trapezoidMinorOuterAngle1 = Math.toRadians(angle - 0.8 + startAngle);
trapezoidMinorOuterAngle2 = Math.toRadians(angle + 0.8 + startAngle);
trapezoidMinorInnerPoint1X = centerX + scaledSize * 0.440 * Math.sin(trapezoidMinorInnerAngle1);
trapezoidMinorInnerPoint1Y = centerY + scaledSize * 0.440 * Math.cos(trapezoidMinorInnerAngle1);
trapezoidMinorInnerPoint2X = centerX + scaledSize * 0.440 * Math.sin(trapezoidMinorInnerAngle2);
trapezoidMinorInnerPoint2Y = centerY + scaledSize * 0.440 * Math.cos(trapezoidMinorInnerAngle2);
trapezoidMinorOuterPoint1X = centerX + scaledSize * 0.475 * Math.sin(trapezoidMinorOuterAngle1);
trapezoidMinorOuterPoint1Y = centerY + scaledSize * 0.475 * Math.cos(trapezoidMinorOuterAngle1);
trapezoidMinorOuterPoint2X = centerX + scaledSize * 0.475 * Math.sin(trapezoidMinorOuterAngle2);
trapezoidMinorOuterPoint2Y = centerY + scaledSize * 0.475 * Math.cos(trapezoidMinorOuterAngle2);
break;
}
// Set the general tickmark color
tickMarkCtx.setStroke(tickMarkColor);
tickMarkCtx.setFill(tickMarkColor);
if (Double.compare(counterBD.remainder(majorTickSpaceBD).doubleValue(), 0.0) == 0) {
// Draw major tick mark
isNotZero = Double.compare(0.0, counter) != 0;
TickMarkType tickMarkType = TickMarkType.LINE;
if (majorTickMarksVisible) {
tickMarkType = majorTickMarkType;
tickMarkCtx.setFill(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, majorTickMarkColor) : majorTickMarkColor);
tickMarkCtx.setStroke(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, majorTickMarkColor) : majorTickMarkColor);
tickMarkCtx.setLineWidth(size * (TickMarkType.BOX == tickMarkType || TickMarkType.PILL == tickMarkType ? 0.016 : 0.0055));
tickMarkCtx.setLineCap(TickMarkType.PILL == tickMarkType ? StrokeLineCap.ROUND : StrokeLineCap.BUTT);
} else if (minorTickMarksVisible) {
tickMarkType = minorTickMarkType;
tickMarkCtx.setFill(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, minorTickMarkColor) : minorTickMarkColor);
tickMarkCtx.setStroke(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, minorTickMarkColor) : minorTickMarkColor);
tickMarkCtx.setLineWidth(size * (TickMarkType.BOX == tickMarkType || TickMarkType.PILL == tickMarkType ? 0.007 : 0.00225));
tickMarkCtx.setLineCap(TickMarkType.PILL == tickMarkType ? StrokeLineCap.ROUND : StrokeLineCap.BUTT);
}
if (fullRange && !isNotZero) {
tickMarkCtx.setFill(zeroColor);
tickMarkCtx.setStroke(zeroColor);
}
switch(tickMarkType) {
case TRAPEZOID:
if (majorTickMarksVisible) {
Helper.drawTrapezoid(tickMarkCtx, trapezoidMajorInnerPoint1X, trapezoidMajorInnerPoint1Y, trapezoidMajorInnerPoint2X, trapezoidMajorInnerPoint2Y, trapezoidMajorOuterPoint1X, trapezoidMajorOuterPoint1Y, trapezoidMajorOuterPoint2X, trapezoidMajorOuterPoint2Y);
} else if (minorTickMarksVisible) {
Helper.drawTrapezoid(tickMarkCtx, trapezoidMinorInnerPoint1X, trapezoidMinorInnerPoint1Y, trapezoidMinorInnerPoint2X, trapezoidMinorInnerPoint2Y, trapezoidMinorOuterPoint1X, trapezoidMinorOuterPoint1Y, trapezoidMinorOuterPoint2X, trapezoidMinorOuterPoint2Y);
}
break;
case TRIANGLE:
if (majorTickMarksVisible) {
if (TickLabelLocation.INSIDE == tickLabelLocation) {
Helper.drawTriangle(tickMarkCtx, innerPointX, innerPointY, trapezoidMajorOuterPoint1X, trapezoidMajorOuterPoint1Y, trapezoidMajorOuterPoint2X, trapezoidMajorOuterPoint2Y);
} else {
Helper.drawTriangle(tickMarkCtx, outerPointX, outerPointY, trapezoidMajorInnerPoint1X, trapezoidMajorInnerPoint1Y, trapezoidMajorInnerPoint2X, trapezoidMajorInnerPoint2Y);
}
} else if (minorTickMarksVisible) {
if (TickLabelLocation.INSIDE == tickLabelLocation) {
Helper.drawTriangle(tickMarkCtx, innerMinorPointX, innerMinorPointY, trapezoidMinorOuterPoint1X, trapezoidMinorOuterPoint1Y, trapezoidMinorOuterPoint2X, trapezoidMinorOuterPoint2Y);
} else {
Helper.drawTriangle(tickMarkCtx, outerMinorPointX, outerMinorPointY, trapezoidMinorInnerPoint1X, trapezoidMinorInnerPoint1Y, trapezoidMinorInnerPoint2X, trapezoidMinorInnerPoint2Y);
}
}
break;
case DOT:
if (majorTickMarksVisible) {
Helper.drawDot(tickMarkCtx, dotCenterX - majorHalfDotSize, dotCenterY - majorHalfDotSize, majorDotSize);
} else if (minorTickMarksVisible) {
Helper.drawDot(tickMarkCtx, dotMinorCenterX - minorHalfDotSize, dotMinorCenterY - minorHalfDotSize, minorDotSize);
}
break;
case TICK_LABEL:
if (majorTickMarksVisible) {
tickMarkCtx.save();
tickMarkCtx.translate(tickLabelTickMarkX, tickLabelTickMarkY);
Helper.rotateContextForText(tickMarkCtx, startAngle, angle, tickLabelOrientation);
tickMarkCtx.setFont(isNotZero ? tickMarkFont : tickMarkZeroFont);
tickMarkCtx.setTextAlign(TextAlignment.CENTER);
tickMarkCtx.setTextBaseline(VPos.CENTER);
tickMarkCtx.fillText(String.format(locale, tickLabelFormatString, counter), 0, 0);
tickMarkCtx.restore();
}
break;
case LINE:
default:
if (majorTickMarksVisible) {
Helper.drawLine(tickMarkCtx, innerPointX, innerPointY, outerPointX, outerPointY);
} else if (minorTickMarksVisible) {
if (TickLabelLocation.OUTSIDE == tickLabelLocation) {
Helper.drawLine(tickMarkCtx, innerPointX, innerPointY, outerMinorPointX, outerMinorPointY);
} else {
Helper.drawLine(tickMarkCtx, innerMinorPointX, innerMinorPointY, outerPointX, outerPointY);
}
}
break;
}
// Draw tick label text
if (tickLabelsVisible) {
tickMarkCtx.save();
tickMarkCtx.translate(textPointX, textPointY);
Helper.rotateContextForText(tickMarkCtx, startAngle, angle, tickLabelOrientation);
tickMarkCtx.setFont(isNotZero ? tickLabelFont : tickLabelZeroFont);
tickMarkCtx.setTextAlign(TextAlignment.CENTER);
tickMarkCtx.setTextBaseline(VPos.CENTER);
if (!onlyFirstAndLastLabelVisible) {
if (isNotZero) {
tickMarkCtx.setFill(tickLabelSectionsVisible ? Helper.getColorOfSection(tickLabelSections, counter, tickLabelColor) : tickLabelColor);
} else {
tickMarkCtx.setFill(tickLabelSectionsVisible ? Helper.getColorOfSection(tickLabelSections, counter, tickLabelColor) : fullRange ? zeroColor : tickLabelColor);
}
} else {
if ((Double.compare(counter, minValue) == 0 || Double.compare(counter, maxValue) == 0)) {
if (isNotZero) {
tickMarkCtx.setFill(tickLabelSectionsVisible ? Helper.getColorOfSection(tickLabelSections, counter, tickLabelColor) : tickLabelColor);
} else {
tickMarkCtx.setFill(tickLabelSectionsVisible ? Helper.getColorOfSection(tickLabelSections, counter, tickLabelColor) : fullRange ? zeroColor : tickLabelColor);
}
} else {
tickMarkCtx.setFill(Color.TRANSPARENT);
}
}
if (customTickLabelsEnabled) {
if (customTickLabelCounter >= 0) {
tickMarkCtx.fillText(customTickLabels.get(customTickLabelCounter), 0, 0);
customTickLabelCounter++;
}
if (customTickLabelCounter > customTickLabels.size() - 1)
customTickLabelCounter = -1;
} else {
tickMarkCtx.fillText(String.format(locale, tickLabelFormatString, counter), 0, 0);
}
tickMarkCtx.restore();
}
} else if (mediumTickMarksVisible && Double.compare(minorTickSpaceBD.remainder(mediumCheck2).doubleValue(), 0.0) != 0.0 && Double.compare(counterBD.remainder(mediumCheck5).doubleValue(), 0.0) == 0.0) {
// Draw medium tick mark
tickMarkCtx.setFill(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, mediumTickMarkColor) : mediumTickMarkColor);
tickMarkCtx.setStroke(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, mediumTickMarkColor) : mediumTickMarkColor);
switch(mediumTickMarkType) {
case TRAPEZOID:
Helper.drawTrapezoid(tickMarkCtx, trapezoidMediumInnerPoint1X, trapezoidMediumInnerPoint1Y, trapezoidMediumInnerPoint2X, trapezoidMediumInnerPoint2Y, trapezoidMediumOuterPoint1X, trapezoidMediumOuterPoint1Y, trapezoidMediumOuterPoint2X, trapezoidMediumOuterPoint2Y);
break;
case TRIANGLE:
if (TickLabelLocation.INSIDE == tickLabelLocation) {
Helper.drawTriangle(tickMarkCtx, innerMediumPointX, innerMediumPointY, trapezoidMediumOuterPoint1X, trapezoidMediumOuterPoint1Y, trapezoidMediumOuterPoint2X, trapezoidMediumOuterPoint2Y);
} else {
Helper.drawTriangle(tickMarkCtx, outerMediumPointX, outerMediumPointY, trapezoidMediumInnerPoint1X, trapezoidMediumInnerPoint1Y, trapezoidMediumInnerPoint2X, trapezoidMediumInnerPoint2Y);
}
break;
case DOT:
Helper.drawDot(tickMarkCtx, dotMediumCenterX - mediumHalfDotSize, dotMediumCenterY - mediumHalfDotSize, mediumDotSize);
break;
case BOX:
tickMarkCtx.setLineWidth(size * 0.009);
if (TickLabelLocation.OUTSIDE == tickLabelLocation) {
Helper.drawLine(tickMarkCtx, innerPointX, innerPointY, outerMediumPointX, outerMediumPointY);
} else {
Helper.drawLine(tickMarkCtx, innerMediumPointX, innerMediumPointY, outerPointX, outerPointY);
}
break;
case PILL:
tickMarkCtx.setLineCap(StrokeLineCap.ROUND);
tickMarkCtx.setLineWidth(size * 0.009);
if (TickLabelLocation.OUTSIDE == tickLabelLocation) {
Helper.drawLine(tickMarkCtx, innerPointX, innerPointY, outerMediumPointX, outerMediumPointY);
} else {
Helper.drawLine(tickMarkCtx, innerMediumPointX, innerMediumPointY, outerPointX, outerPointY);
}
break;
case LINE:
default:
tickMarkCtx.setLineWidth(size * 0.0035);
if (TickLabelLocation.OUTSIDE == tickLabelLocation) {
Helper.drawLine(tickMarkCtx, innerPointX, innerPointY, outerMediumPointX, outerMediumPointY);
} else {
Helper.drawLine(tickMarkCtx, innerMediumPointX, innerMediumPointY, outerPointX, outerPointY);
}
break;
}
} else if (minorTickMarksVisible && Double.compare(counterBD.remainder(minorTickSpaceBD).doubleValue(), 0.0) == 0) {
// Draw minor tick mark
if (TickMarkType.TICK_LABEL != majorTickMarkType) {
tickMarkCtx.setFill(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, minorTickMarkColor) : minorTickMarkColor);
tickMarkCtx.setStroke(tickMarkSectionsVisible ? Helper.getColorOfSection(tickMarkSections, counter, minorTickMarkColor) : minorTickMarkColor);
switch(minorTickMarkType) {
case TRAPEZOID:
Helper.drawTrapezoid(tickMarkCtx, trapezoidMinorInnerPoint1X, trapezoidMinorInnerPoint1Y, trapezoidMinorInnerPoint2X, trapezoidMinorInnerPoint2Y, trapezoidMinorOuterPoint1X, trapezoidMinorOuterPoint1Y, trapezoidMinorOuterPoint2X, trapezoidMinorOuterPoint2Y);
break;
case TRIANGLE:
if (TickLabelLocation.INSIDE == tickLabelLocation) {
Helper.drawTriangle(tickMarkCtx, innerMinorPointX, innerMinorPointY, trapezoidMinorOuterPoint1X, trapezoidMinorOuterPoint1Y, trapezoidMinorOuterPoint2X, trapezoidMinorOuterPoint2Y);
} else {
Helper.drawTriangle(tickMarkCtx, outerMinorPointX, outerMinorPointY, trapezoidMinorInnerPoint1X, trapezoidMinorInnerPoint1Y, trapezoidMinorInnerPoint2X, trapezoidMinorInnerPoint2Y);
}
break;
case DOT:
Helper.drawDot(tickMarkCtx, dotMinorCenterX - minorHalfDotSize, dotMinorCenterY - minorHalfDotSize, minorDotSize);
break;
case BOX:
tickMarkCtx.setLineWidth(size * 0.007);
if (TickLabelLocation.OUTSIDE == tickLabelLocation) {
Helper.drawLine(tickMarkCtx, innerPointX, innerPointY, outerMinorPointX, outerMinorPointY);
} else {
Helper.drawLine(tickMarkCtx, innerMinorPointX, innerMinorPointY, outerPointX, outerPointY);
}
break;
case PILL:
tickMarkCtx.setLineCap(StrokeLineCap.ROUND);
tickMarkCtx.setLineWidth(size * 0.007);
if (TickLabelLocation.OUTSIDE == tickLabelLocation) {
Helper.drawLine(tickMarkCtx, innerPointX, innerPointY, outerMinorPointX, outerMinorPointY);
} else {
Helper.drawLine(tickMarkCtx, innerMinorPointX, innerMinorPointY, outerPointX, outerPointY);
}
break;
case LINE:
default:
tickMarkCtx.setLineWidth(size * 0.00225);
if (TickLabelLocation.OUTSIDE == tickLabelLocation) {
Helper.drawLine(tickMarkCtx, innerPointX, innerPointY, outerMinorPointX, outerMinorPointY);
} else {
Helper.drawLine(tickMarkCtx, innerMinorPointX, innerMinorPointY, outerPointX, outerPointY);
}
break;
}
}
}
counterBD = counterBD.add(minorTickSpaceBD);
counter = counterBD.doubleValue();
if (counter > maxValue)
break;
angle = ScaleDirection.CLOCKWISE == scaleDirection ? (angle - tmpAngleStep) : (angle + tmpAngleStep);
}
}Example 9
| Project: Enzo-master File: RadialBargraphSkin.java View source code |
private void initGraphics() {
// "OpenSans"
Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.06 * PREFERRED_HEIGHT));
barColor = getSkinnable().getBarColor();
barGradient = new ConicalGradient(new Stop(0.0, Color.TRANSPARENT), new Stop(1.0, Color.TRANSPARENT));
valueBlendBottomShadow = new DropShadow();
valueBlendBottomShadow.setBlurType(BlurType.TWO_PASS_BOX);
valueBlendBottomShadow.setColor(Color.rgb(255, 255, 255, 0.5));
valueBlendBottomShadow.setOffsetX(0);
valueBlendBottomShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
valueBlendBottomShadow.setRadius(0);
valueBlendTopShadow = new InnerShadow();
valueBlendTopShadow.setBlurType(BlurType.TWO_PASS_BOX);
valueBlendTopShadow.setColor(Color.rgb(0, 0, 0, 0.7));
valueBlendTopShadow.setOffsetX(0);
valueBlendTopShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
valueBlendTopShadow.setRadius(0.005 * PREFERRED_WIDTH);
blend = new Blend();
blend.setMode(BlendMode.MULTIPLY);
blend.setBottomInput(valueBlendBottomShadow);
blend.setTopInput(valueBlendTopShadow);
background = new Region();
background.getStyleClass().setAll("background");
ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
minMeasuredValue = new Region();
minMeasuredValue.getStyleClass().setAll("min-measured-value");
minMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle());
minMeasuredValue.getTransforms().setAll(minMeasuredValueRotate);
minMeasuredValue.setOpacity(getSkinnable().isMinMeasuredValueVisible() ? 1 : 0);
minMeasuredValue.setManaged(getSkinnable().isMinMeasuredValueVisible());
maxMeasuredValue = new Region();
maxMeasuredValue.getStyleClass().setAll("max-measured-value");
maxMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle());
maxMeasuredValue.getTransforms().setAll(maxMeasuredValueRotate);
maxMeasuredValue.setOpacity(getSkinnable().isMaxMeasuredValueVisible() ? 1 : 0);
maxMeasuredValue.setManaged(getSkinnable().isMaxMeasuredValueVisible());
threshold = new Region();
threshold.getStyleClass().setAll("threshold");
thresholdRotate = new Rotate(180 - getSkinnable().getStartAngle());
threshold.getTransforms().setAll(thresholdRotate);
threshold.setOpacity(getSkinnable().isThresholdVisible() ? 1 : 0);
threshold.setManaged(getSkinnable().isThresholdVisible());
thresholdExceeded = false;
bar = new Arc();
bar.setType(ArcType.ROUND);
bar.setCenterX(PREFERRED_WIDTH * 0.5);
bar.setCenterY(PREFERRED_HEIGHT * 0.5);
bar.setRadiusX(PREFERRED_WIDTH * 0.5 - 4);
bar.setRadiusY(PREFERRED_HEIGHT * 0.5 - 4);
bar.setStartAngle(getSkinnable().getStartAngle() - 90);
bar.setLength(0);
bar.setStrokeType(StrokeType.CENTERED);
bar.setStroke(null);
bar.setFill(new RadialGradient(0, 0, PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.45, false, CycleMethod.NO_CYCLE, new Stop(0.0, barColor), // -5 for on the barColorHue)
new Stop(0.76, barColor.deriveColor(-5, 1, 1, 1)), new Stop(0.79, barColor), new Stop(0.97, barColor), // -5 for on the barColorHue)
new Stop(1.0, barColor.deriveColor(-5, 1, 1, 1))));
knob = new Region();
knob.setPickOnBounds(false);
knob.getStyleClass().setAll("knob");
dropShadow = new DropShadow();
dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);
title = new Text(getSkinnable().getTitle());
title.setMouseTransparent(true);
title.setTextOrigin(VPos.CENTER);
title.getStyleClass().setAll("title");
title.setEffect(getSkinnable().isPlainValue() ? null : blend);
unit = new Text(getSkinnable().getUnit());
unit.setMouseTransparent(true);
unit.setTextOrigin(VPos.CENTER);
unit.getStyleClass().setAll("unit");
unit.setEffect(getSkinnable().isPlainValue() ? null : blend);
value = new Text();
value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", 0.0));
value.setMouseTransparent(true);
value.setTextOrigin(VPos.CENTER);
value.getStyleClass().setAll("value");
value.setEffect(getSkinnable().isPlainValue() ? null : blend);
// Add all nodes
pane = new Pane();
pane.getChildren().setAll(background, bar, ticksAndSectionsCanvas, minMeasuredValue, maxMeasuredValue, threshold, knob, title, unit, value);
pane.getChildren().addAll(getSkinnable().getMarkers().keySet());
getChildren().setAll(pane);
}Example 10
| Project: jfxtras-master File: BasicRoundDailGaugeSkin.java View source code |
/**
*
*/
@Override
protected void layoutChildren() {
super.layoutChildren();
// prep
// radius must be calculated and cannot use bind
double radius = calculateRadius();
// size the circle
double plateRadius = radius * BACKPLATE_RADIUS_FACTOR;
backpaneCircle.setRadius(plateRadius);
// preparation
double controlMinValue = getSkinnable().getMinValue();
double controlMaxValue = getSkinnable().getMaxValue();
double controlValueRange = controlMaxValue - controlMinValue;
// layout the segments
double segmentRadius = calculateRadius() * BACKPLATE_RADIUS_FACTOR;
for (Segment segment : getSkinnable().segments()) {
String message = validateSegment(segment);
if (message != null) {
new Throwable(message).printStackTrace();
continue;
}
// layout the arc for this segment
double segmentMinValue = segment.getMinValue();
double segmentMaxValue = segment.getMaxValue();
double startAngle = (segmentMinValue - controlMinValue) / controlValueRange * FULL_ARC_IN_DEGREES;
double endAngle = (segmentMaxValue - controlMinValue) / controlValueRange * FULL_ARC_IN_DEGREES;
Arc arc = segmentToArc.get(segment);
if (arc != null) {
arc.setCenterX(centerX.get());
arc.setCenterY(centerY.get());
arc.setRadiusX(segmentRadius);
arc.setRadiusY(segmentRadius);
// 0 degrees is on the right side of the circle (3 o'clock), the gauge starts in the bottom left (about 7 o'clock), so add 90 + 45 degrees to offset to that.
// The arc draws counter clockwise, so we need to negate to make it clock wise.
arc.setStartAngle(-1 * (startAngle + 135.0));
arc.setLength(-1 * (endAngle - startAngle));
arc.setType(ArcType.ROUND);
}
}
}Example 11
| Project: processing-master File: PGraphicsFX2D.java View source code |
//////////////////////////////////////////////////////////////
// ARC
//public void arc(float a, float b, float c, float d,
// float start, float stop)
@Override
protected void arcImpl(float x, float y, float w, float h, float start, float stop, int mode) {
beforeContextDraw();
if (drawingThinLines()) {
x += 0.5f;
y += 0.5f;
}
// 0 to 90 in java would be 0 to -90 for p5 renderer
// but that won't work, so -90 to 0?
start = -start;
stop = -stop;
float sweep = stop - start;
// The defaults, before 2.0b7, were to stroke as Arc2D.OPEN, and then fill
// using Arc2D.PIE. That's a little wonky, but it's here for compatability.
// Arc2D.PIE
ArcType fillMode = ArcType.ROUND;
ArcType strokeMode = ArcType.OPEN;
if (mode == OPEN) {
fillMode = ArcType.OPEN;
} else if (mode == PIE) {
// PIE
strokeMode = ArcType.ROUND;
} else if (mode == CHORD) {
fillMode = ArcType.CHORD;
strokeMode = ArcType.CHORD;
}
if (fill) {
context.fillArc(x, y, w, h, PApplet.degrees(start), PApplet.degrees(sweep), fillMode);
}
if (stroke) {
context.strokeArc(x, y, w, h, PApplet.degrees(start), PApplet.degrees(sweep), strokeMode);
}
}Example 12
| Project: jvarkit-master File: VcfStage.java View source code |
private void paintDrawingArea() {
final double canvaswidth = this.drawingArea.getCanvas().getWidth();
if (canvaswidth < 1)
return;
final double canvasheight = this.drawingArea.getCanvas().getHeight();
if (canvasheight < 1)
return;
final GraphicsContext gc = this.drawingArea.getCanvas().getGraphicsContext2D();
gc.setGlobalAlpha(1.0);
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, canvaswidth, canvasheight);
if (this.variantTable.getItems().isEmpty())
return;
gc.setFill(Color.BLACK);
final int MAX_VARIANTS = (int) (canvaswidth / 4.0);
if (this.variantTable.getItems().size() > MAX_VARIANTS) {
gc.setFont(Font.font("Verdana", 24));
gc.fillText("Sorry. Too Many Variants (N=" + this.variantTable.getItems().size() + ">" + MAX_VARIANTS + ")", 2, 50);
return;
}
//genome track
int nrows = 1;
for (final SampleDef sampleDef : this.name2sampledef.values()) {
if (!sampleDef.isDisplayed())
continue;
nrows++;
}
double rowheight = canvasheight / nrows;
if (rowheight < 5)
rowheight = 5;
//no margin if no sample
final double marginleft = (nrows <= 1 ? 0.0 : canvaswidth / 10.0);
final Function<Long, Double> convertGenomicIndexToPixel;
final Function<Integer, Double> convertListIndexToPixel;
if (!this.canvasEvenlySpaced.isSelected()) {
Long minGenomicIndex;
Long maxGenomicIndex;
{
final VariantContext ctx = this.variantTable.getItems().get(0);
minGenomicIndex = convertContigPosToGenomicIndex(ctx.getContig(), ctx.getStart());
maxGenomicIndex = minGenomicIndex;
}
{
final VariantContext ctx = this.variantTable.getItems().get(this.variantTable.getItems().size() - 1);
maxGenomicIndex = convertContigPosToGenomicIndex(ctx.getContig(), ctx.getEnd());
}
if (minGenomicIndex == null || maxGenomicIndex == null)
return;
long extend = (long) ((maxGenomicIndex - minGenomicIndex) * 0.1);
minGenomicIndex = minGenomicIndex - extend;
maxGenomicIndex = maxGenomicIndex + extend;
final long genomicIndexStart = minGenomicIndex;
final long genomicIndexLength = (maxGenomicIndex - minGenomicIndex);
convertGenomicIndexToPixel = ( GI) -> {
double x = marginleft + (canvaswidth - marginleft) * ((double) (GI - genomicIndexStart)) / ((double) (genomicIndexLength));
return x;
};
convertListIndexToPixel = null;
} else {
final double nItems = 2.0 + this.variantTable.getItems().size();
convertGenomicIndexToPixel = null;
convertListIndexToPixel = ( IDX) -> {
return marginleft + ((1 + IDX) / nItems) * (canvaswidth - marginleft);
};
}
//draw vertical lines
String prev_chr = "";
Paint fill_chr1 = Color.BLACK;
Paint fill_chr2 = Color.DARKGRAY;
Paint fill_current = fill_chr1;
gc.setFont(Font.font("Verdana", 7));
for (int idx = 0; idx < this.variantTable.getItems().size(); ++idx) {
final VariantContext ctx = this.variantTable.getItems().get(idx);
if (!ctx.getContig().equals(prev_chr)) {
prev_chr = ctx.getContig();
fill_current = (fill_current == fill_chr1 ? fill_chr2 : fill_chr1);
}
gc.setFill(fill_current);
double x0;
double x1;
if (convertListIndexToPixel == null) {
x0 = convertGenomicIndexToPixel.apply(convertContigPosToGenomicIndex(ctx.getContig(), ctx.getStart()));
x1 = convertGenomicIndexToPixel.apply(convertContigPosToGenomicIndex(ctx.getContig(), ctx.getEnd()));
if (x0 <= x1)
x1 = x0 + 1;
} else {
x0 = convertListIndexToPixel.apply(idx);
x1 = x0 + 1;
}
gc.setGlobalAlpha(0.4);
gc.fillRect(x0, 0, (x1 - x0), canvasheight);
// http://stackoverflow.com/questions/39524792/
gc.setGlobalAlpha(1.0);
gc.setFill(Color.BLACK);
gc.save();
gc.translate(x0, 0);
gc.rotate(90);
gc.fillText(ctx.getContig() + ":" + ctx.getStart(), 5, 0, rowheight);
gc.restore();
}
final double radius = 3.0;
gc.setFont(Font.font("Verdana", 12));
double y = rowheight;
for (final SampleDef sampleDef : this.name2sampledef.values()) {
if (!sampleDef.isDisplayed())
continue;
gc.setLineWidth(1.0);
gc.setGlobalAlpha(1.0);
gc.setFill(Color.BLACK);
gc.setStroke(Color.BLACK);
gc.strokeLine(0, y, canvaswidth, y);
gc.fillText(sampleDef.getName(), 1, y + gc.getFont().getSize(), marginleft);
gc.setLineWidth(0.5);
final double midy = y + rowheight / 2.0;
gc.setGlobalAlpha(0.8);
for (int idx = 0; idx < this.variantTable.getItems().size(); ++idx) {
final VariantContext ctx = this.variantTable.getItems().get(idx);
double x0;
if (convertListIndexToPixel == null) {
x0 = convertGenomicIndexToPixel.apply(convertContigPosToGenomicIndex(ctx.getContig(), ctx.getStart()));
} else {
x0 = convertListIndexToPixel.apply(idx);
}
final Genotype g = ctx.getGenotype(sampleDef.getName());
if (g == null || g.isNoCall())
continue;
if (g.isHomRef()) {
gc.setStroke(Color.DARKGRAY);
gc.strokeOval(x0 - radius, midy - radius, radius * 2, radius * 2);
} else if (g.isHet() && !g.isHetNonRef()) {
gc.setStroke(Color.DARKGRAY);
gc.strokeOval(x0 - radius, midy - radius, radius * 2, radius * 2);
gc.setFill(Color.RED);
gc.fillArc(x0 - radius, midy - radius, radius * 2, radius * 2, 0, 180, ArcType.CHORD);
} else if (g.isHetNonRef()) {
gc.setFill(Color.PINK);
gc.fillOval(x0 - radius, midy - radius, radius * 2, radius * 2);
gc.setFill(Color.RED);
gc.fillArc(x0 - radius, midy - radius, radius * 2, radius * 2, 0, 180, ArcType.CHORD);
} else {
gc.setFill(Color.RED);
gc.fillOval(x0 - radius, midy - radius, radius * 2, radius * 2);
}
}
y += rowheight;
if (y > canvasheight)
break;
}
}Example 13
| Project: Carry-master File: ArcPassenger.java View source code |
public void draw(GraphicsContext gc) {
// TODO Auto-generated method stub
gc.setFill(color);
gc.setGlobalAlpha(1);
gc.fillArc(getX() - 5, getY(), 20 / size, 21 / size, 55, 70, ArcType.ROUND);
}Example 14
| Project: latexdraw-master File: ArcStyle.java View source code |
@Override public ArcType getJFXStyle() { return ArcType.ROUND; }
Example 15
| Project: JXTN-master File: ArcMaker.java View source code |
/**
* 設定屬性{@link Arc#setType(javafx.scene.shape.ArcType)}。
*
* @param value 新的屬性值
* @return 目前的建構器(this)
*/
@SuppressWarnings("unchecked")
public B type(javafx.scene.shape.ArcType value) {
this.hasType = true;
this.valType = value;
return (B) this;
}Example 16
| Project: ewidgetfx-master File: ArcPiece.java View source code |
public void draw(GraphicsContext gc) {
gc.setStroke(strokeColor);
gc.setLineWidth(strokeWidth);
gc.strokeArc(x, y, w, h, startAngle, arcExtent, ArcType.OPEN);
}Example 17
| Project: kvaddakopter-master File: ArcBuilder.java View source code |
/**
* Builds the path for a closed arc, returning a PolygonOptions that can be
* further customised before use.
*
* @param center
* @param start
* @param end
* @param arcType Pass in either ArcType.CHORD or ArcType.ROUND
* @return PolygonOptions with the paths element populated.
*/
public static final PolygonOptions buildClosedArc(LatLong center, LatLong start, LatLong end, ArcType arcType) {
MVCArray res = buildArcPoints(center, start, end);
if (ArcType.ROUND.equals(arcType)) {
res.push(center);
}
return new PolygonOptions().paths(res);
}Example 18
| Project: RoboBuggy-master File: FXGraphics2D.java View source code |
private ArcType intToArcType(int t) { if (t == Arc2D.CHORD) { return ArcType.CHORD; } else if (t == Arc2D.OPEN) { return ArcType.OPEN; } else if (t == Arc2D.PIE) { return ArcType.ROUND; } throw new IllegalArgumentException("Unrecognised t: " + t); }