Revision 954 org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSProvider.java
WMTSProvider.java | ||
---|---|---|
92 | 92 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSetLink; |
93 | 93 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix.Tile; |
94 | 94 |
import org.gvsig.tools.ToolsLocator; |
95 |
import org.slf4j.Logger; |
|
96 |
import org.slf4j.LoggerFactory; |
|
95 | 97 |
/** |
96 | 98 |
* Provider for WMTS service |
97 | 99 |
* |
... | ... | |
101 | 103 |
public static String NAME = "Wmts Store"; |
102 | 104 |
public static String DESCRIPTION = "Wmts Raster file"; |
103 | 105 |
public static final String METADATA_DEFINITION_NAME = "WmtsStore"; |
104 |
|
|
106 |
private static Logger logger = LoggerFactory.getLogger(WMTSProvider.class); |
|
105 | 107 |
public static boolean TILED = true; |
106 | 108 |
|
107 | 109 |
//Los tiles se piden de forma secuencial y sin lanzar threads para ello (+Lento) |
... | ... | |
185 | 187 |
tile.file = getConnector().downloadFile(url, null); |
186 | 188 |
pipe.setTile(tile); |
187 | 189 |
} catch (DownloadException e) { |
188 |
//} catch (ServerErrorException e) {
|
|
190 |
logger.info("Error downloading files", e);
|
|
189 | 191 |
} catch (MalformedURLException e) { |
190 |
// TODO Auto-generated catch block |
|
191 |
e.printStackTrace(); |
|
192 |
logger.info("Malformed URL", e); |
|
192 | 193 |
} catch (WMTSException e) { |
193 |
// TODO Auto-generated catch block |
|
194 |
e.printStackTrace(); |
|
194 |
logger.info("", e); |
|
195 | 195 |
} |
196 | 196 |
} |
197 | 197 |
} |
... | ... | |
1008 | 1008 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
1009 | 1009 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
1010 | 1010 |
ArrayList tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits(); |
1011 |
int initialLevel = p.getLayer().getInitialLevel(tileMatrixSet.getIdentifier()); |
|
1011 | 1012 |
|
1012 |
|
|
1013 | 1013 |
//Esto hace lo mismo que getScale y getLevelFromScale |
1014 | 1014 |
/*int level = 0; |
1015 | 1015 |
double[] pixelSizes = getPixelSizeByLevel(); |
... | ... | |
1026 | 1026 |
|
1027 | 1027 |
//3-Selecci?n del nivel a partir de la escala |
1028 | 1028 |
int level = getLevelFromScale(scale, tileMatrixSet); |
1029 |
|
|
1029 |
|
|
1030 |
//Para evitar que se salga del array si la capa tiene menos niveles que el tilematrixset |
|
1031 |
int dif = (level - initialLevel) >= tileMatrixSetLimits.size() ? (level - initialLevel) - tileMatrixSetLimits.size() + 1 : 0; |
|
1032 |
|
|
1030 | 1033 |
//4-Obtenemos la matriz de tiles y los l?mites si tiene subsets |
1031 | 1034 |
WMTSTileMatrixLimits tileMatrixLimits = null; |
1032 |
WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixSet.getTileMatrix().get(level); |
|
1035 |
WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixSet.getTileMatrix().get(level - dif);
|
|
1033 | 1036 |
if(gridSubsets) |
1034 |
tileMatrixLimits = (WMTSTileMatrixLimits)tileMatrixSetLimits.get(level); |
|
1037 |
tileMatrixLimits = (WMTSTileMatrixLimits)tileMatrixSetLimits.get(level - initialLevel - dif);
|
|
1035 | 1038 |
|
1036 | 1039 |
//5-Selecci?n de tiles que entran en esta bounding box |
1037 | 1040 |
ArrayList<Tile> tiles = null; |
... | ... | |
1043 | 1046 |
//6-Petici?n |
1044 | 1047 |
WMTSStatus status = new WMTSStatus(); |
1045 | 1048 |
status.setTileList(tiles); |
1046 |
status.setLayer(p.getLayer().getIdentifier()); |
|
1049 |
status.setLayer(p.getLayer().getIdentifier());//.substring(p.getLayer().getIdentifier().indexOf("_") + 1));
|
|
1047 | 1050 |
status.setFormat(p.getImageFormat()); |
1048 | 1051 |
status.setInfoFormat(p.getInfoFormat()); |
1049 | 1052 |
status.setStyle(p.getStyle() != null ? p.getStyle().getIdentifier() : ""); |
1050 | 1053 |
status.setTileMatrixSet(tileMatrixSet.getIdentifier()); |
1051 | 1054 |
status.setTileMatrix(tileMatrix.getIdentifier()); |
1052 |
status.setLevel(level); |
|
1055 |
status.setLevel(level - dif);
|
|
1053 | 1056 |
this.lastStatus = status; |
1054 | 1057 |
return status; |
1055 | 1058 |
} |
Also available in: Unified diff