Package org.openstreetmap.josm.data.projection

Examples of org.openstreetmap.josm.data.projection.Projection


        selectedProjectionChanged(pc);
    }

    private void updateMeta(ProjectionChoice pc) {
        pc.setPreferences(pc.getPreferences(projSubPrefPanel));
        Projection proj = pc.getProjection();
        projectionCode.setText(proj.toCode());
        projectionName.setText(proj.toString());
        Bounds b = proj.getWorldBoundsLatLon();
        CoordinateFormat cf = CoordinateFormat.getDefaultFormat();
        bounds.setText(b.getMin().lonToString(cf)+", "+b.getMin().latToString(cf)+" : "+b.getMax().lonToString(cf)+", "+b.getMax().latToString(cf));
        boolean showCode = true;
        boolean showName = false;
        if (pc instanceof SubPrefsOptions) {
View Full Code Here


        id = pc.getId();
        PROP_PROJECTION.put(id);
        PROP_SUB_PROJECTION.put(pref);
        Main.pref.putCollection("projection.sub."+id, pref);
        pc.setPreferences(pref);
        Projection proj = pc.getProjection();
        Main.setProjection(proj);
    }
View Full Code Here

            if (center != null) {
                Element scaleEl = getElementByTagName(viewportEl, "scale");
                if (scaleEl != null && scaleEl.hasAttribute("meter-per-pixel")) {
                    try {
                        double meterPerPixel = Double.parseDouble(scaleEl.getAttribute("meter-per-pixel"));
                        Projection proj = Main.getProjection();
                        // Get a "typical" distance in east/north units that
                        // corresponds to a couple of pixels. Shouldn't be too
                        // large, to keep it within projection bounds and
                        // not too small to avoid rounding errors.
                        double dist = 0.01 * proj.getDefaultZoomInPPD();
                        LatLon ll1 = proj.eastNorth2latlon(new EastNorth(center.east() - dist, center.north()));
                        LatLon ll2 = proj.eastNorth2latlon(new EastNorth(center.east() + dist, center.north()));
                        double meterPerEasting = ll1.greatCircleDistance(ll2) / dist / 2;
                        double scale = meterPerPixel / meterPerEasting; // unit: easting per pixel
                        viewport = new ViewportData(center, scale);
                    } catch (NumberFormatException ex) {
                        Main.warn(ex);
View Full Code Here

     *
     * @param p the projection
     */
    public static void setProjection(Projection p) {
        CheckParameterUtil.ensureParameterNotNull(p);
        Projection oldValue = proj;
        Bounds b = isDisplayingMapView() ? map.mapView.getRealBounds() : null;
        proj = p;
        fireProjectionChanged(oldValue, proj, b);
    }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.data.projection.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.