Exemplo n.º 1
0
 /**
  * Compares two ellipses and returns <code>true</code> if they are equal or both <code>null</code>
  * .
  *
  * @param e1 the first ellipse (<code>null</code> permitted).
  * @param e2 the second ellipse (<code>null</code> permitted).
  * @return A boolean.
  */
 public static boolean equal(final Ellipse2D e1, final Ellipse2D e2) {
   if (e1 == null) {
     return (e2 == null);
   }
   if (e2 == null) {
     return false;
   }
   if (!e1.getFrame().equals(e2.getFrame())) {
     return false;
   }
   return true;
 }
 /**
  * Draws the waferedge, including the notch.
  *
  * @param g2 the graphics device.
  * @param plotArea the plot area.
  */
 protected void drawWaferEdge(Graphics2D g2, Rectangle2D plotArea) {
   // draw the wafer
   Ellipse2D waferEdge = getWaferEdge(plotArea);
   g2.setColor(Color.black);
   g2.draw(waferEdge);
   // calculate and draw the notch
   // horizontal orientation is considered notch right
   // vertical orientation is considered notch down
   Arc2D notch;
   Rectangle2D waferFrame = waferEdge.getFrame();
   double notchDiameter = waferFrame.getWidth() * 0.04;
   if (this.orientation == PlotOrientation.HORIZONTAL) {
     Rectangle2D notchFrame =
         new Rectangle2D.Double(
             waferFrame.getX() + waferFrame.getWidth() - (notchDiameter / 2),
             waferFrame.getY() + (waferFrame.getHeight() / 2) - (notchDiameter / 2),
             notchDiameter,
             notchDiameter);
     notch = new Arc2D.Double(notchFrame, 90d, 180d, Arc2D.OPEN);
   } else {
     Rectangle2D notchFrame =
         new Rectangle2D.Double(
             waferFrame.getX() + (waferFrame.getWidth() / 2) - (notchDiameter / 2),
             waferFrame.getY() + waferFrame.getHeight() - (notchDiameter / 2),
             notchDiameter,
             notchDiameter);
     notch = new Arc2D.Double(notchFrame, 0d, 180d, Arc2D.OPEN);
   }
   g2.setColor(Color.white);
   g2.fill(notch);
   g2.setColor(Color.black);
   g2.draw(notch);
 }