Revision 47732

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/utils/SHPFileWrite.java
202 202

  
203 203
        ShapeFileHeader2 header = new ShapeFileHeader2();
204 204

  
205
        header.write(m_bb, type, numberOfGeometries, fileLength / 2,
205
        header.write(m_bb, type, numberOfGeometries, fileLength, // / 2,
206 206
                bounds
207 207
                .getMinimum(0), bounds.getMinimum(1), bounds.getMaximum(0),
208 208
                bounds.getMaximum(1), 0, 0, 0, 0);
......
389 389
        }
390 390
        return SHP.NULL;
391 391
    }
392
    
393
    public int size() throws IOException {
394
        return (int) this.shpChannel.size();
395
    }
396

  
392 397
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPFeatureWriter.java
130 130
    }
131 131

  
132 132
    public void end() throws DataException {
133
        if (envelope == null) {
134
            try {
135
                envelope =
136
                    GEOM_MANAGER.createEnvelope(0, 0, 0, 0, SUBTYPES.GEOM2D);
137
            } catch (CreateEnvelopeException e) {
138
                LOGGER.error("Error creating the envelope", e);
133
        try {
134
            if (envelope == null) {
135
                try {
136
                    envelope
137
                        = GEOM_MANAGER.createEnvelope(0, 0, 0, 0, SUBTYPES.GEOM2D);
138
                } catch (CreateEnvelopeException e) {
139
                    LOGGER.error("Error creating the envelope", e);
140
                }
139 141
            }
142
            int shapeType = getShapeTypeAndSetSupportedGeometries(shpFeatureType);
143
            shpWrite.writeHeaders(envelope, shapeType, super.getRowCount(),
144
                shpWrite.size());
145
            super.end();
146
            shpWrite.close();
147
        } catch (IOException e) {
148
            throw new RuntimeException("Can't write SHP file.", e);
140 149
        }
141
        int shapeType = getShapeTypeAndSetSupportedGeometries(shpFeatureType);
142
        shpWrite.writeHeaders(envelope, shapeType, super.getRowCount(),
143
            fileSize);
144
        super.end();
145
        shpWrite.close();
146 150
    }
147 151

  
148 152
    public void append(Feature feature) throws DataException {

Also available in: Unified diff