亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? miffile.java

?? .mif .mid file read and write
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
                        coords[p] = readMIFCoordinate();
                    }

                    numpoints = 0;

                    lineStrings[i] = geomFactory.createLineString(coords);
                }

                if ((numsections == 1) && !toGeometryCollection) {
                    return (Geometry) lineStrings[0];
                }

                return (Geometry) geomFactory.createMultiLineString(lineStrings);
            } catch (Exception e) {
                throw new IOException(
                    "Exception reading PLine data from MIF file : "
                    + e.toString());
            }
        }

        /**
         * Reads Region (Polygon) information from the MIF stream
         *
         * @return The (MULTI)POLYGON object
         *
         * @throws IOException Error retrieving geometry from input MIF stream
         */
        private Geometry readRegionObject() throws IOException {
            try {
                int numpolygons = Integer.parseInt(mif.getToken(' ', true));

                Vector polygons = new Vector();

                LinearRing tmpRing = null;
                Polygon shell = null;
                LinearRing shellRing = null;
                Vector holes = null;
                boolean savePolygon;

                // Read all linearrings;
                for (int i = 0; i < numpolygons; i++) {
                    // Read coordinates & create ring
                    int numpoints = Integer.parseInt(mif.getToken(' ', true));
                    Coordinate[] coords = new Coordinate[numpoints + 1];

                    for (int p = 0; p < numpoints; p++) {
                        coords[p] = readMIFCoordinate();
                    }

                    coords[coords.length - 1] = coords[0];
                    tmpRing = geomFactory.createLinearRing(coords);

                    /*
                     * In MIF format a polygon is described as a list of rings, with no info wether
                     * a ring is a hole or a shell, so we have to determine it by checking if
                     * a ring in contained in the previously defined shell
                     */
                    if ((shell != null) && shell.contains(tmpRing)) {
                        holes.add(tmpRing);
                        tmpRing = null; // mark as done
                        savePolygon = (i == (numpolygons - 1));
                    } else {
                        // New polygon, must save previous if it's not the first ring
                        savePolygon = (i > 0);
                    }

                    if (savePolygon) {
                        LinearRing[] h = null;

                        if (holes.size() > 0) {
                            h = new LinearRing[holes.size()];

                            for (int hole = 0; hole < holes.size(); hole++) {
                                h[hole] = (LinearRing) holes.get(hole);
                            }
                        }

                        polygons.add(geomFactory.createPolygon(shellRing, h));

                        shellRing = null;
                    }

                    // Build the polygon needed for testing holes
                    if (tmpRing != null) {
                        shellRing = tmpRing;
                        shell = geomFactory.createPolygon(shellRing, null);
                        holes = new Vector();
                    }
                }

                if (shellRing != null) {
                    polygons.add(geomFactory.createPolygon(shellRing, null));
                }

                try {
                    if ((polygons.size() == 1) && !toGeometryCollection) {
                        return (Polygon) polygons.get(0);
                    }

                    Polygon[] polys = new Polygon[polygons.size()];

                    for (int i = 0; i < polygons.size(); i++) {
                        polys[i] = (Polygon) polygons.get(i);
                    }

                    return geomFactory.createMultiPolygon(polys);
                } catch (TopologyException topexp) {
                    throw new TopologyException(
                        "TopologyException reading Region polygon : "
                        + topexp.toString());
                }
            } catch (Exception e) {
                throw new IOException(
                    "Exception reading Region data from MIF file : "
                    + e.toString());
            }
        }

        /**
         * Reads a couple of coordinates (x,y) from input stream, applying the
         * transform factor if required.
         *
         * @return A Coordinate object, or null if error encountered
         *
         * @throws IOException if couldn't build a valid Coordinate object
         */
        private Coordinate readMIFCoordinate() throws IOException {
            String x;
            String y;

            try {
                x = mif.getToken(' ', true);
                y = mif.getToken();

                if (x.equals("") || y.equals("")) {
                    throw new IOException("End of file.");
                }

                Coordinate result = new Coordinate(Double.parseDouble(x),
                        Double.parseDouble(y));

                if (useTransform) {
                    result.x = (result.x * multX) + sumX;
                    result.y = (result.y * multY) + sumY;
                }

                return result;
            } catch (Exception e) {
                throw new IOException("Error getting coordinates: "
                    + e.toString());
            }
        }

        /**
         * Reads Point information from the MIF stream
         *
         * @return The next POINT object read
         *
         * @throws IOException Error retrieving geometry from input MIF stream
         */
        private Geometry readPointObject() throws IOException {
            return geomFactory.createPoint(readMIFCoordinate());
        }

        /**
         * Reads Line information from the MIF stream
         *
         * @return a LINESTRING object
         *
         * @throws IOException Error retrieving geometry from input MIF stream
         */
        private Geometry readLineObject() throws IOException {
            Coordinate[] cPoints = new Coordinate[2];
            cPoints[0] = readMIFCoordinate();
            cPoints[1] = readMIFCoordinate();

            LineString[] result = { geomFactory.createLineString(cPoints) };

            if (toGeometryCollection) {
                return geomFactory.createMultiLineString(result);
            }

            return result[0];
        }

        private Geometry readTextObject() throws IOException {
            try {
                mifText = mif.getToken(' ', true, true);
            } catch (ParseException e) {
                throw new IOException(e.getMessage());
            }

            Coordinate c1 = readMIFCoordinate();
            Coordinate c2 = readMIFCoordinate();
            Coordinate p = new Coordinate((c1.x + c2.x) / 2, (c1.y + c2.y) / 2);

            return geomFactory.createPoint(p);
        }
    }

    /**
     * <p>
     * MIF FeatureWriter
     * </p>
     */
    private class Writer implements FeatureWriter<SimpleFeatureType, SimpleFeature> {
        private PrintStream outMif = null;
        private PrintStream outMid = null;
        private  FeatureReader<SimpleFeatureType, SimpleFeature> innerReader = null;
        private MIFValueSetter[] fieldValueSetters;
        private SimpleFeature editFeature = null;
        private SimpleFeature originalFeature = null;

        private Writer(PrintStream mif, PrintStream mid, boolean append)
            throws IOException {
            innerReader = getFeatureReader();

            try {
                fieldValueSetters = getValueSetters();
            } catch (SchemaException e) {
                throw new IOException(e.getMessage());
            }

            outMif = mif;
            outMid = mid;

            try {
                if (!append) {
                    outMif.println(exportHeader());
                }
            } catch (Exception e) {
                outMif = null;
                outMid = null;
                throw new IOException(e.getMessage());
            }
        }

        public SimpleFeatureType getFeatureType() {
            return featureType;
        }

        public SimpleFeature next() throws IOException {
            try {
                if (originalFeature != null) {
                    writeFeature(originalFeature); // keep the original
                }

                if (innerReader.hasNext()) {
                    originalFeature = innerReader.next(); // ;
                    editFeature = SimpleFeatureBuilder.copy(originalFeature);
                    } else {
                    originalFeature = null;
                    editFeature = SimpleFeatureBuilder.build(featureType, featureDefaults, null); 
                }

                return editFeature;
            } catch (Exception e) {
                throw new IOException(e.toString());
            }
        }

        public void remove() throws IOException {
            if (editFeature == null) {
                throw new IOException("Current feature is null");
            }

            editFeature = null;
            originalFeature = null;
        }

        public void write() throws IOException {
            if (editFeature == null) {
                throw new IOException("Current feature is null");
            }

            try {
                writeFeature(editFeature);
            } catch (Exception e) {
                editFeature = null;
                throw new IOException("Can't write feature: " + e.toString());
            }

            editFeature = null;
            originalFeature = null;
        }

        public boolean hasNext() throws IOException {
            return innerReader.hasNext();
        }

        public void close() throws IOException {
            while (hasNext())
                next();

            try {
                if (originalFeature != null) {
                    writeFeature(originalFeature); // keep the original
                }
            } catch (Exception e) {
            }

            innerReader.close();
            innerReader = null;

            try {
                if (outMif != null) {
                    outMif.close();
                }

                if (outMid != null) {
                    outMid.close();
                }

                copyFileAndDelete(mifFileOut, mifFile, true);
                copyFileAndDelete(midFileOut, midFile, true);
            } catch (IOException e) {
            } finally {
                outMid = null;
                outMif = null;
            }
        }

        protected void finalize() throws Throwable {
            close();
            super.finalize();
        }

        /**
         * Writes the given Feature to file
         *
         * @param f The feature to write
         *
         * @throws IOException if cannot access file for reading
         * @throws SchemaException if given Feature is not compatible with
         *         MIFFile FeatureType. TODO: private
         */
        public void writeFeature(SimpleFeature f) throws IOException, SchemaException {
            if ((outMif == null) || (outMid == null)) {
                throw new IOException(
                    "Output stream has not been opened for writing.");
            }

            Geometry theGeom = (geomFieldIndex >= 0)
                ? (Geometry) f.getAttribute(geomFieldIndex) : null;
            String outGeom = exportGeometry(theGeom);

            if (outGeom.equals("")) {
                throw new SchemaException("Unsupported geometry type: "
                    + theGeom.getClass().getName());
            }

            outMif.println(outGeom);

            int col;
            String outBuf = "";

       

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品第13页| 不卡av免费在线观看| 国产不卡在线一区| 欧美日免费三级在线| 久久精品一区二区| 天天亚洲美女在线视频| 99精品久久免费看蜜臀剧情介绍| 欧美一区二区久久久| 亚洲乱码国产乱码精品精小说| 黄色资源网久久资源365| 日本韩国欧美一区| 国产精品第一页第二页第三页| 精品制服美女丁香| 制服视频三区第一页精品| 亚洲精品免费在线观看| 成人性生交大合| 久久久久久9999| 毛片av一区二区| 欧美乱妇20p| 亚洲一区二区欧美| 91麻豆.com| ●精品国产综合乱码久久久久| 韩国一区二区在线观看| 欧美成人乱码一区二区三区| 午夜视频在线观看一区二区 | 国产精品美日韩| 久久99久久久久| 日韩三级高清在线| 美美哒免费高清在线观看视频一区二区 | 艳妇臀荡乳欲伦亚洲一区| 国产成人免费视频精品含羞草妖精| 91精品国产91久久综合桃花| 午夜视频在线观看一区二区三区| 欧美性一区二区| 亚洲成人精品一区| 欧美另类变人与禽xxxxx| 日韩av电影免费观看高清完整版 | 国产日韩精品一区二区三区| 韩国v欧美v日本v亚洲v| 久久免费的精品国产v∧| 国产成人午夜电影网| 国产精品三级视频| 成人黄色在线视频| 亚洲美女视频一区| 欧美唯美清纯偷拍| 日本伊人精品一区二区三区观看方式 | 久久午夜电影网| 国产福利一区在线| 国产精品福利一区二区三区| 91原创在线视频| 亚洲成av人影院| 日韩欧美国产麻豆| 国产精品一区二区在线看| 国产精品嫩草影院av蜜臀| 91亚洲精品久久久蜜桃| 视频一区在线播放| 2023国产精品| 成人激情综合网站| 一区二区三区中文免费| 精品免费视频.| jizzjizzjizz欧美| 亚洲成人三级小说| 国产欧美一二三区| 91国产丝袜在线播放| 免费成人结看片| 国产精品蜜臀在线观看| 9191久久久久久久久久久| 精久久久久久久久久久| 日韩美女精品在线| 91精品国产综合久久精品图片| 久久99久国产精品黄毛片色诱| 国产精品久久久久影视| 欧美日韩一级片网站| 国产一区二区影院| 亚洲免费在线看| wwwwxxxxx欧美| 欧美吞精做爰啪啪高潮| 成人午夜免费视频| 青青草97国产精品免费观看无弹窗版 | 国产成人综合网站| 五月婷婷欧美视频| 国产精品久线观看视频| 欧美精品777| 一本一本大道香蕉久在线精品| 精品午夜一区二区三区在线观看| 亚洲一区在线观看视频| 国产日产精品1区| 日韩欧美色综合网站| 日本精品视频一区二区三区| 成人久久18免费网站麻豆| 另类成人小视频在线| 洋洋成人永久网站入口| 国产精品福利av| 国产亚洲成av人在线观看导航| 欧美一区二区三区在线视频| 色婷婷精品大在线视频 | 久久99深爱久久99精品| 伊人夜夜躁av伊人久久| 国产人妖乱国产精品人妖| 日韩精品一区二区三区在线| 欧美亚洲国产怡红院影院| 99久久综合国产精品| 国产九色sp调教91| 久久国产生活片100| 首页国产丝袜综合| 丝袜美腿亚洲综合| 亚洲一区二区三区在线播放| 亚洲欧美日韩在线| 1024国产精品| 樱桃国产成人精品视频| 亚洲日本乱码在线观看| 国产精品乱码久久久久久| 久久精品亚洲乱码伦伦中文| 精品国产免费人成在线观看| 日韩美女在线视频| 日韩精品一区二区三区在线观看| 日韩欧美国产1| 日韩精品一区二区三区中文精品| 欧美变态凌虐bdsm| www国产精品av| 亚洲国产精品精华液ab| 欧美国产乱子伦| 自拍偷在线精品自拍偷无码专区| 中文字幕一区二区三区在线播放| 日韩理论片中文av| 亚洲综合色婷婷| 日韩电影在线免费观看| 美日韩黄色大片| 国产一区二区三区观看| 国产成人精品午夜视频免费| 成人av在线看| 在线免费观看日本欧美| 欧美日韩成人高清| 欧美一级生活片| 国产天堂亚洲国产碰碰| 国产精品电影院| 五月激情丁香一区二区三区| 久久精品国产第一区二区三区| 国产一区高清在线| 91在线你懂得| 欧美久久久久久久久久| 欧美精品一区二区三区视频| 亚洲欧洲色图综合| 午夜影院久久久| 国产精品一级片| 欧美视频一区二区三区四区 | 日本一区二区成人| 亚洲国产精品人人做人人爽| 麻豆精品新av中文字幕| 99麻豆久久久国产精品免费| 欧美日韩国产a| 欧美激情一区二区三区蜜桃视频 | 一区二区三区四区在线| 视频在线观看国产精品| 国产成人精品免费网站| 欧美日韩一区二区欧美激情| 久久综合九色综合欧美98 | 国产在线一区二区| 91国产视频在线观看| 久久人人97超碰com| 亚洲自拍偷拍麻豆| 国产成+人+日韩+欧美+亚洲| 91精品国产乱码久久蜜臀| 国产精品黄色在线观看| 蓝色福利精品导航| 欧美专区日韩专区| 中文在线一区二区| 青青草原综合久久大伊人精品 | 日韩欧美一二三| 亚洲欧美综合色| 韩国视频一区二区| 精品视频免费看| 综合分类小说区另类春色亚洲小说欧美| 美女性感视频久久| 欧美亚一区二区| 亚洲欧美日韩综合aⅴ视频| 国产酒店精品激情| 欧美大片免费久久精品三p| 一区二区三区**美女毛片| 国产传媒一区在线| 日韩欧美国产麻豆| 奇米色777欧美一区二区| 91国产丝袜在线播放| 亚洲视频一区在线观看| 高清成人免费视频| ww久久中文字幕| 美日韩一区二区| 日韩欧美三级在线| 欧美aaa在线| 欧美一卡2卡3卡4卡| 天堂资源在线中文精品| 欧美系列亚洲系列| 国产精品毛片大码女人| 国产99久久久国产精品潘金| 国产欧美一区二区精品性色超碰 | 天堂午夜影视日韩欧美一区二区| 色欧美乱欧美15图片| 综合久久综合久久| 色婷婷av一区二区三区gif| 亚洲乱码国产乱码精品精小说 |