Statistics
| Revision:

root / org.gvsig.proj / branches / refactor2018 / org.gvsig.proj / org.gvsig.proj.lib / org.gvsig.proj.lib.api / src / test / java / org / gvsig / proj / CoordinateReferenceSystemManagerIT.java @ 832

History | View | Annotate | Download (3.09 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;
24

    
25
import org.gvsig.proj.catalog.CRSDefinition;
26
import org.gvsig.proj.catalog.TransformationDefinition;
27
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
28

    
29
/**
30
 * {@link CoordinateReferenceSystemManager} API acceptance tests.
31
 * 
32
 * @author gvSIG Team
33
 */
34
public abstract class CoordinateReferenceSystemManagerIT extends
35
    AbstractLibraryAutoInitTestCase {
36

    
37
    protected CoordinateReferenceSystemManager manager;
38

    
39
    protected void doSetUp() throws Exception {
40
        manager = createProjectionManager();
41
    }
42

    
43
    /**
44
     * Creates a {@link CoordinateReferenceSystemManager} instance.
45
     * 
46
     * @return the {@link CoordinateReferenceSystemManager} instance
47
     */
48
    protected abstract CoordinateReferenceSystemManager createProjectionManager();
49

    
50
    /**
51
     * Returns the CRS definition to create the CRSs to test.
52
     * 
53
     * @return the authority name
54
     */
55
    protected abstract CRSDefinition getCoordinateReferenceSystemDefinition();
56
    
57
    /**
58
     * Returns the transformation definition to create the CoordinateTransformation
59
     * to test.
60
     * 
61
     * @return the authority name
62
     */
63
    protected abstract TransformationDefinition getTransformationDefinition();
64

    
65
    /**
66
     * Test method for
67
     * {@link org.gvsig.proj.CoordinateReferenceSystemManager#getCoordinateReferenceSystem(CRSDefinition)}
68
     */
69
    public void testGetProjectionFromDefinition() throws Exception {
70
            CRSDefinition definition = getCoordinateReferenceSystemDefinition();
71
        CoordinateReferenceSystem crs =
72
            manager.getCoordinateReferenceSystem(definition);
73
        assertNotNull(crs);
74
        assertEquals(definition, crs.getDefinition());
75
    }
76
    
77
    /**
78
     * Test method for
79
     * {@link org.gvsig.proj.CoordinateReferenceSystemManager#getCoordinateTransformation(TransformationDefinition)}
80
     */
81
    public void testGetTransformationFromDefinition() throws Exception {
82
            TransformationDefinition definition = getTransformationDefinition();
83
        CoordinateTransformation ct =
84
            manager.getCoordinateTransformation(definition);
85
        assertNotNull(ct);
86
        assertEquals(definition, ct.getDefinition());
87

    
88
    }
89
 
90
}