gvsig-raster / org.gvsig.raster.tools / trunk / templates / rasterTaskProjectTemplate / alg_template / sources / io / ProjectTemplateProvider.java @ 2143
History | View | Annotate | Download (6.25 KB)
1 |
package org.gvsig.raster.projecttemplate.io; |
---|---|
2 |
|
3 |
import java.awt.geom.Rectangle2D; |
4 |
|
5 |
import org.gvsig.fmap.dal.DALLocator; |
6 |
import org.gvsig.fmap.dal.DataStore; |
7 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
8 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
9 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
10 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
11 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
12 |
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException; |
13 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
14 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
15 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
16 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
17 |
import org.gvsig.fmap.dal.coverage.exception.RemoteServiceException; |
18 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
19 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
20 |
import org.gvsig.metadata.MetadataLocator; |
21 |
import org.gvsig.raster.cache.tile.provider.TileListener; |
22 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
23 |
import org.gvsig.raster.impl.provider.DefaultRasterProvider; |
24 |
import org.gvsig.raster.impl.provider.RasterProvider; |
25 |
import org.gvsig.raster.impl.provider.tile.FileTileServer; |
26 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
27 |
import org.gvsig.raster.impl.store.DefaultStoreFactory; |
28 |
import org.gvsig.tools.ToolsLocator; |
29 |
import org.gvsig.tools.task.TaskStatus; |
30 |
import org.slf4j.Logger; |
31 |
import org.slf4j.LoggerFactory; |
32 |
|
33 |
public class ProjectTemplateProvider extends DefaultRasterProvider { |
34 |
public static String NAME = "ProjectTemplate Store"; |
35 |
public static String DESCRIPTION = "ProjectTemplate file"; |
36 |
public static final String METADATA_DEFINITION_NAME = "ProjectTemplateStore"; |
37 |
private static Logger logger = LoggerFactory.getLogger(ProjectTemplateProvider.class.getName()); |
38 |
|
39 |
|
40 |
public static void register() { |
41 |
//To get the tiled capabilities
|
42 |
RasterLocator.getManager().getProviderServices().registerFileProvidersTiled(ProjectTemplateProvider.class); |
43 |
|
44 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
45 |
if (dataman != null && !dataman.getStoreProviders().contains(NAME)) { |
46 |
dataman.registerStoreProvider(NAME, |
47 |
ProjectTemplateProvider.class, ProjectTemplateDataParameters.class); |
48 |
} |
49 |
|
50 |
if (!dataman.getExplorerProviders().contains(ProjectTemplateProvider.NAME)) {
|
51 |
dataman.registerExplorerProvider(ProjectTemplateServerExplorer.NAME, ProjectTemplateServerExplorer.class, ProjectTemplateServerExplorerParameters.class); |
52 |
} |
53 |
dataman.registerStoreFactory(NAME, DefaultStoreFactory.class); |
54 |
} |
55 |
|
56 |
public ProjectTemplateProvider() {
|
57 |
|
58 |
} |
59 |
|
60 |
public ProjectTemplateProvider (ProjectTemplateDataParameters params,
|
61 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException {
|
62 |
super(params, storeServices, ToolsLocator.getDynObjectManager()
|
63 |
.createDynObject( |
64 |
MetadataLocator.getMetadataManager().getDefinition( |
65 |
DataStore.METADATA_DEFINITION_NAME))); |
66 |
init(params, storeServices); |
67 |
} |
68 |
|
69 |
/**
|
70 |
* Creates data base references and loads structures with the information and metadata
|
71 |
* @param params load parameters
|
72 |
* @throws NotSupportedExtensionException
|
73 |
*/
|
74 |
public void init (AbstractRasterDataParameters params, |
75 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException {
|
76 |
} |
77 |
|
78 |
public void getWindow( |
79 |
Extent ex, |
80 |
int bufWidth,
|
81 |
int bufHeight,
|
82 |
BandList bandList, |
83 |
TileListener listener, |
84 |
TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
|
85 |
} |
86 |
|
87 |
public Buffer getWindow( |
88 |
Extent ex, |
89 |
BandList bandList, |
90 |
Buffer rasterBuf,
|
91 |
TaskStatus status) |
92 |
throws ProcessInterruptedException, RasterDriverException {
|
93 |
return null; |
94 |
} |
95 |
|
96 |
public Buffer getWindow( |
97 |
double ulx,
|
98 |
double uly,
|
99 |
double w,
|
100 |
double h,
|
101 |
BandList bandList, |
102 |
Buffer rasterBuf,
|
103 |
boolean adjustToExtent,
|
104 |
TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
|
105 |
return null; |
106 |
} |
107 |
|
108 |
public Buffer getWindow( |
109 |
Extent extent, |
110 |
int bufWidth,
|
111 |
int bufHeight,
|
112 |
BandList bandList, |
113 |
Buffer rasterBuf,
|
114 |
boolean adjustToExtent,
|
115 |
TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
|
116 |
return null; |
117 |
} |
118 |
|
119 |
public Buffer getWindow( |
120 |
int x,
|
121 |
int y,
|
122 |
int w,
|
123 |
int h,
|
124 |
int bufWidth,
|
125 |
int bufHeight,
|
126 |
BandList bandList, |
127 |
Buffer rasterBuf,
|
128 |
TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
|
129 |
return null; |
130 |
} |
131 |
|
132 |
public Rectangle2D getLayerExtent(String layerName, String srs) |
133 |
throws RemoteServiceException {
|
134 |
return null; |
135 |
} |
136 |
|
137 |
public TileServer getTileServer() {
|
138 |
//TODO: It is an example. Maybe we need a specific TileServer
|
139 |
if(tileServer == null) |
140 |
tileServer = new FileTileServer(this); |
141 |
return tileServer;
|
142 |
} |
143 |
|
144 |
public int getBlockSize() { |
145 |
return 0; |
146 |
} |
147 |
|
148 |
public Object getData(int x, int y, int band) |
149 |
throws InvalidSetViewException, FileNotOpenException,
|
150 |
RasterDriverException { |
151 |
return null; |
152 |
} |
153 |
|
154 |
public double getHeight() { |
155 |
return 0; |
156 |
} |
157 |
|
158 |
public int getOverviewHeight(int band, int overview) |
159 |
throws BandAccessException, RasterDriverException {
|
160 |
return 0; |
161 |
} |
162 |
|
163 |
public int getOverviewWidth(int band, int overview) |
164 |
throws BandAccessException, RasterDriverException {
|
165 |
return 0; |
166 |
} |
167 |
|
168 |
public Extent getView() {
|
169 |
return null; |
170 |
} |
171 |
|
172 |
public double getWidth() { |
173 |
return 0; |
174 |
} |
175 |
|
176 |
public Buffer getWindow(int x, int y, int w, int h, BandList bandList, |
177 |
Buffer rasterBuf, TaskStatus status)
|
178 |
throws ProcessInterruptedException, RasterDriverException {
|
179 |
return null; |
180 |
} |
181 |
|
182 |
public boolean isOverviewsSupported() { |
183 |
return false; |
184 |
} |
185 |
|
186 |
public RasterProvider load() {
|
187 |
return null; |
188 |
} |
189 |
|
190 |
public void setView(Extent e) { |
191 |
|
192 |
} |
193 |
|
194 |
public int getOverviewCount(int band) throws BandAccessException, |
195 |
RasterDriverException { |
196 |
return 0; |
197 |
} |
198 |
|
199 |
public boolean isOpen() { |
200 |
return false; |
201 |
} |
202 |
|
203 |
public Object readBlock(int pos, int blockHeight, double scale) |
204 |
throws InvalidSetViewException, FileNotOpenException,
|
205 |
RasterDriverException, ProcessInterruptedException { |
206 |
return null; |
207 |
} |
208 |
|
209 |
public void setStatus(RasterProvider provider) { |
210 |
|
211 |
} |
212 |
|
213 |
public String getName() { |
214 |
return NAME;
|
215 |
} |
216 |
} |