📄 coveragetable.java
字号:
/** * Should be called once per feature, after the tables have been * set (setTables()), and findYourself() has been called. The * appropriate table will use the warehouse to create proper * OMGraphic. */ protected boolean drawFeature(int primitiveID, VPFFeatureWarehouse warehouse, LatLonPoint ll1, LatLonPoint ll2, float dpplat, float dpplon, String currentFeature) throws FormatException { if (aft != null || tft != null || edg != null || ent != null || cnt != null) { // OK, now check to see what table is being // used. if the tile is being reused, the // table will be reused. if ((aft != null) && aft.getRow(primitiveVector, primitiveID)) { aft.drawFeature(warehouse, dpplat, dpplon, ll1, ll2, primitiveVector, currentFeature); } if ((tft != null) && tft.getRow(primitiveVector, primitiveID)) { tft.drawFeature(warehouse, dpplat, dpplon, ll1, ll2, primitiveVector, currentFeature); } if ((ent != null) && ent.getRow(primitiveVector, primitiveID)) { ent.drawFeature(warehouse, dpplat, dpplon, ll1, ll2, primitiveVector, currentFeature); } if ((cnt != null) && cnt.getRow(primitiveVector, primitiveID)) { cnt.drawFeature(warehouse, dpplat, dpplon, ll1, ll2, primitiveVector, currentFeature); } if ((edg != null) && edg.getRow(primitiveVector, primitiveID)) { edg.drawFeature(warehouse, dpplat, dpplon, ll1, ll2, primitiveVector, currentFeature); } return true; } else { return false; } } /** * Only call once per tile. It will parse all the needed data in * the tile. Does not require setTables() or findYourself(). */ protected void drawTile(TileDirectory tile, VPFGraphicWarehouse warehouse, LatLonPoint ll1, LatLonPoint ll2, float dpplat, float dpplon) { boolean drawedge = warehouse.drawEdgeFeatures(); boolean drawtext = warehouse.drawTextFeatures(); boolean drawarea = warehouse.drawAreaFeatures(); boolean drawepoint = warehouse.drawEPointFeatures(); boolean drawcpoint = warehouse.drawCPointFeatures(); close(); try { if (drawedge || drawarea) { edg = new EdgeTable(coverageTable, tile); } } catch (FormatException f) { if (Debug.debugging("vpf.FormatException")) { Debug.output("EdgeTable: " + f.getClass() + " " + f.getMessage()); } } try { if (drawtext) { tft = new TextTable(coverageTable, tile); } } catch (FormatException f) { if (Debug.debugging("vpf.FormatException")) { Debug.output("TextTable: " + f.getClass() + " " + f.getMessage()); } } try { if (drawepoint) { ent = new NodeTable(coverageTable, tile, true); } } catch (FormatException f) { if (Debug.debugging("vpf.FormatException")) { Debug.output("NodeTable: " + f.getClass() + " " + f.getMessage()); } } try { if (drawcpoint) { cnt = new NodeTable(coverageTable, tile, false); } } catch (FormatException f) { if (Debug.debugging("vpf.FormatException")) { Debug.output("NodeTable: " + f.getClass() + " " + f.getMessage()); } } try { if (drawarea && (edg != null)) { aft = new AreaTable(coverageTable, edg, tile); } } catch (FormatException f) { if (Debug.debugging("vpf.FormatException")) { Debug.output("AreaTable: " + f.getClass() + " " + f.getMessage()); } } if ((aft != null) && drawarea) { for (int i = 0; i < coverageTable.areainfo.length; i++) { coverageTable.areainfo[i].findYourself(aft); } aft.drawTile(warehouse, dpplat, dpplon, ll1, ll2); } if ((tft != null) && drawtext) { for (int i = 0; i < coverageTable.textinfo.length; i++) { coverageTable.textinfo[i].findYourself(tft); } tft.drawTile(warehouse, dpplat, dpplon, ll1, ll2); } if ((edg != null) && drawedge) { for (int i = 0; i < coverageTable.lineinfo.length; i++) { coverageTable.lineinfo[i].findYourself(edg); } edg.drawTile(warehouse, dpplat, dpplon, ll1, ll2); } if ((ent != null) && drawepoint) { for (int i = 0; i < coverageTable.epointinfo.length; i++) { coverageTable.epointinfo[i].findYourself(ent); } ent.drawTile(warehouse, dpplat, dpplon, ll1, ll2); } if ((cnt != null) && drawcpoint) { for (int i = 0; i < coverageTable.cpointinfo.length; i++) { coverageTable.cpointinfo[i].findYourself(cnt); } cnt.drawTile(warehouse, dpplat, dpplon, ll1, ll2); } // if (Debug.On && Debug.debugging("vpf.tile")) // Debug.output(drawtd.toString() + " " + edgecount[0] + // " polys with " + edgecount[1] + // " points (cumulative)\n" + // drawtd.toString() + " " + textcount[0] + // " texts with " + textcount[1] + // " points (cumulative)\n" + // drawtd.toString() + " " + areacount[0] + // " areas with " + areacount[1] + // " points (cumulative)"); close(); } /** * Close any of these tables that may be in use. */ protected void close() { if (Debug.debugging("vpf.tile")) { Debug.output("CoverageTable closing tile tables"); } if (edg != null) { edg.close(); } if (tft != null) { tft.close(); } if (aft != null) { aft.close(); } aft = null; tft = null; edg = null; }}/** * A utility class used to map information from a VPF feature table to * its associated value in an int.vdt file. */class CoverageIntVdt { /** the name of the table we are looking up (table is interned) */ final String table; /** * the name of the attribute we are looking up (attribute is * interned) */ final String attribute; /** the integer value we are looking up */ final int value; /** * Construct a new object * * @param t value for the table member * @param a the value for the attribute member * @param v the value for the value member */ public CoverageIntVdt(String t, String a, int v) { table = t.toLowerCase().intern(); attribute = a.toLowerCase().intern(); value = v; } /** * Override the equals method. Two CoverageIntVdts are equal if * and only iff their respective table, attribute and value * members are equal. */ public boolean equals(Object o) { if (o instanceof CoverageIntVdt) { CoverageIntVdt civ = (CoverageIntVdt) o; //we can use == rather than String.equals(String) since //table and attribute are interned. return ((table == civ.table) && (attribute == civ.attribute) && (value == civ.value)); } else { return false; } } /** * Override hashcode. Compute a hashcode based on our member * values, rather than our (base class) object identity. */ public int hashCode() { return ((table.hashCode() ^ attribute.hashCode()) ^ value); }}/** * A utility class used to map information from a VPF feature table to * its associated value in an char.vdt file. */class CoverageCharVdt { /** the name of the table we are looking up (table is interned) */ final String table; /** * the name of the attribute we are looking up (attribute is * interned) */ final String attribute; /** the character value we are looking up (value is interned) */ final String value; /** * Construct a new object * * @param t value for the table member * @param a the value for the attribute member * @param v the value for the value member */ public CoverageCharVdt(String t, String a, String v) { table = t.toLowerCase().intern(); attribute = a.toLowerCase().intern(); value = v.intern(); } /** * Override the equals method. Two CoverageIntVdts are equal if * and only iff their respective table, attribute and value * members are equal. */ public boolean equals(Object o) { if (o instanceof CoverageCharVdt) { CoverageCharVdt civ = (CoverageCharVdt) o; //we can use == rather than String.equals(String) since //table, attribute, and value are interned. return ((table == civ.table) && (attribute == civ.attribute) && (value == civ.value)); } else { return false; } } /** * Override hashcode. Compute a hashcode based on our member * values, rather than our (base class) object identity. */ public int hashCode() { return ((table.hashCode() ^ attribute.hashCode()) ^ value.hashCode()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -