?? libraryselectiontable.java
字號:
screenwidth, screenheight, covname, warehouse, ll1, new LatLonPoint(ll2.getLatitude(), 180f - .00001f)/* 180-epsilon */); drawTile(scale, screenwidth, screenheight, covname, warehouse, new LatLonPoint(ll1.getLatitude(), -180f), ll2); return; } if (Debug.debugging("vpf")) { Debug.output("LST.drawTile() with scale of " + scale); } float dpplat = Math.abs((ll1.getLatitude() - ll2.getLatitude()) / screenheight); float dpplon = Math.abs((ll1.getLongitude() - ll2.getLongitude()) / screenwidth); int inArea = 0; CoverageTable redrawUntiled = null; String useLibrary = warehouse.getUseLibrary(); for (Iterator i = CATs.values().iterator(); i.hasNext();) { CoverageAttributeTable cat = (CoverageAttributeTable) i.next(); if (Debug.debugging("vpf")) { Debug.output("LST: checking library: " + cat.getLibraryName()); } if (useLibrary != null && !useLibrary.equalsIgnoreCase(cat.getLibraryName())) { continue; } warehouse.resetForCAT(); List tiles = cat.tilesInRegion(ll1.getLatitude(), ll2.getLatitude(), ll2.getLongitude(), ll1.getLongitude()); if (tiles == null) { redrawUntiled = cat.getCoverageTable(covname); } else if (cat.isTiledData() && (scale < BROWSE_CUTOFF)) { if (!tiles.isEmpty()) { CoverageTable c = cat.getCoverageTable(covname); if (c == null) { if (Debug.debugging("vpf")) { Debug.output("|LST.drawTile(): Couldn't get coverage table for " + covname + " " + cat.getLibraryName()); } continue; } if (Debug.debugging("vpf")) { Debug.output("Using coverage table for " + covname + " " + cat.getLibraryName()); } inArea++; for (Iterator tile = tiles.iterator(); tile.hasNext();) { c.drawTile((TileDirectory) tile.next(), warehouse, ll1, ll2, dpplat, dpplon); } } } } if ((redrawUntiled != null) && (inArea == 0)) { if (Debug.debugging("vpf")) { Debug.output("LST drawing untiled browse data"); } redrawUntiled.drawTile(new TileDirectory(), warehouse, ll1, ll2, dpplat, dpplon); } } /** * */ public void drawFeatures(int scale, int screenwidth, int screenheight, String covname, VPFFeatureWarehouse warehouse, LatLonPoint ll1, LatLonPoint ll2) { if (Debug.debugging("vpf")) { Debug.output("LST.drawFeatures(): Coverage name: " + covname); Debug.output("Library selection table - edges: " + warehouse.drawEdgeFeatures()); Debug.output("Library selection table - text: " + warehouse.drawTextFeatures()); Debug.output("Library selection table - areas: " + warehouse.drawAreaFeatures()); Debug.output("Warehouse: " + warehouse); } // handle Dateline if ((scale < BROWSE_CUTOFF) && (ll1.getLongitude() > ll2.getLongitude())) { drawFeatures(scale, screenwidth, screenheight, covname, warehouse, ll1, new LatLonPoint(ll2.getLatitude(), 180f - .00001f)//180-epsilon ); drawFeatures(scale, screenwidth, screenheight, covname, warehouse, new LatLonPoint(ll1.getLatitude(), -180f), ll2); return; } if (Debug.debugging("vpf")) { Debug.output("LST.drawFeatures() with scale of " + scale); } float dpplat = Math.abs((ll1.getLatitude() - ll2.getLatitude()) / screenheight); float dpplon = Math.abs((ll1.getLongitude() - ll2.getLongitude()) / screenwidth); int inArea = 0; CoverageTable redrawUntiled = null; String useLibrary = warehouse.getUseLibrary(); for (Iterator i = CATs.values().iterator(); i.hasNext();) { CoverageAttributeTable cat = (CoverageAttributeTable) i.next(); if (useLibrary != null && !useLibrary.equalsIgnoreCase(cat.getLibraryName())) { continue; } if (scale < BROWSE_CUTOFF) { CoverageTable c = cat.getCoverageTable(covname); if (c == null) { if (Debug.debugging("vpf")) { Debug.output("LST.getFeatures(): Couldn't get coverage table for " + covname + " " + cat.getLibraryName()); } continue; } if (Debug.debugging("vpf")) { Debug.output("Using coverage table for " + covname + " " + cat.getLibraryName()); } c.drawFeatures(warehouse, ll1, ll2, dpplat, dpplon); inArea++; } else { // Set up to draw browse coverage, or untiled coverage if (Debug.debugging("vpf")) { Debug.output("LST.drawTile(): Scale too small (probably) or no tiles in region."); } redrawUntiled = cat.getCoverageTable(covname); } } if ((redrawUntiled != null) && (inArea == 0)) { redrawUntiled.drawFeatures(warehouse, ll1, ll2, dpplat, dpplon); } } /** * Given a string for a coverage type or feature type, return the * description for that string. Return null if the code string * isn't found. * * @param coverageOrFeatureType string ID for coverage or Feature * type. */ public String getDescription(String coverageOrFeatureType) throws FormatException { boolean DEBUG = Debug.debugging("vpf.lst"); if (DEBUG) Debug.output("LST.getDescription: " + coverageOrFeatureType); String[] libraries = getLibraryNames(); for (int i = 0; i < libraries.length; i++) { CoverageAttributeTable cat = getCAT(libraries[i]); if (cat == null) { continue; } String[] coverages = cat.getCoverageNames(); for (int j = 0; j < coverages.length; j++) { String covname = coverages[j]; if (coverageOrFeatureType.equalsIgnoreCase(covname)) { if (DEBUG) Debug.output("** Matches coverage " + covname); return cat.getCoverageDescription(covname); } else { if (DEBUG) Debug.output(" Checking in coverage table " + covname); CoverageTable ct = cat.getCoverageTable(covname); Hashtable info = ct.getFeatureTypeInfo(); for (Enumeration enumeration = info.elements(); enumeration.hasMoreElements();) { CoverageTable.FeatureClassRec fcr = (CoverageTable.FeatureClassRec) enumeration.nextElement(); String name = fcr.feature_class; if (coverageOrFeatureType.equalsIgnoreCase(name)) { if (DEBUG) Debug.output("** Found feature " + name); return fcr.description; } if (DEBUG) Debug.output(" checked " + name); } } } } if (DEBUG) Debug.output("-- No matches found."); return null; } /** * Just a test main to parse vpf datafiles param args files to * parse, plus other command line flags * * @param args command line arguments args[0] is a path to the VPF * root */ public static void main(String[] args) { Debug.init(); Debug.put("vpf"); String dcwbase = null; if (args.length > 0) { dcwbase = args[0]; } else { System.out.println("Need a path to the VPF lat. file"); } try { LibrarySelectionTable lst = new LibrarySelectionTable(dcwbase); System.out.println("Database Name " + lst.getDatabaseName()); String liblist[] = lst.getLibraryNames(); for (int j = 0; j < liblist.length; j++) { System.out.println("Library " + liblist[j]); lst.getCAT(liblist[j]); } } catch (FormatException f) { System.err.println("*****************************************"); System.err.println("*---------------------------------------*"); System.err.println("Format error in dealing with LST"); System.err.println(f.getMessage()); System.err.println("*---------------------------------------*"); System.err.println("*****************************************"); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -