Java Code Examples for java.awt.geom.Rectangle2D#contains()

The following examples show how to use java.awt.geom.Rectangle2D#contains() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Cardumen_006_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Handles a 'click' on the plot by updating the anchor value.
 *
 * @param x  x-coordinate of the click (in Java2D space).
 * @param y  y-coordinate of the click (in Java2D space).
 * @param info  information about the plot's dimensions.
 *
 */
public void handleClick(int x, int y, PlotRenderingInfo info) {

    Rectangle2D dataArea = info.getDataArea();
    if (dataArea.contains(x, y)) {
        // set the anchor value for the range axis...
        double java2D = 0.0;
        if (this.orientation == PlotOrientation.HORIZONTAL) {
            java2D = x;
        }
        else if (this.orientation == PlotOrientation.VERTICAL) {
            java2D = y;
        }
        RectangleEdge edge = Plot.resolveRangeAxisLocation(
                getRangeAxisLocation(), this.orientation);
        double value = getRangeAxis().java2DToValue(
                java2D, info.getDataArea(), edge);
        setAnchorValue(value);
        setRangeCrosshairValue(value);
    }

}
 
Example 2
Source File: Chart_19_CategoryPlot_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Handles a 'click' on the plot by updating the anchor value.
 *
 * @param x  x-coordinate of the click (in Java2D space).
 * @param y  y-coordinate of the click (in Java2D space).
 * @param info  information about the plot's dimensions.
 *
 */
public void handleClick(int x, int y, PlotRenderingInfo info) {

    Rectangle2D dataArea = info.getDataArea();
    if (dataArea.contains(x, y)) {
        // set the anchor value for the range axis...
        double java2D = 0.0;
        if (this.orientation == PlotOrientation.HORIZONTAL) {
            java2D = x;
        }
        else if (this.orientation == PlotOrientation.VERTICAL) {
            java2D = y;
        }
        RectangleEdge edge = Plot.resolveRangeAxisLocation(
                getRangeAxisLocation(), this.orientation);
        double value = getRangeAxis().java2DToValue(
                java2D, info.getDataArea(), edge);
        setAnchorValue(value);
        setRangeCrosshairValue(value);
    }

}
 
Example 3
Source File: jKali_001_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Handles a 'click' on the plot by updating the anchor value.
 *
 * @param x  x-coordinate of the click (in Java2D space).
 * @param y  y-coordinate of the click (in Java2D space).
 * @param info  information about the plot's dimensions.
 *
 */
public void handleClick(int x, int y, PlotRenderingInfo info) {

    Rectangle2D dataArea = info.getDataArea();
    if (dataArea.contains(x, y)) {
        // set the anchor value for the range axis...
        double java2D = 0.0;
        if (this.orientation == PlotOrientation.HORIZONTAL) {
            java2D = x;
        }
        else if (this.orientation == PlotOrientation.VERTICAL) {
            java2D = y;
        }
        RectangleEdge edge = Plot.resolveRangeAxisLocation(
                getRangeAxisLocation(), this.orientation);
        double value = getRangeAxis().java2DToValue(
                java2D, info.getDataArea(), edge);
        setAnchorValue(value);
        setRangeCrosshairValue(value);
    }

}
 
Example 4
Source File: JGenProg2017_005_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Handles a 'click' on the plot by updating the anchor value.
 *
 * @param x  x-coordinate of the click (in Java2D space).
 * @param y  y-coordinate of the click (in Java2D space).
 * @param info  information about the plot's dimensions.
 *
 */
public void handleClick(int x, int y, PlotRenderingInfo info) {

    Rectangle2D dataArea = info.getDataArea();
    if (dataArea.contains(x, y)) {
        // set the anchor value for the range axis...
        double java2D = 0.0;
        if (this.orientation == PlotOrientation.HORIZONTAL) {
            java2D = x;
        }
        else if (this.orientation == PlotOrientation.VERTICAL) {
            java2D = y;
        }
        RectangleEdge edge = Plot.resolveRangeAxisLocation(
                getRangeAxisLocation(), this.orientation);
        double value = getRangeAxis().java2DToValue(
                java2D, info.getDataArea(), edge);
        setAnchorValue(value);
        setRangeCrosshairValue(value);
    }

}
 
Example 5
Source File: Chart_14_CategoryPlot_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Handles a 'click' on the plot by updating the anchor value.
 *
 * @param x  x-coordinate of the click (in Java2D space).
 * @param y  y-coordinate of the click (in Java2D space).
 * @param info  information about the plot's dimensions.
 *
 */
