⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lambertconformal.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
字号:
// **********************************************************************//// **********************************************************************//// $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/proj/LambertConformal.java,v $// $RCSfile: LambertConformal.java,v $// $Revision: 1.1.2.4 $// $Date: 2005/08/09 21:17:54 $// $Author: dietrick $//// **********************************************************************package com.bbn.openmap.proj;import java.awt.Point;import java.awt.geom.Point2D;import java.util.ArrayList;import com.bbn.openmap.LatLonPoint;import com.bbn.openmap.MoreMath;import com.bbn.openmap.proj.ProjMath;import com.bbn.openmap.util.Debug;/** * Implements the LambertConformalConic projection. <br> * <br> * <b>NOTE: </b> This implementation only works for the northern * hemisphere. <br> * <br> * Needs to be modified for use in the southern hemesphere. *  * @author David J. Ward */public class LambertConformal extends Proj {    /**     * The LambertCC name.     */    public final static transient String LambertConformalName = "Lambert Conformal";    /**     * The LambertCC type of projection.     */    public final static transient int LambertConformalType = 4200;    private double lambert_sp_one;    private double lambert_sp_two;    private double centralMeridian;    double angle_sp_one;    double angle_sp_two;    double distance_sp_one;    double distance_sp_two;    double lambert_lamn;    double lambert_lamf;    int locationCenterXPixel = 0;    int locationCenterYPixel = 0;    double locationCenterXLambert = 0.0;    double locationCenterYLambert = 0.0;    double locationPixelsPerLambert = 0.0;    double locationOriginX = 0.0;    double locationOriginY = 0.0;    double referenceLatitude = 0.0;    double falseEasting = 0.0;    double falseNorthing = 0.0;    /**     * Construct a Lambert projection.     * <p>     *      * @param center LatLonPoint center of projection     * @param scale float scale of projection     * @param width width of screen     * @param height height of screen     */    protected LambertConformal(LatLonPoint center, float scale, int width,            int height) {        super(center, scale, width, height, LambertConformalType);    }    /**     * Constructor for the lambert conformal projection.     *      * @param center center location for projections     * @param scale scale of projection     * @param width width of projection     * @param height height of projection     * @param centralMeridian the Central Meridian in degrees.     * @param sp_one Standard Parallel One in degrees.     * @param sp_two Standard Parallel Two in degrees.     */    protected LambertConformal(LatLonPoint center, float scale, int width,            int height, float centralMeridian, float sp_one, float sp_two) {        this(center,             scale,             width,             height,             centralMeridian,             sp_one,             sp_two,             0f,             0,             0);    }    /**     * Constructor for the lambert conformal projection.     *      * @param center center location for projections     * @param scale scale of projection     * @param width width of projection     * @param height height of projection     * @param centralMeridian the Central Meridian in degrees.     * @param sp_one Standard Parallel One in degrees.     * @param sp_two Standard Parallel Two in degrees.     * @param reference_latitude the latitude for the origin of the     *        projection     * @param falseEasting number of meters added as buffer to origin     *        E/W.     * @param falseNorthing number of meters added as buffer to origin     *        for N/S.     */    public LambertConformal(LatLonPoint center, float scale, int width,            int height, double centralMeridian, double sp_one, double sp_two,            double reference_latitude, double falseEasting, double falseNorthing) {        super(center, scale, width, height, LambertConformalType);        this.centralMeridian = centralMeridian;        this.lambert_sp_one = sp_one;        this.lambert_sp_two = sp_two;        this.referenceLatitude = reference_latitude;        this.falseEasting = falseEasting;        this.falseNorthing = falseNorthing;        computeParameters();    }    /**     * Called when some fundamental parameters change.     * <p>     * Each projection will decide how to respond to this change. For     * instance, they may need to recalculate "constant" parameters     * used in the forward() and inverse() calls.     * <p>     *      */    public void computeParameters() {        angle_sp_one = ProjMath.degToRad(90.0f - lambert_sp_one);        angle_sp_two = ProjMath.degToRad(90.0f - lambert_sp_two);        distance_sp_one = Math.log(Math.sin(angle_sp_one))                - Math.log(Math.sin(angle_sp_two));        distance_sp_two = Math.log(Math.tan(angle_sp_one / 2.0f))                - Math.log(Math.tan(angle_sp_two / 2.0f));        lambert_lamn = distance_sp_one / distance_sp_two;        lambert_lamf = Math.sin(angle_sp_one)                / (lambert_lamn * Math.pow(Math.tan(angle_sp_one / 2.0),                        lambert_lamn));        locationCenterXPixel = (int) ((float) getWidth() / 2.0 + .5);        locationCenterYPixel = (int) ((float) getHeight() / 2.0 + .5);        // Multiply by the cosmological constant of 100 to adjust        // pixels per lambert        // to produce a ratio that is close to that of other        // projections        locationPixelsPerLambert = getMaxScale() / getScale() * 100;        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("lcc")) {            Debug.output("Creating LambertConformal: center x = "                    + locationCenterXLambert + ", center y = "                    + locationCenterYLambert);            Debug.output("Creating LambertConformal: origin x = "                    + locationOriginX + ", origin y = " + locationOriginY);        }    }    /**     * Sets radian latitude to something sane. This is an abstract     * function since some projections don't deal well with extreme     * latitudes.     * <p>     *      * @param lat float latitude in radians     * @return float latitude (-PI/2 &lt;= y &lt;= PI/2)     * @see com.bbn.openmap.LatLonPoint#normalize_latitude(float)     *      */    public float normalize_latitude(float lat) {        if (lat > NORTH_POLE) {            return NORTH_POLE;        } else if (lat < SOUTH_POLE) {            return SOUTH_POLE;        }        return lat;    }    /**     * Pan the map/projection.     * <ul>     * <li><code>pan(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -