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

📄 utmgct.java

📁 OpenMap是一个基于JavaBeansTM的开发工具包。利用OpenMap你就能够快速构建用于访问legacy数据库的应用程序与applets。OpenMap提供了允许用户查看和操作地理空间信息的
💻 JAVA
字号:
//**********************************************************************////<copyright>////BBN Technologies//10 Moulton Street//Cambridge, MA 02138//(617) 873-8000////Copyright (C) BBNT Solutions LLC. All rights reserved.////</copyright>//**********************************************************************////$Source:///cvs/darwars/ambush/aar/src/com/bbn/ambush/mission/MissionHandler.java,v//$//$RCSfile: UTMGCT.java,v $//$Revision: 1.1.2.4 $//$Date: 2008/01/25 17:44:27 $//$Author: dietrick $////**********************************************************************package com.bbn.openmap.proj.coords;import java.awt.geom.Point2D;import java.util.Properties;import com.bbn.openmap.LatLonPoint;import com.bbn.openmap.proj.Ellipsoid;import com.bbn.openmap.util.PropUtils;public class UTMGCT extends AbstractGCT implements GeoCoordTransformation {    public final static String NorthingProperty = "northing";    public final static String EastingProperty = "easting";    public final static String ZoneProperty = "zone";    public final static String HemiProperty = "hemi";    public final static String ElliposoidProperty = "ellipsoid";    protected UTMPoint utm;    protected Ellipsoid ellipsoid = Ellipsoid.WGS_84;    protected LatLonPoint tmpLL = new LatLonPoint();    /**     * Make sure you call setProperties() or set the UTM before trying to use     * this object.     *      */    public UTMGCT() {}    public UTMGCT(UTMPoint utmPoint) {        utm = utmPoint;    }    public UTMPoint getUtm() {        return utm;    }    public void setUtm(UTMPoint utm) {        this.utm = utm;    }    public synchronized Point2D forward(double lat, double lon, Point2D ret) {        if (utm == null) {            return null;        }        tmpLL.setLatLon((float) lat, (float) lon);        UTMPoint.LLtoUTM(tmpLL, ellipsoid, utm);        ret.setLocation(utm.easting, utm.northing);        return ret;    }    public synchronized LatLonPoint inverse(double x, double y, LatLonPoint ret) {        if (utm == null) {            return null;        }        utm.easting = (float) x;        utm.northing = (float) y;        UTMPoint.UTMtoLL(utm, ellipsoid, ret);        return ret;    }    public void setProperties(String propertyPrefix, Properties props) {        super.setProperties(propertyPrefix, props);        propertyPrefix = PropUtils.getScopedPropertyPrefix(propertyPrefix);        float northing = PropUtils.floatFromProperties(props, propertyPrefix                + NorthingProperty, 0.0f);        float easting = PropUtils.floatFromProperties(props, propertyPrefix                + EastingProperty, 0.0f);        int zone = PropUtils.intFromProperties(props, propertyPrefix                + ZoneProperty, 0);        String hString = props.getProperty(propertyPrefix + HemiProperty, "N");        char hemi = hString.charAt(0);        utm = new UTMPoint(northing, easting, zone, hemi);        String eName = props.getProperty(propertyPrefix + ElliposoidProperty,                "WGS_84");        ellipsoid = Ellipsoid.getByName(eName);    }    public Properties getProperties(Properties props) {        props = super.getProperties(props);        String prefix = PropUtils.getScopedPropertyPrefix(this);        if (utm != null) {            props.put(prefix + NorthingProperty, Float.toString(utm.northing));            props.put(prefix + EastingProperty, Float.toString(utm.easting));            props.put(prefix + ZoneProperty, Integer.toString(utm.zone_number));            props.put(prefix + HemiProperty,                    Character.toString(utm.zone_letter));            props.put(prefix + ElliposoidProperty, ellipsoid.name.toUpperCase()                    .replace(' ', '_'));        }        return props;    }    public Properties getPropertyInfo(Properties props) {        props = super.getPropertyInfo(props);        return props;    }    public Ellipsoid getEllipsoid() {        return ellipsoid;    }    public void setEllipsoid(Ellipsoid ellipsoid) {        this.ellipsoid = ellipsoid;    }}

⌨️ 快捷键说明

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