Revision 1242

View differences:

org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/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/xsd/maven-4.0.0.xsd">
3
    <modelVersion>4.0.0</modelVersion>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.projection.api</artifactId>
6
    <version>2.0.47</version>
7
    <packaging>jar</packaging>
8
    <name>${project.artifactId}</name>
9

  
10
    <licenses>
11
        <license>
12
            <name>GPLv3</name>
13
            <url>http://www.gnu.org/licenses/gpl.html</url>
14
            <distribution>repo</distribution>
15
            <comments>
16
                "GPL" stands for "General Public License". The most widespread such
17
                license is the GNU General Public License, or GNU GPL for short.
18
                This can be further shortened to "GPL", when it is understood that
19
                the GNU GPL is the one intended.
20
            </comments>
21
        </license>
22
    </licenses>
23

  
24
    <organization>
25
        <name>gvSIG Association</name>
26
        <url>http://www.gvsig.com/</url>
27
    </organization>
28

  
29
    <scm>
30
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-jcrs/org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47</connection>
31
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-jcrs/org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47</developerConnection>
32
        <url>https://devel.gvsig.org/redmine/projects/gvsig-jcrs/repository/show/org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47</url>
33
    </scm>
34

  
35
    <repositories>
36
        <repository>
37
            <id>gvsig-public-http-repository</id>
38
            <name>gvSIG maven public HTTP repository</name>
39
            <url>http://devel.gvsig.org/m2repo/j2se</url>
40
            <releases>
41
                <enabled>true</enabled>
42
                <updatePolicy>daily</updatePolicy>
43
                <checksumPolicy>warn</checksumPolicy>
44
            </releases>
45
            <snapshots>
46
                <enabled>true</enabled>
47
                <updatePolicy>daily</updatePolicy>
48
                <checksumPolicy>warn</checksumPolicy>
49
            </snapshots>
50
        </repository>
51
    </repositories>
52

  
53
    <distributionManagement>
54
        <site>
55
            <id>gvsig-repository</id>
56
            <url>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</url>
57
        </site>
58
        <repository>
59
            <id>gvsig-repository</id>
60
            <name>gvSIG maven repository</name>
61
            <url>dav:https://devel.gvsig.org/m2repo/j2se</url>
62
            <uniqueVersion>false</uniqueVersion>
63
        </repository>
64
        <snapshotRepository>
65
            <id>gvsig-repository</id>
66
            <name>gvSIG maven repository</name>
67
            <url>dav:https://devel.gvsig.org/m2repo/j2se</url>
68
            <uniqueVersion>false</uniqueVersion>
69
        </snapshotRepository>
70
    </distributionManagement>
71

  
72
    <issueManagement>
73
        <system>redmine</system>
74
        <url>https://devel.gvsig.org/redmine/projects/gvsig-jcrs</url>
75
    </issueManagement>
76

  
77

  
78
    <mailingLists>
79
        <mailingList>
80
            <name>User List</name>
81
            <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_usuarios</subscribe>
82
            <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_usuarios</unsubscribe>
83
            <post>gvsig_usuarios@listserv.gva.es</post>
84
            <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
85
            <otherArchives>
86
                <otherArchive>http://www.mail-archive.com/gvsig_usuarios@runas.cap.gva.es</otherArchive>
87
                <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
88
            </otherArchives>
89
        </mailingList>
90
        <mailingList>
91
            <name>Developer List</name>
92
            <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores</subscribe>
93
            <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores</unsubscribe>
94
            <post>gvsig_desarrolladores@listserv.gva.es</post>
95
            <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
96
            <otherArchives>
97
                <otherArchive>http://www.mail-archive.com/gvsig_desarrolladores@runas.cap.gva.es</otherArchive>
98
                <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
99
            </otherArchives>
100
        </mailingList>
101
        <mailingList>
102
            <name>International List</name>
103
            <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</subscribe>
104
            <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</unsubscribe>
105
            <post>gvsig_internacional@listserv.gva.es</post>
106
            <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
107
            <otherArchives>
108
                <otherArchive>http://www.mail-archive.com/gvsig_internacional@runas.cap.gva.es</otherArchive>
109
                <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
110
            </otherArchives>
111
        </mailingList>
112
    </mailingLists>
113

  
114
    <developers>
115
        <developer>
116
            <id>jjdelcerro</id>
117
            <name>Joaquín José del Cerro</name>
118
            <email>jjdelcerro@gvsig.com</email>
119
            <roles>
120
                <role>Architect</role>
121
                <role>Developer</role>
122
            </roles>
123
        </developer>
124
        <developer>
125
            <id>cordinayana</id>
126
            <name>Cèsar Ordiñana</name>
127
            <email>cordinyana@gvsig.com</email>
128
            <roles>
129
                <role>Architect</role>
130
                <role>Developer</role>
131
            </roles>
132
        </developer>
133
    </developers>
134

  
135
    <dependencyManagement>
136
        <dependencies>
137
            <dependency>
138
                <groupId>junit</groupId>
139
                <artifactId>junit</artifactId>
140
                <version>3.8.1</version>
141
            </dependency>
