Commit 3753344c authored by Simon Barner's avatar Simon Barner
Browse files

- Style fixes (no functional change)

refs 3371
parent 28e5658c
......@@ -3,7 +3,7 @@ LabelToDraw.java 999a987f051ecf08965832c43c6164b20cb0431a GREEN
LineToDraw.java 96fb75373891873a51b557fece736f1c337069fc GREEN
ScheduleModelElementToDraw.java 8d3da6f399fb33bfc243a5519345ee9d36953304 YELLOW
ScheduleView.java 3c0165545106c338f3a00449b09b4e219bf94a29 GREEN
ScheduleViewCanvas.java c47deedbcc39fee8008ecad8ab0392f76b6ad4d8 YELLOW
ScheduleViewCanvas.java 00f5ab7cac8bf9c14756fe6ebd15c5a7b3bdee18 YELLOW
ScheduleViewColors.java a5544e371ea55d1d6cec99cd119bdddfef3d1239 GREEN
ScheduleViewGraphModel.java 218aadb5dd480a2a0f8ff72ced6bc8816181911d YELLOW
ScheduleViewLayoutData.java c192e6d12806bac9df98c7e25faa45607023bef0 YELLOW
......
......@@ -17,9 +17,13 @@ package org.fortiss.af3.schedule.ui.ganttchartview;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.math.BigDecimal.ONE;
import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleViewLayoutData.DIAGRAM_HORIZONTAL_SPACING;
import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleViewLayoutData.DIAGRAM_OFFSET_LABEL;
import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleViewLayoutData.DIAGRAM_OFFSET_X;
import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleViewLayoutData.DIAGRAM_OFFSET_Y;
import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleViewLayoutData.MATH_CONTEXT_DOUBLE_MAXIMUM_PRECISION;
import static org.fortiss.af3.schedule.ui.ganttchartview.ScheduleViewLayoutData.SCALING_USER_X_MAX;
import static org.fortiss.af3.schedule.ui.utils.ScheduleViewUtils.getDuration;
import static org.fortiss.af3.schedule.ui.utils.ScheduleViewUtils.getPhase;
import static org.fortiss.af3.schedule.utils.MathUtils.round;
......@@ -154,7 +158,7 @@ public class ScheduleViewCanvas extends Canvas {
public void mouseDown(MouseEvent e) {
switch(e.button) {
case 1:
if(scheduleLayoutData.getScalingUserX() < ScheduleViewLayoutData.SCALING_USER_X_MAX) {
if(scheduleLayoutData.getScalingUserX() < SCALING_USER_X_MAX) {
// Left mouse button: Start zoom in operation (finished in mouseUp())
diagramMouseDownX = e.x;
}
......@@ -195,8 +199,7 @@ public class ScheduleViewCanvas extends Canvas {
// Do nothing in case
// - the user cancelled the zoom using the ESC key (resets diagramMouseDownX)
// - maximum user scaling level has already been reached
if(diagramMouseDownX < 0 ||
scheduleLayoutData.getScalingUserX() == ScheduleViewLayoutData.SCALING_USER_X_MAX) {
if(diagramMouseDownX < 0 || scheduleLayoutData.getScalingUserX() == SCALING_USER_X_MAX) {
return;
}
......@@ -239,16 +242,16 @@ public class ScheduleViewCanvas extends Canvas {
ratioLargerScalingFactor =
setScalingUserX(scheduleLayoutData.getScalingUserX() + 1, diagramWidth,
objectSelectionWidth);
} while(ratioLargerScalingFactor.compareTo(BigDecimal.ONE) == -1 &&
scheduleLayoutData.getScalingUserX() < ScheduleViewLayoutData.SCALING_USER_X_MAX);
} while(ratioLargerScalingFactor.compareTo(ONE) == -1 &&
scheduleLayoutData.getScalingUserX() < SCALING_USER_X_MAX);
// Check if the previous user scaling factor would have resulting in a smaller
// deviation between the actual and the desired object space diagram width.
BigDecimal ratioSmallerScalingFactor =
setScalingUserX(scheduleLayoutData.getScalingUserX() - 1, diagramWidth,
objectSelectionWidth);
if(ratioLargerScalingFactor.subtract(BigDecimal.ONE).abs()
.compareTo(ratioSmallerScalingFactor.subtract(BigDecimal.ONE).abs()) == -1) {
if(ratioLargerScalingFactor.subtract(ONE).abs()
.compareTo(ratioSmallerScalingFactor.subtract(ONE).abs()) == -1) {
setScalingUserX(scheduleLayoutData.getScalingUserX() + 1, diagramWidth,
objectSelectionWidth);
}
......@@ -398,8 +401,7 @@ public class ScheduleViewCanvas extends Canvas {
// first.
int diagramSelectionX =
scheduleLayoutData.scaleLengthObjectSpaceToDiagramSpaceX(objectSelectionX) +
ScheduleViewLayoutData.DIAGRAM_OFFSET_X +
ScheduleViewLayoutData.DIAGRAM_OFFSET_LABEL;
DIAGRAM_OFFSET_X + DIAGRAM_OFFSET_LABEL;
getHorizontalBar().setSelection(diagramSelectionX);
// diagramSelectionX is the diagram coordinate of the left-most visible point. Hence, set
......@@ -460,18 +462,17 @@ public class ScheduleViewCanvas extends Canvas {
diagramY2);
// X axis
BigDecimal maf = scheduleModel.getMajorFrame();
BigDecimal numHyperPeriods = BigDecimal.valueOf(scheduleModel.getNumberOfHyperPeriods());
int diagramX2 =
diagramX +
scheduleLayoutData
.scaleLengthObjectSpaceToDiagramSpaceX(scheduleModel
.getMajorFrame().multiply(
BigDecimal.valueOf(scheduleModel
.getNumberOfHyperPeriods())));
scheduleLayoutData.scaleLengthObjectSpaceToDiagramSpaceX(maf
.multiply(numHyperPeriods));
// Explicitly long horizontal lines since they will get extremely long at high scaling
// levels and will trigger bugs in SWT.
diagramX = Math.max(diagramX, 0);
diagramX2 = Math.min(diagramX2, clientArea.width);
// Explicitly truncate long horizontal lines since they will get extremely long at high
// scaling levels and will trigger bugs in SWT.
diagramX = max(diagramX, 0);
diagramX2 = min(diagramX2, clientArea.width);
gc.drawLine(diagramX - 2 * DIAGRAM_COORDINATE_SYSTEM_EXTRA_LINE_LENGTH, diagramY,
diagramX2, diagramY);
......@@ -498,12 +499,9 @@ public class ScheduleViewCanvas extends Canvas {
.divide(modelLabelInterval_bd, MATH_CONTEXT_DOUBLE_MAXIMUM_PRECISION)
.setScale(0, BigDecimal.ROUND_FLOOR).multiply(modelLabelInterval_bd);
BigDecimal modelEndCoordinateLabel =
BigDecimal
.valueOf(scheduleModel.getNumberOfHyperPeriods())
.multiply(scheduleModel.getMajorFrame())
.min(scheduleLayoutData
.scaleLengthDiagramSpaceToObjectSpaceX(clientArea.width -
scheduleLayoutData.getDiagramOrigin().x));
numHyperPeriods.multiply(maf).min(
scheduleLayoutData.scaleLengthDiagramSpaceToObjectSpaceX(clientArea.width -
scheduleLayoutData.getDiagramOrigin().x));
DecimalFormat df = new DecimalFormat("0.00", DecimalFormatSymbols.getInstance(Locale.ROOT));
int decimals =
......@@ -535,7 +533,7 @@ public class ScheduleViewCanvas extends Canvas {
for(int i = 0; i < scheduleModel.getNumberOfHyperPeriods(); ++i) {
diagramX =
scheduleLayoutData.objectSpaceToDiagramSpaceX(BigDecimal.valueOf(i + 1)
.multiply(scheduleModel.getMajorFrame()));
.multiply(maf));
if(displayPeriodsSchedulableEntities) {
drawPeriods(scheduleModel.getSchedulableEntityPeriods(), gc, SWT.COLOR_BLACK, i,
......
Supports Markdown
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