Revision 1961 org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.ogc/org.gvsig.raster.wmts.ogc.impl/src/main/java/org/gvsig/raster/wmts/ogc/impl/base/WMTSClientImpl.java
WMTSClientImpl.java | ||
---|---|---|
40 | 40 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification; |
41 | 41 |
import org.gvsig.raster.wmts.ogc.struct.WMTSThemes; |
42 | 42 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSet; |
43 |
import org.slf4j.Logger; |
|
44 |
import org.slf4j.LoggerFactory; |
|
43 | 45 |
|
44 | 46 |
|
45 | 47 |
/** |
... | ... | |
55 | 57 |
private WMTSProtocolHandler handler = null; |
56 | 58 |
private WMTSServerDescription serverDescription = null; |
57 | 59 |
protected boolean forceLongitudeFirstAxisOrder = false; |
58 |
|
|
60 |
private Logger logger = LoggerFactory.getLogger(WMTSClientImpl.class.toString()); |
|
61 |
|
|
59 | 62 |
/** |
60 | 63 |
* Constructor. |
61 | 64 |
* the parameter host, indicates the WMS host to connect. |
62 | 65 |
* */ |
63 | 66 |
public WMTSClientImpl(String host) throws ConnectException, IOException { |
64 | 67 |
setHost(host); |
65 |
handler = WMTSProtocolHandlerFactory.negotiate(host); |
|
66 |
handler.setHost(host); |
|
68 |
getHandler(); |
|
67 | 69 |
} |
68 | 70 |
|
71 |
private WMTSProtocolHandler getHandler() throws ConnectException, IOException { |
|
72 |
if (handler == null) { |
|
73 |
if (getHost().trim().length() > 0) { |
|
74 |
handler = WMTSProtocolHandlerFactory.negotiate(getHost()); |
|
75 |
handler.setHost(getHost()); |
|
76 |
} |
|
77 |
} |
|
78 |
return handler; |
|
79 |
} |
|
80 |
|
|
69 | 81 |
/** |
70 | 82 |
* Sets longitude first in the axis order |
71 | 83 |
* @param force |
... | ... | |
154 | 166 |
public String getFeatureInfo(WMTSStatus status, int x, int y, ICancellable cancel) { |
155 | 167 |
return handler.getFeatureInfo((WMTSStatusImpl)status, x, y, cancel); |
156 | 168 |
} |
157 |
|
|
169 |
|
|
158 | 170 |
public boolean connect(boolean override, ICancellable cancel) { |
159 | 171 |
try { |
160 |
if (handler == null) { |
|
161 |
if (getHost().trim().length() > 0) { |
|
162 |
handler = WMTSProtocolHandlerFactory.negotiate(getHost()); |
|
163 |
handler.setHost(getHost()); |
|
164 |
} else { |
|
165 |
return false; |
|
166 |
} |
|
167 |
} |
|
168 |
if(serverDescription == null) { |
|
169 |
serverDescription = new WMTSServerDescription(handler.getVersion()); |
|
170 |
handler.setServerDescription(serverDescription); |
|
171 |
handler.setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder); |
|
172 |
} |
|
172 |
if(getHandler() == null) |
|
173 |
return false; |
|
174 |
|
|
175 |
serverDescription = getHandler().getServerDescription(); |
|
176 |
getHandler().setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder); |
|
173 | 177 |
getCapabilities(serverDescription, override, cancel); |
174 | 178 |
return true; |
175 |
|
|
176 | 179 |
} catch (Exception e) { |
177 |
e.printStackTrace();
|
|
180 |
logger.debug("Error connecting to the server", e);
|
|
178 | 181 |
return false; |
179 | 182 |
} |
180 | 183 |
} |
Also available in: Unified diff