Revision 8429
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.cache.tile.TileCacheLibrary |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/TileCache.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile; |
|
23 |
|
|
24 |
import org.gvsig.raster.cache.tile.layer.TiledLayer; |
|
25 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
|
26 |
|
|
27 |
/** |
|
28 |
* Main API interface for the tile cache |
|
29 |
* |
|
30 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
31 |
*/ |
|
32 |
public interface TileCache { |
|
33 |
/** |
|
34 |
* Builds a new layer |
|
35 |
* @param provider |
|
36 |
* @param diskStructure |
|
37 |
* @return |
|
38 |
*/ |
|
39 |
public TiledLayer createLayer(TileServer provider, String diskStructure); |
|
40 |
|
|
41 |
/** |
|
42 |
* Removes a layer from list. |
|
43 |
* @param layer |
|
44 |
*/ |
|
45 |
public void removeLayer(TiledLayer layer); |
|
46 |
|
|
47 |
/** |
|
48 |
* Returns true if the size of data in disk is greater than the MAX_CACHE_SIZE |
|
49 |
* @return |
|
50 |
*/ |
|
51 |
public boolean isFullDiskCache(); |
|
52 |
|
|
53 |
/** |
|
54 |
* Updates the string with the base directory |
|
55 |
* @param dir |
|
56 |
*/ |
|
57 |
public void updateBaseDirectory(String dir); |
|
58 |
|
|
59 |
/** |
|
60 |
* Gets the configuration directory |
|
61 |
* @return |
|
62 |
*/ |
|
63 |
public String getConfigurationDirectory(); |
|
64 |
} |
|
0 | 65 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/TileCacheLocator.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile; |
|
23 |
|
|
24 |
import org.gvsig.tools.locator.BaseLocator; |
|
25 |
import org.gvsig.tools.locator.Locator; |
|
26 |
import org.gvsig.tools.locator.LocatorException; |
|
27 |
|
|
28 |
/** |
|
29 |
* This locator is the entry point for the Raster library, providing |
|
30 |
* access to all Raster services through the {@link TileCacheManager} |
|
31 |
* . |
|
32 |
* |
|
33 |
* @author gvSIG team |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public class TileCacheLocator extends BaseLocator { |
|
37 |
public static final String MANAGER_NAME = "TileCache.manager"; |
|
38 |
public static final String MANAGER_DESCRIPTION = "TileCache Manager"; |
|
39 |
private static final String LOCATOR_NAME = "TileCache.locator"; |
|
40 |
private static final TileCacheLocator INSTANCE = new TileCacheLocator(); |
|
41 |
|
|
42 |
/** |
|
43 |
* Return the singleton instance. |
|
44 |
* |
|
45 |
* @return the singleton instance |
|
46 |
*/ |
|
47 |
public static TileCacheLocator getInstance() { |
|
48 |
return INSTANCE; |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* Return the Locator's name. |
|
53 |
* |
|
54 |
* @return a String with the Locator's name |
|
55 |
*/ |
|
56 |
public final String getLocatorName() { |
|
57 |
return LOCATOR_NAME; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Return a reference to the RasterManager. |
|
62 |
* |
|
63 |
* @return a reference to the RasterManager |
|
64 |
* @throws LocatorException |
|
65 |
* if there is no access to the class or the class cannot be |
|
66 |
* instantiated |
|
67 |
* @see Locator#get(String) |
|
68 |
*/ |
|
69 |
public static TileCacheManager getManager() throws LocatorException { |
|
70 |
return (TileCacheManager) getInstance().get(MANAGER_NAME); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* Registers the Class implementing the RasterManager interface. |
|
75 |
* |
|
76 |
* @param clazz |
|
77 |
* implementing the RasterManager interface |
|
78 |
*/ |
|
79 |
public static void registerManager( |
|
80 |
Class<? extends TileCacheManager> clazz) { |
|
81 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
82 |
} |
|
83 |
|
|
84 |
} |
|
0 | 85 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/TileCacheLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile; |
|
23 |
|
|
24 |
import org.gvsig.tools.library.AbstractLibrary; |
|
25 |
import org.gvsig.tools.library.LibraryException; |
|
26 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
33 |
public class TileCacheLibrary extends AbstractLibrary { |
|
34 |
public static int DEFAULT_LEVELS = 25; |
|
35 |
public static int DEFAULT_TILEWIDTH = 256; |
|
36 |
public static int DEFAULT_TILEHEIGHT = 256; |
|
37 |
public static int ALTERNATIVE_TILESIZE = 1024; |
|
38 |
public static String DEFAULT_STRUCTURE = "FLATX"; |
|
39 |
|
|
40 |
//One directory X dimension. The name of each tile is the Y coordinate. |
|
41 |
public static String FLATX_STRUCT = "FLATX"; |
|
42 |
public static String QUADKEY_STRUCT = "QUADKEY"; |
|
43 |
|
|
44 |
public static int MAX_CACHE_SIZE = 5000; |
|
45 |
|
|
46 |
public TileCacheLibrary() { |
|
47 |
registerAsAPI(TileCacheLibrary.class); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void doInitialize() throws LibraryException { |
|
52 |
} |
|
53 |
|
|
54 |
@Override |
|
55 |
protected void doPostInitialize() throws LibraryException { |
|
56 |
TileCacheManager manager = TileCacheLocator.getManager(); |
|
57 |
if (manager == null) { |
|
58 |
throw new ReferenceNotRegisteredException( |
|
59 |
TileCacheLocator.MANAGER_NAME, TileCacheLocator |
|
60 |
.getInstance()); |
|
61 |
} |
|
62 |
} |
|
63 |
} |
|
0 | 64 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/pool/TilePipe.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile.pool; |
|
23 |
|
|
24 |
|
|
25 |
/** |
|
26 |
* This class manages transactions between the producer and the consumer. The |
|
27 |
* producer download tiles from a server and the consumer is a tile provider |
|
28 |
* which will return downloaded tiles. |
|
29 |
* |
|
30 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
31 |
*/ |
|
32 |
public interface TilePipe { |
|
33 |
|
|
34 |
/** |
|
35 |
* Sets a tile in the pipe |
|
36 |
* @param tile |
|
37 |
*/ |
|
38 |
public void setAtomicTask(AtomicTask tile); |
|
39 |
|
|
40 |
/** |
|
41 |
* Gets a tile from the pipe |
|
42 |
* @return |
|
43 |
*/ |
|
44 |
public AtomicTask getAtomicTask(); |
|
45 |
|
|
46 |
/** |
|
47 |
* Returns the number of elements in the queue |
|
48 |
* @return |
|
49 |
*/ |
|
50 |
public int getSize(); |
|
51 |
|
|
52 |
/** |
|
53 |
* Cleans the queue |
|
54 |
*/ |
|
55 |
public void clear(); |
|
56 |
} |
|
0 | 57 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/pool/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.raster.cache.tile.pool package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>API to build a pool of threads of tasks</p> |
|
11 |
|
|
12 |
<p> |
|
13 |
</p> |
|
14 |
|
|
15 |
</body> |
|
16 |
</html> |
|
0 | 17 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/pool/AtomicTask.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile.pool; |
|
23 |
|
|
24 |
/** |
|
25 |
* Task with priorities |
|
26 |
* |
|
27 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
28 |
*/ |
|
29 |
public interface AtomicTask extends Runnable, Comparable<AtomicTask> { |
|
30 |
/** |
|
31 |
* Gets the priority of this task |
|
32 |
* @return |
|
33 |
*/ |
|
34 |
public int getPriority(); |
|
35 |
|
|
36 |
/** |
|
37 |
* Sets the priority of this task |
|
38 |
* @param priority |
|
39 |
*/ |
|
40 |
public void setPriority(int priority); |
|
41 |
|
|
42 |
/** |
|
43 |
* Cancels this current task |
|
44 |
*/ |
|
45 |
public void cancelTask(); |
|
46 |
} |
|
0 | 47 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/pool/ThreadPool.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile.pool; |
|
23 |
|
|
24 |
import java.util.LinkedList; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* Pool of threads. This class contains a list of tasks and a limited number |
|
29 |
* of threads to execute them. When a thread is free will execute the next task |
|
30 |
* in the list. |
|
31 |
* |
|
32 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
33 |
*/ |
|
34 |
public interface ThreadPool { |
|
35 |
/** |
|
36 |
* Stops all threads in the list and sets the list to null |
|
37 |
*/ |
|
38 |
public void destroyPool(); |
|
39 |
|
|
40 |
/** |
|
41 |
* Adds a new task to the list |
|
42 |
* @param task |
|
43 |
*/ |
|
44 |
public void addTask(AtomicTask task); |
|
45 |
|
|
46 |
/** |
|
47 |
* Gets the list of input tasks |
|
48 |
* @return |
|
49 |
*/ |
|
50 |
public LinkedList<AtomicTask> getInputTaskList(); |
|
51 |
|
|
52 |
/** |
|
53 |
* Gets the list of output tiles |
|
54 |
* @return |
|
55 |
*/ |
|
56 |
public TilePipe getTilePipe(); |
|
57 |
} |
|
0 | 58 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/disk/ITileFileSystemStrategy.java | ||
---|---|---|
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.disk; |
|
35 |
|
|
36 |
/** |
|
37 |
* This interface allows to save/load tiles attending to different strategies, this means |
|
38 |
* the way the tiles are stored on disk, using a quadkey, flat zoom level, etc. |
|
39 |
* |
|
40 |
* @author aromeu |
|
41 |
* |
|
42 |
*/ |
|
43 |
public interface ITileFileSystemStrategy { |
|
44 |
|
|
45 |
public static final String FLATX = "flatx"; |
|
46 |
public static final String QUADKEY = "quadkey"; |
|
47 |
|
|
48 |
/** |
|
49 |
* The relative path of the tile on disk |
|
50 |
* @param row |
|
51 |
* Row of the tile |
|
52 |
* @param col |
|
53 |
* Column of the tile |
|
54 |
* @param zoomLevel |
|
55 |
* The zoom level |
|
56 |
* @param var |
|
57 |
* Variable which is represented in this cache structure. This is useful for netcdf and other |
|
58 |
* multidimensional formats |
|
59 |
* @param z |
|
60 |
* Level of deep in the raster layer. This is useful for multidimensional formats |
|
61 |
* @param time |
|
62 |
* A format which supports 4D needs to store different time moments y different directories |
|
63 |
* @return The path to append to the absolute path of the layer on disk |
|
64 |
*/ |
|
65 |
public String getRelativeToLayerDirTilePath(int row, int col, int zoomLevel, |
|
66 |
String var, String z, String time); |
|
67 |
} |
|
0 | 68 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/disk/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.raster.cache.tile.disk package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>Strategies to store tiles in disk</p> |
|
11 |
|
|
12 |
<p> |
|
13 |
</p> |
|
14 |
|
|
15 |
</body> |
|
16 |
</html> |
|
0 | 17 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/provider/TileListener.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile.provider; |
|
23 |
|
|
24 |
import org.gvsig.raster.cache.tile.Tile; |
|
25 |
import org.gvsig.raster.cache.tile.exception.TileGettingException; |
|
26 |
|
|
27 |
/** |
|
28 |
* This interface will receive events when a new tile arrives. When the last tile is |
|
29 |
* received then endReading will be called. |
|
30 |
* |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
33 |
public interface TileListener { |
|
34 |
|
|
35 |
/** |
|
36 |
* A new tile is received |
|
37 |
* @param loadedTile |
|
38 |
*/ |
|
39 |
public void tileReady(Tile loadedTile) throws TileGettingException ; |
|
40 |
|
|
41 |
/** |
|
42 |
* The last tile is received |
|
43 |
*/ |
|
44 |
public void endReading(); |
|
45 |
|
|
46 |
/** |
|
47 |
* Returns true if the endReading wasn't be called yet |
|
48 |
*/ |
|
49 |
public boolean isReading(); |
|
50 |
|
|
51 |
} |
|
0 | 52 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/provider/TileServer.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile.provider; |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* This interface have to be implemented by a data provider. This will report |
|
29 |
* the structure of its layers |
|
30 |
* |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
33 |
public interface TileServer { |
|
34 |
/** |
|
35 |
* Gets the cache structure |
|
36 |
* @return |
|
37 |
*/ |
|
38 |
public CacheStruct getStruct(); |
|
39 |
|
|
40 |
/** |
|
41 |
* Sets the cache structure. It builds the Downloader with the |
|
42 |
* new structure. |
|
43 |
* @param struct |
|
44 |
*/ |
|
45 |
public void setStruct(CacheStruct struct); |
|
46 |
|
|
47 |
/** |
|
48 |
* Gets the tile server |
|
49 |
* @return |
|
50 |
*/ |
|
51 |
public Downloader getDownloader(); |
|
52 |
|
|
53 |
/** |
|
54 |
* Gets the file extension to save tiles |
|
55 |
* @return |
|
56 |
*/ |
|
57 |
public String getFileSuffix(); |
|
58 |
|
|
59 |
/** |
|
60 |
* Assigns the extension of the output file |
|
61 |
* @param extension |
|
62 |
*/ |
|
63 |
public void setFileSuffix(String extension); |
|
64 |
} |
|
0 | 65 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/provider/CacheStruct.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile.provider; |
|
23 |
|
|
24 |
import java.awt.geom.Point2D; |
|
25 |
import java.awt.geom.Rectangle2D; |
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import org.gvsig.raster.cache.tile.Tile; |
|
29 |
import org.gvsig.raster.cache.tile.exception.TileBuildException; |
|
30 |
|
|
31 |
/** |
|
32 |
* Structure of a cache service |
|
33 |
* |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public interface CacheStruct { |
|
37 |
public static int GEOGRAFIC = 0; |
|
38 |
public static int FLAT = 1; |
|
39 |
|
|
40 |
/** |
|
41 |
* Gets the number of resolution levels |
|
42 |
* @return |
|
43 |
*/ |
|
44 |
public int getNumberOfLevels(); |
|
45 |
|
|
46 |
/** |
|
47 |
* Gets the number of columns in a specific level |
|
48 |
* @param level |
|
49 |
* @return |
|
50 |
*/ |
|
51 |
public long getWorldWidthOfTileMatrixByLevel(int level); |
|
52 |
|
|
53 |
/** |
|
54 |
* Gets the number of rows in a specific level |
|
55 |
* @param level |
|
56 |
* @return |
|
57 |
*/ |
|
58 |
public long getWorldHeightOfTileMatrixByLevel(int level); |
|
59 |
|
|
60 |
/** |
|
61 |
* Gets the number of columns in a specific level |
|
62 |
* @param level |
|
63 |
* @return |
|
64 |
*/ |
|
65 |
public int getLayerWidthOfTileMatrixByLevel(int level); |
|
66 |
|
|
67 |
/** |
|
68 |
* Gets the number of rows in a specific level |
|
69 |
* @param level |
|
70 |
* @return |
|
71 |
*/ |
|
72 |
public int getLayerHeightOfTileMatrixByLevel(int level); |
|
73 |
|
|
74 |
/** |
|
75 |
* Gets the starting X position of the layer |
|
76 |
* @param level |
|
77 |
* @return |
|
78 |
*/ |
|
79 |
public int getLayerInitXTilePositionByLevel(int level); |
|
80 |
|
|
81 |
/** |
|
82 |
* Gets the starting Y position of the layer |
|
83 |
* @param level |
|
84 |
* @return |
|
85 |
*/ |
|
86 |
public int getLayerInitYTilePositionByLevel(int level); |
|
87 |
|
|
88 |
/** |
|
89 |
* Gets the tile size |
|
90 |
* @param level |
|
91 |
* @return an array of two elements. The first element is the width in pixels and |
|
92 |
* the second the height. |
|
93 |
*/ |
|
94 |
public int[] getTileSizeByLevel(int level); |
|
95 |
|
|
96 |
/** |
|
97 |
* Gets the tile size by level in world coordinates |
|
98 |
* @param level |
|
99 |
* @return width x height |
|
100 |
*/ |
|
101 |
public double[] getTileSizeInRealCoordsByLevel(int level); |
|
102 |
|
|
103 |
/** |
|
104 |
* Gets the pixel size of a level |
|
105 |
* @param level |
|
106 |
* @return |
|
107 |
*/ |
|
108 |
public double getPixelSizeByLevel(int level); |
|
109 |
|
|
110 |
/** |
|
111 |
* Gets the extent of a tile |
|
112 |
* @param level |
|
113 |
* @param x |
|
114 |
* @param y |
|
115 |
* @return |
|
116 |
*/ |
|
117 |
public Point2D[] getTileExtent(Tile tile); |
|
118 |
|
|
119 |
/** |
|
120 |
* Get the extent of an matrix element in a specific level |
|
121 |
* @param level |
|
122 |
* @param col |
|
123 |
* @param row |
|
124 |
* @return |
|
125 |
*/ |
|
126 |
public Point2D[] getTileExtent(int level, int col, int row); |
|
127 |
|
|
128 |
/** |
|
129 |
* Builds a tile structure with all parameters that this kind of service needs. |
|
130 |
* @param level |
|
131 |
* @param tileCol |
|
132 |
* @param tileRow |
|
133 |
* @return |
|
134 |
*/ |
|
135 |
public Tile getTileStructure(int level, int tileCol, int tileRow, Point2D ul, Point2D lr) throws TileBuildException ; |
|
136 |
|
|
137 |
/** |
|
138 |
* Gets the list of tiles inside of selected area in pixels. This method is only valid |
|
139 |
* for the real level. Don't use with levels of resolution. |
|
140 |
* @param r |
|
141 |
* @return |
|
142 |
*/ |
|
143 |
public List<Tile> getTileList(Rectangle2D r); |
|
144 |
|
|
145 |
/** |
|
146 |
* Gets the list of tiles inside of selected area |
|
147 |
* @param ul |
|
148 |
* @param lr |
|
149 |
* @param mtsPixelRequest |
|
150 |
* @return |
|
151 |
* @throws TileBuildException |
|
152 |
*/ |
|
153 |
public List<Tile> getTileList(Point2D ul, Point2D lr, double mtsPixelRequest) throws TileBuildException; |
|
154 |
|
|
155 |
/** |
|
156 |
* Gets the list of tiles inside of selected area |
|
157 |
* @param ul |
|
158 |
* @param lr |
|
159 |
* @param mtsPixelRequest |
|
160 |
* @param increaseResolution |
|
161 |
* Set to true to get a level of resolution greater than the correct. |
|
162 |
* For the same area, we will get more tiles and won't improve the |
|
163 |
* quality because they will be rescaled in the drawn. In request |
|
164 |
* to remote services can be useful because it will give a better |
|
165 |
* level of detail. |
|
166 |
* @return |
|
167 |
* @throws TileBuildException |
|
168 |
*/ |
|
169 |
//public List<Tile> getTileList(Point2D ul, Point2D lr, double mtsPixelRequest, boolean increaseResolution) throws TileBuildException; |
|
170 |
|
|
171 |
/** |
|
172 |
* Gets the layer name |
|
173 |
* @return |
|
174 |
*/ |
|
175 |
public String getLayerName(); |
|
176 |
|
|
177 |
/** |
|
178 |
* Gets the server URL |
|
179 |
* @return |
|
180 |
*/ |
|
181 |
public String getServerURL(); |
|
182 |
|
|
183 |
/** |
|
184 |
* Gets the suffix which represents the image format |
|
185 |
* @return |
|
186 |
*/ |
|
187 |
public String getFileSuffix(); |
|
188 |
|
|
189 |
/** |
|
190 |
* Gets the EPSG code |
|
191 |
* @return |
|
192 |
*/ |
|
193 |
public String getEPSG(); |
|
194 |
|
|
195 |
/** |
|
196 |
* If the source is a file gets the size or 0 if is not a file |
|
197 |
* @return |
|
198 |
*/ |
|
199 |
public String getFileSize(); |
|
200 |
|
|
201 |
/** |
|
202 |
* Compares two structures and returns true if they are equals |
|
203 |
* @param struct |
|
204 |
* @return |
|
205 |
*/ |
|
206 |
public boolean compare(CacheStruct struct); |
|
207 |
} |
|
0 | 208 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/provider/Downloader.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile.provider; |
|
23 |
|
|
24 |
import org.gvsig.raster.cache.tile.Tile; |
|
25 |
import org.gvsig.raster.cache.tile.exception.TileGettingException; |
|
26 |
|
|
27 |
/** |
|
28 |
* Tile cache uses this interface to get a tile and the data provider have to implement |
|
29 |
* it to serve tiles. |
|
30 |
* |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
33 |
public interface Downloader { |
|
34 |
|
|
35 |
/** |
|
36 |
* Gets a tile from the data source. The parameter tile contains |
|
37 |
* the information of the tile to download. If the provider is a remote |
|
38 |
* service this will have to download the tile from the server and if it |
|
39 |
* is a file provider the source will be a file. |
|
40 |
* @param tile Tile information |
|
41 |
* @param param Additional parameter |
|
42 |
* @return Tile loaded |
|
43 |
*/ |
|
44 |
public Tile downloadTile(Tile tile) throws TileGettingException; |
|
45 |
|
|
46 |
/** |
|
47 |
* Reads a tile from the tile cache. The path to the tile is in the Tile |
|
48 |
* object |
|
49 |
* @param tile |
|
50 |
* @return |
|
51 |
* @throws TileGettingException |
|
52 |
*/ |
|
53 |
public Tile readTileFromDisk(Tile tile) throws TileGettingException; |
|
54 |
|
|
55 |
/** |
|
56 |
* Gets the image that represent a tile while is downloading |
|
57 |
* @return |
|
58 |
*/ |
|
59 |
public Object[] getDownloadingImage(int w, int h); |
|
60 |
|
|
61 |
/** |
|
62 |
* Gets the image that represent a crash tile |
|
63 |
* @return |
|
64 |
*/ |
|
65 |
public Object[] getCrashImage(int w, int h); |
|
66 |
} |
|
0 | 67 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/provider/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.raster.cache.tile.provider package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>Cache structures</p> |
|
11 |
|
|
12 |
<p> |
|
13 |
</p> |
|
14 |
|
|
15 |
</body> |
|
16 |
</html> |
|
0 | 17 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/TileCacheManager.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile; |
|
23 |
|
|
24 |
import java.awt.geom.Point2D; |
|
25 |
import java.awt.geom.Rectangle2D; |
|
26 |
|
|
27 |
import org.gvsig.raster.cache.tile.pool.ThreadPool; |
|
28 |
import org.gvsig.raster.cache.tile.provider.CacheStruct; |
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
/** |
|
33 |
* This class is responsible of the management of the library's business logic. |
|
34 |
* It is the library's main entry point, and provides all the services to manage |
|
35 |
* {@link TileCacheService}s. |
|
36 |
* |
|
37 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
38 |
* @version $Id$ |
|
39 |
*/ |
|
40 |
public interface TileCacheManager { |
|
41 |
/** |
|
42 |
* Builds a new entry point for a tile cache. The parameter is an identifier for a |
|
43 |
* tile cache structured implemented inside of this library |
|
44 |
* @param baseDir |
|
45 |
* @return |
|
46 |
*/ |
|
47 |
public TileCache getTileCache(String baseDir); |
|
48 |
|
|
49 |
/** |
|
50 |
* Creates a new tile structure |
|
51 |
* @param level |
|
52 |
* @param col |
|
53 |
* Tile column |
|
54 |
* @param row |
|
55 |
* Tile row |
|
56 |
* @return |
|
57 |
*/ |
|
58 |
public Tile createTile(int level, int col, int row); |
|
59 |
|
|
60 |
/** |
|
61 |
* Creates a new tile structure |
|
62 |
* @param wPx |
|
63 |
* Width in pixels |
|
64 |
* @param hPx |
|
65 |
* Height in pixels |
|
66 |
* @param row |
|
67 |
* Tile row |
|
68 |
* @param col |
|
69 |
* Tile column |
|
70 |
* @param ul |
|
71 |
* Upper left coordinate |
|
72 |
* @param lr |
|
73 |
* Lower roght coordinate |
|
74 |
* @return |
|
75 |
*/ |
|
76 |
public Tile createTile(int wPx, int hPx, int row, int col, Point2D ul, Point2D lr); |
|
77 |
|
|
78 |
/** |
|
79 |
* Builds a standard cache structure |
|
80 |
* @param typeOfCoords Constant defined in CacheStruct interface |
|
81 |
* @param levels Number of levels |
|
82 |
* @param layerExtent Bounding box of the layer |
|
83 |
* @param pixelSize Pixel size of the layer |
|
84 |
* @param tilePxWidth Width in pixels of a tile |
|
85 |
* @param tilePxHeight Height in pixels of a tile |
|
86 |
* @param uri server URL |
|
87 |
* @param layerName Layer name or identifier |
|
88 |
* @param strategy Strategy to store tiles in disk |
|
89 |
* @param baseDir path to this layer |
|
90 |
* @param fileSuffix File suffix |
|
91 |
* @param epsg |
|
92 |
* @return |
|
93 |
*/ |
|
94 |
public CacheStruct createCacheStructure(int typeOfCoords, |
|
95 |
int levels, |
|
96 |
Rectangle2D layerExtent, |
|
97 |
double pixelSize, |
|
98 |
int tilePxWidth, |
|
99 |
int tilePxHeight, |
|
100 |
String uri, |
|
101 |
String layerName, |
|
102 |
String strategy, |
|
103 |
String baseDir, |
|
104 |
String fileSuffix, |
|
105 |
String epsg, |
|
106 |
long fileSize); |
|
107 |
|
|
108 |
/** |
|
109 |
* Builds a standard cache structure for local files |
|
110 |
* @param typeOfCoords Constant defined in CacheStruct interface |
|
111 |
* @param levels Number of levels |
|
112 |
* @param layerExtent Bounding box of the layer |
|
113 |
* @param pixelSize Pixel size of the layer |
|
114 |
* @param tilePxWidth Width in pixels of a tile |
|
115 |
* @param tilePxHeight Height in pixels of a tile |
|
116 |
* @param layerName Layer name or identifier |
|
117 |
* @param strategy Strategy to store tiles in disk |
|
118 |
* @param baseDir path to this layer |
|
119 |
* @param fileSuffix File suffix |
|
120 |
* @param epsg |
|
121 |
* @return |
|
122 |
*/ |
|
123 |
public CacheStruct createCacheStructure(int typeOfCoords, |
|
124 |
int levels, |
|
125 |
Rectangle2D layerExtent, |
|
126 |
double pixelSize, |
|
127 |
int tilePxWidth, |
|
128 |
int tilePxHeight, |
|
129 |
String layerName, |
|
130 |
String strategy, |
|
131 |
String baseDir, |
|
132 |
String fileSuffix, |
|
133 |
String epsg, |
|
134 |
long fileSize); |
|
135 |
|
|
136 |
/** |
|
137 |
* Builds a new thread pool. This pool will use five threads by default |
|
138 |
* @return |
|
139 |
*/ |
|
140 |
public ThreadPool createThreadPool(boolean priorityActive); |
|
141 |
|
|
142 |
/** |
|
143 |
* Builds a new thread pool selecting the number of threads |
|
144 |
* @return |
|
145 |
*/ |
|
146 |
public ThreadPool createThreadPool(boolean priorityActive, int nThreads); |
|
147 |
|
|
148 |
/** |
|
149 |
* Sets the time out in milliseconds |
|
150 |
* @param ms |
|
151 |
*/ |
|
152 |
public void setTileTimeOut(int ms); |
|
153 |
|
|
154 |
/** |
|
155 |
* Gets the time out in milliseconds |
|
156 |
* @return |
|
157 |
*/ |
|
158 |
public int getTileTimeOut(); |
|
159 |
} |
|
0 | 160 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/layer/TiledLayer.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile.layer; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import org.gvsig.raster.cache.tile.Tile; |
|
27 |
import org.gvsig.raster.cache.tile.exception.TileGettingException; |
|
28 |
import org.gvsig.raster.cache.tile.provider.TileListener; |
|
29 |
import org.gvsig.tools.task.TaskStatus; |
|
30 |
|
|
31 |
/** |
|
32 |
* API interface for a cached layer |
|
33 |
* |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public interface TiledLayer { |
|
37 |
|
|
38 |
/** |
|
39 |
* Gets a tile |
|
40 |
* @param tile |
|
41 |
* @return |
|
42 |
* @throws TileGettingException |
|
43 |
*/ |
|
44 |
public Tile getTile(Tile tile) throws TileGettingException; |
|
45 |
|
|
46 |
/** |
|
47 |
* Gets a list of tiles |
|
48 |
* @param tiles |
|
49 |
* @param listener |
|
50 |
* @throws TileGettingException |
|
51 |
*/ |
|
52 |
public void getTiles(List<Tile> tiles, TileListener listener, TaskStatus status) throws TileGettingException; |
|
53 |
|
|
54 |
/** |
|
55 |
* Gets the base directory for this layer. This function builds an unique identifier |
|
56 |
* for a layer with a limited length. |
|
57 |
* @return |
|
58 |
*/ |
|
59 |
public String getBaseLayerDirectory(); |
|
60 |
|
|
61 |
/** |
|
62 |
* Returns the ID of this layer. |
|
63 |
* The ID is the name of the directory where the tiles are stored. |
|
64 |
* @return |
|
65 |
*/ |
|
66 |
public String getID(); |
|
67 |
|
|
68 |
/** |
|
69 |
* Deletes the files of this layer |
|
70 |
* @return Size of information that was deleted |
|
71 |
*/ |
|
72 |
public long delete(); |
|
73 |
} |
|
0 | 74 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/layer/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.raster.cache.tile.layer package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>Tile layer</p> |
|
11 |
|
|
12 |
<p> |
|
13 |
</p> |
|
14 |
|
|
15 |
</body> |
|
16 |
</html> |
|
0 | 17 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.23/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/tile/Tile.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.cache.tile; |
|
23 |
|
|
24 |
import java.awt.geom.Point2D; |
|
25 |
import java.awt.geom.Rectangle2D; |
|
26 |
import java.io.File; |
|
27 |
|
|
28 |
import org.gvsig.raster.cache.tile.pool.AtomicTask; |
|
29 |
import org.gvsig.raster.cache.tile.pool.TilePipe; |
|
30 |
import org.gvsig.raster.cache.tile.provider.Downloader; |
|
31 |
import org.gvsig.compat.net.ICancellable; |
|
32 |
|
|
33 |
/** |
|
34 |
* Tile structure for requests |
|
35 |
* |
|
36 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
37 |
*/ |
|
38 |
public interface Tile extends AtomicTask { |
|
39 |
|
|
40 |
/** |
|
41 |
* Gets the Variable that this tile belong to.This is useful when the source |
|
42 |
* is a multidimensional container. If it is not then this variable will have |
|
43 |
* a default value. |
|
44 |
* @return |
|
45 |
*/ |
|
46 |
public String getVariable(); |
|
47 |
|
|
48 |
/** |
|
49 |
* Gets the Z that this tile belong to. This is useful when the source |
|
50 |
* is a multidimensional container. If it is not then this variable will have |
|
51 |
* a 0 value. |
|
52 |
* @return |
|
53 |
*/ |
|
54 |
public String getZ(); |
|
55 |
|
|
56 |
/** |
|
57 |
* Gets the time instant that this tile belong to.This is useful when the source |
|
58 |
* is a multidimensional container. If it is not then this variable will have |
|
59 |
* a 0 value. |
|
60 |
* @return |
|
61 |
*/ |
|
62 |
public String getTimeInstant(); |
|
63 |
|
|
64 |
/** |
|
65 |
* Sets the Variable that this tile belong to.This is useful when the source |
|
66 |
* is a multidimensional container. If it is not then this variable will have |
|
67 |
* a default value. |
|
68 |
* @return |
|
69 |
*/ |
|
70 |
public void setVariable(String var); |
|
71 |
|
|
72 |
/** |
|
73 |
* Sets the Z that this tile belong to. This is useful when the source |
|
74 |
* is a multidimensional container. If it is not then this variable will have |
|
75 |
* a 0 value. |
|
76 |
* @return |
|
77 |
*/ |
|
78 |
public void setZ(String z); |
|
79 |
|
|
80 |
/** |
|
81 |
* Sets the time instant that this tile belong to.This is useful when the source |
|
82 |
* is a multidimensional container. If it is not then this variable will have |
|
83 |
* a 0 value. |
|
84 |
* @return |
|
85 |
*/ |
|
86 |
public void setTimeInstant(String t); |
|
87 |
|
|
88 |
/** |
|
89 |
* Gets the column of this tile |
|
90 |
* @return |
|
91 |
*/ |
|
92 |
public int getCol(); |
|
93 |
|
|
94 |
/** |
|
95 |
* Gets the row of this tile |
|
96 |
* @return |
|
97 |
*/ |
|
98 |
public int getRow(); |
|
99 |
|
|
100 |
/** |
|
101 |
* Gets the resolution level of this tile |
|
102 |
* @return |
|
103 |
*/ |
|
104 |
public int getLevel(); |
|
105 |
|
|
106 |
/** |
|
107 |
* Sets the column of this tile in its level |
|
108 |
* @param col |
|
109 |
*/ |
|
110 |
public void setCol(int col); |
|
111 |
|
|
112 |
/** |
|
113 |
* Sets the row of this tile in its level |
|
114 |
* @param col |
|
115 |
*/ |
|
116 |
public void setRow(int row); |
|
117 |
|
|
118 |
/** |
|
119 |
* Sets the level of resolution of this tile |
|
120 |
* @param col |
|
121 |
*/ |
|
122 |
public void setLevel(int level); |
|
123 |
|
|
124 |
/** |
|
125 |
* Gets the coordinates in pixels of this tile inside the layer. |
|
126 |
* This function is only for the real level. |
|
127 |
* @return |
|
128 |
*/ |
|
129 |
public Rectangle2D getCoordsPx(); |
|
130 |
|
|
131 |
/** |
|
132 |
* Sets the coordinates ins pixels of this tile inside the layer. |
|
133 |
* This function is only for the real level. |
|
134 |
* @param r |
|
135 |
*/ |
|
136 |
public void setCoordsPx(Rectangle2D r); |
|
137 |
|
|
138 |
/** |
|
139 |
* Gets the width in pixels of this tile |
|
140 |
* @return |
|
141 |
*/ |
|
142 |
public int getWidthPx(); |
|
143 |
|
|
144 |
/** |
|
145 |
* Sets the width in pixels of this tile |
|
146 |
* @param widthPx |
|
147 |
*/ |
|
148 |
public void setWidthPx(int widthPx); |
|
149 |
|
|
150 |
/** |
|
151 |
* Gets the height in pixels of this tile |
|
152 |
* @return |
|
153 |
*/ |
|
154 |
public int getHeightPx(); |
|
155 |
|
|
156 |
/** |
|
157 |
* Sets the height in pixels of this tile |
|
158 |
* @param heightPx |
|
159 |
*/ |
|
160 |
public void setHeightPx(int heightPx); |
|
161 |
|
|
162 |
/** |
|
163 |
* Gets the bounding box |
|
164 |
* @return |
|
165 |
*/ |
|
166 |
public Rectangle2D getExtent(); |
|
167 |
|
|
168 |
/** |
|
169 |
* Gets the upper left coordinate of this tile |
|
170 |
* @return |
|
171 |
*/ |
|
172 |
public Point2D getUl(); |
|
173 |
|
|
174 |
/** |
|
175 |
* Sets the upper left coordinate of this tile |
|
176 |
* @return |
|
177 |
*/ |
Also available in: Unified diff