Revision 853
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.catalog.impl/src/test/java/org/gvsig/geotools/proj/catalog/test/TestWKTUtils.java | ||
---|---|---|
1 |
package org.gvsig.geotools.proj.catalog.test; |
|
2 |
|
|
3 |
import static org.junit.Assert.*; |
|
4 |
|
|
5 |
import org.gvsig.geotools.proj.catalog.utils.WKTUtils; |
|
6 |
import org.junit.After; |
|
7 |
import org.junit.Before; |
|
8 |
import org.junit.Test; |
|
9 |
|
|
10 |
public class TestWKTUtils { |
|
11 |
|
|
12 |
@Before |
|
13 |
public void setUp() throws Exception { |
|
14 |
} |
|
15 |
|
|
16 |
@After |
|
17 |
public void tearDown() throws Exception { |
|
18 |
} |
|
19 |
|
|
20 |
private String[] wktDefs = new String[] { |
|
21 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
22 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Y\",NORTH],AXIS[\"X\",EAST],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
23 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Y J\",NORTH],AXIS[\"X\",EAST],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
24 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Y J\\\\\",NORTH],AXIS[\"X\",EAST],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
25 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Y J\\\\\\\\\\\"\",NORTH],AXIS[\"X\",EAST],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
26 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Y J\\\\\\\\\\\" a b c\",NORTH],AXIS[\"X\",EAST],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
27 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Y J\\\\\\\\\\\" a b c\",NORTH],AXIS[\"\\\"Xjk \\\"\",EAST],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
28 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Y J\\\\\\\\\\\" a b c\",NORTH],AXIS[\"\\\"Xjk \\\"\",EAST],AXIS[\"\\\"Xjk \\\"\",UP],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
29 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Y J\\\\\\\\\\\" a b c\",NORTH],AXIS[\"\\\"Xjk \\\"\",UP],AXIS[\"\\\"Xjk \\\"\",EAST],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
30 |
"PROJCS[\"ETRS89 / AXIS[\\\"Y\\\",NORTH] LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Y\",NORTH],AXIS[\"X\",EAST],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
31 |
}; |
|
32 |
|
|
33 |
|
|
34 |
private String[] wktAxisRemovedDefs = new String[] { |
|
35 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
36 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
37 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
38 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
39 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
40 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
41 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
42 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
43 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
44 |
"PROJCS[\"ETRS89 / AXIS[\\\"Y\\\",NORTH] LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]" |
|
45 |
} ; |
|
46 |
|
|
47 |
private String[] wktSwappedAxisOrderDefs = new String[] { |
|
48 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
49 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
50 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",EAST],AXIS[\"Y J\",NORTH],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
51 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",EAST],AXIS[\"Y J\\\\\",NORTH],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
52 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",EAST],AXIS[\"Y J\\\\\\\\\\\"\",NORTH],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
53 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",EAST],AXIS[\"Y J\\\\\\\\\\\" a b c\",NORTH],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
54 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"\\\"Xjk \\\"\",EAST],AXIS[\"Y J\\\\\\\\\\\" a b c\",NORTH],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
55 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"\\\"Xjk \\\"\",EAST],AXIS[\"Y J\\\\\\\\\\\" a b c\",NORTH],AXIS[\"\\\"Xjk \\\"\",UP],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
56 |
"PROJCS[\"ETRS89 / LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"\\\"Xjk \\\"\",UP],AXIS[\"Y J\\\\\\\\\\\" a b c\",NORTH],AXIS[\"\\\"Xjk \\\"\",EAST],AUTHORITY[\"EPSG\",\"3035\"]]", |
|
57 |
"PROJCS[\"ETRS89 / AXIS[\\\"Y\\\",NORTH] LAEA Europe\",GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]], PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",52],PARAMETER[\"longitude_of_center\",10],PARAMETER[\"false_easting\",4321000],PARAMETER[\"false_northing\",3210000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH],AUTHORITY[\"EPSG\",\"3035\"]]" |
|
58 |
} ; |
|
59 |
|
|
60 |
@Test |
|
61 |
public void testRemoveAxis() { |
|
62 |
for (int i=0; i<wktDefs.length; i++) { |
|
63 |
doTestRemoveAxis(wktDefs[i], wktAxisRemovedDefs[i]); |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
@Test |
|
68 |
public void testAxisOrderSwapping() { |
|
69 |
System.out.println("swap axis"); |
|
70 |
for (int i=0; i<wktDefs.length; i++) { |
|
71 |
dotestAxisOrderSwapping(wktDefs[i], wktSwappedAxisOrderDefs[i]); |
|
72 |
} |
|
73 |
} |
|
74 |
|
|
75 |
public void doTestRemoveAxis(String wktDef, String expectedWktDef) { |
|
76 |
assertEquals("TestRemoveAxis", WKTUtils.removeAxisDefinition(wktDef), expectedWktDef); |
|
77 |
} |
|
78 |
|
|
79 |
public void dotestAxisOrderSwapping(String wktDef, String expectedWktDef) { |
|
80 |
assertEquals("TestRemoveAxis", WKTUtils.swapAxisOrder(wktDef), expectedWktDef); |
|
81 |
} |
|
82 |
|
|
83 |
} |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.catalog.impl/src/main/java/org/gvsig/geotools/proj/catalog/utils/WKTUtils.java | ||
---|---|---|
1 |
package org.gvsig.geotools.proj.catalog.utils; |
|
2 |
|
|
3 |
import java.util.regex.Matcher; |
|
4 |
import java.util.regex.Pattern; |
|
5 |
|
|
6 |
public class WKTUtils { |
|
7 |
private static final Pattern AXIS_REMOVER = Pattern.compile(",\\s*AXIS\\s*\\[\\s*\"(?:[^\"\\\\]|(?:\\\\.))*?\"\\s*,\\s*[^\\]]+\\s*\\]\\s*,\\s*AXIS\\s*\\[\\s*\"(?:[^\"\\\\]|(?:\\\\.))*?\"\\s*,\\s*[^\\]]+\\s*\\](?:,\\s*AXIS\\s*\\[\\s*\"(?:[^\"\\\\]|(?:\\\\.))*?\"\\s*,\\s*[^\\]]+\\s*\\])*"); |
|
8 |
|
|
9 |
private static final Pattern AXIS_SWAPPER = Pattern.compile("(.*?)(,\\s*AXIS\\s*\\[\\s*\"(?:[^\"\\\\]|(?:\\\\.))*?\"\\s*,\\s*[^\\]]+\\s*\\]\\s*)(,\\s*AXIS\\s*\\[\\s*\"(?:[^\"\\\\]|(?:\\\\.))*?\"\\s*,\\s*[^\\]]+\\s*\\])(.*)"); |
|
10 |
|
|
11 |
/** |
|
12 |
* Removes any AXIS definition from a WKT string. |
|
13 |
* @return The WKT without any AXIS definitions |
|
14 |
*/ |
|
15 |
public static String removeAxisDefinition(String wktDef) { |
|
16 |
return AXIS_REMOVER.matcher(wktDef).replaceFirst(""); |
|
17 |
} |
|
18 |
|
|
19 |
/** |
|
20 |
* Swaps the order of the first 2 AXIS definitions from the provided |
|
21 |
* WKT string. |
|
22 |
* @return The WKT string with a swapped axis order |
|
23 |
*/ |
|
24 |
public static String swapAxisOrder(String wktDef) { |
|
25 |
Matcher m = AXIS_SWAPPER.matcher(wktDef); |
|
26 |
if (m.matches() && m.groupCount()==4) { |
|
27 |
return m.group(1) + m.group(3) + m.group(2) + m.group(4); |
|
28 |
} |
|
29 |
return wktDef; |
|
30 |
} |
|
31 |
} |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.catalog.impl/src/main/java/org/gvsig/geotools/proj/catalog/DefaultTransformationDefinition.java | ||
---|---|---|
18 | 18 |
import org.gvsig.proj.catalog.exception.TransformationException; |
19 | 19 |
import org.gvsig.proj.catalog.exception.UnsupportedFormatException; |
20 | 20 |
import org.gvsig.proj.catalog.exception.UnsupportedTransformationException; |
21 |
import org.gvsig.proj.catalog.ref.Extent;
|
|
21 |
import org.gvsig.proj.catalog.extent.Extent;
|
|
22 | 22 |
import org.opengis.referencing.ReferenceIdentifier; |
23 | 23 |
import org.opengis.referencing.operation.ConcatenatedOperation; |
24 | 24 |
import org.opengis.referencing.operation.CoordinateOperation; |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.catalog.impl/src/main/java/org/gvsig/geotools/proj/catalog/DefaultCRSDefinition.java | ||
---|---|---|
10 | 10 |
import org.geotools.referencing.wkt.Formatter; |
11 | 11 |
import org.geotools.referencing.wkt.Symbols; |
12 | 12 |
import org.gvsig.geotools.proj.catalog.datum.DefaultDatum; |
13 |
import org.gvsig.geotools.proj.catalog.extent.DefaultExtent; |
|
14 |
import org.gvsig.geotools.proj.catalog.extent.DefaultGeographicBoundingBox; |
|
15 |
import org.gvsig.geotools.proj.catalog.extent.DefaultVerticalExtent; |
|
13 | 16 |
import org.gvsig.geotools.proj.catalog.utils.IdentifiedObjectUtils; |
14 | 17 |
import org.gvsig.proj.catalog.CRSDefinition; |
15 | 18 |
import org.gvsig.proj.catalog.CRSType; |
... | ... | |
21 | 24 |
import org.gvsig.proj.catalog.datum.Datum; |
22 | 25 |
import org.gvsig.proj.catalog.exception.CoordinateReferenceSystemException; |
23 | 26 |
import org.gvsig.proj.catalog.exception.UnsupportedCoordinateReferenceSystemException; |
24 |
import org.gvsig.proj.catalog.ref.Extent; |
|
27 |
import org.gvsig.proj.catalog.extent.Extent; |
|
28 |
import org.gvsig.proj.catalog.extent.GeographicBoundingBox; |
|
29 |
import org.gvsig.proj.catalog.extent.VerticalExtent; |
|
25 | 30 |
import org.opengis.metadata.Identifier; |
26 | 31 |
import org.opengis.referencing.FactoryException; |
27 | 32 |
import org.opengis.referencing.ReferenceIdentifier; |
... | ... | |
37 | 42 |
import org.opengis.referencing.operation.Conversion; |
38 | 43 |
|
39 | 44 |
public class DefaultCRSDefinition implements CRSDefinition { |
45 |
/** |
|
46 |
* Coordinate reference system in the original axis order |
|
47 |
*/ |
|
40 | 48 |
final private CoordinateReferenceSystem origCrs; |
49 |
/** |
|
50 |
* Coordinate reference system in the internal axis order (east-north) |
|
51 |
*/ |
|
52 |
final private CoordinateReferenceSystem internalCrs; |
|
41 | 53 |
final private String wkt; |
42 | 54 |
private CoordinateReferenceSystem epsgCrs = null; |
43 | 55 |
|
44 |
public DefaultCRSDefinition(String wktDefinition) throws UnsupportedCoordinateReferenceSystemException { |
|
45 |
this.wkt = wktDefinition; |
|
46 |
try { |
|
47 |
this.origCrs = CRS.parseWKT(wktDefinition); |
|
48 |
} catch (FactoryException e) { |
|
49 |
throw new UnsupportedCoordinateReferenceSystemException(e); |
|
50 |
} |
|
56 |
public DefaultCRSDefinition(CoordinateReferenceSystem crs) { |
|
57 |
this(crs, crs, null); |
|
51 | 58 |
} |
52 | 59 |
|
53 |
public DefaultCRSDefinition(CoordinateReferenceSystem crs) { |
|
60 |
public DefaultCRSDefinition(CoordinateReferenceSystem crs, String wkt) { |
|
61 |
this(crs, crs, wkt); |
|
62 |
} |
|
63 |
|
|
64 |
public DefaultCRSDefinition(CoordinateReferenceSystem crs, CoordinateReferenceSystem eastNorthCrs, String wkt) { |
|
54 | 65 |
this.origCrs = crs; |
55 |
this.wkt = null; |
|
66 |
this.wkt = wkt; |
|
67 |
this.internalCrs = eastNorthCrs; |
|
56 | 68 |
} |
57 | 69 |
|
70 |
/** |
|
71 |
* Gets the Geotools instance backing this definition, using the gvSIG internal |
|
72 |
* axis order (east-north). |
|
73 |
* definition |
|
74 |
* |
|
75 |
* @return |
|
76 |
*/ |
|
58 | 77 |
public CoordinateReferenceSystem getInternalCRS() { |
78 |
return internalCrs; |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* Gets the Geotools instance backing this definition, using the original, |
|
83 |
* unmodified axis order as defined by the defining authority or WKT string. |
|
84 |
* |
|
85 |
* @return |
|
86 |
*/ |
|
87 |
public CoordinateReferenceSystem getOrigCRS() { |
|
59 | 88 |
return origCrs; |
60 | 89 |
} |
61 | 90 |
|
62 | 91 |
@Override |
63 | 92 |
public String getName() { |
64 | 93 |
if (origCrs.getName() != null) { |
65 |
return origCrs.getName().toString();
|
|
94 |
return origCrs.getName().getCode();
|
|
66 | 95 |
} |
67 | 96 |
if (getIdentifier() != null) { |
68 | 97 |
return getIdentifier(); |
... | ... | |
89 | 118 |
if (id!=null) { |
90 | 119 |
return id; |
91 | 120 |
} |
92 |
return IdentifiedObjectUtils.getIdentifier(getEpsgCrs()); |
|
121 |
return null; |
|
122 |
/*return IdentifiedObjectUtils.getIdentifier(getEpsgCrs());*/ |
|
93 | 123 |
} |
94 | 124 |
|
95 | 125 |
/** |
... | ... | |
97 | 127 |
* null if not found |
98 | 128 |
* @return |
99 | 129 |
*/ |
100 |
protected CoordinateReferenceSystem getEpsgCrs() { |
|
101 |
// FIXME: this method makes the class immutable
|
|
130 |
/*protected CoordinateReferenceSystem getEpsgCrs() {
|
|
131 |
// FIXME: this method makes the class mutable |
|
102 | 132 |
if (epsgCrs==null) { |
103 | 133 |
try { |
104 | 134 |
String code = CRS.lookupIdentifier(Citations.EPSG, origCrs, true); |
... | ... | |
109 | 139 |
catch (FactoryException exc) {} |
110 | 140 |
} |
111 | 141 |
return epsgCrs; |
112 |
} |
|
142 |
}*/
|
|
113 | 143 |
|
114 | 144 |
@Override |
115 | 145 |
public Set<String> getIdentifiers() { |
... | ... | |
117 | 147 |
for (ReferenceIdentifier id: origCrs.getIdentifiers()) { |
118 | 148 |
ids.add(id.toString()); |
119 | 149 |
} |
150 |
/* |
|
120 | 151 |
if (!getAuthorityName().equals("EPSG") && getEpsgCrs() != null) { |
121 | 152 |
for (ReferenceIdentifier id: getEpsgCrs().getIdentifiers()) { |
122 | 153 |
ids.add(id.toString()); |
123 | 154 |
} |
124 |
} |
|
155 |
}*/
|
|
125 | 156 |
return ids; |
126 | 157 |
} |
127 | 158 |
|
... | ... | |
132 | 163 |
|
133 | 164 |
@Override |
134 | 165 |
public Extent getDomainOfValidity() { |
135 |
// TODO Auto-generated method stub |
|
166 |
// FIXME: should we cache this? |
|
167 |
org.opengis.metadata.extent.Extent extent = origCrs.getDomainOfValidity(); |
|
168 |
if (extent != null) { |
|
169 |
String desc; |
|
170 |
if (origCrs.getDomainOfValidity().getDescription() != null) { |
|
171 |
desc = origCrs.getDomainOfValidity().getDescription().toString(); |
|
172 |
} |
|
173 |
else { |
|
174 |
desc = null; |
|
175 |
} |
|
176 |
ArrayList<GeographicBoundingBox> horizontalExtentList = new ArrayList<GeographicBoundingBox>(); |
|
177 |
for (org.opengis.metadata.extent.GeographicExtent horizExtent: origCrs.getDomainOfValidity().getGeographicElements()) { |
|
178 |
if (horizExtent instanceof org.opengis.metadata.extent.GeographicBoundingBox) { |
|
179 |
DefaultGeographicBoundingBox bb = new DefaultGeographicBoundingBox( |
|
180 |
((org.opengis.metadata.extent.GeographicBoundingBox) horizExtent).getWestBoundLongitude(), |
|
181 |
((org.opengis.metadata.extent.GeographicBoundingBox) horizExtent).getEastBoundLongitude(), |
|
182 |
((org.opengis.metadata.extent.GeographicBoundingBox) horizExtent).getNorthBoundLatitude(), |
|
183 |
((org.opengis.metadata.extent.GeographicBoundingBox) horizExtent).getSouthBoundLatitude()); |
|
184 |
horizontalExtentList.add(bb); |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
ArrayList<VerticalExtent> vertExtentList = new ArrayList<VerticalExtent>(); |
|
189 |
for (org.opengis.metadata.extent.VerticalExtent verticalExtent: origCrs.getDomainOfValidity().getVerticalElements()) { |
|
190 |
DefaultVerticalExtent ve = new DefaultVerticalExtent( |
|
191 |
new DefaultCRSDefinition(verticalExtent.getVerticalCRS()), |
|
192 |
verticalExtent.getMinimumValue(), |
|
193 |
verticalExtent.getMaximumValue() |
|
194 |
); |
|
195 |
vertExtentList.add(ve); |
|
196 |
} |
|
197 |
return new DefaultExtent(desc, horizontalExtentList, vertExtentList); |
|
198 |
} |
|
136 | 199 |
return null; |
137 | 200 |
} |
138 | 201 |
|
139 | 202 |
@Override |
140 | 203 |
public String getDescription() { |
141 |
return "Scope: " + origCrs.getScope() + "\nRemarks: " + origCrs.getRemarks(); |
|
204 |
StringBuilder desc = new StringBuilder(); |
|
205 |
if (origCrs.getScope() != null) { |
|
206 |
desc.append("Scope: ").append(origCrs.getScope()); |
|
207 |
} |
|
208 |
if (origCrs.getRemarks() != null) { |
|
209 |
if (desc.length()>0) { |
|
210 |
desc.append("\nRemarks: "); |
|
211 |
} |
|
212 |
else { |
|
213 |
desc.append("Remarks: "); |
|
214 |
} |
|
215 |
desc.append(origCrs.getRemarks()); |
|
216 |
} |
|
217 |
if (origCrs.getDomainOfValidity() != null && |
|
218 |
origCrs.getDomainOfValidity().getDescription() != null) { |
|
219 |
if (desc.length()>0) { |
|
220 |
desc.append("\nDomain: "); |
|
221 |
} |
|
222 |
else { |
|
223 |
desc.append("Domain: "); |
|
224 |
} |
|
225 |
desc.append(origCrs.getDomainOfValidity().getDescription()); |
|
226 |
} |
|
227 |
|
|
228 |
return desc.toString(); |
|
142 | 229 |
} |
143 | 230 |
|
144 | 231 |
@Override |
... | ... | |
172 | 259 |
if (wkt!=null) { |
173 | 260 |
return wkt; |
174 | 261 |
} |
175 |
return origCrs.toWKT();
|
|
262 |
return toString(Format.WKT1);
|
|
176 | 263 |
} |
177 | 264 |
|
265 |
@Override |
|
266 |
public String toString() { |
|
267 |
return (getIdentifier()!=null)?(getIdentifier() + " - " + getName()):getName(); |
|
268 |
} |
|
269 |
|
|
178 | 270 |
|
179 | 271 |
@Override |
180 | 272 |
public String toString(Format format) throws UnsupportedOperationException { |
181 |
return toString(format, null, 0);
|
|
273 |
return toString(format, null, 2);
|
|
182 | 274 |
} |
183 | 275 |
|
184 | 276 |
@Override |
... | ... | |
246 | 338 |
|
247 | 339 |
@Override |
248 | 340 |
public CoordinateSystemAxis getAxisInternal(int dimension) throws IndexOutOfBoundsException { |
249 |
// TODO Auto-generated method stub |
|
250 |
return null; |
|
341 |
return new DefaultCoordinateSystemAxis(internalCrs.getCoordinateSystem().getAxis(dimension)); |
|
251 | 342 |
} |
252 | 343 |
|
253 | 344 |
@Override |
254 | 345 |
public CRSDefinition getBaseCRS() { |
346 |
// FIXME: consider the axis order of the base CRS |
|
255 | 347 |
if (origCrs instanceof GeneralDerivedCRS) { |
256 | 348 |
CoordinateReferenceSystem base = ((GeneralDerivedCRS)origCrs).getBaseCRS(); |
257 | 349 |
return new DefaultCRSDefinition(base); |
... | ... | |
284 | 376 |
|
285 | 377 |
@Override |
286 | 378 |
public Object clone() throws CloneNotSupportedException { |
287 |
return new DefaultCRSDefinition(this.origCrs); |
|
379 |
return new DefaultCRSDefinition(this.origCrs, this.internalCrs, this.wkt);
|
|
288 | 380 |
} |
289 | 381 |
|
290 | 382 |
@Override |
291 | 383 |
public boolean equals(Object obj) { |
292 | 384 |
if (obj instanceof DefaultCRSDefinition) { |
293 |
return origCrs.equals(((DefaultCRSDefinition)obj).getInternalCRS());
|
|
385 |
return origCrs.equals(((DefaultCRSDefinition)obj).getOrigCRS());
|
|
294 | 386 |
} |
295 | 387 |
if (obj instanceof CRSDefinition) { |
296 | 388 |
return toString(Format.WKT1, WKTConvention.EPSG, 0).equals(((CRSDefinition)obj).toString(Format.WKT1, WKTConvention.EPSG, 0)); |
... | ... | |
300 | 392 |
|
301 | 393 |
@Override |
302 | 394 |
public boolean equals(CRSDefinition definition, boolean ignoreAxis, boolean ignoreMetadata) { |
303 |
// TODO Auto-generated method stub |
|
304 |
return this.equals(definition); |
|
395 |
if (definition instanceof DefaultCRSDefinition) { |
|
396 |
DefaultCRSDefinition def = (DefaultCRSDefinition) definition; |
|
397 |
if (ignoreAxis) { |
|
398 |
if (ignoreMetadata) { |
|
399 |
return CRS.equalsIgnoreMetadata(this.internalCrs, def.getInternalCRS()); |
|
400 |
} |
|
401 |
else { |
|
402 |
return this.internalCrs.equals(def.getInternalCRS()); |
|
403 |
} |
|
404 |
} |
|
405 |
else if (ignoreMetadata) { |
|
406 |
return CRS.equalsIgnoreMetadata(this.origCrs, def.getOrigCRS()); |
|
407 |
} |
|
408 |
else { |
|
409 |
return CRS.equalsIgnoreMetadata(this.origCrs, def.getOrigCRS()); |
|
410 |
} |
|
411 |
} |
|
412 |
else { |
|
413 |
return equals(definition); |
|
414 |
} |
|
305 | 415 |
} |
306 | 416 |
} |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.catalog.impl/src/main/java/org/gvsig/geotools/proj/catalog/extent/DefaultVerticalExtent.java | ||
---|---|---|
1 |
package org.gvsig.geotools.proj.catalog.extent; |
|
2 |
|
|
3 |
import org.gvsig.proj.catalog.CRSDefinition; |
|
4 |
import org.gvsig.proj.catalog.extent.VerticalExtent; |
|
5 |
|
|
6 |
public class DefaultVerticalExtent implements VerticalExtent { |
|
7 |
final private CRSDefinition crs; |
|
8 |
final private double minValue, maxValue; |
|
9 |
|
|
10 |
public DefaultVerticalExtent(CRSDefinition verticalCrs, |
|
11 |
double minValue, double maxValue) { |
|
12 |
this.crs = verticalCrs; |
|
13 |
this.minValue = minValue; |
|
14 |
this.maxValue = maxValue; |
|
15 |
} |
|
16 |
|
|
17 |
@Override |
|
18 |
public double getMinimumValue() { |
|
19 |
return minValue; |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
public double getMaximumValue() { |
|
24 |
return maxValue; |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public CRSDefinition getVerticalCRS() { |
|
29 |
return crs; |
|
30 |
} |
|
31 |
|
|
32 |
} |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.catalog.impl/src/main/java/org/gvsig/geotools/proj/catalog/extent/DefaultExtent.java | ||
---|---|---|
1 |
package org.gvsig.geotools.proj.catalog.extent; |
|
2 |
|
|
3 |
import java.util.Collection; |
|
4 |
import java.util.Collections; |
|
5 |
|
|
6 |
import org.gvsig.proj.catalog.extent.Extent; |
|
7 |
import org.gvsig.proj.catalog.extent.GeographicBoundingBox; |
|
8 |
import org.gvsig.proj.catalog.extent.VerticalExtent; |
|
9 |
|
|
10 |
public class DefaultExtent implements Extent { |
|
11 |
final private String description; |
|
12 |
final private Collection<GeographicBoundingBox> horizontalBoundingBoxList; |
|
13 |
final private Collection<VerticalExtent> verticalBoundingBoxList; |
|
14 |
|
|
15 |
public DefaultExtent(String description, |
|
16 |
Collection<GeographicBoundingBox> horizontalBoundingBoxList, |
|
17 |
Collection<VerticalExtent> verticalBoundingBoxList) { |
|
18 |
this.description = description; |
|
19 |
if (horizontalBoundingBoxList != null) { |
|
20 |
this.horizontalBoundingBoxList = Collections.unmodifiableCollection(horizontalBoundingBoxList); |
|
21 |
} |
|
22 |
else { |
|
23 |
this.horizontalBoundingBoxList = Collections.emptyList(); |
|
24 |
} |
|
25 |
if (verticalBoundingBoxList != null) { |
|
26 |
this.verticalBoundingBoxList = Collections.unmodifiableCollection(verticalBoundingBoxList); |
|
27 |
} |
|
28 |
else { |
|
29 |
this.verticalBoundingBoxList = Collections.emptyList(); |
|
30 |
} |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public String getDescription() { |
|
35 |
return description; |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public Collection<GeographicBoundingBox> getGeographicElements() { |
|
40 |
return horizontalBoundingBoxList; |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public Collection<VerticalExtent> getVerticalElements() { |
|
45 |
return verticalBoundingBoxList; |
|
46 |
} |
|
47 |
|
|
48 |
} |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.catalog.impl/src/main/java/org/gvsig/geotools/proj/catalog/extent/DefaultGeographicBoundingBox.java | ||
---|---|---|
1 |
package org.gvsig.geotools.proj.catalog.extent; |
|
2 |
|
|
3 |
import org.gvsig.proj.catalog.extent.GeographicBoundingBox; |
|
4 |
|
|
5 |
public class DefaultGeographicBoundingBox implements GeographicBoundingBox { |
|
6 |
private final double westBoundLongitude, eastBoundLongitude, |
|
7 |
northBoundLatitude, southBoundLatitude; |
|
8 |
|
|
9 |
public DefaultGeographicBoundingBox( |
|
10 |
double westBoundLongitude, double eastBoundLongitude, |
|
11 |
double northBoundLatitude, double southBoundLatitude) { |
|
12 |
this.westBoundLongitude = westBoundLongitude; |
|
13 |
this.eastBoundLongitude = eastBoundLongitude; |
|
14 |
this.northBoundLatitude = northBoundLatitude; |
|
15 |
this.southBoundLatitude = southBoundLatitude; |
|
16 |
} |
|
17 |
|
|
18 |
@Override |
|
19 |
public double getWestBoundLongitude() { |
|
20 |
return westBoundLongitude; |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
public double getEastBoundLongitude() { |
|
25 |
return eastBoundLongitude; |
|
26 |
} |
|
27 |
|
|
28 |
@Override |
|
29 |
public double getSouthBoundLatitude() { |
|
30 |
return southBoundLatitude; |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public double getNorthBoundLatitude() { |
|
35 |
return northBoundLatitude; |
|
36 |
} |
|
37 |
|
|
38 |
} |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.catalog.impl/src/main/java/org/gvsig/geotools/proj/catalog/GtCRSCatalogManager.java | ||
---|---|---|
8 | 8 |
import java.text.ParseException; |
9 | 9 |
import java.util.ArrayList; |
10 | 10 |
import java.util.Arrays; |
11 |
import java.util.Collection; |
|
11 | 12 |
import java.util.Collections; |
12 | 13 |
import java.util.HashMap; |
13 | 14 |
import java.util.List; |
14 | 15 |
import java.util.Map; |
15 | 16 |
import java.util.Set; |
17 |
import java.util.regex.Pattern; |
|
16 | 18 |
|
17 | 19 |
import javax.sql.DataSource; |
18 | 20 |
|
... | ... | |
21 | 23 |
import org.geotools.factory.Hints; |
22 | 24 |
import org.geotools.metadata.iso.citation.Citations; |
23 | 25 |
import org.geotools.referencing.CRS; |
26 |
import org.geotools.referencing.CRS.AxisOrder; |
|
24 | 27 |
import org.geotools.referencing.ReferencingFactoryFinder; |
25 | 28 |
import org.geotools.referencing.factory.AbstractAuthorityFactory; |
26 | 29 |
import org.geotools.referencing.factory.BufferedAuthorityFactory; |
... | ... | |
30 | 33 |
import org.geotools.referencing.wkt.Parser; |
31 | 34 |
import org.geotools.resources.i18n.ErrorKeys; |
32 | 35 |
import org.geotools.resources.i18n.Errors; |
36 |
import org.gvsig.geotools.proj.catalog.extent.DefaultExtent; |
|
37 |
import org.gvsig.geotools.proj.catalog.extent.DefaultGeographicBoundingBox; |
|
38 |
import org.gvsig.geotools.proj.catalog.extent.DefaultVerticalExtent; |
|
39 |
import org.gvsig.geotools.proj.catalog.utils.IdentifiedObjectUtils; |
|
40 |
import org.gvsig.geotools.proj.catalog.utils.WKTUtils; |
|
33 | 41 |
import org.gvsig.proj.catalog.CRSCatalogManager; |
34 | 42 |
import org.gvsig.proj.catalog.CRSDefinition; |
43 |
import org.gvsig.proj.catalog.CRSType; |
|
35 | 44 |
import org.gvsig.proj.catalog.TextSerialization; |
36 | 45 |
import org.gvsig.proj.catalog.TextSerialization.Format; |
37 | 46 |
import org.gvsig.proj.catalog.TransformationDefinition; |
... | ... | |
39 | 48 |
import org.gvsig.proj.catalog.exception.UnsupportedCoordinateReferenceSystemException; |
40 | 49 |
import org.gvsig.proj.catalog.exception.UnsupportedFormatException; |
41 | 50 |
import org.gvsig.proj.catalog.exception.UnsupportedTransformationException; |
51 |
import org.gvsig.proj.catalog.extent.Extent; |
|
52 |
import org.gvsig.proj.catalog.extent.GeographicBoundingBox; |
|
53 |
import org.gvsig.proj.catalog.extent.VerticalExtent; |
|
42 | 54 |
import org.opengis.referencing.AuthorityFactory; |
43 | 55 |
import org.opengis.referencing.FactoryException; |
44 | 56 |
import org.opengis.referencing.NoSuchAuthorityCodeException; |
... | ... | |
66 | 78 |
public class GtCRSCatalogManager implements CRSCatalogManager { |
67 | 79 |
private static final String EPSG_DB_SUBFOLDER = "epsg"; |
68 | 80 |
private static final List<TextSerialization.Format> SUPPORTED_FORMATS = Arrays.asList(TextSerialization.Format.WKT1); |
69 |
private static final List<String> supportedAuthorities = Collections.unmodifiableList(Arrays.asList("EPSG", "ESRI", "USER")); |
|
81 |
private static final List<String> supportedAuthorities = Collections.unmodifiableList(Arrays.asList("EPSG", "ESRI", "USER"));
|
|
70 | 82 |
|
71 | 83 |
public GtCRSCatalogManager() { |
72 | 84 |
|
... | ... | |
123 | 135 |
@Override |
124 | 136 |
public List<String> search(String searchString) { |
125 | 137 |
// FIXME handle other authorities |
126 |
return searchEpsg(searchString); |
|
138 |
return searchEpsg(searchString, null, null);
|
|
127 | 139 |
} |
128 | 140 |
|
129 | 141 |
@Override |
130 | 142 |
public List<String> search(String authority, String searchString) { |
131 | 143 |
// FIXME handle other authorities |
132 | 144 |
if (authority.equals("EPSG")) { |
133 |
return searchEpsg(searchString); |
|
145 |
return searchEpsg(searchString, null, null);
|
|
134 | 146 |
} |
135 | 147 |
return Collections.emptyList(); |
136 | 148 |
} |
137 | 149 |
|
138 |
protected List<String> searchEpsg(String searchString) { |
|
150 |
@Override |
|
151 |
public List<String> search(String authority, String searchString, CRSType[] includeTypes, CRSType[] excludeTypes) { |
|
139 | 152 |
// FIXME handle other authorities |
153 |
if (authority.equals("EPSG")) { |
|
154 |
return searchEpsg(searchString, includeTypes, excludeTypes); |
|
155 |
} |
|
156 |
return Collections.emptyList(); |
|
157 |
} |
|
158 |
|
|
159 |
|
|
160 |
protected List<String> searchEpsg(String searchString, CRSType[] includeTypes, CRSType[] excludeTypes) { |
|
161 |
// FIXME handle other authorities |
|
140 | 162 |
CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", null); |
141 | 163 |
if (factory instanceof ThreadedEpsgFactory) { |
142 | 164 |
ThreadedEpsgFactory epsgFactory = (ThreadedEpsgFactory) factory; |
143 | 165 |
try { |
144 | 166 |
DataSource ds = epsgFactory.getDataSource(); |
145 | 167 |
Connection c = ds.getConnection(); |
146 |
return searchEpsg(searchString, c); |
|
168 |
return searchEpsg(searchString, c, includeTypes, excludeTypes);
|
|
147 | 169 |
} catch (SQLException e) { |
148 | 170 |
// TODO Auto-generated catch block |
149 | 171 |
e.printStackTrace(); |
... | ... | |
152 | 174 |
return Collections.EMPTY_LIST; |
153 | 175 |
} |
154 | 176 |
|
155 |
public synchronized List<String> searchEpsg(String searchString, Connection conn) throws SQLException |
|
177 |
private boolean isExcluded(CRSType type, CRSType[] excludeTypes) { |
|
178 |
for (CRSType excluded: excludeTypes) { |
|
179 |
if (type.equals(excluded)) { |
|
180 |
return true; |
|
181 |
} |
|
182 |
} |
|
183 |
return false; |
|
184 |
} |
|
185 |
|
|
186 |
public synchronized List<String> searchEpsg(String searchString, Connection conn, |
|
187 |
CRSType[] includeTypes, CRSType[] excludeTypes) throws SQLException |
|
156 | 188 |
{ |
157 | 189 |
ArrayList<String> codes = new ArrayList<String>(); |
158 | 190 |
|
159 |
if (searchString.startsWith("EPSG:")) { |
|
191 |
if (searchString == null) { |
|
192 |
searchString = ""; |
|
193 |
} |
|
194 |
else if (searchString.startsWith("EPSG:")) { |
|
160 | 195 |
searchString = searchString.substring(5); |
161 | 196 |
} |
162 | 197 |
searchString = "%" + searchString.toLowerCase() + "%"; |
198 |
StringBuilder builder = new StringBuilder("SELECT COORD_REF_SYS_CODE," |
|
199 |
+ " COORD_REF_SYS_NAME," |
|
200 |
+ " AREA_OF_USE_CODE," |
|
201 |
+ " CRS_SCOPE," |
|
202 |
+ " REMARKS," |
|
203 |
+ " COORD_REF_SYS_KIND," |
|
204 |
+ " COORD_SYS_CODE," // Null for CompoundCRS |
|
205 |
+ " DATUM_CODE," // Null for ProjectedCRS |
|
206 |
+ " SOURCE_GEOGCRS_CODE," // For ProjectedCRS |
|
207 |
+ " PROJECTION_CONV_CODE," // For ProjectedCRS |
|
208 |
+ " CMPD_HORIZCRS_CODE," // For CompoundCRS only |
|
209 |
+ " CMPD_VERTCRS_CODE," // For CompoundCRS only |
|
210 |
+ " DEPRECATED" |
|
211 |
+ " FROM epsg_coordinatereferencesystem" |
|
212 |
+ " WHERE DEPRECATED = 0 AND (COORD_REF_SYS_CODE LIKE ? OR LCASE(COORD_REF_SYS_NAME) LIKE ?" |
|
213 |
+ " OR LCASE(REMARKS) LIKE ?" |
|
214 |
+ " OR LCASE(CRS_SCOPE) LIKE ?)"); |
|
215 |
|
|
216 |
if (includeTypes != null) { |
|
217 |
boolean first = true; |
|
218 |
builder.append(" AND ("); |
|
219 |
for (CRSType type: includeTypes) { |
|
220 |
if (first) { |
|
221 |
first = false; |
|
222 |
builder.append("COORD_REF_SYS_KIND LIKE '").append(type.toEpsgString()).append("'"); |
|
223 |
} |
|
224 |
else { |
|
225 |
builder.append(" OR COORD_REF_SYS_KIND LIKE '").append(type.toEpsgString()).append("'"); |
|
226 |
} |
|
227 |
} |
|
228 |
builder.append(")"); |
|
229 |
} |
|
230 |
if (excludeTypes != null) { |
|
231 |
boolean first = true; |
|
232 |
builder.append(" AND NOT("); |
|
233 |
for (CRSType type: excludeTypes) { |
|
234 |
if (first) { |
|
235 |
first = false; |
|
236 |
builder.append("COORD_REF_SYS_KIND LIKE '").append(type.toEpsgString()).append("'"); |
|
237 |
} |
|
238 |
else { |
|
239 |
builder.append(" OR COORD_REF_SYS_KIND LIKE '").append(type.toEpsgString()).append("'"); |
|
240 |
} |
|
241 |
} |
|
242 |
builder.append(")"); |
|
243 |
} |
|
244 |
|
|
163 | 245 |
try { |
164 | 246 |
// FIXME: JOIN query with area of use. Maybe also with COORD_SYS_CODE to search for coord sys name |
165 | 247 |
final PreparedStatement stmt; |
166 |
stmt = conn.prepareStatement("SELECT COORD_REF_SYS_CODE," |
|
167 |
+ " COORD_REF_SYS_NAME," |
|
168 |
+ " AREA_OF_USE_CODE," |
|
169 |
+ " CRS_SCOPE," |
|
170 |
+ " REMARKS," |
|
171 |
+ " COORD_REF_SYS_KIND," |
|
172 |
+ " COORD_SYS_CODE," // Null for CompoundCRS |
|
173 |
+ " DATUM_CODE," // Null for ProjectedCRS |
|
174 |
+ " SOURCE_GEOGCRS_CODE," // For ProjectedCRS |
|
175 |
+ " PROJECTION_CONV_CODE," // For ProjectedCRS |
|
176 |
+ " CMPD_HORIZCRS_CODE," // For CompoundCRS only |
|
177 |
+ " CMPD_VERTCRS_CODE" // For CompoundCRS only |
|
178 |
+ " FROM epsg_coordinatereferencesystem" |
|
179 |
+ " WHERE COORD_REF_SYS_CODE LIKE ? OR LCASE(COORD_REF_SYS_NAME) LIKE ?" |
|
180 |
+ " OR LCASE(REMARKS) LIKE ?" |
|
181 |
+ " OR LCASE(CRS_SCOPE) LIKE ?"); |
|
248 |
stmt = conn.prepareStatement(builder.toString()); |
|
182 | 249 |
stmt.setString(1, searchString); |
183 | 250 |
stmt.setString(2, searchString); |
184 | 251 |
stmt.setString(3, searchString); |
... | ... | |
190 | 257 |
final String area = result.getString(3); |
191 | 258 |
final String scope = result.getString(4); |
192 | 259 |
final String remarks = result.getString(5); |
260 |
final String kind = result.getString(6); |
|
193 | 261 |
|
194 | 262 |
final String csCode = result.getString(7); |
195 | 263 |
final String dmCode = result.getString( 8); // geographic |
... | ... | |
198 | 266 |
// vertical: |
199 | 267 |
final String code1 = result.getString(11); |
200 | 268 |
final String code2 = result.getString(12); |
201 |
codes.add(epsg); |
|
269 |
codes.add("EPSG:"+epsg);
|
|
202 | 270 |
} |
203 | 271 |
result.close(); |
204 | 272 |
} catch (SQLException exception) { |
... | ... | |
211 | 279 |
@Override |
212 | 280 |
public DefaultCRSDefinition getCRSDefinition(String code) throws UnsupportedCoordinateReferenceSystemException { |
213 | 281 |
CoordinateReferenceSystem crs; |
282 |
CoordinateReferenceSystem internalCrs; |
|
214 | 283 |
try { |
215 |
crs = CRS.decode(code); |
|
216 |
} catch (NoSuchAuthorityCodeException e) { |
|
284 |
crs = CRS.decode(code, false); |
|
285 |
if (CRS.getAxisOrder(crs) == AxisOrder.NORTH_EAST) { |
|
286 |
internalCrs = CRS.decode(code, true); |
|
287 |
} |
|
288 |
else { |
|
289 |
internalCrs = crs; |
|
290 |
} |
|
291 |
return new DefaultCRSDefinition(crs, internalCrs, null); |
|
292 |
} catch (NoSuchAuthorityCodeException e) { |
|
217 | 293 |
throw new UnsupportedCoordinateReferenceSystemException(code, e); |
218 | 294 |
} catch (FactoryException e) { |
219 | 295 |
throw new UnsupportedCoordinateReferenceSystemException(code, e); |
220 | 296 |
} |
221 |
return new DefaultCRSDefinition(crs); |
|
222 | 297 |
} |
223 | 298 |
|
224 | 299 |
public DefaultCRSDefinition getCRSDefinition(CoordinateReferenceSystem crs) throws UnsupportedCoordinateReferenceSystemException { |
225 | 300 |
return new DefaultCRSDefinition(crs); |
226 | 301 |
} |
227 | 302 |
|
228 |
|
|
229 | 303 |
@Override |
230 | 304 |
public CRSDefinition getCompoundCRS(CRSDefinition... crsList) throws UnsupportedCoordinateReferenceSystemException { |
231 | 305 |
ArrayList<CoordinateReferenceSystem> components = new ArrayList<CoordinateReferenceSystem>(); |
... | ... | |
234 | 308 |
components.add(((DefaultCRSDefinition)def).getInternalCRS()); |
235 | 309 |
} |
236 | 310 |
else { |
237 |
def = new DefaultCRSDefinition(def.toWKT());
|
|
311 |
def = parseCRSDefinition(def.toWKT());
|
|
238 | 312 |
} |
239 | 313 |
} |
240 | 314 |
CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null); |
... | ... | |
249 | 323 |
} |
250 | 324 |
} |
251 | 325 |
|
326 |
/** |
|
327 |
* Removes axis definition from a WKT string |
|
328 |
* |
|
329 |
* @param wktDef |
|
330 |
* @return A WKT string without any axis definition |
|
331 |
*/ |
|
332 |
private static String removeWktAxis(String wktDef) { |
|
333 |
return WKTUtils.removeAxisDefinition(wktDef); |
|
334 |
} |
|
335 |
|
|
252 | 336 |
@Override |
253 | 337 |
public DefaultCRSDefinition parseCRSDefinition(String def) throws UnsupportedCoordinateReferenceSystemException { |
254 | 338 |
CoordinateReferenceSystem crs; |
339 |
CoordinateReferenceSystem internalCrs; |
|
255 | 340 |
try { |
256 |
crs = CRS.decode(def); |
|
257 |
} catch (FactoryException e1) { |
|
258 |
try { |
|
259 |
crs = CRS.parseWKT(def); |
|
260 |
} catch (NoSuchAuthorityCodeException e) { |
|
261 |
throw new UnsupportedCoordinateReferenceSystemException(def, e); |
|
262 |
} catch (FactoryException e) { |
|
263 |
throw new UnsupportedCoordinateReferenceSystemException(def, e); |
|
264 |
} |
|
341 |
crs = CRS.parseWKT(def); |
|
342 |
if (CRS.getAxisOrder(crs)==AxisOrder.NORTH_EAST) { |
|
343 |
String id = IdentifiedObjectUtils.getIdentifier(crs); |
|
344 |
if (id != null && id.startsWith("EPSG:")) { //FIXME: could this also work for other authorities such as ESRI? |
|
345 |
internalCrs = CRS.decode(id, true); |
|
346 |
} |
|
347 |
else { |
|
348 |
// Hack: remove the axis from the WKT. It could be better to try to derive a CRS with default axis order, but I don't see the way for non EPSG CRSs |
|
349 |
internalCrs = CRS.parseWKT(removeWktAxis(def)); |
|
350 |
} |
|
351 |
} |
|
352 |
else { |
|
353 |
internalCrs = crs; |
|
354 |
} |
|
355 |
} catch (NoSuchAuthorityCodeException e) { |
|
356 |
throw new UnsupportedCoordinateReferenceSystemException(def, e); |
|
357 |
} catch (FactoryException e) { |
|
358 |
throw new UnsupportedCoordinateReferenceSystemException(def, e); |
|
265 | 359 |
} |
266 |
return new DefaultCRSDefinition(crs); |
|
360 |
return new DefaultCRSDefinition(crs, internalCrs, def);
|
|
267 | 361 |
} |
268 | 362 |
|
269 | 363 |
|
... | ... | |
461 | 555 |
return SUPPORTED_FORMATS; |
462 | 556 |
} |
463 | 557 |
|
558 |
@Override |
|
559 |
public GeographicBoundingBox createBoundingBox(double westBoundLongitude, double eastBoundLongitude, |
|
560 |
double northBoundLatitude, double southBoundLatitude) { |
|
561 |
return new DefaultGeographicBoundingBox(westBoundLongitude, eastBoundLongitude, northBoundLatitude, southBoundLatitude); |
|
562 |
} |
|
563 |
|
|
564 |
@Override |
|
565 |
public VerticalExtent createVerticalExtent(CRSDefinition crs, double minValue, double maxValue) { |
|
566 |
return new DefaultVerticalExtent(crs, minValue, maxValue); |
|
567 |
} |
|
568 |
|
|
569 |
@Override |
|
570 |
public Extent createExtent(String description, |
|
571 |
Collection<GeographicBoundingBox> horizontalBoundingBoxList, |
|
572 |
Collection<VerticalExtent> verticalBoundingBoxList) { |
|
573 |
return new DefaultExtent(description, horizontalBoundingBoxList, verticalBoundingBoxList); |
|
574 |
} |
|
464 | 575 |
} |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.app/pom.xml | ||
---|---|---|
26 | 26 |
<groupId>org.gvsig</groupId> |
27 | 27 |
<artifactId>org.gvsig.geotools.proj.lib.impl</artifactId> |
28 | 28 |
</dependency> |
29 |
<dependency> |
|
30 |
<groupId>org.gvsig</groupId> |
|
31 |
<artifactId>org.gvsig.proj.swing.api</artifactId> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.proj.swing.impl</artifactId> |
|
36 |
<scope>test</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.tools</artifactId> |
|
41 |
<scope>test</scope> |
|
42 |
<type>pom</type> |
|
43 |
</dependency> |
|
44 |
<dependency> |
|
45 |
<groupId>org.gvsig</groupId> |
|
46 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
47 |
<type>test-jar</type> |
|
48 |
<scope>test</scope> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
53 |
<scope>test</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
58 |
<scope>test</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.tools.dynform.api</artifactId> |
|
63 |
<scope>test</scope> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>org.gvsig</groupId> |
|
67 |
<artifactId>org.gvsig.tools.dynform.spi</artifactId> |
|
68 |
<scope>test</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.tools.dynform.services</artifactId> |
|
73 |
<scope>test</scope> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.tools.dynform.impl</artifactId> |
|
78 |
<scope>test</scope> |
|
79 |
</dependency> |
|
29 | 80 |
</dependencies> |
30 | 81 |
|
31 | 82 |
<properties> |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.app/src/test/java/org/gvsig/geotools/proj/app/test/TestCrsPanel.java | ||
---|---|---|
1 |
package org.gvsig.geotools.proj.app.test; |
|
2 |
|
|
3 |
|
|
4 |
import javax.swing.JFrame; |
|
5 |
import javax.swing.SwingUtilities; |
|
6 |
|
|
7 |
import org.apache.log4j.ConsoleAppender; |
|
8 |
import org.apache.log4j.Level; |
|
9 |
import org.apache.log4j.PatternLayout; |
|
10 |
import org.gvsig.proj.swing.CoordinateReferenceSystemSelectorComponent; |
|
11 |
import org.gvsig.proj.swing.CoordinateReferenceSystemSwingLocator; |
|
12 |
import org.gvsig.proj.swing.impl.DefaultCoordinateReferenceSystemSwingManager; |
|
13 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
14 |
|
|
15 |
public class TestCrsPanel { |
|
16 |
|
|
17 |
public TestCrsPanel() { |
|
18 |
// TODO Auto-generated constructor stub |
|
19 |
} |
|
20 |
|
|
21 |
public static void main(String[] args) { |
|
22 |
ConsoleAppender console = new ConsoleAppender(); //create appender |
|
23 |
//configure the appender |
|
24 |
String PATTERN = "%d [%p|%c|%C{1}] %m%n"; |
|
25 |
console.setLayout(new PatternLayout(PATTERN)); |
|
26 |
console.setThreshold(Level.ALL); |
|
27 |
console.activateOptions(); |
|
28 |
//add appender to any Logger (here is root) |
|
29 |
org.apache.log4j.Logger.getRootLogger().addAppender(console); |
|
30 |
|
|
31 |
DefaultLibrariesInitializer initializer = new DefaultLibrariesInitializer(); |
|
32 |
initializer.fullInitialize(); |
|
33 |
final JFrame frame = new JFrame(); |
|
34 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
35 |
DefaultCoordinateReferenceSystemSwingManager manager = (DefaultCoordinateReferenceSystemSwingManager) CoordinateReferenceSystemSwingLocator.getSwingManager(); |
|
36 |
|
|
37 |
CoordinateReferenceSystemSelectorComponent selector = manager.createCoordinateReferenceSystemSelectionComponent(); |
|
38 |
frame.add(selector.asJComponent()); |
|
39 |
frame.setSize(400, 600); |
|
40 |
//frame.pack(); |
|
41 |
SwingUtilities.invokeLater(new Runnable() { |
|
42 |
public void run() { |
|
43 |
frame.setVisible(true); |
|
44 |
} |
|
45 |
}); |
|
46 |
|
|
47 |
} |
|
48 |
|
|
49 |
} |
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/pom.xml | ||
---|---|---|
159 | 159 |
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding> |
160 | 160 |
<localRepository>${user.home}/.m2/repository</localRepository> |
161 | 161 |
<site-repository>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</site-repository> |
162 |
<gvsig.tools.version>3.0.145</gvsig.tools.version> |
|
163 |
<gvsig.metadata.version>1.0.0</gvsig.metadata.version> |
|
162 |
<gvsig.proj.version>1.0.5-SNAPSHOT</gvsig.proj.version> |
|
163 |
<!-- <gvsig.tools.version>3.0.145</gvsig.tools.version> |
|
164 |
<gvsig.metadata.version>1.0.0</gvsig.metadata.version> --> |
|
164 | 165 |
<!-- <gvsig.projection.version>2.0.21</gvsig.projection.version> --> |
165 | 166 |
</properties> |
166 | 167 |
<dependencyManagement> |
... | ... | |
175 | 176 |
</dependency> |
176 | 177 |
<dependency> |
177 | 178 |
<groupId>org.gvsig</groupId> |
179 |
<artifactId>org.gvsig.tools</artifactId> |
|
180 |
<version>${gvsig.tools.version}</version> |
|
181 |
<type>pom</type> |
|
182 |
<scope>test</scope> |
|
183 |
</dependency> |
|
184 |
<dependency> |
|
185 |
<groupId>org.gvsig</groupId> |
|
178 | 186 |
<artifactId>org.gvsig.tools.lib</artifactId> |
179 | 187 |
<version>${gvsig.tools.version}</version> |
180 | 188 |
<type>test-jar</type> |
... | ... | |
189 | 197 |
<dependency> |
190 | 198 |
<groupId>org.gvsig</groupId> |
191 | 199 |
<artifactId>org.gvsig.proj.lib.api</artifactId> |
192 |
<version>1.0.5-SNAPSHOT</version>
|
|
200 |
<version>${gvsig.proj.version}</version>
|
|
193 | 201 |
</dependency> |
194 | 202 |
<dependency> |
195 | 203 |
<groupId>org.gvsig</groupId> |
196 | 204 |
<artifactId>org.gvsig.proj.catalog.api</artifactId> |
197 |
<version>1.0.5-SNAPSHOT</version>
|
|
205 |
<version>${gvsig.proj.version}</version>
|
|
198 | 206 |
</dependency> |
199 | 207 |
<dependency> |
200 | 208 |
<groupId>org.gvsig</groupId> |
201 | 209 |
<artifactId>org.gvsig.proj.catalog.api</artifactId> |
202 |
<version>1.0.5-SNAPSHOT</version>
|
|
210 |
<version>${gvsig.proj.version}</version>
|
|
203 | 211 |
<type>test-jar</type> |
204 | 212 |
<scope>test</scope> |
205 | 213 |
</dependency> |
... | ... | |
284 | 292 |
<version>4.12</version> |
285 | 293 |
<scope>test</scope> |
286 | 294 |
</dependency> |
295 |
<dependency> |
|
296 |
<groupId>org.gvsig</groupId> |
|
297 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
298 |
<version>${gvsig.tools.version}</version> |
|
299 |
<scope>test</scope> |
|
300 |
</dependency> |
|
301 |
<dependency> |
|
302 |
<groupId>org.gvsig</groupId> |
|
303 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
304 |
<version>${gvsig.tools.version}</version> |
|
305 |
<scope>test</scope> |
|
306 |
</dependency> |
|
307 |
<dependency> |
|
308 |
<groupId>org.gvsig</groupId> |
|
309 |
<artifactId>org.gvsig.tools.dynform.api</artifactId> |
|
310 |
<version>${gvsig.tools.version}</version> |
|
311 |
<scope>test</scope> |
|
312 |
</dependency> |
|
313 |
<dependency> |
|
314 |
<groupId>org.gvsig</groupId> |
|
315 |
<artifactId>org.gvsig.tools.dynform.spi</artifactId> |
|
316 |
<version>${gvsig.tools.version}</version> |
|
317 |
<scope>test</scope> |
|
318 |
</dependency> |
|
319 |
<dependency> |
|
320 |
<groupId>org.gvsig</groupId> |
|
321 |
<artifactId>org.gvsig.tools.dynform.services</artifactId> |
|
322 |
<version>${gvsig.tools.version}</version> |
|
323 |
<scope>test</scope> |
|
324 |
</dependency> |
|
325 |
<dependency> |
|
326 |
<groupId>org.gvsig</groupId> |
|
327 |
<artifactId>org.gvsig.tools.dynform.impl</artifactId> |
|
328 |
<version>${gvsig.tools.version}</version> |
|
329 |
<scope>test</scope> |
|
330 |
</dependency> |
|
287 | 331 |
</dependencies> |
288 | 332 |
</dependencyManagement> |
289 | 333 |
|
org.gvsig.geotools.proj/trunk/org.gvsig.geotools.proj/org.gvsig.geotools.proj.lib.impl/src/main/java/org/gvsig/geotools/proj/lib/DefaultTransformation.java | ||
---|---|---|
17 | 17 |
import org.gvsig.proj.catalog.exception.NoninvertibleTransformException; |
18 | 18 |
import org.gvsig.proj.catalog.exception.TransformationException; |
19 | 19 |
import org.gvsig.proj.catalog.exception.UnsupportedCoordinateReferenceSystemException; |
20 |
import org.gvsig.proj.catalog.ref.Extent;
|
|
20 |
import org.gvsig.proj.catalog.extent.Extent;
|
|
21 | 21 |
import org.opengis.referencing.ReferenceIdentifier; |
22 | 22 |
import org.opengis.referencing.operation.CoordinateOperation; |
23 | 23 |
import org.opengis.referencing.operation.MathTransform; |
Also available in: Unified diff