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

📄 layergraphicwarehousesupport.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/openmap/com/bbn/openmap/layer/vpf/LayerGraphicWarehouseSupport.java,v $// $Revision: 1.6.2.5 $ $Date: 2005/08/09 21:17:53 $ $Author: dietrick $// **********************************************************************package com.bbn.openmap.layer.vpf;import com.bbn.openmap.LatLonPoint;import com.bbn.openmap.omGraphics.*;import com.bbn.openmap.proj.ProjMath;import com.bbn.openmap.util.Debug;import com.bbn.openmap.util.FanCompress;import com.bbn.openmap.util.PropUtils;import java.awt.Component;import java.util.*;/** * Implement a graphic factory that builds OMGraphics. *  * @see com.bbn.openmap.omGraphics.OMGraphic */public abstract class LayerGraphicWarehouseSupport implements        VPFGraphicWarehouse {    protected DrawingAttributes drawingAttributes;    /** HACK around antarctica display problem. */    final transient protected static float antarcticaThreshold = ProjMath.degToRad(-89.9f);    /** hang on to the graphics that we build */    protected OMGraphicList graphics;    /** remember if we draw edge features */    private boolean drawEdgeFeatures;    /** remember if we draw text features */    private boolean drawTextFeatures;    /** remember if we draw area features */    private boolean drawAreaFeatures;    /** remember if we draw entity point features */    private boolean drawEPointFeatures;    /** remember if we draw connected point features */    private boolean drawCPointFeatures;    /**     * thinning variables. note that thinning is meant to be done     * offline, so this is not optimized...     */    private static boolean doThinning = false;    private static double fan_eps = 0.01f;    /**     * Construct an object, initialiazes graphiclist     */    public LayerGraphicWarehouseSupport() {        initDrawingAttributes();        graphics = new OMGraphicList();        graphics.setTraverseMode(OMGraphicList.LAST_ADDED_ON_TOP);    }    /**     * Called from super class constructor.     *     */    protected void initDrawingAttributes() {        drawingAttributes = new DrawingAttributes();    }        /**     * Get the current graphics list.     *      * @return the OMGraphicList.     */    public synchronized OMGraphicList getGraphics() {        return getGraphics(graphics);    }    /**     * Add the area, edge, text and point sublists to the provided     * list.     */    protected synchronized OMGraphicList getGraphics(OMGraphicList addToList) {        if (areaSubList != null) {            addToList.add(areaSubList);        }        if (edgeSubList != null) {            addToList.add(edgeSubList);        }        if (pointSubList != null) {            addToList.add(pointSubList);        }        if (textSubList != null) {            addToList.add(textSubList);        }        return addToList;    }    /**     * Get the DrawingAttributes used for the coverage type.     */    public DrawingAttributes getDrawingAttributes() {        return drawingAttributes;    }    /**     * Set the drawing attributes for the coverage type.     */    public void setDrawingAttributes(DrawingAttributes da) {        drawingAttributes = da;    }    /**     * Lets the warehouse know that a different CoverageAttributeTable     * will be using it. Default action is to do nothing.     */    public void resetForCAT() {}    /**     * Set which library to use. If null, all applicable libraries in     * database will be searched.     */    private String useLibrary = null;    /**     * Set the VPF library to use. If null, all libraries will be     * searched. Null is default.     */    public void setUseLibrary(String lib) {        useLibrary = lib;    }    /**     * Get the VPF library to use.     */    public String getUseLibrary() {        return useLibrary;    }    /**     * Return the GUI for certain warehouse attributes. By default,     * return the GUI for the DrawingAttributes object being used for     * rendering attributes of the graphics.     *      * @param lst LibrarySelectionTable to use to get information     *        about the data, if needed. Not needed here.     */    public Component getGUI(LibrarySelectionTable lst) {        if (drawingAttributes != null) {            return drawingAttributes.getGUI();        } else {            return null;        }    }    protected OMGraphicList areaSubList;    protected OMGraphicList edgeSubList;    protected OMGraphicList textSubList;    protected OMGraphicList pointSubList;    /**     * Clears the contained list of graphics.     */    public void clear() {        graphics.clear();        if (areaSubList != null) {            areaSubList.clear();            areaSubList = null;        }        if (edgeSubList != null) {            edgeSubList.clear();            edgeSubList = null;        }        if (textSubList != null) {            textSubList.clear();            textSubList = null;        }        if (pointSubList != null) {            pointSubList.clear();            pointSubList = null;        }    }    protected void addArea(OMGraphic area) {        if (areaSubList == null) {            areaSubList = new OMGraphicList();        }        areaSubList.add(area);    }    protected void addEdge(OMGraphic edge) {        if (edgeSubList == null) {            edgeSubList = new OMGraphicList();        }        edgeSubList.add(edge);    }    protected void addText(OMGraphic text) {        if (textSubList == null) {            textSubList = new OMGraphicList();        }        textSubList.add(text);    }    protected void addPoint(OMGraphic point) {        if (pointSubList == null) {            pointSubList = new OMGraphicList();        }        pointSubList.add(point);    }    /**     * set if we draw edge features     *      * @param newvalue <code>true</code> for drawing, false     *        otherwise     */    public void setEdgeFeatures(boolean newvalue) {        drawEdgeFeatures = newvalue;    }    /**     * Return true if we may draw some edge features.     */    public boolean drawEdgeFeatures() {        return drawEdgeFeatures;    }    /**     * set if we draw text features     *      * @param newvalue <code>true</code> for drawing, false     *        otherwise     */    public void setTextFeatures(boolean newvalue) {        drawTextFeatures = newvalue;    }    /**     * Return true if we may draw some text features.     */    public boolean drawTextFeatures() {        return drawTextFeatures;    }    /**     * set if we draw area features     *      * @param newvalue <code>true</code> for drawing, false     *        otherwise     */    public void setAreaFeatures(boolean newvalue) {        drawAreaFeatures = newvalue;    }    /**     * Return true if we may draw some area features.     */    public boolean drawAreaFeatures() {        return drawAreaFeatures;    }    /**     * set if we draw entity point features     *      * @param newvalue <code>true</code> for drawing, false     *        otherwise     */    public void setEPointFeatures(boolean newvalue) {        drawEPointFeatures = newvalue;    }    /**     * Return true if we may draw some entity point features.     */    public boolean drawEPointFeatures() {        return drawEPointFeatures;    }    /**     * set if we draw connected point features     *      * @param newvalue <code>true</code> for drawing, false     *        otherwise     */    public void setCPointFeatures(boolean newvalue) {        drawCPointFeatures = newvalue;    }    /**     * Return true if we may draw some connected point features.     */    public boolean drawCPointFeatures() {        return drawCPointFeatures;    }    /**     * Sets the features (lines, areas, text, points) that get     * displayed     *      * @param features a whitespace-separated list of features to     *        display     */    public void setFeatures(String features) {        // If someone gives us a list of features, we need to make        // sure thats        // what we use.        setAreaFeatures(false);        setEdgeFeatures(false);        setTextFeatures(false);        setEPointFeatures(false);        setCPointFeatures(false);        StringTokenizer t = new StringTokenizer(features);        while (t.hasMoreTokens()) {            String token = t.nextToken();            if (token.equalsIgnoreCase(VPFUtil.Area)) {                setAreaFeatures(true);

⌨️ 快捷键说明

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