Revision 33567

View differences:

tags/v2_0_0_Build_2011/libraries/libProjection/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
6
	<modelVersion>4.0.0</modelVersion>
7
	<groupId>org.gvsig</groupId>
8
	<artifactId>org.gvsig.projection</artifactId>
9
	<packaging>jar</packaging>
10
	<version>2.0-SNAPSHOT</version>
11
	<name>libProjection</name>
12
	<url>http://gvsig.org</url>
13
	<parent>
14
		<groupId>org.gvsig</groupId>
15
		<artifactId>gvsig-base-library-pom</artifactId>
16
		<version>2.0-SNAPSHOT</version>
17
	</parent>	
18
	<distributionManagement>
19
		<site>
20
			<id>gvsig-repository</id>
21
			<url>${site-repository}/</url>
22
		</site>
23
	</distributionManagement>
24

  
25
	<properties>
26
		<build-dir>${basedir}/../build</build-dir>
27
	</properties>
28
	<dependencies>
29
		<dependency>
30
			<groupId>org.gvsig</groupId>
31
			<artifactId>org.gvsig.i18n</artifactId>
32
			<version>2.0-SNAPSHOT</version>
33
		</dependency>
34
		<dependency>
35
			<groupId>org.gvsig</groupId>
36
			<artifactId>org.gvsig.tools.lib</artifactId>
37
		</dependency>
38
	</dependencies>
39
	
40
	  <build>
41
		<sourceDirectory>src</sourceDirectory>
42
		<testSourceDirectory>src-test</testSourceDirectory>
43
	  </build>	
44
	
45
	  <profiles>
46
		<profile>
47
		  <id>se</id>
48
		  <activation>
49
		    <activeByDefault>true</activeByDefault>
50
		  </activation>
51
		  
52
			<dependencies>	
53
				<dependency>
54
					<groupId>org.opengis</groupId>
55
				    <artifactId>geoapi</artifactId>
56
					<optional>true</optional>
57
				</dependency>
58
				<dependency>
59
					<groupId>org.geotools</groupId>
60
					<artifactId>gt2-legacy</artifactId>
61
					<optional>true</optional>
62
				</dependency>
63
				<dependency>
64
					<groupId>org.geotools</groupId>
65
					<artifactId>gt2-main</artifactId>
66
					<optional>true</optional>
67
				</dependency>
68
				<dependency>
69
					<groupId>geojava</groupId>
70
					<artifactId>geojava</artifactId>
71
					<optional>true</optional>
72
				</dependency>
73
				<dependency>
74
					<groupId>javax.media</groupId>
75
					<artifactId>jai_core</artifactId>
76
					<optional>true</optional>
77
				</dependency>
78
				<dependency>
79
					<groupId>javax.media</groupId>
80
					<artifactId>jai_codec</artifactId>
81
					<optional>true</optional>
82
				</dependency>
83
			</dependencies>
84
			<build>
85
				<resources>
86
		    		<resource>
87
						<directory>config</directory>
88
					</resource>
89
					<resource>
90
						<directory>images</directory>
91
					</resource>
92
				</resources>
93
				
94
				<plugins>
95
					<plugin>
96
						<groupId>org.apache.maven.plugins</groupId>
97
						<artifactId>maven-compiler-plugin</artifactId>
98
						<configuration>
99
							<source>1.4</source>
100
							<target>1.4</target>
101
							<!-- put your configurations here -->
102
							<encoding>ISO-8859-1</encoding>
103
						</configuration>
104
					</plugin>
105
					<plugin>
106
						<groupId>org.apache.maven.plugins</groupId>
107
						<artifactId>maven-jar-plugin</artifactId>
108
						<configuration>
109
							<excludes>
