gvsig-3d / 2.1 / branches / org.gvsig.view3d_vector_and_extrusion_2.3 / org.gvsig.view3d / org.gvsig.view3d / org.gvsig.view3d.swing / org.gvsig.view3d.swing.impl / src / main / java / org / gvsig / view3d / swing / impl / data / DefaultDataRasterReaderFactory.java @ 708
History | View | Annotate | Download (2.64 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright � 2007-2015 gvSIG Association
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
|
25 |
package org.gvsig.view3d.swing.impl.data; |
26 |
|
27 |
import gov.nasa.worldwind.avlist.AVList; |
28 |
import gov.nasa.worldwind.data.BasicDataRasterReaderFactory; |
29 |
import gov.nasa.worldwind.data.DataRasterReader; |
30 |
|
31 |
import org.slf4j.Logger; |
32 |
import org.slf4j.LoggerFactory; |
33 |
|
34 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
35 |
|
36 |
/**
|
37 |
* Default implementation of {@link BasicDataRasterReaderFactory} to allow
|
38 |
* creater {@link DefaultDataRasterReader} readers form {@link FLayer}.
|
39 |
*
|
40 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
|
41 |
*/
|
42 |
public class DefaultDataRasterReaderFactory extends |
43 |
BasicDataRasterReaderFactory { |
44 |
|
45 |
private static final Logger LOG = LoggerFactory |
46 |
.getLogger(DefaultDataRasterReaderFactory.class); |
47 |
|
48 |
@Override
|
49 |
public DataRasterReader findReaderFor(Object source, AVList params) { |
50 |
if (source == null) { |
51 |
LOG.error("Can't find reader because source is null");
|
52 |
throw new IllegalArgumentException(); |
53 |
} |
54 |
|
55 |
if (source instanceof FLayer) { |
56 |
FLayer layer = (FLayer) source; |
57 |
return new DefaultDataRasterReader(layer.getInfoString()); |
58 |
} |
59 |
|
60 |
return super.findReaderFor(source, params, readers); |
61 |
} |
62 |
|
63 |
@Override
|
64 |
public DataRasterReader findReaderFor(Object source, AVList params, |
65 |
DataRasterReader[] readers) {
|
66 |
|
67 |
if (source == null) { |
68 |
LOG.error("Can't find reader because source is null");
|
69 |
throw new IllegalArgumentException(); |
70 |
} |
71 |
|
72 |
if (source instanceof FLayer) { |
73 |
FLayer layer = (FLayer) source; |
74 |
return new DefaultDataRasterReader(layer.getInfoString()); |
75 |
} else {
|
76 |
return super.findReaderFor(source, params, readers); |
77 |
} |
78 |
} |
79 |
} |