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

📄 coveragetable.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                // nothing else that we care about for now                // symbol.rat could show up here, for example            }        } catch (FormatException f) {            System.out.println("internSchema: " + f.getMessage());        }    }    /**     * Get the path for this coverage     */    public String getDataPath() {        return tablepath;    }    /**     * Returns all the feature classes     */    public Map getFeatureClasses() {        return Collections.unmodifiableMap(featureTypes);    }    /**     * Returns the FeatureClassInfo object corresponding to the     * feature type. Returns null if the featureType doesn't exist.     *      * @return the feature class object for the feature type     * @param featureType the name of the feature to get     */    public FeatureClassInfo getFeatureClassInfo(String featureType) {        return (FeatureClassInfo) featureTypes.get(featureType);    }    public String getDescription(String t, String a, int v) {        CoverageIntVdt civ = new CoverageIntVdt(t, a, v);        return (String) intvdtrec.get(civ);    }    public String getDescription(String t, String a, String v) {        CoverageCharVdt civ = new CoverageCharVdt(t, a, v);        return (String) charvdtrec.get(civ);    }    private String getDescription(List id, FeatureClassInfo fti[],                                  MutableInt ret) {        if ((fti == null) || (fti.length == 0)) {            return null;        }        StringBuffer foo = null;        for (int i = 0; i < fti.length; i++) {            String desc = fti[i].getDescription(id, ret);            if (desc != null) {                if (foo == null) {                    foo = new StringBuffer(desc);                } else {                    foo.append(";; ").append(desc);                }            }        }        return ((foo == null) ? null : foo.toString());    }    public String getLineDescription(List lineid, MutableInt retval) {        return getDescription(lineid, lineinfo, retval);    }    public String getTextDescription(List textid, MutableInt retval) {        return getDescription(textid, textinfo, retval);    }    public String getEPointDescription(List pointid, MutableInt retval) {        return getDescription(pointid, epointinfo, retval);    }    public String getCPointDescription(List pointid, MutableInt retval) {        return getDescription(pointid, cpointinfo, retval);    }    public String getAreaDescription(List areaid, MutableInt retval) {        return getDescription(areaid, areainfo, retval);    }    public void setCoverateAttributeTable(CoverageAttributeTable cat) {        this.cat = cat;    }    public CoverageAttributeTable getCoverageAttributeTable() {        return cat;    }    /**     * Given a tile directory, go through the entries in the     * edg/fac/txt files, and send those entries to the warehouse. The     * warehouse will check their feature names with the feature names     * given to it in its properties, and eliminate the ones that it     * shouldn't draw.     */    public void drawTile(TileDirectory drawtd, VPFGraphicWarehouse warehouse,                         LatLonPoint ll1, LatLonPoint ll2, float dpplat,                         float dpplon) {        if (Debug.debugging("vpf.tile")) {            Debug.output("Drawtile for " + drawtd);        }        TableHolder tables = new TableHolder(this);        tables.drawTile(drawtd, warehouse, ll1, ll2, dpplat, dpplon);    }    /**     * This function uses the warehouse to get a list of features, and     * then looks in the featureList to see what feature tables handle     * those features. Using the appropriate feature table, the     * function then tracks down the tile that contains that feature,     * and the feature index into that tile file, and then contacts     * the warehouse to get that feature created into a graphic.     */    public boolean drawFeatures(VPFFeatureWarehouse warehouse, LatLonPoint ll1,                                LatLonPoint ll2, float dpplat, float dpplon) {        boolean didSomething = false;        TableHolder tables = new TableHolder(this);        // First, find the list of features, and interate through        // them. Use each one to go through it's feature table, if it        // exists. Then, from the feature table (perhaps check the        // FACC code, too), get the tile number and feature ID.        // Access the CoverageAttributeTable to get the tile (using a        // table from above), and check if it is within bounds. If it        // is, seek to get the feature. Once the feature has been        // read, contact the warehouse to use the row to build a        // graphic. Hold on to the tile in case (and it's likely)        // that the next feature desired is in the same tile). If it        // isn't, then dump the tile.        // Should sort the feature types by area, text and then lines,        // to do them in that order.        List featureList = warehouse.getFeatures();        for (Iterator it = featureList.iterator(); it.hasNext();) {            String currentFeature = (String) it.next();            // Figure out if the feature should be rendered, depending            // on what the warehouse settings are (drawedges,            // drawareas, drawtext).            char featureType = whatFeatureType(warehouse, currentFeature);            if (featureType == SKIP_FEATURETYPE) {                // Blow off this feature type.                continue;            }            if (Debug.debugging("vpf")) {                Debug.output("CoverageTable getting " + currentFeature                        + " features");            }            // Get the feature class for this feature type.            FeatureClassInfo fci = getFeatureClassInfo(currentFeature);            if ((fci == null) || (cat == null)) {                continue; //don't have enough info to procede                //in an untiled coverage, we could probably work                // without                //the cat            }            if (drawFeaturesFromThematicIndex(fci,                    warehouse,                    tables,                    ll1,                    ll2,                    dpplat,                    dpplon,                    currentFeature,                    featureType)) {                didSomething = true;                continue;            }            //couldn't use the tile_id thematic index, so just parse            // the            //whole file            boolean needToFindOurselves = true;            TilingAdapter fciTilingAdapter = fci.getTilingAdapter();            if (fciTilingAdapter == null) {                //no way to find primitives                continue;            }            TileDirectory currentTile = null;            // There are going to be a variable number of columns.            // We're interested in the f_code, tile_id, and the            // primitive id (fci independent depending on type).            int oldTileID = -2; //-1 is "untiled" tile_id            //          int faccIndex = fci.getFaccIndex()            // OK, now we are looking in the Feature class file.            try {                int getrow = 1;                for (List fcirow = new ArrayList(); fci.getRow(fcirow, getrow++);) {                    if (Debug.debugging("vpfdetail")) {                        Debug.output("CoverageTable new feature " + fcirow);                    }                    int tileID = fciTilingAdapter.getTileId(fcirow);                    //                  String facc = (String)fcirow.get(faccIndex);                    // With tileID, find the tile and figure out if it                    // is needed.                    if (tileID != oldTileID) {                        tables.close();                        if (Debug.debugging("vpf.tile")) {                            Debug.output("CoverageTable.drawFeatures(): opening new tile ("                                    + tileID + ")");                        }                        currentTile = (tileID == -1) ? new TileDirectory()                                : cat.getTileWithID(tileID);                        if (currentTile == null) {                            Debug.error("VPFLayer|CoverageTable.drawFeatures: null tile from bogus ID ("                                    + tileID                                    + ") from "                                    + fci.filename                                    + ", skipping...");                            continue;                        }                        if ((tileID == -1)                                || currentTile.inRegion(ll1.getLatitude(),                                        ll2.getLatitude(),                                        ll2.getLongitude(),                                        ll1.getLongitude())) {                            // We should only be in here once, I                            // think, if the tile IDs are all stored                            // in order. If the tile IDs are laid out                            // in the FCI in jumbled order, only the                            // first group of features will be                            // gathered because the tile will appear                            // cached.                            if (!warehouse.needToFetchTileContents(currentFeature,                                    currentTile)) {                                if (Debug.debugging("vpf")) {                                    Debug.output("CoverageTable: Loaded Cached List for "                                            + currentFeature                                            + " and "                                            + currentTile.getPath());                                }                                continue;                            }                            if (Debug.debugging("vpf.tile")) {                                Debug.output("CoverageTable: Drawing "                                        + featureType + " features for "                                        + currentTile);                            }                            tables.setTables(featureType, currentTile);                            // Only need to do this once for a new                            // fci...                            if (needToFindOurselves) {                                needToFindOurselves = false;                                tables.findYourself(fci);                            }                        } else {                            tables.close();                        }                        oldTileID = tileID;                    }                    // If currentTile == null, then the tile                    // wasn't found, or it is outside the area of                    // interest. The tables in the TableHolder                    // (tables) will all be null, and the tables                    // drawFeature will return false...                    int primitiveID = fciTilingAdapter.getPrimId(fcirow);                    if (tables.drawFeature(primitiveID,                            warehouse,                            ll1,                            ll2,                            dpplat,                            dpplon,                            currentFeature)) {                        didSomething = true;                    }                }            } catch (FormatException f) {                if (Debug.debugging("vpf.FormatException")) {                    Debug.output("CoverageTable: Creating table: "                            + f.getClass() + " " + f.getMessage());                }            }            fci.close();        }        tables.close();        return didSomething;

⌨️ 快捷键说明

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