コード例 #1
0
ファイル: Well.java プロジェクト: RoboSquirt/java
  /**
   * Called by the dispatcher, tells its well to paint itself at the proper location.
   *
   * @param g - graphics to paint on
   * @param sF - scale factor from cm to pixels
   */
  public void paint(Graphics g, double sF, boolean isRotated) {

    // get the graphics objects
    Graphics2D g2d = (Graphics2D) g;
    AffineTransform at = new AffineTransform();

    // draw well's outline
    at.translate(parentPlate.getTLcorner().getX() * sF, parentPlate.getTLcorner().getY() * sF);
    if (isRotated) {
      at.translate(parentPlate.getPlateSpecs().getBorderDimensions().getY() * sF, 0);
      at.rotate(Math.PI / 2);
    }
    at.translate(
        (relativeLocation.getX() - diameter / 2) * sF,
        (relativeLocation.getY() - diameter / 2) * sF);
    at.scale(sF, sF);

    g2d.setTransform(at);
    g2d.setColor(Color.BLACK);
    g2d.drawOval(0, 0, (int) diameter, (int) diameter);

    // highlight well if it is selected
    if (isSelected) {
      g2d.setColor(Color.LIGHT_GRAY);
      g2d.fillOval(0, 0, (int) diameter, (int) diameter);
    }
  }
コード例 #2
0
ファイル: Well.java プロジェクト: RoboSquirt/java
 /** Returns the well's position in cm, with all modifiers. */
 public Point2D getAbsoluteLocation() {
   if (parentPlate.isRotated) {
     return new Point2D.Double(
         parentPlate.getTLcorner().getX()
             + parentPlate.getDimensions().getY()
             - relativeLocation.getY(),
         parentPlate.getTLcorner().getY() + relativeLocation.getX());
   } else {
     return new Point2D.Double(
         parentPlate.getTLcorner().getX() + relativeLocation.getX(),
         parentPlate.getTLcorner().getY() + relativeLocation.getY());
   }
 }
コード例 #3
0
ファイル: Well.java プロジェクト: RoboSquirt/java
 /** @return amount of liquid each well can hold, as per plate specifications */
 public double getMaxVolume() {
   return parentPlate.getMaxWellVolume();
 }