List of usage examples for javafx.scene.shape Rectangle contains
public boolean contains(double localX, double localY)
From source file:org.nmrfx.processor.gui.spectra.PeakListAttributes.java
protected boolean pick1DPeak(Peak peak, double x, double y) { double height = yAxis.getHeight(); y = height - y;/* www. j a va 2s. c o m*/ int[] peakDim = getPeakDim(); double bou = peak.peakDim[0].getBoundsValue(); double ctr = peak.peakDim[0].getChemShiftValue(); Rectangle box = getBox(ctr, bou, 20); boolean result = box.contains(x, y); return result; }
From source file:org.nmrfx.processor.gui.spectra.PeakListAttributes.java
private boolean pick2DPeak(Peak peak, double x, double y) { double[] ctr = { 0.0, 0.0 }; double[] bou = { 0.0, 0.0 }; int[] peakDim = getPeakDim(); bou[0] = peak.peakDim[peakDim[0]].getBoundsValue(); bou[1] = peak.peakDim[peakDim[1]].getBoundsValue(); ctr[0] = peak.peakDim[peakDim[0]].getChemShiftValue(); ctr[1] = peak.peakDim[peakDim[1]].getChemShiftValue(); Rectangle box = getBox(ctr, bou); boolean result = box.contains(x, y); // System.out.println(box.toString() + " " + x + " " + y + " " + result); if (!result) { int growWidth = 0; int growHeight = 0; int width = (int) box.getWidth(); if (width < minHitSize) { growWidth = minHitSize - width; }/*ww w. ja v a 2 s .c o m*/ int height = (int) box.getHeight(); if (height < minHitSize) { growHeight = minHitSize - height; } // fixme why are we doing this (from old code) and should it grow symmetrically // gues we try to hit small rect for selectivity, then expand if no hit if ((growWidth > 0) || (growHeight > 0)) { box.setWidth(growWidth); box.setX(box.getX() - growWidth / 2); box.setHeight(growHeight); box.setY(box.getY() - growHeight / 2); result = box.contains(x, y); } } return result; }