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

📄 basiclocation.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
字号:
// **********************************************************************// // <copyright>// //  BBN Technologies//  10 Moulton Street//  Cambridge, MA 02138//  (617) 873-8000// //  Copyright (C) BBNT Solutions LLC. All rights reserved.// // </copyright>// **********************************************************************// // $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/layer/location/BasicLocation.java,v $// $RCSfile: BasicLocation.java,v $// $Revision: 1.2.2.1 $// $Date: 2004/10/14 18:27:09 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.layer.location;/*  OpenMap  */import com.bbn.openmap.omGraphics.OMRect;import com.bbn.openmap.omGraphics.OMGraphic;/** * A BasicLocation the standard Location - dot for the marker, text to * the right of the dot. Other graphics can be substituted for the * dot, but you should modify the setGraphicLocations methods * accordingly. */public class BasicLocation extends Location {    /**     * A plain constructor if you are planning on setting everything     * yourself.     */    public BasicLocation() {}    /**     * Create a location at a latitude/longitude. If the     * locationMarker is null, a small rectangle (dot) will be created     * to mark the location.     *      * @param latitude the latitude, in decimal degrees, of the     *        location.     * @param longitude the longitude, in decimal degrees, of the     *        location.     * @param name the name of the location, also used in the label.     * @param locationMarker the OMGraphic to use for the location     *        mark.     */    public BasicLocation(float latitude, float longitude, String name,            OMGraphic locationMarker) {        super(latitude, longitude, name, locationMarker);    }    /**     * Create a location at a map location. If the locationMarker is     * null, a small rectangle (dot) will be created to mark the     * location.     *      * @param x the pixel location of the object from the let of the     *        map.     * @param y the pixel location of the object from the top of the     *        map     * @param name the name of the location, also used in the label.     * @param locationMarker the OMGraphic to use for the location     *        mark.     */    public BasicLocation(int x, int y, String name, OMGraphic locationMarker) {        super(x, y, name, locationMarker);    }    /**     * Create a location at a pixel offset from a latitude/longitude.     * If the locationMarker is null, a small rectangle (dot) will be     * created to mark the location.     *      * @param latitude the latitude, in decimal degrees, of the     *        location.     * @param longitude the longitude, in decimal degrees, of the     *        location.     * @param xOffset the pixel location of the object from the     *        longitude.     * @param yOffset the pixel location of the object from the     *        latitude.     * @param name the name of the location, also used in the label.     * @param locationMarker the OMGraphic to use for the location     *        mark.     */    public BasicLocation(float latitude, float longitude, int xOffset,            int yOffset, String name, OMGraphic locationMarker) {        super(latitude, longitude, xOffset, yOffset, name, locationMarker);    }    /**     * Called by setLocations(). Assumes the dot for the location     * marker, and a text object as the label, stored to the right.     */    public void setGraphicLocations(float latitude, float longitude) {        if (location instanceof OMRect) {            ((OMRect) location).setLocation(latitude, longitude, -1, -1, 1, 1);        }        label.setLat(latitude);        label.setLon(longitude);    }    /**     * Called by setLocations(). Assumes the dot for the location     * marker, and a text object as the label, stored to the right.     */    public void setGraphicLocations(int x, int y) {        if (location instanceof OMRect) {            ((OMRect) location).setLocation(x - 1, y - 1, x + 1, y + 1);        }        label.setX(x);        label.setY(y);    }    /**     * Called by setLocations(). Assumes the dot for the location     * marker, and a text object as the label, stored to the right.     */    public void setGraphicLocations(float latitude, float longitude,                                    int offsetX, int offsetY) {        if (location instanceof OMRect) {            ((OMRect) location).setLocation(latitude,                    longitude,                    offsetX - 1,                    offsetY - 1,                    offsetX + 1,                    offsetY + 1);        }        label.setLat(latitude);        label.setLon(longitude);        label.setX(offsetX);        label.setY(offsetY);    }}

⌨️ 快捷键说明

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