Revision 2613 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/struct/WMTSTileMatrixImpl.java
WMTSTileMatrixImpl.java | ||
---|---|---|
27 | 27 |
import java.util.ArrayList; |
28 | 28 |
import java.util.List; |
29 | 29 |
|
30 |
import org.cresques.cts.IProjection; |
|
31 |
import org.gvsig.fmap.crs.CRSFactory; |
|
30 | 32 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTile; |
31 | 33 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrix; |
32 | 34 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixLimits; |
... | ... | |
46 | 48 |
private long matrixWidth = 0; |
47 | 49 |
private long matrixHeight = 0; |
48 | 50 |
private static final double MTS_X_GRADO = 111319.490793274; |
49 |
protected boolean forceLongitudeFirstAxisOrder = false;
|
|
51 |
protected boolean forceChangeAxisOrder = false;
|
|
50 | 52 |
private double epsilon = 1e-6; |
53 |
private String tileMatrixSetSupportedCRS = null; |
|
51 | 54 |
|
55 |
|
|
52 | 56 |
/** |
53 |
* Sets longitude first in the axis order read from the capabilities file
|
|
57 |
* Force to change the axis order read from the capabilities
|
|
54 | 58 |
* @param force |
55 | 59 |
*/ |
56 |
public void setForceLongitudeFirstAxisOrder(boolean force) {
|
|
57 |
this.forceLongitudeFirstAxisOrder = force;
|
|
60 |
public void setForceChangeAxisOrder(boolean force) {
|
|
61 |
this.forceChangeAxisOrder = force;
|
|
58 | 62 |
} |
59 | 63 |
|
64 |
/** |
|
65 |
* Sets the CRS supported by the parent |
|
66 |
* @param parentSupportedCRS |
|
67 |
*/ |
|
68 |
public void setSupportedCRS(String parentSupportedCRS) { |
|
69 |
this.tileMatrixSetSupportedCRS = parentSupportedCRS; |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* Gets the CRS supported by the parent |
|
74 |
* @return |
|
75 |
*/ |
|
76 |
public String getSupportedCRS() { |
|
77 |
return this.tileMatrixSetSupportedCRS; |
|
78 |
} |
|
79 |
|
|
80 |
public void checkChangeAxis() { |
|
81 |
if(forceChangeAxisOrder) { |
|
82 |
double aux = topLeftCorner[0]; |
|
83 |
topLeftCorner[0] = topLeftCorner[1]; |
|
84 |
topLeftCorner[1] = aux; |
|
85 |
return; |
|
86 |
} |
|
87 |
|
|
88 |
if(tileMatrixSetSupportedCRS.contains("CRS:84") || tileMatrixSetSupportedCRS.contains("CRS84")) |
|
89 |
return; |
|
90 |
|
|
91 |
//Para CRS no proyectados menos CRS:84 hay que cambiar de orden los ejes |
|
92 |
String epsgNumber = tileMatrixSetSupportedCRS.substring(tileMatrixSetSupportedCRS.lastIndexOf(":") + 1); |
|
93 |
try { |
|
94 |
Integer.parseInt(epsgNumber); |
|
95 |
IProjection projSrc = CRSFactory.getCRS("EPSG:" + epsgNumber); |
|
96 |
if(projSrc != null && !projSrc.isProjected()) { |
|
97 |
double aux = topLeftCorner[0]; |
|
98 |
topLeftCorner[0] = topLeftCorner[1]; |
|
99 |
topLeftCorner[1] = aux; |
|
100 |
} |
|
101 |
} catch (NumberFormatException e) { |
|
102 |
//No se invierte el orden de los ejes |
|
103 |
} catch (Exception e) { |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
60 | 107 |
public void setBBoxTileMatrixSet(Rectangle2D bbox) { |
61 | 108 |
if(bboxTileMatrixSet == null) |
62 | 109 |
this.bboxTileMatrixSet = bbox; |
... | ... | |
306 | 353 |
//Para cada tile comprueba si intersecta con el ?rea seleccionada si es as? |
307 | 354 |
//mete el tile en la lista para devolverlo como resultado |
308 | 355 |
|
309 |
double initX = topLeftCorner[1];
|
|
310 |
double initY = topLeftCorner[0];
|
|
356 |
double initX = topLeftCorner[0];
|
|
357 |
double initY = topLeftCorner[1];
|
|
311 | 358 |
|
312 | 359 |
int tileInitX = 0; |
313 | 360 |
int tileInitY = 0; |
Also available in: Unified diff