Revision 6899

View differences:

org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.file.jimi.legend/src/main/java/org/gvsig/fmap/dal/file/jimi/legend/JimiGetColorTable.java
11 11
import org.gvsig.fmap.dal.file.jimi.MemoryImage;
12 12
import org.gvsig.fmap.dal.raster.api.RasterStore;
13 13
import org.gvsig.raster.lib.legend.api.ColorInterpretation;
14
import org.gvsig.raster.lib.legend.api.ColorTable;
15
import org.gvsig.raster.lib.legend.api.ColorTableClass;
16 14
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
17 15
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
16
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
17
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
18 18
import org.gvsig.tools.ToolsLocator;
19 19
import org.gvsig.tools.dynobject.DynClass;
20 20
import org.gvsig.tools.dynobject.DynMethod;
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.file.jimi.legend/src/main/java/org/gvsig/fmap/dal/file/jimi/legend/JimiGetLegend.java
3 3
import org.gvsig.fmap.dal.file.jimi.JimiRasterStoreProvider;
4 4
import org.gvsig.fmap.dal.raster.api.RasterStore;
5 5
import org.gvsig.raster.lib.legend.api.ColorInterpretation;
6
import org.gvsig.raster.lib.legend.api.ColorTable;
7 6
import org.gvsig.raster.lib.legend.api.RasterLegend;
8 7
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
9 8
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
9
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
10 10
import org.gvsig.tools.ToolsLocator;
11 11
import org.gvsig.tools.dynobject.DynClass;
12 12
import org.gvsig.tools.dynobject.DynMethod;
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/DefaultRasterLegendManager.java
8 8
import java.util.List;
9 9
import java.util.Map;
10 10

  
11
import org.apache.commons.lang3.tuple.ImmutablePair;
12
import org.apache.commons.lang3.tuple.Pair;
13
import org.slf4j.Logger;
14
import org.slf4j.LoggerFactory;
15

  
11 16
import org.gvsig.raster.lib.buffer.api.FilterList;
12 17
import org.gvsig.raster.lib.legend.api.ColorInterpretation;
13
import org.gvsig.raster.lib.legend.api.ColorTable;
14
import org.gvsig.raster.lib.legend.api.ColorTableClass;
15
import org.gvsig.raster.lib.legend.api.ColorTableIO;
16
import org.gvsig.raster.lib.legend.api.ColorTableIOFactory;
17 18
import org.gvsig.raster.lib.legend.api.RasterLegend;
18 19
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
19 20
import org.gvsig.raster.lib.legend.api.Transparency;
20 21
import org.gvsig.raster.lib.legend.api.TransparencyRange;
22
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
23
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
24
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
25
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIOFactory;
26
import org.gvsig.raster.lib.legend.api.colortable.MakeColorTable;
27
import org.gvsig.raster.lib.legend.impl.colortable.DefaultMakeColorTable;
21 28
import org.gvsig.raster.lib.legend.impl.io.gvSIGColorTableIO;
22 29

  
23
import org.apache.commons.lang3.tuple.ImmutablePair;
24
import org.apache.commons.lang3.tuple.Pair;
25
import org.slf4j.Logger;
26
import org.slf4j.LoggerFactory;
27

  
28 30
/**
29 31
 * Default implementation of {@link RasterLegendManager}.
30 32
 *
......
235 237
        return new DefaultTransparencyRange(redRange, greenRange, blueRange, alpha, isAnd);
236 238
    }
237 239

  
240

  
241
    @Override
242
    public MakeColorTable createMakeColorTable() {
243
        return new DefaultMakeColorTable();
244
    }
238 245
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/DefaultColorTableClass.java
3 3
import java.awt.Color;
4 4

  
5 5
import org.apache.commons.lang3.StringUtils;
6
import org.gvsig.raster.lib.legend.api.ColorTableClass;
6

  
7
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
7 8
import org.gvsig.tools.ToolsLocator;
8 9
import org.gvsig.tools.dynobject.DynStruct;
9 10
import org.gvsig.tools.persistence.PersistenceManager;
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/DefaultRasterLegend.java
27 27
import org.gvsig.raster.lib.buffer.api.NoData;
28 28
import org.gvsig.raster.lib.buffer.api.exceptions.BufferException;
29 29
import org.gvsig.raster.lib.legend.api.ColorInterpretation;
30
import org.gvsig.raster.lib.legend.api.ColorTable;
31 30
import org.gvsig.raster.lib.legend.api.RasterLegend;
32 31
import org.gvsig.raster.lib.legend.api.Transparency;
32
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
33 33
import org.gvsig.tools.ToolsLocator;
34 34
import org.gvsig.tools.dispose.DisposeUtils;
35 35
import org.gvsig.tools.dynobject.DynStruct;
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/colortable/DefaultMakeColorTable.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 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.raster.lib.legend.impl.colortable;
24

  
25
import java.awt.Color;
26
import java.util.List;
27

  
28
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
29
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
30
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
31
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
32
import org.gvsig.raster.lib.legend.api.colortable.MakeColorTable;
33

  
34

  
35
/**
36
 * @author fdiaz
37
 *
38
 */
39
public class DefaultMakeColorTable implements MakeColorTable {
40

  
41
    private String name;
42
    private double minimum;
43
    private double maximum;
44
    private int mode;
45
    private double intervalSize;
46
    private int intervals;
47
    private Color fromColor;
48
    private Color toColor;
49
    private boolean interpolated;
50

  
51
    /* (non-Javadoc)
52
     * @see org.gvsig.raster.tools.lib.api.colortable.CreateColorTable#setName(java.lang.String)
53
     */
54
    @Override
55
    public void setName(String name) {
56
        this.name = name;
57
    }
58

  
59
    /* (non-Javadoc)
60
     * @see org.gvsig.raster.tools.lib.api.colortable.CreateColorTable#setMinimum(double)
61
     */
62
    @Override
63
    public void setMinimum(double minimum) {
64
        this.minimum = minimum;
65
    }
66

  
67
    /* (non-Javadoc)
68
     * @see org.gvsig.raster.tools.lib.api.colortable.CreateColorTable#setMaximum(double)
69
     */
70
    @Override
71
    public void setMaximum(double maximum) {
72
        this.maximum = maximum;
73
    }
74

  
75
    /* (non-Javadoc)
76
     * @see org.gvsig.raster.tools.lib.api.colortable.CreateColorTable#setMode(int)
77
     */
78
    @Override
79
    public void setMode(int mode) {
80
        this.mode = mode;
81
    }
82

  
83
    /* (non-Javadoc)
84
     * @see org.gvsig.raster.tools.lib.api.colortable.CreateColorTable#setIntervalSize(double)
85
     */
86
    @Override
87
    public void setIntervalSize(double intervalSize) {
88
        this.intervalSize = intervalSize;
89
    }
90

  
91
    /* (non-Javadoc)
92
     * @see org.gvsig.raster.tools.lib.api.colortable.CreateColorTable#setIntervals(int)
93
     */
94
    @Override
95
    public void setIntervals(int intervals) {
96
        this.intervals = intervals;
97
    }
98

  
99
    /* (non-Javadoc)
100
     * @see org.gvsig.raster.tools.lib.api.colortable.CreateColorTable#setFromColor(java.awt.Color)
101
     */
102
    @Override
103
    public void setFromColor(Color fromColor) {
104
        this.fromColor = fromColor;
105
    }
106

  
107
    /* (non-Javadoc)
108
     * @see org.gvsig.raster.tools.lib.api.colortable.CreateColorTable#setToColor(java.awt.Color)
109
     */
110
    @Override
111
    public void setToColor(Color toColor) {
112
        this.toColor = toColor;
113
    }
114

  
115
    /* (non-Javadoc)
116
     * @see org.gvsig.raster.tools.lib.api.colortable.CreateColorTable#getColorTable()
117
     */
118
    @Override
119
    public ColorTable getColorTable() {
120
        RasterLegendManager legendManager = RasterLegendLocator.getRasterLegendManager();
121
        List<ColorTableClass> listColorTableClasses = null;
122
        switch (mode) {
123
        case MakeColorTable.MODE_INTERVAL_SIZE:
124
            listColorTableClasses = legendManager.createListColorTableClasses(minimum, maximum, intervalSize, fromColor, toColor);
125
            break;
126
        case MakeColorTable.MODE_NUMBER_OF_INTERVALS:
127
            listColorTableClasses = legendManager.createListColorTableClasses(minimum, maximum, intervals, fromColor, toColor);
128
            break;
129
        }
130

  
131
        ColorTable colorTable = legendManager.createColorTable(name, listColorTableClasses, interpolated);
132

  
133
        return colorTable;
134
    }
135

  
136
    @Override
137
    public void setInterpolated(boolean interpolated) {
138
        this.interpolated = interpolated;
139
    }
140

  
141
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/io/gvSIGColorTableIO.java
11 11
import java.util.ArrayList;
12 12
import java.util.List;
13 13

  
14
import org.gvsig.raster.lib.legend.api.ColorTable;
15
import org.gvsig.raster.lib.legend.api.ColorTableClass;
16
import org.gvsig.raster.lib.legend.api.ColorTableIO;
17 14
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
18 15
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
16
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
17
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
18
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
19 19
import org.gvsig.raster.lib.legend.api.exceptions.ColorTableIOException;
20

  
20 21
import org.kxml2.io.KXmlParser;
21 22
import org.kxml2.io.KXmlSerializer;
22 23
import org.slf4j.Logger;
......
25 26

  
26 27
/**
27 28
 * {@link ColorTableIO} to read and write gvSIG color tables.
28
 * 
29
 *
29 30
 * @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
30 31
 *
31 32
 */
......
87 88
        for (int i = 0; i < parser.getAttributeCount(); i++) {
88 89
            if (parser.getAttributeName(i).equals("name")) {
89 90
                colorTable.setName(parser.getAttributeValue(i));
90
                break;
91
                continue;
92
            } else if (parser.getAttributeName(i).equals("interpolated")) {
93
                colorTable.setInterpolated(Boolean.parseBoolean(parser.getAttributeValue(i)));
94
                continue;
91 95
            }
96

  
92 97
        }
93 98

  
94 99
        try {
......
182 187
            // Just notice but not throw an exception
183 188
            LOG.warn("Can not close input stream", e);
184 189
        }
185
        
190

  
186 191
        colorTable.setClasses(classes, false);
187 192
        return colorTable;
188 193
    }
......
212 217
            parserOutput.startDocument("UTF-8", null);
213 218
            parserOutput.startTag(null, "ColorTable");
214 219
            parserOutput.attribute(null, "name", colorTable.getName());
220
            parserOutput.attribute(null, "interpolated", String.valueOf(colorTable.isInterpolated()));
215 221
            parserOutput.attribute(null, "version", "1.1");
216 222
            parserOutput.text("\n");
