Revision 1086
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/RasterExtension.java | ||
---|---|---|
57 | 57 |
import org.gvsig.raster.tools.app.basic.raster.gui.wizard.PrepareLayerAskCoordinates; |
58 | 58 |
import org.gvsig.raster.tools.app.basic.raster.gui.wizard.PrepareLayerAskProjection; |
59 | 59 |
import org.gvsig.raster.tools.app.basic.raster.gui.wizard.PrepareLayerAskUsingTiles; |
60 |
import org.gvsig.raster.tools.app.basic.tool.colortable.ui.library.RasterColorTablesFactory; |
|
60 | 61 |
import org.gvsig.raster.tools.app.basic.tool.filter.grayscale.GrayScaleManager; |
61 | 62 |
import org.gvsig.raster.tools.app.basic.tool.filter.mask.MaskListManager; |
62 | 63 |
import org.gvsig.raster.tools.app.basic.tool.filter.regionalpha.RegionAlphaListManager; |
... | ... | |
177 | 178 |
appGvSigMan.registerPrepareOpenLayer(new PrepareLayerAskProjection()); |
178 | 179 |
appGvSigMan.registerPrepareOpenDataStoreParameters(new PrepareLayerAskProjection()); |
179 | 180 |
|
181 |
appGvSigMan.registerColorTablesFactory(new RasterColorTablesFactory()); |
|
180 | 182 |
//Alias |
181 | 183 |
//LayerFactory lFactory = LayerFactory.getInstance(); |
182 | 184 |
// lFactory.registerLayerToUseForStore("com.iver.cit.gvsig.fmap.layers.FLyrRaster", FLyrRasterSE.class); |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/colortable/ui/library/ColorTableIconPainter.java | ||
---|---|---|
24 | 24 |
import java.awt.Color; |
25 | 25 |
import java.awt.Graphics2D; |
26 | 26 |
import java.awt.Rectangle; |
27 |
import java.util.ArrayList; |
|
27 | 28 |
|
28 | 29 |
import org.gvsig.fmap.dal.coverage.datastruct.ColorItem; |
29 | 30 |
import org.gvsig.fmap.dal.coverage.store.props.ColorTable; |
31 |
import org.gvsig.gui.ColorTablePainter; |
|
30 | 32 |
import org.gvsig.gui.beans.listview.IIconPaint; |
31 | 33 |
/** |
32 | 34 |
* Clase para dibujar los iconos del ListViewComponent del panel de color. Se |
... | ... | |
36 | 38 |
* @version 29/06/2007 |
37 | 39 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
38 | 40 |
*/ |
39 |
public class ColorTableIconPainter implements IIconPaint { |
|
41 |
public class ColorTableIconPainter implements IIconPaint, ColorTablePainter {
|
|
40 | 42 |
private ColorTable colorTable; |
41 | 43 |
|
42 | 44 |
/** |
... | ... | |
62 | 64 |
public ColorTable getColorTable() { |
63 | 65 |
return colorTable; |
64 | 66 |
} |
67 |
|
|
68 |
/* |
|
69 |
* (non-Javadoc) |
|
70 |
* @see org.gvsig.gui.ColorTablePainter#getColors() |
|
71 |
*/ |
|
72 |
public Color[] getColors() { |
|
73 |
ArrayList<ColorItem> cItem = colorTable.getColorItems(); |
|
74 |
Color[] colorList = new Color[cItem.size()]; |
|
75 |
for (int i = 0; i < colorList.length; i++) { |
|
76 |
colorList[i] = cItem.get(i).getColor(); |
|
77 |
} |
|
78 |
return colorList; |
|
79 |
} |
|
65 | 80 |
|
66 | 81 |
/** |
67 | 82 |
* Metodo de pintado de la tabla de color |
... | ... | |
104 | 119 |
else |
105 | 120 |
g.setColor(new Color(96, 96, 96)); |
106 | 121 |
g.drawRect(x1, area.y, x2 - x1, area.height - 1); |
122 |
} |
|
123 |
|
|
124 |
/* |
|
125 |
* (non-Javadoc) |
|
126 |
* @see org.gvsig.gui.ColorTablePainter#getTableName() |
|
127 |
*/ |
|
128 |
public String getTableName() { |
|
129 |
return colorTable.getName(); |
|
107 | 130 |
} |
108 | 131 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/colortable/ui/library/RasterColorTablesFactory.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.tools.app.basic.tool.colortable.ui.library; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
import java.util.List; |
|
26 |
|
|
27 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
28 |
import org.gvsig.fmap.dal.coverage.RasterManager; |
|
29 |
import org.gvsig.fmap.dal.coverage.datastruct.ColorItem; |
|
30 |
import org.gvsig.fmap.dal.coverage.datastruct.ColorTableLibrary; |
|
31 |
import org.gvsig.fmap.dal.coverage.exception.FilePaletteException; |
|
32 |
import org.gvsig.fmap.dal.coverage.store.props.ColorTable; |
|
33 |
import org.gvsig.gui.ColorTablePainter; |
|
34 |
import org.gvsig.gui.ColorTablesFactory; |
|
35 |
import org.gvsig.raster.tools.app.basic.RasterToolsUtil; |
|
36 |
|
|
37 |
/** |
|
38 |
* Factory for color tables. This factory is useful to register color tables |
|
39 |
* in gvSIG. |
|
40 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
41 |
* |
|
42 |
*/ |
|
43 |
public class RasterColorTablesFactory implements ColorTablesFactory { |
|
44 |
private ColorTableLibrary tableLib = null; |
|
45 |
|
|
46 |
public RasterColorTablesFactory() { |
|
47 |
RasterManager rManager = RasterLocator.getManager(); |
|
48 |
tableLib = rManager.getDataStructFactory().getColorTableLibrary(); |
|
49 |
} |
|
50 |
|
|
51 |
/* |
|
52 |
* (non-Javadoc) |
|
53 |
* @see org.gvsig.gui.ColorTablesFactory#createColorTables() |
|
54 |
*/ |
|
55 |
public List<ColorTablePainter> createColorTables() { |
|
56 |
try { |
|
57 |
List<ColorTablePainter> result = new ArrayList<ColorTablePainter>(); |
|
58 |
ArrayList<String> fileList = tableLib.getPaletteFileList(ColorTableLibraryPanel.palettesPath); |
|
59 |
for (int i = 0; i < fileList.size(); i++) { |
|
60 |
ArrayList<ColorItem> paletteItems = new ArrayList<ColorItem>(); |
|
61 |
String paletteName = tableLib.loadPalette(ColorTableLibraryPanel.palettesPath, (String) fileList.get(i), paletteItems); |
|
62 |
|
|
63 |
if (paletteItems.size() <= 0) |
|
64 |
continue; |
|
65 |
|
|
66 |
ColorTable colorTable = tableLib.createColorTable(); |
|
67 |
colorTable.setName(paletteName); |
|
68 |
colorTable.createPaletteFromColorItems(paletteItems, true); |
|
69 |
colorTable.setInterpolated(true); |
|
70 |
|
|
71 |
ColorTablePainter painter = new ColorTableIconPainter(colorTable); |
|
72 |
result.add(painter); |
|
73 |
} |
|
74 |
return result; |
|
75 |
} catch (FilePaletteException e) { |
|
76 |
RasterToolsUtil.messageBoxError(e.getMessage(), this, e); |
|
77 |
} |
|
78 |
return null; |
|
79 |
} |
|
80 |
|
|
81 |
} |
|
0 | 82 |
Also available in: Unified diff