1 |
alfonx |
1212 |
package skrueger.geotools; |
2 |
|
|
|
3 |
alfonx |
1218 |
import static org.junit.Assert.*; |
4 |
alfonx |
1215 |
import static org.junit.Assert.assertNotNull; |
5 |
|
|
import static org.junit.Assert.assertTrue; |
6 |
alfonx |
1212 |
|
7 |
alfonx |
1215 |
import java.awt.image.ColorModel; |
8 |
|
|
import java.io.IOException; |
9 |
|
|
|
10 |
alfonx |
1218 |
import org.geotools.geometry.jts.ReferencedEnvelope; |
11 |
alfonx |
1212 |
import org.junit.After; |
12 |
|
|
import org.junit.Before; |
13 |
|
|
import org.junit.Test; |
14 |
|
|
|
15 |
alfonx |
1218 |
import com.vividsolutions.jts.geom.Envelope; |
16 |
|
|
|
17 |
alfonx |
1215 |
import schmitzm.swing.TestingUtil; |
18 |
|
|
|
19 |
alfonx |
1212 |
public class StyledLayerUtilTest { |
20 |
|
|
|
21 |
|
|
@Before |
22 |
|
|
public void setUp() throws Exception { |
23 |
|
|
} |
24 |
|
|
|
25 |
|
|
@After |
26 |
|
|
public void tearDown() throws Exception { |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
@Test |
30 |
alfonx |
1215 |
public void testGetColorModel() throws IOException { |
31 |
|
|
StyledGridCoverageReader styled = TestingUtil.TestDatasetsRaster.geotiffWithSld |
32 |
|
|
.getStyled(); |
33 |
|
|
ColorModel colorModel = StyledLayerUtil.getColorModel(styled); |
34 |
|
|
assertNotNull(colorModel); |
35 |
alfonx |
1212 |
} |
36 |
|
|
|
37 |
|
|
@Test |
38 |
alfonx |
1218 |
public void testGetBoundsAndCrs1() throws IOException { |
39 |
|
|
StyledGridCoverageReader styled = TestingUtil.TestDatasetsRaster.geotiffWithSld |
40 |
|
|
.getStyled(); |
41 |
|
|
Envelope env = styled.getEnvelope(); |
42 |
|
|
|
43 |
|
|
assertNotNull(env); |
44 |
|
|
assertEquals( |
45 |
|
|
"Env[269666.0316659544 : 503516.0316659544, -106963.90575157234 : 161836.09424842766]", |
46 |
|
|
env.toString()); |
47 |
|
|
|
48 |
|
|
ReferencedEnvelope refenv = styled.getReferencedEnvelope(); |
49 |
|
|
|
50 |
|
|
assertNotNull(refenv); |
51 |
|
|
assertEquals( |
52 |
|
|
"ReferencedEnvelope[269666.0316659544 : 503516.0316659544, -106963.90575157234 : 161836.09424842766]", |
53 |
|
|
refenv.toString()); |
54 |
|
|
assertEquals("unnamed", refenv.getCoordinateReferenceSystem().getName() |
55 |
|
|
.toString()); |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
@Test |
59 |
|
|
public void testGetBoundsAndCrs2() throws IOException { |
60 |
|
|
StyledGridCoverageReader styled = TestingUtil.TestDatasetsRaster.geotiffRGBWithoutSLD |
61 |
|
|
.getStyled(); |
62 |
|
|
Envelope env = styled.getEnvelope(); |
63 |
|
|
|
64 |
|
|
assertNotNull(env); |
65 |
|
|
assertEquals( |
66 |
|
|
"Env[269423.4645826937 : 504863.4645826937, -104051.22125889576 : 162438.77874110424]", |
67 |
|
|
env.toString()); |
68 |
|
|
|
69 |
|
|
ReferencedEnvelope refenv = styled.getReferencedEnvelope(); |
70 |
|
|
|
71 |
|
|
assertNotNull(refenv); |
72 |
|
|
assertEquals( |
73 |
|
|
"ReferencedEnvelope[269423.4645826937 : 504863.4645826937, -104051.22125889576 : 162438.77874110424]", |
74 |
|
|
refenv.toString()); |
75 |
|
|
assertEquals("unnamed", refenv.getCoordinateReferenceSystem().getName() |
76 |
|
|
.toString()); |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
@Test |
80 |
|
|
public void testGetBoundsAndCrs3() throws IOException { |
81 |
|
|
StyledGridCoverageReader styled = TestingUtil.TestDatasetsRaster.arcAscii |
82 |
|
|
.getStyled(); |
83 |
|
|
Envelope env = styled.getEnvelope(); |
84 |
|
|
|
85 |
|
|
assertNotNull(env); |
86 |
|
|
assertEquals( |
87 |
|
|
"Env[167285.07632269844 : 722285.0763226985, 651967.6461872223 : 1440651.856713538]", |
88 |
|
|
env.toString()); |
89 |
|
|
|
90 |
|
|
ReferencedEnvelope refenv = styled.getReferencedEnvelope(); |
91 |
|
|
|
92 |
|
|
assertNotNull(refenv); |
93 |
|
|
assertEquals( |
94 |
|
|
"ReferencedEnvelope[167285.07632269844 : 722285.0763226985, 651967.6461872223 : 1440651.856713538]", |
95 |
|
|
refenv.toString()); |
96 |
|
|
assertEquals("EPSG:WGS 84", refenv.getCoordinateReferenceSystem() |
97 |
|
|
.getName().toString()); |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
@Test |
101 |
alfonx |
1215 |
public void testIsStyleable() throws IOException { |
102 |
|
|
StyledGridCoverageReader styled = TestingUtil.TestDatasetsRaster.geotiffWithSld |
103 |
|
|
.getStyled(); |
104 |
|
|
assertTrue(StyledLayerUtil.isStyleable(styled)); |
105 |
alfonx |
1212 |
} |
106 |
|
|
|
107 |
|
|
} |