Revision 20744
trunk/libraries/libFMap_dataFile/src-test/org/gvsig/data/datastores/vectorial/file/DataExplorerTest.java | ||
---|---|---|
162 | 162 |
DataManager dsm=DataManager.getManager(); |
163 | 163 |
IDataExplorerParameters dsp = dsm.createDataExplorerParameters( |
164 | 164 |
name); |
165 |
((DataExplorerFileParameters)dsp).setSource(new File(file).getParentFile());
|
|
165 |
((FileExplorerParameters)dsp).setSource(new File(file).getParentFile());
|
|
166 | 166 |
IFeatureStoreExplorer src = (IFeatureStoreExplorer)dsm.createDataExplorer(dsp); |
167 | 167 |
src.remove(parameters); |
168 | 168 |
|
... | ... | |
173 | 173 |
IDataExplorerParameters dsp = dsm.createDataExplorerParameters( |
174 | 174 |
name); |
175 | 175 |
|
176 |
((DataExplorerFileParameters)dsp).setSource(new File(file).getParentFile());
|
|
176 |
((FileExplorerParameters)dsp).setSource(new File(file).getParentFile());
|
|
177 | 177 |
IFeatureStoreExplorer src; |
178 | 178 |
try { |
179 | 179 |
src = (IFeatureStoreExplorer)dsm.createDataExplorer(dsp); |
... | ... | |
204 | 204 |
DataManager dsm=DataManager.getManager(); |
205 | 205 |
IDataExplorerParameters dsp = dsm.createDataExplorerParameters( |
206 | 206 |
name); |
207 |
((DataExplorerFileParameters)dsp).setSource(new File(file).getParentFile());
|
|
207 |
((FileExplorerParameters)dsp).setSource(new File(file).getParentFile());
|
|
208 | 208 |
IFeatureStoreExplorer src; |
209 | 209 |
try { |
210 | 210 |
src = (IFeatureStoreExplorer)dsm.createDataExplorer(dsp); |
... | ... | |
230 | 230 |
|
231 | 231 |
IDataExplorerParameters dsp = dsm.createDataExplorerParameters( |
232 | 232 |
name); |
233 |
((DataExplorerFileParameters)dsp).setSource(new File(parent));
|
|
233 |
((FileExplorerParameters)dsp).setSource(new File(parent));
|
|
234 | 234 |
|
235 | 235 |
IDataExplorer src; |
236 | 236 |
try { |
trunk/libraries/libFMap_dataFile/src-test/org/gvsig/data/datastores/vectorial/file/DataStoreTest.java | ||
---|---|---|
9 | 9 |
import org.gvsig.data.DataManager; |
10 | 10 |
import org.gvsig.data.IDataCollection; |
11 | 11 |
import org.gvsig.data.IDataStoreParameters; |
12 |
import org.gvsig.data.IResourceNotification; |
|
13 | 12 |
import org.gvsig.data.Resource; |
14 | 13 |
import org.gvsig.data.ResourceManager; |
15 | 14 |
import org.gvsig.data.datastores.vectorial.file.dbf.DBFStore; |
... | ... | |
36 | 35 |
import org.gvsig.data.vectorial.IsNotAttributeSettingException; |
37 | 36 |
import org.gvsig.data.vectorial.visitor.PrintlnFeaturesVisitor; |
38 | 37 |
import org.gvsig.exceptions.BaseException; |
39 |
import org.gvsig.util.observer.IObservable; |
|
40 | 38 |
import org.gvsig.util.observer.IObserver; |
41 | 39 |
|
42 | 40 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
... | ... | |
1122 | 1120 |
Iterator iter = resMan.iterator(); |
1123 | 1121 |
while (iter.hasNext()){ |
1124 | 1122 |
obj = iter.next(); |
1125 |
if (obj instanceof IFileResource){
|
|
1123 |
if (obj instanceof FileResource){ |
|
1126 | 1124 |
tmpRes = (Resource)obj; |
1127 |
if (((IFileResource)tmpRes).getFile().getAbsoluteFile().equals(params.getFile().getAbsoluteFile())){
|
|
1125 |
if (((FileResource)tmpRes).getFile().getAbsoluteFile().equals(params.getFile().getAbsoluteFile())){ |
|
1128 | 1126 |
i++; |
1129 | 1127 |
res=tmpRes; |
1130 | 1128 |
} |
... | ... | |
1219 | 1217 |
} |
1220 | 1218 |
|
1221 | 1219 |
|
1222 |
((IFileResource)res).getFile().setLastModified(System.currentTimeMillis());
|
|
1220 |
((FileResource)res).getFile().setLastModified(System.currentTimeMillis()); |
|
1223 | 1221 |
|
1224 | 1222 |
isOk=false; |
1225 | 1223 |
try{ |
... | ... | |
1265 | 1263 |
iter = resMan.iterator(); |
1266 | 1264 |
while (iter.hasNext()){ |
1267 | 1265 |
obj = iter.next(); |
1268 |
if (obj instanceof IFileResource){
|
|
1266 |
if (obj instanceof FileResource){ |
|
1269 | 1267 |
tmpRes = (Resource)obj; |
1270 |
if (((IFileResource)tmpRes).getFile().getAbsoluteFile().equals(params.getFile().getAbsoluteFile())){
|
|
1268 |
if (((FileResource)tmpRes).getFile().getAbsoluteFile().equals(params.getFile().getAbsoluteFile())){ |
|
1271 | 1269 |
i++; |
1272 | 1270 |
res=tmpRes; |
1273 | 1271 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/DataExplorerFile.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.gvsig.data.DataManager; |
|
6 |
import org.gvsig.data.IDataStore; |
|
7 |
import org.gvsig.data.IDataStoreParameters; |
|
8 |
import org.gvsig.data.INewDataStoreParameters; |
|
9 |
import org.gvsig.data.exception.InitializeException; |
|
10 |
import org.gvsig.data.exception.ReadException; |
|
11 |
import org.gvsig.data.exception.WriteException; |
|
12 |
import org.gvsig.data.vectorial.IFeatureStoreExplorer; |
|
13 |
import org.gvsig.data.vectorial.INewFeatureStoreParameters; |
|
14 |
|
|
15 |
public abstract class DataExplorerFile implements IFeatureStoreExplorer{ |
|
16 |
|
|
17 |
public boolean canCreate() { |
|
18 |
return false; |
|
19 |
} |
|
20 |
|
|
21 |
public IDataStore createDataStore(IDataStoreParameters dsp) throws InitializeException { |
|
22 |
DataManager manager = DataManager.getManager(); |
|
23 |
return manager.createDataStore(dsp); |
|
24 |
} |
|
25 |
|
|
26 |
protected abstract boolean isValid(String file); |
|
27 |
protected abstract boolean isValid(File file); |
|
28 |
|
|
29 |
public IDataStoreParameters add(INewFeatureStoreParameters ndsp) throws WriteException,InitializeException { |
|
30 |
throw new UnsupportedOperationException(); |
|
31 |
} |
|
32 |
|
|
33 |
public IDataStoreParameters add(INewDataStoreParameters ndsp) throws WriteException, InitializeException { |
|
34 |
return this.add((INewFeatureStoreParameters)ndsp); |
|
35 |
} |
|
36 |
|
|
37 |
public void remove(IDataStoreParameters dsp) throws ReadException { |
|
38 |
throw new UnsupportedOperationException(); |
|
39 |
|
|
40 |
} |
|
41 |
|
|
42 |
public INewDataStoreParameters createNewDataStoreParameter() { |
|
43 |
throw new UnsupportedOperationException(); |
|
44 |
} |
|
45 |
|
|
46 |
|
|
47 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/DataExplorerFileParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.gvsig.data.IDataExplorerParameters; |
|
6 |
|
|
7 |
public abstract class DataExplorerFileParameters implements IDataExplorerParameters{ |
|
8 |
protected File source; |
|
9 |
|
|
10 |
public void setSource(File source){ |
|
11 |
this.source = source; |
|
12 |
} |
|
13 |
|
|
14 |
public File getSource(){ |
|
15 |
return this.source; |
|
16 |
} |
|
17 |
|
|
18 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/IFileResource.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
package org.gvsig.data.datastores.vectorial.file; |
|
32 |
|
|
33 |
import java.io.File; |
|
34 |
|
|
35 |
import org.gvsig.data.exception.OpenException; |
|
36 |
|
|
37 |
/** |
|
38 |
* @author jmvivo |
|
39 |
* |
|
40 |
*/ |
|
41 |
public interface IFileResource { |
|
42 |
public File getFile(); |
|
43 |
|
|
44 |
/** |
|
45 |
* |
|
46 |
* @return number of real files used by this resource |
|
47 |
*/ |
|
48 |
public int getTotalFiles(); |
|
49 |
|
|
50 |
public boolean isEditable(); |
|
51 |
} |
|
52 |
|
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/shp/ShpFeaturesWriter.java | ||
---|---|---|
9 | 9 |
import org.gvsig.data.datastores.vectorial.file.dbf.utils.DbaseFileHeader; |
10 | 10 |
import org.gvsig.data.datastores.vectorial.file.shp.utils.SHP; |
11 | 11 |
import org.gvsig.data.datastores.vectorial.file.shp.utils.SHPFileWrite; |
12 |
import org.gvsig.data.exception.DataException; |
|
12 | 13 |
import org.gvsig.data.exception.InitializeWriterException; |
13 | 14 |
import org.gvsig.data.exception.OpenException; |
14 | 15 |
import org.gvsig.data.exception.ReadException; |
... | ... | |
168 | 169 |
throw new InitializeWriterException("SHP Feature Writer",e); |
169 | 170 |
} |
170 | 171 |
} |
172 |
|
|
173 |
/* (non-Javadoc) |
|
174 |
* @see org.gvsig.data.datastores.vectorial.file.dbf.DBFFeaturesWriter#dispose() |
|
175 |
*/ |
|
176 |
public void dispose() throws DataException { |
|
177 |
super.dispose(); |
|
178 |
if (this.shpWrite != null){ |
|
179 |
this.shpWrite.close(); |
|
180 |
this.shpWrite = null; |
|
181 |
} |
|
182 |
this.fullExtent = null; |
|
183 |
|
|
184 |
} |
|
171 | 185 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/shp/SHPStore.java | ||
---|---|---|
13 | 13 |
import org.gvsig.data.IDataStoreParameters; |
14 | 14 |
import org.gvsig.data.ResourceManager; |
15 | 15 |
import org.gvsig.data.datastores.vectorial.IFeaturesWriter; |
16 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFileParameters;
|
|
16 |
import org.gvsig.data.datastores.vectorial.file.FileExplorerParameters;
|
|
17 | 17 |
import org.gvsig.data.datastores.vectorial.file.dbf.DBFStore; |
18 | 18 |
import org.gvsig.data.exception.CloseException; |
19 | 19 |
import org.gvsig.data.exception.DataException; |
... | ... | |
230 | 230 |
DataManager dsm=DataManager.getManager(); |
231 | 231 |
IDataExplorerParameters dsp = dsm.createDataExplorerParameters( |
232 | 232 |
SHPDataExplorer.DATASOURCE_NAME); |
233 |
((DataExplorerFileParameters)dsp).setSource(shpParameters.getFile().getParentFile());
|
|
233 |
((FileExplorerParameters)dsp).setSource(shpParameters.getFile().getParentFile());
|
|
234 | 234 |
|
235 | 235 |
IDataExplorer src=null; |
236 | 236 |
try { |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/shp/SHPDataExplorerParameters.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.file.shp; |
2 | 2 |
|
3 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFileParameters;
|
|
3 |
import org.gvsig.data.datastores.vectorial.file.FileExplorerParameters;
|
|
4 | 4 |
|
5 |
public class SHPDataExplorerParameters extends DataExplorerFileParameters {
|
|
5 |
public class SHPDataExplorerParameters extends FileExplorerParameters {
|
|
6 | 6 |
public String getDataExplorerName() { |
7 | 7 |
return SHPDataExplorer.DATASOURCE_NAME; |
8 | 8 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFDataExplorer.java | ||
---|---|---|
6 | 6 |
import org.gvsig.data.IDataExplorerParameters; |
7 | 7 |
import org.gvsig.data.IDataStoreParameters; |
8 | 8 |
import org.gvsig.data.INewDataStoreParameters; |
9 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFile;
|
|
9 |
import org.gvsig.data.datastores.vectorial.file.FileExplorer;
|
|
10 | 10 |
import org.gvsig.data.datastores.vectorial.file.IFileStoreParameters; |
11 | 11 |
import org.gvsig.data.datastores.vectorial.file.exception.FileNotFoundException; |
12 | 12 |
import org.gvsig.data.datastores.vectorial.file.exception.RemoveFileException; |
... | ... | |
17 | 17 |
import org.gvsig.data.vectorial.IFeatureType; |
18 | 18 |
import org.gvsig.data.vectorial.INewFeatureStoreParameters; |
19 | 19 |
|
20 |
public class DBFDataExplorer extends DataExplorerFile {
|
|
20 |
public class DBFDataExplorer extends FileExplorer {
|
|
21 | 21 |
|
22 | 22 |
public static String DATASOURCE_NAME="DBFDataExplorer"; |
23 | 23 |
|
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFFeaturesWriter.java | ||
---|---|---|
10 | 10 |
import org.gvsig.data.datastores.vectorial.IFeaturesWriter; |
11 | 11 |
import org.gvsig.data.datastores.vectorial.file.dbf.utils.DbaseFileHeader; |
12 | 12 |
import org.gvsig.data.datastores.vectorial.file.dbf.utils.DbaseFileWriter; |
13 |
import org.gvsig.data.exception.DataException; |
|
13 | 14 |
import org.gvsig.data.exception.InitializeWriterException; |
14 | 15 |
import org.gvsig.data.exception.OpenException; |
15 | 16 |
import org.gvsig.data.exception.ReadException; |
... | ... | |
110 | 111 |
// RESTAURAR Ficheros anteriores???? |
111 | 112 |
|
112 | 113 |
} |
114 |
/* (non-Javadoc) |
|
115 |
* @see org.gvsig.data.datastores.vectorial.IFeaturesWriter#dispose() |
|
116 |
*/ |
|
117 |
public void dispose() throws DataException { |
|
118 |
this.dbfFile = null; |
|
119 |
if (this.dbfWrite != null){ |
|
120 |
this.dbfWrite.close(); |
|
121 |
this.dbfWrite = null; |
|
122 |
} |
|
123 |
this.featureType = null; |
|
124 |
this.myHeader = null; |
|
113 | 125 |
|
126 |
} |
|
127 |
|
|
114 | 128 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFStore.java | ||
---|---|---|
14 | 14 |
import org.gvsig.data.IDataStoreParameters; |
15 | 15 |
import org.gvsig.data.ResourceManager; |
16 | 16 |
import org.gvsig.data.datastores.vectorial.IFeaturesWriter; |
17 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFileParameters;
|
|
17 |
import org.gvsig.data.datastores.vectorial.file.FileExplorerParameters;
|
|
18 | 18 |
import org.gvsig.data.exception.CloseException; |
19 | 19 |
import org.gvsig.data.exception.DataException; |
20 | 20 |
import org.gvsig.data.exception.InitializeException; |
... | ... | |
291 | 291 |
DataManager dsm=DataManager.getManager(); |
292 | 292 |
IDataExplorerParameters dsp = dsm.createDataExplorerParameters( |
293 | 293 |
DBFDataExplorer.DATASOURCE_NAME); |
294 |
((DataExplorerFileParameters)dsp).setSource(dbfParameters.getFile().getParentFile());
|
|
294 |
((FileExplorerParameters)dsp).setSource(dbfParameters.getFile().getParentFile());
|
|
295 | 295 |
|
296 | 296 |
IDataExplorer src=null; |
297 | 297 |
try { |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFDataExplorerParameters.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.file.dbf; |
2 | 2 |
|
3 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFileParameters;
|
|
3 |
import org.gvsig.data.datastores.vectorial.file.FileExplorerParameters;
|
|
4 | 4 |
|
5 |
public class DBFDataExplorerParameters extends DataExplorerFileParameters {
|
|
5 |
public class DBFDataExplorerParameters extends FileExplorerParameters {
|
|
6 | 6 |
|
7 | 7 |
public String getDataExplorerName() { |
8 | 8 |
return DBFDataExplorer.DATASOURCE_NAME; |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/FileExplorer.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.gvsig.data.DataManager; |
|
6 |
import org.gvsig.data.IDataStore; |
|
7 |
import org.gvsig.data.IDataStoreParameters; |
|
8 |
import org.gvsig.data.INewDataStoreParameters; |
|
9 |
import org.gvsig.data.exception.DataException; |
|
10 |
import org.gvsig.data.exception.InitializeException; |
|
11 |
import org.gvsig.data.exception.ReadException; |
|
12 |
import org.gvsig.data.exception.WriteException; |
|
13 |
import org.gvsig.data.vectorial.IFeatureStoreExplorer; |
|
14 |
import org.gvsig.data.vectorial.INewFeatureStoreParameters; |
|
15 |
|
|
16 |
public abstract class FileExplorer implements IFeatureStoreExplorer{ |
|
17 |
|
|
18 |
public boolean canCreate() { |
|
19 |
return false; |
|
20 |
} |
|
21 |
|
|
22 |
public IDataStore createDataStore(IDataStoreParameters dsp) throws InitializeException { |
|
23 |
DataManager manager = DataManager.getManager(); |
|
24 |
return manager.createDataStore(dsp); |
|
25 |
} |
|
26 |
|
|
27 |
protected abstract boolean isValid(String file); |
|
28 |
protected abstract boolean isValid(File file); |
|
29 |
|
|
30 |
public IDataStoreParameters add(INewFeatureStoreParameters ndsp) throws WriteException,InitializeException { |
|
31 |
throw new UnsupportedOperationException(); |
|
32 |
} |
|
33 |
|
|
34 |
public IDataStoreParameters add(INewDataStoreParameters ndsp) throws WriteException, InitializeException { |
|
35 |
return this.add((INewFeatureStoreParameters)ndsp); |
|
36 |
} |
|
37 |
|
|
38 |
public void remove(IDataStoreParameters dsp) throws ReadException { |
|
39 |
throw new UnsupportedOperationException(); |
|
40 |
|
|
41 |
} |
|
42 |
|
|
43 |
public INewDataStoreParameters createNewDataStoreParameter() { |
|
44 |
throw new UnsupportedOperationException(); |
|
45 |
} |
|
46 |
|
|
47 |
/* (non-Javadoc) |
|
48 |
* @see org.gvsig.data.IDataExplorer#dispose() |
|
49 |
*/ |
|
50 |
public void dispose() throws DataException { |
|
51 |
// No operation |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFDataExplorerParameters.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.file.dxf; |
2 | 2 |
|
3 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFileParameters;
|
|
3 |
import org.gvsig.data.datastores.vectorial.file.FileExplorerParameters;
|
|
4 | 4 |
|
5 |
public class DXFDataExplorerParameters extends DataExplorerFileParameters {
|
|
5 |
public class DXFDataExplorerParameters extends FileExplorerParameters {
|
|
6 | 6 |
|
7 | 7 |
public String getDataExplorerName() { |
8 | 8 |
return DXFDataExplorer.DATASOURCE_NAME; |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFDataExplorer.java | ||
---|---|---|
6 | 6 |
import org.gvsig.data.IDataExplorerParameters; |
7 | 7 |
import org.gvsig.data.IDataStoreParameters; |
8 | 8 |
import org.gvsig.data.INewDataStoreParameters; |
9 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFile;
|
|
9 |
import org.gvsig.data.datastores.vectorial.file.FileExplorer;
|
|
10 | 10 |
import org.gvsig.data.datastores.vectorial.file.exception.FileNotFoundException; |
11 | 11 |
import org.gvsig.data.datastores.vectorial.file.exception.RemoveFileException; |
12 | 12 |
import org.gvsig.data.exception.InitializeException; |
... | ... | |
15 | 15 |
import org.gvsig.data.vectorial.IFeatureType; |
16 | 16 |
import org.gvsig.data.vectorial.INewFeatureStoreParameters; |
17 | 17 |
|
18 |
public class DXFDataExplorer extends DataExplorerFile {
|
|
18 |
public class DXFDataExplorer extends FileExplorer {
|
|
19 | 19 |
public static String DATASOURCE_NAME="DXFDataSource"; |
20 | 20 |
protected DXFDataExplorerParameters parameters; |
21 | 21 |
protected File path; |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFFeaturesWriter.java | ||
---|---|---|
14 | 14 |
import org.cresques.io.DxfGroupVector; |
15 | 15 |
import org.cresques.px.dxf.DxfEntityMaker; |
16 | 16 |
import org.gvsig.data.datastores.vectorial.IFeaturesWriter; |
17 |
import org.gvsig.data.exception.DataException; |
|
17 | 18 |
import org.gvsig.data.exception.InitializeWriterException; |
18 | 19 |
import org.gvsig.data.exception.OpenException; |
19 | 20 |
import org.gvsig.data.exception.ReadException; |
... | ... | |
51 | 52 |
|
52 | 53 |
private IProjection proj = null; |
53 | 54 |
|
54 |
private DxfFile dxfFile; |
|
55 |
|
|
56 | 55 |
int handle = 40; // Revisar porqu? es 40. |
57 | 56 |
|
58 | 57 |
int k = 0; |
... | ... | |
80 | 79 |
|
81 | 80 |
public void postProcess() throws WriteException { |
82 | 81 |
// Escribimos realmente lo que hemos montado en memoria. |
83 |
dxfFile = new DxfFile(null, file.getAbsolutePath(), entityMaker); |
|
82 |
DxfFile dxfFile = new DxfFile(null, file.getAbsolutePath(), entityMaker);
|
|
84 | 83 |
dxfFile.setCadFlag(true); |
85 | 84 |
if (dxf3DFile) |
86 | 85 |
dxfFile.setDxf3DFlag(true); |
... | ... | |
89 | 88 |
} catch (IOException e) { |
90 | 89 |
throw new WriteException("DXF Writer",e); |
91 | 90 |
} |
91 |
dxfFile.close(); |
|
92 | 92 |
} |
93 | 93 |
|
94 | 94 |
public void preProcess() throws InitializeWriterException, ReadException { |
... | ... | |
861 | 861 |
// Hacer algo???? |
862 | 862 |
|
863 | 863 |
} |
864 |
|
|
865 |
/* (non-Javadoc) |
|
866 |
* @see org.gvsig.data.datastores.vectorial.IFeaturesWriter#dispose() |
|
867 |
*/ |
|
868 |
public void dispose() throws DataException { |
|
869 |
this.entityMaker = null; |
|
870 |
this.proj = null; |
|
871 |
this.featureType = null; |
|
872 |
|
|
873 |
} |
|
864 | 874 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFStore.java | ||
---|---|---|
16 | 16 |
import org.gvsig.data.IDataStoreParameters; |
17 | 17 |
import org.gvsig.data.ResourceManager; |
18 | 18 |
import org.gvsig.data.datastores.vectorial.IFeaturesWriter; |
19 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFileParameters;
|
|
19 |
import org.gvsig.data.datastores.vectorial.file.FileExplorerParameters;
|
|
20 | 20 |
import org.gvsig.data.exception.CloseException; |
21 | 21 |
import org.gvsig.data.exception.DataException; |
22 | 22 |
import org.gvsig.data.exception.InitializeException; |
... | ... | |
373 | 373 |
DataManager dsm=DataManager.getManager(); |
374 | 374 |
IDataExplorerParameters dsp = dsm.createDataExplorerParameters( |
375 | 375 |
DXFDataExplorer.DATASOURCE_NAME); |
376 |
((DataExplorerFileParameters)dsp).setSource(dxfParameters.getFile().getParentFile());
|
|
376 |
((FileExplorerParameters)dsp).setSource(dxfParameters.getFile().getParentFile());
|
|
377 | 377 |
|
378 | 378 |
IDataExplorer src=null; |
379 | 379 |
try { |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/FileExplorerParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.gvsig.data.IDataExplorerParameters; |
|
6 |
|
|
7 |
public abstract class FileExplorerParameters implements IDataExplorerParameters{ |
|
8 |
protected File source; |
|
9 |
|
|
10 |
public void setSource(File source){ |
|
11 |
this.source = source; |
|
12 |
} |
|
13 |
|
|
14 |
public File getSource(){ |
|
15 |
return this.source; |
|
16 |
} |
|
17 |
|
|
18 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/FileResource.java | ||
---|---|---|
33 | 33 |
import java.io.File; |
34 | 34 |
|
35 | 35 |
import org.gvsig.data.Resource; |
36 |
import org.gvsig.data.exception.CloseException; |
|
37 | 36 |
import org.gvsig.data.exception.DataException; |
38 | 37 |
import org.gvsig.data.exception.InitializeException; |
39 | 38 |
import org.gvsig.data.exception.OpenException; |
... | ... | |
43 | 42 |
* @author jmvivo |
44 | 43 |
* |
45 | 44 |
*/ |
46 |
public abstract class FileResource extends Resource implements IFileResource {
|
|
45 |
public abstract class FileResource extends Resource { |
|
47 | 46 |
|
48 | 47 |
protected IFileStoreParameters params; |
49 | 48 |
protected File file; |
50 | 49 |
private long fileLastModified=0; |
51 |
private boolean opened; |
|
52 | 50 |
private boolean editing=false; |
53 | 51 |
|
54 | 52 |
public FileResource(IFileStoreParameters params){ |
... | ... | |
87 | 85 |
} |
88 | 86 |
|
89 | 87 |
/* (non-Javadoc) |
90 |
* @see org.gvsig.data.Resource#isOpen() |
|
91 |
*/ |
|
92 |
public boolean isOpen() { |
|
93 |
return this.opened; |
|
94 |
} |
|
95 |
|
|
96 |
/* (non-Javadoc) |
|
97 | 88 |
* @see org.gvsig.data.Resource#doChanged() |
98 | 89 |
*/ |
99 | 90 |
protected void doChanged() { |
... | ... | |
117 | 108 |
} |
118 | 109 |
} |
119 | 110 |
|
120 |
protected void setOpened(){ |
|
121 |
this.opened=true; |
|
122 |
} |
|
123 |
|
|
124 | 111 |
/* (non-Javadoc) |
125 | 112 |
* @see org.gvsig.data.Resource#doDispose() |
126 | 113 |
*/ |
... | ... | |
128 | 115 |
this.file = null; |
129 | 116 |
} |
130 | 117 |
|
131 |
/* (non-Javadoc) |
|
132 |
* @see org.gvsig.data.Resource#doClose() |
|
133 |
*/ |
|
134 |
protected boolean doClose() throws CloseException{ |
|
135 |
this.opened= false; |
|
136 |
return true; |
|
137 |
} |
|
138 |
|
|
139 |
|
|
140 |
protected synchronized void checkOpen() throws OpenException{ |
|
141 |
if (!this.isOpen()){ |
|
142 |
this.open(); |
|
143 |
} else { |
|
144 |
this.checkChanged(); |
|
145 |
} |
|
146 |
|
|
147 |
} |
|
148 |
|
|
149 | 118 |
public boolean isEditable(){ |
150 | 119 |
return this.getFile().canWrite(); |
151 | 120 |
} |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dgn/DGNStore.java | ||
---|---|---|
17 | 17 |
import org.gvsig.data.IDataStoreParameters; |
18 | 18 |
import org.gvsig.data.ResourceManager; |
19 | 19 |
import org.gvsig.data.datastores.vectorial.IFeaturesWriter; |
20 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFileParameters;
|
|
20 |
import org.gvsig.data.datastores.vectorial.file.FileExplorerParameters;
|
|
21 | 21 |
import org.gvsig.data.exception.CloseException; |
22 | 22 |
import org.gvsig.data.exception.DataException; |
23 | 23 |
import org.gvsig.data.exception.InitializeException; |
... | ... | |
342 | 342 |
DataManager dsm=DataManager.getManager(); |
343 | 343 |
IDataExplorerParameters dsp = dsm.createDataExplorerParameters( |
344 | 344 |
DGNDataExplorer.DATASOURCE_NAME); |
345 |
((DataExplorerFileParameters)dsp).setSource(dgnParameters.getFile().getParentFile());
|
|
345 |
((FileExplorerParameters)dsp).setSource(dgnParameters.getFile().getParentFile());
|
|
346 | 346 |
|
347 | 347 |
IDataExplorer src=null; |
348 | 348 |
try { |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dgn/DGNDataExplorerParameters.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.file.dgn; |
2 | 2 |
|
3 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFileParameters;
|
|
3 |
import org.gvsig.data.datastores.vectorial.file.FileExplorerParameters;
|
|
4 | 4 |
|
5 |
public class DGNDataExplorerParameters extends DataExplorerFileParameters {
|
|
5 |
public class DGNDataExplorerParameters extends FileExplorerParameters {
|
|
6 | 6 |
|
7 | 7 |
public String getDataExplorerName() { |
8 | 8 |
return DGNDataExplorer.DATASOURCE_NAME; |
trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dgn/DGNDataExplorer.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import org.gvsig.data.IDataExplorerParameters; |
7 | 7 |
import org.gvsig.data.IDataStoreParameters; |
8 |
import org.gvsig.data.datastores.vectorial.file.DataExplorerFile;
|
|
8 |
import org.gvsig.data.datastores.vectorial.file.FileExplorer;
|
|
9 | 9 |
import org.gvsig.data.datastores.vectorial.file.exception.FileNotFoundException; |
10 | 10 |
import org.gvsig.data.exception.ReadException; |
11 | 11 |
import org.gvsig.data.vectorial.IFeatureType; |
12 | 12 |
|
13 |
public class DGNDataExplorer extends DataExplorerFile {
|
|
13 |
public class DGNDataExplorer extends FileExplorer {
|
|
14 | 14 |
|
15 | 15 |
public static String DATASOURCE_NAME="DGNDataExplorer"; |
16 | 16 |
|
Also available in: Unified diff