public void handleClick(int x, int y, PlotRenderingInfo info) {

    Rectangle2D dataArea = info.getDataArea();
    if (dataArea.contains(x, y)) {
        // set the anchor value for the range axis...
        double java2D = 0.0;
        if (this.orientation == PlotOrientation.HORIZONTAL) {
            java2D = x;
        }
        else if (this.orientation == PlotOrientation.VERTICAL) {
            java2D = y;
        }
        RectangleEdge edge = Plot.resolveRangeAxisLocation(
                getRangeAxisLocation(), this.orientation);
        double value = getRangeAxis().java2DToValue(
                java2D, info.getDataArea(), edge);
        setAnchorValue(value);
        setRangeCrosshairValue(value);
    }

}
 
Example 6
Source File: CombinedDomainCategoryPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Handles a 'click' on the plot.
 *
 * @param x  x-coordinate of the click.
 * @param y  y-coordinate of the click.
 * @param info  information about the plot's dimensions.
 *
 */
@Override
public void handleClick(int x, int y, PlotRenderingInfo info) {

    Rectangle2D dataArea = info.getDataArea();
    if (dataArea.contains(x, y)) {
        for (int i = 0; i < this.subplots.size(); i++) {
            CategoryPlot subplot = (CategoryPlot) this.subplots.get(i);
            PlotRenderingInfo subplotInfo = info.getSubplotInfo(i);
            subplot.handleClick(x, y, subplotInfo);
        }
    }

}
 
Example 7
Source File: CombinedDomainXYPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Handles a 'click' on the plot by updating the anchor values.
 *
 * @param x  x-coordinate, where the click occured.
 * @param y  y-coordinate, where the click occured.
 * @param info  object containing information about the plot dimensions.
 */
public void handleClick(int x, int y, PlotRenderingInfo info) {
    Rectangle2D dataArea = info.getDataArea();
    if (dataArea.contains(x, y)) {
        for (int i = 0; i < this.subplots.size(); i++) {
            XYPlot subplot = (XYPlot) this.subplots.get(i);
            PlotRenderingInfo subplotInfo = info.getSubplotInfo(i);
            subplot.handleClick(x, y, subplotInfo);
        }
    }
}
 
Example 8
Source File: VisualGroup.java    From workcraft with MIT License 5 votes vote down vote up
@Override
public boolean hitTestInLocalSpace(Point2D pointInLocalSpace) {
    Rectangle2D bb = getBoundingBoxInLocalSpace();
    if ((bb != null) && (getParent() != null)) {
        return bb.contains(pointInLocalSpace);
    }
    return false;
}
 
Example 9
Source File: PlotRenderingInfo.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the index of the subplot that contains the specified
 * (x, y) point (the "source" point).  The source point will usually
 * come from a mouse click on a {@link org.jfree.chart.ChartPanel},
 * and this method is then used to determine the subplot that
 * contains the source point.
 *
 * @param source  the source point (in Java2D space, <code>null</code> not
 * permitted).
 *
 * @return The subplot index (or -1 if no subplot contains
 *         <code>source</code>).
 */
public int getSubplotIndex(Point2D source) {
    if (source == null) {
        throw new IllegalArgumentException("Null 'source' argument.");
    }
    int subplotCount = getSubplotCount();
    for (int i = 0; i < subplotCount; i++) {
        PlotRenderingInfo info = getSubplotInfo(i);
        Rectangle2D area = info.getDataArea();
        if (area.contains(source)) {
            return i;
        }
    }
    return -1;
}
 
Example 10
Source File: SunGraphics2D.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
Shape intersectRectShape(Rectangle2D r, Shape s,
                         boolean keep1, boolean keep2) {
    if (s instanceof Rectangle2D) {
        Rectangle2D r2 = (Rectangle2D) s;
        Rectangle2D outrect;
        if (!keep1) {
            outrect = r;
        } else if (!keep2) {
            outrect = r2;
        } else {
            outrect = new Rectangle2D.Float();
        }
        double x1 = Math.max(r.getX(), r2.getX());
        double x2 = Math.min(r.getX()  + r.getWidth(),
                             r2.getX() + r2.getWidth());
        double y1 = Math.max(r.getY(), r2.getY());
        double y2 = Math.min(r.getY()  + r.getHeight(),
                             r2.getY() + r2.getHeight());

        if (((x2 - x1) < 0) || ((y2 - y1) < 0))
            // Width or height is negative. No intersection.
            outrect.setFrameFromDiagonal(0, 0, 0, 0);
        else
            outrect.setFrameFromDiagonal(x1, y1, x2, y2);
        return outrect;
    }
    if (r.contains(s.getBounds2D())) {
        if (keep2) {
            s = cloneShape(s);
        }
        return s;
    }
    return intersectByArea(r, s, keep1, keep2);
}
 
