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

📄 installeddata.java

📁 world wind java sdk 源码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            {                this.uninstallSelected();            }            else if (InstalledDataPanel.PROPERTIES_ACTION_COMMAND.equals(event.getActionCommand()))            {            }            else if (InstalledDataPanel.ZOOM_ACTION_COMMAND.equals(event.getActionCommand()))            {                this.zoomToSelected();            }            else if (ACTION_COMMAND_VERTICAL_EXAGGERATION.equals(event.getActionCommand()))            {                Double ve = (Double) event.getSource();                this.setVerticalExaggeration(ve);            }        }        public String getInstallLocation()        {            java.io.File installLocation = null;            for (java.io.File f : WorldWind.getDataFileStore().getLocations())            {                if (WorldWind.getDataFileStore().isInstallLocation(f.getPath()))                {                    installLocation = f;                    break;                }            }            return installLocation != null ? installLocation.getPath() : null;        }        public void synchronizeInstalledData(Iterable<DataDescriptor> installed)        {            LayerList layers = this.appFrame.getWwd().getModel().getLayers();            CompoundElevationModel elevationModel =                (CompoundElevationModel) this.appFrame.getWwd().getModel().getGlobe().getElevationModel();            this.synchronizeLayers(installed, layers);            this.synchronizeElevationModel(installed, elevationModel);            this.appFrame.getLayerPanel().update(this.appFrame.getWwd());        }        public void refreshInstalled()        {            String installPath = this.getInstallLocation();            this.appFrame.getInstalledDataPanel().update(installPath);            Iterable<DataDescriptor> descriptors = this.appFrame.getInstalledDataPanel().getDataDescriptors();            if (descriptors != null)                this.synchronizeInstalledData(descriptors);        }        public void selectAndInstall()        {            String installLocation = this.getInstallLocation();            if (installLocation == null || installLocation.length() < 1)            {                String message = "Controller.CannotFindInstallLocation";                Logging.logger().severe(message);                JOptionPane.showMessageDialog(this.appFrame,                    "Cannot find install location", "Error", JOptionPane.ERROR_MESSAGE);                return;            }            JFileChooser fc = this.appFrame.getInstallDataFileChooser();            int retVal = fc.showOpenDialog(this.appFrame);            if (retVal != JFileChooser.APPROVE_OPTION)                return;            FileFilter filter = fc.getFileFilter();            if (filter == null || !(filter instanceof DataStoreProducerFilter))            {                String message = "Controller.InvalidFileFilter";                Logging.logger().severe(message);                JOptionPane.showMessageDialog(this.appFrame,                    "Invalid file selection type", "Error", JOptionPane.ERROR_MESSAGE);                return;            }            java.io.File[] selected = fc.getSelectedFiles();            if (selected == null)            {                String message = "Controller.NoFileSelected";                Logging.logger().severe(message);                JOptionPane.showMessageDialog(this.appFrame,                    "No file was selected", "Error", JOptionPane.ERROR_MESSAGE);                return;            }            DataStoreProducerFilter producerFilter = ((DataStoreProducerFilter) filter);            producerFilter.getParameters().clearList();            Object o = producerFilter.showControls(this.appFrame, selected);            if (o == null)                return;            DataSource[] sources = new DataSource[selected.length];            for (int i = 0; i < selected.length; i++)                sources[i] = new BasicDataSource(selected[i]);            try            {                final DataStoreProducer producer = producerFilter.createProducer();                final AVList parmeters = producerFilter.getParameters();                Installer installer = new Installer(this, producer, parmeters, sources, installLocation);                installer.installInNonUIThread(new Runnable() {                    public void run() {                        Controller.this.zoomToProductionResults(producer);                    }                });            }            catch (Exception e)            {                String message = "Controller.ExceptionCreatingInstaller: " + producerFilter.getProducerClass();                Logging.logger().severe(message);                JOptionPane.showMessageDialog(this.appFrame,                    "Cannot create installer " + producerFilter.getProducerClass(), "Error", JOptionPane.ERROR_MESSAGE);               }        }        public void uninstallSelected()        {            Iterable<DataDescriptor> selected = this.appFrame.getInstalledDataPanel().getSelectedDataDescriptors();            if (selected == null)                return;            Uninstaller uninstaller = new Uninstaller(this, selected);            uninstaller.uninstallInNonUIThread();        }        public void zoomToSelected()        {            Iterable<DataDescriptor> selected = this.appFrame.getInstalledDataPanel().getSelectedDataDescriptors();            if (selected == null)                return;            Sector sector = null;            for (DataDescriptor descriptor : selected)            {                Object o = descriptor.getValue(AVKey.SECTOR);                if (o != null && o instanceof Sector)                    sector = (sector == null ? (Sector) o : sector.union((Sector) o));            }            if (sector == null)            {                JOptionPane.showMessageDialog(this.appFrame,                    "Select installed data to zoom to", null, JOptionPane.INFORMATION_MESSAGE);                return;            }            try            {                this.zoomTo(sector);            }            catch (Exception e)            {                JOptionPane.showMessageDialog(this.appFrame,                    "Cannot zoom to selected data", "Error", JOptionPane.ERROR_MESSAGE);            }        }        public void zoomToProductionResults(DataStoreProducer producer)        {            Iterable<?> results = producer.getProductionResults();            if (results == null)                return;            Sector sector = null;            for (Object result : results)            {                if (result instanceof AVList)                {                    Object o = ((AVList) result).getValue(AVKey.SECTOR);                    if (o != null && o instanceof Sector)                        sector = (sector == null ? (Sector) o : sector.union((Sector) o));                }            }            if (sector == null)                return;            try            {                this.zoomTo(sector);            }            catch (Exception e)            {                JOptionPane.showMessageDialog(this.appFrame,                    "Cannot zoom to selected data", "Error", JOptionPane.ERROR_MESSAGE);            }        }        public void setVerticalExaggeration(double verticalExaggeration)        {            this.getAppFrame().getWwd().getSceneController().setVerticalExaggeration(verticalExaggeration);        }        private void zoomTo(Sector sector)        {            if (sector == null)            {                String message = Logging.getMessage("nullValue.SectorIsNull");                Logging.logger().severe(message);                throw new IllegalArgumentException(message);            }            View view = this.appFrame.getWwd().getView();            if (view == null)            {                String message = Logging.getMessage("nullValue.ViewIsNull");                Logging.logger().severe(message);                throw new IllegalArgumentException(message);            }            Globe globe = this.appFrame.getWwd().getModel().getGlobe();            if (globe == null)            {                String message = Logging.getMessage("nullValue.GlobeIsNull");                Logging.logger().severe(message);                throw new IllegalArgumentException(message);            }            double ve = this.appFrame.getWwd().getSceneController().getVerticalExaggeration();            Extent extent = globe.computeBoundingCylinder(ve, sector);            Position centerPos = globe.computePositionFromPoint(extent.getCenter());            double zoomDistance = 1.5 * extent.getRadius() / view.getFieldOfView().tanHalfAngle();            ViewStateIterator vsi = FlyToOrbitViewStateIterator.createPanToIterator(                (OrbitView) view, globe, centerPos, Angle.ZERO, Angle.ZERO, zoomDistance, true);            view.applyStateIterator(vsi);        }        private void synchronizeLayers(Iterable<DataDescriptor> descriptors, LayerList layerList)        {            java.util.List<DataDescriptor> installedDescriptors = new java.util.ArrayList<DataDescriptor>();            for (DataDescriptor d : descriptors)                installedDescriptors.add(d);            java.util.List<Layer> uninstalledLayers = new java.util.ArrayList<Layer>();            // Remove layers with DataDescriptors that are no longer installed, and remove DataDescriptors that            // are already installed as a layer.            for (Layer layer : layerList)            {                Object o = layer.getValue(DATA_SOURCE_DESCRIPTOR);                if (o != null && o instanceof DataDescriptor)                {                    DataDescriptor d = (DataDescriptor) o;                    // If the layer references an installed DataDesriptor, then we can eliminate it from the list                    // of new DataDescriptors.                    if (installedDescriptors.contains(d))                        installedDescriptors.remove(d);                    // If the layer references a DataDescriptor that is no longer installed,                    // then remove that layer.                    else                        uninstalledLayers.add(layer);                }            }            // Remove layers for uninstalled DataDescriptors.            for (Layer layer : uninstalledLayers)                layerList.remove(layer);            // Add layers for installedDataDescriptors.            for (DataDescriptor d : installedDescriptors)                this.createLayerForDescriptor(d);        }        private void synchronizeElevationModel(Iterable<DataDescriptor> descriptors,                                               CompoundElevationModel compoundModel)        {            java.util.List<DataDescriptor> installedDescriptors = new java.util.ArrayList<DataDescriptor>();            for (DataDescriptor d : descriptors)                installedDescriptors.add(d);            java.util.List<ElevationModel> modelList = compoundModel.getElevationModels();            //java.util.List<ElevationModel> uninstalledModels = new java.util.ArrayList<ElevationModel>();            // Remove models with DataDescriptors that are no longer installed, and remove DataDescriptors that            // are already installed as a model.

⌨️ 快捷键说明

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