Examples of Point2d


Examples of java.awt.geom.Point2D

      }
    }
    else if (paint instanceof GradientPaint)
    {
      final GradientPaint gp = (GradientPaint) paint;
      final Point2D p1 = gp.getPoint1();
      transform.transform(p1, p1);
      final Point2D p2 = gp.getPoint2();
      transform.transform(p2, p2);
      final Color c1 = gp.getColor1();
      final Color c2 = gp.getColor2();
      final PdfShading shading = PdfShading.simpleAxial(cb.getPdfWriter(), (float) p1.getX(), normalizeY(
          (float) p1.getY()), (float) p2.getX(), normalizeY((float) p2.getY()), c1, c2);
      final PdfShadingPattern pat = new PdfShadingPattern(shading);
      if (fill)
      {
        cb.setShadingFill(pat);
      }
View Full Code Here

Examples of java.awt.geom.Point2D

  private static Line2D resizeLine(final Line2D line,
                                   final double width,
                                   final double height)
  {
    final Line2D newLine = getNormalizedLine(line);
    final Point2D p1 = newLine.getP1();
    final Point2D p2 = newLine.getP2();
    final double normPointX = (p1.getX() - p2.getX());
    final double normPointY = (p1.getY() - p2.getY());
    final double scaleX = (normPointX == 0) ? 1 : width / Math.abs(normPointX);
    final double scaleY = (normPointY == 0) ? 1 : height / Math.abs(normPointY);
    p2.setLocation((p2.getX() - p1.getX()) * scaleX + p1.getX(),
        (p2.getY() - p1.getY()) * scaleY + p1.getY());
    newLine.setLine(p1, p2);
    return newLine;
  }
View Full Code Here

Examples of java.awt.geom.Point2D

   */
  private static Line2D getNormalizedLine(final Line2D line)
  {
    final Line2D lineClone = (Line2D) line.clone();

    final Point2D p1 = line.getP1();
    final Point2D p2 = line.getP2();
    if (p1.getX() < p2.getX())
    {
      return lineClone;
    }
    if (p1.getX() > p2.getX())
    {
      lineClone.setLine(p2, p1);
      return lineClone;
    }
    if (p1.getY() < p2.getY())
    {
      return lineClone;
    }
    lineClone.setLine(p2, p1);
    return lineClone;
View Full Code Here

Examples of java.awt.geom.Point2D

                                      final double x2, final double y2, final int mask2,
                                      final double xmin, final double xmax,
                                      final double ymin, final double ymax)
  {
    final int mask = mask1 ^ mask2;
    Point2D p1 = null;

    if (mask1 == INSIDE)
    {
      // point 1 is internal
      p1 = new Point2D.Double(x1, y1);
      if (mask == 0)
      {
        // both masks are the same, so the second point is inside, too
        final Point2D[] ret = new Point2D[2];
        ret[0] = p1;
        ret[1] = new Point2D.Double(x2, y2);
        return ret;
      }
    }
    else if (mask2 == INSIDE)
    {
      // point 2 is internal
      p1 = new Point2D.Double(x2, y2);
    }

    if ((mask & LEFT) != 0)
    {
      //      System.out.println("Trying left");
      // try to calculate intersection with left line
      final Point2D p = intersect(x1, y1, x2, y2, xmin, ymin, xmin, ymax);
      if (p != null)
      {
        if (p1 == null)
        {
          p1 = p;
        }
        else
        {
          final Point2D[] ret = new Point2D[2];
          ret[0] = p1;
          ret[1] = p;
          return ret;
        }
      }
    }
    if ((mask & RIGHT) != 0)
    {
      //      System.out.println("Trying right");
      // try to calculate intersection with left line
      final Point2D p = intersect(x1, y1, x2, y2, xmax, ymin, xmax, ymax);
      if (p != null)
      {
        if (p1 == null)
        {
          p1 = p;
        }
        else
        {
          final Point2D[] ret = new Point2D[2];
          ret[0] = p1;
          ret[1] = p;
          return ret;
        }
      }
    }
    if (mask1 == (LEFT | BELOW) || mask1 == (RIGHT | BELOW))
    {
      // for exactly these two special cases use different sequence!

      if ((mask & ABOVE) != 0)
      {
        //      System.out.println("Trying top");
        // try to calculate intersection with lower line
        final Point2D p = intersect(x1, y1, x2, y2, xmin, ymax, xmax, ymax);
        if (p != null)
        {
          if (p1 == null)
          {
            p1 = p;
          }
          else
          {
            final Point2D[] ret = new Point2D[2];
            ret[0] = p1;
            ret[1] = p;
            return ret;
          }
        }
      }
      if ((mask & BELOW) != 0)
      {
        //      System.out.println("Trying bottom");
        // try to calculate intersection with lower line
        final Point2D p = intersect(x1, y1, x2, y2, xmin, ymin, xmax, ymin);
        if (p != null && p1 != null)
        {
          final Point2D[] ret = new Point2D[2];
          ret[0] = p1;
          ret[1] = p;
          return ret;
        }
      }
    }
    else
    {
      if ((mask & BELOW) != 0)
      {
        //      System.out.println("Trying bottom");
        // try to calculate intersection with lower line
        final Point2D p = intersect(x1, y1, x2, y2, xmin, ymin, xmax, ymin);
        if (p != null)
        {
          if (p1 == null)
          {
            p1 = p;
          }
          else
          {
            final Point2D[] ret = new Point2D[2];
            ret[0] = p1;
            ret[1] = p;
            return ret;
          }
        }
      }
      if ((mask & ABOVE) != 0)
      {
        //      System.out.println("Trying top");
        // try to calculate intersection with lower line
        final Point2D p = intersect(x1, y1, x2, y2, xmin, ymax, xmax, ymax);
        if (p != null && p1 != null)
        {
          final Point2D[] ret = new Point2D[2];
          ret[0] = p1;
          ret[1] = p;
View Full Code Here

Examples of java.awt.geom.Point2D

    {
      return false;
    }
    if (key == ElementStyleKeys.ABSOLUTE_POS)
    {
      final Point2D point = (Point2D) value;
      setStyleProperty(ElementStyleKeys.POS_X, new Float(point.getX()));
      setStyleProperty(ElementStyleKeys.POS_Y, new Float(point.getY()));
      return true;
    }
    if (key == ElementStyleKeys.MINIMUMSIZE)
    {
      final Dimension2D dim = (Dimension2D) value;
View Full Code Here

Examples of java.awt.geom.Point2D

  }

  public void setCenter(float lat, float lon) {
    super.setCenter(lat, lon);

    Point2D centerInDifferentDatum = datum.forward(lat, lon,
        new Point2D.Double());
    wrappedProjection.setCenter((float) centerInDifferentDatum.getY(),
        (float) centerInDifferentDatum.getX());
  }
View Full Code Here

Examples of java.awt.geom.Point2D

  protected ArrayList _forwardPoly(float[] rawllpts, int ltype, int nsegs,
      boolean isFilled) {
   
    float[] rawllptsInDifferentDatum = new float[rawllpts.length];

    Point2D tmpll = new Point2D.Double();

    for (int i = 0; i < rawllpts.length; i += 2) {
      tmpll = datum.forward(Math.toDegrees(rawllpts[i]), Math.toDegrees(rawllpts[i + 1]), tmpll);
      rawllptsInDifferentDatum[i] = (float) Math.toRadians(tmpll.getY());
      rawllptsInDifferentDatum[i + 1] = (float) Math.toRadians(tmpll.getX());
    }

    return wrappedProjection._forwardPoly(rawllptsInDifferentDatum, ltype,
        nsegs, isFilled);
  }
View Full Code Here

Examples of java.awt.geom.Point2D

  public Point forward(float lat, float lon, Point pt) {
    return forward(lat, lon, pt, false);
  }

  public Point forward(float lat, float lon, Point pt, boolean isRadian) {
    Point2D t;
    if (isRadian) {
      t = datum.forward(Math.toDegrees(lat), Math.toDegrees(lon));
    } else {
      t = datum.forward(lat, lon);
    }
    return wrappedProjection
        .forward((float) t.getY(), (float) t.getX(), pt);
  }
View Full Code Here

Examples of java.awt.geom.Point2D

  public boolean forwardRaw(float[] rawllpts, int rawoff, int[] xcoords,
      int[] ycoords, boolean[] visible, int copyoff, int copylen) {

    float[] rawllptsInDifferentDatum = new float[rawllpts.length];

    Point2D tmpll = new Point2D.Double();

    int end = copylen + copyoff;
    for (int i = copyoff, j = rawoff; i < end; i++, j += 2) {
      tmpll = datum.forward(Math.toDegrees(rawllpts[j]), Math.toDegrees(rawllpts[j + 1]), tmpll);
      rawllptsInDifferentDatum[j] = (float) Math.toRadians(tmpll.getY());
      rawllptsInDifferentDatum[j + 1] = (float) Math.toRadians(tmpll.getX());
    }

    return wrappedProjection.forwardRaw(rawllptsInDifferentDatum, rawoff,
        xcoords, ycoords, visible, copyoff, copylen);
  }
View Full Code Here

Examples of java.awt.geom.Point2D

    llpt = wrappedProjection.inverse(x, y, llpt);
    return datum.inverse(llpt.getLongitude(), llpt.getLatitude(), llpt);
  }

  public boolean isPlotable(float lat, float lon) {
    Point2D t = datum.forward(lat, lon);
    return wrappedProjection.isPlotable((float) t.getY(), (float) t.getX());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.