Revision 5334
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.raster.tilecache.app</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>Tilecache for raster services</name> |
|
8 |
<description>Basic libraries to support tiled raster</description> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.raster.tilecache</artifactId> |
|
12 |
<version>2.2.28</version> |
|
13 |
</parent> |
|
14 |
<scm> |
|
15 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app</connection> |
|
16 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app</developerConnection> |
|
17 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app</url> |
|
18 |
</scm> |
|
19 |
<dependencies> |
|
20 |
<dependency> |
|
21 |
<groupId>org.gvsig</groupId> |
|
22 |
<artifactId>org.gvsig.about.api</artifactId> |
|
23 |
<scope>compile</scope> |
|
24 |
</dependency> |
|
25 |
<dependency> |
|
26 |
<groupId>org.gvsig</groupId> |
|
27 |
<artifactId>org.gvsig.raster.cache.lib.api</artifactId> |
|
28 |
<scope>compile</scope> |
|
29 |
</dependency> |
|
30 |
<dependency> |
|
31 |
<groupId>org.gvsig</groupId> |
|
32 |
<artifactId>org.gvsig.raster.cache.lib.impl</artifactId> |
|
33 |
<scope>runtime</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.raster.tilecache.io</artifactId> |
|
38 |
<scope>runtime</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.andami</artifactId> |
|
43 |
<scope>compile</scope> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 |
<artifactId>org.gvsig.i18n</artifactId> |
|
48 |
<scope>compile</scope> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
53 |
<scope>compile</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
58 |
<scope>compile</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
|
63 |
<scope>compile</scope> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>org.gvsig</groupId> |
|
67 |
<artifactId>org.gvsig.raster.lib.impl</artifactId> |
|
68 |
<scope>compile</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.raster.fmap</artifactId> |
|
73 |
<scope>compile</scope> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
78 |
<scope>compile</scope> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.gvsig</groupId> |
|
82 |
<artifactId>org.gvsig.utils</artifactId> |
|
83 |
<scope>compile</scope> |
|
84 |
</dependency> |
|
85 |
<dependency> |
|
86 |
<groupId>org.gvsig</groupId> |
|
87 |
<artifactId>org.gvsig.ui</artifactId> |
|
88 |
<scope>compile</scope> |
|
89 |
</dependency> |
|
90 |
<dependency> |
|
91 |
<groupId>org.gvsig</groupId> |
|
92 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
93 |
<scope>compile</scope> |
|
94 |
</dependency> |
|
95 |
<dependency> |
|
96 |
<groupId>org.gvsig</groupId> |
|
97 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
98 |
<scope>runtime</scope> |
|
99 |
</dependency> |
|
100 |
<dependency> |
|
101 |
<groupId>org.gvsig</groupId> |
|
102 |
<artifactId>org.gvsig.timesupport.lib.impl</artifactId> |
|
103 |
<scope>runtime</scope> |
|
104 |
</dependency> |
|
105 |
<dependency> |
|
106 |
<groupId>joda-time</groupId> |
|
107 |
<artifactId>joda-time</artifactId> |
|
108 |
<scope>runtime</scope> |
|
109 |
</dependency> |
|
110 |
<dependency> |
|
111 |
<groupId>org.gvsig</groupId> |
|
112 |
<artifactId>org.gvsig.raster.swing.api</artifactId> |
|
113 |
<scope>compile</scope> |
|
114 |
</dependency> |
|
115 |
<dependency> |
|
116 |
<groupId>org.gvsig</groupId> |
|
117 |
<artifactId>org.gvsig.raster.swing.impl</artifactId> |
|
118 |
<scope>runtime</scope> |
|
119 |
</dependency> |
|
120 |
<dependency> |
|
121 |
<groupId>org.gvsig</groupId> |
|
122 |
<artifactId>org.gvsig.raster.algorithm</artifactId> |
|
123 |
<scope>runtime</scope> |
|
124 |
</dependency> |
|
125 |
|
|
126 |
<dependency> |
|
127 |
<groupId>org.gvsig</groupId> |
|
128 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
129 |
<scope>compile</scope> |
|
130 |
</dependency> |
|
131 |
<dependency> |
|
132 |
<groupId>org.gvsig</groupId> |
|
133 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
134 |
<scope>runtime</scope> |
|
135 |
</dependency> |
|
136 |
<dependency> |
|
137 |
<groupId>org.gvsig</groupId> |
|
138 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
139 |
<scope>compile</scope> |
|
140 |
</dependency> |
|
141 |
<dependency> |
|
142 |
<groupId>org.gvsig</groupId> |
|
143 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
144 |
<scope>compile</scope> |
|
145 |
</dependency> |
|
146 |
<dependency> |
|
147 |
<groupId>org.gvsig</groupId> |
|
148 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
149 |
<scope>compile</scope> |
|
150 |
</dependency> |
|
151 |
<dependency> |
|
152 |
<groupId>org.gvsig</groupId> |
|
153 |
<artifactId>org.gvsig.fmap.mapcontext.impl</artifactId> |
|
154 |
<scope>runtime</scope> |
|
155 |
</dependency> |
|
156 |
<dependency> |
|
157 |
<groupId>org.gvsig</groupId> |
|
158 |
<artifactId>org.gvsig.fmap.mapcontext.operation</artifactId> |
|
159 |
<scope>runtime</scope> |
|
160 |
</dependency> |
|
161 |
</dependencies> |
|
162 |
<properties> |
|
163 |
<gvsig.package.info.state>final</gvsig.package.info.state> |
|
164 |
<gvsig.package.info.categories>Raster</gvsig.package.info.categories> |
|
165 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
166 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/Raster/pool</gvsig.package.info.poolURL> |
|
167 |
</properties> |
|
168 |
</project> |
|
0 | 169 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/buildNumber.properties | ||
---|---|---|
1 |
#Sun Feb 21 13:32:02 CET 2016 |
|
2 |
buildNumber=80 |
|
0 | 3 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/resources-plugin/text.properties | ||
---|---|---|
1 |
tiled_layer=?Deseas usar la cach? de tiles con las capas seleccionadas? |
|
2 |
tiled_layer2=?Deseas cargar la capa de forma normal o cacheando datos en forma de teselas? |
|
3 |
tiled=Teselada |
|
4 |
all_normally=Todas normal |
|
5 |
all_tiled=Todas teseladas |
|
6 |
normally=Normal |
|
7 |
tilecache=Tilecach? |
|
8 |
preference_cache_warning=<html><center><b>ATENCI?N: Solo tocar esta secci?n si est? seguro de lo que est? haciendo</b></center></html> |
|
9 |
tamanyo_max_tilecache=Tama?o m?ximo tile cache |
|
10 |
res_levels=Niveles de resoluci?n |
|
11 |
tilesize=Tama?o de tile |
|
12 |
tilecache_struct=Estructura de directorios |
|
13 |
remove_cache=Borrar cach? |
|
14 |
path_tilecache=Ruta a los ficheros de la cach? |
|
15 |
remove_directory=Borrar directorio |
|
16 |
open_files=El directorio de cach? no puede ser eliminado.\n No debe tener ficheros abiertos. Cierre todas las capas. |
|
17 |
path_not_exists=El directorio no existe |
|
18 |
file=Fichero |
|
0 | 19 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/resources-plugin/text_en.properties | ||
---|---|---|
1 |
tiled_layer=Would you like to use tile cache with the selected layers? |
|
2 |
tiled_layer2=Would you like to load this layer normally or caching data as tiles? |
|
3 |
tiled=Tiled |
|
4 |
all_normally=Normally all |
|
5 |
all_tiled=Tiled all |
|
6 |
normally=Normally |
|
7 |
tilecache=Tilecache |
|
8 |
preference_cache_warning=<html><center><b>WARNING: You mustn't to change this section if you're not sure what you are doing</b></center></html> |
|
9 |
tamanyo_max_tilecache=Maximum size of tilecache |
|
10 |
res_levels=Resolution levels |
|
11 |
tilesize=Tile size |
|
12 |
tilecache_struct=Path structure |
|
13 |
remove_cache=Remove cache |
|
14 |
path_tilecache=Path to the files of cache |
|
15 |
remove_directory=Remove folder |
|
16 |
open_files=The folder cannot be eliminated.\n It should not have open files. Close all layers |
|
17 |
path_not_exists=The directory does not exists |
|
18 |
file=File |
|
0 | 19 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="org.gvsig.raster.mainplugin" /> |
|
4 |
<libraries library-dir="lib"/> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<extensions> |
|
7 |
<extension class-name="org.gvsig.raster.tilecache.app.CacheExtension" |
|
8 |
description="Tile Cache support" |
|
9 |
active="true" |
|
10 |
priority="1"> |
|
11 |
</extension> |
|
12 |
</extensions> |
|
13 |
</plugin-config> |
|
0 | 14 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/resources-plugin/install/install.xml | ||
---|---|---|
1 |
<project name="org.gvsig.plugin1" default="main" basedir="."> |
|
2 |
<target name="main" depends="copy_files, link1, link2"/> |
|
3 |
<target name="copy_files"> |
|
4 |
<copy todir="${gvsig_dir}"> |
|
5 |
<fileset dir="./files" includes="**"/> |
|
6 |
</copy> |
|
7 |
</target> |
|
8 |
<target name="link1" depends="gdal-properties" if="gdal.link1"> |
|
9 |
<exec executable="ln" > |
|
10 |
<arg value="-s"/> |
|
11 |
<arg value="${gdal.so}"/> |
|
12 |
<arg value="${gdal.link1}"/> |
|
13 |
</exec> |
|
14 |
</target> |
|
15 |
<target name="link2" depends="gdal-properties" if="gdal.link2"> |
|
16 |
<exec executable="ln" > |
|
17 |
<arg value="-s"/> |
|
18 |
<arg value="${gdal.so}"/> |
|
19 |
<arg value="${gdal.link2}"/> |
|
20 |
</exec> |
|
21 |
</target> |
|
22 |
<target name="gdal-properties" depends="checkgdal, gdal-properties.1.15.1, gdal-properties.1.13.0"/> |
|
23 |
<target name="gdal-properties.1.15.1" if="gdal.1.15.1"> |
|
24 |
<property name="gdal.so" value="${gvsig_dir}/native/libgdal.so.1.15.1"/> |
|
25 |
<property name="gdal.link1" value="${gvsig_dir}/native/libgdal.so.1"/> |
|
26 |
<property name="gdal.link2" value="${gvsig_dir}/native/libgdal.so"/> |
|
27 |
</target> |
|
28 |
<target name="gdal-properties.1.13.0" if="gdal.1.13.0"> |
|
29 |
<property name="gdal.so" value="${gvsig_dir}/native/libgdal.so.1.13.0"/> |
|
30 |
<property name="gdal.link1" value="${gvsig_dir}/native/libgdal.so.1"/> |
|
31 |
<property name="gdal.link2" value="${gvsig_dir}/native/libgdal.so"/> |
|
32 |
</target> |
|
33 |
<target name="checkgdal"> |
|
34 |
<available file="${gvsig_dir}/native/libgdal.so.1.15.1" property="gdal.1.15.1"/> |
|
35 |
<available file="${gvsig_dir}/native/libgdal.so.1.13.0" property="gdal.1.13.0"/> |
|
36 |
</target> |
|
37 |
|
|
38 |
<!-- To add a new gdal so version: |
|
39 |
* add a new available in "checkgdal" target |
|
40 |
* create a new "gdal-properties.x.xx.x" target with right property values |
|
41 |
* add the new "gda-properties.x.xx.x" into "gdal-properties" target depends list |
|
42 |
|
|
43 |
|
|
44 |
--> |
|
45 |
</project> |
|
0 | 46 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/resources-plugin/about/tilecache-about.html | ||
---|---|---|
1 |
<html> |
|
2 |
<head> |
|
3 |
<style type="text/css"> |
|
4 |
BODY { background-image: url(logo.png); background-repeat: no-repeat; background-position: 100% 0% } |
|
5 |
</style> |
|
6 |
</head> |
|
7 |
<body> |
|
8 |
<h2>Soporte PostGIS Raster para gvSIG</h2> |
|
9 |
<p><b>Prodevelop S.L.</b> ha incorporado el soporte al formato raster en |
|
10 |
base de datos <b>PostGres</b></p> |
|
11 |
|
|
12 |
<p><b>Desarrollo:</b></p> |
|
13 |
|
|
14 |
<p>Director del proyecto:</p> |
|
15 |
<ul> |
|
16 |
<li>Miguel Montesinos Lajara</li> |
|
17 |
</ul> |
|
18 |
<p>Equipo de desarrollo:</p> |
|
19 |
<ul> |
|
20 |
<li>Nacho Brodin</li> |
|
21 |
</ul> |
|
22 |
|
|
23 |
<p><b>Colaboradores:</b></p> |
|
24 |
|
|
25 |
<p>Deimos:</p> |
|
26 |
<ul> |
|
27 |
<li>Jorge Arevalo</li> |
|
28 |
</ul> |
|
29 |
|
|
30 |
<p>Build Number de la extensión: 1</p> |
|
31 |
<center> |
|
32 |
<p><b><a href="http://www.prodevelop.es" title="Prodevelop">http://www.prodevelop.es</a></b></p> |
|
33 |
</center> |
|
34 |
|
|
35 |
</body> |
|
36 |
</html> |
|
0 | 37 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
|
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>true</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
<includes> |
|
32 |
<include>org.gvsig:org.gvsig.raster.tilecache.app:jar</include> |
|
33 |
<include>org.gvsig:org.gvsig.raster.tilecache.io:jar</include> |
|
34 |
</includes> |
|
35 |
</dependencySet> |
|
36 |
</dependencySets> |
|
37 |
</assembly> |
|
0 | 38 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/java/org/gvsig/raster/tilecache/app/TileCachePreferences.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.tilecache.app; |
|
23 |
|
|
24 |
import java.awt.BorderLayout; |
|
25 |
import java.awt.GridBagConstraints; |
|
26 |
import java.awt.GridBagLayout; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
import javax.swing.JPanel; |
|
30 |
import javax.swing.JScrollPane; |
|
31 |
import javax.swing.border.EmptyBorder; |
|
32 |
|
|
33 |
import org.gvsig.andami.IconThemeHelper; |
|
34 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
|
35 |
import org.gvsig.andami.preferences.StoreException; |
|
36 |
import org.gvsig.tools.ToolsLocator; |
|
37 |
import org.gvsig.tools.i18n.I18nManager; |
|
38 |
|
|
39 |
/** |
|
40 |
* Preferences for tile cache |
|
41 |
* @author Nacho Brodin (nachobrodin@gmail.com |
|
42 |
*/ |
|
43 |
public class TileCachePreferences extends AbstractPreferencePage { |
|
44 |
private static final long serialVersionUID = -1689657253810393874L; |
|
45 |
|
|
46 |
protected static String id = TileCachePreferences.class.getName(); |
|
47 |
private ImageIcon icon; |
|
48 |
|
|
49 |
private TileCachePreferencesPanel tilecache = null; |
|
50 |
|
|
51 |
private I18nManager i18n = ToolsLocator.getI18nManager(); |
|
52 |
|
|
53 |
/** |
|
54 |
* Constructor de la clase RasterPreferences |
|
55 |
*/ |
|
56 |
public TileCachePreferences() { |
|
57 |
super(); |
|
58 |
icon = IconThemeHelper.getImageIcon("pref-tilecache-icon"); |
|
59 |
initialize(); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Inicializacion del panel de preferencias. |
|
64 |
*/ |
|
65 |
private void initialize() { |
|
66 |
setTitle("Frame"); |
|
67 |
|
|
68 |
GridBagConstraints gridBagConstraints; |
|
69 |
|
|
70 |
JScrollPane scrollPane = new JScrollPane(); |
|
71 |
|
|
72 |
scrollPane.getVerticalScrollBar().setUnitIncrement(20); |
|
73 |
|
|
74 |
JPanel panel = new JPanel(); |
|
75 |
|
|
76 |
panel.setLayout(new GridBagLayout()); |
|
77 |
|
|
78 |
gridBagConstraints = new GridBagConstraints(); |
|
79 |
gridBagConstraints.gridx = 0; |
|
80 |
gridBagConstraints.gridy = 0; |
|
81 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
82 |
panel.add(getPreferenceTileCache(), gridBagConstraints); |
|
83 |
|
|
84 |
gridBagConstraints = new GridBagConstraints(); |
|
85 |
gridBagConstraints.gridx = 0; |
|
86 |
gridBagConstraints.gridy = 7; |
|
87 |
gridBagConstraints.weightx = 1.0; |
|
88 |
gridBagConstraints.weighty = 1.0; |
|
89 |
panel.add(new JPanel(), gridBagConstraints); |
|
90 |
|
|
91 |
panel.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
92 |
|
|
93 |
scrollPane.setViewportView(panel); |
|
94 |
|
|
95 |
setLayout(new BorderLayout()); |
|
96 |
add(scrollPane, BorderLayout.CENTER); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Gets a tile cache configuration panel |
|
101 |
* @return |
|
102 |
*/ |
|
103 |
private TileCachePreferencesPanel getPreferenceTileCache() { |
|
104 |
if (tilecache == null) { |
|
105 |
tilecache = new TileCachePreferencesPanel(); |
|
106 |
} |
|
107 |
return tilecache; |
|
108 |
} |
|
109 |
|
|
110 |
/* |
|
111 |
* (non-Javadoc) |
|
112 |
* @see com.iver.andami.preferences.IPreference#initializeValues() |
|
113 |
*/ |
|
114 |
public void initializeValues() { |
|
115 |
getPreferenceTileCache().initializeValues(); |
|
116 |
} |
|
117 |
|
|
118 |
/* |
|
119 |
* (non-Javadoc) |
|
120 |
* @see com.iver.andami.preferences.AbstractPreferencePage#storeValues() |
|
121 |
*/ |
|
122 |
public void storeValues() throws StoreException { |
|
123 |
getPreferenceTileCache().storeValues(); |
|
124 |
} |
|
125 |
|
|
126 |
/* |
|
127 |
* (non-Javadoc) |
|
128 |
* @see com.iver.andami.preferences.IPreference#initializeDefaults() |
|
129 |
*/ |
|
130 |
public void initializeDefaults() { |
|
131 |
getPreferenceTileCache().initializeDefaults(); |
|
132 |
} |
|
133 |
|
|
134 |
/* |
|
135 |
* (non-Javadoc) |
|
136 |
* @see com.iver.andami.preferences.AbstractPreferencePage#isResizeable() |
|
137 |
*/ |
|
138 |
public boolean isResizeable() { |
|
139 |
return true; |
|
140 |
} |
|
141 |
|
|
142 |
/* |
|
143 |
* (non-Javadoc) |
|
144 |
* @see com.iver.andami.preferences.IPreference#getID() |
|
145 |
*/ |
|
146 |
public String getID() { |
|
147 |
return id; |
|
148 |
} |
|
149 |
|
|
150 |
/* |
|
151 |
* (non-Javadoc) |
|
152 |
* @see com.iver.andami.preferences.IPreference#getIcon() |
|
153 |
*/ |
|
154 |
public ImageIcon getIcon() { |
|
155 |
return icon; |
|
156 |
} |
|
157 |
|
|
158 |
/* |
|
159 |
* (non-Javadoc) |
|
160 |
* @see com.iver.andami.preferences.IPreference#getPanel() |
|
161 |
*/ |
|
162 |
public JPanel getPanel() { |
|
163 |
return this; |
|
164 |
} |
|
165 |
|
|
166 |
/* |
|
167 |
* (non-Javadoc) |
|
168 |
* @see com.iver.andami.preferences.IPreference#getTitle() |
|
169 |
*/ |
|
170 |
public String getTitle() { |
|
171 |
return i18n.getTranslation("tilecache"); |
|
172 |
} |
|
173 |
|
|
174 |
/* |
|
175 |
* (non-Javadoc) |
|
176 |
* @see com.iver.andami.preferences.IPreference#isValueChanged() |
|
177 |
*/ |
|
178 |
public boolean isValueChanged() { |
|
179 |
return true; |
|
180 |
} |
|
181 |
|
|
182 |
public void setChangesApplied() {} |
|
183 |
} |
|
0 | 184 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/java/org/gvsig/raster/tilecache/app/TileCachePreferencesPanel.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.tilecache.app; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
import java.awt.Dimension; |
|
26 |
import java.awt.GridBagConstraints; |
|
27 |
import java.awt.GridBagLayout; |
|
28 |
import java.awt.Insets; |
|
29 |
import java.awt.event.ActionEvent; |
|
30 |
import java.awt.event.ActionListener; |
|
31 |
import java.io.File; |
|
32 |
import java.text.NumberFormat; |
|
33 |
|
|
34 |
import javax.swing.BorderFactory; |
|
35 |
import javax.swing.DefaultComboBoxModel; |
|
36 |
import javax.swing.JButton; |
|
37 |
import javax.swing.JComboBox; |
|
38 |
import javax.swing.JFormattedTextField; |
|
39 |
import javax.swing.JLabel; |
|
40 |
import javax.swing.JTextField; |
|
41 |
import javax.swing.SwingConstants; |
|
42 |
import javax.swing.text.DefaultFormatterFactory; |
|
43 |
import javax.swing.text.NumberFormatter; |
|
44 |
|
|
45 |
import org.gvsig.andami.PluginServices; |
|
46 |
import org.gvsig.andami.preferences.DlgPreferences; |
|
47 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
48 |
import org.gvsig.fmap.dal.coverage.RasterLibrary; |
|
49 |
import org.gvsig.i18n.Messages; |
|
50 |
import org.gvsig.raster.cache.tile.TileCacheLibrary; |
|
51 |
import org.gvsig.raster.util.BasePanel; |
|
52 |
/** |
|
53 |
* This class provides a panel for tile cache configuration |
|
54 |
* |
|
55 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
56 |
*/ |
|
57 |
public class TileCachePreferencesPanel extends BasePanel implements ActionListener { |
|
58 |
protected static final long serialVersionUID = 1L; |
|
59 |
private static int TILE_SIZE_WMS = 1024; |
|
60 |
private JLabel labelWarning = null; |
|
61 |
private JLabel labelCacheSize = null; |
|
62 |
private JLabel labelLevels = null; |
|
63 |
private JLabel labelStruct = null; |
|
64 |
private JLabel labelTileSize = null; |
|
65 |
private JLabel labelWMSTileSize = null; |
|
66 |
private JLabel labelPath = null; |
|
67 |
private JFormattedTextField textFieldCacheSize = null; |
|
68 |
private JFormattedTextField textFieldLevels = null; |
|
69 |
private JFormattedTextField textFieldTileSize = null; |
|
70 |
private JFormattedTextField textFieldWMSTileSize = null; |
|
71 |
private JTextField textFieldPath = null; |
|
72 |
private JComboBox comboBoxStruct = null; |
|
73 |
private JButton buttonRemove = null; |
|
74 |
|
|
75 |
/** |
|
76 |
*Inicializa componentes gr?ficos y traduce |
|
77 |
*/ |
|
78 |
public TileCachePreferencesPanel() { |
|
79 |
init(); |
|
80 |
translate(); |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* Define todas las traducciones de PreferenceCache |
|
85 |
*/ |
|
86 |
protected void translate() { |
|
87 |
setBorder(BorderFactory.createTitledBorder(getText(this, "tilecache"))); |
|
88 |
getLabelWarning().setText(getText(this, "preference_cache_warning")); |
|
89 |
getLabelCacheSize().setText(getText(this, "tamanyo_max_tilecache") + ":"); |
|
90 |
getLabelLevels().setText(getText(this, "res_levels") + ":"); |
|
91 |
getLabelTileSize().setText(getText(this, "tilesize") + ":"); |
|
92 |
getLabelWMSTileSize().setText("WMS/WCS " + getText(this, "tilesize") + ":"); |
|
93 |
getLabelStruct().setText(getText(this, "tilecache_struct") + ":"); |
|
94 |
getButtonRemove().setText(getText(this, "remove_cache")); |
|
95 |
getLabelPath().setText(getText(this, "path_tilecache")); |
|
96 |
} |
|
97 |
|
|
98 |
protected void init() { |
|
99 |
GridBagConstraints gridBagConstraints; |
|
100 |
|
|
101 |
setLayout(new GridBagLayout()); |
|
102 |
|
|
103 |
gridBagConstraints = new GridBagConstraints(); |
|
104 |
gridBagConstraints.gridwidth = 2; |
|
105 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
106 |
gridBagConstraints.weightx = 1.0; |
|
107 |
gridBagConstraints.insets = new Insets(5, 5, 2, 5); |
|
108 |
add(getLabelWarning(), gridBagConstraints); |
|
109 |
|
|
110 |
gridBagConstraints = new GridBagConstraints(); |
|
111 |
gridBagConstraints.gridx = 0; |
|
112 |
gridBagConstraints.gridy = 1; |
|
113 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
114 |
gridBagConstraints.insets = new Insets(2, 5, 2, 2); |
|
115 |
add(getLabelCacheSize(), gridBagConstraints); |
|
116 |
|
|
117 |
gridBagConstraints = new GridBagConstraints(); |
|
118 |
gridBagConstraints.gridx = 0; |
|
119 |
gridBagConstraints.gridy = 2; |
|
120 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
121 |
gridBagConstraints.insets = new Insets(2, 5, 2, 2); |
|
122 |
add(getLabelLevels(), gridBagConstraints); |
|
123 |
|
|
124 |
gridBagConstraints = new GridBagConstraints(); |
|
125 |
gridBagConstraints.gridx = 0; |
|
126 |
gridBagConstraints.gridy = 3; |
|
127 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
128 |
gridBagConstraints.insets = new Insets(2, 5, 2, 2); |
|
129 |
add(getLabelTileSize(), gridBagConstraints); |
|
130 |
|
|
131 |
gridBagConstraints = new GridBagConstraints(); |
|
132 |
gridBagConstraints.gridx = 0; |
|
133 |
gridBagConstraints.gridy = 4; |
|
134 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
135 |
gridBagConstraints.insets = new Insets(2, 5, 2, 2); |
|
136 |
add(getLabelWMSTileSize(), gridBagConstraints); |
|
137 |
|
|
138 |
gridBagConstraints = new GridBagConstraints(); |
|
139 |
gridBagConstraints.gridx = 0; |
|
140 |
gridBagConstraints.gridy = 5; |
|
141 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
142 |
gridBagConstraints.insets = new Insets(2, 5, 2, 2); |
|
143 |
add(getLabelStruct(), gridBagConstraints); |
|
144 |
|
|
145 |
gridBagConstraints = new GridBagConstraints(); |
|
146 |
gridBagConstraints.gridx = 0; |
|
147 |
gridBagConstraints.gridy = 6; |
|
148 |
gridBagConstraints.gridwidth = 2; |
|
149 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
150 |
gridBagConstraints.insets = new Insets(2, 5, 2, 2); |
|
151 |
add(getButtonRemove(), gridBagConstraints); |
|
152 |
|
|
153 |
gridBagConstraints = new GridBagConstraints(); |
|
154 |
gridBagConstraints.gridx = 0; |
|
155 |
gridBagConstraints.gridy = 7; |
|
156 |
gridBagConstraints.anchor = GridBagConstraints.EAST; |
|
157 |
gridBagConstraints.insets = new Insets(2, 5, 2, 2); |
|
158 |
add(getLabelPath(), gridBagConstraints); |
|
159 |
|
|
160 |
gridBagConstraints = new GridBagConstraints(); |
|
161 |
gridBagConstraints.gridx = 1; |
|
162 |
gridBagConstraints.gridy = 1; |
|
163 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
164 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
165 |
gridBagConstraints.insets = new Insets(2, 2, 2, 5); |
|
166 |
add(getTextFieldCacheSize(), gridBagConstraints); |
|
167 |
|
|
168 |
gridBagConstraints = new GridBagConstraints(); |
|
169 |
gridBagConstraints.gridx = 1; |
|
170 |
gridBagConstraints.gridy = 2; |
|
171 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
172 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
173 |
gridBagConstraints.insets = new Insets(2, 2, 2, 5); |
|
174 |
add(getTextFieldLevels(), gridBagConstraints); |
|
175 |
|
|
176 |
gridBagConstraints = new GridBagConstraints(); |
|
177 |
gridBagConstraints.gridx = 1; |
|
178 |
gridBagConstraints.gridy = 3; |
|
179 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
180 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
181 |
gridBagConstraints.insets = new Insets(2, 2, 2, 5); |
|
182 |
add(getTextFieldTileSize(), gridBagConstraints); |
|
183 |
|
|
184 |
gridBagConstraints = new GridBagConstraints(); |
|
185 |
gridBagConstraints.gridx = 1; |
|
186 |
gridBagConstraints.gridy = 4; |
|
187 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
188 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
189 |
gridBagConstraints.insets = new Insets(2, 2, 2, 5); |
|
190 |
add(getTextFieldWMSTileSize(), gridBagConstraints); |
|
191 |
|
|
192 |
gridBagConstraints = new GridBagConstraints(); |
|
193 |
gridBagConstraints.gridx = 1; |
|
194 |
gridBagConstraints.gridy = 5; |
|
195 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
196 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
197 |
gridBagConstraints.insets = new Insets(2, 2, 2, 5); |
|
198 |
add(getComboBoxStruct(), gridBagConstraints); |
|
199 |
|
|
200 |
gridBagConstraints = new GridBagConstraints(); |
|
201 |
gridBagConstraints.gridx = 1; |
|
202 |
gridBagConstraints.gridy = 7; |
|
203 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
204 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
205 |
gridBagConstraints.insets = new Insets(2, 2, 2, 5); |
|
206 |
add(getTextFieldPath(), gridBagConstraints); |
|
207 |
|
|
208 |
} |
|
209 |
|
|
210 |
private JLabel getLabelWarning() { |
|
211 |
if (labelWarning == null) { |
|
212 |
labelWarning = new JLabel(); |
|
213 |
labelWarning.setForeground(new Color(255, 0, 0)); |
|
214 |
labelWarning.setHorizontalAlignment(SwingConstants.CENTER); |
|
215 |
labelWarning.setPreferredSize(new Dimension(0, 32)); |
|
216 |
} |
|
217 |
return labelWarning; |
|
218 |
} |
|
219 |
|
|
220 |
private JButton getButtonRemove() { |
|
221 |
if(buttonRemove == null) { |
|
222 |
buttonRemove = new JButton(); |
|
223 |
buttonRemove.addActionListener(this); |
|
224 |
} |
|
225 |
return buttonRemove; |
|
226 |
} |
|
227 |
|
|
228 |
private JComboBox getComboBoxStruct() { |
|
229 |
if (comboBoxStruct == null) { |
|
230 |
comboBoxStruct = new JComboBox(); |
|
231 |
comboBoxStruct.setModel(new DefaultComboBoxModel(new String[] { "FLATX" })); |
|
232 |
} |
|
233 |
return comboBoxStruct; |
|
234 |
} |
|
235 |
|
|
236 |
private JTextField getTextFieldPath() { |
|
237 |
if (textFieldPath == null) { |
|
238 |
textFieldPath = new JTextField(); |
|
239 |
} |
|
240 |
return textFieldPath; |
|
241 |
} |
|
242 |
|
|
243 |
private JFormattedTextField getTextFieldCacheSize() { |
|
244 |
if (textFieldCacheSize == null) { |
|
245 |
NumberFormat integerFormat = NumberFormat.getNumberInstance(); |
|
246 |
integerFormat.setParseIntegerOnly(true); |
|
247 |
textFieldCacheSize = new JFormattedTextField(new DefaultFormatterFactory( |
|
248 |
new NumberFormatter(integerFormat), |
|
249 |
new NumberFormatter(integerFormat), |
|
250 |
new NumberFormatter(integerFormat))); |
|
251 |
} |
|
252 |
return textFieldCacheSize; |
|
253 |
} |
|
254 |
|
|
255 |
private JFormattedTextField getTextFieldTileSize() { |
|
256 |
if (textFieldTileSize == null) { |
|
257 |
NumberFormat integerFormat = NumberFormat.getNumberInstance(); |
|
258 |
integerFormat.setParseIntegerOnly(true); |
|
259 |
textFieldTileSize = new JFormattedTextField(new DefaultFormatterFactory( |
|
260 |
new NumberFormatter(integerFormat), |
|
261 |
new NumberFormatter(integerFormat), |
|
262 |
new NumberFormatter(integerFormat))); |
|
263 |
} |
|
264 |
return textFieldTileSize; |
|
265 |
} |
|
266 |
|
|
267 |
private JFormattedTextField getTextFieldWMSTileSize() { |
|
268 |
if (textFieldWMSTileSize == null) { |
|
269 |
NumberFormat integerFormat = NumberFormat.getNumberInstance(); |
|
270 |
integerFormat.setParseIntegerOnly(true); |
|
271 |
textFieldWMSTileSize = new JFormattedTextField(new DefaultFormatterFactory( |
|
272 |
new NumberFormatter(integerFormat), |
|
273 |
new NumberFormatter(integerFormat), |
|
274 |
new NumberFormatter(integerFormat))); |
|
275 |
} |
|
276 |
return textFieldWMSTileSize; |
|
277 |
} |
|
278 |
|
|
279 |
private JFormattedTextField getTextFieldLevels() { |
|
280 |
if (textFieldLevels == null) { |
|
281 |
NumberFormat integerFormat = NumberFormat.getNumberInstance(); |
|
282 |
integerFormat.setParseIntegerOnly(true); |
|
283 |
textFieldLevels = new JFormattedTextField(new DefaultFormatterFactory( |
|
284 |
new NumberFormatter(integerFormat), |
|
285 |
new NumberFormatter(integerFormat), |
|
286 |
new NumberFormatter(integerFormat))); |
|
287 |
} |
|
288 |
return textFieldLevels; |
|
289 |
} |
|
290 |
|
|
291 |
private JLabel getLabelPath() { |
|
292 |
if (labelPath == null) |
|
293 |
labelPath = new JLabel(); |
|
294 |
return labelPath; |
|
295 |
} |
|
296 |
|
|
297 |
private JLabel getLabelCacheSize() { |
|
298 |
if (labelCacheSize == null) |
|
299 |
labelCacheSize = new JLabel(); |
|
300 |
return labelCacheSize; |
|
301 |
} |
|
302 |
|
|
303 |
private JLabel getLabelLevels() { |
|
304 |
if (labelLevels == null) |
|
305 |
labelLevels = new JLabel(); |
|
306 |
return labelLevels; |
|
307 |
} |
|
308 |
|
|
309 |
private JLabel getLabelStruct() { |
|
310 |
if (labelStruct == null) |
|
311 |
labelStruct = new JLabel(); |
|
312 |
return labelStruct; |
|
313 |
} |
|
314 |
|
|
315 |
private JLabel getLabelTileSize() { |
|
316 |
if (labelTileSize == null) |
|
317 |
labelTileSize = new JLabel(); |
|
318 |
return labelTileSize; |
|
319 |
} |
|
320 |
|
|
321 |
private JLabel getLabelWMSTileSize() { |
|
322 |
if (labelWMSTileSize == null) |
|
323 |
labelWMSTileSize = new JLabel(); |
|
324 |
return labelWMSTileSize; |
|
325 |
} |
|
326 |
|
|
327 |
/** |
|
328 |
* Establece los valores por defecto de la Cache |
|
329 |
*/ |
|
330 |
public void initializeDefaults() { |
|
331 |
getTextFieldCacheSize().setValue(Configuration.getDefaultValue("tilecache_size")); |
|
332 |
getTextFieldTileSize().setValue(Configuration.getDefaultValue("tilesize")); |
|
333 |
getTextFieldWMSTileSize().setValue(Configuration.getDefaultValue("tilesizewms")); |
|
334 |
getTextFieldLevels().setValue(Configuration.getDefaultValue("tile_levels")); |
|
335 |
getTextFieldPath().setText(Configuration.getDefaultValue("path_tilecache").toString()); |
|
336 |
String struct = (String) Configuration.getDefaultValue("cache_struct"); |
|
337 |
if(struct != null) { |
|
338 |
for (int i = 0; i < getComboBoxStruct().getItemCount(); i++) |
|
339 |
if (getComboBoxStruct().getItemAt(i).toString().equals(struct.toString())) { |
|
340 |
getComboBoxStruct().setSelectedIndex(i); |
|
341 |
break; |
|
342 |
} |
|
343 |
} |
|
344 |
} |
|
345 |
|
|
346 |
/** |
|
347 |
* Establece los valores que ha definido el usuario de la Cache |
|
348 |
*/ |
|
349 |
public void initializeValues() { |
|
350 |
getTextFieldCacheSize().setValue(Configuration.getValue("tilecache_size", Integer.valueOf(TileCacheLibrary.MAX_CACHE_SIZE))); |
|
351 |
getTextFieldTileSize().setValue(Configuration.getValue("tilesize", Integer.valueOf(TileCacheLibrary.DEFAULT_TILEWIDTH))); |
|
352 |
getTextFieldWMSTileSize().setValue(Configuration.getValue("tilesizewms", TILE_SIZE_WMS)); |
|
353 |
getTextFieldLevels().setValue(Configuration.getValue("tile_levels", Integer.valueOf(TileCacheLibrary.DEFAULT_LEVELS))); |
|
354 |
getTextFieldPath().setText(Configuration.getValue("path_tilecache", RasterLibrary.pathTileCache)); |
|
355 |
String struct = Configuration.getValue("cache_struct", TileCacheLibrary.DEFAULT_STRUCTURE); |
|
356 |
if(struct != null) { |
|
357 |
for (int i = 0; i < getComboBoxStruct().getItemCount(); i++) |
|
358 |
if (getComboBoxStruct().getItemAt(i).toString().equals(struct.toString())) { |
|
359 |
getComboBoxStruct().setSelectedIndex(i); |
|
360 |
break; |
|
361 |
} |
|
362 |
} |
|
363 |
} |
|
364 |
|
|
365 |
/** |
|
366 |
* Guarda los valores de la cache establecidos por el usuario |
|
367 |
*/ |
|
368 |
public void storeValues() { |
|
369 |
Integer tilecachesize = null; |
|
370 |
try { |
|
371 |
String s = getTextFieldCacheSize().getText().replaceAll(",", ""); |
|
372 |
tilecachesize = new Integer(s); |
|
373 |
Configuration.setValue("tilecache_size", tilecachesize); |
|
374 |
} catch (NumberFormatException e) { |
|
375 |
|
|
376 |
} |
|
377 |
|
|
378 |
Integer tilesize = null; |
|
379 |
try { |
|
380 |
String s = getTextFieldTileSize().getText().replaceAll(",", ""); |
|
381 |
tilesize = new Integer(s); |
|
382 |
Configuration.setValue("tilesize", tilesize); |
|
383 |
} catch (NumberFormatException e) { |
|
384 |
|
|
385 |
} |
|
386 |
|
|
387 |
Integer tilesizewms = null; |
|
388 |
try { |
|
389 |
String s = getTextFieldWMSTileSize().getText().replaceAll(",", ""); |
|
390 |
tilesizewms = new Integer(s); |
|
391 |
Configuration.setValue("tilesizewms", tilesizewms); |
|
392 |
} catch (NumberFormatException e) { |
|
393 |
|
|
394 |
} |
|
395 |
|
|
396 |
Integer tilelevels = null; |
|
397 |
try { |
|
398 |
String s = getTextFieldLevels().getText().replaceAll(",", ""); |
|
399 |
tilelevels = new Integer(s); |
|
400 |
Configuration.setValue("tile_levels", tilelevels); |
|
401 |
} catch (NumberFormatException e) { |
|
402 |
|
|
403 |
} |
|
404 |
|
|
405 |
Configuration.setValue("cache_struct", getComboBoxStruct().getSelectedItem() != null ? getComboBoxStruct().getSelectedItem().toString() : TileCacheLibrary.DEFAULT_STRUCTURE); |
|
406 |
Configuration.setValue("path_tilecache", getTextFieldPath().getText()); |
|
407 |
} |
|
408 |
|
|
409 |
public void actionPerformed(ActionEvent e) { |
|
410 |
String path = getTextFieldPath().getText(); |
|
411 |
IWindow parent = PluginServices.getMDIManager().getActiveWindow(); |
|
412 |
IWindow[] wList = PluginServices.getMDIManager().getAllWindows(); |
|
413 |
for (int i = 0; i < wList.length; i++) { |
|
414 |
if(wList[i] instanceof DlgPreferences) |
|
415 |
parent = wList[i]; |
|
416 |
} |
|
417 |
|
|
418 |
if(CacheExtension.messageBoxYesOrNot(Messages.getText("remove_directory") + "<BR>" + path, parent)) { |
|
419 |
File f = new File(path); |
|
420 |
if(f.exists()) { |
|
421 |
if(!deleteDirectory(f)) { |
|
422 |
CacheExtension.messageBoxError("open_files", parent); |
|
423 |
} |
|
424 |
}else |
|
425 |
CacheExtension.messageBoxError("path_not_exists", parent); |
|
426 |
} |
|
427 |
} |
|
428 |
|
|
429 |
public boolean deleteDirectory(File directory) { |
|
430 |
File[] files = directory.listFiles(); |
|
431 |
for(int i = 0; i < files.length; i++) { |
|
432 |
if(files[i].isDirectory()) { |
|
433 |
this.deleteDirectory(files[i]); |
|
434 |
} else { |
|
435 |
files[i].delete(); |
|
436 |
} |
|
437 |
} |
|
438 |
return directory.delete(); |
|
439 |
} |
|
440 |
} |
|
0 | 441 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/java/org/gvsig/raster/tilecache/app/Configuration.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.tilecache.app; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
import java.util.HashMap; |
|
26 |
import java.util.Iterator; |
|
27 |
|
|
28 |
import org.gvsig.andami.PluginServices; |
|
29 |
import org.gvsig.raster.fmap.layers.IConfiguration; |
|
30 |
import org.gvsig.utils.XMLEntity; |
|
31 |
|
|
32 |
/** |
|
33 |
* La clase <code>Configuration</code> sirve para poder leer y escribir valores en el entorno |
|
34 |
* de raster a nivel de configuraci?n. Para leer o escribir hay que usar los |
|
35 |
* metodos getValue y setValue, estos metodos lanzan eventos en el caso de |
|
36 |
* cambiar el valor que habia establecido. Forma de uso:<p> |
|
37 |
* |
|
38 |
* En la lectura es recomendable pasar un valor por defecto en el get, para que |
|
39 |
* si no existe o si existe pero no corresponde el tipo de datos devolvera el |
|
40 |
* valor por defecto<p> |
|
41 |
* |
|
42 |
* <code>Boolean valor = Configuration.getValue("valorBooleano", Boolean.valueOf(true));</code><p> |
|
43 |
* |
|
44 |
* <code>Configuration.setValue("valorBooleano", Boolean.valueOf(false));</code><p> |
|
45 |
* |
|
46 |
* Solo se pueden usar los siguientes tipos de datos:<br> |
|
47 |
* - <b>Boolean</b>, <b>Double</b>, <b>Float</b>, <b>Integer</b>, <b>Long</b> |
|
48 |
* y <b>String</b>.<p> |
|
49 |
* |
|
50 |
* Otra funcionalidad que tiene, es que puedes agregar un manejador de eventos |
|
51 |
* para controlar los cambios de las variables y actuar en consecuencia si cambia |
|
52 |
* la que deseas. |
|
53 |
* |
|
54 |
* @version 07/12/2007 |
|
55 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
56 |
*/ |
|
57 |
public class Configuration implements IConfiguration { |
|
58 |
static private Configuration singleton = new Configuration(); |
|
59 |
private ArrayList<ConfigurationListener> |
|
60 |
actionCommandListeners = new ArrayList<ConfigurationListener>(); |
|
61 |
private XMLEntity xml = null; |
|
62 |
private HashMap<String, Object> |
|
63 |
hashMap = new HashMap<String, Object>(); |
|
64 |
|
|
65 |
/** |
|
66 |
* Constructor privado. Nos aseguramos de que nadie pueda crear una instancia |
|
67 |
* desde fuera, la configuraci?n es ?nica para todos. |
|
68 |
*/ |
|
69 |
private Configuration() { |
|
70 |
try { |
|
71 |
PluginServices ps = PluginServices.getPluginServices("org.gvsig.raster.tilecache.app"); |
|
72 |
xml = ps.getPersistentXML(); |
|
73 |
} catch (NullPointerException e) { |
|
74 |
//No est? inicializado Configuration |
|
75 |
xml = new XMLEntity(); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Devuelve un valor Boolean para el key especificado |
|
81 |
* @param key |
|
82 |
* @param defaultValue |
|
83 |
* @return |
|
84 |
*/ |
|
85 |
static public Boolean getValue(String key, Boolean defaultValue) { |
|
86 |
singleton.saveDefaultValue(key, defaultValue); |
|
87 |
try { |
|
88 |
return Boolean.valueOf(getXMLEntity().getStringProperty(key)); |
|
89 |
} catch (Exception e) { |
|
90 |
} |
|
91 |
try { |
|
92 |
getXMLEntity().putProperty(key, defaultValue.booleanValue()); |
|
93 |
} catch(NullPointerException e) { |
|
94 |
//No est? inicializada la configuraci?n. Devuelve el default |
|
95 |
} |
|
96 |
return defaultValue; |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Devuelve un valor Double para el key especificado |
|
101 |
* @param key |
|
102 |
* @param defaultValue |
|
103 |
* @return |
|
104 |
*/ |
|
105 |
static public Double getValue(String key, Double defaultValue) { |
|
106 |
singleton.saveDefaultValue(key, defaultValue); |
|
107 |
try { |
|
108 |
return Double.valueOf(getXMLEntity().getStringProperty(key)); |
|
109 |
} catch (Exception e) { |
|
110 |
} |
|
111 |
getXMLEntity().putProperty(key, defaultValue.doubleValue()); |
|
112 |
return defaultValue; |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* Devuelve un valor Float para el key especificado |
|
117 |
* @param key |
|
118 |
* @param defaultValue |
|
119 |
* @return |
|
120 |
*/ |
|
121 |
static public Float getValue(String key, Float defaultValue) { |
|
122 |
singleton.saveDefaultValue(key, defaultValue); |
|
123 |
try { |
|
124 |
return Float.valueOf(getXMLEntity().getStringProperty(key)); |
|
125 |
} catch (Exception e) { |
|
126 |
} |
|
127 |
getXMLEntity().putProperty(key, defaultValue.floatValue()); |
|
128 |
return defaultValue; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* Devuelve un valor Integer para el key especificado |
|
133 |
* @param key |
|
134 |
* @param defaultValue |
|
135 |
* @return |
|
136 |
*/ |
|
137 |
static public Integer getValue(String key, Integer defaultValue) { |
|
138 |
singleton.saveDefaultValue(key, defaultValue); |
|
139 |
try { |
|
140 |
return Integer.valueOf(getXMLEntity().getStringProperty(key)); |
|
141 |
} catch (Exception e) { |
|
142 |
} |
|
143 |
getXMLEntity().putProperty(key, defaultValue.intValue()); |
|
144 |
return defaultValue; |
|
145 |
} |
|
146 |
|
|
147 |
/** |
|
148 |
* Devuelve un valor Long para el key especificado |
|
149 |
* @param key |
|
150 |
* @param defaultValue |
|
151 |
* @return |
|
152 |
*/ |
|
153 |
static public Long getValue(String key, Long defaultValue) { |
|
154 |
singleton.saveDefaultValue(key, defaultValue); |
|
155 |
try { |
|
156 |
return Long.valueOf(getXMLEntity().getStringProperty(key)); |
|
157 |
} catch (Exception e) { |
|
158 |
} |
|
159 |
getXMLEntity().putProperty(key, defaultValue.longValue()); |
|
160 |
return defaultValue; |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* Devuelve un valor String para el key especificado |
|
165 |
* @param key |
|
166 |
* @param defaultValue |
|
167 |
* @return |
|
168 |
*/ |
|
169 |
static public String getValue(String key, String defaultValue) { |
|
170 |
singleton.saveDefaultValue(key, defaultValue); |
|
171 |
try { |
|
172 |
return getXMLEntity().getStringProperty(key); |
|
173 |
} catch (Exception e) { |
|
174 |
} |
|
175 |
getXMLEntity().putProperty(key, defaultValue); |
|
176 |
return defaultValue; |
|
177 |
} |
|
178 |
|
|
179 |
/** |
|
180 |
* Guarda el valor por defecto en caso de que no exista |
|
181 |
* @param key |
|
182 |
* @param defaultValue |
|
183 |
*/ |
|
184 |
private void saveDefaultValue(String key, Object defaultValue) { |
|
185 |
if (hashMap.get(key) == null) |
|
186 |
hashMap.put(key, defaultValue); |
|
187 |
} |
|
188 |
|
|
189 |
/** |
|
190 |
* Devuelve el valor por defecto de un key |
|
191 |
* @param key |
|
192 |
* @return |
|
193 |
*/ |
|
194 |
static public Object getDefaultValue(String key) { |
|
195 |
return singleton.hashMap.get(key); |
|
196 |
} |
|
197 |
|
|
198 |
/** |
|
199 |
* Guarda en la configuracion el Objeto pasado por parametro asociado a dicho |
|
200 |
* key |
|
201 |
* @param key |
|
202 |
* @param value |
|
203 |
*/ |
|
204 |
private void putProperty(String key, Object value) { |
|
205 |
if (Integer.class.isInstance(value)) { |
|
206 |
getXMLEntity().putProperty(key, ((Integer) value).intValue()); |
|
207 |
return; |
|
208 |
} |
|
209 |
if (Double.class.isInstance(value)) { |
|
210 |
getXMLEntity().putProperty(key, ((Double) value).doubleValue()); |
|
211 |
return; |
|
212 |
} |
|
213 |
if (Float.class.isInstance(value)) { |
|
214 |
getXMLEntity().putProperty(key, ((Float) value).floatValue()); |
|
215 |
return; |
|
216 |
} |
|
217 |
if (Boolean.class.isInstance(value)) { |
|
218 |
getXMLEntity().putProperty(key, ((Boolean) value).booleanValue()); |
|
219 |
return; |
|
220 |
} |
|
221 |
if (Long.class.isInstance(value)) { |
|
222 |
getXMLEntity().putProperty(key, ((Long) value).longValue()); |
|
223 |
return; |
|
224 |
} |
|
225 |
if (String.class.isInstance(value)) { |
|
226 |
getXMLEntity().putProperty(key, (String) value); |
|
227 |
return; |
|
228 |
} |
|
229 |
getXMLEntity().putProperty(key, value); |
|
230 |
} |
|
231 |
|
|
232 |
/** |
|
233 |
* Establece un valor en la configuracion |
|
234 |
* @param uri |
|
235 |
* @param value |
|
236 |
*/ |
|
237 |
static public void setValue(String key, Object value) { |
|
238 |
if (value == null) { |
|
239 |
getXMLEntity().remove(key); |
|
240 |
singleton.callConfigurationChanged(key, value); |
|
241 |
return; |
|
242 |
} |
|
243 |
|
|
244 |
String oldValue = getValue(key, value.toString()); |
|
245 |
|
|
246 |
singleton.putProperty(key, value); |
|
247 |
|
|
248 |
if (!oldValue.equals(value.toString())) |
|
249 |
singleton.callConfigurationChanged(key, value); |
|
250 |
} |
|
251 |
|
|
252 |
/** |
|
253 |
* A?adir un listener a la lista de eventos |
|
254 |
* @param listener |
|
255 |
*/ |
|
256 |
static public void addValueChangedListener(ConfigurationListener listener) { |
|
257 |
if (!singleton.actionCommandListeners.contains(listener)) |
|
258 |
singleton.actionCommandListeners.add(listener); |
|
259 |
} |
|
260 |
|
|
261 |
/** |
|
262 |
* Borrar un listener de la lista de eventos |
|
263 |
* @param listener |
|
264 |
*/ |
|
265 |
static public void removeValueChangedListener(ConfigurationListener listener) { |
|
266 |
singleton.actionCommandListeners.remove(listener); |
|
267 |
} |
|
268 |
|
|
269 |
/** |
|
270 |
* Invocar a los eventos asociados al componente |
|
271 |
*/ |
|
272 |
private void callConfigurationChanged(String key, Object value) { |
|
273 |
Iterator<ConfigurationListener> iterator = actionCommandListeners.iterator(); |
|
274 |
while (iterator.hasNext()) { |
|
275 |
ConfigurationListener listener = iterator.next(); |
|
276 |
listener.actionConfigurationChanged(new ConfigurationEvent(this, key, value)); |
|
277 |
} |
|
278 |
} |
|
279 |
|
|
280 |
/** |
|
281 |
* Devuelve una instancia unica al XMLEntity de Configuration |
|
282 |
* @return |
|
283 |
*/ |
|
284 |
static private XMLEntity getXMLEntity() { |
|
285 |
return singleton.xml; |
|
286 |
} |
|
287 |
|
|
288 |
/** |
|
289 |
* Devuelve una instancia al unico objeto de configuraci?n que puede existir. |
|
290 |
* @return |
|
291 |
*/ |
|
292 |
static public Configuration getSingleton() { |
|
293 |
return singleton; |
|
294 |
} |
|
295 |
|
|
296 |
/* |
|
297 |
* (non-Javadoc) |
|
298 |
* @see org.gvsig.fmap.raster.conf.IConfiguration#getValueBoolean(java.lang.String, java.lang.Boolean) |
|
299 |
*/ |
|
300 |
public Boolean getValueBoolean(String name, Boolean defaultValue) { |
|
301 |
return Configuration.getValue(name, defaultValue); |
|
302 |
} |
|
303 |
|
|
304 |
/* |
|
305 |
* (non-Javadoc) |
|
306 |
* @see org.gvsig.fmap.raster.conf.IConfiguration#getValueString(java.lang.String, java.lang.String) |
|
307 |
*/ |
|
308 |
public String getValueString(String name, String defaultValue) { |
|
309 |
return Configuration.getValue(name, defaultValue); |
|
310 |
} |
|
311 |
|
|
312 |
/* |
|
313 |
* (non-Javadoc) |
|
314 |
* @see org.gvsig.fmap.raster.conf.IConfiguration#getValueDouble(java.lang.String, java.lang.Double) |
|
315 |
*/ |
|
316 |
public Double getValueDouble(String name, Double defaultValue) { |
|
317 |
return Configuration.getValue(name, defaultValue); |
|
318 |
} |
|
319 |
|
|
320 |
/* |
|
321 |
* (non-Javadoc) |
|
322 |
* @see org.gvsig.fmap.raster.conf.IConfiguration#getValueFloat(java.lang.String, java.lang.Float) |
|
323 |
*/ |
|
324 |
public Float getValueFloat(String name, Float defaultValue) { |
|
325 |
return Configuration.getValue(name, defaultValue); |
|
326 |
} |
|
327 |
|
|
328 |
/* |
|
329 |
* (non-Javadoc) |
|
330 |
* @see org.gvsig.fmap.raster.conf.IConfiguration#getValueInteger(java.lang.String, java.lang.Integer) |
|
331 |
*/ |
|
332 |
public Integer getValueInteger(String name, Integer defaultValue) { |
|
333 |
return Configuration.getValue(name, defaultValue); |
|
334 |
} |
|
335 |
|
|
336 |
/* |
|
337 |
* (non-Javadoc) |
|
338 |
* @see org.gvsig.fmap.raster.conf.IConfiguration#getValueLong(java.lang.String, java.lang.Long) |
|
339 |
*/ |
|
340 |
public Long getValueLong(String name, Long defaultValue) { |
|
341 |
return Configuration.getValue(name, defaultValue); |
|
342 |
} |
|
343 |
} |
|
0 | 344 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.28/org.gvsig.raster.tilecache.app/src/main/java/org/gvsig/raster/tilecache/app/ConfigurationEvent.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.tilecache.app; |
|
23 |
|
|
24 |
import java.util.EventObject; |
|
25 |
/** |
|
26 |
* Estado del evento de configuraci?n para las preferencias de Raster. |
|
27 |
* |
|
28 |
* @version 26/02/2008 |
|
29 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
30 |
*/ |
|
31 |
public class ConfigurationEvent extends EventObject { |
|
32 |
private static final long serialVersionUID = 7016236098872059L; |
|
33 |
private String key; |
|
34 |
private Object value; |
|
35 |
|
Also available in: Unified diff