Revision 47656 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVStoreProvider.java

View differences:

CSVStoreProvider.java
119 119
                        if (virtualrows == null) {
120 120
                            List<FeatureProvider> newdata = new ArrayList<>();
121 121
                            FeatureType ftype = getStoreServices().getDefaultFeatureType();
122
                            writer.initialize(getCSVParameters(), file, ftype, getCSVPreferences());
122
                            writer.initialize(getCSVParameters(), file, ftype, getCSVPreferences(), spatialIndexes);
123 123
                            writer.begin();
124 124
                            it = features.fastIterator();
125 125
                            taskStatus.setRangeOfValues(0, features.getSize());
......
136 136
                                newdata.add(feature);
137 137
                            }
138 138
                            data = newdata;
139
                            if (writer.getEnvelope() != null) {
140
                                envelope = writer.getEnvelope();
139
                            if (writer.getEnvelopes() != null) {
140
                                envelopes = writer.getEnvelopes();
141 141
                            } else {
142
                                envelope = null;
142
                                envelopes = null;
143 143
                            }
144 144
                            resource.notifyChanges();
145 145
                            writer.end();
146
                            bboxFileSave(envelope);
146
                            bboxFileSave(envelopes);
147 147
                        } else {
148 148

  
149 149
                            CSVStoreParameters csvParams = getCSVParameters();
......
154 154
                            tmpParams.setFile(tmpFile);
155 155

  
156 156
                            FeatureType ftype = getStoreServices().getDefaultFeatureType();
157
                            writer.initialize(tmpParams, tmpFile, ftype, getCSVPreferences(),spatialIndex);
157
                            writer.initialize(tmpParams, tmpFile, ftype, getCSVPreferences(),spatialIndexes);
158 158
                            writer.begin();
159 159
                            it = features.fastIterator();
160 160
                            taskStatus.setIndeterminate();
......
174 174
                                    feature.setOID(createNewOID());
175 175
                                }
176 176
                            }
177
                            if (writer.getEnvelope() != null) {
178
                                envelope = writer.getEnvelope();
177
                            if (writer.getEnvelopes() != null) {
178
                                envelopes = writer.getEnvelopes();
179 179
                            } else {
180
                                envelope = null;
180
                                envelopes = null;
181 181
                            }
182 182
                            resource.notifyChanges();
183 183
                            writer.end();
......
194 194
                                FileUtils.moveFile(tmpParams.getFile(), csvFile);
195 195
                                FileUtils.delete(new File(FilenameUtils.removeExtension(csvFile.getAbsolutePath())+".idx"));
196 196

  
197
                                bboxFileSave(envelope);
197
                                bboxFileSave(envelopes);
198 198

  
199 199
                                loadFeatures();
200 200
                            }
......
248 248
        getResource().execute(new ResourceAction() {
249 249
            @Override
250 250
            public Object run() throws Exception {
251
                writer.initialize(
252
                        getCSVParameters(),
251
                writer.initialize(getCSVParameters(),
253 252
                        getCSVParameters().getFile(),
254 253
                        getFeatureStore().getDefaultFeatureType(),
255
                        getCSVPreferences()
254
                        getCSVPreferences(),
255
                        spatialIndexes
256 256
                );
257 257
                writer.beginAppend();
258 258
                return null;
......
274 274
                    return null;
275 275
                }
276 276
            });
277
            if (writer.getEnvelope() != null) {
278
                envelope = writer.getEnvelope();
277
            if (writer.getEnvelopes() != null) {
278
                envelopes = writer.getEnvelopes();
279 279
            } else {
280
                envelope = null;
280
                envelopes = null;
281 281
            }
282 282
            writer.end();
283 283
            this.close();
284
            bboxFileSave(envelope);            
284
            bboxFileSave(envelopes);            
285 285
            
286 286
        } catch (Exception ex) {
287 287
            LOGGER.warn("Not been able to end append '" + this.getFullName() + "'.", ex);

Also available in: Unified diff