当前位置: 首页>>代码示例>>Java>>正文


Java Rectangle2D.getMaxX方法代码示例

本文整理汇总了Java中java.awt.geom.Rectangle2D.getMaxX方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle2D.getMaxX方法的具体用法?Java Rectangle2D.getMaxX怎么用?Java Rectangle2D.getMaxX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.Rectangle2D的用法示例。


在下文中一共展示了Rectangle2D.getMaxX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawAxisLine

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Draws an axis line at the current cursor position and edge.
 * 
 * @param g2  the graphics device.
 * @param cursor  the cursor position.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawAxisLine(Graphics2D g2, double cursor,
        Rectangle2D dataArea, RectangleEdge edge) {
    
    Line2D axisLine = null;
    if (edge == RectangleEdge.TOP) {
        axisLine = new Line2D.Double(dataArea.getX(), cursor, 
                dataArea.getMaxX(), cursor);  
    }
    else if (edge == RectangleEdge.BOTTOM) {
        axisLine = new Line2D.Double(dataArea.getX(), cursor, 
                dataArea.getMaxX(), cursor);  
    }
    else if (edge == RectangleEdge.LEFT) {
        axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, 
                dataArea.getMaxY());  
    }
    else if (edge == RectangleEdge.RIGHT) {
        axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, 
                dataArea.getMaxY());  
    }
    g2.setPaint(this.axisLinePaint);
    g2.setStroke(this.axisLineStroke);
    g2.draw(axisLine);
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:Axis.java

示例2: drawHorizontalAxisTrace

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Draws a vertical line used to trace the mouse position to the horizontal axis.
 *
 * @param x  the x-coordinate of the trace line.
 */
