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

📄 utmgridplugin.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        c.gridy = 1;        gridbag.setConstraints(set100kGridButton, c);        panel.add(set100kGridButton);        JCheckBox setLabelsButton = new JCheckBox(i18n.get(UTMGridPlugIn.class,                "setLabelsButton",                "Show Zone Labels"), showLabels);        setLabelsButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                JCheckBox button = (JCheckBox) ae.getSource();                showLabels = button.isSelected();                doPrepare();            }        });        c.gridy = 2;        gridbag.setConstraints(setLabelsButton, c);        panel.add(setLabelsButton);        JPanel resPanel = PaletteHelper.createPaletteJPanel(i18n.get(UTMGridPlugIn.class,                "resPanel",                "Distance Grid Units"));        String[] resStrings = {                i18n.get(UTMGridPlugIn.class, "resStrings.noGrid", " No Grid "),                i18n.get(UTMGridPlugIn.class,                        "resStrings.10000m",                        " 10,000 meter   "),                i18n.get(UTMGridPlugIn.class,                        "resStrings.1000m",                        " 1000 meter "),                i18n.get(UTMGridPlugIn.class, "resStrings.100m", " 100 meter "),                i18n.get(UTMGridPlugIn.class, "resStrings.10m", " 10 meter "),                i18n.get(UTMGridPlugIn.class, "resStrings.1m", " 1 meter ") };        JComboBox resList = new JComboBox(resStrings);        resList.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                JComboBox jcb = (JComboBox) e.getSource();                setDistanceGridResolution(jcb.getSelectedIndex());                doPrepare();            }        });        resList.setSelectedIndex(getDistanceGridResolution());        resPanel.add(resList);        c.gridy = 3;        c.anchor = GridBagConstraints.CENTER;        gridbag.setConstraints(resPanel, c);        panel.add(resPanel);        JButton utmGridColorButton = new JButton(i18n.get(UTMGridPlugIn.class,                "utmGridColorButton",                "Set UTM Grid Color"));        utmGridColorButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                Color tmpPaint = getNewPaint((Component) ae.getSource(),                        i18n.get(UTMGridPlugIn.class,                                "utmGridColorChooser",                                "Choose UTM Grid Color"),                        (Color) getUTMGridPaint());                if (tmpPaint != null) {                    setUTMGridPaint(tmpPaint);                    doPrepare();                }            }        });        c.gridy = 4;        gridbag.setConstraints(utmGridColorButton, c);        panel.add(utmGridColorButton);        JButton distGridColorButton = new JButton(i18n.get(UTMGridPlugIn.class,                "distGridColorButton",                "Set Distance Grid Color"));        distGridColorButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                Color tmpPaint = getNewPaint((Component) ae.getSource(),                        i18n.get(UTMGridPlugIn.class,                                "distanceGridColorChooser",                                "Choose Distance Grid Color"),                        (Color) getDistanceGridPaint());                if (tmpPaint != null) {                    setDistanceGridPaint(tmpPaint);                    doPrepare();                }            }        });        c.gridy = 5;        gridbag.setConstraints(distGridColorButton, c);        panel.add(distGridColorButton);        return panel;    }    /**     * A convenience method to get a color from a JColorChooser. Null     * will be returned if the JColorChooser lock is in place, or if     * something else is done where the JColorChooser would normally     * return null.     *      * @param source the source component for the JColorChooser.     * @param title the String to label the JColorChooser window.     * @param startingColor the color to give to the JColorChooser to     *        start with. Returned if the cancel button is pressed.     * @return Color chosen from the JColorChooser, null if lock for     *         chooser can't be sequired.     */    protected Color getNewPaint(Component source, String title,                                Color startingColor) {        Color newPaint = null;        if (getLock()) {            newPaint = OMColorChooser.showDialog(source, title, startingColor);            releaseLock();        }        return newPaint;    }    /**     * A lock to use to limit the number of JColorChoosers that can     * pop up for a given DrawingAttributes GUI.     */    private boolean colorChooserLock = false;    /**     * Get the lock to use a JColorChooser. Returns true if you got     * the lock, false if you didn't.     */    protected synchronized boolean getLock() {        if (colorChooserLock == false) {            colorChooserLock = true;            return colorChooserLock;        } else {            return false;        }    }    /**     * Release the lock on the JColorChooser.     */    protected synchronized void releaseLock() {        colorChooserLock = false;    }    public void setProperties(String prefix, Properties props) {        super.setProperties(prefix, props);        prefix = PropUtils.getScopedPropertyPrefix(prefix);        showLabels = PropUtils.booleanFromProperties(props, prefix                + ShowLabelsProperty, showLabels);        showZones = PropUtils.booleanFromProperties(props, prefix                + ShowZonesProperty, showZones);        show100kGrid = PropUtils.booleanFromProperties(props, prefix                + Show100kGridProperty, show100kGrid);        labelCutoffScale = PropUtils.floatFromProperties(props, prefix                + LabelCutoffScaleProperty, labelCutoffScale);        utmGridPaint = PropUtils.parseColorFromProperties(props, prefix                + UTMGridColorProperty, utmGridPaint);        distanceGridPaint = PropUtils.parseColorFromProperties(props, prefix                + DistanceGridColorProperty, distanceGridPaint);        setDistanceGridResolution(PropUtils.intFromProperties(props, prefix                + DistanceGridResolutionProperty, distanceGridResolution));    }    public Properties getProperties(Properties props) {        props = super.getProperties(props);        String prefix = PropUtils.getScopedPropertyPrefix(this);        props.put(prefix + ShowLabelsProperty,                new Boolean(showLabels).toString());        props.put(prefix + ShowZonesProperty, new Boolean(showZones).toString());        props.put(prefix + LabelCutoffScaleProperty,                Float.toString(labelCutoffScale));        props.put(prefix + Show100kGridProperty,                new Boolean(show100kGrid).toString());        props.put(prefix + UTMGridColorProperty,                Integer.toHexString(((Color) utmGridPaint).getRGB()));        props.put(prefix + DistanceGridColorProperty,                Integer.toHexString(((Color) distanceGridPaint).getRGB()));        props.put(prefix + DistanceGridResolutionProperty,                Integer.toString(distanceGridResolution));        return props;    }    public Properties getPropertyInfo(Properties props) {        props = super.getPropertyInfo(props);        String interString;        interString = i18n.get(UTMGridPlugIn.class,                ShowZonesProperty,                I18n.TOOLTIP,                "Show UTM Zone Grid Lines.");        props.put(ShowZonesProperty, interString);        interString = i18n.get(UTMGridPlugIn.class,                ShowZonesProperty,                ShowZonesProperty);        props.put(ShowZonesProperty + LabelEditorProperty, interString);        props.put(ShowZonesProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        interString = i18n.get(UTMGridPlugIn.class,                UTMGridColorProperty,                I18n.TOOLTIP,                "Color for UTM Zone Grid lines.");        props.put(UTMGridColorProperty, interString);        interString = i18n.get(UTMGridPlugIn.class,                UTMGridColorProperty,                UTMGridColorProperty);        props.put(UTMGridColorProperty + LabelEditorProperty, interString);        props.put(UTMGridColorProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.ColorPropertyEditor");        interString = i18n.get(UTMGridPlugIn.class,                ShowLabelsProperty,                I18n.TOOLTIP,                "Show Labels for Grid Lines");        props.put(ShowLabelsProperty, interString);        interString = i18n.get(UTMGridPlugIn.class,                ShowLabelsProperty,                ShowLabelsProperty);        props.put(ShowLabelsProperty + LabelEditorProperty, interString);        props.put(ShowLabelsProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        interString = i18n.get(UTMGridPlugIn.class,                Show100kGridProperty,                I18n.TOOLTIP,                "Show 100Km Distance Grid Lines");        props.put(Show100kGridProperty, interString);        interString = i18n.get(UTMGridPlugIn.class,                Show100kGridProperty,                Show100kGridProperty);        props.put(Show100kGridProperty + LabelEditorProperty, interString);        props.put(Show100kGridProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        interString = i18n.get(UTMGridPlugIn.class,                DistanceGridColorProperty,                I18n.TOOLTIP,                "Color for Equal-Distance Grid Lines.");        props.put(DistanceGridColorProperty, interString);        interString = i18n.get(UTMGridPlugIn.class,                DistanceGridColorProperty,                DistanceGridColorProperty);        props.put(DistanceGridColorProperty + LabelEditorProperty, interString);        props.put(DistanceGridColorProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.ColorPropertyEditor");        interString = i18n.get(UTMGridPlugIn.class,                DistanceGridResolutionProperty,                I18n.TOOLTIP,                "Meter Resolution for Distance Grid Lines (0-5)");        props.put(DistanceGridResolutionProperty, interString);        interString = i18n.get(UTMGridPlugIn.class,                DistanceGridResolutionProperty,                DistanceGridResolutionProperty);        props.put(DistanceGridResolutionProperty + LabelEditorProperty,                interString);        props.put(initPropertiesProperty, ShowZonesProperty + " "                + UTMGridColorProperty + " " + Show100kGridProperty + " "                + ShowLabelsProperty + " " + DistanceGridResolutionProperty                + " " + DistanceGridColorProperty);        return props;    }    public void setShowZones(boolean value) {        showZones = value;    }    public boolean isShowZones() {        return showZones;    }    public void setShowLabels(boolean value) {        showLabels = value;    }    public boolean isShowLabels() {        return showLabels;    }    public void setLabelCutoffScale(float value) {        labelCutoffScale = value;    }    public float getLabelCutoffScale() {        return labelCutoffScale;    }    public void setShow100kGrid(boolean value) {        show100kGrid = value;    }    public boolean isShow100kGrid() {        return show100kGrid;    }    /**     * Resolution should be MRGS accuracy, 0 for none, 1-5 otherwise,     * where 1 = 10000 meter grid, 5 is 1 meter grid.     */    public void setDistanceGridResolution(int value) {        distanceGridResolution = value;        if (distanceGridResolution < 0                || distanceGridResolution > MGRSPoint.ACCURACY_1_METER) {            distanceGridResolution = 0;        }    }    public int getDistanceGridResolution() {        return distanceGridResolution;    }    public void setUTMGridPaint(Paint value) {        utmGridPaint = value;        if (verticalList != null) {            verticalList.setLinePaint(getUTMGridPaint());            horizontalList.setLinePaint(getUTMGridPaint());        }    }    public Paint getUTMGridPaint() {        return utmGridPaint;    }    public void setDistanceGridPaint(Paint value) {        distanceGridPaint = value;    }    public Paint getDistanceGridPaint() {        return distanceGridPaint;    }}

⌨️ 快捷键说明

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