本文整理汇总了Java中java.awt.geom.Rectangle2D.getMinY方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle2D.getMinY方法的具体用法?Java Rectangle2D.getMinY怎么用?Java Rectangle2D.getMinY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.Rectangle2D
的用法示例。
在下文中一共展示了Rectangle2D.getMinY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawRangeCrosshair
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Draws a range crosshair.
*
* @param g2 the graphics target.
* @param dataArea the data area.
* @param orientation the plot orientation.
* @param value the crosshair value.
* @param axis the axis against which the value is measured.
* @param stroke the stroke used to draw the crosshair line.
* @param paint the paint used to draw the crosshair line.
*
* @since 1.0.5
*/
protected void drawRangeCrosshair(Graphics2D g2, Rectangle2D dataArea,
PlotOrientation orientation, double value, ValueAxis axis,
Stroke stroke, Paint paint) {
if (!axis.getRange().contains(value)) {
return;
}
Line2D line = null;
if (orientation == PlotOrientation.HORIZONTAL) {
double xx = axis.valueToJava2D(value, dataArea,
RectangleEdge.BOTTOM);
line = new Line2D.Double(xx, dataArea.getMinY(), xx,
dataArea.getMaxY());
}
else {
double yy = axis.valueToJava2D(value, dataArea,
RectangleEdge.LEFT);
line = new Line2D.Double(dataArea.getMinX(), yy,
dataArea.getMaxX(), yy);
}
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(line);
}
示例2: getCategoryStart
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Returns the starting coordinate for the specified category.
*
* @param category the category.
* @param categoryCount the number of categories.
* @param area the data area.
* @param edge the axis location.
*
* @return the coordinate.
*/
public double getCategoryStart(int category, int categoryCount, Rectangle2D area,
RectangleEdge edge) {
double result = 0.0;
if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
result = area.getX() + area.getWidth() * getLowerMargin();
}
else if ((edge == RectangleEdge.LEFT) || (edge == RectangleEdge.RIGHT)) {
result = area.getMinY() + area.getHeight() * getLowerMargin();
}
double categorySize = calculateCategorySize(categoryCount, area, edge);
double categoryGapWidth = calculateCategoryGapSize(categoryCount, area, edge);
result = result + category * (categorySize + categoryGapWidth);
return result;
}
示例3: transEnd
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Translates a data value to a Java2D value for the second section of the
* axis.
*
* @param value the value.
* @param area the data area.
* @param edge the edge along which the axis lies.
* @param length1 the length of the first section.
* @param length2 the length of the second section.
*
* @return The Java2D coordinate.
*/
private double transEnd(double value, Rectangle2D area, RectangleEdge edge,
double length1, double length2) {
double min = 0.0;
double max = 0.0;
if (RectangleEdge.isTopOrBottom(edge)) {
max = area.getMaxX();
min = area.getMaxX() - area.getWidth() * length2 / (length1 + length2);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
max = area.getMinY();
min = area.getMinY() + area.getHeight() * length2 / (length1 + length2);
}
if (isInverted()) {
return max - ((value - this.fixedRange.getLowerBound())
/ (this.displayEnd - this.fixedRange.getLowerBound())) * (max - min);
}
else {
return min + ((value - this.fixedRange.getLowerBound())
/ (this.displayEnd - this.fixedRange.getLowerBound())) * (max - min);
}
}
示例4: fillDomainGridBand
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Fills a band between two values on the axis. This can be used to color bands between the
* grid lines.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param axis the domain axis.
* @param dataArea the data area.
* @param start the start value.
* @param end the end value.
*/
public void fillDomainGridBand(Graphics2D g2,
XYPlot plot,
ValueAxis axis,
Rectangle2D dataArea,
double start, double end) {
double x1 = axis.valueToJava2D(start, dataArea, plot.getDomainAxisEdge());
double x2 = axis.valueToJava2D(end, dataArea, plot.getDomainAxisEdge());
// TODO: need to change the next line to take account of plot orientation...
Rectangle2D band = new Rectangle2D.Double(
x1, dataArea.getMinY(), x2 - x1, dataArea.getMaxY() - dataArea.getMinY()
);
Paint paint = plot.getDomainTickBandPaint();
if (paint != null) {
g2.setPaint(paint);
g2.fill(band);
}
}
示例5: drawRangeCrosshair
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Draws a range crosshair.
*
* @param g2 the graphics target.
* @param dataArea the data area.
* @param orientation the plot orientation.
* @param value the crosshair value.
* @param axis the axis against which the value is measured.
* @param stroke the stroke used to draw the crosshair line.
* @param paint the paint used to draw the crosshair line.
*
* @since 1.0.4
*/
protected void drawRangeCrosshair(Graphics2D g2, Rectangle2D dataArea,
PlotOrientation orientation, double value, ValueAxis axis,
Stroke stroke, Paint paint) {
if (axis.getRange().contains(value)) {
Line2D line = null;
if (orientation == PlotOrientation.HORIZONTAL) {
double xx = axis.valueToJava2D(value, dataArea,
RectangleEdge.BOTTOM);
line = new Line2D.Double(xx, dataArea.getMinY(), xx,
dataArea.getMaxY());
}
else {
double yy = axis.valueToJava2D(value, dataArea,
RectangleEdge.LEFT);
line = new Line2D.Double(dataArea.getMinX(), yy,
dataArea.getMaxX(), yy);
}
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(line);
}
}
示例6: restrictValueToDataArea
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Helper method which returns a value if it lies
* inside the visible dataArea and otherwise the corresponding
* coordinate on the border of the dataArea. The PlotOrientation
* is taken into account.
* Useful to avoid possible sun.dc.pr.PRException: endPath: bad path
* which occurs when trying to draw lines/shapes which in large part
* lie outside of the visible dataArea.
*
* @param value the value which shall be
* @param dataArea the area within which the data is being drawn.
* @param plot the plot (can be used to obtain standard color information etc).
* @return <code>double</code> value inside the data area.
*/
protected static double restrictValueToDataArea(double value,
XYPlot plot,
Rectangle2D dataArea) {
double min = 0;
double max = 0;
if (plot.getOrientation() == PlotOrientation.VERTICAL) {
min = dataArea.getMinY();
max = dataArea.getMaxY();
}
else if (plot.getOrientation() == PlotOrientation.HORIZONTAL) {
min = dataArea.getMinX();
max = dataArea.getMaxX();
}
if (value < min) {
value = min;
}
else if (value > max) {
value = max;
}
return value;
}
示例7: zoom
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Zooms in on a selected region.
*
* @param selection the selected region.
*/
public void zoom(Rectangle2D selection) {
// get the origin of the zoom selection in the Java2D space used for
// drawing the chart (that is, before any scaling to fit the panel)
Point2D selectOrigin = translateScreenToJava2D(new Point(
(int) Math.ceil(selection.getX()),
(int) Math.ceil(selection.getY())));
PlotRenderingInfo plotInfo = this.info.getPlotInfo();
Rectangle2D scaledDataArea = getScreenDataArea(
(int) selection.getCenterX(), (int) selection.getCenterY());
if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) {
double hLower = (selection.getMinX() - scaledDataArea.getMinX())
/ scaledDataArea.getWidth();
double hUpper = (selection.getMaxX() - scaledDataArea.getMinX())
/ scaledDataArea.getWidth();
double vLower = (scaledDataArea.getMaxY() - selection.getMaxY())
/ scaledDataArea.getHeight();
double vUpper = (scaledDataArea.getMaxY() - selection.getMinY())
/ scaledDataArea.getHeight();
Plot p = this.chart.getPlot();
if (p instanceof Zoomable) {
Zoomable z = (Zoomable) p;
if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
}
else {
z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
}
}
}
}
示例8: drawRangeLine
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Draws a line perpendicular to 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.
* @param paint the paint.
* @param stroke the stroke.
*/
public void drawRangeLine(Graphics2D g2,
XYPlot plot,
ValueAxis axis,
Rectangle2D dataArea,
double value,
Paint paint,
Stroke stroke) {
Range range = axis.getRange();
if (!range.contains(value)) {
return;
}
PlotOrientation orientation = plot.getOrientation();
Line2D line = null;
double v = axis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge());
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);
}
g2.setPaint(paint);
g2.setStroke(stroke);
g2.draw(line);
}
示例9: 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 plotArea.
*
* @param value the data value.
* @param area the area for plotting the data.
* @param edge the axis location.
*
* @return The Java2D coordinate.
*
* @see #java2DToValue(double, Rectangle2D, RectangleEdge)
*/
public double valueToJava2D(double value, 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)) {
max = area.getMinY();
min = area.getMaxY();
}
if (isInverted()) {
return max
- ((value - axisMin) / (axisMax - axisMin)) * (max - min);
}
else {
return min
+ ((value - axisMin) / (axisMax - axisMin)) * (max - min);
}
}
示例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.
*
* @see #drawDomainGridline(Graphics2D, CategoryPlot, Rectangle2D, double)
*
*/
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);
}
示例11: 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;
}
示例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 plotArea.
*
* @param java2DValue the coordinate in Java2D space.
* @param plotArea the area in which the data is plotted.
* @param edge the axis location.
*
* @return the data value.
*/
public double java2DToValue(double java2DValue, Rectangle2D plotArea, RectangleEdge edge) {
Range range = getRange();
double axisMin = switchedLog10(range.getLowerBound());
double axisMax = switchedLog10(range.getUpperBound());
double plotMin = 0.0;
double plotMax = 0.0;
if (RectangleEdge.isTopOrBottom(edge)) {
plotMin = plotArea.getX();
plotMax = plotArea.getMaxX();
}
else if (RectangleEdge.isLeftOrRight(edge)) {
plotMin = plotArea.getMaxY();
plotMax = plotArea.getMinY();
}
if (isInverted()) {
return Math.pow(
10, axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)
);
}
else {
return Math.pow(
10, axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)
);
}
}
示例13: 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 plotArea.
* Note that it is possible for the coordinate to fall outside the
* plotArea.
*
* @param value the data value.
* @param plotArea the area for plotting the data.
* @param edge the axis location.
*
* @return the Java2D coordinate.
*/
public double valueToJava2D(double value, Rectangle2D plotArea, RectangleEdge edge) {
Range range = getRange();
double axisMin = switchedLog10(range.getLowerBound());
double axisMax = switchedLog10(range.getUpperBound());
double min = 0.0;
double max = 0.0;
if (RectangleEdge.isTopOrBottom(edge)) {
min = plotArea.getMinX();
max = plotArea.getMaxX();
}
else if (RectangleEdge.isLeftOrRight(edge)) {
min = plotArea.getMaxY();
max = plotArea.getMinY();
}
value = switchedLog10(value);
if (isInverted()) {
return max - (((value - axisMin) / (axisMax - axisMin)) * (max - min));
}
else {
return min + (((value - axisMin) / (axisMax - axisMin)) * (max - min));
}
}
示例14: valueToJava2D
import java.awt.geom.Rectangle2D; //导入方法依赖的package包/类
/**
* Converts a value on the axis scale to a Java2D coordinate relative to
* the given <code>area</code>, based on the axis running along the
* specified <code>edge</code>.
*
* @param value the data value.
* @param area the area.
* @param edge the edge.
*
* @return The Java2D coordinate corresponding to <code>value</code>.
*/
public double valueToJava2D(double value, Rectangle2D area,
RectangleEdge edge) {
Range range = getRange();
double axisMin = calculateLog(range.getLowerBound());
double axisMax = calculateLog(range.getUpperBound());
value = calculateLog(value);
double min = 0.0;
double max = 0.0;
if (RectangleEdge.isTopOrBottom(edge)) {
min = area.getX();
max = area.getMaxX();
}
else if (RectangleEdge.isLeftOrRight(edge)) {
max = area.getMinY();
min = area.getMaxY();
}
if (isInverted()) {
return max
- ((value - axisMin) / (axisMax - axisMin)) * (max - min);
}
else {
return min
+ ((value - axisMin) / (axisMax - axisMin)) * (max - min);
}
}
示例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);
}
}