private void drawHorizontalAxisTrace(int x) {

    Graphics2D g2 = (Graphics2D) getGraphics();
    Rectangle2D dataArea = getScaledDataArea();

    g2.setXORMode(java.awt.Color.orange);
    if (((int) dataArea.getMinX() < x) && (x < (int) dataArea.getMaxX())) {

        if (this.verticalTraceLine != null) {
            g2.draw(this.verticalTraceLine);
            this.verticalTraceLine.setLine(
                x, (int) dataArea.getMinY(), x, (int) dataArea.getMaxY()
            );
        }
        else {
            this.verticalTraceLine = new Line2D.Float(
                x, (int) dataArea.getMinY(), x, (int) dataArea.getMaxY()
            );
        }
        g2.draw(this.verticalTraceLine);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:29,代码来源:ChartPanel.java

示例3: drawHorizontalLine

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Utility method for drawing a horizontal line across the data area of the
 * plot.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param value  the coordinate, where to draw the line.
 * @param stroke  the stroke to use.
 * @param paint  the paint to use.
 */
protected void drawHorizontalLine(Graphics2D g2, Rectangle2D dataArea,
                                  double value, Stroke stroke,
                                  Paint paint) {

    ValueAxis axis = getRangeAxis();
    if (getOrientation() == PlotOrientation.HORIZONTAL) {
        axis = getDomainAxis();
    }
    if (axis.getRange().contains(value)) {
        double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);
        Line2D line = new Line2D.Double(dataArea.getMinX(), yy, 
                dataArea.getMaxX(), yy);
        g2.setStroke(stroke);
        g2.setPaint(paint);
        g2.draw(line);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:29,代码来源:XYPlot.java

示例4: drawHorizontalAxisTrace

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Draws a vertical line used to trace the mouse position to the horizontal axis.
 * 
 * @param g2
 *            the graphics device.
 * @param x
 *            the x-coordinate of the trace line.
 */
private void drawHorizontalAxisTrace(Graphics2D g2, int x) {

	Rectangle2D dataArea = getScreenDataArea();

	g2.setXORMode(Color.orange);
	if ((int) dataArea.getMinX() < x && x < (int) dataArea.getMaxX()) {

		if (this.verticalTraceLine != null) {
			g2.draw(this.verticalTraceLine);
			this.verticalTraceLine.setLine(x, (int) dataArea.getMinY(), x, (int) dataArea.getMaxY());
		} else {
			this.verticalTraceLine = new Line2D.Float(x, (int) dataArea.getMinY(), x, (int) dataArea.getMaxY());
		}
		g2.draw(this.verticalTraceLine);
	}

	// Reset to the default 'overwrite' mode
	g2.setPaintMode();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:AbstractChartPanel.java

示例5: resolveCollision

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * With the current physics implementation is is possible to glitch through
 * other entities, if their collisionbox is smaller than the velocity of the
 * moving entity and they also move towards the currently moving entity.
 *
 * @param entity
 * @param newPosition
 * @return
 */
private Point2D resolveCollision(final IMovableEntity entity, final Point2D newPosition) {
  // first resolve x-axis movement
  Point2D resolvedPosition = new Point2D.Double(newPosition.getX(), entity.getLocation().getY());

  // resolve static collision boxes first
  final Rectangle2D intersectionX = this.collidesWithAnything(entity, entity.getCollisionBox(resolvedPosition));
  if (intersectionX != null) {
    if (intersectionX.getWidth() > entity.getCollisionBox().getWidth() || intersectionX.getHeight() > entity.getCollisionBox().getHeight()) {
      resolvedPosition = this.findLocationWithoutCollision(entity, resolvedPosition);
    } else if (entity.getCollisionBox().getX() < intersectionX.getMaxX()) {
      // new position is closer to the left side, so push out to the left
      resolvedPosition.setLocation(Math.max(entity.getLocation().getX(), resolvedPosition.getX() - intersectionX.getWidth()), resolvedPosition.getY());
    } else {
      // push it out to the right
      resolvedPosition.setLocation(Math.min(entity.getLocation().getX(), resolvedPosition.getX() + intersectionX.getWidth()), resolvedPosition.getY());
    }
  }

  // then resolve y-axis movement
  resolvedPosition.setLocation(resolvedPosition.getX(), newPosition.getY());
  final Rectangle2D intersectionY = this.collidesWithAnything(entity, entity.getCollisionBox(resolvedPosition));

  if (intersectionY != null) {
    if (intersectionY.getWidth() > entity.getCollisionBox().getWidth() || intersectionY.getHeight() > entity.getCollisionBox().getHeight()) {
      resolvedPosition = this.findLocationWithoutCollision(entity, resolvedPosition);
    } else if (entity.getCollisionBox().getCenterY() - intersectionY.getCenterY() < 0) {
      // new position is closer to the top
      resolvedPosition.setLocation(resolvedPosition.getX(), Math.max(entity.getLocation().getY(), resolvedPosition.getY() - intersectionY.getHeight()));
    } else {
      resolvedPosition.setLocation(resolvedPosition.getX(), Math.min(entity.getLocation().getY(), resolvedPosition.getY() + intersectionY.getHeight()));
    }
  }

  return resolvedPosition;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:45,代码来源:PhysicsEngine.java

示例6: getLines

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Gets the lines.
 *
 * @param rectangle
 *          the rectangle
 * @return the lines
 */
public static Line2D[] getLines(final Rectangle2D rectangle) {
  final Line2D[] lines = new Line2D[4];
  lines[0] = new Line2D.Double(rectangle.getMinX(), rectangle.getMinY(), rectangle.getMinX(), rectangle.getMaxY());
  lines[1] = new Line2D.Double(rectangle.getMinX(), rectangle.getMaxY(), rectangle.getMaxX(), rectangle.getMaxY());
  lines[2] = new Line2D.Double(rectangle.getMaxX(), rectangle.getMaxY(), rectangle.getMaxX(), rectangle.getMinY());
  lines[3] = new Line2D.Double(rectangle.getMaxX(), rectangle.getMinY(), rectangle.getMinX(), rectangle.getMinY());
  return lines;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:16,代码来源:GeometricUtilities.java

示例7: drawRangeMarker

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Draws a horizontal line across the chart to represent a 'range marker'.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param rangeAxis  the range axis.
 * @param marker  the marker line.
 * @param dataArea  the axis data area.
 */
public void drawRangeMarker(Graphics2D g2,
                            ContourPlot plot,
                            ValueAxis rangeAxis,
                            Marker marker,
                            Rectangle2D dataArea) {

    if (marker instanceof ValueMarker) {
        ValueMarker vm = (ValueMarker) marker;
        double value = vm.getValue();
        Range range = rangeAxis.getRange();
        if (!range.contains(value)) {
            return;
        }

        double y = rangeAxis.valueToJava2D(value, dataArea, 
                RectangleEdge.LEFT);
        Line2D line = new Line2D.Double(dataArea.getMinX(), y, 
                dataArea.getMaxX(), y);
        Paint paint = marker.getOutlinePaint();
        Stroke stroke = marker.getOutlineStroke();
        g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT);
        g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE);
        g2.draw(line);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:36,代码来源:ContourPlot.java

示例8: drawOverflowIndicator

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Draws indicator in case the annotation text overflows on the y axis.
 *
 * @param anno
 *            the annotation
 * @param g
 *            the graphics context to draw upon
 * @param loc
 *            the location of the annotation
 * @param printing
 *            if we are currently printing
 */
private void drawOverflowIndicator(final WorkflowAnnotation anno, final Graphics2D g, final Rectangle2D loc,
		final boolean printing) {
	if (printing) {
		// never draw them for printing
		return;
	}
	Graphics2D g2 = (Graphics2D) g.create();

	int size = 20;
	int xOffset = 10;
	int yOffset = 10;
	int stepSize = size / 4;
	int dotSize = 3;
	int x = (int) loc.getMaxX() - size - xOffset;
	int y = (int) loc.getMaxY() - size - yOffset;
	GradientPaint gp = new GradientPaint(x, y, Color.WHITE, x, y + size * 1.5f, Color.LIGHT_GRAY);
	g2.setPaint(gp);
	g2.fillRect(x, y, size, size);

	g2.setColor(Color.BLACK);
	g2.drawRect(x, y, size, size);

	g2.fillOval(x + stepSize, y + stepSize * 2, dotSize, dotSize);
	g2.fillOval(x + stepSize * 2, y + stepSize * 2, dotSize, dotSize);
	g2.fillOval(x + stepSize * 3, y + stepSize * 2, dotSize, dotSize);

	g2.dispose();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:41,代码来源:AnnotationDrawer.java

示例9: valueToJava2D

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Translates the data value to the display coordinates (Java 2D User Space)
 * of the chart.
 *
 * @param value  the date to be plotted.
 * @param area  the rectangle (in Java2D space) where the data is to be plotted.
 * @param edge  the axis location.
 *
 * @return the coordinate corresponding to the supplied data value.
 */
public double valueToJava2D(double value, Rectangle2D area, RectangleEdge edge) {
    
    value = this.timeline.toTimelineValue(new Date((long) value));

    DateRange range = (DateRange) getRange();
    double axisMin = this.timeline.toTimelineValue(range.getLowerDate());
    double axisMax = this.timeline.toTimelineValue(range.getUpperDate());
    double result = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        double minX = area.getX();
        double maxX = area.getMaxX();
        if (isInverted()) {
            result = maxX + ((value - axisMin) / (axisMax - axisMin)) * (minX - maxX);
        }
        else {
            result = minX + ((value - axisMin) / (axisMax - axisMin)) * (maxX - minX);
        }
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        double minY = area.getMinY();
        double maxY = area.getMaxY();
        if (isInverted()) {
            result = minY + (((value - axisMin) / (axisMax - axisMin)) * (maxY - minY));
        }
        else {
            result = maxY - (((value - axisMin) / (axisMax - axisMin)) * (maxY - minY));
        }
    }
    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:42,代码来源:DateAxis.java

示例10: drawRangeGridline

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Draws a grid line against the range axis.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the value axis.
 * @param dataArea  the area for plotting data (not yet adjusted for any 3D effect).
 * @param value  the value at which the grid line should be drawn.
 *
 */
public void drawRangeGridline(Graphics2D g2,
                              CategoryPlot plot,
                              ValueAxis axis,
                              Rectangle2D dataArea,
                              double value) {

    Range range = axis.getRange();
    if (!range.contains(value)) {
        return;
    }

    PlotOrientation orientation = plot.getOrientation();
    double v = axis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge());
    Line2D line = null;
    if (orientation == PlotOrientation.HORIZONTAL) {
        line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v);
    }

    Paint paint = plot.getRangeGridlinePaint();
    if (paint == null) {
        paint = CategoryPlot.DEFAULT_GRIDLINE_PAINT;
    }
    g2.setPaint(paint);

    Stroke stroke = plot.getRangeGridlineStroke();
    if (stroke == null) {
        stroke = CategoryPlot.DEFAULT_GRIDLINE_STROKE;
    }
    g2.setStroke(stroke);

    g2.draw(line);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:47,代码来源:AbstractCategoryItemRenderer.java

示例11: valueToJava2D

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Converts a data value to a coordinate in Java2D space, assuming that the
 * axis runs along one edge of the specified dataArea.
 * <p>
 * Note that it is possible for the coordinate to fall outside the area.
 *
 * @param value  the data value.
 * @param area  the area for plotting the data.
 * @param edge  the edge along which the axis lies.
 *
 * @return The Java2D coordinate.
 */
public double valueToJava2D(double value,
                            Rectangle2D area,
                            RectangleEdge edge) {
    
    double result = Double.NaN;
    double axisMin = this.first.getFirstMillisecond(this.timeZone);
    double axisMax = this.last.getLastMillisecond(this.timeZone);
    if (RectangleEdge.isTopOrBottom(edge)) {
        double minX = area.getX();
        double maxX = area.getMaxX();
        if (isInverted()) {
            result = maxX + ((value - axisMin) / (axisMax - axisMin)) * (minX - maxX);
        }
        else {
            result = minX + ((value - axisMin) / (axisMax - axisMin)) * (maxX - minX);
        }
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        double minY = area.getMinY();
        double maxY = area.getMaxY();
        if (isInverted()) {
            result = minY + (((value - axisMin) / (axisMax - axisMin)) * (maxY - minY));
        }
        else {
            result = maxY - (((value - axisMin) / (axisMax - axisMin)) * (maxY - minY));
        }
    }
    return result;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:43,代码来源:PeriodAxis.java

示例12: java2DToValue

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Converts a coordinate in Java2D space to the corresponding data value,
 * assuming that the axis runs along one edge of the specified dataArea.
 *
 * @param java2DValue  the coordinate in Java2D space.
 * @param area  the area in which the data is plotted.
 * @param edge  the location.
 *
 * @return The data value.
 * 
 * @see #valueToJava2D(double, Rectangle2D, RectangleEdge)
 */
public double java2DToValue(double java2DValue, Rectangle2D area, 
                            RectangleEdge edge) {
    
    Range range = getRange();
    double axisMin = range.getLowerBound();
    double axisMax = range.getUpperBound();

    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = area.getX();
        max = area.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        min = area.getMaxY();
        max = area.getY();
    }
    if (isInverted()) {
        return axisMax 
               - (java2DValue - min) / (max - min) * (axisMax - axisMin);
    }
    else {
        return axisMin 
               + (java2DValue - min) / (max - min) * (axisMax - axisMin);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:40,代码来源:NumberAxis.java

示例13: drawHorizontal

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Draws a the title horizontally within the specified area.  This method will be called
 * from the {@link #draw(Graphics2D, Rectangle2D) draw} method.
 * 
 * @param g2  the graphics device.
 * @param area  the area for the title.
 */
protected void drawHorizontal(Graphics2D g2, Rectangle2D area) {
    Rectangle2D titleArea = (Rectangle2D) area.clone();
    getSpacer().trim(titleArea);
    g2.setFont(this.font);
    g2.setPaint(this.paint);
    TextBlock title = TextUtilities.createTextBlock(
        this.text, this.font, this.paint, (float) titleArea.getWidth(), new G2TextMeasurer(g2)
    );
    TextBlockAnchor anchor = null;
    float x = 0.0f;
    HorizontalAlignment horizontalAlignment = getHorizontalAlignment();
    if (horizontalAlignment == HorizontalAlignment.LEFT) {
        x = (float) titleArea.getX();
        anchor = TextBlockAnchor.TOP_LEFT;
    }
    else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
        x = (float) titleArea.getMaxX();
        anchor = TextBlockAnchor.TOP_RIGHT;
    }
    else if (horizontalAlignment == HorizontalAlignment.CENTER) {
        x = (float) titleArea.getCenterX();
        anchor = TextBlockAnchor.TOP_CENTER;
    }
    float y = 0.0f;
    RectangleEdge position = getPosition();
    if (position == RectangleEdge.TOP) {
        y = (float) titleArea.getY();
    }
    else if (position == RectangleEdge.BOTTOM) {
        y = (float) titleArea.getMaxY();
        if (horizontalAlignment == HorizontalAlignment.LEFT) {
            anchor = TextBlockAnchor.BOTTOM_LEFT;
        }
        else if (horizontalAlignment == HorizontalAlignment.CENTER) {
            anchor = TextBlockAnchor.BOTTOM_CENTER;
        }
        else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
            anchor = TextBlockAnchor.BOTTOM_RIGHT;
        }
    }
    title.draw(g2, x, y, anchor);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:50,代码来源:TextTitle.java

示例14: drawNeedle

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Draws the needle.
 *
 * @param g2  the graphics device.
 * @param plotArea  the plot area.
 * @param rotate  the rotation point.
 * @param angle  the angle.
 */
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea, 
                          Point2D rotate, double angle) {

    GeneralPath shape1 = new GeneralPath();
    GeneralPath shape2 = new GeneralPath();
    GeneralPath shape3 = new GeneralPath();

    float minX = (float) plotArea.getMinX();
    float minY = (float) plotArea.getMinY();
    float maxX = (float) plotArea.getMaxX();
    float maxY = (float) plotArea.getMaxY();
    //float midX = (float) (minX + (plotArea.getWidth() * getRotateX()));
    //float midY = (float) (minY + (plotArea.getHeight() * getRotateY()));
    float midX = (float) (minX + (plotArea.getWidth() * 0.5));
    float midY = (float) (minY + (plotArea.getHeight() * 0.8));
    float y = maxY - (2 * (maxY - midY));
    if (y < minY) {
        y = minY;
    }
    shape1.moveTo(minX, midY);
    shape1.lineTo(midX, minY);
    shape1.lineTo(midX, y);
    shape1.closePath();

    shape2.moveTo(maxX, midY);
    shape2.lineTo(midX, minY);
    shape2.lineTo(midX, y);
    shape2.closePath();

    shape3.moveTo(minX, midY);
    shape3.lineTo(midX, maxY);
    shape3.lineTo(maxX, midY);
    shape3.lineTo(midX, y);
    shape3.closePath();

    Shape s1 = shape1;
    Shape s2 = shape2;
    Shape s3 = shape3;

    if ((rotate != null) && (angle != 0)) {
        /// we have rotation huston, please spin me
        getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
        s1 = shape1.createTransformedShape(transform);
        s2 = shape2.createTransformedShape(transform);
        s3 = shape3.createTransformedShape(transform);
    }


    if (getHighlightPaint() != null) {
        g2.setPaint(getHighlightPaint());
        g2.fill(s3);
    }

    if (getFillPaint() != null) {
        g2.setPaint(getFillPaint());
        g2.fill(s1);
        g2.fill(s2);
    }


    if (getOutlinePaint() != null) {
        g2.setStroke(getOutlineStroke());
        g2.setPaint(getOutlinePaint());
        g2.draw(s1);
        g2.draw(s2);
        g2.draw(s3);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:77,代码来源:LongNeedle.java

示例15: drawBackground

import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
public void drawBackground(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // higlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Composite originalComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC,
                                                   plot.getBackgroundAlpha()));
        g2.drawImage(backgroundImage,
                     (int) x1, (int) y3,
                     (int) (x3 - x1 + 1), (int) (y1 - y3 + 1),
                     null);
        g2.setComposite(originalComposite);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:77,代码来源:BarRenderer3D.java


注:本文中的java.awt.geom.Rectangle2D.getMaxX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。