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

📄 rpfcoverage.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        }        Debug.message("basic", "RpfCoverage.prepare(): doing it");        // Setting the OMGraphicsList for this layer. Remember, the        // OMGraphicList is made up of OMGraphics, which are generated        // (projected) when the graphics are added to the list. So,        // after this call, the list is ready for painting.        // IF the data arrays have not been set up yet, do it!        if (coverageManager == null) {            coverageManager = new RpfCoverageManager(frameProvider);        }        setGraphicLists(coverageManager.getCatalogCoverage(ullat,                ullon,                lrlat,                lrlon,                projection,                chartSeries,                getColors(),                fillRects));    }    protected Color[] colors = null;    protected void resetColors() {        colors = null;    }    protected Color[] getColors() {        if (colors == null) {            colors = new Color[] { getModifiedColor(CGColor),                    getModifiedColor(TLMColor), getModifiedColor(JOGColor),                    getModifiedColor(TPCColor), getModifiedColor(ONCColor),                    getModifiedColor(JNCColor), getModifiedColor(GNCColor),                    getModifiedColor(CIB10Color), getModifiedColor(CIB5Color),                    getModifiedColor(MISCColor) };        }        return colors;    }    /**     * @return Returns the opaqueness.     */    public int getOpaqueness() {        return opaqueness;    }    /**     * @param opaqueness The opaqueness to set.     */    public void setOpaqueness(int opaqueness) {        this.opaqueness = opaqueness;        resetColors();    }    protected Color getModifiedColor(Color color) {        if (opaqueness < 255) {            int opa = opaqueness << 24;            return ColorFactory.createColor(((color.getRGB() & 0x00FFFFFF) | opa),                    true);        } else {            return ColorFactory.createColor(color.getRGB(), true);        }    }    public synchronized void setGraphicLists(Vector lists) {        omGraphics = lists;    }    public synchronized Vector getGraphicLists() {        return omGraphics;    }    /**     * Paints the layer.     *      * @param g the Graphics context for painting     *       */    public void paint(java.awt.Graphics g) {        Debug.message("rpfcov", "RpfCoverage.paint()");        Vector tmpGraphics = getGraphicLists();        if (tmpGraphics != null) {            int length = tmpGraphics.size();            Debug.message("rpfcov", "RpfCoverage.painting(): " + length                    + " lists");            for (int k = length - 1; k >= 0; k--) {                // HACK - this order is nicely arranged with the order                // that lists are arrainged by the                // RpfCoverageManager!!!!                if (k == 0 && showCG)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);                if (k == 1 && showCIB5)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);                if (k == 2 && showTLM)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);                if (k == 3 && showCIB10)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);                if (k == 4 && showJOG)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);                if (k == 5 && showMISC)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);                if (k == 6 && showTPC)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);                if (k == 7 && showONC)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);                if (k == 8 && showJNC)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);                if (k == 9 && showGNC)                    ((OMGraphicList) tmpGraphics.elementAt(k)).render(g);            }        } else {            Debug.message("rpfcov", "RpfCoverage.paint(): null graphics list");        }    }    /**     * Reproject the graphics you have.     *      * @param proj the projection to use     *       */    public void generate(Projection proj) {        Debug.message("rpfcov", "RpfCoverage.generate()");        Vector tmpGraphics = getGraphicLists();        if (tmpGraphics != null) {            int length = tmpGraphics.size();            for (int k = length - 1; k >= 0; k--) {                // HACK - this order is nicely arranged with the order                // that lists are arrainged by the                // RpfCoverageManager!!!!                if (k == 0)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);                if (k == 1)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);                if (k == 2)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);                if (k == 3)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);                if (k == 4)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);                if (k == 5)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);                if (k == 6)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);                if (k == 7)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);                if (k == 8)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);                if (k == 9)                    ((OMGraphicList) tmpGraphics.elementAt(k)).generate(proj);            }        }    }    //----------------------------------------------------------------------    // GUI    //----------------------------------------------------------------------    /**     * Provides the palette widgets to control the options of showing     * maps, or attribute text.     *      * @return Component object representing the palette widgets.     */    public java.awt.Component getGUI() {        JCheckBox showCGCheck, showTLMCheck, showJOGCheck, showTPCCheck, showONCCheck, showJNCCheck, showGNCCheck, showCIB10Check, showCIB5Check, showMISCCheck;        showCGCheck = new JCheckBox("Show City Graphic Coverage", showCG);        showCGCheck.setActionCommand(showCGCommand);        showCGCheck.addActionListener(this);        showCGCheck.setForeground(CGColor);        showTLMCheck = new JCheckBox("Show TLM (1:50k) Coverage", showTLM);        showTLMCheck.setActionCommand(showTLMCommand);        showTLMCheck.addActionListener(this);        showTLMCheck.setForeground(TLMColor);        showJOGCheck = new JCheckBox("Show JOG (1:250k) Coverage", showJOG);        showJOGCheck.setActionCommand(showJOGCommand);        showJOGCheck.addActionListener(this);        showJOGCheck.setForeground(JOGColor);        showTPCCheck = new JCheckBox("Show TPC (1:500k) Coverage", showTPC);        showTPCCheck.setActionCommand(showTPCCommand);        showTPCCheck.addActionListener(this);        showTPCCheck.setForeground(TPCColor);        showONCCheck = new JCheckBox("Show ONC (1:1M) Coverage", showONC);        showONCCheck.setActionCommand(showONCCommand);        showONCCheck.addActionListener(this);        showONCCheck.setForeground(ONCColor);        showJNCCheck = new JCheckBox("Show JNC (1:2M) Coverage", showJNC);        showJNCCheck.setActionCommand(showJNCCommand);        showJNCCheck.addActionListener(this);        showJNCCheck.setForeground(JNCColor);        showGNCCheck = new JCheckBox("Show GNC (1:5M) Coverage", showGNC);        showGNCCheck.setActionCommand(showGNCCommand);        showGNCCheck.addActionListener(this);        showGNCCheck.setForeground(GNCColor);        showCIB10Check = new JCheckBox("Show CIB 10m Coverage", showCIB10);        showCIB10Check.setActionCommand(showCIB10Command);        showCIB10Check.addActionListener(this);        showCIB10Check.setForeground(CIB10Color);        showCIB5Check = new JCheckBox("Show CIB 5m Coverage", showCIB5);        showCIB5Check.setActionCommand(showCIB5Command);        showCIB5Check.addActionListener(this);        showCIB5Check.setForeground(CIB5Color);        showMISCCheck = new JCheckBox("Show Coverage of all Others", showMISC);        showMISCCheck.setActionCommand(showMISCCommand);        showMISCCheck.addActionListener(this);        showMISCCheck.setForeground(MISCColor);        Box box = Box.createVerticalBox();        box.add(showCGCheck);        box.add(showTLMCheck);        box.add(showJOGCheck);        box.add(showTPCCheck);        box.add(showONCCheck);        box.add(showJNCCheck);        box.add(showGNCCheck);        box.add(showCIB10Check);        box.add(showCIB5Check);        box.add(showMISCCheck);        return box;    }    protected JFrame paletteWindow = null;    /**     * Get RpfCoverage's associated palette as a top-level window     *      * @return the frame that the palette is in     */    public JFrame getPaletteWindow() {        if (paletteWindow == null) {            // create the palette's scroll pane            Component pal = getGUI();            if (pal == null)                pal = new JLabel("No Palette");            JPanel p = new JPanel();            p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));            p.setAlignmentX(Component.LEFT_ALIGNMENT);            p.setAlignmentY(Component.BOTTOM_ALIGNMENT);            p.add(pal);            JScrollPane scrollPane = new JScrollPane(p, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);            scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);            scrollPane.setAlignmentY(Component.TOP_ALIGNMENT);            // create the palette internal window            paletteWindow = new JFrame("RPF Coverage Palette");            paletteWindow.setContentPane(scrollPane);            paletteWindow.pack();//layout all the components        }        return paletteWindow;    }    //----------------------------------------------------------------------    // ActionListener interface implementation    //----------------------------------------------------------------------    /**     * The Action Listener method, that reacts to the palette widgets     * actions.     */    public void actionPerformed(ActionEvent e) {        String cmd = e.getActionCommand();        JCheckBox check = (JCheckBox) e.getSource();        if (cmd == showCGCommand)            showCG = check.isSelected();        else if (cmd == showTLMCommand)            showTLM = check.isSelected();        else if (cmd == showJOGCommand)            showJOG = check.isSelected();        else if (cmd == showTPCCommand)            showTPC = check.isSelected();        else if (cmd == showONCCommand)            showONC = check.isSelected();        else if (cmd == showJNCCommand)            showJNC = check.isSelected();        else if (cmd == showGNCCommand)            showGNC = check.isSelected();        else if (cmd == showCIB10Command)            showCIB10 = check.isSelected();        else if (cmd == showCIB5Command)            showCIB5 = check.isSelected();        else if (cmd == showMISCCommand)            showMISC = check.isSelected();        else {            System.err.println("Unknown action command \"" + cmd                    + "\" in RpfCoverageLayer.actionPerformed().");        }        layer.repaint();    }}

⌨️ 快捷键说明

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