gvsig-raster / org.gvsig.raster / branches / org.gvsig.raster.2.4 / org.gvsig.raster.googlemaps / org.gvsig.raster.googlemaps.provider / src / main / java / org / gvsig / raster / googlemaps / provider / DefaultGoogleMapsRasterServerExplorer.java @ 8825
History | View | Annotate | Download (4.15 KB)
1 |
/* gvSIG. Desktop Geographic Information System.
|
---|---|
2 |
*
|
3 |
* Copyright ? 2007-2016 gvSIG Association
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18 |
* MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.raster.googlemaps.provider; |
24 |
|
25 |
|
26 |
import java.io.IOException; |
27 |
import java.net.ConnectException; |
28 |
import java.net.URL; |
29 |
import java.net.URLConnection; |
30 |
import java.util.ArrayList; |
31 |
import java.util.List; |
32 |
|
33 |
import org.slf4j.Logger; |
34 |
import org.slf4j.LoggerFactory; |
35 |
|
36 |
import org.gvsig.fmap.dal.DataServerExplorer; |
37 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
38 |
import org.gvsig.fmap.dal.DataStoreParameters; |
39 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
40 |
import org.gvsig.fmap.dal.exception.DataException; |
41 |
import org.gvsig.fmap.dal.exception.InitializeException; |
42 |
import org.gvsig.fmap.dal.spi.AbstractDataServerExplorer; |
43 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices; |
44 |
|
45 |
|
46 |
/**
|
47 |
* @author fdiaz
|
48 |
*
|
49 |
*/
|
50 |
public class DefaultGoogleMapsRasterServerExplorer extends AbstractDataServerExplorer implements GoogleMapsRasterServerExplorer { |
51 |
|
52 |
private static final Logger logger = |
53 |
LoggerFactory.getLogger(DefaultGoogleMapsRasterServerExplorer.class); |
54 |
|
55 |
protected DefaultGoogleMapsRasterServerExplorer(DataServerExplorerParameters parameters,
|
56 |
DataServerExplorerProviderServices providerServices) throws InitializeException {
|
57 |
super(parameters, providerServices);
|
58 |
} |
59 |
|
60 |
|
61 |
@Override
|
62 |
public String getProviderName() { |
63 |
return GoogleMapsRasterProvider.NAME;
|
64 |
} |
65 |
|
66 |
@Override
|
67 |
public boolean canAdd() { |
68 |
return false; |
69 |
} |
70 |
|
71 |
@Override
|
72 |
public boolean canAdd(String storeName) throws DataException { |
73 |
return false; |
74 |
} |
75 |
|
76 |
@Override
|
77 |
public List<GoogleMapsRasterProviderParameters> list() throws DataException { |
78 |
List<GoogleMapsRasterProviderParameters> result = new ArrayList<GoogleMapsRasterProviderParameters>(); |
79 |
@SuppressWarnings("unchecked") |
80 |
|
81 |
GoogleMapsRasterProviderParameters params = new GoogleMapsRasterProviderParameters();
|
82 |
GoogleMapsRasterServerExplorerParameters explorerParameters = (GoogleMapsRasterServerExplorerParameters) this.getParameters();
|
83 |
params.setHasApiKey(explorerParameters.getHasApiKey()); |
84 |
params.setApiKey(explorerParameters.getApiKey()); |
85 |
params.setMapType(explorerParameters.getMapType()); |
86 |
params.setFormat(explorerParameters.getFormat()); |
87 |
params.setLanguage(explorerParameters.getLanguage()); |
88 |
params.setRegion(explorerParameters.getRegion()); |
89 |
|
90 |
result.add(params); |
91 |
|
92 |
return result;
|
93 |
} |
94 |
|
95 |
@Override
|
96 |
public List<GoogleMapsRasterProviderParameters> list(int mode) throws DataException { |
97 |
if(mode!=DataServerExplorer.MODE_RASTER){
|
98 |
return null; |
99 |
} |
100 |
return list();
|
101 |
} |
102 |
|
103 |
@Override
|
104 |
public boolean add(String provider, NewDataStoreParameters parameters, boolean overwrite) throws DataException { |
105 |
return false; |
106 |
} |
107 |
|
108 |
@Override
|
109 |
public void remove(DataStoreParameters parameters) throws DataException { |
110 |
throw new UnsupportedOperationException("Can't remove a GoogleMaps provider."); |
111 |
|
112 |
} |
113 |
|
114 |
@Override
|
115 |
public NewDataStoreParameters getAddParameters(String storeName) throws DataException { |
116 |
return null; |
117 |
} |
118 |
|
119 |
@Override
|
120 |
public List<String> getDataStoreProviderNames() { |
121 |
List<String> x = new ArrayList<String>(); |
122 |
x.add(GoogleMapsRasterProvider.NAME); |
123 |
return x;
|
124 |
} |
125 |
} |