Package org.renjin.graphics.geom

Examples of org.renjin.graphics.geom.Rectangle


 
  private boolean xLog;
  private boolean yLog;
 
  public UserWindow() {
    setUserCoordinates(new Rectangle(0, 1, 0, 1));
  }
View Full Code Here


      y2 = coords.getY2();
      logY1 = Math.log10(y1);
      logY2 = Math.log10(y2);
    }
 
    coordinates = new Rectangle(x1, x2, y1, y2);
    logCoordinates = new Rectangle(logX1, logX2, logY1, logY2);
  }
View Full Code Here

    logCoordinates = new Rectangle(logX1, logX2, logY1, logY2);
  }
 
  public Rectangle normalize(Rectangle rect) {
    //TODO: log stuff
    return new Rectangle(
        (rect.getX1() - coordinates.getX1()) / coordinates.getWidth(),
        (rect.getX2() - coordinates.getX1()) / coordinates.getWidth(),
        (rect.getY1() - coordinates.getY1()) / coordinates.getHeight(),
        (rect.getY2() - coordinates.getY1()) / coordinates.getHeight());
  }
View Full Code Here

  public Rectangle getPlotRegion() {
    return getFigureRect().normalize(getPlotRegionRect());
  }

  private Rectangle getPlotRegionRect() {
    Rectangle figureInDevice = getFigureRect();
    Margins innerMarginsInDeviceUnits = innerMargins.multiplyBy(getLineSize());
    Rectangle plotRegionInDeviceUnits = figureInDevice.apply(innerMarginsInDeviceUnits);
    return plotRegionInDeviceUnits;
  }
View Full Code Here

  private Rectangle getFigureRect() {
    return driver.getDeviceRegion().denormalize(getFigureRegion());
  }
 
  public Dimension getPlotDimensions() {
    Rectangle plotRegionInDeviceUnits = getPlotRegionRect();
   
    return plotRegionInDeviceUnits.size().multiplyBy(driver.getInchesPerPixel());
  }
View Full Code Here

public class RectangleTest {

  @Test
  public void denormalize() {
   
    Rectangle rectangle = new Rectangle(0, 150, 0, 200);
    Rectangle denormalized = rectangle.denormalize(rectangle.UNIT_RECT);
   
    assertThat(denormalized, equalTo(rectangle));
   
  }
View Full Code Here

      dd.getParameters()
      .setLineType( LineType.valueOf(lty, i % lty.length()) )
      .setLineWidth( lwd.getElementAsDouble( i % lwd.length() ));

      dd.drawRectangle(new Rectangle(
          xleft.getElementAsDouble(i % xleft.length()),
          xright.getElementAsDouble(i % xright.length()),
          ybottom.getElementAsDouble(i % ybottom.length()),
          ytop.getElementAsDouble(i % ytop.length())),
          fillColor, borderColor);
View Full Code Here

    this.deviceRegion = deviceRegion;
    this.size = size;
  }

  public GraphicsDeviceDriverStub(int widthPixels, int heightPixels) {
    deviceRegion = new Rectangle(0, widthPixels, 0, heightPixels);
    size = new Dimension(widthPixels / 72d, heightPixels / 72d);
  }
View Full Code Here

    return new java.awt.Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
  }

  @Override
  public Dimension getInchesPerPixel() {
    Rectangle bounds = getDeviceRegion();
    return new org.renjin.graphics.geom.Dimension(
        size.getWidth() / bounds.getWidth(),
        size.getHeight() / bounds.getHeight());
  }
View Full Code Here

  }

  @Override
  public Rectangle getDeviceRegion() {
    java.awt.Rectangle bounds = g2d.getDeviceConfiguration().getBounds();
    return new Rectangle(bounds.getMinX(), bounds.getMaxX(), bounds.getMinY(), bounds.getMaxY());
  }
View Full Code Here

TOP

Related Classes of org.renjin.graphics.geom.Rectangle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.