List of usage examples for java.awt.geom Ellipse2D.Double getY
public abstract double getY();
From source file:edu.ucla.stat.SOCR.motionchart.MotionBubbleRenderer.java
/** * Translates the shape so that it displays correctly given the plot and dataArea. * * @param shape the shape to translate * @param plot the plot that will be used to translate the shape * @param dataArea the dataArea that the shape will be translated to * @return The translated shape */// w ww . j a v a 2 s.c o m @SuppressWarnings({ "SuspiciousNameCombination" }) protected Ellipse2D.Double translateShape(Ellipse2D.Double shape, XYPlot plot, Rectangle2D dataArea) { Ellipse2D.Double circle = null; //double x = shape.getCenterX(); //double y = shape.getCenterY(); double z = shape.getWidth(); PlotOrientation orientation = plot.getOrientation(); ValueAxis domainAxis = plot.getDomainAxis(); ValueAxis rangeAxis = plot.getRangeAxis(); RectangleEdge domainAxisLocation = plot.getDomainAxisEdge(); RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge(); double transX1 = domainAxis.valueToJava2D(shape.getX(), dataArea, domainAxisLocation); double transX2 = domainAxis.valueToJava2D(shape.getX() + shape.getWidth(), dataArea, domainAxisLocation); //The upper-left corner is the lower-left on the graph (screen origin vs. graph origin) double transY1 = rangeAxis.valueToJava2D(shape.getY() + shape.getHeight(), dataArea, rangeAxisLocation); double transY2 = rangeAxis.valueToJava2D(shape.getY(), dataArea, rangeAxisLocation); double width = z * domainAxis.getRange().getLength() * domainZoomMultiplier * SIZE_MULTIPLIER; double height = z * rangeAxis.getRange().getLength() * rangeZoomMultiplier * SIZE_MULTIPLIER; double transWidth = domainAxis.lengthToJava2D(width, dataArea, domainAxisLocation);//transX2 - transX1; double transHeight = rangeAxis.lengthToJava2D(height, dataArea, rangeAxisLocation);//transY2 - transY1; double transX = (transX1 + transX2) / 2.0; double transY = (transY1 + transY2) / 2.0; switch (getScaleType()) { case SCALE_ON_DOMAIN_AXIS: transHeight = transWidth; break; case SCALE_ON_RANGE_AXIS: transWidth = transHeight; break; default: break; } transWidth = Math.abs(transWidth); transHeight = Math.abs(transHeight); if (orientation == PlotOrientation.VERTICAL) { circle = new Ellipse2D.Double(transX - transWidth / 2.0, transY - transHeight / 2.0, transWidth, transHeight); } else if (orientation == PlotOrientation.HORIZONTAL) { circle = new Ellipse2D.Double(transY - transHeight / 2.0, transX - transWidth / 2.0, transHeight, transWidth); } return circle; }