use of org.csstudio.javafx.rtplot.RTImagePlotListener in project org.csstudio.display.builder by kasemir.
the class ImagePlot method updateRoiFromScreen.
/**
* @param roi RegionOfInterest to move to new location
* @param screen_pos Screen position, will be converted into axes' values
*/
private void updateRoiFromScreen(final int index, final Rectangle2D screen_pos) {
final RegionOfInterest roi = rois.get(index);
// Convert screen position to axis values
final double x0 = x_axis.getValue((int) screen_pos.getMinX()), y0 = y_axis.getValue((int) screen_pos.getMinY()), x1 = x_axis.getValue((int) screen_pos.getMaxX()), y1 = y_axis.getValue((int) screen_pos.getMaxY());
final double x = Math.min(x0, x1);
final double y = Math.min(y0, y1);
final Rectangle2D region = new Rectangle2D(x, y, Math.abs(x1 - x0), Math.abs(y1 - y0));
roi.setRegion(region);
requestUpdate();
// Notify listener of ROI change
final RTImagePlotListener listener = plot_listener;
if (listener != null)
listener.changedROI(index, roi.getName(), roi.getRegion());
}
use of org.csstudio.javafx.rtplot.RTImagePlotListener in project org.csstudio.display.builder by kasemir.
the class ImagePlot method fireChangedAxisRange.
void fireChangedAxisRange(final Axis<Double> axis) {
final RTImagePlotListener listener = plot_listener;
if (listener == null)
return;
final AxisRange<Double> range = axis.getValueRange();
if (axis == x_axis)
listener.changedXAxis(range.getLow(), range.getHigh());
else
listener.changedYAxis(range.getLow(), range.getHigh());
}
Aggregations