110
								<exclude>**/org/cresques/impl/**</exclude>
111
								<exclude>**/org/cresques/ui/**</exclude>
112
								<exclude>**/org/cresques/resources/**</exclude>
113
								<exclude>*.gif</exclude>
114
							</excludes>
115
						</configuration>
116
						<executions>
117
							<execution>
118
								<id>cresques-ui</id>
119
								<phase>package</phase>
120
								<goals>
121
									<goal>jar</goal>
122
								</goals>
123
								<configuration>
124
									<classifier>cresques-ui</classifier>
125
									<excludes>
126
										<exclude>NONE</exclude>
127
									</excludes>
128
									<includes>
129
										<include>**/org/cresques/ui/**</include>
130
										<include>**/org/cresques/resources/**</include>
131
										<include>*.gif</include>
132
									</includes>
133
								<!--	<finalName>org.cresques.ui</finalName>  -->
134
								</configuration>
135
							</execution>
136
							<execution>
137
								<id>cresques-cts-impl</id>
138
								<phase>package</phase>
139
								<goals>
140
									<goal>jar</goal>
141
								</goals>
142
								<configuration>
143
									<classifier>cresques-impl</classifier>
144
									<excludes>
145
										<exclude>**/org/cresques/resources/**</exclude>
146
										<exclude>*.gif</exclude>
147
									</excludes>
148
									<includes>
149
										<include>**/org/cresques/impl/**</include>
150
									</includes>
151
								<!-- <finalName>org.cresques.cts</finalName> -->
152
								</configuration>
153
							</execution>
154
						</executions>
155
					</plugin>
156
					<plugin>
157
						<artifactId>maven-antrun-plugin</artifactId>
158
						<executions>
159
							<execution>
160
								<id>services</id>
161
								<phase>package</phase>
162
								<goals>
163
									<goal>run</goal>
164
								</goals>
165
								<configuration>
166
									<tasks>
167
										<jar destfile="${project.build.directory}/${project.build.finalName}.jar"
168
											update="true">
169
											<fileset dir="${basedir}/resources/api" />
170
										</jar>
171
										<jar destfile="${project.build.directory}/${project.build.finalName}-cresques-impl.jar"
172
											update="true">
173
											<fileset dir="${basedir}/resources/cresques" />
174
										</jar>
175
									</tasks>
176
								</configuration>
177
							</execution>
178
						</executions>
179
					</plugin>
180
					<plugin>
181
						<groupId>org.apache.maven.plugins</groupId>
182
						<artifactId>maven-surefire-plugin</artifactId>
183
						<configuration>
184
							<additionalClasspathElements>
185
								<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
186
								<additionalClasspathElement>${basedir}/resources/cresques</additionalClasspathElement>
187
							</additionalClasspathElements>
188
						</configuration>
189
					</plugin>
190
				</plugins>
191
			</build>
192
		</profile>
193
		
194
		<profile>
195
	      <id>cdc</id>
196
		  <activation>
197
		    <activeByDefault>false</activeByDefault>
198
		  </activation>
199
		  
200
		  <build>
201
				<plugins>
202
					<plugin>
203
						<groupId>org.apache.maven.plugins</groupId>
204
						<artifactId>maven-compiler-plugin</artifactId>
205
						<configuration>
206
							<excludes>
207
								<exclude>**/org/cresques/impl/**</exclude>
208
								<exclude>**/org/cresques/ui/**</exclude>
209
							</excludes>
210
							<testExcludes>
211
								<exclude>**/org/cresques/impl/**</exclude>
212
								<exclude>**/org/cresques/ui/**</exclude>
213
							</testExcludes>
214
						</configuration>
215
					</plugin>
216
	      			<plugin>
217
						<groupId>org.apache.maven.plugins</groupId>
218
						<artifactId>maven-jar-plugin</artifactId>
219
						<configuration>
220
							<excludes>
221
								<exclude>**/org/cresques/impl/**</exclude>
222
								<exclude>**/org/cresques/ui/**</exclude>
223
							</excludes>
224
						</configuration>
225
					</plugin>
226
					<plugin>
227
						<artifactId>maven-antrun-plugin</artifactId>
228
						<executions>
229
							<execution>
230
								<id>services</id>
231
								<phase>package</phase>
232
								<goals>
233
									<goal>run</goal>
234
								</goals>
235
								<configuration>
236
									<tasks>
237
										<jar destfile="${project.build.directory}/${project.build.finalName}.jar"
238
											update="true">
239
											<fileset dir="${basedir}/resources/api" />
240
										</jar>
241
									</tasks>
242
								</configuration>
243
							</execution>
244
						</executions>
245
					</plugin>
246
					<plugin>
247
						<groupId>org.apache.maven.plugins</groupId>
248
						<artifactId>maven-surefire-plugin</artifactId>
249
						<configuration>
250
							<additionalClasspathElements>
251
								<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
252
							</additionalClasspathElements>
253
						</configuration>
254
					</plugin>
255
				</plugins>
256
			</build>
257
		  
258
		</profile>
259
		
260
		<profile>
261
			<id>eclipse-project</id>
262
			<build>
263
				<defaultGoal>antrun:run</defaultGoal>
264
				<plugins>
265
					<plugin>
266
						<artifactId>maven-antrun-plugin</artifactId>
267
						<configuration>
268
							<tasks>
269
								<ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml"
270
									target="eclipse.all"/>
271
							</tasks>
272
						</configuration>
273
					</plugin>
274
				</plugins>
275
			</build>				
276
		</profile>				
277
	</profiles>
278
	
279
	<reporting>
280
		<plugins>
281
			<plugin>
282
				<groupId>org.apache.maven.plugins</groupId>
283
				<artifactId>maven-javadoc-plugin</artifactId>
284
				<reportSets>
285
					<reportSet>
286
						<id>api</id>
287
						<configuration>
288
							<excludePackageNames>org.cresques.ui:org.cresques.impl</excludePackageNames>
289
							<name>Javadoc: API</name>
290
							<destDir>apidoc</destDir>
291
							<windowtitle>API Documentation</windowtitle>
292
							<links>
293
								<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
294
								<link>http://www.slf4j.org/api/</link>
295
								<link>${site-repository}/org.gvsig.tools/2.0.0/apidocs/</link>
296
								<link>${site-repository}/org.gvsig.i18n/2.0.0/apidocs/</link>
297
								<link>${site-repository}/org.gvsig.metadata/2.0.0/apidocs/</link>
298
								<link>${site-repository}/org.gvsig.compat/2.0.0/apidocs/</link>
299
							</links>
300
						</configuration>
301
						<reports>
302
							<report>javadoc</report>
303
						</reports>
304
					</reportSet>
305
					<reportSet>
306
						<id>ui</id>
307
						<configuration>
308
							<doctitle>${project.name} ${project.version} User interface</doctitle>
309
							<subpackages>org.cresques.ui</subpackages>
310
							<name>Javadoc: UI</name>
311
							<destDir>uidoc</destDir>
312
							<windowtitle>User interface Documentation</windowtitle>
313
							<links>
314
								<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
315
								<link>http://www.slf4j.org/api/</link>
316
								<link>../apidoc/</link>
317
								<link>${site-repository}/org.gvsig.tools/2.0.0/apidocs/</link>
318
								<link>${site-repository}/org.gvsig.i18n/2.0.0/apidocs/</link>
319
								<link>${site-repository}/org.gvsig.metadata/2.0.0/apidocs/</link>
320
								<link>${site-repository}/org.gvsig.compat/2.0.0/apidocs/</link>
321
							</links>
322
						</configuration>
323
						<reports>
324
							<report>javadoc</report>
325
						</reports>
326
					</reportSet>
327
					<reportSet>
328
						<id>cresques-impl</id>
329
						<configuration>
330
							<doctitle>${project.name} ${project.version} Cresques implementation</doctitle>
331
							<subpackages>org.cresques.impl</subpackages>
332
							<name>Javadoc: Cresques impl</name>
333
							<destDir>cresquesdoc</destDir>
334
							<windowtitle>Cresques implementation Documentation</windowtitle>
335
							<links>
336
								<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
337
								<link>http://www.slf4j.org/api/</link>
338
								<link>../apidoc/</link>
339
								<link>${site-repository}/org.gvsig.tools/2.0.0/apidocs/</link>
340
								<link>${site-repository}/org.gvsig.i18n/2.0.0/apidocs/</link>
341
								<link>${site-repository}/org.gvsig.metadata/2.0.0/apidocs/</link>
342
								<link>${site-repository}/org.gvsig.compat/2.0.0/apidocs/</link>
343
							</links>
344
						</configuration>
345
						<reports>
346
							<report>javadoc</report>
347
						</reports>
348
					</reportSet>
349
				</reportSets>
350
			</plugin>
351
		</plugins>
352
	</reporting>
353
	
354
</project>
0 355

  
tags/v2_0_0_Build_2011/libraries/libProjection/resources/cresques/META-INF/services/org.gvsig.tools.library.Library
1
org.cresques.impl.CresquesCtsLibrary
tags/v2_0_0_Build_2011/libraries/libProjection/resources/api/META-INF/services/org.gvsig.tools.library.Library
1
org.cresques.ProjectionLibrary
tags/v2_0_0_Build_2011/libraries/libProjection/.cvsignore
1
bin
2
bin-test
0 3

  
tags/v2_0_0_Build_2011/libraries/libProjection/src-test/org/cresques/cts/AllTests.java
1
package org.cresques.cts;
2

  
3
import junit.framework.Test;
4
import junit.framework.TestSuite;
5

  
6
public class AllTests {
7

  
8
	public static Test suite() {
9
		TestSuite suite = new TestSuite("Test for org.cresques.cts");
10
		//$JUnit-BEGIN$
11

  
12
		//$JUnit-END$
13
		return suite;
14
	}
15

  
16
}
0 17

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text_it.properties
1
#Translations for language [it]
2
#Tue Nov 07 12:30:01 CET 2006
3
Aceptar=Accetta
4
Aplicar=Applica
5
Block_Size_=Dimensioni blocco\:
6
Cancelar=Cancella
7
Compression_=Compressione
8
datum=Datum
9
Generate_Tfw_=Genera Tfw\:
10
Interleave_=Interlacciato\:
11
Photometric_=Fotometrica\:
12
Progressive_=Progressivo\:
13
projection=Proiezione
14
reference_system=Sistema di riferimento
15
zone=Fuso
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text.properties
1
#Translations for language [es]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Aceptar
4
Aplicar=Aplicar
5
Block_Size_=Tama\u00f1o de bloque\:
6
Cancelar=Cancelar
7
Compression_=Compresi\u00f3n\:
8
datum=Datum
9
Generate_Tfw_=Generar Tfw\:
10
Interleave_=Entrelazado\:
11
Photometric_=Fotom\u00e9trica\:
12
Progressive_=Progresivo\:
13
projection=Proyecci\u00f3n
14
reference_system=Sistema de Referencia
15
zone=Huso
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text_en.properties
1
#Translations for language [en]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Accept
4
Aplicar=Apply
5
Block_Size_=Block Size\:
6
Cancelar=Cancel
7
Compression_=Compression\:
8
datum=Datum
9
Generate_Tfw_=Generate Tfw\:
10
Interleave_=Interleave\:
11
Photometric_=Photometric\:
12
Progressive_=Progressive\:
13
projection=Projection
14
reference_system=Reference System
15
zone=Zone
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text_gl.properties
1
#Translations for language [gl]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Aceptar
4
Aplicar=Aplicar
5
Block_Size_=
6
Cancelar=Cancelar
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text_ca.properties
1
#Translations for language [ca]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Acceptar
4
Aplicar=Aplicar
5
Block_Size_=
6
Cancelar=Cancel\u00b7lar
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=Projecci\u00f3
14
reference_system=Sistema de refer\u00e8ncia
15
zone=
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text_pt.properties
1
#Translations for language [pt]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Aceitar
4
Aplicar=Aplicar
5
Block_Size_=
6
Cancelar=Cancelar
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text_cs.properties
1
#Translations for language [cs]
2
#Mon Nov 06 09:04:31 CET 2006
3
Aceptar=Budi\u017e
4
Aplicar=Pou\u017e\u00edt
5
Block_Size_=
6
Cancelar=Zru\u0161it
7
Compression_=
8
datum=Datum
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=Projekce
14
reference_system=Prostorov\u00fd referen\u010dn\u00ed syst\u00e9m
15
zone=Z\u00f3na
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text_fr.properties
1
#Translations for language [fr]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Accepter
4
Aplicar=Appliquer
5
Block_Size_=
6
Cancelar=Annuler
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text_de.properties
1
#Translations for language [de]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=OK
4
Aplicar=Anwenden
5
Block_Size_=
6
Cancelar=Abbrechen
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/config/org/cresques/resources/i18n/text_eu.properties
1
#Translations for language [eu]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Ados
4
Aplicar=Aplikatu
5
Block_Size_=
6
Cancelar=Utzi
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2011/libraries/libProjection/resources-test/log4j.xml
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
5

  
6
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
7
		<layout class="org.apache.log4j.PatternLayout">
8
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
9
		</layout>
10
	</appender>
11

  
12
	<category name="org.gvsig.tools">
13
		<priority value="DEBUG" />
14
	</category>
15
	<category name="org.cresques">
16
		<priority value="DEBUG" /> 
17
	</category>
18
	<category name="org.gvsig.fmap.crs">
19
		<priority value="DEBUG" /> 
20
	</category>
21

  
22
	<root>
23
		<priority value="INFO" />
24
		<appender-ref ref="CONSOLE" />
25
	</root>
26
</log4j:configuration>
tags/v2_0_0_Build_2011/libraries/libProjection/src/org/cresques/Messages.java
1
/* Cresques Mapping Suite. Graphic Library for constructing mapping applications.
2
* Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
3
*
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
17
*
18
* For more information, contact:
19
*
20
*  Generalitat Valenciana
21
*   Conselleria d'Infraestructures i Transport
22
*   Av. Blasco Ib??ez, 50
23
*   46010 VALENCIA
24
*   SPAIN
25
*
26
*      +34 963862235
27
*   gvsig@gva.es
28
*      www.gvsig.gva.es
29
*
30
*    or
31
*
32
*   IVER T.I. S.A
33
*   Salamanca 50
34
*   46005 Valencia
35
*   Spain
36
*
37
*   +34 963163400
38
*   dac@iver.es
39
*/
40

  
41

  
42
package org.cresques;
43

  
44
import java.util.Locale;
45

  
46
/**
47
* Bridge class to provide internationalization services to the library.
48
* It uses the gvsig-i18n library as a backend, and includes its
49
* necessary initialization.
50
* 
51
* @author Cesar Martinez Izquierdo
52
*
53
*/
54
public class Messages {
55
	/**
56
	 * Whether the class has been initialized
57
	 */
58
	private static boolean isInitialized = false;
59
	
60
	/**
61
	 * The name of the Java package containing this class
62
	 */
63
//	private static final String packageName = Messages.class.getName() ;
64
	
65
	/**
66
	 * Loads the translations in the dictionary. It initializes the backend
67
	 * gvsig-i18n library
68
	 *
69
	 */
70
	private static void init() {
71
		if (!org.gvsig.i18n.Messages.hasLocales()) {
72
			org.gvsig.i18n.Messages.addLocale(Locale.getDefault());
73
		}
74
		org.gvsig.i18n.Messages.addResourceFamily("org.cresques.resources.i18n.text", Messages.class.getClassLoader(), Messages.class.getClass().getName());
75
	}
76
	
77
	/**
78
	 * Gets the translation associated with the provided translation key.
79
	 * 
80
	 * @param key The translation key which identifies the target text
81
	 * @return The translation associated with the provided translation key.
82
	 */
83
	public static String getText(String key) {
84
		if (isInitialized==false) {
85
			init();
86
			isInitialized = true;
87
		}
88
		return org.gvsig.i18n.Messages.getText(key, Messages.class.getName());
89
	}
90

  
91
}
92

  
0 93

  
tags/v2_0_0_Build_2011/libraries/libProjection/src/org/cresques/px/Extent.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.px;
25

  
26
import java.awt.geom.Point2D;
27
import java.awt.geom.Rectangle2D;
28

  
29
import java.text.DecimalFormat;
30

  
31
/**
32
 *	Clase que getiona el extent de una imagen
33
 *	
34
 *  @author Luis W.Sevilla (sevilla_lui@gva.es)
35
 */
36
public class Extent {
37
    Point2D min = null;
38
    Point2D max = null;
39

  
40
    /**
41
     * Constructor sin par?metros
42
     */
43
    public Extent() {
44
        min = new Point2D.Double(999999999.0, 999999999.0);
45
        max = new Point2D.Double(-999999999.0, -999999999.0);
46
    }
47

  
48
    /**
49
     * Constructor 
50
     * @param pt1	punto que representa la esquina superior izquierda
51
     * @param pt2	punto que representa la esquina inferior derecha
52
     */
53
    public Extent(Point2D pt1, Point2D pt2) {
54
        newExtent(pt1.getX(), pt1.getY(), pt2.getX(), pt2.getY());
55
    }
56

  
57
    /**
58
     * Contructor
59
     * @param x1 punto que representa la coordenada X de la esquina superior izquierda
60
     * @param y1 punto que representa la coordenada Y de la esquina superior izquierda
61
     * @param x2 punto que representa la coordenada X de la esquina inferior derecha
62
     * @param y2 punto que representa la coordenada Y de la esquina inferior derecha
63
     */
64
    public Extent(double x1, double y1, double x2, double y2) {
65
        newExtent(x1, y1, x2, y2);
66
    }
67

  
68
    /**
69
     * Constructor
70
     * @param r	Rectangulo 2D
71
     */
72
    public Extent(Rectangle2D r) {
73
        newExtent(r.getX(), r.getY(), r.getX() + r.getWidth(),
74
                  r.getY() + r.getHeight());
75
    }
76

  
77
    /**
78
     * Constructor de copia
79
     * @param ext	Objeto Extent
80
     */
81
    public Extent(Extent ext) {
82
        newExtent(ext.minX(), ext.minY(), ext.maxX(), ext.maxY());
83
    }
84

  
85
    /**
86
     * Crea un objeto extent identico y lo retorna
87
     * @return Objeto extent
88
     */
89
    public Object clone() {
90
        Extent e = (Extent) clone();
91
        e.min = (Point2D) min.clone();
92
        e.max = (Point2D) max.clone();
93

  
94
        return e;
95
    }
96

  
97
    private void newExtent(double x1, double y1, double x2, double y2) {
98
        min = new Point2D.Double(Math.min(x1, x2), Math.min(y1, y2));
99
        max = new Point2D.Double(Math.max(x1, x2), Math.max(y1, y2));
100
    }
101

  
102
    /**
103
     * Obtiene la coordenada X m?nima
104
     * @return valor de la coordenada X m?nima
105
     */
106
    public double minX() {
107
        return min.getX();
108
    }
109

  
110
    /**
111
     * Obtiene la coordenada Y m?nima
112
     * @return valor de la coordenada X m?nima
113
     */
114
    public double minY() {
115
        return min.getY();
116
    }
117

  
118
    /**
119
     * Obtiene la coordenada X m?xima
120
     * @return valor de la coordenada X m?xima
121
     */
122
    public double maxX() {
123
        return max.getX();
124
    }
125

  
126
    /**
127
     * Obtiene la coordenada Y m?xima
128
     * @return valor de la coordenada Y m?xima
129
     */
130
    public double maxY() {
131
        return max.getY();
132
    }
133
    
134
    /**
135
     * Obtiene el punto m?nimo
136
     * @return m?nimo
137
     */
138
    public Point2D getMin() {
139
        return min;
140
    }
141

  
142
    /**
143
     * Obtiene el punto m?ximo
144
     * @return m?ximo
145
     */
146
    public Point2D getMax() {
147
        return max;
148
    }
149

  
150
    public boolean isAt(Point2D pt) {
151
        if (pt.getX() < minX()) {
152
            return false;
153
        }
154

  
155
        if (pt.getX() > maxX()) {
156
            return false;
157
        }
158

  
159
        if (pt.getY() < minY()) {
160
            return false;
161
        }
162

  
163
        if (pt.getY() > maxY()) {
164
            return false;
165
        }
166

  
167
        return true;
168
    }
169

  
170
    public double width() {
171
        return Math.abs(maxX() - minX());
172
    }
173

  
174
    public double height() {
175
        return Math.abs(maxY() - minY());
176
    }
177

  
178
    /**
179
     * Verifica un punto, y modifica el extent si no est? incluido
180
     */
181
    public void add(Point2D pt) {
182
        if (pt == null) {
183
            return;
184
        }
185

  
186
        min.setLocation(Math.min(pt.getX(), minX()), Math.min(pt.getY(), minY()));
187
        max.setLocation(Math.max(pt.getX(), maxX()), Math.max(pt.getY(), maxY()));
188
    }
189

  
190
    public void add(Extent ext) {
191
        if (ext == null) {
192
            return;
193
        }
194

  
195
        min.setLocation(Math.min(ext.minX(), minX()),
196
                        Math.min(ext.minY(), minY()));
197
        max.setLocation(Math.max(ext.maxX(), maxX()),
198
                        Math.max(ext.maxY(), maxY()));
199
    }
200

  
201
    /**
202
     * Obtiene la escala
203
     * @param width	Ancho
204
     * @param height	Alto
205
     * @return
206
     */
207
    public double[] getScale(int width, int height) {
208
        return getScale((double) width, (double) height);
209
    }
210

  
211
    public double[] getScale(double width, double height) {
212
        double[] scale = new double[2];
213
        scale[0] = ((float) width) / width();
214
        scale[1] = ((float) height) / height();
215

  
216
        return scale;
217
    }
218

  
219
    public Rectangle2D toRectangle2D() {
220
        return new Rectangle2D.Double(minX(), minY(), width(), height());
221
    }
222

  
223
    public String toString() {
224
        DecimalFormat format = new DecimalFormat("####.000");
225

  
226
        return "Extent: (" + format.format(minX()) + "," +
227
               format.format(minY()) + "), (" + format.format(maxX()) + "," +
228
               format.format(maxY()) + ")";
229
    }
230

  
231
    public interface Has {
232
        public Extent getExtent();
233
    }
234
}
0 235

  
tags/v2_0_0_Build_2011/libraries/libProjection/src/org/cresques/px/.cvsignore
1
*.dfPackage
2
*.wmf
0 3

  
tags/v2_0_0_Build_2011/libraries/libProjection/src/org/cresques/px/package.html
1
<html>
2
	<body>Pixel: Clases para dibujar.
