Package java.awt.geom

Examples of java.awt.geom.Line2D


    private void draw(Shape s) {
        followPath(s, STROKE);
    }
   
    protected void drawLine(int x1, int y1, int x2, int y2) {
        Line2D line = new Line2D.Double((double)x1, (double)y1, (double)x2, (double)y2);
        draw(line);
    }
View Full Code Here


   *
   * @return The object.
   */
  public Object createObject()
  {
    final Line2D line = new Line2D.Float();

    final float x1 = getFloatParameter("x1");
    final float x2 = getFloatParameter("x2");
    final float y1 = getFloatParameter("y1");
    final float y2 = getFloatParameter("y2");
    line.setLine(x1, y1, x2, y2);
    return line;
  }
View Full Code Here

  {
    if (!(o instanceof Line2D))
    {
      throw new ObjectFactoryException("The given object is no java.awt.geom.Line2D.");
    }
    final Line2D line = (Line2D) o;
    final float x1 = (float) line.getX1();
    final float x2 = (float) line.getX2();
    final float y1 = (float) line.getY1();
    final float y2 = (float) line.getY2();

    setParameter("x1", new Float(x1));
    setParameter("x2", new Float(x2));
    setParameter("y1", new Float(y1));
    setParameter("y2", new Float(y2));
View Full Code Here

    final boolean draw = styleSheet.getBooleanStyleProperty(ElementStyleKeys.DRAW_SHAPE);
    if (draw && rawObject instanceof Line2D)
    {
      final int lineType;
      final long coordinate;
      final Line2D line = (Line2D) rawObject;

      final boolean vertical = line.getX1() == line.getX2();
      final boolean horizontal = line.getY1() == line.getY2();
      if (vertical && horizontal)
      {
        return null;
      }
      if (vertical)
      {
        lineType = SheetLayoutTableCellDefinition.LINE_HINT_VERTICAL;
        coordinate = StrictGeomUtility.toInternalValue(line.getX1()) + box.getX();
      }
      else if (horizontal)
      {
        lineType = SheetLayoutTableCellDefinition.LINE_HINT_HORIZONTAL;
        coordinate = StrictGeomUtility.toInternalValue(line.getY1()) + box.getY() + shift;
      }
      else
      {
        return null;
      }
View Full Code Here

      if (rawObject instanceof Line2D)
      {
        if (hasBorderEdge(styleSheet))
        {
          final Line2D line = (Line2D) rawObject;
          if (line.getY1() == line.getY2())
          {
            return false;
          }
          else if (line.getX1() == line.getX2())
          {
            return false;
          }
        }
      }
View Full Code Here

      graphics.draw(imageableArea);

      final int pcH = pageDefinition.getPageCountHorizontal();
      final int pcW = pageDefinition.getPageCountVertical();

      final Line2D line = new Line2D.Double();
      for (int splitH = 1; splitH < pcH; splitH += 1)
      {
        final double xPos = gpf.getImageableX() + (splitH * gpf.getImageableWidth());
        line.setLine(xPos, gpf.getImageableY(),
            xPos, gpf.getImageableY() + gpf.getImageableHeight());
        graphics.draw(line);
      }

      for (int splitW = 1; splitW < pcW; splitW += 1)
      {
        final double yPos = gpf.getImageableY() + (splitW * gpf.getImageableHeight());
        line.setLine(gpf.getImageableX(), yPos,
            gpf.getImageableX() + gpf.getImageableWidth(), yPos);
        graphics.draw(line);
      }
    }
View Full Code Here

      final int UnderlineThickness = 50;
      //
      final double d = PdfGraphics2D.asPoints((double) UnderlineThickness, (int) fontSize);
      setStroke(new BasicStroke((float) d));
      y = (float) ((double) (y) + PdfGraphics2D.asPoints((double) (UnderlineThickness), (int) fontSize));
      final Line2D line = new Line2D.Double((double) x, (double) y, (width + x), (double) y);
      draw(line);
    }
  }
View Full Code Here

  /**
   * @see Graphics#drawLine(int, int, int, int)
   */
  public void drawLine(final int x1, final int y1, final int x2, final int y2)
  {
    final Line2D line = new Line2D.Double((double) x1, (double) y1, (double) x2, (double) y2);
    draw(line);
  }
View Full Code Here

  /**
   * @see Graphics#drawPolyline(int[], int[], int)
   */
  public void drawPolyline(final int[] x, final int[] y, final int nPoints)
  {
    final Line2D line = new Line2D.Double(x[0], y[0], x[0], y[0]);
    for (int i = 1; i < nPoints; i++)
    {
      line.setLine(line.getX2(), line.getY2(), x[i], y[i]);
      draw(line);
    }
  }
View Full Code Here

    {
      // here comes the magic - we transform the line into the absolute space;
      // this should preserve the general appearance. Heck, and if not, then
      // it is part of the users responsibility to resolve that. Magic does not
      // solve all problems, you know.
      final Line2D line = new Line2D.Float
          (Math.abs(x1), Math.abs(y1), Math.abs(x2), Math.abs(y2));
      final Rectangle2D shapeBounds = line.getBounds2D();
      final Shape transformedShape =
          ShapeTransform.translateShape(line, -shapeBounds.getX(), -shapeBounds.getY());
      // and use that shape with the user's bounds to create the element.
      final ContentElementFactory elementFactory = new ContentElementFactory();
      elementFactory.setName(name);
View Full Code Here

TOP

Related Classes of java.awt.geom.Line2D

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.