java.awt.geom.Rectangle2D#contains ( )源码实例Demo

下面列出了java.awt.geom.Rectangle2D#contains ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: coming   文件: Cardumen_006_t.java
/**
 * 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);
    }

}
 
源代码2 项目: coming   文件: JGenProg2017_005_t.java
/**
 * 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);
    }

}
 
源代码3 项目: coming   文件: Chart_14_CategoryPlot_s.java
/**
 * 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);
    }

}
 
源代码4 项目: coming   文件: jKali_001_t.java
/**
 * 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);
    }

}
 
源代码5 项目: coming   文件: Chart_19_CategoryPlot_t.java
/**
 * 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);
    }

}
 
源代码6 项目: buffer_bci   文件: CombinedDomainCategoryPlot.java
/**
 * 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);
        }
    }

}
 
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);
        }
    }
}
 
源代码8 项目: openjdk-jdk8u   文件: SunGraphics2D.java
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);
}
 
源代码9 项目: astor   文件: PlotRenderingInfo.java
/**
 * 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;
}
 
源代码10 项目: workcraft   文件: VisualGroup.java
@Override
public boolean hitTestInLocalSpace(Point2D pointInLocalSpace) {
    Rectangle2D bb = getBoundingBoxInLocalSpace();
    if ((bb != null) && (getParent() != null)) {
        return bb.contains(pointInLocalSpace);
    }
    return false;
}
 
源代码11 项目: astor   文件: CombinedDomainXYPlot.java
/**
 * 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);
        }
    }
}
 
源代码12 项目: openstock   文件: XYBarRenderer.java
/**
 * 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());
    }
}
 
源代码13 项目: buffer_bci   文件: BarRenderer.java
/**
 * 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());
    }
}
 
源代码14 项目: ECG-Viewer   文件: XYBarRenderer.java
/**
 * 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());
    }
}
 
源代码15 项目: ECG-Viewer   文件: CrosshairOverlay.java
/**
 * 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);
    }
}
 
源代码16 项目: opensim-gui   文件: XYBarRenderer.java
/**
 * 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());
    }        
}
 
源代码17 项目: orbit-image-analysis   文件: ImageFrame.java
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();
    }

}
 
源代码18 项目: coming   文件: Arja_0062_t.java
/**
 * 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);
}
 
/**
 * 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);
}
 
源代码20 项目: coming   文件: JGenProg2017_0044_t.java
/**
 * 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);
}