217 223

  
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/io/GimpGradientColorTableIOFactory.java
4 4

  
5 5
import org.apache.commons.io.FilenameUtils;
6 6

  
7
import org.gvsig.raster.lib.legend.api.ColorTableIO;
8
import org.gvsig.raster.lib.legend.api.ColorTableIOFactory;
7
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
8
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIOFactory;
9 9

  
10 10
/**
11 11
 * Factory to create {@link GimpGradientColorTableIO}.
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/io/GimpPaletteColorTableIOFactory.java
4 4

  
5 5
import org.apache.commons.io.FilenameUtils;
6 6

  
7
import org.gvsig.raster.lib.legend.api.ColorTableIO;
8
import org.gvsig.raster.lib.legend.api.ColorTableIOFactory;
7
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
8
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIOFactory;
9 9

  
10 10

  
11 11
/**
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/io/gvSIGColorTableIOFactory.java
4 4

  
5 5
import org.apache.commons.io.FilenameUtils;
6 6

  
7
import org.gvsig.raster.lib.legend.api.ColorTableIO;
8
import org.gvsig.raster.lib.legend.api.ColorTableIOFactory;
7
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
8
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIOFactory;
9 9

  
10 10
/**
11 11
 * Factory to create instances of {@link gvSIGColorTableIO}.
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/io/GimpGradientColorTableIO.java
11 11
import java.util.ArrayList;
12 12
import java.util.List;
13 13

  
14
import org.gvsig.raster.lib.legend.api.ColorTable;
15
import org.gvsig.raster.lib.legend.api.ColorTableClass;
16
import org.gvsig.raster.lib.legend.api.ColorTableIO;
17 14
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
15
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
16
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
17
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
18 18
import org.gvsig.raster.lib.legend.api.exceptions.ColorTableIOException;
19

  
19 20
import org.slf4j.Logger;
20 21
import org.slf4j.LoggerFactory;
21 22

  
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/io/GimpPaletteColorTableIO.java
10 10
import java.util.ArrayList;
11 11
import java.util.List;
12 12

  
13
import org.gvsig.raster.lib.legend.api.ColorTable;
14
import org.gvsig.raster.lib.legend.api.ColorTableClass;
15
import org.gvsig.raster.lib.legend.api.ColorTableIO;
16 13
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
14
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
15
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
16
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
17 17
import org.gvsig.raster.lib.legend.api.exceptions.ColorTableIOException;
18

  
18 19
import org.slf4j.Logger;
19 20
import org.slf4j.LoggerFactory;
20 21

  
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/DefaultColorTable.java
8 8

  
9 9
import org.apache.commons.lang3.StringUtils;
10 10

  
11
import org.gvsig.raster.lib.legend.api.ColorTable;
12
import org.gvsig.raster.lib.legend.api.ColorTableClass;
13 11
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
14 12
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
13
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
14
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
15 15
import org.gvsig.tools.ToolsLocator;
16 16
import org.gvsig.tools.dynobject.DynStruct;
17 17
import org.gvsig.tools.persistence.PersistenceManager;
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/test/java/org/gvsig/raster/lib/legend/impl/DefaultRasterLegendTest.java
12 12

  
13 13
import javax.imageio.ImageIO;
14 14

  
15
import org.apache.commons.lang3.tuple.Pair;
15 16
import org.cresques.cts.IProjection;
17

  
16 18
import org.gvsig.fmap.crs.CRSFactory;
17 19
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
18 20
import org.gvsig.fmap.geom.GeometryLocator;
......
27 29
import org.gvsig.raster.lib.buffer.api.NoData;
28 30
import org.gvsig.raster.lib.buffer.api.exceptions.BufferException;
29 31
import org.gvsig.raster.lib.legend.api.ColorInterpretation;
30
import org.gvsig.raster.lib.legend.api.ColorTable;
31
import org.gvsig.raster.lib.legend.api.ColorTableClass;
32 32
import org.gvsig.raster.lib.legend.api.RasterLegend;
33 33
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
34 34
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
35 35
import org.gvsig.raster.lib.legend.api.Transparency;
36
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
37
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
36 38
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
37 39

  
38 40
/**
39
 * 
41
 *
40 42
 * @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
41 43
 *
42 44
 */
......
171 173

  
172 174
        rasterLegend.draw(image.getGraphics(), buffer, viewPort, null);
173 175
    }
174
    
176

  
175 177
    public void testDrawRGBBufferProjected(){
176 178
        BufferManager bufferManager = BufferLocator.getBufferManager();
177 179

  
......
209 211
            for(int i = 0; i < 1000; i++){
210 212
                byteData[i] = (byte) (i * 255 / 1000);
211 213
            }
212
            
214

  
213 215
            buffer =
214 216
                bufferManager.createBuffer(1000, 1000, bandDataTypes, bandNodata, epsg25830, bufferEnvelope);
215 217

  
......
238 240

  
239 241
        rasterLegend.draw(image.getGraphics(), buffer, viewPort, null);
240 242
    }
241
    
243

  
242 244
    public void testDrawRGBBufferProjected2(){
243 245
        BufferManager bufferManager = BufferLocator.getBufferManager();
244 246

  
......
276 278
            for(int i = 0; i < 1000; i++){
277 279
                byteData[i] = (byte) (i * 255 / 1000);
278 280
            }
279
            
281

  
280 282
            buffer =
281 283
                bufferManager.createBuffer(1000, 1000, bandDataTypes, bandNodata, epsg25830, bufferEnvelope);
282 284

  
......
305 307

  
306 308
        rasterLegend.draw(image.getGraphics(), buffer, viewPort, null);
307 309
    }
308
    
