Package com.jhlabs.map.proj

Examples of com.jhlabs.map.proj.Projection


                throw new Error(ex);
            }
        }
       
        final Rectangle2D bnd = bounds.getBounds();
        final Projection proj = new OrthographicAzimuthalProjection();
        proj.setProjectionLongitudeDegrees(bnd.getX() + bnd.getWidth()/2);
        proj.setProjectionLatitudeDegrees(bnd.getY() + bnd.getHeight()/2);
        proj.initialize();
        return proj;
    }
View Full Code Here


        resourceManager= res;
    }

    @Override
    public void paint(GL gl) {
        Projection pr = viewPort.getProjection();
        double step = MapMath.degToRad(10);
        gl.glEnable(GL.GL_LINE_STIPPLE);
        gl.glDisable(GL.GL_LINE_SMOOTH);
        gl.glLineStipple(1, (short) 0x000F);
        gl.glLineWidth(0.01f);
        gl.glBegin(GL.GL_LINES);
        gl.glDisable(GL.GL_LIGHTING);
        gl.glDisable(GL.GL_TEXTURE_2D);
        gl.glColor4d(0, 0, 0, 0.5);
        for (double lambda = pr.getMinLongitude(); lambda <= pr
                .getMaxLongitude(); lambda += step) {
            for (double phi = pr.getMinLatitude(); phi < pr.getMaxLatitude(); phi += step) {
                Point2D.Double ptn0 = pr.project(lambda, phi,
                        new Point2D.Double());
                Point2D.Double ptn1 = pr.project(lambda + MapMath.degToRad(10),
                        phi + step, new Point2D.Double());
                gl.glVertex2d(MapMath.radToDeg(ptn0.x), MapMath
                        .radToDeg(ptn0.y) / 2);
                gl.glVertex2d(MapMath.radToDeg(ptn0.x), MapMath
                        .radToDeg(ptn1.y) / 2);
View Full Code Here

  /**
   * Test roundtrip with external library.
   */
  @Test
  public void testJavaProj() throws Exception {
    Projection proj = ProjectionFactory
        .fromPROJ4Specification(new String[] { "+proj=utm", "+zone=31",
            "+ellps=bessel", "+units=m" });

    Point2D.Double latlon = new Point2D.Double();
    double lon = latlon.x = 13.295053;
    double lat = latlon.y = 52.499847;
    Point2D.Double xy = new Point2D.Double();

    proj.transform(latlon, xy);
    System.out.println(xy);

    proj.inverseTransform(xy, latlon);
    System.out.println(latlon);
    assertEquals(lon, latlon.x, 0.001);
    assertEquals(lat, latlon.y, 0.001);
  }
View Full Code Here

TOP

Related Classes of com.jhlabs.map.proj.Projection

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.