root / org.gvsig.proj / branches / refactor2018 / org.gvsig.proj / org.gvsig.proj.catalog / org.gvsig.proj.catalog.api / src / test / java / org / gvsig / proj / catalog / CoordinateTransformationIT.java @ 829
History | View | Annotate | Download (4.23 KB)
1 |
/* gvSIG. Desktop Geographic Information System.
|
---|---|
2 |
*
|
3 |
* Copyright ? 2007-2012 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.gvsig.proj.catalog; |
24 |
|
25 |
import org.gvsig.proj.catalog.CRSDefinition; |
26 |
import org.gvsig.proj.catalog.TransformationDefinition; |
27 |
import org.gvsig.proj.catalog.exception.NoninvertibleTransformException; |
28 |
import org.gvsig.proj.catalog.exception.UnsupportedTransformationException; |
29 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
30 |
|
31 |
/**
|
32 |
* {@link TransformationDefinition} API acceptance tests.
|
33 |
*
|
34 |
* @author gvSIG Team
|
35 |
*/
|
36 |
public abstract class CoordinateTransformationIT extends |
37 |
AbstractLibraryAutoInitTestCase { |
38 |
|
39 |
protected CRSDefinition source;
|
40 |
protected CRSDefinition target;
|
41 |
protected TransformationDefinition transformation;
|
42 |
|
43 |
protected void doSetUp() throws Exception { |
44 |
source = createSourceProjection(); |
45 |
target = createTargetProjection(); |
46 |
transformation = createTransformation(); |
47 |
} |
48 |
|
49 |
/**
|
50 |
* Creates the transformation to test
|
51 |
*
|
52 |
* @return
|
53 |
* @throws Exception
|
54 |
*/
|
55 |
protected abstract TransformationDefinition createTransformation() |
56 |
throws Exception; |
57 |
|
58 |
/**
|
59 |
* Creates the source CRSDefinition, which must match the
|
60 |
* source CRS of the transformation to test
|
61 |
* @return
|
62 |
* @throws Exception
|
63 |
*/
|
64 |
protected abstract CRSDefinition createSourceProjection() |
65 |
throws Exception; |
66 |
|
67 |
/**
|
68 |
* Returns the name of the authority which defines the
|
69 |
* transformation to be tested
|
70 |
*
|
71 |
* @return
|
72 |
*/
|
73 |
protected abstract String getAuthorityName(); |
74 |
|
75 |
/**
|
76 |
* Creates the target CRSDefinition, which must match the
|
77 |
* target CRS of the transformation to test
|
78 |
* @return
|
79 |
* @throws Exception
|
80 |
*/
|
81 |
protected abstract CRSDefinition createTargetProjection() |
82 |
throws Exception; |
83 |
|
84 |
/**
|
85 |
* Test method for
|
86 |
* {@link org.gvsig.proj.catalogue.TransformationDefinition#getAuthorityName()}.
|
87 |
*/
|
88 |
public void testGetAuthorityName() { |
89 |
assertEquals(getAuthorityName(), transformation.getAuthorityName()); |
90 |
} |
91 |
|
92 |
/**
|
93 |
* Test method for
|
94 |
* {@link org.gvsig.proj.catalogue.TransformationDefinition#getIdentifier()}.
|
95 |
*/
|
96 |
// public void testGetIdentifier() {
|
97 |
// assertEquals(getProjectedCode(), projCrsDef.getIdentifier());
|
98 |
// }
|
99 |
|
100 |
/**
|
101 |
* Test method for
|
102 |
* {@link org.gvsig.proj.catalogue.TransformationDefinition#getSourceDefinition()}.
|
103 |
*/
|
104 |
public void testGetSourceProjection() { |
105 |
assertEquals(source, transformation.getSourceDefinition()); |
106 |
} |
107 |
|
108 |
/**
|
109 |
* Test method for
|
110 |
* {@link org.gvsig.proj.catalogue.TransformationDefinition#getTargetDefinition()}.
|
111 |
*/
|
112 |
public void testGetTargetProjection() { |
113 |
assertEquals(target, transformation.getTargetDefinition()); |
114 |
} |
115 |
|
116 |
/**
|
117 |
* Test method for
|
118 |
* {@link org.gvsig.proj.catalogue.TransformationDefinition#getInverseDefinition()}.
|
119 |
* @throws NoninvertibleTransformException
|
120 |
* @throws UnsupportedTransformationException
|
121 |
*/
|
122 |
public void testGetReverse() throws NoninvertibleTransformException, UnsupportedTransformationException { |
123 |
TransformationDefinition inverseTransformation = |
124 |
transformation.getInverseDefinition(); |
125 |
assertEquals(target, inverseTransformation.getSourceDefinition()); |
126 |
assertEquals(source, inverseTransformation.getTargetDefinition()); |
127 |
} |
128 |
|
129 |
} |