3
</body>
4
</html>
0 5

  
tags/v2_0_0_Build_2011/libraries/libProjection/src/org/cresques/cts/IProjection.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.cts;
25

  
26
import org.cresques.geo.ViewPortData;
27

  
28
import java.awt.Color;
29
import java.awt.Graphics2D;
30
import java.awt.geom.Point2D;
31
import java.awt.geom.Rectangle2D;
32

  
33

  
34
/**
35
 *
36
 * @author "Luis W. Sevilla" (sevilla_lui@gva.es)
37
 */
38
public interface IProjection {
39

  
40
    public IDatum getDatum();
41

  
42
    public Point2D createPoint(double x, double y);
43

  
44
    // TODO Quitar si no son necesarias.
45
    public String getAbrev();
46
    
47
    /**
48
     * Devuelve getAbrev() mas los parametros de transformacion si los hay
49
     * ej.: (EPSG:23030:proj@+proj...@...)
50
     * 
51
     * @return getAbrev() o getAbrev()+parametros
52
     */
53
    public String getFullCode();
54

  
55
    public void drawGrid(Graphics2D g, ViewPortData vp);
56

  
57
    public void setGridColor(Color c);
58

  
59
    public Color getGridColor();
60

  
61
    /**
62
     * Crea un ICoordTrans para transformar coordenadas
63
     * desde el IProjection actual al dest.
64
     * @param dest
65
     * @return
66
     */
67

  
68
    public ICoordTrans getCT(IProjection dest);
69

  
70
    public Point2D toGeo(Point2D pt);
71

  
72
    public Point2D fromGeo(Point2D gPt, Point2D mPt);
73

  
74
    public boolean isProjected();
75

  
76
    public double getScale(double minX, double maxX, double width, double dpi);
77
    public Rectangle2D getExtent(Rectangle2D extent,double scale,double wImage,double hImage,double mapUnits,double distanceUnits,double dpi);
78
}
0 79

  
tags/v2_0_0_Build_2011/libraries/libProjection/src/org/cresques/cts/UTM.java
1
package org.cresques.cts;
2

  
3
public interface UTM extends IProjection {
4

  
5
}
0 6

  
tags/v2_0_0_Build_2011/libraries/libProjection/src/org/cresques/cts/ICoordTrans.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.cts;
25

  
26
import java.awt.geom.Point2D;
27
import java.awt.geom.Rectangle2D;
28

  
29

  
30
/**
31
 * @author "Luis W. Sevilla" (sevilla_lui@gva.es)
32
 */
33
public interface ICoordTrans {
34
    public IProjection getPOrig();
35

  
36
    public IProjection getPDest();
37

  
38
    public Point2D convert(Point2D ptOrig, Point2D ptDest);
39

  
40
    public Rectangle2D convert(Rectangle2D rect);
41

  
42
    public ICoordTrans getInverted();
43
}
0 44

  
tags/v2_0_0_Build_2011/libraries/libProjection/src/org/cresques/cts/ICRSFactory.java
1
package org.cresques.cts;
2

  
3
public interface ICRSFactory {
4
	
5
	public boolean doesRigurousTransformations();
6
	
7
    /**
8
     * Devuelve una proyeccion a partir de una cadena.
9
     * @param name abreviatura de la proyecccion (i.e. EPSG:23030)
10
     * @return Proyeccion si existe
11
     */
12
    public IProjection get(String name);
13
}
0 14

  
tags/v2_0_0_Build_2011/libraries/libProjection/src/org/cresques/cts/GeoCalc.java
1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.cts;
25

  
26
import java.awt.geom.Point2D;
27

  
28

  
29
/**
30
 * Operaciones relacionadas con las proyecciones y sistemas
31
 * de coordenadas.
32
 *
33
 * cmartinez: Esta clase no deber?a formar parte de una API, pero
34
 * se deja hasta que se aborde el refactoring de libProjection.
35
 *
36
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
37
 */