Example 11
Source File: BorderlessImageToggleButton.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void mouseReleased(MouseEvent event) {
    if (getAction() != null ? getAction().isEnabled() : isEnabled()) {
        // do a hit test to make sure the mouse is being released inside the button
        Rectangle2D buttonRect = BorderlessImageToggleButton.this.getBounds();
        if (buttonRect.contains(event.getPoint())) {
            BorderlessImageToggleButton.this.setBackground(BorderlessUtility.ON_MOUSE_OVER_BACKGROUND);
        }
    }
}
 
Example 12
Source File: XYBarRenderer.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws an item label.  This method is provided as an alternative to
 * {@link #drawItemLabel(Graphics2D, PlotOrientation, XYDataset, int, int,
 * double, double, boolean)} so that the bar can be used to calculate the
 * label anchor point.
 *
 * @param g2  the graphics device.
 * @param dataset  the dataset.
 * @param series  the series index.
 * @param item  the item index.
 * @param plot  the plot.
 * @param generator  the label generator (<code>null</code> permitted, in
 *         which case the method does nothing, just returns).
 * @param bar  the bar.
 * @param negative  a flag indicating a negative value.
 */
protected void drawItemLabel(Graphics2D g2, XYDataset dataset,
        int series, int item, XYPlot plot, XYItemLabelGenerator generator,
        Rectangle2D bar, boolean negative) {

    if (generator == null) {
        return;  // nothing to do
    }
    String label = generator.generateLabel(dataset, series, item);
    if (label == null) {
        return;  // nothing to do
    }

    Font labelFont = getItemLabelFont(series, item);
    g2.setFont(labelFont);
    Paint paint = getItemLabelPaint(series, item);
    g2.setPaint(paint);

    // find out where to place the label...
    ItemLabelPosition position;
    if (!negative) {
        position = getPositiveItemLabelPosition(series, item);
    }
    else {
        position = getNegativeItemLabelPosition(series, item);
    }

    // work out the label anchor point...
    Point2D anchorPoint = calculateLabelAnchorPoint(
            position.getItemLabelAnchor(), bar, plot.getOrientation());

    if (isInternalAnchor(position.getItemLabelAnchor())) {
        Shape bounds = TextUtilities.calculateRotatedStringBounds(label,
                g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());

        if (bounds != null) {
            if (!bar.contains(bounds.getBounds2D())) {
                if (!negative) {
                    position = getPositiveItemLabelPositionFallback();
                }
                else {
                    position = getNegativeItemLabelPositionFallback();
                }
                if (position != null) {
                    anchorPoint = calculateLabelAnchorPoint(
                            position.getItemLabelAnchor(), bar,
                            plot.getOrientation());
                }
            }
        }

    }

    if (position != null) {
        TextUtilities.drawRotatedString(label, g2,
                (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());
    }
}
 
Example 13
Source File: BarRenderer.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws an item label.  This method is overridden so that the bar can be
 * used to calculate the label anchor point.
 *
 * @param g2  the graphics device.
 * @param data  the dataset.
 * @param row  the row.
 * @param column  the column.
 * @param plot  the plot.
 * @param generator  the label generator.
 * @param bar  the bar.
 * @param negative  a flag indicating a negative value.
 */
protected void drawItemLabel(Graphics2D g2,
                             CategoryDataset data,
                             int row,
                             int column,
                             CategoryPlot plot,
                             CategoryItemLabelGenerator generator,
                             Rectangle2D bar,
                             boolean negative) {

    String label = generator.generateLabel(data, row, column);
    if (label == null) {
        return;  // nothing to do
    }

    Font labelFont = getItemLabelFont(row, column);
    g2.setFont(labelFont);
    Paint paint = getItemLabelPaint(row, column);
    g2.setPaint(paint);

    // find out where to place the label...
    ItemLabelPosition position;
    if (!negative) {
        position = getPositiveItemLabelPosition(row, column);
    }
    else {
        position = getNegativeItemLabelPosition(row, column);
    }

    // work out the label anchor point...
    Point2D anchorPoint = calculateLabelAnchorPoint(
            position.getItemLabelAnchor(), bar, plot.getOrientation());

    if (isInternalAnchor(position.getItemLabelAnchor())) {
        Shape bounds = TextUtilities.calculateRotatedStringBounds(label,
                g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());

        if (bounds != null) {
            if (!bar.contains(bounds.getBounds2D())) {
                if (!negative) {
                    position = getPositiveItemLabelPositionFallback();
                }
                else {
                    position = getNegativeItemLabelPositionFallback();
                }
                if (position != null) {
                    anchorPoint = calculateLabelAnchorPoint(
                            position.getItemLabelAnchor(), bar,
                            plot.getOrientation());
                }
            }
        }

    }

    if (position != null) {
        TextUtilities.drawRotatedString(label, g2,
                (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());
    }
}
 
Example 14
Source File: CrosshairOverlay.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws a crosshair horizontally across the plot.
 *
 * @param g2  the graphics target.
 * @param dataArea  the data area.
 * @param y  the y-value in Java2D space.
 * @param crosshair  the crosshair.
 */
protected void drawHorizontalCrosshair(Graphics2D g2, Rectangle2D dataArea,
        double y, Crosshair crosshair) {

    if (y >= dataArea.getMinY() && y <= dataArea.getMaxY()) {
        Line2D line = new Line2D.Double(dataArea.getMinX(), y,
                dataArea.getMaxX(), y);
        Paint savedPaint = g2.getPaint();
        Stroke savedStroke = g2.getStroke();
        g2.setPaint(crosshair.getPaint());
        g2.setStroke(crosshair.getStroke());
        g2.draw(line);
        if (crosshair.isLabelVisible()) {
            String label = crosshair.getLabelGenerator().generateLabel(
                    crosshair);
            RectangleAnchor anchor = crosshair.getLabelAnchor();
            Point2D pt = calculateLabelPoint(line, anchor, 5, 5);
            float xx = (float) pt.getX();
            float yy = (float) pt.getY();
            TextAnchor alignPt = textAlignPtForLabelAnchorH(anchor);
            Shape hotspot = TextUtilities.calculateRotatedStringBounds(
                    label, g2, xx, yy, alignPt, 0.0, TextAnchor.CENTER);
            if (!dataArea.contains(hotspot.getBounds2D())) {
                anchor = flipAnchorV(anchor);
                pt = calculateLabelPoint(line, anchor, 5, 5);
                xx = (float) pt.getX();
                yy = (float) pt.getY();
                alignPt = textAlignPtForLabelAnchorH(anchor);
                hotspot = TextUtilities.calculateRotatedStringBounds(
                       label, g2, xx, yy, alignPt, 0.0, TextAnchor.CENTER);
            }

            g2.setPaint(crosshair.getLabelBackgroundPaint());
            g2.fill(hotspot);
            g2.setPaint(crosshair.getLabelOutlinePaint());
            g2.draw(hotspot);
            TextUtilities.drawAlignedString(label, g2, xx, yy, alignPt);
        }
        g2.setPaint(savedPaint);
        g2.setStroke(savedStroke);
    }
}
 
Example 15
Source File: XYBarRenderer.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws an item label.  This method is provided as an alternative to
 * {@link #drawItemLabel(Graphics2D, PlotOrientation, XYDataset, int, int,
 * double, double, boolean)} so that the bar can be used to calculate the
 * label anchor point.
 *
 * @param g2  the graphics device.
 * @param dataset  the dataset.
 * @param series  the series index.
 * @param item  the item index.
 * @param plot  the plot.
 * @param generator  the label generator (<code>null</code> permitted, in
 *         which case the method does nothing, just returns).
 * @param bar  the bar.
 * @param negative  a flag indicating a negative value.
 */
protected void drawItemLabel(Graphics2D g2, XYDataset dataset,
        int series, int item, XYPlot plot, XYItemLabelGenerator generator,
        Rectangle2D bar, boolean negative) {

    if (generator == null) {
        return;  // nothing to do
    }
    String label = generator.generateLabel(dataset, series, item);
    if (label == null) {
        return;  // nothing to do
    }

    Font labelFont = getItemLabelFont(series, item);
    g2.setFont(labelFont);
    Paint paint = getItemLabelPaint(series, item);
    g2.setPaint(paint);

    // find out where to place the label...
    ItemLabelPosition position;
    if (!negative) {
        position = getPositiveItemLabelPosition(series, item);
    }
    else {
        position = getNegativeItemLabelPosition(series, item);
    }

    // work out the label anchor point...
    Point2D anchorPoint = calculateLabelAnchorPoint(
            position.getItemLabelAnchor(), bar, plot.getOrientation());

    if (isInternalAnchor(position.getItemLabelAnchor())) {
        Shape bounds = TextUtilities.calculateRotatedStringBounds(label,
                g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());

        if (bounds != null) {
            if (!bar.contains(bounds.getBounds2D())) {
                if (!negative) {
                    position = getPositiveItemLabelPositionFallback();
                }
                else {
                    position = getNegativeItemLabelPositionFallback();
                }
                if (position != null) {
                    anchorPoint = calculateLabelAnchorPoint(
                            position.getItemLabelAnchor(), bar,
                            plot.getOrientation());
                }
            }
        }

    }

    if (position != null) {
        TextUtilities.drawRotatedString(label, g2,
                (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());
    }
}
 
Example 16
Source File: XYBarRenderer.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
/**
 * Draws an item label.  This method is overridden so that the bar can be 
 * used to calculate the label anchor point.
 * 
 * @param g2  the graphics device.
 * @param dataset  the dataset.
 * @param series  the series index.
 * @param item  the item index.
 * @param plot  the plot.
 * @param generator  the label generator.
 * @param bar  the bar.
 * @param negative  a flag indicating a negative value.
 */
protected void drawItemLabel(Graphics2D g2, XYDataset dataset,
        int series, int item, XYPlot plot, XYItemLabelGenerator generator, 
        Rectangle2D bar, boolean negative) {
                                 
    String label = generator.generateLabel(dataset, series, item);
    if (label == null) {
        return;  // nothing to do   
    }
    
    Font labelFont = getItemLabelFont(series, item);
    g2.setFont(labelFont);
    Paint paint = getItemLabelPaint(series, item);
    g2.setPaint(paint);

    // find out where to place the label...
    ItemLabelPosition position = null;
    if (!negative) {
        position = getPositiveItemLabelPosition(series, item);
    }
    else {
        position = getNegativeItemLabelPosition(series, item);
    }

    // work out the label anchor point...
    Point2D anchorPoint = calculateLabelAnchorPoint(
            position.getItemLabelAnchor(), bar, plot.getOrientation());
    
    if (isInternalAnchor(position.getItemLabelAnchor())) {
        Shape bounds = TextUtilities.calculateRotatedStringBounds(label, 
                g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());
        
        if (bounds != null) {
            if (!bar.contains(bounds.getBounds2D())) {
                if (!negative) {
                    position = getPositiveItemLabelPositionFallback();
                }
                else {
                    position = getNegativeItemLabelPositionFallback();
                }
                if (position != null) {
                    anchorPoint = calculateLabelAnchorPoint(
                            position.getItemLabelAnchor(), bar, 
                            plot.getOrientation());
                }
            }
        }
    
    }
    
    if (position != null) {
        TextUtilities.drawRotatedString(label, g2, 
                (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(), 
                position.getRotationAnchor());
    }        
}
 
Example 17
Source File: ImageFrame.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
private synchronized void adjustViewport(boolean fromMouse) {
    double scOld = recognitionFrame.getOldScale() / 100d;
    double scNew = recognitionFrame.getScale() / 100d;
    if (scOld < 0.00001d) return; // avoid diff by 0 later

    Dimension frameSize = getSize();
    recognitionFrame.setViewPortSize(recognitionFrame.getSize());
    Point2D offs = recognitionFrame.getViewPortOffset();

    // "centralized zooming"
    double centerX = frameSize.width / 2d;
    double centerY = frameSize.height / 2d;

    Point2D mousePos = getMousePosition(); // returns null if mouse cursor is not over component
    double imgW = (int) (recognitionFrame.bimg.getWidth() * scOld);
    double imgH = (int) (recognitionFrame.bimg.getHeight() * scOld);
    Rectangle2D viewPortRect = new Rectangle2D.Double(-offs.getX(), -offs.getY(), imgW, imgH);
    if (fromMouse && mousePos != null && viewPortRect.contains(mousePos)) { // if available, center the zooming to the mouse position
        centerX = mousePos.getX();
        centerY = mousePos.getY();
    }

    double x = offs.getX() + centerX;
    double y = offs.getY() + centerY;
    x *= (scNew / scOld);
    y *= (scNew / scOld);
    x -= centerX;
    y -= centerY;

    offs.setLocation(x, y);

    // don't let the image out of the viewport
    final double border = 20;
    double ox = offs.getX();
    double oy = offs.getY();
    if (fromMouse) {
        if (-offs.getX() + imgW - border < 0) ox = imgW - border;
        if (-offs.getY() + imgH - border < 0) oy = imgH - border;
        if (-offs.getX() + border > recognitionFrame.getWidth()) ox = -recognitionFrame.getWidth() + border;
        if (-offs.getY() + border > recognitionFrame.getHeight()) oy = -recognitionFrame.getHeight() + border;
    }
    offs.setLocation(ox, oy);

    recognitionFrame.setOldScale(scNew * 100d);    // version 1.91
    recognitionFrame.setViewPortOffset(new Point2D.Double(offs.getX(), offs.getY()));
    recognitionFrame.repaint();

    if ((exclusive || isSelected()) && renderGrid != null) {
        renderGrid.setScale(recognitionFrame.getScale() / 100d);
        //this.propertyChange(new PropertyChangeEvent(this, SCALE_SET_EVENT_OUT, null, new Integer((int)recognitionFrame.getScale())));
        renderGrid.setViewportPosition(recognitionFrame.getViewPortOffset());
        renderGrid.repaint();
    }

}
 
Example 18
Source File: patch1-Chart-1-jMutRepair_patch1-Chart-1-jMutRepair_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Returns <code>true</code> if the specified point (xx, yy) in Java2D
 * space falls within the "hot spot" for the specified data item, and
 * <code>false</code> otherwise.
 *
 * @param xx
 * @param yy
 * @param g2
 * @param dataArea
 * @param plot
 * @param domainAxis
 * @param rangeAxis
 * @param dataset
 * @param row
 * @param column
 * @param selected
 *
 * @return
 *
 * @since 1.2.0
 */
public boolean hitTest(double xx, double yy, Graphics2D g2,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
        boolean selected, CategoryItemRendererState state) {
    Rectangle2D bounds = createHotSpotBounds(g2, dataArea, plot,
            domainAxis, rangeAxis, dataset, row, column, selected,
            state, null);
    if (bounds == null) {
        return false;
    }
    // FIXME:  if the following test passes, we should then do the more
    // expensive test against the hotSpotShape
    return bounds.contains(xx, yy);
}
 
Example 19
Source File: Arja_0062_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Returns <code>true</code> if the specified point (xx, yy) in Java2D
 * space falls within the "hot spot" for the specified data item, and
 * <code>false</code> otherwise.
 *
 * @param xx
 * @param yy
 * @param g2
 * @param dataArea
 * @param plot
 * @param domainAxis
 * @param rangeAxis
 * @param dataset
 * @param row
 * @param column
 * @param selected
 *
 * @return
 *
 * @since 1.2.0
 */
public boolean hitTest(double xx, double yy, Graphics2D g2,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
        boolean selected, CategoryItemRendererState state) {
    Rectangle2D bounds = createHotSpotBounds(g2, dataArea, plot,
            domainAxis, rangeAxis, dataset, row, column, selected,
            state, null);
    if (bounds == null) {
        return false;
    }
    // FIXME:  if the following test passes, we should then do the more
    // expensive test against the hotSpotShape
    return bounds.contains(xx, yy);
}
 
Example 20
Source File: JGenProg2017_0044_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Returns <code>true</code> if the specified point (xx, yy) in Java2D
 * space falls within the "hot spot" for the specified data item, and
 * <code>false</code> otherwise.
 *
 * @param xx
 * @param yy
 * @param g2
 * @param dataArea
 * @param plot
 * @param domainAxis
 * @param rangeAxis
 * @param dataset
 * @param row
 * @param column
 * @param selected
 *
 * @return
 *
 * @since 1.2.0
 */
public boolean hitTest(double xx, double yy, Graphics2D g2,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
        boolean selected, CategoryItemRendererState state) {
    Rectangle2D bounds = createHotSpotBounds(g2, dataArea, plot,
            domainAxis, rangeAxis, dataset, row, column, selected,
            state, null);
    if (bounds == null) {
        return false;
    }
    // FIXME:  if the following test passes, we should then do the more
    // expensive test against the hotSpotShape
    return bounds.contains(xx, yy);
}