Revision 34411
branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/struct/WMTSTileMatrix.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.remoteclient.wmts.struct; |
23 | 23 |
|
24 |
import java.awt.geom.AffineTransform; |
|
25 |
import java.awt.geom.NoninvertibleTransformException; |
|
24 | 26 |
import java.awt.geom.Point2D; |
25 | 27 |
import java.awt.geom.Rectangle2D; |
26 | 28 |
import java.io.File; |
... | ... | |
59 | 61 |
this.wPx = wPx; |
60 | 62 |
this.hPx = hPx; |
61 | 63 |
} |
62 |
|
|
64 |
|
|
65 |
/** |
|
66 |
* Convierte un punto desde del mundo a coordenadas pixel. |
|
67 |
* @param pt Punto a transformar |
|
68 |
* @return punto transformado en coordenadas pixel |
|
69 |
*/ |
|
70 |
public Point2D worldToRaster(Point2D pt) { |
|
71 |
Point2D p = new Point2D.Double(); |
|
72 |
double psX = (lrx - ulx) / tileWidth; |
|
73 |
double psY = (lry - uly) / tileHeight; |
|
74 |
AffineTransform t = new AffineTransform(psX, 0, 0, psY, ulx - (psX / 2), uly + (psY / 2)); |
|
75 |
try { |
|
76 |
t.inverseTransform(pt, p); |
|
77 |
} catch (NoninvertibleTransformException e) { |
|
78 |
return pt; |
|
79 |
} |
|
80 |
return p; |
|
81 |
} |
|
82 |
|
|
63 | 83 |
public Tile cloneTile() { |
64 | 84 |
Tile status = new Tile(wPx, hPx, row, col, ulx, uly, lrx, lry); |
65 | 85 |
status.file = file; |
... | ... | |
128 | 148 |
} |
129 | 149 |
|
130 | 150 |
/** |
151 |
* Gets the width in meters of a tile |
|
152 |
* @param projected |
|
153 |
* @return |
|
154 |
*/ |
|
155 |
public double getWidthMtsTile(boolean projected) { |
|
156 |
if(!projected) { |
|
157 |
return (scaleDenominator * tileWidth * 0.28) / (MTS_X_GRADO * 1000); |
|
158 |
} else { |
|
159 |
return (scaleDenominator * tileWidth * 0.28) / 1000; |
|
160 |
} |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* Gets the height in meters of a tile |
|
165 |
* @param projected |
|
166 |
* @return |
|
167 |
*/ |
|
168 |
public double getHeightMtsTile(boolean projected) { |
|
169 |
if(!projected) { |
|
170 |
return (scaleDenominator * tileHeight * 0.28) / (MTS_X_GRADO * 1000); |
|
171 |
} else { |
|
172 |
return (scaleDenominator * tileHeight * 0.28) / 1000; |
|
173 |
} |
|
174 |
} |
|
175 |
|
|
176 |
/** |
|
131 | 177 |
* This function will check if the request coordinates intersects with the tiles in the matrix. If a tile |
132 | 178 |
* intersects then this will be added to the list. |
133 | 179 |
*/ |
134 | 180 |
public ArrayList intersects(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Rectangle2D request, Rectangle2D extentLayer) { |
135 |
double widthMtsTile = 0; |
|
136 |
double heightMtsTile = 0; |
|
137 |
if(!projected) { |
|
138 |
widthMtsTile = (scaleDenominator * tileWidth * 0.28) / (MTS_X_GRADO * 1000); |
|
139 |
heightMtsTile = (scaleDenominator * tileHeight * 0.28) / (MTS_X_GRADO * 1000); |
|
140 |
} else { |
|
141 |
widthMtsTile = (scaleDenominator * tileWidth * 0.28) / 1000; |
|
142 |
heightMtsTile = (scaleDenominator * tileHeight * 0.28) / 1000; |
|
143 |
} |
|
181 |
double widthMtsTile = getWidthMtsTile(projected); |
|
182 |
double heightMtsTile = getHeightMtsTile(projected); |
|
144 | 183 |
|
145 | 184 |
double ulx, uly, lrx, lry; |
146 | 185 |
ArrayList list = new ArrayList(); |
... | ... | |
180 | 219 |
* intersects then this will be added to the list. |
181 | 220 |
*/ |
182 | 221 |
public ArrayList intersects(boolean projected, Rectangle2D request, Rectangle2D extentLayer) { |
183 |
double widthMtsTile = 0; |
|
184 |
double heightMtsTile = 0; |
|
185 |
if(!projected) { |
|
186 |
widthMtsTile = (scaleDenominator * tileWidth * 0.28) / (MTS_X_GRADO * 1000); |
|
187 |
heightMtsTile = (scaleDenominator * tileHeight * 0.28) / (MTS_X_GRADO * 1000); |
|
188 |
} else { |
|
189 |
widthMtsTile = (scaleDenominator * tileWidth * 0.28) / 1000; |
|
190 |
heightMtsTile = (scaleDenominator * tileHeight * 0.28) / 1000; |
|
191 |
} |
|
222 |
double widthMtsTile = getWidthMtsTile(projected); |
|
223 |
double heightMtsTile = getHeightMtsTile(projected); |
|
192 | 224 |
|
193 | 225 |
double ulx, uly, lrx, lry; |
194 | 226 |
ArrayList list = new ArrayList(); |
... | ... | |
227 | 259 |
* intersects then this will be added to the list. |
228 | 260 |
*/ |
229 | 261 |
public ArrayList contains(boolean projected, Point2D point, Rectangle2D extentLayer) { |
230 |
double widthMtsTile = 0; |
|
231 |
double heightMtsTile = 0; |
|
232 |
if(!projected) { |
|
233 |
widthMtsTile = (scaleDenominator * tileWidth * 0.28) / (MTS_X_GRADO * 1000); |
|
234 |
heightMtsTile = (scaleDenominator * tileHeight * 0.28) / (MTS_X_GRADO * 1000); |
|
235 |
} else { |
|
236 |
widthMtsTile = (scaleDenominator * tileWidth * 0.28) / 1000; |
|
237 |
heightMtsTile = (scaleDenominator * tileHeight * 0.28) / 1000; |
|
238 |
} |
|
262 |
double widthMtsTile = getWidthMtsTile(projected); |
|
263 |
double heightMtsTile = getHeightMtsTile(projected); |
|
239 | 264 |
|
240 | 265 |
double ulx, uly, lrx, lry; |
241 | 266 |
ArrayList list = new ArrayList(); |
... | ... | |
274 | 299 |
* intersects then this will be added to the list. |
275 | 300 |
*/ |
276 | 301 |
public ArrayList contains(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Point2D point, Rectangle2D extentLayer) { |
277 |
double widthMtsTile = 0; |
|
278 |
double heightMtsTile = 0; |
|
279 |
if(!projected) { |
|
280 |
widthMtsTile = (scaleDenominator * tileWidth * 0.28) / (MTS_X_GRADO * 1000); |
|
281 |
heightMtsTile = (scaleDenominator * tileHeight * 0.28) / (MTS_X_GRADO * 1000); |
|
282 |
} else { |
|
283 |
widthMtsTile = (scaleDenominator * tileWidth * 0.28) / 1000; |
|
284 |
heightMtsTile = (scaleDenominator * tileHeight * 0.28) / 1000; |
|
285 |
} |
|
302 |
double widthMtsTile = getWidthMtsTile(projected); |
|
303 |
double heightMtsTile = getHeightMtsTile(projected); |
|
286 | 304 |
|
287 | 305 |
double ulx, uly, lrx, lry; |
288 | 306 |
ArrayList list = new ArrayList(); |
Also available in: Unified diff