Package com.iver.cit.gvsig.fmap.drivers.shp.write

Examples of com.iver.cit.gvsig.fmap.drivers.shp.write.SHPFileWrite


        try {
         
          FileChannel shpChannel = (FileChannel) getWriteChannel(shpPath);
          FileChannel shxChannel = (FileChannel) getWriteChannel(shxPath);
            SHPFileWrite filewrite = new SHPFileWrite(shpChannel, shxChannel);

            IGeometry[] ig = new IGeometry[(int) dataSource.getRowCount()];
            for (int i = 0; i < ig.length; i++) {
                ig[i] = dataSource.getFMapGeometry(i);
            }
           
            int type = DriverUtilities.translate(dataSource.getGeometryType(), new int[]{
                FShape.POINT,
                FShape.MULTIPOINT,
                FShape.LINE,
                FShape.POLYGON
            }, new int[]{
                1,
                8,
                3,
                5,
            });

            filewrite.write(ig, type);
           
            shpChannel.close();
            shxChannel.close();
           
            String dbf = shpPath.substring(0, shpPath.length() - 3) + "dbf";
View Full Code Here


            throws DriverException {
        String dbfPath = path.substring(0, path.length() - 3) + "dbf";
        new DBFDriver().createSource(dbfPath, dsm);

        String shxPath = path.substring(0, path.length() - 3) + "shx";
        SHPFileWrite filewrite;

        try {
            filewrite = new SHPFileWrite((FileChannel) getWriteChannel(path),
                    (FileChannel) getWriteChannel(shxPath));
           
            int type = dsm.getGeometryType();
            switch (type) {
            case FShape.POINT:
                type = 1;
                break;
            case FShape.LINE:
                type = 3;
                break;
            case FShape.POLYGON:
                type = 5;
                break;
            case FShape.MULTIPOINT:
                type = 8;
                break;
            }

            filewrite.write(new IGeometry[0], type);
        } catch (IOException e) {
            throw new DriverException(e);
        } catch (ShapefileException e) {
            throw new DriverException(e);
        }
View Full Code Here

TOP

Related Classes of com.iver.cit.gvsig.fmap.drivers.shp.write.SHPFileWrite

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.