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

📄 sectorselection.java

📁 world wind java sdk 源码
💻 JAVA
字号:
/*Copyright (C) 2001, 2009 United States Governmentas represented by the Administrator of theNational Aeronautics and Space Administration.All Rights Reserved.*/package gov.nasa.worldwind.examples;import gov.nasa.worldwind.examples.util.SectorSelector;import gov.nasa.worldwind.geom.Sector;import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.beans.*;/** * Demonstrates how to use the SectorSelector utility. * * @author tag * @version $Id: SectorSelection.java 9760 2009-03-29 09:34:06Z tgaskins $ */public class SectorSelection extends ApplicationTemplate{    public static class AppFrame extends ApplicationTemplate.AppFrame    {        private SectorSelector selector;        public AppFrame()        {            super(true, true, false);            this.selector = new SectorSelector(getWwd());            this.selector.setInteriorColor(new Color(1f, 1f, 1f, 0.1f));            this.selector.setBorderColor(new Color(1f, 0f, 0f, 0.5f));            this.selector.setBorderWidth(3);            // Set up a button to enable and disable region selection.            JButton btn = new JButton(new EnableSelectorAction());            btn.setToolTipText("Press Start then press and drag button 1 on globe");            JPanel p = new JPanel(new BorderLayout(5, 5));            p.add(btn, BorderLayout.CENTER);            this.getLayerPanel().add(p, BorderLayout.SOUTH);            // Listen for changes to the sector selector's region. Could also just wait until the user finishes            // and query the result using selector.getSector().            this.selector.addPropertyChangeListener(SectorSelector.SECTOR_PROPERTY, new PropertyChangeListener()            {                public void propertyChange(PropertyChangeEvent evt)                {                    Sector sector = (Sector) evt.getNewValue();//                    System.out.println(sector != null ? sector : "no sector");                }            });        }        private class EnableSelectorAction extends AbstractAction        {            public EnableSelectorAction()            {                super("Start");            }            public void actionPerformed(ActionEvent e)            {                ((JButton) e.getSource()).setAction(new DisableSelectorAction());                selector.enable();            }        }        private class DisableSelectorAction extends AbstractAction        {            public DisableSelectorAction()            {                super("Stop");            }            public void actionPerformed(ActionEvent e)            {                selector.disable();                ((JButton) e.getSource()).setAction(new EnableSelectorAction());            }        }    }    public static void main(String[] args)    {        ApplicationTemplate.start("Sector Selection", AppFrame.class);    }}

⌨️ 快捷键说明

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