310

  
309 311
    public void testDrawRGBBufferProjected3(){
310 312
        BufferManager bufferManager = BufferLocator.getBufferManager();
311 313

  
......
343 345
            for(int i = 0; i < 1000; i++){
344 346
                byteData[i] = (byte) (i * 255 / 1000);
345 347
            }
346
            
348

  
347 349
            buffer =
348 350
                bufferManager.createBuffer(1000, 1000, bandDataTypes, bandNodata, epsg25830, bufferEnvelope);
349 351

  
......
560 562
        rasterLegend.setColorInterpretation(colorInterpretation);
561 563
        assertNotNull(rasterLegend.getColorInterpretation());
562 564
    }
563
    
565

  
564 566
    public void testGetColorTablesFile(){
565
        
567

  
566 568
        RasterLegendManager rasterLegendManager = RasterLegendLocator.getRasterLegendManager();
567 569
        URL resource = this.getClass().getClassLoader().getResource("colorTables");
568 570
        File colorTableFoler = new File(resource.getFile());
569
        List<ColorTable> colorTables = rasterLegendManager.getColorTables(colorTableFoler);
570
        
571
        List<Pair<File, ColorTable>> colorTables = rasterLegendManager.getColorTables(colorTableFoler);
572

  
571 573
        assertEquals(3, colorTables.size());
572
        for (ColorTable colorTable : colorTables) {
573
            if (!colorTable.getName().equals("GIMP Gradient")
574
                && colorTable.getName().equals("GIMP Palette")
575
                && colorTable.getName().equals("1  Forest - Soil  (100)")) {
576
                fail(colorTable.getName().concat(" is not recognised"));
574
        for (Pair<File, ColorTable> colorTable : colorTables) {
575
            if (!colorTable.getValue().getName().equals("GIMP Gradient")
576
                && colorTable.getValue().getName().equals("GIMP Palette")
577
                && colorTable.getValue().getName().equals("1  Forest - Soil  (100)")) {
578
                fail(colorTable.getValue().getName().concat(" is not recognised"));
577 579
            }
578 580
        }
579 581
    }
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/test/java/org/gvsig/raster/lib/legend/impl/io/GimpGradientColorTableIOTest.java
6 6
import java.util.ArrayList;
7 7
import java.util.List;
8 8

  
9
import org.gvsig.raster.lib.legend.api.ColorTable;
10
import org.gvsig.raster.lib.legend.api.ColorTableClass;
11
import org.gvsig.raster.lib.legend.api.ColorTableIO;
12
import org.gvsig.raster.lib.legend.api.ColorTableIOFactory;
13 9
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
14 10
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
11
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
12
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
13
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
14
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIOFactory;
15 15
import org.gvsig.raster.lib.legend.api.exceptions.ColorTableIOException;
16 16
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
17 17

  
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/test/java/org/gvsig/raster/lib/legend/impl/io/GimpPaletteColorTableIOTest.java
6 6
import java.util.ArrayList;
7 7
import java.util.List;
8 8

  
9
import org.gvsig.raster.lib.legend.api.ColorTable;
10
import org.gvsig.raster.lib.legend.api.ColorTableClass;
11
import org.gvsig.raster.lib.legend.api.ColorTableIO;
12
import org.gvsig.raster.lib.legend.api.ColorTableIOFactory;
13 9
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
14 10
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
11
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
12
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
13
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
14
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIOFactory;
15 15
import org.gvsig.raster.lib.legend.api.exceptions.ColorTableIOException;
16 16
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
17 17

  
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/test/java/org/gvsig/raster/lib/legend/impl/io/gvSIGColorTableIOTest.java
6 6
import java.util.ArrayList;
7 7
import java.util.List;
8 8

  
9
import org.gvsig.raster.lib.legend.api.ColorTable;
10
import org.gvsig.raster.lib.legend.api.ColorTableClass;
11
import org.gvsig.raster.lib.legend.api.ColorTableIO;
12
import org.gvsig.raster.lib.legend.api.ColorTableIOFactory;
13 9
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
14 10
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
11
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
12
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
13
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
14
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIOFactory;
15 15
import org.gvsig.raster.lib.legend.api.exceptions.ColorTableIOException;
16 16
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
17 17

  
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/ColorTable.java
1
package org.gvsig.raster.lib.legend.api;
2

  
3
import java.util.List;
4

  
5
import org.gvsig.tools.lang.Cloneable;
6
import org.gvsig.tools.persistence.Persistent;
7

  
8
/**
9
 * @author fdiaz
10
 *
11
 */
12
public interface ColorTable extends Persistent, Cloneable {
13

  
14
    /**
15
     * Compress {@link ColorTable} to reduce number of {@link ColorTableClass}.
16
     */
17
    public void compressPalette();
18

  
19
    /**
20
     * Copies from {@link ColorTable} received as parameter
21
     *
22
     * @param colorTable
23
     *            {@link ColorTable} to be copied
24
     */
25
    public void copyFrom(ColorTable colorTable);
26

  
27
    /**
28
     * @return {@link ColorTableClass} of this {@link ColorTable}
29
     */
30
    public List<ColorTableClass> getClasses();
31

  
32
    /**
33
     * @return Gets the name of this {@link ColorTable}
34
     */
35
    public String getName();
36

  
37
    /**
38
     * @return Return if {@link ColorTable} has alpha
39
     */
40
    public boolean hasAlpha();
41

  
42
    /**
43
     * @return Gets if this {@link ColorTable} is interpolated
44
     */
45
    public boolean isInterpolated();
46

  
47
    /**
48
     * Remove duplicated values of {@link ColorTableClass}
49
     */
50
    public void removeDuplicatedValues();
51

  
52
    /**
53
     * Sets {@link ColorTableClass} of this {@link ColorTable} and recalculates
54
     * palette color of this {@link ColorTable}.
55
     *
56
     * @param colorTableClasses
57
     *            New classes of this {@link ColorTable}
58
     * @param compress
59
     *            True to compress palette color.
60
     */
61
    public void setClasses(List<ColorTableClass> colorTableClasses, boolean compress);
62

  
63
    /**
64
     * Calculates and sets {@link ColorTableClass} of this {@link ColorTable}
65
     * take into account min and max value. Palette color is recalculated with
66
     * new color table classes.
67
     *
68
     * @param min
69
     *            Minimum value of {@link ColorTableClass}
70
     * @param max
71
     *            Maximum value of {@link ColorTableClass}
72
     * @param compress
73
     *            True to compress {@link ColorTable}.
74
     */
75
    public void setClasses(double min, double max, boolean compress);
76

  
77
    /**
78
     * Sets interpolated to this {@link ColorTable}
79
     *
80
     * @param interpolated
81
     */
82
    public void setInterpolated(boolean interpolated);
83

  
84
    /**
85
     * Sets name of this {@link ColorTable}
86
     *
87
     * @param name
88
     */
89
    public void setName(String name);
90

  
91
    /**
92
     * Get RGBA values defined by {@link ColorTableClass}
93
     *
94
     * @param value
95
     *            Value to get RGBA
96
     * @return Byte array with RGBA values
97
     */
98
    byte[] getRGBA(Object value);
99
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/ColorTableIOFactory.java
1
package org.gvsig.raster.lib.legend.api;
2

  
3
import java.io.File;
4

  
5

  
6
/**
7
 * @author fdiaz
8
 *
9
 */
10
public interface ColorTableIOFactory {
11

  
12
    /**
13
     * @return the name
14
     */
15
    public String getName();
16

  
17
    /**
18
     * Return true if factory can create a {@link ColorTableIO} from file
19
     *
20
     * @param file
21
     * @return True if factory accepts file, otherwise false.
22
     */
23
    public boolean accept(File file);
24

  
25
    /**
26
     * @return ColorTableProvider
27
     */
28
    public ColorTableIO create();
29

  
30
    /**
31
     * @return
32
     */
33
    public String getDefaultExtension();
34

  
35
    /**
36
     * @return
37
     */
38
    public String getDescription();
39

  
40
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/ColorTableClass.java
1
package org.gvsig.raster.lib.legend.api;
2

  
3
import java.awt.Color;
4

  
5
import org.gvsig.tools.persistence.Persistent;
6

  
7
/**
8
 * Class to represent each class of a {@link ColorTable}
9
 * 
10
 * @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
11
 *
12
 */
13
public interface ColorTableClass extends Persistent, Comparable<ColorTableClass> {
14

  
15
    /**
16
     * @return Gets the color of {@link ColorTableClass}
17
     */
18
    public Color getColor();
19

  
20
    /**
21
     * Sets the color of {@link ColorTableClass}
22
     * 
23
     * @param color
24
     *            {@link Color} of class
25
     */
26
    public void setColor(Color color);
27

  
28
    /**
29
     * @return Gets the percent of interpolation with the next
30
     *         {@link ColorTableClass}
31
     */
32
    public double getInterpolated();
33

  
34
    /**
35
     * Sets percent of interpolation with the next {@link ColorTableClass}.
36
     * 
37
     * @param interpolated
38
     *            Percent value.
39
     */
40
    public void setInterpolated(double interpolated);
41

  
42
    /**
43
     * @return Gets value of {@link ColorTableClass}
44
     */
45
    public double getValue();
46

  
47
    /**
48
     * Sets value of {@link ColorTableClass}
49
     * 
50
     * @param value
51
     *            Value of this class.
52
     */
53
    public void setValue(double value);
54

  
55
    /**
56
     * @return Gets name of class
57
     */
58
    public String getName();
59

  
60
    /**
61
     * Sets name of this class
62
     * 
63
     * @param nameClass
64
     *            Name of this class
65
     */
66
    public void setName(String nameClass);
67

  
68
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/ColorTableIO.java
1
package org.gvsig.raster.lib.legend.api;
2

  
3
import java.io.File;
4

  
5
import org.gvsig.raster.lib.legend.api.exceptions.ColorTableIOException;
6

  
7
/**
8
 * Class to read {@link ColorTable} from files and write {@link ColorTable} to
9
 * files.
10
 * 
11
 * @author fdiaz
12
 *
13
 */
14
public interface ColorTableIO {
15

  
16
    /**
17
     * @return the name of {@link ColorTableIO}
18
     */
19
    public String getName();
20

  
21
    /**
22
     * @return the description of {@link ColorTableIO}
23
     */
24
    public String getDescription();
25

  
26
    /**
27
     * Reads file to create {@link ColorTable} from it.
28
     * 
29
     * @param file
30
     *            {@link ColorTable} file.
31
     * @return ColorTable {@link ColorTable} created from file.
32
     * @throws ColorTableIOException 
33
     */
34
    public ColorTable read(File file) throws ColorTableIOException;
35

  
36
    /**
37
     * Reads file to set information to {@link ColorTable} received as
38
     * parameter.
39
     * 
40
     * @param colorTable
41
     *            {@link ColorTable} to be filled.
42
     * @param file
43
     *            File of new {@link ColorTable}.
44
     * @throws ColorTableIOException 
45
     */
46
    public void read(ColorTable colorTable, File file) throws ColorTableIOException;
47

  
48
    /**
49
     * Writes {@link ColorTable} to file.
50
     * 
51
     * @param colorTable
52
     *            {@link ColorTable} to be written
53
     * @param file
54
     *            File of {@link ColorTable}
55
     * @throws ColorTableIOException 
56
     */
57
    public void write(ColorTable colorTable, File file) throws ColorTableIOException;
58

  
59
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/RasterLegendManager.java
7 7
import org.apache.commons.lang3.tuple.Pair;
8 8

  
9 9
import org.gvsig.raster.lib.buffer.api.FilterList;
10
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
11
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
12
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO;
13
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIOFactory;
14
import org.gvsig.raster.lib.legend.api.colortable.MakeColorTable;
10 15

  
11 16
/**
12 17
 * @author fdiaz
......
212 217
    List<ColorTableClass> createListColorTableClasses(double minimum, double maximum, double intervalSize,
213 218
        Color fromColor, Color toColor);
214 219

  
220
    /**
221
     * @return
222
     */
223
    MakeColorTable createMakeColorTable();
215 224
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/RasterLegend.java
6 6
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
7 7
import org.gvsig.raster.lib.buffer.api.Buffer;
8 8
import org.gvsig.raster.lib.buffer.api.FilterList;
9
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
9 10
import org.gvsig.tools.persistence.Persistent;
10 11
import org.gvsig.tools.task.SimpleTaskStatus;
11 12

  
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/colortable/MakeColorTable.java
1
package org.gvsig.raster.lib.legend.api.colortable;
2

  
3
import java.awt.Color;
4

  
5

  
6
/**
7
 * @author fdiaz
8
 *
9
 */
10
public interface MakeColorTable {
11

  
12
    public static int MODE_INTERVAL_SIZE = 0;
13
    public static int MODE_NUMBER_OF_INTERVALS = 1;
14

  
15
    /**
16
     * @param name
17
     */
18
    public void setName(String name);
19

  
20
    /**
21
     * @param minimum
22
     */
23
    public void setMinimum(double minimum);
24

  
25
    /**
26
     * @param maximum
27
     */
28
    public void setMaximum(double maximum);
29

  
30
    /**
31
     * @param mode
32
     */
33
    public void setMode(int mode);
34

  
35
    /**
36
     * @param intervalSize
37
     */
38
    public void setIntervalSize(double intervalSize);
39

  
40
    /**
41
     * @param intervals
42
     */
43
    public void setIntervals(int intervals);
44

  
45
    /**
46
     * @param fromColor
47
     */
48
    public void setFromColor(Color fromColor);
49

  
50
    /**
51
     * @param toColor
52
     */
53
    public void setToColor(Color toColor);
54

  
55
    /**
56
     * @param interpolated
57
     */
58
    public void setInterpolated(boolean interpolated);
59

  
60
    /**
61
     * @return
62
     */
63
    public ColorTable getColorTable();
64

  
65

  
66
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/colortable/ColorTable.java
1
package org.gvsig.raster.lib.legend.api.colortable;
2

  
3
import java.util.List;
4

  
5
import org.gvsig.tools.lang.Cloneable;
6
import org.gvsig.tools.persistence.Persistent;
7

  
8
/**
9
 * @author fdiaz
10
 *
11
 */
12
public interface ColorTable extends Persistent, Cloneable {
13

  
14
    /**
15
     * Compress {@link ColorTable} to reduce number of {@link ColorTableClass}.
16
     */
17
    public void compressPalette();
18

  
19
    /**
20
     * Copies from {@link ColorTable} received as parameter
21
     *
22
     * @param colorTable
23
     *            {@link ColorTable} to be copied
24
     */
25
    public void copyFrom(ColorTable colorTable);
26

  
27
    /**
28
     * @return {@link ColorTableClass} of this {@link ColorTable}
29
     */
30
    public List<ColorTableClass> getClasses();
31

  
32
    /**
33
     * @return Gets the name of this {@link ColorTable}
34
     */
35
    public String getName();
36

  
37
    /**
38
     * @return Return if {@link ColorTable} has alpha
39
     */
40
    public boolean hasAlpha();
41

  
42
    /**
43
     * @return Gets if this {@link ColorTable} is interpolated
44
     */
45
    public boolean isInterpolated();
46

  
47
    /**
48
     * Remove duplicated values of {@link ColorTableClass}
49
     */
50
    public void removeDuplicatedValues();
51

  
52
    /**
53
     * Sets {@link ColorTableClass} of this {@link ColorTable} and recalculates
54
     * palette color of this {@link ColorTable}.
55
     *
56
     * @param colorTableClasses
57
     *            New classes of this {@link ColorTable}
58
     * @param compress
59
     *            True to compress palette color.
60
     */
61
    public void setClasses(List<ColorTableClass> colorTableClasses, boolean compress);
62

  
63
    /**
64
     * Calculates and sets {@link ColorTableClass} of this {@link ColorTable}
65
     * take into account min and max value. Palette color is recalculated with
66
     * new color table classes.
67
     *
68
     * @param min
69
     *            Minimum value of {@link ColorTableClass}
70
     * @param max
71
     *            Maximum value of {@link ColorTableClass}
72
     * @param compress
73
     *            True to compress {@link ColorTable}.
74
     */
75
    public void setClasses(double min, double max, boolean compress);
76

  
77
    /**
78
     * Sets interpolated to this {@link ColorTable}
79
     *
80
     * @param interpolated
81
     */
82
    public void setInterpolated(boolean interpolated);
83

  
84
    /**
85
     * Sets name of this {@link ColorTable}
86
     *
87
     * @param name
88
     */
89
    public void setName(String name);
90

  
91
    /**
92
     * Get RGBA values defined by {@link ColorTableClass}
93
     *
94
     * @param value
95
     *            Value to get RGBA
96
     * @return Byte array with RGBA values
97
     */
98
    byte[] getRGBA(Object value);
99
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/colortable/ColorTableIOFactory.java
1
package org.gvsig.raster.lib.legend.api.colortable;
2

  
3
import java.io.File;
4

  
5

  
6
/**
7
 * @author fdiaz
8
 *
9
 */
10
public interface ColorTableIOFactory {
11

  
12
    /**
13
     * @return the name
14
     */
15
    public String getName();
16

  
17
    /**
18
     * Return true if factory can create a {@link ColorTableIO} from file
19
     *
20
     * @param file
21
     * @return True if factory accepts file, otherwise false.
22
     */
23
    public boolean accept(File file);
24

  
25
    /**
26
     * @return ColorTableProvider
27
     */
28
    public ColorTableIO create();
29

  
30
    /**
31
     * @return
32
     */
33
    public String getDefaultExtension();
34

  
35
    /**
36
     * @return
37
     */
38
    public String getDescription();
39

  
40
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/colortable/ColorTableClass.java
1
package org.gvsig.raster.lib.legend.api.colortable;
2

  
3
import java.awt.Color;
4

  
5
import org.gvsig.tools.persistence.Persistent;
6

  
7
/**
8
 * Class to represent each class of a {@link ColorTable}
9
 * 
10
 * @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
11
 *
12
 */
13
public interface ColorTableClass extends Persistent, Comparable<ColorTableClass> {
14

  
15
    /**
16
     * @return Gets the color of {@link ColorTableClass}
17
     */
18
    public Color getColor();
19

  
20
    /**
21
     * Sets the color of {@link ColorTableClass}
22
     * 
23
     * @param color
24
     *            {@link Color} of class
25
     */
26
    public void setColor(Color color);
27

  
28
    /**
29
     * @return Gets the percent of interpolation with the next
30
     *         {@link ColorTableClass}
31
     */
32
    public double getInterpolated();
33

  
34
    /**
35
     * Sets percent of interpolation with the next {@link ColorTableClass}.
36
     * 
37
     * @param interpolated
38
     *            Percent value.
39
     */
40
    public void setInterpolated(double interpolated);
41

  
42
    /**
43
     * @return Gets value of {@link ColorTableClass}
44
     */
45
    public double getValue();
46

  
47
    /**
48
     * Sets value of {@link ColorTableClass}
49
     * 
50
     * @param value
51
     *            Value of this class.
52
     */
53
    public void setValue(double value);
54

  
55
    /**
56
     * @return Gets name of class
57
     */
58
    public String getName();
59

  
60
    /**
61
     * Sets name of this class
62
     * 
63
     * @param nameClass
64
     *            Name of this class
65
     */
66
    public void setName(String nameClass);
67

  
68
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/colortable/ColorTableIO.java
1
package org.gvsig.raster.lib.legend.api.colortable;
2

  
3
import java.io.File;
4

  
5
import org.gvsig.raster.lib.legend.api.exceptions.ColorTableIOException;
6

  
7
/**
8
 * Class to read {@link ColorTable} from files and write {@link ColorTable} to
9
 * files.
10
 * 
11
 * @author fdiaz
12
 *
13
 */
14
public interface ColorTableIO {
15

  
16
    /**
17
     * @return the name of {@link ColorTableIO}
18
     */
19
    public String getName();
20

  
21
    /**
22
     * @return the description of {@link ColorTableIO}
23
     */
24
    public String getDescription();
25

  
26
    /**
27
     * Reads file to create {@link ColorTable} from it.
28
     * 
29
     * @param file
30
     *            {@link ColorTable} file.
31
     * @return ColorTable {@link ColorTable} created from file.
32
     * @throws ColorTableIOException 
33
     */
34
    public ColorTable read(File file) throws ColorTableIOException;
35

  
36
    /**
37
     * Reads file to set information to {@link ColorTable} received as
38
     * parameter.
39
     * 
40
     * @param colorTable
41
     *            {@link ColorTable} to be filled.
42
     * @param file
43
     *            File of new {@link ColorTable}.
44
     * @throws ColorTableIOException 
45
     */
46
    public void read(ColorTable colorTable, File file) throws ColorTableIOException;
47

  
48
    /**
49
     * Writes {@link ColorTable} to file.
50
     * 
51
     * @param colorTable
52
     *            {@link ColorTable} to be written
53
     * @param file
54
     *            File of {@link ColorTable}
55
     * @throws ColorTableIOException 
56
     */
57
    public void write(ColorTable colorTable, File file) throws ColorTableIOException;
58

  
59
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/pom.xml
5 5
    <artifactId>org.gvsig.raster.lib.legend</artifactId>
6 6
    <version>2.4.1-SNAPSHOT</version>
7 7
  </parent>
8
  <groupId>org.gvsig</groupId>
9 8
  <artifactId>org.gvsig.raster.lib.legend.api</artifactId>
10
  <version>2.4.1-SNAPSHOT</version>
11 9
  <name>org.gvsig.raster.lib.legend.api</name>
12 10
  <dependencies>
13 11
    <dependency>
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.gdal/org.gvsig.raster.gdal.provider.legend/src/main/java/org/gvsig/raster/gdal/provider/legend/RasterGdalGetColorTable.java
6 6

  
7 7
import org.gdal.gdal.Band;
8 8
import org.gdal.gdal.Dataset;
9

  
9 10
import org.gvsig.fmap.dal.raster.api.RasterStore;
10 11
import org.gvsig.raster.gdal.provider.AbstractRasterGdalStoreProvider;
11 12
import org.gvsig.raster.lib.legend.api.ColorInterpretation;
12
import org.gvsig.raster.lib.legend.api.ColorTable;
13
import org.gvsig.raster.lib.legend.api.ColorTableClass;
14 13
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
15 14
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
15
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
16
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
16 17
import org.gvsig.tools.ToolsLocator;
17 18
import org.gvsig.tools.dynobject.DynClass;
18 19
import org.gvsig.tools.dynobject.DynMethod;
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.gdal/org.gvsig.raster.gdal.provider.legend/src/main/java/org/gvsig/raster/gdal/provider/legend/RasterGdalGetLegend.java
3 3
import org.gvsig.fmap.dal.raster.api.RasterStore;
4 4
import org.gvsig.raster.gdal.provider.AbstractRasterGdalStoreProvider;
5 5
import org.gvsig.raster.lib.legend.api.ColorInterpretation;
6
import org.gvsig.raster.lib.legend.api.ColorTable;
7 6
import org.gvsig.raster.lib.legend.api.RasterLegend;
8 7
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
9 8
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
9
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
10 10
import org.gvsig.tools.ToolsLocator;
11 11
import org.gvsig.tools.dynobject.DynClass;
12 12
import org.gvsig.tools.dynobject.DynMethod;
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.swing/pom.xml
10 10
  <name>org.gvsig.raster.swing</name>
11 11
  <modules>
12 12
    <module>org.gvsig.raster.swing.buffer</module>
13
    <module>org.gvsig.raster.swing.legend</module>
13 14
  </modules>
14 15
</project>
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.legend/org.gvsig.raster.swing.legend.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.raster.swing.legend.impl.DefaultRasterSwingLegendLibrary
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.legend/org.gvsig.raster.swing.legend.impl/src/main/java/org/gvsig/raster/swing/legend/impl/DefaultRasterSwingLegendLibrary.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 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.raster.swing.legend.impl;
24

  
25
import org.gvsig.raster.swing.legend.RasterSwingLegendLibrary;
26
import org.gvsig.raster.swing.legend.RasterSwingLegendLocator;
27
import org.gvsig.tools.library.LibraryException;
28

  
29

  
30

  
31
/**
32
 * @author fdiaz
33
 *
34
 */
35
public class DefaultRasterSwingLegendLibrary extends RasterSwingLegendLibrary{
36

  
37

  
38
    @Override
39
    public void doRegistration() {
40
        registerAsImplementationOf(RasterSwingLegendLibrary.class);
41
    }
42

  
43
    @Override
44
    protected void doInitialize() throws LibraryException {
45
        RasterSwingLegendLocator
46
            .registerSwingManager(DefaultRasterSwingLegendManager.class);
47
    }
48

  
49
    @Override
50
    protected void doPostInitialize() throws LibraryException {
51
    }
52

  
53
}
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.legend/org.gvsig.raster.swing.legend.impl/src/main/java/org/gvsig/raster/swing/legend/impl/colortable/editor/DefaultColorTableClassesTableModel.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 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.raster.swing.legend.impl.colortable.editor;
24

  
25
import java.awt.Color;
26
import java.util.List;
27

  
28
import javax.swing.table.AbstractTableModel;
29

  
30
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
31
import org.gvsig.raster.lib.legend.api.colortable.ColorTableClass;
32
import org.gvsig.raster.swing.legend.colortable.editor.ColorTableClassesTableModel;
33
import org.gvsig.raster.swing.legend.colortable.selector.ColorTablesTableModel;
34
import org.gvsig.tools.ToolsLocator;
35
import org.gvsig.tools.i18n.I18nManager;
36

  
37

  
38
/**
39
 * @author fdiaz
40
 *
41
 */
42
public class DefaultColorTableClassesTableModel extends AbstractTableModel implements ColorTableClassesTableModel{
43

  
44
    /**
45
     *
46
     */
47
    private static final long serialVersionUID = -456045233313370454L;
48

  
49
    private ColorTable colorTable;
50

  
51
    private static final int COLUMNS = 4;
52

  
53
    public static final int COLUMN_COLOR = 0;
54
    public static final int COLUMN_NAME = 1;
55
    public static final int COLUMN_VALUE = 2;
56
    public static final int COLUMN_INTERPOLATED = 3;
57

  
58
    /**
59
     * @param bandsInfo
60
     */
61
    public DefaultColorTableClassesTableModel(ColorTable colorTable) {
62
        this.colorTable = colorTable;
63
    }
64

  
65
    /* (non-Javadoc)
66
     * @see javax.swing.table.TableModel#getRowCount()
67
     */
68
    @Override
69
    public int getRowCount() {
70
        return colorTable.getClasses().size();
71
    }
72

  
73
    /* (non-Javadoc)
74
     * @see javax.swing.table.TableModel#getColumnCount()
75
     */
76
    @Override
77
    public int getColumnCount() {
78
        return COLUMNS;
79
    }
80

  
81
    /* (non-Javadoc)
82
     * @see javax.swing.table.TableModel#getValueAt(int, int)
83
     */
84
    @Override
85
    public Object getValueAt(int rowIndex, int columnIndex) {
86
        switch (columnIndex) {
87
        case COLUMN_COLOR:
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff