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

📄 dtedcoveragespecialist.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// **********************************************************************// // <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/corba/com/bbn/openmap/layer/specialist/dted/DTEDCoverageSpecialist.java,v $// $RCSfile: DTEDCoverageSpecialist.java,v $// $Revision: 1.4.2.3 $// $Date: 2005/08/11 21:03:34 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.layer.specialist.dted;/*  Java Core  */import java.awt.*;import java.io.*;import java.util.*;/*  OpenMap  */import com.bbn.openmap.*;import com.bbn.openmap.layer.dted.DTEDFrameColorTable;import com.bbn.openmap.layer.dted.DTEDCoverageManager;import com.bbn.openmap.omGraphics.*;import com.bbn.openmap.proj.*;import com.bbn.openmap.util.*;/* Specialist */import com.bbn.openmap.CSpecialist.*;import com.bbn.openmap.CSpecialist.CColorPackage.*;import com.bbn.openmap.CSpecialist.GraphicPackage.*;import com.bbn.openmap.CSpecialist.RectanglePackage.*;import com.bbn.openmap.layer.specialist.*;/** * HACK: this specialist copies functionality from the * DTEDCoverageLayer. */public class DTEDCoverageSpecialist extends Specialist {    /** The paths to the DTED directories, telling where the data is. */    protected String[] paths = { "/mnt/cdrom/dted", "/mnt/disk/dted" };    /**     * The paths to the DTED Level 2 directories, telling where the     * data is.     */    protected String[] paths2 = { "/mnt/cdrom/dted_level2",            "/mnt/disk/dted_level2" };    /** Flag to tell the cache to return the coverage for level 0 dted. */    protected boolean showDTEDLevel0 = true;    /** Flag to tell the cache to return the coverage for level 1 dted. */    protected boolean showDTEDLevel1 = true;    /** Flag to tell the cache to return the coverage for level 0 dted. */    protected boolean showDTEDLevel2 = true;    /** The default line color for level 0. */    public final static Color defaultLevel0Color = new Color(0xCE4F3F); // redish    /** The default line color for level 1. */    public final static Color defaultLevel1Color = new Color(0x339159); // greenish    /** The default line color for level 2. */    public final static Color defaultLevel2Color = new Color(0x0C75D3); // bluish    /** The color to outline the shapes for level 0. */    protected Color level0Color = defaultLevel0Color;    /** The color to outline the shapes for level 1. */    protected Color level1Color = defaultLevel1Color;    /** The color to outline the shapes for level 2. */    protected Color level2Color = defaultLevel2Color;    /**     * A setting for how transparent to make the images. The default     * is 255, which is totally opaque.     */    protected int opaqueness = DTEDFrameColorTable.DEFAULT_OPAQUENESS;    /** Flag to fill the coverage rectangles. */    protected boolean fillRects = false;    /**     * Location of coverage summary file. If it doesn't exists, one     * will be created here for later use.     */    protected String coverageFile = "/mnt/disk/coverage.dted";    /**     * Location of coverage summary file, if supplied as a URL. If it     * doesn't exists, a coverage file will be used instead.     */    protected String coverageURL = null;    protected DTEDCoverageManager coverageManager = null;    /** The array of coverage for level 0 data. */    protected boolean[][] level0Frames = new boolean[180][360];    /** The array of coverage for level 1 data. */    protected boolean[][] level1Frames = new boolean[180][360];    /** The array of coverage for level 2 data. */    protected boolean[][] level2Frames = new boolean[180][360];//    private final static transient String showLevel0Command = "showLevel0";//    private final static transient String showLevel1Command = "showLevel1";//    private final static transient String showLevel2Command = "showLevel2";    private final static transient XYPoint nullP1 = new XYPoint((short) 0, (short) 0);    /** The property describing the locations of level 0 and 1 data. */    public static final String DTEDPathsProperty = ".paths";    /** The property describing the locations of level 2 data. */    public static final String DTED2PathsProperty = ".level2.paths";    /** Property setting to show level 0 data on startup. */    public static final String ShowLevel0Property = ".level0.showcov";    /**     * Property to use to change the color for coverage of level 0     * data.     */    public static final String Level0ColorProperty = ".level0.color";    /** Property setting to show level 1 data on startup. */    public static final String ShowLevel1Property = ".level1.showcov";    /**     * Property to use to change the color for coverage of level 1     * data.     */    public static final String Level1ColorProperty = ".level1.color";    /** Property setting to show level 2 data on startup. */    public static final String ShowLevel2Property = ".level2.showcov";    /**     * Property to use to change the color for coverage of level 2     * data.     */    public static final String Level2ColorProperty = ".level2.color";    /** Property to use for filled rectangles (when java supports it). */    public static final String OpaquenessProperty = ".opaque";    /** Property to use to fill rectangles. */    public static final String FillProperty = ".fill";    /**     * The file to read/write coverage summary. If it doesn't exist     * here, it will be created and placed here.     */    public static final String CoverageFileProperty = ".coverageFile";    /**     * A URL to read coverage summary. If it doesn't exist, the     * coverage file will be tried.     */    public static final String CoverageURLProperty = ".coverageURL";    /**     * The default constructor for the Layer. All of the attributes     * are set to their default values.     */    public DTEDCoverageSpecialist() {        super("DTEDCoverageSpecialist", (short) 2, false);    }    protected void init() {        System.out.println("DTEDCoverageSpecialist: Figuring out which DTED frames exist! (This is a one-time operation!)");        System.out.println("Scanning for frames - This could take over (2) minutes!");        coverageManager = new DTEDCoverageManager(paths, paths2, coverageURL, coverageFile);        coverageManager.setPaint(level0Color,                level1Color,                level2Color,                opaqueness,                fillRects);    }    /**     * Set all the DTED properties from a properties object.     *      * @param prefix string prefix used in the properties file for     *        this layer.     * @param properties the properties set in the properties file.     */    public void setProperties(String prefix, java.util.Properties properties) {        paths = initPathsFromProperties(properties.getProperty(prefix                + DTEDPathsProperty));        paths2 = initPathsFromProperties(properties.getProperty(prefix                + DTED2PathsProperty));        coverageFile = properties.getProperty(prefix + CoverageFileProperty);        coverageURL = properties.getProperty(prefix + CoverageURLProperty);        String fillString = properties.getProperty(prefix + FillProperty);        if (fillString != null)            fillRects = Boolean.valueOf(fillString).booleanValue();        String opaqueString = properties.getProperty(prefix                + OpaquenessProperty);        try {            opaqueness = Integer.valueOf(opaqueString).intValue();        } catch (NumberFormatException e) {            System.err.println("Unable to parse " + OpaquenessProperty + " = "                    + opaqueString);            opaqueness = DTEDFrameColorTable.DEFAULT_OPAQUENESS;        }        level0Color = parseColor(properties,                prefix + Level0ColorProperty,                defaultLevel0Color);        level1Color = parseColor(properties,                prefix + Level1ColorProperty,                defaultLevel1Color);        level2Color = parseColor(properties,                prefix + Level2ColorProperty,                defaultLevel2Color);        String showLevel0String = properties.getProperty(prefix                + ShowLevel0Property);        if (showLevel0String != null)            showDTEDLevel0 = Boolean.valueOf(showLevel0String).booleanValue();        String showLevel1String = properties.getProperty(prefix                + ShowLevel1Property);        if (showLevel1String != null)            showDTEDLevel1 = Boolean.valueOf(showLevel1String).booleanValue();        String showLevel2String = properties.getProperty(prefix                + ShowLevel2Property);        if (showLevel2String != null)            showDTEDLevel2 = Boolean.valueOf(showLevel2String).booleanValue();    }    /**     * Takes a String of File.separator separated paths, and returns     * an array of strings instead.     *      * @param rawPaths the string of paths separated by a     *        File.separator.     * @return Array of strings representing paths to dted     *         directories.

⌨️ 快捷键说明

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