Implement clamping in while panning. Don't allow panning past the min
or max.
This commit is contained in:
parent
d9c0f68e64
commit
06e702839f
@ -171,6 +171,11 @@ public class SimulationPlot {
|
|||||||
// axis.setRange(axes.get(i).getMinValue(), axes.get(i).getMaxValue());
|
// axis.setRange(axes.get(i).getMinValue(), axes.get(i).getMaxValue());
|
||||||
plot.setRangeAxis(axisno, axis);
|
plot.setRangeAxis(axisno, axis);
|
||||||
|
|
||||||
|
double domainMin = data[i].getDomainLowerBound(true);
|
||||||
|
double domainMax = data[i].getDomainUpperBound(true);
|
||||||
|
|
||||||
|
plot.setDomainAxis(new PresetNumberAxis(domainMin, domainMax));
|
||||||
|
|
||||||
// Add data and map to the axis
|
// Add data and map to the axis
|
||||||
plot.setDataset(axisno, data[i]);
|
plot.setDataset(axisno, data[i]);
|
||||||
ModifiedXYItemRenderer r = new ModifiedXYItemRenderer(branchCount);
|
ModifiedXYItemRenderer r = new ModifiedXYItemRenderer(branchCount);
|
||||||
@ -354,8 +359,10 @@ public class SimulationPlot {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(EventDisplayInfo o1, EventDisplayInfo o2) {
|
public int compare(EventDisplayInfo o1, EventDisplayInfo o2) {
|
||||||
if ( o1.time< o2.time) return -1;
|
if (o1.time < o2.time)
|
||||||
if ( o1.time == o2.time)return 0;
|
return -1;
|
||||||
|
if (o1.time == o2.time)
|
||||||
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,59 +370,6 @@ public class SimulationPlot {
|
|||||||
|
|
||||||
return eventList;
|
return eventList;
|
||||||
|
|
||||||
/*
|
|
||||||
double prevTime = -100;
|
|
||||||
String text = null;
|
|
||||||
Color color = null;
|
|
||||||
Image image = null;
|
|
||||||
for ( int branch=0; branch<branchCount; branch++ ) {
|
|
||||||
List<FlightEvent> events = simulation.getSimulatedData().getBranch(branch).getEvents();
|
|
||||||
for (int i = 0; i < events.size(); i++) {
|
|
||||||
FlightEvent event = events.get(i);
|
|
||||||
double t = event.getTime();
|
|
||||||
FlightEvent.Type type = event.getType();
|
|
||||||
|
|
||||||
if (type != FlightEvent.Type.ALTITUDE && config.isEventActive(type)) {
|
|
||||||
if (Math.abs(t - prevTime) <= 0.05) {
|
|
||||||
|
|
||||||
if (!typeSet.contains(type)) {
|
|
||||||
text = text + ", " + type.toString();
|
|
||||||
color = EventGraphics.getEventColor(type);
|
|
||||||
image = EventGraphics.getEventImage(type);
|
|
||||||
typeSet.add(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (text != null) {
|
|
||||||
EventDisplayInfo info = new EventDisplayInfo();
|
|
||||||
info.time = prevTime;
|
|
||||||
info.event = text;
|
|
||||||
info.color = color;
|
|
||||||
info.image = image;
|
|
||||||
eventList.add(info);
|
|
||||||
}
|
|
||||||
prevTime = t;
|
|
||||||
text = type.toString();
|
|
||||||
color = EventGraphics.getEventColor(type);
|
|
||||||
image = EventGraphics.getEventImage(type);
|
|
||||||
typeSet.clear();
|
|
||||||
typeSet.add(type);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (text != null) {
|
|
||||||
EventDisplayInfo info = new EventDisplayInfo();
|
|
||||||
info.time = prevTime;
|
|
||||||
info.event = text;
|
|
||||||
info.color = color;
|
|
||||||
info.image = image;
|
|
||||||
eventList.add(info);
|
|
||||||
}
|
|
||||||
return eventList;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -560,6 +514,19 @@ public class SimulationPlot {
|
|||||||
protected void autoAdjustRange() {
|
protected void autoAdjustRange() {
|
||||||
this.setRange(min, max);
|
this.setRange(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRange(Range range) {
|
||||||
|
double lowerValue = range.getLowerBound();
|
||||||
|
double upperValue = range.getUpperBound();
|
||||||
|
if (lowerValue < min || upperValue > max) {
|
||||||
|
// Don't blow past the min & max of the range this is important to keep
|
||||||
|
// panning constrained within the current bounds.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.setRange(new Range(lowerValue, upperValue));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EventDisplayInfo {
|
private static class EventDisplayInfo {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user