gvsig-raster / org.gvsig.raster.cache / trunk / org.gvsig.raster.cache / org.gvsig.raster.cache.lib.impl / src / main / java / org / gvsig / raster / cache / tile / impl / disk / FlatXFileSystemStrategy.java @ 2424
History | View | Annotate | Download (2.75 KB)
1 |
/* TileRasterCache, a library to download tiles from several sources.
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2010 Prodevelop SL.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Prodevelop Integraci�n de Tecnolog�as SL
|
22 |
* Plaza don Juan de Vilarrasa , 14-5
|
23 |
* 46000 Valencia
|
24 |
* Spain
|
25 |
*
|
26 |
* +34 963 510 612
|
27 |
* +34 963 510 968
|
28 |
* gis@prodevelop.es
|
29 |
* http://www.prodevelop.es
|
30 |
*
|
31 |
* author: Alberto Romeu Carrasco (aromeu@prodevelop.es)
|
32 |
*/
|
33 |
|
34 |
package org.gvsig.raster.cache.tile.impl.disk; |
35 |
|
36 |
import java.io.File; |
37 |
|
38 |
|
39 |
/**
|
40 |
* This IFileSystemStrategy creates a directory for each zoom level of a layer.
|
41 |
* Inside the directory of a zoom level, creates a directory for each X row and
|
42 |
* inside the directory of an X row stores a file with the Y row, so
|
43 |
* OSM/0/0/0.tile represents the tile http://osm/0/0/0.png
|
44 |
*
|
45 |
* This strategy is the most spread for mobile map viewers (although is not the most efficient)
|
46 |
* @author aromeu
|
47 |
*
|
48 |
*/
|
49 |
public class FlatXFileSystemStrategy extends DefaultFileSystemStrategy { |
50 |
|
51 |
public FlatXFileSystemStrategy() {
|
52 |
super();
|
53 |
} |
54 |
|
55 |
public FlatXFileSystemStrategy(String tileNameSuffix) { |
56 |
super(tileNameSuffix);
|
57 |
} |
58 |
|
59 |
public String getRelativeToLayerDirTilePath(int row, |
60 |
int col,
|
61 |
int zoomLevel,
|
62 |
String var,
|
63 |
String z,
|
64 |
String time) {
|
65 |
if(zoomLevel < 0) { //Real zoom level |
66 |
return new StringBuffer() |
67 |
.append(var) |
68 |
.append(File.separator)
|
69 |
.append(z) |
70 |
.append(File.separator)
|
71 |
.append(time) |
72 |
.append(File.separator)
|
73 |
.append("real")
|
74 |
.append(File.separator)
|
75 |
.append(col) |
76 |
.append(File.separator)
|
77 |
.append(row).toString(); |
78 |
} else {
|
79 |
return new StringBuffer() |
80 |
.append(var) |
81 |
.append(File.separator)
|
82 |
.append(z) |
83 |
.append(File.separator)
|
84 |
.append(time) |
85 |
.append(File.separator)
|
86 |
.append(zoomLevel) |
87 |
.append(File.separator)
|
88 |
.append(col) |
89 |
.append(File.separator)
|
90 |
.append(row).toString(); |
91 |
} |
92 |
} |
93 |
|
94 |
public String getLayerNameSuffix() { |
95 |
return "_flatx"; |
96 |
} |
97 |
|
98 |
public String getName() { |
99 |
return FLATX;
|
100 |
} |
101 |
} |