38
public class GeoCalc {
39
    IProjection proj;
40

  
41
    /**
42
     *
43
     * @param proj
44
     */
45
    public GeoCalc(IProjection proj) {
46
        this.proj = proj;
47
    }
48

  
49
    /* (non-Javadoc)
50
	 * @see org.cresques.impl.cts.GeoCalc#distanceGeo(java.awt.geom.Point2D, java.awt.geom.Point2D)
51
	 */
52
    public double distanceGeo(Point2D pt1, Point2D pt2) {
53
        double R2 = Math.pow(proj.getDatum().getESemiMajorAxis(), 2);
54
        double dLat = Math.toRadians(pt2.getY() - pt1.getY());
55
        double dLong = Math.toRadians(pt2.getX() - pt1.getX());
56

  
57
        double alfa = Math.toRadians(pt1.getY());
58
        double alfa2 = Math.toRadians(pt2.getY());
59

  
60
        if (Math.abs(alfa2) < Math.abs(alfa)) {
61
            alfa = alfa2;
62
        }
63

  
64
        double ds2 = (R2 * dLat * dLat) +
65
                     (R2 * Math.cos(alfa) * Math.cos(alfa) * dLong * dLong);
66

  
67
        return Math.sqrt(ds2);
68
    }
69

  
70
    /* (non-Javadoc)
71
	 * @see org.cresques.impl.cts.GeoCalc#distanceEli(java.awt.geom.Point2D, java.awt.geom.Point2D)
72
	 */
73
    public double distanceEli(Point2D pt1, Point2D pt2) {
74
        double lat1 = Math.toRadians(pt1.getY());
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff