📄 dtedcoveragelayer.java
字号:
+ DTEDPathsProperty); paths2 = PropUtils.initPathsFromProperties(properties, prefix + DTED2PathsProperty); coverageFile = properties.getProperty(prefix + CoverageFileProperty); coverageURL = properties.getProperty(prefix + CoverageURLProperty); fillRects = PropUtils.booleanFromProperties(properties, prefix + FillProperty, false); opaqueness = PropUtils.intFromProperties(properties, prefix + OpaquenessProperty, DTEDFrameColorTable.DEFAULT_OPAQUENESS); level0Color = PropUtils.parseColorFromProperties(properties, prefix + Level0ColorProperty, DTEDCoverageManager.defaultLevel0ColorString); level1Color = PropUtils.parseColorFromProperties(properties, prefix + Level1ColorProperty, DTEDCoverageManager.defaultLevel1ColorString); level2Color = PropUtils.parseColorFromProperties(properties, prefix + Level2ColorProperty, DTEDCoverageManager.defaultLevel2ColorString); showDTEDLevel0 = PropUtils.booleanFromProperties(properties, prefix + ShowLevel0Property, true); showDTEDLevel1 = PropUtils.booleanFromProperties(properties, prefix + ShowLevel1Property, true); showDTEDLevel2 = PropUtils.booleanFromProperties(properties, prefix + ShowLevel2Property, true); } /** * Sets the current graphics lists to the given list. * * @param aList a list of OMGraphics */ public synchronized void setGraphicLists(OMGraphicList[] aList) { omGraphics = aList; } /** Retrieves the current graphics lists. */ public synchronized OMGraphicList[] getGraphicLists() { return omGraphics; } /** * Prepares the graphics for the layer. This is where the * getRectangle() method call is made on the dtedcov. * <p> * Occasionally it is necessary to abort a prepare call. When this * happens, the map will set the cancel bit in the LayerThread, * (the thread that is running the prepare). If this Layer needs * to do any cleanups during the abort, it should do so, but * return out of the prepare asap. */ public synchronized OMGraphicList prepare() { if (isCancelled()) { Debug.message("dtedcov", getName() + "|DTEDCoverageLayer.prepare(): aborted."); return null; } Debug.message("basic", getName() + "|DTEDCoverageLayer.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. Projection projection = getProjection(); // call getRectangle(); if (Debug.debugging("dtedcov")) { Debug.output(getName() + "|DTEDCoverageLayer.prepare(): " + "calling prepare with projection: " + projection + " ul = " + projection.getUpperLeft() + " lr = " + projection.getLowerRight()); } // IF the coverage manager has not been set up yet, do it! if (coverageManager == null) { coverageManager = new DTEDCoverageManager(paths, paths2, coverageURL, coverageFile); coverageManager.setPaint(level0Color, level1Color, level2Color, opaqueness, fillRects); if (Debug.debugging("dtedcov")) { Debug.output(getName() + "|DTEDCoverageLayer.prepare(): created DTEDCoverageManager"); } } OMGraphicList[] omGraphicLists = coverageManager.getCoverageRects(projection); setGraphicLists(omGraphicLists); ///////////////////// // safe quit int size = 0; if (omGraphicLists != null) { for (int j = 0; j < omGraphicLists.length; j++) { size = omGraphicLists[j].size(); Debug.message("basic", getName() + "|DTEDCoverageLayer.prepare(): finished with " + size + " level " + j + " graphics"); } } else Debug.message("basic", getName() + "|DTEDCoverageLayer.prepare(): finished with null graphics list"); OMGraphicList mainList = new OMGraphicList(); // Don't forget to project them. Since they are only being // recalled if the projection hase changed, then we need to // force a reprojection of all of them because the screen // position has changed. for (int k = 0; k < omGraphicLists.length; k++) { omGraphicLists[k].project(projection, true); mainList.add(omGraphicLists[k]); } return mainList; } public synchronized void checkVisibilities() { OMGraphicList[] lists = getGraphicLists(); if (lists != null) { int length = lists.length; if (length > 0) lists[0].setVisible(showDTEDLevel0); if (length > 1) lists[1].setVisible(showDTEDLevel1); if (length > 2) lists[2].setVisible(showDTEDLevel2); } } /** * Paints the layer. * * @param g the Graphics context for painting */ public void paint(java.awt.Graphics g) { checkVisibilities(); super.paint(g); } //---------------------------------------------------------------------- // 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 showLevel0Check, showLevel1Check, showLevel2Check; showLevel0Check = new JCheckBox("Show Level 0 Coverage", showDTEDLevel0); showLevel0Check.setActionCommand(showLevel0Command); showLevel0Check.addActionListener(this); showLevel1Check = new JCheckBox("Show Level 1 Coverage", showDTEDLevel1); showLevel1Check.setActionCommand(showLevel1Command); showLevel1Check.addActionListener(this); showLevel2Check = new JCheckBox("Show Level 2 Coverage", showDTEDLevel2); showLevel2Check.setActionCommand(showLevel2Command); showLevel2Check.addActionListener(this); Box box = Box.createVerticalBox(); box.add(showLevel0Check); box.add(showLevel1Check); box.add(showLevel2Check); return box; } //---------------------------------------------------------------------- // ActionListener interface implementation //---------------------------------------------------------------------- /** * The Action Listener method, that reacts to the palette widgets * actions. */ public void actionPerformed(ActionEvent e) { super.actionPerformed(e); String cmd = e.getActionCommand(); if (cmd == showLevel0Command) { JCheckBox level0Check = (JCheckBox) e.getSource(); showDTEDLevel0 = level0Check.isSelected(); repaint(); } else if (cmd == showLevel1Command) { JCheckBox level1Check = (JCheckBox) e.getSource(); showDTEDLevel1 = level1Check.isSelected(); repaint(); } else if (cmd == showLevel2Command) { JCheckBox level2Check = (JCheckBox) e.getSource(); showDTEDLevel2 = level2Check.isSelected(); repaint(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -