356 |
356 |
WMTSTileMatrixSet tms = tileMatrixSetLink.getTileMatrixSet();
|
357 |
357 |
List<WMTSTileMatrixLimits> tmsl = tileMatrixSetLink.getTileMatrixLimits();
|
358 |
358 |
String srsTileSet = tms.getSupportedCRS();
|
359 |
|
if(srsTileSet.compareTo(srs) == 0) {
|
|
359 |
if(areSrsEquals(srsTileSet, srs)) {
|
360 |
360 |
tileMatrixSetLimits = tmsl;
|
361 |
361 |
}
|
362 |
362 |
}
|
363 |
363 |
|
364 |
|
return tileMatrixSetLimits.size() <= 0 ? false : true;
|
|
364 |
return (tileMatrixSetLimits == null || tileMatrixSetLimits.size() <= 0) ? false : true;
|
365 |
365 |
}
|
366 |
366 |
|
|
367 |
private boolean areSrsEquals(String sourceSrs, String appSrs) {
|
|
368 |
if(sourceSrs.compareTo(appSrs) == 0)
|
|
369 |
return true;
|
|
370 |
if(sourceSrs.contains("CRS:84") || sourceSrs.contains("CRS84")) {
|
|
371 |
if(appSrs.equals("EPSG:4326"))
|
|
372 |
return true;
|
|
373 |
}
|
|
374 |
return false;
|
|
375 |
}
|
|
376 |
|
367 |
377 |
/*public static final WMTSConnector getConnectorFromURL(URL url) throws IOException {
|
368 |
378 |
WMTSConnector drv = (WMTSConnector) drivers.get(url);
|
369 |
379 |
if (drv == null) {
|
... | ... | |
832 |
842 |
q.setBufferResult(b);
|
833 |
843 |
}
|
834 |
844 |
|
835 |
|
/*public void getWindow(Extent ex, int bufWidth, int bufHeight,
|
836 |
|
BandList bandList, TileListener listener, TaskStatus taskStatus) throws ProcessInterruptedException, RasterDriverException {
|
837 |
|
Rectangle2D r = ex.toRectangle2D();//new Rectangle2D.Double(Math.min(minX, maxX), Math.min(minY, maxY), Math.abs(maxX - minX), Math.abs(maxY - minY));
|
838 |
|
WMTSStatus status = buildWMTSStatus(r, bufWidth, bufHeight);
|
839 |
|
request(status, bandList, listener, requestType);
|
840 |
|
}
|
841 |
|
|
842 |
|
public Buffer getWindow(Extent extent, int bufWidth, int bufHeight,
|
843 |
|
BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus taskStatus) throws ProcessInterruptedException, RasterDriverException {
|
844 |
|
Rectangle2D r = extent.toRectangle2D();//new Rectangle2D.Double(Math.min(ulx, lrx), Math.min(lry, uly), Math.abs(lrx - ulx), Math.abs(uly - lry));
|
845 |
|
WMTSStatus status = buildWMTSStatus(r, bufWidth, bufHeight);
|
846 |
|
org.gvsig.raster.cache.tile.Tile[] tileList = request(status, bandList, null, requestType);
|
847 |
|
MemoryTileMatrixBuffer matrixBuffer = new MemoryTileMatrixBuffer(tileList);
|
848 |
|
return matrixBuffer.getWindow(extent, rasterBuf);
|
849 |
|
}
|
850 |
|
|
851 |
|
public Buffer getWindow(Extent extent, BandList bandList, Buffer rasterBuf, TaskStatus taskStatus)
|
852 |
|
throws ProcessInterruptedException, RasterDriverException {
|
853 |
|
lastWidthRequest = rasterBuf.getWidth();
|
854 |
|
lastHeightRequest = rasterBuf.getHeight();
|
855 |
|
Rectangle2D r = extent.toRectangle2D();//new Rectangle2D.Double(Math.min(ulx, lrx), Math.min(lry, uly), Math.abs(lrx - ulx), Math.abs(uly - lry));
|
856 |
|
WMTSStatus status = buildWMTSStatus(r, lastWidthRequest, lastHeightRequest);
|
857 |
|
org.gvsig.raster.cache.tile.Tile[] tileList = request(status, bandList, null, requestType);
|
858 |
|
MemoryTileMatrixBuffer matrixBuffer = new MemoryTileMatrixBuffer(tileList);
|
859 |
|
return matrixBuffer.getWindow(extent, rasterBuf);
|
860 |
|
}
|
861 |
|
|
862 |
|
public Buffer getWindow(double ulx, double uly, double w, double h,
|
863 |
|
BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus taskStatus) throws ProcessInterruptedException, RasterDriverException {
|
864 |
|
lastWidthRequest = rasterBuf.getWidth();
|
865 |
|
lastHeightRequest = rasterBuf.getHeight();
|
866 |
|
Rectangle2D r = new Rectangle2D.Double(ulx, uly - h, w, h);
|
867 |
|
WMTSStatus status = buildWMTSStatus(r, lastWidthRequest, lastHeightRequest);
|
868 |
|
org.gvsig.raster.cache.tile.Tile[] tileList = request(status, bandList, null, requestType);
|
869 |
|
MemoryTileMatrixBuffer matrixBuffer = new MemoryTileMatrixBuffer(tileList);
|
870 |
|
return matrixBuffer.getWindow(new ExtentImpl(ulx, uly, ulx + w, uly - h), rasterBuf);
|
871 |
|
}
|
872 |
|
|
873 |
|
public Buffer getWindow(int x, int y, int w, int h, BandList bandList, Buffer rasterBuf, TaskStatus status) throws ProcessInterruptedException, RasterDriverException {
|
874 |
|
lastWidthRequest = rasterBuf.getWidth();
|
875 |
|
lastHeightRequest = rasterBuf.getHeight();
|
876 |
|
return null;
|
877 |
|
}*/
|
878 |
|
|
879 |
845 |
/**
|
880 |
846 |
* Gets the information from a point
|
881 |
847 |
* @param wcx
|
... | ... | |
899 |
865 |
return fi;
|
900 |
866 |
} catch (WMTSException e) {
|
901 |
867 |
throw new RasterDriverException("Error getting the connector object", e);
|
902 |
|
} /*catch (ServerErrorException e) {
|
903 |
|
throw new RasterDriverException("Error getting the connector object", e);
|
904 |
|
}*/
|
|
868 |
}
|
905 |
869 |
}
|
906 |
870 |
|
907 |
871 |
/**
|
... | ... | |
1007 |
971 |
} catch (WMTSException e) {
|
1008 |
972 |
throw new RasterDriverException("Error creating WMTSStatus", e);
|
1009 |
973 |
}
|
|
974 |
WMTSLayer wmtsLayer = p.getLayer();
|
1010 |
975 |
status.setTileList(tiles);
|
1011 |
|
status.setLayer(p.getLayer().getIdentifier());//.substring(p.getLayer().getIdentifier().indexOf("_") + 1));
|
|
976 |
status.setLayer(wmtsLayer.getIdentifier());//.substring(p.getLayer().getIdentifier().indexOf("_") + 1));
|
|
977 |
|
1012 |
978 |
status.setFormat(p.getImageFormat());
|
1013 |
979 |
status.setInfoFormat(p.getInfoFormat());
|
1014 |
980 |
status.setStyle(p.getStyle() != null ? p.getStyle().getIdentifier() : "");
|
1015 |
981 |
status.setTileMatrixSet(tileMatrixSet.getIdentifier());
|
1016 |
982 |
status.setTileMatrix(tileMatrix.getIdentifier());
|
1017 |
983 |
status.setLevel(level - dif);
|
|
984 |
|
|
985 |
wmtsLayer.buildResourceURLListFromTemplate(status, null);
|
1018 |
986 |
this.lastStatus = status;
|
1019 |
987 |
|
1020 |
988 |
return status;
|