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

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

?? miffile.java

?? .mif .mid file read and write
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
/*
 *    GeoTools - OpenSource mapping toolkit
 *    http://geotools.org
 *    (C) 2005-2006, GeoTools Project Managment Committee (PMC)
 * 
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */
package org.geotools.data.mif;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URI;
import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Vector;
import java.util.logging.Logger;

import org.geotools.data.FeatureReader;
import org.geotools.data.FeatureWriter;
import org.geotools.feature.AttributeTypeBuilder;
import org.geotools.feature.AttributeTypes;
import org.geotools.feature.FeatureTypes;
import org.geotools.feature.SchemaException;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.LinearRing;
import com.vividsolutions.jts.geom.MultiLineString;
import com.vividsolutions.jts.geom.MultiPolygon;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.PrecisionModel;
import com.vividsolutions.jts.geom.TopologyException;
import com.vividsolutions.jts.io.ParseException;


/**
 * <p>
 * MIFFile class allows sequential reading and writing of Features in MapInfo
 * MIF/MID text file format with a  FeatureReader<SimpleFeatureType, SimpleFeature> and FeatureWriter.
 * </p>
 * 
 * <p>
 * This class has been developed starting from MapInfoDataSource.
 * </p>
 * 
 * <p>
 * Open issues:
 * </p>
 * 
 * <ul>
 * <li>
 * CoordSys clause parsing is still not supported
 * </li>
 * </ul>
 * 
 *
 * @author Luca S. Percich, AMA-MI
 * @author Paolo Rizzi, AMA-MI
 * @source $URL: http://svn.geotools.org/trunk/modules/unsupported/mif/src/main/java/org/geotools/data/mif/MIFFile.java $
 * @version $Id: MIFFile.java 29414 2008-02-21 12:35:44Z groldan $
 */
public class MIFFile {
    // Geometry type identifier constants 
    private static final String TYPE_NONE = "none";
    private static final String TYPE_POINT = "point";
    private static final String TYPE_LINE = "line";
    private static final String TYPE_PLINE = "pline";
    private static final String TYPE_REGION = "region";
    private static final String TYPE_TEXT = "text";

    // The following object types are still not supported
    private static final String TYPE_ARC = "arc";
    private static final String TYPE_RECT = "rect"; // could be converted to polygon
    private static final String TYPE_ROUNDRECT = "roundrect";
    private static final String TYPE_ELLIPSE = "ellipse";

    // New types introduced after version 6.0, still not supported
    private static final String TYPE_MULTIPOINT = "multipoint";
    private static final String TYPE_COLLECTION = "collection";

    // String Style Constants  
    private static final String CLAUSE_SYMBOL = "symbol";
    private static final String CLAUSE_PEN = "pen";
    private static final String CLAUSE_SMOOTH = "smooth";
    private static final String CLAUSE_CENTER = "center";
    private static final String CLAUSE_BRUSH = "brush";
    private static final String CLAUSE_FONT = "font";
    private static final String CLAUSE_ANGLE = "angle";
    private static final String CLAUSE_JUSTIFY = "justify";
    private static final String CLAUSE_SPACING = "spacing";
    private static final String CLAUSE_RIGHT = "right";
    private static final String CLAUSE_LABEL = "label";

    // Header parse Constants (& parameter names) 
    private static final String CLAUSE_COLUMNS = "columns";
    public static final int MAX_STRING_LEN = 255; // Max length for MapInfo Char() fields

    // Some (by now useless) default values
    private static final String DEFAULT_PEN = "Pen (1,2,0)";
    private static final String DEFAULT_BRUSH = "Brush (2,16777215,16777215)";
    private static final String DEFAULT_SYMBOL = "Symbol (34,0,12)";
    private static Logger LOGGER = org.geotools.util.logging.Logging.getLogger(
            "org.geotools.data.mif.MIFFile");

    // Header information
    private HashMap header = new HashMap();

    // File IO Variables
    private File mifFile = null;

    // File IO Variables
    private File midFile = null;

    // File IO Variables
    private File mifFileOut = null;

    // File IO Variables
    private File midFileOut = null;
    private Object[] featureDefaults = null;
    private char chDelimiter = '\t'; // TAB is the default delimiter if not specified in header

    // Schema variables
    private SimpleFeatureType featureType = null;
    private int numAttribs = 0;
    private int geomFieldIndex = -1;
    private URI namespace = null;

    // Parameters for coordinate transformation during file i/o
    private boolean useTransform = false;
    private float multX = 1;
    private float multY = 1;
    private float sumX = 0;
    private float sumY = 0;

