Revision 850
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<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"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.projection.jcrs</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<version>2.1.89</version> |
|
8 |
<name>${project.artifactId}</name> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.desktop</artifactId> |
|
12 |
<version>2.0.218</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<description> |
|
16 |
This project contains the support for CRS based in JCRS, proj4+Geotools, for gvSIG |
|
17 |
</description> |
|
18 |
|
|
19 |
<scm> |
|
20 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-jcrs/org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89</connection> |
|
21 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-jcrs/org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89</developerConnection> |
|
22 |
<url>scm:svn:https://devel.gvsig.org/svn/gvsig-jcrs/org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89</url> |
|
23 |
</scm> |
|
24 |
|
|
25 |
<repositories> |
|
26 |
<repository> |
|
27 |
<id>gvsig-public-http-repository</id> |
|
28 |
<name>gvSIG maven public HTTP repository</name> |
|
29 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
30 |
<releases> |
|
31 |
<enabled>true</enabled> |
|
32 |
<updatePolicy>daily</updatePolicy> |
|
33 |
<checksumPolicy>warn</checksumPolicy> |
|
34 |
</releases> |
|
35 |
<snapshots> |
|
36 |
<enabled>true</enabled> |
|
37 |
<updatePolicy>daily</updatePolicy> |
|
38 |
<checksumPolicy>warn</checksumPolicy> |
|
39 |
</snapshots> |
|
40 |
</repository> |
|
41 |
<repository> |
|
42 |
<id>osgeo</id> |
|
43 |
<name>Open Source Geospatial Foundation</name> |
|
44 |
<url>http://download.osgeo.org/webdav/geotools</url> |
|
45 |
<releases> |
|
46 |
<enabled>true</enabled> |
|
47 |
<updatePolicy>never</updatePolicy> |
|
48 |
<checksumPolicy>warn</checksumPolicy> |
|
49 |
</releases> |
|
50 |
<snapshots> |
|
51 |
<enabled>false</enabled> |
|
52 |
</snapshots> |
|
53 |
</repository> |
|
54 |
</repositories> |
|
55 |
|
|
56 |
<distributionManagement> |
|
57 |
<site> |
|
58 |
<id>gvsig-repository</id> |
|
59 |
<url>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</url> |
|
60 |
</site> |
|
61 |
</distributionManagement> |
|
62 |
|
|
63 |
<properties> |
|
64 |
<!-- El plugin versions:use-latest-versions falla con scope import --> |
|
65 |
<!-- asi que toca usar el versions:update-properties que si que funciona --> |
|
66 |
<org.gvsig.gdal.version>1.0.53</org.gvsig.gdal.version> |
|
67 |
<!-- General configuration --> |
|
68 |
<site-repository>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</site-repository> |
|
69 |
|
|
70 |
<!-- The property svn.tags.folder is used in external projects to override --> |
|
71 |
<!-- configuraction in maven-release-plugin --> |
|
72 |
<svn.tags.folder>https://devel.gvsig.org/svn/gvsig-jcrs/org.gvsig.projection.jcrs/tags/</svn.tags.folder> |
|
73 |
|
|
74 |
</properties> |
|
75 |
|
|
76 |
<dependencyManagement> |
|
77 |
<dependencies> |
|
78 |
|
|
79 |
<dependency> |
|
80 |
<groupId>org.gvsig</groupId> |
|
81 |
<artifactId>org.gvsig.gdal</artifactId> |
|
82 |
<version>${org.gvsig.gdal.version}</version> |
|
83 |
<type>pom</type> |
|
84 |
<scope>import</scope> |
|
85 |
</dependency> |
|
86 |
|
|
87 |
<dependency> |
|
88 |
<groupId>org.gvsig</groupId> |
|
89 |
<artifactId>org.gvsig.projection.jcrs.lib</artifactId> |
|
90 |
<version>2.1.89</version> |
|
91 |
</dependency> |
|
92 |
<dependency> |
|
93 |
<groupId>org.gvsig</groupId> |
|
94 |
<artifactId>org.gvsig.projection.app.jcrs</artifactId> |
|
95 |
<version>2.1.89</version> |
|
96 |
</dependency> |
|
97 |
<dependency> |
|
98 |
<groupId>org.gvsig</groupId> |
|
99 |
<artifactId>org.gvsig.projection.app.jcrs.common</artifactId> |
|
100 |
<version>2.1.89</version> |
|
101 |
</dependency> |
|
102 |
<dependency> |
|
103 |
<groupId>org.gvsig</groupId> |
|
104 |
<artifactId>org.gvsig.projection.app.jcrs.common</artifactId> |
|
105 |
<version>2.1.89</version> |
|
106 |
<type>zip</type> |
|
107 |
</dependency> |
|
108 |
<dependency> |
|
109 |
<groupId>org.gvsig</groupId> |
|
110 |
<artifactId>org.gvsig.projection.app.jcrs.lin.x86</artifactId> |
|
111 |
<version>2.1.26-SNAPSHOT</version> |
|
112 |
</dependency> |
|
113 |
<dependency> |
|
114 |
<groupId>org.gvsig</groupId> |
|
115 |
<artifactId>org.gvsig.projection.app.jcrs.win.x86</artifactId> |
|
116 |
<version>2.1.26-SNAPSHOT</version> |
|
117 |
</dependency> |
|
118 |
|
|
119 |
<!-- Non gvSIG projects --> |
|
120 |
<dependency> |
|
121 |
<groupId>org.opengis</groupId> |
|
122 |
<artifactId>geoapi</artifactId> |
|
123 |
<version>2.0</version> |
|
124 |
</dependency> |
|
125 |
<dependency> |
|
126 |
<groupId>hsqldb</groupId> |
|
127 |
<artifactId>hsqldb</artifactId> |
|
128 |
<version>1.8.0.10</version> |
|
129 |
</dependency> |
|
130 |
<dependency> |
|
131 |
<groupId>org.geotools</groupId> |
|
132 |
<artifactId>gt2-main</artifactId> |
|
133 |
<!-- Override the org.gvsig.desktop value --> |
|
134 |
<version>unknown</version> |
|
135 |
</dependency> |
|
136 |
<dependency> |
|
137 |
<groupId>org.geotools</groupId> |
|
138 |
<artifactId>gt2-legacy</artifactId> |
|
139 |
<!-- Override the org.gvsig.desktop value --> |
|
140 |
<version>unknown</version> |
|
141 |
</dependency> |
|
142 |
|
|
143 |
</dependencies> |
|
144 |
</dependencyManagement> |
|
145 |
|
|
146 |
<modules> |
|
147 |
<module>org.gvsig.projection.jcrs.lib</module> |
|
148 |
<module>org.gvsig.projection.app.jcrs</module> |
|
149 |
</modules> |
|
150 |
|
|
151 |
</project> |
|
152 |
|
|
153 |
|
|
154 |
|
|
0 | 155 |
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<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"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.projection.app.jcrs.common</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<description> |
|
8 |
CRS management: |
|
9 |
- Set the reference system (CRS) by default, in views, in layers (CRS on the fly). |
|
10 |
- Selection from recent CRS, from EPSG, ESRI, IAU2000 data bases and user's defined CRS. |
|
11 |
- Create, edit and delete new CRS defined by the user (from an existing CRS, from a wkt string, or from scratch). |
|
12 |
- Consult CRS information (datum, projection, proj4 string...) |
|
13 |
- Convertion of coordinates (no datum changing) |
|
14 |
- Transformation of coordinates (datum changing) from EPSG, manual, recent, compound and grid (.gsb extension) |
|
15 |
</description> |
|
16 |
|
|
17 |
<parent> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>org.gvsig.projection.app.jcrs</artifactId> |
|
20 |
<version>2.1.89</version> |
|
21 |
</parent> |
|
22 |
|
|
23 |
<properties> |
|
24 |
<gvsig.package.info.name>CRS: CRS management (Proj4/Geotools based, Native)</gvsig.package.info.name> |
|
25 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
26 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
27 |
<gvsig.package.info.operatingSystem>all</gvsig.package.info.operatingSystem> |
|
28 |
<gvsig.package.info.architecture>all</gvsig.package.info.architecture> |
|
29 |
<gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0-A</gvsig.package.info.dependencies> |
|
30 |
<gvsig.package.info.categories /> |
|
31 |
<gvsig.package.info.poolURL>http://devel.gvsig.org/download/projects/gvsig-jcrs/pool</gvsig.package.info.poolURL> |
|
32 |
<gvsig.install.plugin>false</gvsig.install.plugin> |
|
33 |
<gvsig.install.plugin.package>false</gvsig.install.plugin.package> |
|
34 |
</properties> |
|
35 |
|
|
36 |
<dependencies> |
|
37 |
|
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.andami</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.ui</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
<dependency> |
|
54 |
<groupId>net.sf</groupId> |
|
55 |
<artifactId>jgridshiftapi</artifactId> |
|
56 |
<scope>compile</scope> |
|
57 |
</dependency> |
|
58 |
<dependency> |
|
59 |
<groupId>org.gvsig</groupId> |
|
60 |
<artifactId>org.gvsig.projection.cresques.ui</artifactId> |
|
61 |
<scope>compile</scope> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>org.gvsig</groupId> |
|
65 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
66 |
<scope>compile</scope> |
|
67 |
</dependency> |
|
68 |
<dependency> |
|
69 |
<groupId>org.gvsig</groupId> |
|
70 |
<artifactId>org.gvsig.projection.jcrs.lib</artifactId> |
|
71 |
<scope>compile</scope> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>javax.units</groupId> |
|
75 |
<artifactId>jsr108</artifactId> |
|
76 |
<scope>compile</scope> |
|
77 |
</dependency> |
|
78 |
|
|
79 |
|
|
80 |
<dependency> |
|
81 |
<groupId>org.geotools</groupId> |
|
82 |
<artifactId>gt2-main</artifactId> |
|
83 |
<!-- Don't remove version from here, this override version --> |
|
84 |
<!-- in org.gvsig.desktop --> |
|
85 |
<version>unknown</version> |
|
86 |
<scope>compile</scope> |
|
87 |
</dependency> |
|
88 |
|
|
89 |
<dependency> |
|
90 |
<groupId>org.opengis</groupId> |
|
91 |
<artifactId>geoapi</artifactId> |
|
92 |
<scope>compile</scope> |
|
93 |
</dependency> |
|
94 |
<dependency> |
|
95 |
<groupId>hsqldb</groupId> |
|
96 |
<artifactId>hsqldb</artifactId> |
|
97 |
<scope>compile</scope> |
|
98 |
</dependency> |
|
99 |
|
|
100 |
<!-- Runtime dependencies --> |
|
101 |
<!-- Need to include in the assembly --> |
|
102 |
<dependency> |
|
103 |
<groupId>org.gvsig</groupId> |
|
104 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
105 |
<scope>runtime</scope> |
|
106 |
</dependency> |
|
107 |
<!-- |
|
108 |
<dependency> |
|
109 |
<groupId>org.gvsig</groupId> |
|
110 |
<artifactId>gt2-epsg-esri</artifactId> |
|
111 |
<scope>runtime</scope> |
|
112 |
</dependency> |
|
113 |
<dependency> |
|
114 |
<groupId>org.gvsig</groupId> |
|
115 |
<artifactId>gt2-epsg-hsql</artifactId> |
|
116 |
<scope>runtime</scope> |
|
117 |
</dependency> |
|
118 |
<dependency> |
|
119 |
<groupId>org.gvsig</groupId> |
|
120 |
<artifactId>gt2-epsg-iau2000</artifactId> |
|
121 |
<scope>runtime</scope> |
|
122 |
</dependency> |
|
123 |
<dependency> |
|
124 |
<groupId>org.gvsig</groupId> |
|
125 |
<artifactId>gt2-epsg-usr</artifactId> |
|
126 |
<scope>runtime</scope> |
|
127 |
</dependency> |
|
128 |
--> |
|
129 |
<dependency> |
|
130 |
<groupId>java3d</groupId> |
|
131 |
<artifactId>vecmath</artifactId> |
|
132 |
<scope>runtime</scope> |
|
133 |
</dependency> |
|
134 |
|
|
135 |
<!-- <dependency> --> |
|
136 |
<!-- <groupId>org.gdal</groupId> --> |
|
137 |
<!-- <artifactId>gdal</artifactId> --> |
|
138 |
<!-- </dependency> --> |
|
139 |
|
|
140 |
</dependencies> |
|
141 |
|
|
142 |
<build> |
|
143 |
<plugins> |
|
144 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
145 |
<plugin> |
|
146 |
<groupId>org.apache.maven.plugins</groupId> |
|
147 |
<artifactId>maven-surefire-plugin</artifactId> |
|
148 |
<configuration> |
|
149 |
<skipTests>true</skipTests> |
|
150 |
</configuration> |
|
151 |
</plugin> |
|
152 |
</plugins> |
|
153 |
</build> |
|
154 |
|
|
155 |
</project> |
|
156 |
|
|
0 | 157 |
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/buildNumber.properties | ||
---|---|---|
1 |
#Wed May 16 19:43:07 CEST 2018 |
|
2 |
buildNumber=2149 |
|
0 | 3 |
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<!-- |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
|
|
25 |
--> |
|
26 |
<assembly> |
|
27 |
<id>gvsig-plugin-package</id> |
|
28 |
<formats> |
|
29 |
<format>zip</format> |
|
30 |
</formats> |
|
31 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
32 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
33 |
<files> |
|
34 |
<file> |
|
35 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
36 |
<outputDirectory>lib</outputDirectory> |
|
37 |
</file> |
|
38 |
<file> |
|
39 |
<source>target/package.info</source> |
|
40 |
</file> |
|
41 |
</files> |
|
42 |
|
|
43 |
<fileSets> |
|
44 |
<fileSet> |
|
45 |
<directory>src/main/resources-plugin</directory> |
|
46 |
<outputDirectory>.</outputDirectory> |
|
47 |
</fileSet> |
|
48 |
</fileSets> |
|
49 |
|
|
50 |
|
|
51 |
<dependencySets> |
|
52 |
<dependencySet> |
|
53 |
<useProjectArtifact>false</useProjectArtifact> |
|
54 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
55 |
<outputDirectory>lib</outputDirectory> |
|
56 |
<includes> |
|
57 |
<include>org.gvsig:org.gvsig.projection.jcrs.lib</include> |
|
58 |
<include>net.sf:jgridshiftapi</include> |
|
59 |
<include>org.geotools:gt2-main:jar:unknown</include> |
|
60 |
<include>hsqldb:hsqldb</include> |
|
61 |
<include>javax.units:jsr108</include> |
|
62 |
<include>java3d:vecmath</include> |
|
63 |
<include>org.opengis:geoapi</include> |
|
64 |
<!-- <include>org.gdal:gdal</include> --> |
|
65 |
<include>org.gvsig:org.gvsig.projection.api</include> |
|
66 |
<include>org.gvsig:org.gvsig.projection.cresques.ui</include> |
|
67 |
<include>org.gvsig:org.gvsig.projection.cresques.impl</include> |
|
68 |
</includes> |
|
69 |
</dependencySet> |
|
70 |
</dependencySets> |
|
71 |
|
|
72 |
</assembly> |
|
73 |
|
|
74 |
|
|
75 |
|
|
0 | 76 |
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/JCRSPluginLibrary.java | ||
---|---|---|
1 |
package org.gvsig.crs; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
import java.util.ArrayList; |
|
6 |
import java.util.List; |
|
7 |
|
|
8 |
import org.apache.commons.io.FileUtils; |
|
9 |
import org.apache.commons.lang3.ArrayUtils; |
|
10 |
import org.apache.commons.lang3.BooleanUtils; |
|
11 |
import org.apache.commons.lang3.StringUtils; |
|
12 |
import org.cresques.ProjectionLibrary; |
|
13 |
|
|
14 |
import org.gvsig.andami.PluginServices; |
|
15 |
import org.gvsig.andami.PluginsLocator; |
|
16 |
import org.gvsig.andami.PluginsManager; |
|
17 |
import org.gvsig.crs.installer.EPSGDatabaseInstallerFactory; |
|
18 |
import org.gvsig.crs.persistence.CompTrData; |
|
19 |
import org.gvsig.crs.persistence.CrsData; |
|
20 |
import org.gvsig.crs.persistence.TrData; |
|
21 |
import org.gvsig.tools.dynobject.DynObject; |
|
22 |
import org.gvsig.tools.library.AbstractLibrary; |
|
23 |
import org.gvsig.tools.library.LibraryException; |
|
24 |
|
|
25 |
import org.slf4j.Logger; |
|
26 |
import org.slf4j.LoggerFactory; |
|
27 |
|
|
28 |
public class JCRSPluginLibrary extends AbstractLibrary { |
|
29 |
|
|
30 |
private String epsg_version = null; |
|
31 |
private final static Logger logger = LoggerFactory.getLogger(JCrsExtension.class); |
|
32 |
|
|
33 |
@Override |
|
34 |
public void doRegistration() { |
|
35 |
// Hack to assign database folder to the jCRS library. |
|
36 |
registerAsServiceOf(ProjectionLibrary.class); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
protected void doInitialize() throws LibraryException { |
|
41 |
CrsData.registerPersistence(); |
|
42 |
TrData.registerPersistence(); |
|
43 |
CompTrData.registerPersistence(); |
|
44 |
|
|
45 |
PluginServices plugin = PluginsLocator.getManager().getPlugin(JCrsExtension.class); |
|
46 |
DynObject properties = plugin.getPluginProperties(); |
|
47 |
|
|
48 |
initalizeHomeDB(plugin); |
|
49 |
|
|
50 |
CrsFactory.setDataBaseFolder(new File(plugin.getPluginHomeFolder(), "db")); |
|
51 |
CrsFactory.setProjLibFolder(new File(plugin.getPluginHomeFolder(), "projlib")); |
|
52 |
CrsFactory.setEnableMemoryCacheOfCRS( |
|
53 |
BooleanUtils.isTrue((Boolean) properties.getDynValue("useMemoryCacheForCRSs")) |
|
54 |
); |
|
55 |
CrsFactory.setEpsgDatabaseFile(this.getDefaultEPSGDatabaseFile(plugin, properties)); |
|
56 |
|
|
57 |
Integer databaseInitializationMode = (Integer) properties.getDynValue("databaseInitializationMode"); |
|
58 |
switch(databaseInitializationMode==null? 0:databaseInitializationMode) { |
|
59 |
case 0: // On start in background |
|
60 |
CrsFactory.initializeDatabaseInbackground(); |
|
61 |
break; |
|
62 |
case 1: // On start in foreground |
|
63 |
CrsFactory.initializeDatabase(); |
|
64 |
break; |
|
65 |
case 2: // On first use |
|
66 |
break; |
|
67 |
|
|
68 |
} |
|
69 |
|
|
70 |
loadCustomCRSIdentificationFile(plugin); |
|
71 |
|
|
72 |
EPSGDatabaseInstallerFactory.registerEPSGDatabaseInstaller(); |
|
73 |
} |
|
74 |
|
|
75 |
private void loadCustomCRSIdentificationFile(PluginServices plugin) { |
|
76 |
File customCRSIdentificationFile = new File(plugin.getPluginHomeFolder(), "customCRSIdentify.txt"); |
|
77 |
try { |
|
78 |
int linenumber = 0; |
|
79 |
List<String> lines = FileUtils.readLines(customCRSIdentificationFile); |
|
80 |
for (String line : lines) { |
|
81 |
try { |
|
82 |
line = line.trim(); |
|
83 |
if (line.startsWith("#")) { |
|
84 |
continue; |
|
85 |
} |
|
86 |
int n = line.indexOf(" "); |
|
87 |
if (n < 0) { |
|
88 |
continue; |
|
89 |
} |
|
90 |
String code_s = line.substring(0, n).trim(); |
|
91 |
String expression = line.substring(n + 1).trim(); |
|
92 |
if (StringUtils.isEmpty(expression) || StringUtils.isEmpty(code_s)) { |
|
93 |
continue; |
|
94 |
} |
|
95 |
int code = Integer.parseInt(code_s); |
|
96 |
CrsFactory.addCustomCRSIdentifyExpression(expression, code); |
|
97 |
} catch (Exception ex) { |
|
98 |
logger.warn("Can't process line "+linenumber+" from file "+customCRSIdentificationFile.getAbsolutePath()+".",ex); |
|
99 |
} |
|
100 |
linenumber++; |
|
101 |
} |
|
102 |
} catch (Exception ex) { |
|
103 |
logger.warn("Can't process file "+customCRSIdentificationFile.getAbsolutePath()+".", ex); |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
private File getDefaultEPSGDatabaseFile(PluginServices plugin, DynObject pluginProperties) { |
|
108 |
String fname = null; |
|
109 |
File dbfolder = null; |
|
110 |
try { |
|
111 |
dbfolder = new File(plugin.getPluginHomeFolder(), "db"); |
|
112 |
File f2; |
|
113 |
fname = (String) pluginProperties.getDynValue("epsgDatabase"); |
|
114 |
if (fname != null) { |
|
115 |
f2 = new File(dbfolder, fname); |
|
116 |
if (f2.exists()) { |
|
117 |
return new File(fname); |
|
118 |
} |
|
119 |
} |
|
120 |
File folder = new File(dbfolder, "EPSG"); |
|
121 |
List<File> subfolders = new ArrayList(FileUtils.listFiles( |
|
122 |
folder, |
|
123 |
new String[]{"sql"}, |
|
124 |
true |
|
125 |
)); |
|
126 |
if (subfolders.size() > 0) { |
|
127 |
// Asumimos que el primer script de SQL que encuentre es una |
|
128 |
// de las BBDD a utilizar. |
|
129 |
f2 = subfolders.get(0); |
|
130 |
return f2; |
|
131 |
} |
|
132 |
logger.warn("Can't locate a EPSG database in folder '" + dbfolder + "' use '" + fname + "'."); |
|
133 |
} catch (Exception ex) { |
|
134 |
logger.warn("Can't locate a EPSG database in folder '" + dbfolder + "' use '" + fname + "'.", ex); |
|
135 |
} |
|
136 |
fname = "EPSG" + File.separator + getEmbeddedEPSGVersion() + File.separator + "EPSG.sql"; |
|
137 |
return new File(fname); |
|
138 |
} |
|
139 |
|
|
140 |
private void initalizeHomeDB(PluginServices plugin) { |
|
141 |
|
|
142 |
File sourceDBFolder = new File(plugin.getPluginDirectory(), "db"); |
|
143 |
File sourceProjLibFolder = new File(plugin.getPluginDirectory(), "projlib"); |
|
144 |
File sourceEPSGFolder = new File(sourceDBFolder, "EPSG"); |
|
145 |
File sourceCustomCRSIdentify = new File(plugin.getPluginDirectory(), "customCRSIdentify.txt"); |
|
146 |
|
|
147 |
File targetDBFolder = new File(plugin.getPluginHomeFolder(), "db"); |
|
148 |
File targetProjLibFolder = new File(plugin.getPluginHomeFolder(), "projlib"); |
|
149 |
File targetEPSGFolder = new File(targetDBFolder, "EPSG"); |
|
150 |
File targetCustomCRSIdentify = new File(plugin.getPluginHomeFolder(), "customCRSIdentify.txt"); |
|
151 |
|
|
152 |
if (!targetDBFolder.exists()) { |
|
153 |
try { |
|
154 |
logger.info("Initializing CRS db in " + targetDBFolder.getAbsolutePath()); |
|
155 |
FileUtils.forceMkdir(targetDBFolder); |
|
156 |
FileUtils.copyDirectory(sourceDBFolder, targetDBFolder); |
|
157 |
} catch (IOException e) { |
|
158 |
logger.error("Can't initilize the CRS database in the gvSIG home (src=" + sourceDBFolder.getAbsolutePath() + ",target=" + targetDBFolder.getAbsolutePath() + ").", e); |
|
159 |
throw new RuntimeException(e); |
|
160 |
} |
|
161 |
} |
|
162 |
if (!targetProjLibFolder.exists()) { |
|
163 |
try { |
|
164 |
logger.info("Initializing PROJ_LIB folder in " + targetProjLibFolder.getAbsolutePath()); |
|
165 |
FileUtils.forceMkdir(targetProjLibFolder); |
|
166 |
FileUtils.copyDirectory(sourceProjLibFolder, targetProjLibFolder); |
|
167 |
} catch (IOException e) { |
|
168 |
logger.error("Can't initilize the PROJ_LIB folder in the gvSIG home (src=" + sourceProjLibFolder.getAbsolutePath() + ",target=" + targetProjLibFolder.getAbsolutePath() + ").", e); |
|
169 |
throw new RuntimeException(e); |
|
170 |
} |
|
171 |
} |
|
172 |
if (!targetEPSGFolder.exists()) { |
|
173 |
try { |
|
174 |
logger.info("Initializing EPSG database folder in " + targetEPSGFolder.getAbsolutePath()); |
|
175 |
FileUtils.forceMkdir(targetEPSGFolder); |
|
176 |
FileUtils.copyDirectory(sourceEPSGFolder, targetEPSGFolder); |
|
177 |
} catch (IOException e) { |
|
178 |
logger.error("Can't initilize EPSG database folder in the gvSIG home (src=" + sourceEPSGFolder.getAbsolutePath() + ",target=" + targetEPSGFolder.getAbsolutePath() + ").", e); |
|
179 |
throw new RuntimeException(e); |
|
180 |
} |
|
181 |
} |
|
182 |
targetEPSGFolder = new File(targetEPSGFolder, getEmbeddedEPSGVersion()); |
|
183 |
if (!targetEPSGFolder.exists()) { |
|
184 |
sourceEPSGFolder = new File(sourceEPSGFolder, getEmbeddedEPSGVersion()); |
|
185 |
try { |
|
186 |
logger.info("Initializing EPSG database folder in " + targetEPSGFolder.getAbsolutePath()); |
|
187 |
FileUtils.forceMkdir(targetEPSGFolder); |
|
188 |
FileUtils.copyDirectory(sourceEPSGFolder, targetEPSGFolder); |
|
189 |
} catch (IOException e) { |
|
190 |
logger.error("Can't initilize EPSG database folder in the gvSIG home (src=" + sourceEPSGFolder.getAbsolutePath() + ",target=" + targetEPSGFolder.getAbsolutePath() + ").", e); |
|
191 |
throw new RuntimeException(e); |
|
192 |
} |
|
193 |
} |
|
194 |
if (!targetCustomCRSIdentify.exists()) { |
|
195 |
try { |
|
196 |
logger.info("Initializing Custom CRS identification file in " + targetCustomCRSIdentify.getAbsolutePath()); |
|
197 |
FileUtils.copyFile(sourceCustomCRSIdentify, targetCustomCRSIdentify); |
|
198 |
} catch (IOException e) { |
|
199 |
logger.error("Can't initilize Custom CRS identification file in the gvSIG home (src=" + sourceCustomCRSIdentify.getAbsolutePath() + ",target=" + targetCustomCRSIdentify.getAbsolutePath() + ").", e); |
|
200 |
throw new RuntimeException(e); |
|
201 |
} |
|
202 |
} |
|
203 |
|
|
204 |
} |
|
205 |
|
|
206 |
@Override |
|
207 |
protected void doPostInitialize() throws LibraryException { |
|
208 |
|
|
209 |
} |
|
210 |
|
|
211 |
private String getEmbeddedEPSGVersion() { |
|
212 |
if (epsg_version == null) { |
|
213 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
|
214 |
PluginServices plugin = pluginManager.getPlugin(this); |
|
215 |
File folder = FileUtils.getFile(plugin.getPluginDirectory(), "db", "EPSG"); |
|
216 |
File[] files = folder.listFiles(); |
|
217 |
if (ArrayUtils.isEmpty(files)) { |
|
218 |
logger.warn("Can't locate embedded EPSG version."); |
|
219 |
return null; |
|
220 |
} |
|
221 |
epsg_version = files[0].getName(); |
|
222 |
} |
|
223 |
return epsg_version; |
|
224 |
} |
|
225 |
|
|
226 |
} |
|
0 | 227 |
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/InitialWarningExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
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 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
|
|
42 |
/* CVS MESSAGES: |
|
43 |
* |
|
44 |
* $Id: InitialWarningExtension.java 8765 2006-11-15 00:08:29Z jjdelcerro $ |
|
45 |
* $Log$ |
|
46 |
* Revision 1.3.4.1 2006-11-15 00:08:08 jjdelcerro |
|
47 |
* *** empty log message *** |
|
48 |
* |
|
49 |
* Revision 1.4 2006/10/02 13:52:34 jaume |
|
50 |
* organize impots |
|
51 |
* |
|
52 |
* Revision 1.3 2006/08/29 07:56:27 cesar |
|
53 |
* Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc) |
|
54 |
* |
|
55 |
* Revision 1.2 2006/08/29 07:13:53 cesar |
|
56 |
* Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow |
|
57 |
* |
|
58 |
* Revision 1.1 2006/05/25 16:27:21 jaume |
|
59 |
* *** empty log message *** |
|
60 |
* |
|
61 |
* |
|
62 |
*/ |
|
63 |
package org.gvsig.crs; |
|
64 |
|
|
65 |
import java.awt.Color; |
|
66 |
import java.awt.Window; |
|
67 |
|
|
68 |
import javax.swing.JButton; |
|
69 |
import javax.swing.JCheckBox; |
|
70 |
import javax.swing.JLabel; |
|
71 |
import javax.swing.JPanel; |
|
72 |
import javax.swing.JWindow; |
|
73 |
import javax.swing.border.TitledBorder; |
|
74 |
|
|
75 |
import org.gvsig.andami.PluginServices; |
|
76 |
import org.gvsig.andami.plugins.Extension; |
|
77 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
78 |
|
|
79 |
|
|
80 |
public class InitialWarningExtension extends Extension { |
|
81 |
// public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.initial_warkning" ); |
|
82 |
// private boolean show = fPrefs.getBoolean( "show_panel", true); |
|
83 |
private DlgWaring dlgWarning; |
|
84 |
/** |
|
85 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled() |
|
86 |
*/ |
|
87 |
public boolean isEnabled() { |
|
88 |
return true; |
|
89 |
} |
|
90 |
|
|
91 |
/** |
|
92 |
* @see com.iver.mdiApp.plugins.IExtension#isVisible() |
|
93 |
*/ |
|
94 |
public boolean isVisible() { |
|
95 |
return true; |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* @see org.gvsig.andami.plugins.IExtension#initialize() |
|
100 |
*/ |
|
101 |
public void initialize() { |
|
102 |
dlgWarning = new DlgWaring(); |
|
103 |
dlgWarning.setText(PluginServices.getText(this, "initial_jcrs_warning")); |
|
104 |
dlgWarning.setVisible(true); |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String) |
|
109 |
*/ |
|
110 |
public void execute(String actionCommand) { |
|
111 |
} |
|
112 |
|
|
113 |
private class DlgWaring extends JWindow{ |
|
114 |
|
|
115 |
private JButton btnOk = null; |
|
116 |
private JCheckBox chkBoxShowAgain = null; |
|
117 |
private JLabel lblText = null; |
|
118 |
private JPanel panel=null; |
|
119 |
private JPanel panel2; |
|
120 |
/** |
|
121 |
* This is the default constructor |
|
122 |
*/ |
|
123 |
public DlgWaring() { |
|
124 |
super((Window)PluginServices.getMainFrame()); |
|
125 |
Window window=(Window)PluginServices.getMainFrame(); |
|
126 |
setLocation(window.getWidth()/2+window.getX()-150,window.getHeight()/2+window.getY()-150); |
|
127 |
initialize(); |
|
128 |
this.setAlwaysOnTop(true); |
|
129 |
} |
|
130 |
|
|
131 |
public void setText(String string) { |
|
132 |
lblText.setText(string); |
|
133 |
} |
|
134 |
|
|
135 |
/** |
|
136 |
* This method initializes this |
|
137 |
* |
|
138 |
* @return void |
|
139 |
*/ |
|
140 |
private void initialize() { |
|
141 |
panel=new JPanel(); |
|
142 |
panel.setBackground(Color.black); |
|
143 |
panel.setLayout(null); |
|
144 |
panel.setBounds(0,0,300,300); |
|
145 |
panel2=new JPanel(); |
|
146 |
panel2.setLayout(null); |
|
147 |
panel2.setBounds(2,2,298,298); |
|
148 |
lblText = new JLabel(); |
|
149 |
lblText.setBounds(15, 15, 271, 200); |
|
150 |
lblText.setText("JLabel"); |
|
151 |
lblText.setBorder(new TitledBorder(PluginServices.getText(this, "warning"))); |
|
152 |
panel2.add(lblText); |
|
153 |
panel2.setSize((int)(panel.getSize().getWidth()-4),(int)(panel.getSize().getHeight()-4)); |
|
154 |
panel.add(panel2); |
|
155 |
this.setLayout(null); |
|
156 |
this.setSize(300, 300); |
|
157 |
this.add(getBtnOk(), null); |
|
158 |
// this.add(getChkBoxShowAgain(), null); |
|
159 |
this.add(panel, null); |
|
160 |
} |
|
161 |
|
|
162 |
/** |
|
163 |
* This method initializes btnOk |
|
164 |
* |
|
165 |
* @return javax.swing.JButton |
|
166 |
*/ |
|
167 |
private JButton getBtnOk() { |
|
168 |
if (btnOk == null) { |
|
169 |
btnOk = new JButton(); |
|
170 |
btnOk.setBounds(100, 250, 100, 20); |
|
171 |
btnOk.setText(PluginServices.getText(this, "aceptar")); |
|
172 |
btnOk.addActionListener(new java.awt.event.ActionListener() { |
|
173 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
174 |
dlgWarning.setVisible(false); |
|
175 |
dlgWarning.dispose(); |
|
176 |
// PluginServices.getMDIManager().closeWindow(dlgWarning); |
|
177 |
} |
|
178 |
}); |
|
179 |
} |
|
180 |
return btnOk; |
|
181 |
} |
|
182 |
|
|
183 |
/** |
|
184 |
* This method initializes chkBoxShowAgain |
|
185 |
* |
|
186 |
* @return javax.swing.JCheckBox |
|
187 |
*/ |
|
188 |
// private JCheckBox getChkBoxShowAgain() { |
|
189 |
// if (chkBoxShowAgain == null) { |
|
190 |
// chkBoxShowAgain = new JCheckBox(); |
|
191 |
// chkBoxShowAgain.setBounds(44, 116, 241, 21); |
|
192 |
// chkBoxShowAgain.setSelected(true); |
|
193 |
// chkBoxShowAgain.setText(PluginServices.getText(this, "show_this_dialog_next_startup")); |
|
194 |
// } |
|
195 |
// return chkBoxShowAgain; |
|
196 |
// } |
|
197 |
|
|
198 |
public WindowInfo getWindowInfo() { |
|
199 |
WindowInfo vi = new WindowInfo(WindowInfo.MODALDIALOG); |
|
200 |
vi.setWidth(300+8); |
|
201 |
vi.setHeight(250); |
|
202 |
vi.setTitle(PluginServices.getText(this, "warning")); |
|
203 |
return vi; |
|
204 |
} |
|
205 |
|
|
206 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
207 |
|
|
208 |
} |
|
0 | 209 |
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/installer/EPSGDatabaseInstallerFactory.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.crs.installer; |
|
25 |
|
|
26 |
import java.io.File; |
|
27 |
import java.io.IOException; |
|
28 |
import org.apache.commons.io.FileUtils; |
|
29 |
import org.gvsig.andami.PluginServices; |
|
30 |
import org.gvsig.andami.PluginsLocator; |
|
31 |
import org.gvsig.andami.PluginsManager; |
|
32 |
import org.gvsig.crs.CrsFactory; |
|
33 |
import org.gvsig.crs.JCrsExtension; |
|
34 |
import org.gvsig.installer.lib.api.InstallerLocator; |
|
35 |
import org.gvsig.installer.lib.api.InstallerManager; |
|
36 |
import org.gvsig.installer.lib.spi.InstallerProviderLocator; |
|
37 |
import org.gvsig.tools.ToolsLocator; |
|
38 |
import org.gvsig.tools.dynobject.DynClass; |
|
39 |
import org.gvsig.tools.dynobject.DynObject; |
|
40 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
41 |
import org.gvsig.tools.service.spi.AbstractProviderFactory; |
|
42 |
import org.gvsig.tools.service.spi.Provider; |
|
43 |
import org.gvsig.tools.service.spi.ProviderManager; |
|
44 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
45 |
import org.slf4j.Logger; |
|
46 |
import org.slf4j.LoggerFactory; |
|
47 |
|
|
48 |
public class EPSGDatabaseInstallerFactory extends |
|
49 |
AbstractProviderFactory { |
|
50 |
|
|
51 |
private static final Logger logger = LoggerFactory.getLogger(EPSGDatabaseInstallerFactory.class); |
|
52 |
|
|
53 |
public static final String PROVIDER_NAME = "jCRS_EPSG"; |
|
54 |
public static final String PROVIDER_DESCRIPTION = "EPSG database installer for jCRS"; |
|
55 |
|
|
56 |
private DynClass dynclass; |
|
57 |
|
|
58 |
@Override |
|
59 |
protected DynClass createParametersDynClass() { |
|
60 |
if ( dynclass == null ) { |
|
61 |
initialize(); |
|
62 |
} |
|
63 |
return dynclass; |
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
protected Provider doCreate(DynObject parameters, ProviderServices services) { |
|
68 |
return new EPSGDatabaseInstaller(services); |
|
69 |
} |
|
70 |
|
|
71 |
public void initialize() { |
|
72 |
if ( dynclass == null ) { |
|
73 |
DynObjectManager dynObjectManager = ToolsLocator |
|
74 |
.getDynObjectManager(); |
|
75 |
dynclass = dynObjectManager.createDynClass(PROVIDER_NAME, |
|
76 |
PROVIDER_DESCRIPTION); |
|
77 |
dynObjectManager.add(dynclass); |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
|
|
82 |
public static void registerEPSGDatabaseInstaller() { |
|
83 |
|
|
84 |
InstallerManager installerManager = InstallerLocator.getInstallerManager(); |
|
85 |
ProviderManager providerManager = InstallerProviderLocator.getProviderManager(); |
|
86 |
PluginsManager pluginsManager = PluginsLocator.getManager(); |
|
87 |
|
|
88 |
providerManager.addProviderFactory(new EPSGDatabaseInstallerFactory()); |
|
89 |
|
|
90 |
File epsgDatabaseFolder = new File(CrsFactory.getDataBaseFolder(),"EPSG"); |
|
91 |
|
|
92 |
try { |
|
93 |
FileUtils.forceMkdir(epsgDatabaseFolder); |
|
94 |
} catch (IOException ex) { |
|
95 |
logger.warn("Can't create EPSG databases folder in '"+epsgDatabaseFolder.getAbsolutePath()+"'.",ex); |
|
96 |
} |
|
97 |
installerManager.setDefaultLocalAddonRepository(epsgDatabaseFolder, PROVIDER_NAME); |
|
98 |
} |
|
99 |
} |
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/installer/EPSGDatabaseInstaller.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.crs.installer; |
|
25 |
|
|
26 |
import java.io.File; |
|
27 |
import java.io.FileOutputStream; |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import java.net.MalformedURLException; |
|
31 |
import java.util.zip.ZipEntry; |
|
32 |
import java.util.zip.ZipException; |
|
33 |
import java.util.zip.ZipInputStream; |
|
34 |
import org.apache.commons.io.FileUtils; |
|
35 |
import org.apache.commons.io.FilenameUtils; |
|
36 |
import org.gvsig.andami.LocaleManager; |
|
37 |
import org.gvsig.andami.PluginServices; |
|
38 |
import org.gvsig.andami.PluginsLocator; |
|
39 |
import org.gvsig.andami.PluginsManager; |
|
40 |
import org.gvsig.crs.CrsFactory; |
|
41 |
import org.gvsig.crs.JCrsExtension; |
|
42 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
43 |
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
|
44 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
|
45 |
import org.gvsig.installer.lib.spi.execution.InstallPackageProvider; |
|
46 |
import org.gvsig.tools.ToolsLocator; |
|
47 |
import org.gvsig.tools.dynobject.DynObject; |
|
48 |
import org.gvsig.tools.service.spi.AbstractProvider; |
|
49 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
50 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
51 |
import org.gvsig.tools.task.TaskStatusManager; |
|
52 |
import org.slf4j.Logger; |
|
53 |
import org.slf4j.LoggerFactory; |
|
54 |
|
|
55 |
public class EPSGDatabaseInstaller extends AbstractProvider implements InstallPackageProvider { |
|
56 |
|
|
57 |
private static Logger logger = LoggerFactory.getLogger(EPSGDatabaseInstaller.class); |
|
58 |
|
|
59 |
private int BUFFER = 2048; |
|
60 |
|
|
61 |
public EPSGDatabaseInstaller(ProviderServices providerServices) { |
|
62 |
super(providerServices); |
|
63 |
} |
|
64 |
|
|
65 |
public void install(File applicationFolder, InputStream inputStream, PackageInfo packageInfo) throws InstallPackageServiceException { |
|
66 |
PluginsManager pluginsManager = PluginsLocator.getManager(); |
|
67 |
File i18nFolder = pluginsManager.getApplicationI18nFolder(); |
|
68 |
|
|
69 |
File epsgDatabaseFolder = new File(CrsFactory.getDataBaseFolder(),"EPSG"); |
|
70 |
|
|
71 |
logger.info("Installing package '" + packageInfo.getCode() + "' in '" + epsgDatabaseFolder.getAbsolutePath() + "'."); |
|
72 |
try { |
|
73 |
FileUtils.forceMkdir(epsgDatabaseFolder); |
|
74 |
decompress(inputStream, epsgDatabaseFolder); |
|
75 |
activateThisDataBase(packageInfo); |
|
76 |
} catch (Exception e) { |
|
77 |
try { |
|
78 |
logger.warn("Can install package '" + packageInfo.getCode() + "'.", e); |
|
79 |
// if there is an exception, installLater is called |
|
80 |
installLater(applicationFolder, inputStream, packageInfo); |
|
81 |
} catch (IOException e1) { |
|
82 |
logger.warn("Can install package '" + packageInfo.getCode() + "'.", e1); |
|
83 |
throw new InstallPackageServiceException(e1); |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
87 |
} |
|
88 |
|
|
89 |
private void activateThisDataBase(PackageInfo packageInfo) { |
|
90 |
String dbentry = "EPSG/" + packageInfo.getCode() + "/EPSG.sql"; |
|
91 |
File f = new File(CrsFactory.getDataBaseFolder(),dbentry); |
|
92 |
if( !f.exists() ) { |
|
93 |
logger.warn("Can't activate EPSG database, problems locating in '"+f.getAbsolutePath()+"'."); |
|
94 |
return; |
|
95 |
} |
|
96 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
|
97 |
PluginServices plugin = pluginManager.getPlugin(this); |
|
98 |
DynObject pluginProperties = plugin.getPluginProperties(); |
|
99 |
|
|
100 |
pluginProperties.setDynValue("epsgDatabase", dbentry); |
|
101 |
plugin.savePluginProperties(); |
|
102 |
} |
|
103 |
|
|
104 |
private void decompress(InputStream inputStream, File folder) |
|
105 |
throws ZipException, IOException, InstallerInfoFileException { |
|
106 |
|
|
107 |
ZipInputStream zis = null; |
|
108 |
ZipEntry entry = null; |
|
109 |
byte data[] = new byte[BUFFER]; |
|
110 |
int count = 0; |
|
111 |
|
|
112 |
TaskStatusManager manager = ToolsLocator.getTaskStatusManager(); |
|
113 |
SimpleTaskStatus taskStatus = manager.createDefaultSimpleTaskStatus("Uncompressing..."); |
|
114 |
|
|
115 |
manager.add(taskStatus); |
|
116 |
String entryName = "(header)"; |
|
117 |
try { |
|
118 |
long readed = 0; |
|
119 |
zis = new ZipInputStream(inputStream); |
|
120 |
while ( (entry = zis.getNextEntry()) != null ) { |
|
121 |
entryName = FilenameUtils.separatorsToSystem(entry.getName()); |
|
122 |
taskStatus.message(entryName); |
|
123 |
|
|
124 |
File file = new File(folder, entryName); |
|
125 |
if ( entry.isDirectory() ) { |
|
126 |
file.mkdirs(); |
|
127 |
} else { |
|
128 |
if ( file.exists() ) { |
|
129 |
FileUtils.forceDelete(file); |
|
130 |
} |
|
131 |
if ( !file.getParentFile().exists() ) { |
|
132 |
FileUtils.forceMkdir(file.getParentFile()); |
|
133 |
} |
|
134 |
logger.debug("extracting " + file.getAbsolutePath()); |
|
135 |
FileOutputStream fos = new FileOutputStream(file); |
|
136 |
while ( (count = zis.read(data, 0, BUFFER)) != -1 ) { |
|
137 |
fos.write(data, 0, count); |
|
138 |
readed += count; |
|
139 |
taskStatus.setCurValue(readed); |
|
140 |
} |
|
141 |
fos.flush(); |
|
142 |
fos.close(); |
|
143 |
} |
|
144 |
} |
|
145 |
zis.close(); |
|
146 |
} catch (IOException ex) { |
|
147 |
logger.warn("Problems uncompresing 'EPSG database' (last entry '" + entryName + "'.", ex); |
|
148 |
throw ex; |
|
149 |
|
|
150 |
} catch (RuntimeException ex) { |
|
151 |
logger.warn("Problems uncompresing 'EPSG database' (last entry '" + entryName + "'.", ex); |
|
152 |
throw ex; |
|
153 |
|
|
154 |
} finally { |
|
155 |
taskStatus.remove(); |
|
156 |
|
|
157 |
} |
|
158 |
} |
|
159 |
|
|
160 |
public void installLater(File applicationDirectory, InputStream inputStream, PackageInfo packageInfo) throws InstallPackageServiceException, IOException { |
|
161 |
logger.warn("installLater is not implementes."); |
|
162 |
} |
|
163 |
} |
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/JCrsExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Información Geográfica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana. |
|
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 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ibáñez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha |
|
34 |
* Campus Universitario s/n |
|
35 |
* 02071 Alabacete |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 967 599 200 |
|
39 |
*/ |
|
40 |
|
|
41 |
|
|
42 |
package org.gvsig.crs; |
|
43 |
|
|
44 |
import org.gvsig.andami.IconThemeHelper; |
|
45 |
import org.gvsig.andami.plugins.Extension; |
|
46 |
import org.gvsig.app.gui.panels.CRSSelectPanelFactory; |
|
47 |
import org.gvsig.crs.gui.panels.CrsUIFactory; |
|
48 |
import org.gvsig.crs.gui.panels.ProjChooserPanel; |
|
49 |
import org.gvsig.crs.preferences.JCRSPreferencesPage; |
|
50 |
import org.gvsig.tools.ToolsLocator; |
|
51 |
import org.gvsig.tools.dynobject.DynObject; |
|
52 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
53 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
54 |
|
|
55 |
public class JCrsExtension extends Extension { |
|
56 |
//private final static Logger logger = LoggerFactory.getLogger(JCrsExtension.class); |
|
57 |
|
|
58 |
@Override |
|
59 |
public void initialize() { |
|
60 |
|
|
61 |
CRSSelectPanelFactory.registerPanelClass(ProjChooserPanel.class); |
|
62 |
CRSSelectPanelFactory.registerUIFactory(CrsUIFactory.class); |
|
63 |
|
|
64 |
IconThemeHelper.registerIcon("preferences", "jcrs-preferences", this); |
|
65 |
|
|
66 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
67 |
ExtensionPoint ep = extensionPoints.add("AplicationPreferences", ""); |
|
68 |
ep.append("jCRS", "", new JCRSPreferencesPage()); |
|
69 |
|
|
70 |
} |
|
71 |
|
|
72 |
|
|
73 |
@Override |
|
74 |
public void execute(String actionCommand) { |
|
75 |
|
|
76 |
} |
|
77 |
|
|
78 |
public boolean isEnabled() { |
|
79 |
return true; |
|
80 |
} |
|
81 |
|
|
82 |
@Override |
|
83 |
public boolean isVisible() { |
|
84 |
return false; |
|
85 |
} |
|
86 |
|
|
87 |
} |
|
0 | 88 |
org.gvsig.projection.jcrs/tags/org.gvsig.projection.jcrs-2.1.89/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/preferences/JCRSPreferencesPage.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.crs.preferences; |
|
7 |
|
|
8 |
import java.awt.BorderLayout; |
|
9 |
import java.io.File; |
|
10 |
import java.util.Collection; |
|
11 |
import java.util.Iterator; |
|
12 |
import javax.swing.ComboBoxModel; |
|
13 |
import javax.swing.DefaultComboBoxModel; |
|
14 |
import javax.swing.DefaultListModel; |
|
15 |
import javax.swing.ImageIcon; |
|
16 |
import javax.swing.JPanel; |
|
17 |
import org.apache.commons.io.FileUtils; |
|
18 |
import org.apache.commons.io.FilenameUtils; |
|
19 |
import org.apache.commons.lang3.BooleanUtils; |
|
20 |
import org.apache.commons.lang3.StringUtils; |
|
21 |
import org.gvsig.andami.IconThemeHelper; |
|
22 |
import org.gvsig.andami.PluginServices; |
|
23 |
import org.gvsig.andami.PluginsLocator; |
|
24 |
import org.gvsig.andami.PluginsManager; |
|
25 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
|
26 |
import org.gvsig.andami.preferences.StoreException; |
|
27 |
import org.gvsig.crs.CrsFactory; |
|
28 |
import org.gvsig.tools.ToolsLocator; |
|
29 |
import org.gvsig.tools.dynobject.DynObject; |
|
30 |
import org.gvsig.tools.exception.BaseException; |
|
31 |
import org.gvsig.tools.i18n.I18nManager; |
|
32 |
import org.gvsig.tools.packageutils.PackageInfo; |
|
33 |
import org.gvsig.tools.packageutils.PackageManager; |
|
34 |
import org.slf4j.Logger; |
|
35 |
import org.slf4j.LoggerFactory; |
|
36 |
|
|
37 |
/** |
|
38 |
* |
|
39 |
* @author usuario |
|
40 |
*/ |
|
41 |
public class JCRSPreferencesPage extends AbstractPreferencePage { |
|
42 |
|
|
43 |
private static final Logger logger = LoggerFactory.getLogger(JCRSPreferencesPage.class); |
|
44 |
private static final long serialVersionUID = -7838901334080793221L; |
|
45 |
|
|
46 |
private JCRSPreferencesPageView preferences; |
|
47 |
private DynObject pluginProperties; |
|
48 |
private PluginServices plugin; |
|
49 |
|
|
50 |
private class ListItem { |
|
51 |
|
|
52 |
private PackageInfo pkg; |
|
53 |
private File epsgFile; |
|
54 |
|
|
55 |
ListItem(PackageInfo pkg, File epsgFile) { |
|
56 |
this.pkg = pkg; |
|
57 |
this.epsgFile = epsgFile; |
|
58 |
} |
|
59 |
|
|
60 |
public File getEPSGFile() { |
|
61 |
return this.epsgFile; |
|
62 |
} |
|
63 |
|
|
64 |
public PackageInfo getPackageInfo() { |
|
65 |
return this.pkg; |
|
66 |
} |
|
67 |
|
|
68 |
public String toString() { |
|
69 |
return this.pkg.getName(); |
|
70 |
} |
|
71 |
|
|
72 |
} |
|
73 |
|
|
74 |
public JCRSPreferencesPage() { |
|
75 |
initComponents(); |
|
76 |
} |
|
77 |
|
|
78 |
private void initComponents() { |
|
79 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
80 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
|
81 |
this.plugin = pluginManager.getPlugin(this); |
|
82 |
this.pluginProperties = this.plugin.getPluginProperties(); |
|
83 |
|
|
84 |
this.preferences = new JCRSPreferencesPageView(); |
|
85 |
this.preferences.lblHeader.setText( |
|
86 |
i18n.getTranslation("_Select_the_EPSG_data_base_to_use") |
|
87 |
); |
|
88 |
this.preferences.chkUseMomoryChacheForCRSs.setText( |
|
89 |
i18n.getTranslation("_Use_cache_for_CRSs") |
|
90 |
); |
|
91 |
this.setLayout(new BorderLayout()); |
|
92 |
this.add(this.preferences, BorderLayout.NORTH); |
|
93 |
|
|
94 |
this.preferences.lblDatabaseInitializationMode.setText( |
|
95 |
i18n.getTranslation("_When_initializing_the_EPSG_database") |
|
96 |
); |
|
97 |
DefaultComboBoxModel modelCombo = new DefaultComboBoxModel(); |
|
98 |
modelCombo.addElement(i18n.getTranslation("_On_start_in_background")); |
|
99 |
modelCombo.addElement(i18n.getTranslation("_On_start_in_foreground")); |
|
100 |
modelCombo.addElement(i18n.getTranslation("_On_first_use")); |
|
101 |
this.preferences.cboDatabaseInitializationMode.setModel(modelCombo); |
|
102 |
|
|
103 |
initializeValues(); |
|
104 |
} |
|
105 |
|
|
106 |
public void storeValues() throws StoreException { |
|
107 |
ListItem item = (ListItem) this.preferences.lstBBDD.getSelectedValue(); |
|
108 |
if( item == null ) { |
|
109 |
return; |
|
110 |
} |
|
111 |
this.pluginProperties.setDynValue("epsgDatabase", item.getEPSGFile()); |
|
112 |
this.pluginProperties.setDynValue("useMemoryCacheForCRSs", |
|
113 |
this.preferences.chkUseMomoryChacheForCRSs.isSelected() |
|
114 |
); |
|
115 |
this.pluginProperties.setDynValue( |
|
116 |
"databaseInitializationMode", |
|
117 |
this.preferences.cboDatabaseInitializationMode.getSelectedIndex() |
|
118 |
); |
|
119 |
this.plugin.savePluginProperties(); |
|
120 |
} |
|
121 |
|
|
122 |
public void setChangesApplied() { |
|
123 |
// ???? |
|
124 |
} |
|
125 |
|
|
126 |
public String getID() { |
|
127 |
return getClass().getName(); |
|
128 |
} |
|
129 |
|
|
130 |
public String getTitle() { |
|
131 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
132 |
return i18nManager.getTranslation("jCRS_preferences"); |
|
133 |
|
|
134 |
} |
|
135 |
|
|
136 |
public JPanel getPanel() { |
|
137 |
return this; |
|
138 |
} |
|
139 |
|
|
140 |
@Override |
|
141 |
public void initializeValues() { |
|
142 |
PackageManager pkgManager = ToolsLocator.getPackageManager(); |
|
143 |
|
|
144 |
File dbfolder = CrsFactory.getDataBaseFolder(); |
|
145 |
File epsgFolders = new File(dbfolder,"EPSG"); |
|
146 |
Collection<File> files = FileUtils.listFiles(epsgFolders, new String[]{"info"}, true); |
|
147 |
DefaultListModel model = new DefaultListModel(); |
|
148 |
|
|
149 |
File currentEPSG = getCurrentEPSG(); |
|
150 |
|
|
151 |
int selectedOption = 0; |
|
152 |
int n = 0; |
|
153 |
Iterator<File> it = files.iterator(); |
|
154 |
while( it.hasNext() ) { |
|
155 |
File f = it.next(); |
|
156 |
if( f.getName().equals("package.info") ) { |
|
157 |
try { |
|
158 |
PackageInfo pkginfo = pkgManager.createPackageInfo(f); |
|
159 |
File epsgdb = new File(f.getParentFile(),"EPSG.sql"); |
|
160 |
epsgdb = makeRelative(dbfolder, epsgdb); |
|
161 |
model.addElement(new ListItem(pkginfo, epsgdb)); |
|
162 |
if( epsgdb.equals(currentEPSG) ) { |
|
163 |
selectedOption = n; |
|
164 |
} |
|
165 |
n++; |
|
166 |
} catch (BaseException ex) { |
|
167 |
logger.warn("Can't load package information from '"+f.getAbsolutePath()+"'.",ex); |
|
168 |
} |
|
169 |
} |
|
170 |
} |
|
171 |
this.preferences.lstBBDD.setModel(model); |
|
172 |
this.preferences.lstBBDD.setSelectedIndex(selectedOption); |
|
173 |
|
|
174 |
boolean currentUseChacheForCRSs = BooleanUtils.isTrue( |
|
175 |
(Boolean) this.pluginProperties.getDynValue("useMemoryCacheForCRSs") |
|
176 |
); |
|
177 |
this.preferences.chkUseMomoryChacheForCRSs.setSelected(currentUseChacheForCRSs); |
|
178 |
|
|
179 |
this.preferences.cboDatabaseInitializationMode.setSelectedIndex( |
|
180 |
(Integer)this.pluginProperties.getDynValue("databaseInitializationMode") |
|
181 |
); |
|
182 |
} |
|
183 |
|
|
184 |
private File makeRelative(File parent, File file) { |
|
185 |
String parent_path = parent.getAbsolutePath(); |
|
186 |
if( !parent_path.endsWith(File.separator) ) { |
|
187 |
parent_path += File.separator; |
|
188 |
} |
|
189 |
if( file.getAbsolutePath().startsWith(parent_path) ) { |
|
190 |
file = new File(file.getAbsolutePath().substring(parent_path.length())); |
|
191 |
} |
|
192 |
return file; |
|
193 |
} |
|
194 |
|
|
195 |
private File getCurrentEPSG() { |
|
196 |
File dbfolder = CrsFactory.getDataBaseFolder(); |
|
197 |
File currentEPSG = null; |
|
198 |
String s = StringUtils.defaultIfBlank((String) this.pluginProperties.getDynValue("epsgDatabase"),null); |
|
199 |
if( s!=null ) { |
|
200 |
currentEPSG = new File(s); |
|
201 |
if( !currentEPSG.isAbsolute() ) { |
|
202 |
currentEPSG = new File(dbfolder,s); |
|
203 |
} |
|
204 |
currentEPSG = makeRelative(dbfolder,currentEPSG); |
|
205 |
} |
|
206 |
return currentEPSG; |
|
207 |
} |
|
208 |
|
|
209 |
public void initializeDefaults() { |
|
210 |
|
|
211 |
} |
|
212 |
|
|
213 |
public ImageIcon getIcon() { |
|
214 |
return IconThemeHelper.getImageIcon("jcrs-preferences"); |
|
215 |
} |
|
216 |
|
|
217 |
public boolean isValueChanged() { |
|
218 |
File currentEPSG = this.getCurrentEPSG(); |
|
219 |
ListItem item = (ListItem) this.preferences.lstBBDD.getSelectedValue(); |
|
220 |
if( item == null ) { |
|
221 |
return false; |
|
222 |
} |
|
223 |
boolean changed = ! currentEPSG.equals(item.getEPSGFile()); |
|
224 |
if( !changed ) { |
|
225 |
boolean currentUseChacheForCRSs = BooleanUtils.isTrue( |
|
226 |
(Boolean) this.pluginProperties.getDynValue("useMemoryCacheForCRSs") |
|
227 |
); |
|
228 |
if( this.preferences.chkUseMomoryChacheForCRSs.isSelected()!=currentUseChacheForCRSs ) { |
|
229 |
changed = true; |
|
230 |
} |
|
231 |
} |
|
232 |
if( !changed ) { |
|
233 |
int n = this.preferences.cboDatabaseInitializationMode.getSelectedIndex(); |
|
234 |
changed = n!=(Integer)this.pluginProperties.getDynValue("databaseInitializationMode"); |
|
235 |
} |
|
236 |
return changed; |
|
237 |
} |
|
238 |
|
|
239 |
public boolean isResizeable() { |
Also available in: Unified diff