Package java.awt.geom

Examples of java.awt.geom.Point2D


        locationCenterXPixel = ((double) getWidth() / 2d);
        locationCenterYPixel = ((double) getHeight() / 2d);
       
        locationPixelsPerLambert = (double)getPPM() / getScale();
       
        Point2D lp = new Point2D.Double();
        LatLonPoint origin = new LatLonPoint(referenceLatitude, centralMeridian);
        LLToWorld(origin.getLatitude(), origin.getLongitude(), lp);
        locationOriginX = lp.getX();
        locationOriginY = lp.getY();
       
        LatLonPoint center = getCenter();
        LLToWorld(center.getLatitude(), center.getLongitude(), lp);
        locationCenterXLambert = lp.getX();
        locationCenterYLambert = lp.getY();
       
        if (Debug.debugging("Lambert")) {
            Debug.output("Creating LambertConformal: center x = "
                    + locationCenterXLambert + ", center y = "
                    + locationCenterYLambert);
View Full Code Here


     * DESCRIPTION:  This function converts lat, lon coordinate to pixel
     *               coordinate.
     *--------------------------------------------------------------------------*/
   
    public Point LLToPixel(double lat, double lon, Point p) {
        Point2D lp = new Point2D.Double();
       
        LLToWorld(lat, lon, lp);
       
        double xrel = lp.getX() - locationCenterXLambert;
        double yrel = lp.getY() - locationCenterYLambert;
       
        xrel = (xrel * locationPixelsPerLambert);
        yrel = (yrel * locationPixelsPerLambert);
       
        xrel = locationCenterXPixel + xrel;
View Full Code Here

        // the same earth radius up north..

        double widthPX = point2.x - point1.x;
        double heightPX = point2.y - point1.y;
       
        Point2D xx1 = LLToWorld(ll1.getLatitude(), ll1.getLongitude(), new Point2D.Double());
        Point2D xx2 = LLToWorld(ll2.getLatitude(), ll2.getLongitude(), new Point2D.Double());

        double widthMap = (xx2.getX() - xx1.getX());
        double widthScale = (((double) getPPM()) * (widthMap / widthPX));

        double heightMap = (xx2.getY() - xx1.getY());
        double heightScale = (((double) getPPM()) * (heightMap / heightPX));
       
        // TODO: use width-, height- or medium scale?

        return (float)widthScale;
View Full Code Here

        Debug.message("Lambert", "(1)" + proj.inverse(310, 240));
       
        LatLonPoint llp = new LatLonPoint(0.0f, 0.0f);
        Debug.message("Lambert", "(2)" + proj.worldToLL(251763.20f, 153034.13f, llp));
       
        Point2D lp = new Point2D.Double();
        LatLonPoint pt = new LatLonPoint(50.679572292f, 5.807370150f);
        Debug.message("Lambert", "(3)" + proj.LLToWorld(pt.getLatitude(), pt.getLongitude(), lp));
    }
View Full Code Here

    /**
     * Return a LatLonPoint in WGS 84
     */
    public LatLonPoint getLatLon(LatLonPoint instance) {
      Point2D p = getLatLon(Ellipsoid.WGS_84, null);
      instance.setLatLon(p.getY(), p.getX());
      return instance;
    }
View Full Code Here

   */
  private String cxy(double x, double y) {
//    double nx = x, ny = y; // scratch
//    double mh = page.getPageFormat().getHeight();

    Point2D ptSrc = new Point2D.Double(x, y);
    Point2D ptDst = new Point2D.Double();
    transform.transform(ptSrc, ptDst);

//    x += trax;
//    y += tray;
//
//    nx = x;
//    ny = mh - y;
//
//    System.out.println("\ncxy(" + ptSrc.getX() + ", " + ptSrc.getY() + ")");
//    System.out.println("Old [" + nx + "," + ny + "]");
//    System.out.println("Trn [" + ptDst.getX() + ", " + ptDst.getY() + "]");
//
//    return "" + df.format(nx) + " " + df.format(ny) + " ";
    return ""+df.format(ptDst.getX())+" "+df.format(ptDst.getY())+" ";
     
  }
View Full Code Here

   */
  private String txy(float x,float y) {
//    float nx=x, ny=y;
//    int mh = (int) page.getPageFormat().getHeight();

    Point2D ptSrc = new Point2D.Float(x, y);
    Point2D ptDst = new Point2D.Float();
    transform.transform(ptSrc, ptDst);

//    // handle any translations
//    x+=trax;
//    y+=tray;
//
//  nx = x;
//  ny = mh - y;
//   
//  System.out.println("\ntxy(" + ptSrc.getX() + ", " + ptSrc.getY() + ")");
//  System.out.println("Old [" + nx + "," + ny + "]");
//  System.out.println("Trn [" + ptDst.getX() + ", " + ptDst.getY() + "]");
//
//    return ""+df.format(nx)+" "+df.format(ny)+" ";
   
    return ""+df.format(ptDst.getX())+" "+df.format(ptDst.getY())+" ";
  }
View Full Code Here

   
    /*
     * Find proper translations to keep rotated image correctly displayed
     */
    private AffineTransform findTranslation(AffineTransform at, BufferedImage bi) {
      Point2D p2din = new Point2D.Double (0.0, 0.0);
      Point2D p2dout = at.transform (p2din, null);
      double ytrans = p2dout.getY();

      p2din = new Point2D.Double(0, bi.getHeight());
      p2dout = at.transform(p2din, null);
      double xtrans = p2dout.getX () ;

      AffineTransform tat = new AffineTransform();
      tat.translate(-xtrans, -ytrans);
     
      return tat;
View Full Code Here

    double yy = insets.top;
    double ww = size.getWidth() - insets.left - insets.right;
    double hh = size.getHeight() - insets.top - insets.bottom;

    // calculate point one
    Point2D one = new Point2D.Double(xx + 6, yy + hh / 2);
    // calculate point two
    Point2D two = new Point2D.Double(xx + ww - 6, yy + hh / 2);

    // draw a line connecting the points
    Line2D line = new Line2D.Double(one, two);
    if (stroke != null) {
      g2.setStroke(stroke);
View Full Code Here

      // this.graphicsNode.getGlobalTransform().deltaTransform(p0, p1);
      this.lastMousePosition = evt.getPoint();
      Rectangle2D rect = graphicsNode.getBounds();
//      double width  = rect.getX() * point.getX() / canvas.getWidth();
//      double height = rect.getY() * point.getY() / canvas.getHeight();
      Point2D point2D = new Point2D.Double();
//      point2D.setLocation(width, height);
      point2D.setLocation(this.lastMousePosition.getX(),
                          this.lastMousePosition.getY());
      this.selectedGraphicsNode = this.graphicsNode.nodeHitAt(point2D);
      if (this.selectedGraphicsNode == null) {
         log.warning(".mousePressed hit a null object");
      }
View Full Code Here

TOP

Related Classes of java.awt.geom.Point2D

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.