142
            <dependency>
143
                <groupId>org.gvsig</groupId>
144
                <artifactId>org.gvsig.tools.lib</artifactId>
145
                <version>${gvsig.tools.version}</version>
146
            </dependency>
147

  
148
        </dependencies>
149
    </dependencyManagement>
150

  
151
    <dependencies>
152
        <dependency>
153
            <groupId>org.gvsig</groupId>
154
            <artifactId>org.gvsig.tools.lib</artifactId>
155
        </dependency>
156
        <dependency>
157
            <groupId>junit</groupId>
158
            <artifactId>junit</artifactId>
159
            <scope>test</scope>
160
        </dependency>            
161
    </dependencies>
162

  
163
    <build>
164
        <extensions>
165
            <extension>
166
                <groupId>org.apache.maven.wagon</groupId>
167
                <artifactId>wagon-webdav-jackrabbit</artifactId>
168
                <version>2.4</version>
169
            </extension>
170
        </extensions>
171
        <pluginManagement>
172
            <plugins>
173

  
174
                <plugin>
175
                    <groupId>org.apache.maven.plugins</groupId>
176
                    <artifactId>maven-surefire-plugin</artifactId>
177
                    <version>2.7.1</version>
178
                    <configuration>
179
                        <forkMode>once</forkMode>
180
                    </configuration>
181
                </plugin>
182
                <plugin>
183
                    <groupId>org.apache.maven.plugins</groupId>
184
                    <artifactId>maven-compiler-plugin</artifactId>
185
                    <version>2.3.2</version>
186
                    <configuration>
187
                        <source>1.5</source>
188
                        <target>1.5</target>
189
                        <encoding>ISO-8859-1</encoding>
190
                    </configuration>
191
                </plugin>
192

  
193
                <plugin>
194
                    <groupId>org.apache.maven.plugins</groupId>
195
                    <artifactId>maven-resources-plugin</artifactId>
196
                    <version>2.4.3</version>
197
                    <configuration>
198
                        <encoding>ISO-8859-1</encoding>
199
                    </configuration>
200
                </plugin>
201

  
202
                <plugin>
203
                    <groupId>org.apache.maven.plugins</groupId>
204
                    <artifactId>maven-javadoc-plugin</artifactId>
205
                    <version>2.9</version>
206
                    <configuration>
207
                        <docTitle>${project.name} ${project.version}</docTitle>
208
                        <encoding>ISO-8859-1</encoding>
209
                        <footer />
210
                        <header />
211
                        <keywords>true</keywords>
212
                        <detectLinks>true</detectLinks>
213
                        <javaApiLinks>
214
                            <property>
215
                                <name>api_1.4</name>
216
                                <value>http://download.oracle.com/javase/1.4.2/docs/api/</value>
217
                            </property>
218
                            <property>
219
                                <name>api_1.5</name>
220
                                <value>http://download.oracle.com/javase/1.5.0/docs/api/</value>
221
                            </property>
222
                            <property>
223
                                <name>api_1.6</name>
224
                                <value>http://download.oracle.com/javase/6/docs/api/</value>
225
                            </property>
226
                        </javaApiLinks>
227
                    </configuration>
228
                </plugin>
229

  
230
                <plugin>
231
                    <groupId>org.apache.maven.plugins</groupId>
232
                    <artifactId>maven-site-plugin</artifactId>
233
                    <configuration>
234
                        <chmod>true</chmod>
235
                        <chmodMode>a+rwX</chmodMode>
236
                    </configuration>
237
                </plugin>
238

  
239
                <plugin>
240
                    <groupId>org.apache.maven.plugins</groupId>
241
                    <artifactId>maven-jar-plugin</artifactId>
242
                    <version>2.3.1</version>
243
                    <configuration>
244
                        <archive>
245
                            <manifestEntries>
246
                                <Built-By>gvSIG Team</Built-By>
247
                            </manifestEntries>
248
                        </archive>
249
                    </configuration>
250
                </plugin>
251

  
252
                <plugin>
253
                    <groupId>org.codehaus.mojo</groupId>
254
                    <artifactId>properties-maven-plugin</artifactId>
255
                    <version>1.0-alpha-2</version>
256
                </plugin>
257

  
258
                <plugin>
259
                    <groupId>org.codehaus.gmaven</groupId>
260
                    <artifactId>gmaven-plugin</artifactId>
261
                    <version>1.4</version>
262
                </plugin>
263

  
264
                <plugin>
265
                    <groupId>org.apache.maven.plugins</groupId>
266
                    <artifactId>maven-antrun-plugin</artifactId>
267
                    <version>1.7</version>
268
                </plugin>
269

  
270
                <plugin>
271
                    <groupId>org.codehaus.mojo</groupId>
272
                    <artifactId>animal-sniffer-maven-plugin</artifactId>
273
                    <version>1.9</version>
274
                </plugin>
275

  
276
                <plugin>
277
                    <groupId>org.apache.maven.plugins</groupId>
278
                    <artifactId>maven-release-plugin</artifactId>
279
                    <version>2.1</version>
280
                </plugin>
281

  
282
                <plugin>
283
                    <groupId>org.apache.maven.plugins</groupId>
284
                    <artifactId>maven-assembly-plugin</artifactId>
285
                    <version>2.2-beta-5</version>
286
                </plugin>
287

  
288
                <plugin>
289
                    <groupId>org.apache.maven.plugins</groupId>
290
                    <artifactId>maven-clean-plugin</artifactId>
291
                    <version>2.4.1</version>
292
                </plugin>
293

  
294
                <plugin>
295
                    <groupId>org.codehaus.mojo</groupId>
296
                    <artifactId>exec-maven-plugin</artifactId>
297
                    <version>1.2</version>
298
                </plugin>
299

  
300
                <plugin>
301
                    <!-- invoke as "mvn license:format" to fix the header -->
302
                    <!-- invoke as "mvn license:check" to check the header -->
303
                    <!-- See http://code.google.com/p/maven-license-plugin/wiki/Configuration -->
304
                    <groupId>com.mycila.maven-license-plugin</groupId>
305
                    <artifactId>maven-license-plugin</artifactId>
306
                    <version>1.10.b1</version>
307
                    <configuration>
308
                        <header>/src/main/config/header.txt</header>
309
                        <failIfMissing>false</failIfMissing>
310
                        <aggregate>false</aggregate>
311
                        <strictCheck>true</strictCheck>
312
                        <encoding>ISO-8859-1</encoding>
313
                        <quiet>false</quiet>
314
                        <excludes>
315
                            <exclude>**/*.properties</exclude>
316
                            <exclude>**/*.txt</exclude>
317
                            <exclude>**/*.jpg</exclude>
318
                            <exclude>**/*.jpeg</exclude>
319
                            <exclude>**/*.svg</exclude>
320
                            <exclude>**/*.png</exclude>
321
                            <exclude>**/*.gvssym</exclude>
322
                            <exclude>**/*.def</exclude>
