📄 featureclassinfo.java
字号:
// **********************************************************************// // <copyright>// // BBN Technologies// 10 Moulton Street// Cambridge, MA 02138// (617) 873-8000// // Copyright (C) BBNT Solutions LLC. All rights reserved.// // </copyright>// **********************************************************************// // $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/layer/vpf/FeatureClassInfo.java,v $// $RCSfile: FeatureClassInfo.java,v $// $Revision: 1.3.2.4 $// $Date: 2005/08/11 21:03:13 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.layer.vpf;import java.util.ArrayList;import java.util.List;import com.bbn.openmap.io.FormatException;import com.bbn.openmap.util.Debug;/** * This class wraps a feature type file (potext.tft, polbndl.lft, etc) * from VPF. It maintains sufficient information about the table it is * indexed from so that it can take a List of values, rather than a * single value. It also knows about its containing CoverageTable so * it can look up information in int.vdt and char.vdt. */public class FeatureClassInfo extends DcwRecordFile implements TerminatingRunnable, com.bbn.openmap.io.Closable { /** the table to look up .vdt info from */ final private CoverageTable ctable; /** * The name of our column from the primitive table (e.g. * potext.tft_id). This is the name of the column that will let * you know, in the primitive file (like edg), what type of * primitive (featurewise) is being reprensented on that row. This * field does not always exist! If it doesn't, all the features in * the file are rendered. */ final private String columnname; /** the column number in the primitive table for columnname */ private int mycolumn = -1; /** true means the object has run(), false otherwise */ private boolean fullInit = false; /** things constructed with deferred initialization get queued here */ // private static RunQueue tq = new RunQueue(true, Thread.MIN_PRIORITY, true); /** temporary list for use in getDescription() */ final private List tmpVec = new ArrayList(); // Feature Classes cross reference each other. For any feature // class name, you can have: // // 1) a DcwRecordFile (EdgeTable, NodeTable, AreaTable, // TextTable), with a certain column used as an ID, reference a // FeatureTable with a column that uses that ID. // // 2) a FeatureTable (.pft, .aft, .lft, .tft) using a column // holding an ID, referencing a DcwRecordFile with a column // holding that ID. // // The FeatureTable shows, for a particular feature type, the // individual primitive features for that particular feature type, // their FACC code, what tile that feature resides in, and the // feature ID number in that tile. // // The DcwRecordFile contains the actual data for the primitive, // and each DceRecordFile contains like feature primitives (edges, // areas, text, points). Each line in the DcwRecordFile contains // the ID number of the primitive, /** * Construct a FeatureClassInfo. * * @param cthis the CoverageTable to use for vdt lookups * @param colname the column name from the primitive table * @param tablepath the directory of the feature table * @param ftname the name of the feature type * @exception FormatException some error was encountered */ public FeatureClassInfo(CoverageTable cthis, String colname, String tablepath, String ftname) throws FormatException { super(tablepath + ftname, true); //defer initialization if (Debug.debugging("vpf.fci")) { Debug.output("FCI: set to peruse (" + filename + ")\n\tcreated with colname (" + colname + ")\n\ttablepath (" + tablepath + ")\n\tftname (" + ftname + ")"); } ctable = cthis; columnname = colname.toLowerCase().intern(); } /** the name of the primitive file: edg, fac, end, cnd */ protected String tileFileName; /** the name of the column with the primitive id */ protected String tileFileColName; /** the type of feature this table represents */ protected char featureType; /** * Construct a FeatureClassInfo that can be used for feature * search * * @param cthis the CoverageTable to use for vdt lookups * @param colname the column name from the primitive table * @param tablepath the directory of the feature table * @param ftname the name of the feature type * @param tileDirFile the name of the primitive file * @param tileDirFileColName the name of the primitive id column * @exception FormatException some error was encountered */ public FeatureClassInfo(CoverageTable cthis, String colname, String tablepath, String ftname, String tileDirFile, String tileDirFileColName) throws FormatException { super(tablepath + ftname, false); //don't defer // initialization fullInit = true; ctable = cthis; columnname = colname.toLowerCase().intern(); tileFileName = tileDirFile; tileFileColName = tileDirFileColName; if ("fac".equals(tileFileName)) { featureType = CoverageTable.AREA_FEATURETYPE; } else if ("end".equals(tileFileName)) { featureType = CoverageTable.EPOINT_FEATURETYPE; } else if ("cnd".equals(tileFileName)) { featureType = CoverageTable.CPOINT_FEATURETYPE; } else if ("txt".equals(tileFileName)) { featureType = CoverageTable.TEXT_FEATURETYPE; } else if ("edg".equals(tileFileName)) { featureType = CoverageTable.EDGE_FEATURETYPE; } else { featureType = CoverageTable.SKIP_FEATURETYPE; } if (Debug.debugging("vpf.fci")) { Debug.output("FCI: set to peruse (" + filename + ")\n\tcreated with column name (" + colname + ")\n\ttile directory file (" + tileDirFile + ")\n\ttile id column (" + tileDirFileColName + ")"); } } /** * Returns a TilingAdapter suitable for retrieving primitive ids * from records in this feature table. * * @return a tilingadapter or null */ public TilingAdapter getTilingAdapter() { return getTilingAdapter(TILE_ID_COLUMN_NAME, tileFileColName); } /** the name of the column where tiling information lives */ public final static String TILE_ID_COLUMN_NAME = "tile_id"; /** * Returns the file name (no path info) of the thematic index for * the tile_id column. */ public String getTileThematicFileName() { if (columnInfo != null) { int colId = getTileIdIndex(); if (colId != -1) { return columnInfo[colId].getThematicIndexName(); } } return null; } /** the thematic index for the tile_id column */ protected DcwThematicIndex thematicIndex = null; /** * Causes the thematic index for the tile_id column to be * initilized. * * @param path the path to the directory where the index lives * @return true if a thematic index is available, false if not */ public synchronized boolean initThematicIndex(String path) { try { if (thematicIndex == null) { // See if we can use the thematic index to see which // tiles // have the features we want. String thematicIndexName = getTileThematicFileName(); if (thematicIndexName != null) { thematicIndex = new DcwThematicIndex(path + thematicIndexName, byteorder); } } } catch (FormatException fe) { if (Debug.debugging("vpf.FormatException")) { Debug.output("FeatureClassInfo.initTI: " + fe.getClass() + " " + fe.getMessage()); } return false; } return (thematicIndex != null); } /** * Returns the thematic index for the tile_id column, if it has * been initialized. * * @return null or a themaitc index for the column */ public DcwThematicIndex getThematicIndex() { return thematicIndex; } /** * Returns the column position of the tile_id column. * * @see DcwRecordFile#whatColumn(String) */ public int getTileIdIndex() { return whatColumn(TILE_ID_COLUMN_NAME); } /** * Returns the column position of the f_code column. * * @see DcwRecordFile#whatColumn(String)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -