root / trunk / libraries / libCq_CMS_praster / src-test / org / cresques / io / datastruct / TestCreatePaletteFromTable.java @ 8026
History | View | Annotate | Download (4.72 KB)
1 |
/*
|
---|---|
2 |
* Created on 17-ago-2006
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*/
|
25 |
package org.cresques.io.datastruct; |
26 |
|
27 |
import junit.framework.TestCase; |
28 |
|
29 |
import org.cresques.io.data.RasterBuf; |
30 |
import org.cresques.util.Utilities; |
31 |
|
32 |
/**
|
33 |
* Este test prueba la creaci?n de paletas a partir de una tabla
|
34 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
35 |
*
|
36 |
*/
|
37 |
public class TestCreatePaletteFromTable extends TestCase{ |
38 |
|
39 |
private Palette palette = new Palette(); |
40 |
public Object [][] table = { |
41 |
{new String("clase19"), new Integer(245), new Integer(243), new Integer(239), new Double(9000), new Integer(255)}, |
42 |
{new String("clase18"), new Integer(221), new Integer(216), new Integer(207), new Double(7000), new Integer(255)}, |
43 |
{new String("clase17"), new Integer(181), new Integer(171), new Integer(155), new Double(4000), new Integer(255)}, |
44 |
{new String("clase16"), new Integer(169), new Integer(157), new Integer(139), new Double(3000), new Integer(255)}, |
45 |
{new String("clase15"), new Integer(168), new Integer(149), new Integer(120), new Double(2000), new Integer(255)}, |
46 |
{new String("clase14"), new Integer(181), new Integer(162), new Integer(133), new Double(1000), new Integer(255)}, |
47 |
{new String("clase13"), new Integer(227), new Integer(228), new Integer(135), new Double(500), new Integer(255)}, |
48 |
{new String("clase12"), new Integer(157), new Integer(209), new Integer(119), new Double(250), new Integer(255)}, |
49 |
{new String("clase11"), new Integer(145), new Integer(191), new Integer(154), new Double(100), new Integer(255)}, |
50 |
{new String("clase10"), new Integer(130), new Integer(182), new Integer(140), new Double(1), new Integer(255)}, |
51 |
{new String("clase9"), new Integer(201), new Integer(223), new Integer(223), new Double(0), new Integer(255)}, |
52 |
{new String("clase8"), new Integer(175), new Integer(209), new Integer(209), new Double(-250), new Integer(255)}, |
53 |
{new String("clase7"), new Integer(149), new Integer(195), new Integer(194), new Double(-500), new Integer(255)}, |
54 |
{new String("clase6"), new Integer(133), new Integer(180), new Integer(223), new Double(-1000), new Integer(255)}, |
55 |
{new String("clase5"), new Integer(106), new Integer(164), new Integer(218), new Double(-2000), new Integer(255)}, |
56 |
{new String("clase4"), new Integer(76), new Integer(146), new Integer(212), new Double(-3000), new Integer(255)}, |
57 |
{new String("clase3"), new Integer(52), new Integer(117), new Integer(184), new Double(-4000), new Integer(255)}, |
58 |
{new String("clase2"), new Integer(36), new Integer(83), new Integer(126), new Double(-6000), new Integer(255)}, |
59 |
{new String("clase1"), new Integer(24), new Integer(53), new Integer(80), new Double(-8000), new Integer(255)}, |
60 |
}; |
61 |
|
62 |
public void setUp() { |
63 |
palette.createPaletteFromTable(table, RasterBuf.TYPE_INT); |
64 |
} |
65 |
|
66 |
public void testStack(){ |
67 |
int[] argb = Utilities.getARGBFromIntToIntArray(palette.getRGB(-7000)); |
68 |
System.out.println(argb[0]+" - "+argb[1]+" - "+argb[2]+" - "+argb[3]); |
69 |
assertEquals(argb[0], 36); |
70 |
assertEquals(argb[1], 83); |
71 |
assertEquals(argb[2], 126); |
72 |
assertEquals(argb[3], 255); |
73 |
argb = Utilities.getARGBFromIntToIntArray(palette.getRGB(-4000)); |
74 |
System.out.println(argb[0]+" - "+argb[1]+" - "+argb[2]+" - "+argb[3]); |
75 |
assertEquals(argb[0], 52); |
76 |
assertEquals(argb[1], 117); |
77 |
assertEquals(argb[2], 184); |
78 |
assertEquals(argb[3], 255); |
79 |
argb = Utilities.getARGBFromIntToIntArray(palette.getRGB(-3999)); |
80 |
System.out.println(argb[0]+" - "+argb[1]+" - "+argb[2]+" - "+argb[3]); |
81 |
assertEquals(argb[0], 76); |
82 |
assertEquals(argb[1], 146); |
83 |
assertEquals(argb[2], 212); |
84 |
assertEquals(argb[3], 255); |
85 |
argb = Utilities.getARGBFromIntToIntArray(palette.getRGB(2005)); |
86 |
System.out.println(argb[0]+" - "+argb[1]+" - "+argb[2]+" - "+argb[3]); |
87 |
assertEquals(argb[0], 169); |
88 |
assertEquals(argb[1], 157); |
89 |
assertEquals(argb[2], 139); |
90 |
assertEquals(argb[3], 255); |
91 |
} |
92 |
} |