    // Options & parameters
    private GeometryFactory geomFactory = null;
    private Integer SRID = new Integer(0);
    private String fieldNameCase;
    private String geometryName;
    private String geometryClass;
    private boolean toGeometryCollection = false;

    /**
     * <p>
     * This constructor opens an existing MIF/MID file, and creates the
     * corresponding schema from the file header
     * </p>
     * 
     * <p>
     * Allowed parameters in params Map:
     * </p>
     * 
     * <ul>
     * <li>
     * "namespace" = URI of the namespace prefix for FeatureTypes
     * </li>
     * <li>
     * PARAM_GEOMFACTORY = GeometryFactory object to be used for creating
     * geometries; alternatively, use PARAM_SRID;
     * </li>
     * <li>
     * PARAM_SRID = SRID to be used for creating geometries;
     * </li>
     * <li>
     * PARAM_FIELDCASE = field names tranformation: "upper" to uppercase |
     * "lower" to lowercase | "" none;
     * </li>
     * <li>
     * PARAM_GEOMNAME = &lt;String&gt, name of the geometry field (defaults to
     * "the_geom");
     * </li>
     * <li>
     * PARAM_GEOMTYPE = geometry type handling: "untyped" uses Geometry class |
     * "typed" force geometry to the type of the first valid geometry found in
     * file | "multi" like typed, but forces LineString to MultilineString and
     * Polygon to MultiPolygon; | "Point" | "LineString" | "MultiLineString" |
     * "Polygon" | "MultiPolygon" | "Text" forces Geometry to Point and
     * creates a MIF_TEXT String field in the schema
     * </li>
     * </ul>
     * 
     * <p>
     * Header clauses values can also be set in the params Map, but they might
     * be overridden by values read from MIF header.
     * </p>
     * 
     * <p>
     * Basic usage:
     * </p>
     * <pre><code>
     *   HashMap params = new HashMap();
     *   // params.put(MIFFile.PARAM_GEOMFACTORY, new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING_SINGLE), SRID));
     *   params.put(MIFFile.PARAM_SRID, new Integer(SRID));
     *   params.put(MIFFile.PARAM_FIELDCASE, "upper");
     *   params.put(MIFFile.PARAM_GEOMNAME, "GEOM");
     *   params.put(MIFFile.PARAM_GEOMTYPE, "typed");
     *   MIFFile mf = new MIFFile("c:/some_path/file.mif",params);
     *   FeatureType ft = mf.getSchema();
     *    FeatureReader<SimpleFeatureType, SimpleFeature> fr = mf.getFeatureReader();	
     *   while (fr.hasNext()) {
     *   	Feature in = fr.next();
     *   	doSomethingWithFeature(in);
     *   }
     *   fr.close(); // closes file resources
     * </code></pre>
     *
     * @param path Full pathName of the mif file, can be specified without the
     *        .mif extension
     * @param params Parameters map
     *
     * @throws IOException If the specified mif file could not be opened
     */
    public MIFFile(String path, Map params) throws IOException {
        // TODO use url instead of String
        super();

        parseParams(params);

        initFiles(path, true);

        MIFFileTokenizer mifTokenizer = new MIFFileTokenizer(new BufferedReader(
                    new FileReader(mifFile)));

        try {
            readMifHeader(false, mifTokenizer);
        } catch (Exception e) {
            throw new IOException("Can't read MIF header: " + e.toString());
        } finally {
            try {
                mifTokenizer.close();
            } catch (Exception e) {
            }
        }
    }

    /**
     * <p>
     * This constructor creates a a new MIF/MID file given schema and path.  If
     * a .mif/.mid file pair already exists, it will be overwritten.
     * </p>
     * 
     * <p>
     * Basic usage:
     * </p>
     * <pre><code>
     *   HashMap params = new HashMap();
     *   params.put(MIFFile.MIFDataStore.HCLAUSE_COORDSYS, "Nonearth \"m\"");
     * 
     *   MIFFile mf = new MIFFile("c:/some_path/", ft, params);
     * 
     * 
     *   FeatureWriter fw = mf.getFeatureWriter();
     * 
     *   while(...) {
     * 	    Feature f = fw.next();
     * 			f.setAttribute(...,...);
     * 			fw.write();
     * 	 }
     * 
     *   fw.close();
     * </code></pre>
     *
     * @param path Full path & file name of the MIF file to create, can be
     *        specified without the .mif extension
     * @param featureType
     * @param params Parameter map
     *
     * @throws IOException Couldn't open the specified mif file for writing
     *         header
     * @throws SchemaException Error setting the given FeatureType as the MIF
     *         schema
     */
    public MIFFile(String path, SimpleFeatureType featureType, HashMap params)
        throws IOException, SchemaException {
        // TODO use url instead of String
        super();

        parseParams(params);

        setSchema(featureType);
        initFiles(path, false);

        PrintStream outMif = new PrintStream(new FileOutputStream(mifFile, false));
        PrintStream outMid = new PrintStream(new FileOutputStream(midFile, false));

        // writes out header
        outMif.println(exportHeader());

        outMif.close();
        outMid.close();
    }

    /**
     * Parses the parameters map into fields:
     *
     * @param params
     *
     * @throws IOException Error getting parameters from the specified map
     */
    private void parseParams(Map params) throws IOException {
        if (params == null) {
            params = new HashMap();
        }

        // Sets defaults for header
        setHeaderClause(MIFDataStore.HCLAUSE_VERSION,
            (String) getParam(MIFDataStore.HCLAUSE_VERSION, "300", false, params));
        setHeaderClause(MIFDataStore.HCLAUSE_CHARSET,
            (String) getParam(MIFDataStore.HCLAUSE_CHARSET, "WindowsLatin1",
                false, params));
        setHeaderClause(MIFDataStore.HCLAUSE_DELIMITER,
            (String) getParam(MIFDataStore.HCLAUSE_DELIMITER,
                String.valueOf(chDelimiter), false, params));
        chDelimiter = getHeaderClause(MIFDataStore.HCLAUSE_DELIMITER).charAt(0);

        setHeaderClause(MIFDataStore.HCLAUSE_UNIQUE,
            (String) getParam(MIFDataStore.HCLAUSE_UNIQUE, "", false, params));
        setHeaderClause(MIFDataStore.HCLAUSE_INDEX,
            (String) getParam(MIFDataStore.HCLAUSE_INDEX, "", false, params));
        setHeaderClause(MIFDataStore.HCLAUSE_COORDSYS,
            (String) getParam(MIFDataStore.HCLAUSE_COORDSYS, "", false, params));
        setHeaderClause(MIFDataStore.HCLAUSE_TRANSFORM,
            (String) getParam(MIFDataStore.HCLAUSE_TRANSFORM, "", false, params));

        SRID = (Integer) getParam(MIFDataStore.PARAM_SRID, new Integer(0),
                false, params);

        geomFactory = (GeometryFactory) getParam(MIFDataStore.PARAM_GEOMFACTORY,
                null, false, params);

        if (geomFactory == null) {
            geomFactory = new GeometryFactory(new PrecisionModel(

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区三| 精品播放一区二区| 亚洲精品免费在线观看| av在线不卡观看免费观看| 国产欧美日韩在线看| 国产宾馆实践打屁股91| 国产欧美1区2区3区| 高清beeg欧美| 亚洲欧美电影一区二区| 在线观看成人免费视频| 亚洲一区二区在线视频| 7777精品伊人久久久大香线蕉的 | 亚洲国产一区二区在线播放| 日本韩国一区二区| 亚洲国产视频网站| 欧美一级高清大全免费观看| 久久国产综合精品| 国产欧美一区视频| 色综合久久88色综合天天| 亚洲午夜影视影院在线观看| 欧美精品一卡两卡| 韩日欧美一区二区三区| 国产精品久久久久久久久久久免费看 | 色综合中文字幕国产 | 激情五月激情综合网| 欧美国产精品专区| 欧美综合色免费| 精品系列免费在线观看| 最好看的中文字幕久久| 欧美三级电影在线看| 久久99精品久久只有精品| 国产精品毛片大码女人| 欧美视频自拍偷拍| 国产原创一区二区| 亚洲精品国产精品乱码不99| 欧美不卡在线视频| 91视频一区二区| 久久精品av麻豆的观看方式| 中文字幕中文在线不卡住| 日韩一区二区三区视频在线观看 | 高清av一区二区| 婷婷开心久久网| 国产亚洲成aⅴ人片在线观看| 在线观看亚洲一区| 国产高清一区日本| 日本不卡中文字幕| 日韩理论片一区二区| 精品欧美乱码久久久久久1区2区| 91丝袜高跟美女视频| 国模一区二区三区白浆| 婷婷六月综合亚洲| 亚洲精品国产精华液| 日韩精品一区二区在线观看| 在线国产电影不卡| 国产精品一级二级三级| 视频一区在线视频| 樱桃视频在线观看一区| 国产日韩v精品一区二区| 69精品人人人人| 欧美日韩在线播放| 91天堂素人约啪| 国产不卡视频在线观看| 国产一二三精品| 久久99精品久久久久久国产越南| 婷婷综合五月天| 亚洲国产你懂的| 亚洲乱码国产乱码精品精的特点| 日本一区二区视频在线观看| 国产日韩影视精品| 欧美电影精品一区二区| 91.com视频| 69堂国产成人免费视频| 欧美日韩免费观看一区二区三区| 91原创在线视频| jizzjizzjizz欧美| 成人综合婷婷国产精品久久免费| 国产乱淫av一区二区三区| 蜜桃av一区二区在线观看| 亚洲不卡在线观看| 亚洲电影一区二区三区| 一二三区精品视频| 亚洲大尺度视频在线观看| 国产精品久久久久久久久果冻传媒 | 亚洲另类色综合网站| 国产精品久久久久久久久晋中| 国产校园另类小说区| 久久久精品综合| 国产午夜亚洲精品不卡| 久久精品男人的天堂| 久久久久久久久久久99999| 日韩欧美国产一区二区三区| 精品国产一区二区三区不卡| 欧美电影免费观看完整版| 欧美电影免费观看完整版| 欧美精品一区二区久久久| 久久伊人蜜桃av一区二区| 国产亚洲女人久久久久毛片| 国产精品高潮呻吟| 亚洲精品久久嫩草网站秘色| 亚洲黄色性网站| 午夜欧美大尺度福利影院在线看| 天堂影院一区二区| 美女视频黄免费的久久 | 国产一区视频导航| 国产精品一卡二卡| 99久久久国产精品免费蜜臀| 色狠狠一区二区三区香蕉| 欧美日韩一区二区三区视频| 欧美三级日韩三级国产三级| 欧美一区二视频| 国产亚洲婷婷免费| 亚洲另类在线制服丝袜| 日韩国产欧美在线观看| 国产一区二区三区香蕉| 成人ar影院免费观看视频| 色综合色综合色综合色综合色综合| 欧美午夜片在线观看| 欧美电视剧免费观看| 国产人伦精品一区二区| 亚洲精品乱码久久久久| 久久99精品久久久久久国产越南 | 狠狠色丁香婷婷综合| 99视频在线观看一区三区| 欧美另类久久久品| 2021久久国产精品不只是精品| 国产精品第13页| 日韩高清不卡一区二区三区| 国产成人夜色高潮福利影视| 色综合久久天天| 久久中文字幕电影| 午夜欧美在线一二页| 波多野结衣亚洲一区| 欧美一区二区私人影院日本| 国产女同互慰高潮91漫画| 一区二区三区在线视频播放 | 亚洲欧美国产高清| 奇米精品一区二区三区在线观看 | 一区二区三区欧美| 国产精品原创巨作av| 欧美综合一区二区三区| 中文字幕欧美日韩一区| 一区二区三区欧美亚洲| 豆国产96在线|亚洲| 正在播放亚洲一区| 亚洲美女屁股眼交3| 国产一区二区在线观看视频| 欧美日韩成人在线一区| 国产精品久久影院| 黑人精品欧美一区二区蜜桃| 在线不卡a资源高清| 国产精品国产成人国产三级| 免费高清在线一区| 欧美在线观看视频一区二区三区 | 欧美日韩一级片在线观看| 中文一区二区在线观看| 精久久久久久久久久久| 777奇米四色成人影色区| 自拍偷拍亚洲欧美日韩| 国产白丝精品91爽爽久久| 欧美成人a在线| 日韩黄色一级片| 欧美日韩精品免费观看视频| 亚洲乱码国产乱码精品精的特点| 国产馆精品极品| 久久精品视频免费| 激情五月播播久久久精品| 日韩一区二区视频在线观看| 日韩和欧美一区二区三区| 欧美日韩在线免费视频| 亚洲激情av在线| 欧美中文字幕一区| 亚洲主播在线播放| 色婷婷综合视频在线观看| 国产精品久久久久久久久久免费看| 国产精品一色哟哟哟| 久久久久久久久久美女| 麻豆成人综合网| 日韩精品一区二区三区在线| 美日韩一级片在线观看| 日韩精品一区二区三区蜜臀| 精品在线播放免费| 久久久亚洲精华液精华液精华液| 国产精品影视天天线| 国产精品无人区| jlzzjlzz亚洲女人18| 亚洲精品国产a| 欧美日韩精品三区| 久久国产三级精品| 久久午夜色播影院免费高清| 国产成人在线色| 亚洲乱码日产精品bd| 欧美色图免费看| 蜜桃精品视频在线| 久久久久久97三级| 成人动漫一区二区三区| 亚洲免费观看在线视频| 制服丝袜成人动漫| 国产伦理精品不卡| 中文字幕在线播放不卡一区| 欧美亚男人的天堂|