323
                            <exclude>**/*.msg</exclude>
324
                        </excludes>
325
                    </configuration>
326
                </plugin>
327

  
328
                <plugin>
329
                    <groupId>org.apache.maven.plugins</groupId>
330
                    <artifactId>maven-source-plugin</artifactId>
331
                    <version>2.2.1</version>
332
                </plugin>
333

  
334
            </plugins>
335
        </pluginManagement>
336

  
337
        <plugins>
338
            <plugin>
339
                <groupId>org.apache.maven.plugins</groupId>
340
                <artifactId>maven-jar-plugin</artifactId>
341
                <configuration>
342
                </configuration>
343
                <executions>
344
                    <!-- Generates a jar file only with the test classes -->
345
                    <execution>
346
                        <goals>
347
                            <goal>test-jar</goal>
348
                        </goals>
349
                    </execution>
350
                </executions>
351
            </plugin>
352

  
353
            <plugin>
354
                <groupId>org.apache.maven.plugins</groupId>
355
                <artifactId>maven-release-plugin</artifactId>
356
                <configuration>
357
                    <tagBase>https://devel.gvsig.org/svn/gvsig-jcrs/${gvsig.projection.svnroot}/tags/</tagBase>
358
                    <!-- This is a 2.0 beta 6 bug. By default the goals are 'clean verify', so the modules
359
                    are not installed, so the dependencies between modules are not met. With this configuration
360
                    we force the module installation. -->
361
                    <preparationGoals>clean install</preparationGoals>
362
                    <autoVersionSubmodules>true</autoVersionSubmodules>
363
                </configuration>
364
            </plugin>
365

  
366
            <plugin>
367
                <!-- to continue building  when test fail -->
368
                <groupId>org.apache.maven.plugins</groupId>
369
                <artifactId>maven-surefire-plugin</artifactId>
370
                <configuration>
371
                    <testFailureIgnore>true</testFailureIgnore>
372
                </configuration>
373
            </plugin>
374
        </plugins>
375
    </build>
376

  
377
    <reporting>
378
        <excludeDefaults>true</excludeDefaults>
379
        <plugins>
380
            <plugin>
381
                <groupId>org.apache.maven.plugins</groupId>
382
                <artifactId>maven-project-info-reports-plugin</artifactId>
383
                <version>2.7</version>
384
            </plugin>
385
            <plugin>
386
                <groupId>org.apache.maven.plugins</groupId>
387
                <artifactId>maven-javadoc-plugin</artifactId>
388
                <version>2.9</version>
389
            </plugin>
390
            <plugin>
391
                <groupId>org.apache.maven.plugins</groupId>
392
                <artifactId>maven-jxr-plugin</artifactId>
393
                <version>2.3</version>
394
                <configuration>
395
                    <linkJavadoc>true</linkJavadoc>
396
                </configuration>
397
            </plugin>
398
        </plugins>
399
    </reporting>
400

  
401

  
402
    <properties>
403
        <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
404
        <localRepository>${user.home}/.m2/repository</localRepository>
405
        <site-repository>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</site-repository>
406

  
407
        <gvsig.projection.svnroot>org.gvsig.projection</gvsig.projection.svnroot>
408
        <gvsig.tools.version>3.0.252</gvsig.tools.version>
409
    </properties>
410

  
411
</project>
412

  
0 413

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2013 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 3
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
28

  
29
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
30

  
31
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
32
		<layout class="org.apache.log4j.PatternLayout">
33
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
34
		</layout>
35
	</appender>
36

  
37
	<category name="org.gvsig.tools">
38
		<priority value="DEBUG" />
39
	</category>
40
	<category name="org.cresques">
41
		<priority value="DEBUG" /> 
42
	</category>
43
	<category name="org.gvsig.fmap.crs">
44
		<priority value="DEBUG" /> 
45
	</category>
46

  
47
	<root>
48
		<priority value="INFO" />
49
		<appender-ref ref="CONSOLE" />
50
	</root>
51
</log4j:configuration>
0 52

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/test/java/org/cresques/cts/AllTests.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.cresques.cts;
25

  
26
import junit.framework.Test;
27
import junit.framework.TestSuite;
28

  
29
public class AllTests {
30

  
31
	public static Test suite() {
32
		TestSuite suite = new TestSuite("Test for org.cresques.cts");
33
		//$JUnit-BEGIN$
34

  
35
		//$JUnit-END$
36
		return suite;
37
	}
38

  
39
}
0 40

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/cts/GeoCalc.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.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());
75
        double lon1 = -Math.toRadians(pt1.getX());
76
        double lat2 = Math.toRadians(pt2.getY());
77
        double lon2 = -Math.toRadians(pt2.getX());
78

  
79
        double F = (lat1 + lat2) / 2D;
80
        double G = (lat1 - lat2) / 2D;
81
        double L = (lon1 - lon2) / 2D;
82

  
83
        double sing = Math.sin(G);
84
        double cosl = Math.cos(L);
85
        double cosf = Math.cos(F);
86
        double sinl = Math.sin(L);
87
        double sinf = Math.sin(F);
88
        double cosg = Math.cos(G);
89

  
90
        double flat = 1D / proj.getDatum().getEIFlattening();
91

  
92
        double S = (sing * sing * cosl * cosl) + (cosf * cosf * sinl * sinl);
93
        double C = (cosg * cosg * cosl * cosl) + (sinf * sinf * sinl * sinl);
94
        double W = Math.atan2(Math.sqrt(S), Math.sqrt(C));
95
        double R = Math.sqrt((S * C)) / W;
96
        double H1 = ((3D * R) - 1D) / (2D * C);
97
        double H2 = ((3D * R) + 1D) / (2D * S);
98
        double D = 2D * W * proj.getDatum().getESemiMajorAxis();
99

  
100
        return (D * ((1D + (flat * H1 * sinf * sinf * cosg * cosg)) -
101
               (flat * H2 * cosf * cosf * sing * sing)));
102
    }
103

  
104
    /**
105
     * Algrothims from Geocentric Datum of Australia Technical Manual
106
     *
107
     * http://www.anzlic.org.au/icsm/gdatum/chapter4.html
108
     *
109
     * This page last updated 11 May 1999
110
     *
111
     * Computations on the Ellipsoid
112
     *
113
     * There are a number of formulae that are available
114
     * to calculate accurate geodetic positions,
115
     * azimuths and distances on the ellipsoid.
116
     *
117
     * Vincenty's formulae (Vincenty, 1975) may be used
118
     * for lines ranging from a few cm to nearly 20,000 km,
119
     * with millimetre accuracy.
120
     * The formulae have been extensively tested
121
     * for the Australian region, by comparison with results
122
     * from other formulae (Rainsford, 1955 & Sodano, 1965).
123
     *
124
     * * Inverse problem: azimuth and distance from known
125
     *                 latitudes and longitudes
126
     * * Direct problem: Latitude and longitude from known
127
     *                 position, azimuth and distance.
128
     * * Sample data
129
     * * Excel spreadsheet
130
     *
131
     * Vincenty's Inverse formulae
132
     * Given: latitude and longitude of two points
133
     *                 (phi1, lembda1 and phi2, lembda2),
134
     * Calculate: the ellipsoidal distance (s) and
135
     * forward and reverse azimuths between the points (alpha12, alpha21).
136
     */
137
    /* (non-Javadoc)
138
	 * @see org.cresques.impl.cts.GeoCalc#distanceVincenty(java.awt.geom.Point2D, java.awt.geom.Point2D)
139
	 */
140
    public double distanceVincenty(Point2D pt1, Point2D pt2) {
141
        return distanceAzimutVincenty(pt1, pt2).dist;
142
    }
143

  
144
    /**
145
     * Returns the distance between two geographic points on the ellipsoid
146
     *        and the forward and reverse azimuths between these points.
147
     *       lats, longs and azimuths are in decimal degrees, distance in metres
148
     *        Returns ( s, alpha12,  alpha21 ) as a tuple
149
     * @param pt1
150
     * @param pt2
151
     * @return
152
     */
153
    protected GeoData distanceAzimutVincenty(Point2D pt1, Point2D pt2) {
154
        GeoData gd = new GeoData(0, 0);
155
        double f = 1D / proj.getDatum().getEIFlattening();
156
        double a = proj.getDatum().getESemiMajorAxis();
157
        double phi1 = pt1.getY();
158
        double lembda1 = pt1.getX();
159
        double phi2 = pt2.getY();
160
        double lembda2 = pt2.getX();
161

  
162
        if ((Math.abs(phi2 - phi1) < 1e-8) &&
163
                (Math.abs(lembda2 - lembda1) < 1e-8)) {
164
            return gd;
165
        }
166

  
167
        double piD4 = Math.atan(1.0);
168
        double two_pi = piD4 * 8.0;
169

  
170
        phi1 = (phi1 * piD4) / 45.0;
171
        lembda1 = (lembda1 * piD4) / 45.0; // unfortunately lambda is a key word!
172
        phi2 = (phi2 * piD4) / 45.0;
173
        lembda2 = (lembda2 * piD4) / 45.0;
174

  
175
        double b = a * (1.0 - f);
176

  
177
        double TanU1 = (1 - f) * Math.tan(phi1);
178
        double TanU2 = (1 - f) * Math.tan(phi2);
179

  
180
        double U1 = Math.atan(TanU1);
181
        double U2 = Math.atan(TanU2);
182

  
183
        double lembda = lembda2 - lembda1;
184
        double last_lembda = -4000000.0; // an impossibe value
185
        double omega = lembda;
186

  
187
        // Iterate the following equations,
188
        //  until there is no significant change in lembda
189
        double Sin_sigma = 0;
190

  
191
        // Iterate the following equations,
192
        //  until there is no significant change in lembda
193
        double Cos_sigma = 0;
194
        double Cos2sigma_m = 0;
195
        double alpha = 0;
196
        double sigma = 0;
197
        double sqr_sin_sigma = 0;
198

  
199
        while ((last_lembda < -3000000.0) ||
200
                   ((lembda != 0) &&
201
                   (Math.abs((last_lembda - lembda) / lembda) > 1.0e-9))) {
202
            sqr_sin_sigma = Math.pow(Math.cos(U2) * Math.sin(lembda), 2) +
203
                            Math.pow(((Math.cos(U1) * Math.sin(U2)) -
204
                                     (Math.sin(U1) * Math.cos(U2) * Math.cos(lembda))),
205
                                     2);
206

  
207
            Sin_sigma = Math.sqrt(sqr_sin_sigma);
208

  
209
            Cos_sigma = (Math.sin(U1) * Math.sin(U2)) +
210
                        (Math.cos(U1) * Math.cos(U2) * Math.cos(lembda));
211

  
212
            sigma = Math.atan2(Sin_sigma, Cos_sigma);
213

  
214
            double Sin_alpha = (Math.cos(U1) * Math.cos(U2) * Math.sin(lembda)) / Math.sin(sigma);
215
            alpha = Math.asin(Sin_alpha);
216

  
217
            Cos2sigma_m = Math.cos(sigma) -
218
                          ((2 * Math.sin(U1) * Math.sin(U2)) / Math.pow(Math.cos(alpha),
219
                                                                        2));
220

  
221
            double C = (f / 16) * Math.pow(Math.cos(alpha), 2) * (4 +
222
                       (f * (4 - (3 * Math.pow(Math.cos(alpha), 2)))));
223

  
224
            last_lembda = lembda;
225

  
226
            lembda = omega +
227
                     ((1 - C) * f * Math.sin(alpha) * (sigma +
228
                     (C * Math.sin(sigma) * (Cos2sigma_m +
229
                     (C * Math.cos(sigma) * (-1 +
230
                     (2 * Math.pow(Cos2sigma_m, 2))))))));
231
        }
232

  
233
        double u2 = (Math.pow(Math.cos(alpha), 2) * ((a * a) - (b * b))) / (b * b);
234

  
235
        double A = 1 +
236
                   ((u2 / 16384) * (4096 +
237
                   (u2 * (-768 + (u2 * (320 - (175 * u2)))))));
238

  
239
        double B = (u2 / 1024) * (256 +
240
                   (u2 * (-128 + (u2 * (74 - (47 * u2))))));
241

  
242
        double delta_sigma = B * Sin_sigma * (Cos2sigma_m +
243
                             ((B / 4) * ((Cos_sigma * (-1 +
244
                             (2 * Math.pow(Cos2sigma_m, 2)))) -
245
                             ((B / 6) * Cos2sigma_m * (-3 +
246
                             (4 * sqr_sin_sigma)) * (-3 +
247
                             (4 * Math.pow(Cos2sigma_m, 2)))))));
248

  
249
        double s = b * A * (sigma - delta_sigma);
250

  
251
        double alpha12 = Math.atan2((Math.cos(U2) * Math.sin(lembda)),
252
                                    ((Math.cos(U1) * Math.sin(U2)) -
253
                                    (Math.sin(U1) * Math.cos(U2) * Math.cos(lembda))));
254

  
255
        double alpha21 = Math.atan2((Math.cos(U1) * Math.sin(lembda)),
256
                                    ((-Math.sin(U1) * Math.cos(U2)) +
257
                                    (Math.cos(U1) * Math.sin(U2) * Math.cos(lembda))));
258

  
259
        if (alpha12 < 0.0) {
260
            alpha12 = alpha12 + two_pi;
261
        }
262

  
263
        if (alpha12 > two_pi) {
264
            alpha12 = alpha12 - two_pi;
265
        }
266

  
267
        alpha21 = alpha21 + (two_pi / 2.0);
268

  
269
        if (alpha21 < 0.0) {
270
            alpha21 = alpha21 + two_pi;
271
        }
272

  
273
        if (alpha21 > two_pi) {
274
            alpha21 = alpha21 - two_pi;
275
        }
276

  
277
        alpha12 = (alpha12 * 45.0) / piD4;
278
        alpha21 = (alpha21 * 45.0) / piD4;
279

  
280
        return new GeoData(0, 0, s, alpha12, alpha21);
281
    }
282

  
283
    /**
284
     * Vincenty's Direct formulae
285
     * Given: latitude and longitude of a point (phi1, lembda1) and
286
     * the geodetic azimuth (alpha12)
287
     * and ellipsoidal distance in metres (s) to a second point,
288
     *
289
     * Calculate: the latitude and longitude of the second point (phi2, lembda2)
290
     * and the reverse azimuth (alpha21).
291
     */
292
	/**
293
	 * Returns the lat and long of projected point and reverse azimuth
294
	 *        given a reference point and a distance and azimuth to project.
295
	 *  lats, longs and azimuths are passed in decimal degrees.
296
	 * Returns ( phi2,  lambda2,  alpha21 ) as a tuple
297
	 * @param pt
298
	 * @param azimut
299
	 * @param dist
300
	 * @return
301
	 */
302
    protected GeoData getPointVincenty(Point2D pt, double azimut, double dist) {
303
        GeoData ret = new GeoData(0, 0);
304
        double f = 1D / proj.getDatum().getEIFlattening();
305
        double a = proj.getDatum().getESemiMajorAxis();
306
        double phi1 = pt.getY();
307
        double lembda1 = pt.getX();
308
        double alpha12 = azimut;
309
        double s = dist;
310

  
311
        double piD4 = Math.atan(1.0);
312
        double two_pi = piD4 * 8.0;
313

  
314
        phi1 = (phi1 * piD4) / 45.0;
315
        lembda1 = (lembda1 * piD4) / 45.0;
316
        alpha12 = (alpha12 * piD4) / 45.0;
317

  
318
        if (alpha12 < 0.0) {
319
            alpha12 = alpha12 + two_pi;
320
        }
321

  
322
        if (alpha12 > two_pi) {
323
            alpha12 = alpha12 - two_pi;
324
        }
325

  
326
        double b = a * (1.0 - f);
327

  
328
        double TanU1 = (1 - f) * Math.tan(phi1);
329
        double U1 = Math.atan(TanU1);
330
        double sigma1 = Math.atan2(TanU1, Math.cos(alpha12));
331
        double Sinalpha = Math.cos(U1) * Math.sin(alpha12);
332
        double cosalpha_sq = 1.0 - (Sinalpha * Sinalpha);
333

  
334
        double u2 = (cosalpha_sq * ((a * a) - (b * b))) / (b * b);
335
        double A = 1.0 +
336
                   ((u2 / 16384) * (4096 +
337
                   (u2 * (-768 + (u2 * (320 - (175 * u2)))))));
338
        double B = (u2 / 1024) * (256 +
339
                   (u2 * (-128 + (u2 * (74 - (47 * u2))))));
340

  
341
        // Starting with the approximation
342
        double sigma = (s / (b * A));
343

  
344
        double last_sigma = (2.0 * sigma) + 2.0; // something impossible
345

  
346
        // Iterate the following three equations
347
        //  until there is no significant change in sigma
348
        // two_sigma_m , delta_sigma
349
        double two_sigma_m = 0;
350

  
351
        while (Math.abs((last_sigma - sigma) / sigma) > 1.0e-9) {
352
            two_sigma_m = (2 * sigma1) + sigma;
353

  
354
            double delta_sigma = B * Math.sin(sigma) * (Math.cos(two_sigma_m) +
355
                                 ((B / 4) * (Math.cos(sigma) * ((-1 +
356
                                 (2 * Math.pow(Math.cos(two_sigma_m), 2))) -
357
                                 ((B / 6) * Math.cos(two_sigma_m) * (-3 +
358
                                 (4 * Math.pow(Math.sin(sigma), 2))) * (-3 +
359
                                 (4 * Math.pow(Math.cos(two_sigma_m), 2))))))));
360

  
361
            last_sigma = sigma;
362
            sigma = (s / (b * A)) + delta_sigma;
363
        }
364

  
365
        double phi2 = Math.atan2(((Math.sin(U1) * Math.cos(sigma)) +
366
                                 (Math.cos(U1) * Math.sin(sigma) * Math.cos(alpha12))),
367
                                 ((1 - f) * Math.sqrt(Math.pow(Sinalpha, 2) +
368
                                                      Math.pow((Math.sin(U1) * Math.sin(sigma)) -
369
                                                               (Math.cos(U1) * Math.cos(sigma) * Math.cos(alpha12)),
370
                                                               2))));
371

  
372
        double lembda = Math.atan2((Math.sin(sigma) * Math.sin(alpha12)),
373
                                   ((Math.cos(U1) * Math.cos(sigma)) -
374
                                   (Math.sin(U1) * Math.sin(sigma) * Math.cos(alpha12))));
375

  
376
        double C = (f / 16) * cosalpha_sq * (4 + (f * (4 - (3 * cosalpha_sq))));
377

  
378
        double omega = lembda -
379
                       ((1 - C) * f * Sinalpha * (sigma +
380
                       (C * Math.sin(sigma) * (Math.cos(two_sigma_m) +
381
                       (C * Math.cos(sigma) * (-1 +
382
                       (2 * Math.pow(Math.cos(two_sigma_m), 2))))))));
383

  
384
        double lembda2 = lembda1 + omega;
385

  
386
        double alpha21 = Math.atan2(Sinalpha,
387
                                    ((-Math.sin(U1) * Math.sin(sigma)) +
388
                                    (Math.cos(U1) * Math.cos(sigma) * Math.cos(alpha12))));
389

  
390
        alpha21 = alpha21 + (two_pi / 2.0);
391

  
392
        if (alpha21 < 0.0) {
393
            alpha21 = alpha21 + two_pi;
394
        }
395

  
396
        if (alpha21 > two_pi) {
397
            alpha21 = alpha21 - two_pi;
398
        }
399

  
400
        phi2 = (phi2 * 45.0) / piD4;
401
        lembda2 = (lembda2 * 45.0) / piD4;
402
        alpha21 = (alpha21 * 45.0) / piD4;
403

  
404
        ret.pt = new Point2D.Double(lembda2, phi2);
405
        ret.azimut = alpha21;
406

  
407
        return ret;
408
    }
409

  
410
    /* (non-Javadoc)
411
	 * @see org.cresques.impl.cts.GeoCalc#surfaceSphere(java.awt.geom.Point2D, java.awt.geom.Point2D, java.awt.geom.Point2D)
412
	 */
413
    public double surfaceSphere(Point2D pt1, Point2D pt2, Point2D pt3) {
414
        double sup = -1;
415
        double A = distanceGeo(pt1, pt2);
416
        double B = distanceGeo(pt2, pt3);
417
        double C = distanceGeo(pt3, pt1);
418
        sup = (((A + B + C) - Math.toRadians(180D)) * Math.PI * proj.getDatum()
419
                                                                    .getESemiMajorAxis()) / Math.toRadians(180D);
420

  
421
        return sup;
422
    }
423

  
424
    /*
425
     * F?rmulas de Vincenty's.
426
     * (pasadas de http://wegener.mechanik.tu-darmstadt.de/GMT-Help/Archiv/att-8710/Geodetic_py
427
     * http://www.icsm.gov.au/icsm/gda/gdatm/index.html
428
     */
429
    protected class GeoData {
430
        Point2D pt;
431
        double azimut;
432
        double revAzimut;
433
        double dist;
434

  
435
        public GeoData(double x, double y) {
436
            pt = new Point2D.Double(x, y);
437
            azimut = revAzimut = dist = 0;
438
        }
439

  
440
        public GeoData(double x, double y, double dist, double azi, double rAzi) {
441
            pt = new Point2D.Double(x, y);
442
            azimut = azi;
443
            revAzimut = rAzi;
444
            this.dist = dist;
445
        }
446
    }
447
}
0 448

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/cts/package.html
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
<html>
27
	<body>Clases relacionadas con el manejo de proyecciones.
28
</body>
29
</html>
0 30

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/cts/CoordTransRuntimeException.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
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., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.cresques.cts;
24

  
25
/**
26
 * @author fdiaz
27
 *
28
 */
29
public class CoordTransRuntimeException extends RuntimeException {
30

  
31
    /**
32
     *
33
     */
34
    private static final long serialVersionUID = 1348981767734366776L;
35
    IProjection source;
36
    IProjection target;
37
    double x;
38
    double y;
39

  
40
    /**
41
     *
42
     */
43
    public CoordTransRuntimeException(IProjection source, IProjection target, double x, double y, Throwable cause) {
44
        super("Error reprojecting point (" + x + "," + y + ") from " + source.getAbrev() + " to " + target.getAbrev()
45
            + ".", cause);
46
        this.source = source;
47
        this.target = target;
48
        this.x = x;
49
        this.y = y;
50
    }
51

  
52
    /**
53
    *
54
    */
55
    public CoordTransRuntimeException(IProjection source, IProjection target, double x, double y) {
56
        this(source, target, x, y, null);
57
    }
58

  
59
    /**
60
     * @return the source
61
     */
62
    public IProjection getSource() {
63
        return source;
64
    }
65

  
66
    /**
67
     * @return the target
68
     */
69
    public IProjection getTarget() {
70
        return target;
71
    }
72

  
73
    /**
74
     * @return the x
75
     */
76
    public double getX() {
77
        return x;
78
    }
79

  
80
    /**
81
     * @return the y
82
     */
83
    public double getY() {
84
        return y;
85
    }
86

  
87
}
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/cts/IDatum.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.cresques.cts;
25

  
26

  
27
/**
28
 * @author "Luis W. Sevilla" (sevilla_lui@gva.es)
29
 */
30
public interface IDatum {
31
    /**
32
     * Semieje Mayor del elipsoide.
33
     * @return
34
     */
35
    public double getESemiMajorAxis();
36

  
37
    /**
38
     * Aplanamiento del elipsoide.
39
     * @return
40
     */
41
    public double getEIFlattening();
42
}
0 43

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/cts/IProjection.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.cresques.cts;
25

  
26
import java.awt.Color;
27
import java.awt.Graphics2D;
28
import java.awt.geom.Point2D;
29
import java.awt.geom.Rectangle2D;
30

  
31
import org.cresques.geo.ViewPortData;
32

  
33
import org.gvsig.tools.lang.Cloneable;
34

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

  
41
    /**
42
     * Return the string representation of projection in the format.
43
     *
44
     * Return null if can't export to format
45
     *
46
     * @param format
47
     * @return
48
     */
49
    public String export(String format);
50

  
51
    public IDatum getDatum();
52

  
53
    public Point2D createPoint(double x, double y);
54

  
55
    // TODO Quitar si no son necesarias.
56
    public String getAbrev();
57

  
58
    /**
59
     * Devuelve getAbrev() mas los parametros de transformacion si los hay
60
     * ej.: (EPSG:23030:proj@+proj...@...)
61
     *
62
     * @return getAbrev() o getAbrev()+parametros
63
     */
64
    public String getFullCode();
65

  
66
    public void drawGrid(Graphics2D g, ViewPortData vp);
67

  
68
    public void setGridColor(Color c);
69

  
70
    public Color getGridColor();
71

  
72
    /**
73
     * Crea un ICoordTrans para transformar coordenadas
74
     * desde el IProjection actual al dest.
75
     * @param dest
76
     * @return
77
     */
78

  
79
    public ICoordTrans getCT(IProjection dest);
80

  
81
    public Point2D toGeo(Point2D pt);
82

  
83
    public Point2D fromGeo(Point2D gPt, Point2D mPt);
84

  
85
    public boolean isProjected();
86

  
87
    /**
88
     * First two parameters must be in meters.
89
     * This should be changed (map units should be used) and then
90
     * change the places where this method is used.
91
     *
92
     * @param minX in meters
93
     * @param maxX in meters
94
     * @param width in pixels (dots)
95
     * @param dpi dots per inch
96
     * @return Scale denominator ( the "X" in "1 : X" )
97
     */
98
    public double getScale(double minX, double maxX, double width, double dpi);
99

  
100
    public Rectangle2D getExtent(Rectangle2D extent,double scale,double wImage,double hImage,double mapUnits,double distanceUnits,double dpi);
101
}
0 102

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/cts/UTM.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.cresques.cts;
25

  
26
public interface UTM extends IProjection {
27

  
28
}
0 29

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/cts/ICoordTrans.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.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) throws CoordTransRuntimeException;
39

  
40
    /**
41
     * Reprojects the input rectangle and returns the minimum rectangle
42
     * containing the result of that reprojection (which was not
43
     * necessarily a rectangle).
44
     *
45
     * Reprojecting the diagonal an assuming that
46
     * the result is the diagonal of the rectangle to be returned is wrong
47
     *
48
     * Reprojecting the four corners and searching for min and max
49
     * to create the resulting rectangle is not completely accurate
50
     * but provides an acceptable approximation
51
     *
52
     * @param rect
53
     * @return
54
     */
55
    public Rectangle2D convert(Rectangle2D rect) throws CoordTransRuntimeException;
56

  
57
    public ICoordTrans getInverted();
58
}
0 59

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/cts/ICRSFactory.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.cresques.cts;
25

  
26
public interface ICRSFactory {
27

  
28
    public static final String FORMAT_WKT = "wkt";
29
    public static final String FORMAT_PROJ4 = "proj4";
30
    public static final String FORMAT_WKT_ESRI = "wkt_esri";
31

  
32
	public boolean doesRigurousTransformations();
33

  
34
    /**
35
     * Devuelve una proyeccion a partir de una cadena.
36
     * @param name abreviatura de la proyecccion (i.e. EPSG:23030)
37
     * @return Proyeccion si existe
38
     */
39
    public IProjection get(String name);
40

  
41
    /**
42
     * Devuelve una proyecci?n a partir de una cadena en uno de los formatos admitidos.
43
     * Devuelve null si no es capaz de crear la proyecci?n.
44
     *
45
     * @param format
46
     * @param value
47
     * @return
48
     */
49
    public IProjection get(String format, String value);
50

  
51
}
0 52

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/geo/.cvsignore
1
*.dfPackage
2
*.wmf
0 3

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/geo/cover/.cvsignore
1
*.dfPackage
2
*.wmf
0 3

  
org.gvsig.projection/tags/org.gvsig.projection.api-2.0.47/src/main/java/org/cresques/geo/package.html
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
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff