Example #1
0
  /**
   * Draws the needle.
   *
   * @param g2 the graphics device.
   * @param plotArea the plot area.
   * @param rotate the rotation point.
   * @param angle the angle.
   */
  @Override
  protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea, Point2D rotate, double angle) {

    Area shape;
    GeneralPath pointer = new GeneralPath();

    int minY = (int) (plotArea.getMinY());
    // int maxX = (int) (plotArea.getMaxX());
    int maxY = (int) (plotArea.getMaxY());
    int midX = (int) (plotArea.getMinX() + (plotArea.getWidth() / 2));
    // int midY = (int) (plotArea.getMinY() + (plotArea.getHeight() / 2));
    int lenX = (int) (plotArea.getWidth() / 10);
    if (lenX < 2) {
      lenX = 2;
    }

    pointer.moveTo(midX - lenX, maxY - lenX);
    pointer.lineTo(midX + lenX, maxY - lenX);
    pointer.lineTo(midX, minY + lenX);
    pointer.closePath();

    lenX = 4 * lenX;
    Ellipse2D circle = new Ellipse2D.Double(midX - lenX / 2, plotArea.getMaxY() - lenX, lenX, lenX);

    shape = new Area(circle);
    shape.add(new Area(pointer));
    if ((rotate != null) && (angle != 0)) {
      /// we have rotation
      getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
      shape.transform(getTransform());
    }

    defaultDisplay(g2, shape);
  }
Example #2
0
  public void paintText(Graphics g, int x, int y, String title) {
    x += paintIcon(g, x, y);
    Graphics2D g2D = (Graphics2D) g;
    Shape savedClip = g2D.getClip();
    Color fc = AbstractLookAndFeel.getWindowTitleForegroundColor();
    if (fc.equals(Color.white)) {
      Color bc = AbstractLookAndFeel.getWindowTitleColorDark();
      g2D.setColor(bc);
      JTattooUtilities.drawString(rootPane, g, title, x - 1, y - 1);
      g2D.setColor(ColorHelper.darker(bc, 30));
      JTattooUtilities.drawString(rootPane, g, title, x + 1, y + 1);
    }
    g.setColor(fc);

    Area clipArea = new Area(new Rectangle2D.Double(x, 0, getWidth(), getHeight() / 2));
    clipArea.intersect(new Area(savedClip));
    g2D.setClip(clipArea);
    JTattooUtilities.drawString(rootPane, g, title, x, y);

    clipArea = new Area(new Rectangle2D.Double(x, (getHeight() / 2), getWidth(), getHeight()));
    clipArea.intersect(new Area(savedClip));
    g2D.setClip(clipArea);
    g.setColor(ColorHelper.darker(fc, 20));
    JTattooUtilities.drawString(rootPane, g, title, x, y);

    g2D.setClip(savedClip);
  }
  private synchronized void initBars() {
    if (bars != null) {
      return;
    }

    bars = new Area[BAR_COUNT];

    final double fixedAngle = 2.0 * Math.PI / (double) bars.length;
    for (int i = 0; i < bars.length; ++i) {
      Area primitive = makeBar();

      Point2D.Double center = new Point2D.Double((double) DIAMETER / 2, (double) DIAMETER / 2);
      AffineTransform toCircle =
          AffineTransform.getRotateInstance(
              ((double) -i) * fixedAngle, center.getX(), center.getY());
      AffineTransform toBorder = AffineTransform.getTranslateInstance(45.0, -6.0);

      AffineTransform toScale = AffineTransform.getScaleInstance(0.1, 0.1);

      primitive.transform(toBorder);
      primitive.transform(toCircle);
      primitive.transform(toScale);

      bars[i] = primitive;
    }
  }
Example #4
0
 @Override
 public boolean apply(final Layer la, final Area roi, final mpicbg.models.CoordinateTransform ict)
     throws Exception {
   double[] fp = null;
   mpicbg.models.CoordinateTransform chain = null;
   Area localroi = null;
   AffineTransform inverse = null;
   for (final Item item : al_items) {
     final long[] p_layer = item.p_layer;
     final double[][] p = item.p;
     for (int i = 0; i < item.n_points; i++) {
       if (p_layer[i] == la.getId()) {
         if (null == localroi) {
           inverse = this.at.createInverse();
           localroi = roi.createTransformedArea(inverse);
         }
         if (localroi.contains(p[0][i], p[1][i])) {
           if (null == chain) {
             chain = M.wrap(this.at, ict, inverse);
             fp = new double[2];
           }
           // Transform the point
           M.apply(chain, p, i, fp);
         }
       }
     }
   }
   if (null != chain) calculateBoundingBox(la);
   return true;
 }
Example #5
0
 /**
  * Returns the currently-defined blob.
  *
  * @return shape drawn
  */
 public Shape getBlob() {
   Area area = new Area();
   for (Iterator it = blobs_.iterator(); it.hasNext(); ) {
     area.add(new Area((Shape) it.next()));
   }
   return simplify(area);
 }
Example #6
0
    /**
     * Draws the needle.
     *
     * @param g2  the graphics device.
     * @param plotArea  the plot area.
     * @param rotate  the rotation point.
     * @param angle  the angle.
     */
    protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea,
                              Point2D rotate, double angle) {

        Arc2D shape = new Arc2D.Double(Arc2D.PIE);
        double radius = plotArea.getHeight();
        double halfX = plotArea.getWidth() / 2;
        double diameter = 2 * radius;

        shape.setFrame(plotArea.getMinX() + halfX - radius ,
                       plotArea.getMinY() - radius,
                       diameter, diameter);
        radius = Math.toDegrees(Math.asin(halfX / radius));
        shape.setAngleStart(270 - radius);
        shape.setAngleExtent(2 * radius);

        Area s = new Area(shape);

        if ((rotate != null) && (angle != 0)) {
            /// we have rotation houston, please spin me
            getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
            s.transform(getTransform());
        }

        defaultDisplay(g2, s);
    }
Example #7
0
  /** Refine segmentation with ADD/SUB regions of interests */
  private synchronized void refine() {
    if (controlPanel.status != ControlJPanel.SEGMENTATED_STATUS) return;

    if (controlPanel.addJRadioButton.isSelected()) addRoi = imp.getRoi();
    else subRoi = imp.getRoi();

    if (null != addRoi) {
      final float alpha = controlPanel.addThreshold.getValue() / 100.0f;
      final Shape shape = ShapeRoiHelper.getShape(new ShapeRoi(addRoi));
      final AffineTransform trans = new AffineTransform();
      trans.translate(addRoi.getBounds().getX(), addRoi.getBounds().getY());
      final Area area = new Area(shape);
      area.transform(trans);
      siox.subpixelRefine(area, SioxSegmentator.ADD_EDGE, alpha, (float[]) confMatrix.getPixels());
    }
    if (null != subRoi) {
      final float alpha = controlPanel.subThreshold.getValue() / 100.0f;
      final Shape shape = ShapeRoiHelper.getShape(new ShapeRoi(subRoi));
      final AffineTransform trans = new AffineTransform();
      trans.translate(subRoi.getBounds().getX(), subRoi.getBounds().getY());
      final Area area = new Area(shape);
      area.transform(trans);
      siox.subpixelRefine(area, SioxSegmentator.SUB_EDGE, alpha, (float[]) confMatrix.getPixels());
    }

    updateResult();
  }
  /**
   * Builds the circular shape and returns the result as an array of <code>Area</code>. Each <code>
   * Area</code> is one of the bars composing the shape.
   */
  private Area[] buildTicker() {
    width = this.getPreferredSize().getWidth();
    height = this.getPreferredSize().getHeight();

    Area[] ticker = new Area[barsCount];
    Point2D.Double center = new Point2D.Double((double) width / 2, (double) height / 2);
    double fixedAngle = 2.0 * Math.PI / ((double) barsCount);

    for (double i = 0.0; i < (double) barsCount; i++) {
      Area primitive = buildPrimitive();

      AffineTransform toCenter = AffineTransform.getTranslateInstance(center.getX(), center.getY());
      AffineTransform toBorder = AffineTransform.getTranslateInstance(45.0 / 8, -6.0 / 8);
      AffineTransform toCircle =
          AffineTransform.getRotateInstance(-i * fixedAngle, center.getX(), center.getY());

      AffineTransform toWheel = new AffineTransform();
      toWheel.concatenate(toCenter);
      toWheel.concatenate(toBorder);

      primitive.transform(toWheel);
      primitive.transform(toCircle);

      ticker[(int) i] = primitive;
    }

    return ticker;
  }
  private void drawAvatarBullet(
      Graphics2D g2, double x, double y, double bulletWidth, double bulletHeight) {
    RoundRectangle2D bullet =
        new RoundRectangle2D.Double(
            0.0, 0.0, bulletWidth, bulletHeight, bulletHeight, bulletHeight);
    Ellipse2D curve =
        new Ellipse2D.Double(-20.0, bulletHeight / 2.0, bulletWidth + 40.0, bulletHeight);

    g2.translate(x, y);

    g2.translate(-1, -2);
    g2.setColor(new Color(0, 0, 0, 170));
    g2.fill(
        new RoundRectangle2D.Double(
            0.0, 0.0, bulletWidth + 2, bulletHeight + 4, bulletHeight + 4, bulletHeight + 4));
    g2.translate(1, 2);

    Color startColor = new Color(10, 0, 40);
    Color endColor = new Color(175, 165, 225);

    Paint paint = g2.getPaint();
    g2.setPaint(new GradientPaint(0.0f, 0.0f, startColor, 0.0f, (float) bulletHeight, endColor));
    g2.fill(bullet);

    startColor = new Color(5, 0, 50);
    endColor = new Color(105, 100, 155);
    g2.setPaint(new GradientPaint(0.0f, 0.0f, startColor, 0.0f, (float) bulletHeight, endColor));

    Area area = new Area(bullet);
    area.intersect(new Area(curve));
    g2.fill(area);

    g2.setPaint(paint);
    g2.translate(-x, -y);
  }
 public void paint(Graphics g) {
   Graphics2D g_2d = (Graphics2D) g;
   Ellipse2D ellipse = new Ellipse2D.Double(0, 2, 80, 80);
   Rectangle2D rect = new Rectangle2D.Double(40, 2, 80, 80);
   Area a1 = new Area(ellipse);
   Area a2 = new Area(rect);
   a1.intersect(a2); // "Óë"
   g_2d.fill(a1);
   ellipse.setFrame(130, 2, 80, 80);
   rect.setFrame(170, 2, 80, 80);
   a1 = new Area(ellipse);
   a2 = new Area(rect);
   a1.add(a2); // "»ò"
   g_2d.draw(a1);
   ellipse.setFrame(0, 90, 80, 80);
   rect.setFrame(40, 90, 80, 80);
   a1 = new Area(ellipse);
   a2 = new Area(rect);
   a1.subtract(a2); // "²î"
   g_2d.draw(a1);
   ellipse.setFrame(130, 90, 80, 80);
   rect.setFrame(170, 90, 80, 80);
   a1 = new Area(ellipse);
   a2 = new Area(rect);
   a1.exclusiveOr(a2); // "Òì»ò"
   g_2d.fill(a1);
 }
Example #11
0
 @Override
 public Rectangle2D getOriginalSelectionBounds(double x, double y) {
   Shape s = getShape();
   AffineTransform af = new AffineTransform();
   af.setToRotation(-totalRotation, x, y);
   Area a = new Area(af.createTransformedShape(s));
   return a.getBounds2D();
 }
Example #12
0
  private static final Shape createMask(int width, int height) {
    Shape outside = new Rectangle2D.Double(0, 0, width, height);
    Shape inside = new RoundRectangle2D.Double(10, 10, width - 20, height - 20, 50, 50);

    Area area = new Area(outside);
    area.subtract(new Area(inside));

    return area;
  }
Example #13
0
 public static void fillComponent(Graphics g, Component c, int x, int y, int w, int h) {
   Graphics2D g2D = (Graphics2D) g;
   Shape savedClip = g2D.getClip();
   Area clipArea = new Area(new Rectangle2D.Double(x, y, w, h));
   clipArea.intersect(new Area(savedClip));
   g2D.setClip(clipArea);
   fillComponent(g, c);
   g2D.setClip(savedClip);
 }
Example #14
0
 public Point2D getCenterPoint() {
   if (centerPoint == null) {
     centerPoint =
         new Point2D.Double(
             area.getBounds().x + area.getBounds().width / 2,
             area.getBounds().y + area.getBounds().height / 2);
   }
   return centerPoint;
 }
 /**
  * Test whether the given region intersects with this area.
  *
  * @param region the region to test
  * @param thisArea an area object for this region
  * @return true if the two regions intersect
  */
 protected boolean intersects(ProtectedRegion region, Area thisArea) {
   if (intersectsBoundingBox(region)) {
     Area testArea = region.toArea();
     testArea.intersect(thisArea);
     return !testArea.isEmpty();
   } else {
     return false;
   }
 }
Example #16
0
 /** @see Graphics2D#hit(Rectangle, Shape, boolean) */
 public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
   if (onStroke) {
     s = stroke.createStrokedShape(s);
   }
   s = transform.createTransformedShape(s);
   Area area = new Area(s);
   if (clip != null) area.intersect(clip);
   return area.intersects(rect.x, rect.y, rect.width, rect.height);
 }
 public List<IDIYComponent<?>> findComponentsAt(Point point, Project project) {
   List<IDIYComponent<?>> components = new ArrayList<IDIYComponent<?>>();
   for (int i = 0; i < project.getComponents().size(); i++) {
     Area area = componentAreaMap.get(project.getComponents().get(i));
     if (area != null && area.contains(point)) {
       components.add(0, project.getComponents().get(i));
     }
   }
   return components;
 }
 private static Area makeBar() {
   int barThickness = 20;
   Rectangle2D.Double body = new Rectangle2D.Double(6, 0, 30, barThickness);
   Ellipse2D.Double head = new Ellipse2D.Double(0, 0, barThickness, barThickness);
   Ellipse2D.Double tail = new Ellipse2D.Double(30, 0, barThickness, barThickness);
   Area tick = new Area(body);
   tick.add(new Area(head));
   tick.add(new Area(tail));
   return tick;
 }
  /** Builds a bar. */
  private Area buildPrimitive() {
    Rectangle2D.Double body = new Rectangle2D.Double(6 / 7, 0, 30 / 7, 12 / 7);
    Ellipse2D.Double head = new Ellipse2D.Double(0, 0, 12 / 7, 12 / 7);
    Ellipse2D.Double tail = new Ellipse2D.Double(30 / 7, 0, 12 / 7, 12 / 7);

    Area tick = new Area(body);
    tick.add(new Area(head));
    tick.add(new Area(tail));

    return tick;
  }
Example #20
0
 /**
  * Sets the clip on a graphics object by merging a supplied clip with the existing one. The new
  * clip will be an intersection of the old clip and the supplied clip. The old clip shape will be
  * returned. This is useful for resetting the old clip after an operation is performed.
  *
  * @param g the graphics object to update
  * @param clip a new clipping region to add to the graphics clip.
  * @return the current clipping region of the supplied graphics object. This may return {@code
  *     null} if the current clip is {@code null}.
  * @throws NullPointerException if any parameter is {@code null}
  */
 public static Shape mergeClip(Graphics g, Shape clip) {
   Shape oldClip = g.getClip();
   if (oldClip == null) {
     g.setClip(clip);
     return null;
   }
   Area area = new Area(oldClip);
   area.intersect(new Area(clip)); // new Rectangle(0,0,width,height)));
   g.setClip(area);
   return oldClip;
 }
Example #21
0
 public void clip(Shape s) {
   if (s == null) {
     return;
   }
   if (_clippingArea == null) {
     setClip(s);
   } else {
     Area a = new Area(_clippingArea);
     a.intersect(new Area(s));
     setClip(a);
   }
 }
    public void paintBorder(final Graphics g, final int x, final int y, final int w, final int h) {
      ((Graphics2D) g)
          .setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

      g.setColor(focusColor);
      rect.setRoundRect(x + 0.6, y + 0.6, w - 1.2, h - 1.2, outsideRadius, outsideRadius);
      area.reset();
      area.add(new Area(rect));
      rect.setRoundRect(x + 2, y + 2, w - 4, h - 4, insideRadius, insideRadius);
      area.subtract(new Area(rect));
      ((Graphics2D) g).fill(area);
    }
Example #23
0
  /**
   * Like copyFrom, but will only copy the area specified.
   *
   * @see TileLayer#copyFrom(MapLayer)
   * @param other
   * @param mask
   */
  @Override
  public void maskedCopyFrom(MapLayer other, Area mask) {
    Rectangle boundBox = mask.getBounds();

    for (int y = boundBox.y; y < boundBox.y + boundBox.height; y++) {
      for (int x = boundBox.x; x < boundBox.x + boundBox.width; x++) {
        if (mask.contains(x, y)) {
          setTileAt(x, y, ((TileLayer) other).getTileAt(x, y));
        }
      }
    }
  }
Example #24
0
  /**
   * Draw all primitives in this layer but do not draw modified ones (they are drawn by the edit
   * layer). Draw nodes last to overlap the ways they belong to.
   */
  @Override
  public void paint(final Graphics g, final MapView mv) {
    boolean active = true;
    boolean inactive = false;
    boolean virtual = false;

    // draw the hatched area for non-downloaded region. only draw if we're
    // the active
    // and bounds are defined; don't draw for inactive layers or loaded GPX
    // files etc
    if (active
        && Main.pref.getBoolean("draw.data.downloaded_area", true)
        && !data.dataSources.isEmpty()) {
      // initialize area with current viewport
      Rectangle b = Main.map.mapView.getBounds();
      // on some platforms viewport bounds seem to be offset from the
      // left,
      // over-grow it just to be sure
      b.grow(100, 100);
      Area a = new Area(b);

      // now succesively subtract downloaded areas
      for (DataSource src : data.dataSources) {
        if (src.bounds != null && !src.bounds.min.equals(src.bounds.max)) {
          EastNorth en1 = Main.proj.latlon2eastNorth(src.bounds.min);
          EastNorth en2 = Main.proj.latlon2eastNorth(src.bounds.max);
          Point p1 = mv.getPoint(en1);
          Point p2 = mv.getPoint(en2);
          Rectangle r =
              new Rectangle(
                  Math.min(p1.x, p2.x),
                  Math.min(p1.y, p2.y),
                  Math.abs(p2.x - p1.x),
                  Math.abs(p2.y - p1.y));
          a.subtract(new Area(r));
        }
      }

      // paint remainder
      ((Graphics2D) g).setPaint(hatched);
      ((Graphics2D) g).fill(a);
    }

    SimplePaintVisitor painter;
    if (Main.pref.getBoolean("draw.wireframe")) painter = new SimplePaintVisitor();
    else painter = new MapPaintVisitor();
    painter.setGraphics(g);
    painter.setNavigatableComponent(mv);
    painter.inactive = inactive;
    painter.visitAll(data, virtual);
    // Main.map.conflictDialog.paintConflicts(g, mv);
  }
Example #25
0
  /**
   * Like mergeOnto, but will only copy the area specified.
   *
   * @see TileLayer#mergeOnto(MapLayer)
   * @param other
   * @param mask
   */
  @Override
  public void maskedMergeOnto(MapLayer other, Area mask) {
    Rectangle boundBox = mask.getBounds();

    for (int y = boundBox.y; y < boundBox.y + boundBox.height; y++) {
      for (int x = boundBox.x; x < boundBox.x + boundBox.width; x++) {
        Tile tile = ((TileLayer) other).getTileAt(x, y);
        if (mask.contains(x, y) && tile != null) {
          setTileAt(x, y, tile);
        }
      }
    }
  }
Example #26
0
 public void addTextSprite(TextSprite nextSprite) {
   Area area = nextSprite.getGlyphOutline();
   // When TJ/Tj and Other text operators are called on a font using
   // modes 5-7 we don't actually craw anything but we still need to
   // transform the glyph to the correct coordinate, so each
   // outline is place correctly with in the total outline shape.
   Area tmp = area.createTransformedArea(nextSprite.getGraphicStateTransform());
   if (path == null) {
     path = new GeneralPath(tmp);
   } else {
     path.append(tmp, false);
   }
 }
Example #27
0
  /**
   * Returns inner shade nine-patch icon.
   *
   * @param shadeWidth shade width
   * @param round corners round
   * @param shadeOpacity shade opacity
   * @return inner shade nine-patch icon
   */
  public static NinePatchIcon createInnerShadeIcon(
      final int shadeWidth, final int round, final float shadeOpacity) {
    // Calculating width for temprorary image
    final int inner = Math.max(shadeWidth, round);
    int width = shadeWidth * 2 + inner * 2;

    // Creating template image
    final BufferedImage bi = new BufferedImage(width, width, BufferedImage.TYPE_INT_ARGB);
    final Graphics2D ig = bi.createGraphics();
    GraphicsUtils.setupAntialias(ig);
    final Area area = new Area(new Rectangle(0, 0, width, width));
    area.exclusiveOr(
        new Area(
            new RoundRectangle2D.Double(
                shadeWidth,
                shadeWidth,
                width - shadeWidth * 2,
                width - shadeWidth * 2,
                round * 2,
                round * 2)));
    ig.setPaint(Color.BLACK);
    ig.fill(area);
    ig.dispose();

    // Creating shade image
    final ShadowFilter sf = new ShadowFilter(shadeWidth, 0, 0, shadeOpacity);
    final BufferedImage shade = sf.filter(bi, null);

    // Clipping shade image
    final Graphics2D g2d = shade.createGraphics();
    GraphicsUtils.setupAntialias(g2d);
    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_IN));
    g2d.setPaint(FlatLafStyleConstants.transparent);
    g2d.fill(area);
    g2d.dispose();

    final BufferedImage croppedShade =
        shade.getSubimage(shadeWidth, shadeWidth, width - shadeWidth * 2, width - shadeWidth * 2);
    width = croppedShade.getWidth();

    // Creating nine-patch icon
    final NinePatchIcon ninePatchIcon = NinePatchIcon.create(croppedShade);
    ninePatchIcon.addHorizontalStretch(0, inner, true);
    ninePatchIcon.addHorizontalStretch(inner + 1, width - inner - 1, false);
    ninePatchIcon.addHorizontalStretch(width - inner, width, true);
    ninePatchIcon.addVerticalStretch(0, inner, true);
    ninePatchIcon.addVerticalStretch(inner + 1, width - inner - 1, false);
    ninePatchIcon.addVerticalStretch(width - inner, width, true);
    ninePatchIcon.setMargin(shadeWidth);
    return ninePatchIcon;
  }
Example #28
0
  /** {@inheritDoc} */
  @Override
  public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {

    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHints(GraphicsUtil.ANTIALIAS_HINT);

    // Define the content rectangle
    int x0 = pointerLeft ? pad + pointerWidth : pad;
    RoundRectangle2D.Double content =
        new RoundRectangle2D.Double(
            x0, pad, width - 2 * pad - pointerWidth, height - 2 * pad, cornerRadius, cornerRadius);

    // Define the pointer triangle
    int xp = pointerLeft ? pad + pointerWidth : width - pad - pointerWidth;
    int yp = pad + height - pointerFromBottom;
    Polygon pointer = new Polygon();
    pointer.addPoint(xp, yp);
    pointer.addPoint(xp, yp - pointerHeight);
    pointer.addPoint(xp + pointerWidth * (pointerLeft ? -1 : 1), yp - pointerHeight / 2);

    // Combine content rectangle and pointer into one area
    Area area = new Area(content);
    area.add(new Area(pointer));

    // Fill the pop-up background
    Color col = pointerLeft ? c.getBackground().darker() : c.getBackground().brighter();
    g2.setColor(col);
    g2.fill(area);

    if (message.getSeverity() == MaritimeTextingNotificationSeverity.WARNING
        || message.getSeverity() == MaritimeTextingNotificationSeverity.ALERT
        || message.getSeverity() == MaritimeTextingNotificationSeverity.SAFETY) {
      g2.setStroke(new BasicStroke(2.0f));

      switch (message.getSeverity()) {
        case WARNING:
          g2.setColor(WARN_COLOR);
        case ALERT:
          g2.setColor(ALERT_COLOR);
        case SAFETY:
          g2.setColor(SAFETY_COLOR);
        default:
          g2.setColor(WARN_COLOR);
      }

      // g2.setColor(message.getSeverity() == MaritimeTextingNotificationSeverity.WARNING ?
      // WARN_COLOR : ALERT_COLOR);

      g2.draw(area);
    }
  }
Example #29
0
 // Morteza2011*****************************************************************
 public static SOSArea reMerge(SOSArea blockade1, SOSArea blockade2) {
   java.awt.geom.Area a1 = new Area(blockade1.getShape());
   java.awt.geom.Area a2 = new Area(blockade2.getShape());
   a1.add(a2);
   int[] apexes = AliGeometryTools.getApexes(a1);
   ArrayList<Edge> edges = new ArrayList<Edge>();
   for (int i = 0; i < apexes.length / 2 - 1; i++) {
     edges.add(new Edge(apexes[i * 2], apexes[i * 2 + 1], apexes[i * 2 + 2], apexes[i * 2 + 3]));
   }
   SOSArea finalArea = new SOSArea(edges);
   finalArea.addReachablityBlockades(blockade1.getReachablityBlockades());
   finalArea.addReachablityBlockades(blockade2.getReachablityBlockades());
   return finalArea;
 }
    @Override
    public Dialog show() {
      Dialog picker = super.show();
      myTimer.start();
      // it seems like it's the lowest value for opacity for mouse events to be processed correctly
      WindowManager.getInstance().setAlphaModeRatio(picker, SystemInfo.isMac ? 0.95f : 0.99f);

      if (SystemInfo.isJavaVersionAtLeast("1.7")) {
        Area area = new Area(new Rectangle(0, 0, DIALOG_SIZE, DIALOG_SIZE));
        area.subtract(new Area(new Rectangle(SIZE / 2 - 1, SIZE / 2 - 1, 3, 3)));
        picker.setShape(area);
      }
      return picker;
    }