Revision 43876 branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/file/bsq/BSQStoreProvider.java
BSQStoreProvider.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import java.io.IOException; |
26 | 26 |
import java.util.ArrayList; |
27 |
import org.gvsig.basicformats.FormatsFile; |
|
28 |
import org.gvsig.basicformats.HDRFile; |
|
27 | 29 |
import org.gvsig.fmap.dal.exception.InitializeException; |
28 | 30 |
import org.gvsig.fmap.dal.exception.OpenException; |
29 |
import org.gvsig.fmap.dal.fileutils.HDRFile; |
|
30 |
import org.gvsig.fmap.dal.fileutils.spi.UtilsFile; |
|
31 | 31 |
import org.gvsig.fmap.dal.raster.OpenRasterStoreParameters; |
32 | 32 |
import org.gvsig.fmap.dal.raster.spi.BandDescriptorServices; |
33 | 33 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
... | ... | |
37 | 37 |
|
38 | 38 |
// https://www.qgistutorials.com/en/docs/open_bil_bip_bsq_files.html |
39 | 39 |
// http://glcf.umd.edu/data/landcover/data.shtml |
40 |
|
|
41 | 40 |
protected HDRFile hdrFile; |
42 | 41 |
|
43 | 42 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
44 | 43 |
public BSQStoreProvider( |
45 | 44 |
String name, |
46 | 45 |
String description, |
47 |
OpenRasterStoreParameters params,
|
|
46 |
OpenRasterStoreParameters params, |
|
48 | 47 |
DataStoreProviderServices storeServices) throws InitializeException { |
49 | 48 |
super( |
50 | 49 |
name, |
... | ... | |
72 | 71 |
this.autoOpen(); |
73 | 72 |
return this.hdrFile.getNcols(); |
74 | 73 |
} |
75 |
|
|
74 |
|
|
76 | 75 |
@Override |
77 | 76 |
protected void doDispose() throws BaseException { |
78 | 77 |
super.doDispose(); |
79 | 78 |
this.hdrFile = null; |
80 | 79 |
} |
81 |
|
|
80 |
|
|
82 | 81 |
@Override |
83 | 82 |
public void open() throws OpenException { |
84 |
if ( this.hdrFile!=null ) {
|
|
83 |
if (this.hdrFile != null) {
|
|
85 | 84 |
return; |
86 | 85 |
} |
87 |
HDRFile theHDRFile = UtilsFile.createHDRFile(this.getFile()); |
|
88 |
if (!theHDRFile.isValid()) { |
|
86 |
HDRFile theHDRFile; |
|
87 |
theHDRFile = FormatsFile.getHDRFile(this.getFile()); |
|
88 |
if (theHDRFile == null || !theHDRFile.isValid()) { |
|
89 | 89 |
throw new OpenException(this.getProviderName(), null); |
90 | 90 |
} |
91 | 91 |
this.hdrFile = theHDRFile; |
... | ... | |
104 | 104 |
bandDescriptor.setDataType(dataType); |
105 | 105 |
bandDescriptor.setName(String.valueOf(nband)); |
106 | 106 |
try { |
107 |
bandDescriptor.setDescription(this.getName()+ "- band "+nband);
|
|
107 |
bandDescriptor.setDescription(this.getName() + "- band " + nband);
|
|
108 | 108 |
} catch (Exception e) { |
109 |
bandDescriptor.setDescription("band "+nband);
|
|
109 |
bandDescriptor.setDescription("band " + nband);
|
|
110 | 110 |
} |
111 | 111 |
bandDescriptor.add("X size", this.hdrFile.getNcols()); |
112 |
bandDescriptor.add("Y size", this.hdrFile.getNrows());
|
|
112 |
bandDescriptor.add("Y size", this.hdrFile.getNrows()); |
|
113 | 113 |
BSQBandPageManager pageManager = new BSQBandPageManager( |
114 | 114 |
getFile(), |
115 | 115 |
nband * this.hdrFile.getBandSize(), |
116 | 116 |
this.hdrFile.getNrows(), |
117 | 117 |
this.hdrFile.getNcols(), |
118 |
dataType |
|
118 |
dataType, |
|
119 |
this.hdrFile.getByteorder() |
|
119 | 120 |
); |
120 | 121 |
this.pageManagers.add(pageManager); |
121 | 122 |
} |
Also available in: Unified diff