@Override public void setActiveAxis(final AxisType axis) { if (dimensionIndex(axis) < 0) { throw new IllegalArgumentException("Unknown axis: " + axis); } activeAxis = axis; // notify interested parties of the change if (eventService != null) { eventService.publish(new AxisActivatedEvent(this, activeAxis)); } }
@Override public long getLongPosition(final AxisType axis) { final int d = dimensionIndex(axis); if (d < 0) { // untracked axes are all at position 0 by default return 0; } final Long value = pos.get(axis); if (value == null) return 0; final long min = min(d); if (value < min) return min; final long max = max(d); if (value > max) return max; return value; }
@Override public RealRect getPlaneExtents() { final int xAxis = dimensionIndex(Axes.X); final int yAxis = dimensionIndex(Axes.Y); final double xMin = realMin(xAxis); final double yMin = realMin(yAxis); final double width = realMax(xAxis) - realMin(xAxis); final double height = realMax(yAxis) - realMin(yAxis); return new RealRect(xMin, yMin, width, height); }
@Override public void setPosition(final long position, final AxisType axis) { final int axisIndex = dimensionIndex(axis); if (axisIndex < 0) { throw new IllegalArgumentException("Invalid axis: " + axis); } // clamp new position value to [min, max] final long min = min(axisIndex); final long max = max(axisIndex); long value = position; if (value < min) value = min; if (value > max) value = max; // update position pos.put(axis, value); // notify interested parties of the change // NB: DataView.setPosition is called only in update method. if (eventService != null) { // NB: BDZ changed from publish() to publishLater(). This fixes bug #1234. // We may want to change order of events to allow publish() instead. eventService.publishLater(new AxisPositionEvent(this, axis)); } }
if (dimensionIndex(axis) < 0) { pos.remove(axis);