1 |
package appl.data; |
2 |
|
3 |
import schmitzm.data.WritableGrid; |
4 |
import appl.util.RasterMetaData; |
5 |
import edu.bonn.xulu.plugin.io.grid.WritableGridFactory; |
6 |
|
7 |
/** |
8 |
* This is an implementation of a loader class which loads data with a |
9 |
* {@link WritableGridFactory}. It is used for Late Loading. |
10 |
* |
11 |
* @author Dominik Appl |
12 |
* @see WritableGridLLProxy |
13 |
*/ |
14 |
public class FactoryLoader implements DataLoader { |
15 |
|
16 |
private WritableGridFactory fac; |
17 |
|
18 |
private RasterMetaData metaData; |
19 |
|
20 |
private FactoryLoader() { |
21 |
} |
22 |
|
23 |
/** |
24 |
* @param factory |
25 |
* the factory which is used for instantiation |
26 |
* @param metaData |
27 |
* the meta data is required for grid instantiation |
28 |
*/ |
29 |
public FactoryLoader(WritableGridFactory factory, RasterMetaData metaData) { |
30 |
fac = factory; |
31 |
this.metaData = metaData; |
32 |
} |
33 |
|
34 |
/* |
35 |
* (non-Javadoc) |
36 |
* |
37 |
* @see appl.data.DataLoader#load() |
38 |
*/ |
39 |
public WritableGrid load() { |
40 |
return fac.newInstance(metaData.getDataType(), metaData.getWidth(), |
41 |
metaData.getHeight(), metaData.getMinX(), metaData.getMinY(), |
42 |
metaData.getX(), metaData.getY(), metaData.getRealWidth(), |
43 |
metaData.getRealHeight(), metaData |
44 |
.getCoordinateReferenceSystem()); |
45 |
} |
46 |
|
47 |
/* |
48 |
* (non-Javadoc) |
49 |
* |
50 |
* @see appl.data.DataLoader#getLoadInfo() |
51 |
*/ |
52 |
public String getLoadInfo() { |
53 |
return "FactoryLoader|" + fac + "|" + metaData; |
54 |
} |
55 |
|
56 |
} |