Revision 2178
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/pom.xml | ||
---|---|---|
35 | 35 |
<artifactId>org.gvsig.raster.mainplugin</artifactId> |
36 | 36 |
<version>2.1.0-SNAPSHOT</version> |
37 | 37 |
</dependency> |
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.raster.algorithm</artifactId> |
|
41 |
<version>2.1.0-SNAPSHOT</version> |
|
42 |
</dependency> |
|
38 | 43 |
<dependency> |
39 | 44 |
<groupId>org.gvsig</groupId> |
40 | 45 |
<artifactId>org.gvsig.raster.multifile.io</artifactId> |
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MainDialogActions.java | ||
---|---|---|
1 |
package org.gvsig.raster.multifile.app; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
import java.util.ArrayList; |
|
6 |
import java.util.List; |
|
7 |
|
|
8 |
import org.gvsig.andami.PluginServices; |
|
9 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
10 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
11 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
12 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
13 |
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException; |
|
14 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
|
15 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
|
16 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
17 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
18 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
19 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
20 |
import org.gvsig.i18n.Messages; |
|
21 |
import org.gvsig.raster.algorithm.RasterBaseAlgorithmLibrary; |
|
22 |
import org.gvsig.raster.algorithm.process.DataProcess; |
|
23 |
import org.gvsig.raster.algorithm.process.IProcessActions; |
|
24 |
import org.gvsig.raster.algorithm.process.ProcessException; |
|
25 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
26 |
import org.gvsig.raster.impl.provider.RasterProvider; |
|
27 |
import org.gvsig.raster.multifile.app.panel.BandSelectorPanel; |
|
28 |
import org.gvsig.raster.multifile.io.MultiFileDataParameters; |
|
29 |
import org.gvsig.raster.multifile.io.MultiFileFormat; |
|
30 |
import org.gvsig.raster.swing.RasterSwingLibrary; |
|
31 |
|
|
32 |
public class MainDialogActions implements IProcessActions { |
|
33 |
private String file = null; |
|
34 |
private String folder = null; |
|
35 |
private BandSelectorPanel panel = null; |
|
36 |
private AbstractViewPanel selectedView = null; |
|
37 |
|
|
38 |
public MainDialogActions(BandSelectorPanel panel, String file, String folder) { |
|
39 |
this.file = file; |
|
40 |
this.folder = folder; |
|
41 |
this.panel = panel; |
|
42 |
} |
|
43 |
|
|
44 |
public void buildOneLayer() { |
|
45 |
RasterDataStore mainRasterStore = panel.getResult(); |
|
46 |
saveMetadata(); |
|
47 |
|
|
48 |
DataProcess clippingProcess = null; |
|
49 |
try { |
|
50 |
clippingProcess = RasterBaseAlgorithmLibrary.getManager().createRasterTask("ClippingProcess"); |
|
51 |
} catch (ProcessException e) { |
|
52 |
RasterSwingLibrary.messageBoxError(Messages.getText("error_processing_layer"), panel, e); |
|
53 |
} |
|
54 |
clippingProcess.setActions(this); |
|
55 |
String tit = PluginServices.getMDIManager().getWindowInfo(getView()).getTitle(); |
|
56 |
clippingProcess.addParam("viewname", tit); |
|
57 |
clippingProcess.addParam("pixelcoordinates", new int[] { 0, (int) mainRasterStore.getHeight(), (int) mainRasterStore.getWidth(), 0 }); |
|
58 |
clippingProcess.addParam("resolution", new int[]{(int) mainRasterStore.getWidth(), |
|
59 |
(int) mainRasterStore.getHeight()}); |
|
60 |
clippingProcess.addParam("suffix", ".tif"); |
|
61 |
|
|
62 |
clippingProcess.addParam("filename", folder + File.separator + file); |
|
63 |
clippingProcess.addParam("layer", mainRasterStore); |
|
64 |
int[] drawableBands = new int[mainRasterStore.getBandCount()]; |
|
65 |
for (int i = 0; i < drawableBands.length; i++) { |
|
66 |
drawableBands[i] = i; |
|
67 |
} |
|
68 |
clippingProcess.addParam("drawablebands", drawableBands); |
|
69 |
clippingProcess.addParam("onelayerperband", new Boolean(false)); |
|
70 |
clippingProcess.addParam("interpolationmethod", new Integer(Buffer.INTERPOLATION_NearestNeighbour)); |
|
71 |
clippingProcess.addParam("affinetransform", mainRasterStore.getAffineTransform()); |
|
72 |
|
|
73 |
|
|
74 |
/*if (params != null) |
|
75 |
RasterToolsUtil.loadWriterParamsFromPropertiesPanel(panelProperty, params); |
|
76 |
clippingProcess.addParam("driverparams", params);*/ |
|
77 |
clippingProcess.start(); |
|
78 |
} |
|
79 |
|
|
80 |
public void loadLayer() { |
|
81 |
RasterDataStore mainRasterStore = panel.getResult(); |
|
82 |
if(mainRasterStore == null) { |
|
83 |
return; |
|
84 |
} |
|
85 |
|
|
86 |
saveMff(mainRasterStore); |
|
87 |
saveMetadata(); |
|
88 |
try { |
|
89 |
loadLayerInView(mainRasterStore); |
|
90 |
} catch (LoadLayerException e) { |
|
91 |
RasterSwingLibrary.messageBoxError(Messages.getText("error_loading_layer"), panel, e); |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
private void saveMff(RasterDataStore mainRasterStore) { |
|
96 |
MultiFileDataParameters params = (MultiFileDataParameters)mainRasterStore.getParameters(); |
|
97 |
ArrayList<File> uriList = new ArrayList<File>(); |
|
98 |
List<RasterProvider> providers = params.getProviders(); |
|
99 |
for (int i = 0; i < providers.size(); i++) { |
|
100 |
uriList.add(new File(providers.get(i).getURI())); |
|
101 |
} |
|
102 |
try { |
|
103 |
MultiFileFormat.saveMultiFileFormat(file, folder, uriList); |
|
104 |
} catch (IOException e) { |
|
105 |
RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_mff"), panel, e); |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
109 |
private void saveMetadata() { |
|
110 |
RasterDataStore mainRasterStore = panel.getResult(); |
|
111 |
int rBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND); |
|
112 |
int gBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.GREEN_BAND); |
|
113 |
int bBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.BLUE_BAND); |
|
114 |
int aBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND); |
|
115 |
|
|
116 |
if (!isCorrectAssignedBand(rBand, gBand, bBand, aBand)) { |
|
117 |
RasterSwingLibrary.messageBoxError(Messages.getText("combinacion_no_asignable"), panel); |
|
118 |
return; |
|
119 |
} |
|
120 |
|
|
121 |
try { |
|
122 |
ColorInterpretation ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation( |
|
123 |
new String[mainRasterStore.getBandCount()]); |
|
124 |
// Combinaci?n GRAY |
|
125 |
if ((rBand == gBand) && (rBand == bBand) && (rBand >= 0)) { |
|
126 |
for (int iBand = 0; iBand < panel.getARGBTable().getRowCount(); iBand++) { |
|
127 |
ci.setColorInterpValue(iBand, ColorInterpretation.UNDEF_BAND); |
|
128 |
} |
|
129 |
ci.setColorInterpValue(rBand, ColorInterpretation.GRAY_BAND); |
|
130 |
ci.setColorInterpValue(aBand, ColorInterpretation.ALPHA_BAND); |
|
131 |
} else { |
|
132 |
// Combinaci?n RGB |
|
133 |
ci.setColorInterpValue(aBand, ColorInterpretation.ALPHA_BAND); |
|
134 |
ci.setColorInterpValue(rBand, ColorInterpretation.RED_BAND); |
|
135 |
ci.setColorInterpValue(gBand, ColorInterpretation.GREEN_BAND); |
|
136 |
ci.setColorInterpValue(bBand, ColorInterpretation.BLUE_BAND); |
|
137 |
} |
|
138 |
RasterLocator.getManager().getProviderServices().saveObjectToRmfFile(folder + File.separator + file, ci); |
|
139 |
} catch (RmfSerializerException exc) { |
|
140 |
RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_rmf"), panel, exc); |
|
141 |
} catch (NotInitializeException exc) { |
|
142 |
RasterSwingLibrary.messageBoxError(Messages.getText("table_not_initialize"), panel, exc); |
|
143 |
} |
|
144 |
} |
|
145 |
|
|
146 |
private void loadLayerInView(RasterDataStore mainRasterStore) throws LoadLayerException { |
|
147 |
MapContextManager mcm = MapContextLocator.getMapContextManager(); |
|
148 |
FLyrRaster lyr = (FLyrRaster) mcm.createLayer(file, mainRasterStore); |
|
149 |
lyr.reload(); |
|
150 |
|
|
151 |
getView().getMapControl().getMapContext().beginAtomicEvent(); |
|
152 |
getView().getMapControl().getMapContext().getLayers().addLayer(lyr); |
|
153 |
getView().getMapControl().getMapContext().invalidate(); |
|
154 |
getView().getMapControl().getMapContext().endAtomicEvent(); |
|
155 |
} |
|
156 |
|
|
157 |
private AbstractViewPanel getView() { |
|
158 |
if(selectedView == null) { |
|
159 |
IWindow[] wList = PluginServices.getMDIManager().getAllWindows(); |
|
160 |
for (int i = 0; i < wList.length; i++) { |
|
161 |
if(wList[i] instanceof AbstractViewPanel) |
|
162 |
selectedView = (AbstractViewPanel)wList[i]; |
|
163 |
} |
|
164 |
} |
|
165 |
return selectedView; |
|
166 |
} |
|
167 |
|
|
168 |
private boolean isCorrectAssignedBand(int r, int g, int b, int a) { |
|
169 |
// Si es gris es correcta la asignacion |
|
170 |
if ((r == g) && (r == b) && (r >= 0)) { |
|
171 |
// Si el alpha esta asignado a la misma banda es incorrecto |
|
172 |
if (r == a) |
|
173 |
return false; |
|
174 |
// En caso contrario es correcto |
|
175 |
return true; |
|
176 |
} |
|
177 |
|
|
178 |
// Si dos bandas coinciden, se dice que no es correcta la asignacion |
|
179 |
int list[] = { r, g, b, a }; |
|
180 |
for (int i = 0; i <= 3; i++) |
|
181 |
for (int j = 0; j <= 3; j++) |
|
182 |
if ((i != j) && (list[i] == list[j]) && (list[i] > -1)) |
|
183 |
return false; |
|
184 |
|
|
185 |
return true; |
|
186 |
} |
|
187 |
|
|
188 |
public void interrupted() { |
|
189 |
// TODO Auto-generated method stub |
|
190 |
|
|
191 |
} |
|
192 |
|
|
193 |
public void end(Object param) { |
|
194 |
|
|
195 |
} |
|
196 |
|
|
197 |
public void updateProgress(int current, int total) { |
|
198 |
// TODO Auto-generated method stub |
|
199 |
|
|
200 |
} |
|
201 |
} |
|
0 | 202 |
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultifileClientExtension.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import java.awt.event.ActionEvent; |
25 | 25 |
import java.awt.event.ActionListener; |
26 |
import java.io.File; |
|
27 |
import java.io.IOException; |
|
28 |
import java.util.ArrayList; |
|
29 |
import java.util.List; |
|
30 | 26 |
import java.util.Locale; |
31 | 27 |
|
32 | 28 |
import javax.swing.JComponent; |
... | ... | |
34 | 30 |
import org.gvsig.andami.IconThemeHelper; |
35 | 31 |
import org.gvsig.andami.PluginServices; |
36 | 32 |
import org.gvsig.andami.plugins.Extension; |
37 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
38 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
39 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
40 |
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException; |
|
41 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
|
42 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
|
43 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
44 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
45 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
46 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
47 | 33 |
import org.gvsig.i18n.Messages; |
48 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
49 |
import org.gvsig.raster.impl.provider.RasterProvider; |
|
50 | 34 |
import org.gvsig.raster.multifile.app.panel.BandSelectorPanel; |
51 | 35 |
import org.gvsig.raster.multifile.app.panel.MainWindow; |
52 |
import org.gvsig.raster.multifile.io.MultiFileDataParameters; |
|
53 |
import org.gvsig.raster.multifile.io.MultiFileFormat; |
|
54 |
import org.gvsig.raster.swing.RasterSwingLibrary; |
|
55 | 36 |
import org.gvsig.raster.swing.RasterSwingLocator; |
56 | 37 |
import org.gvsig.raster.swing.basepanel.IButtonsPanel; |
57 | 38 |
import org.gvsig.raster.swing.newlayer.CreateNewLayerPanel; |
... | ... | |
67 | 48 |
private CreateNewLayerPanel newLayerPanel = null; |
68 | 49 |
private MainWindow layerNamewindow = null; |
69 | 50 |
private MainWindow bandSelectorwindow = null; |
70 |
private BandSelectorPanel panel = null; |
|
71 |
private AbstractViewPanel selectedView = null; |
|
72 |
private String file = null; |
|
73 |
private String folder = null; |
|
51 |
private MainDialogActions actions = null; |
|
74 | 52 |
|
75 | 53 |
public void initialize() { |
76 | 54 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
... | ... | |
97 | 75 |
public void execute(String actionCommand) { |
98 | 76 |
if (actionCommand.compareTo("MultifileCreator") == 0) { |
99 | 77 |
layerNamewindow = new MainWindow((JComponent)getNewLayerPanel(), |
100 |
Messages.getText("bands"), 300, 150, this);
|
|
78 |
Messages.getText("select_output_file"), 300, 150, this);
|
|
101 | 79 |
PluginServices.getMDIManager().addCentredWindow(layerNamewindow); |
102 | 80 |
} |
103 | 81 |
} |
... | ... | |
124 | 102 |
public void actionPerformed(ActionEvent e) { |
125 | 103 |
//Accept the window with the layer name |
126 | 104 |
if(e.getSource() == layerNamewindow.getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT)) { |
127 |
file = getNewLayerPanel().getFileSelected(); |
|
128 |
folder = getNewLayerPanel().getDirectorySelected(); |
|
129 |
panel = new BandSelectorPanel(BandSelectorPanel.TYPE_DIALOG); |
|
105 |
String file = getNewLayerPanel().getFileSelected();
|
|
106 |
String folder = getNewLayerPanel().getDirectorySelected();
|
|
107 |
BandSelectorPanel panel = new BandSelectorPanel(BandSelectorPanel.TYPE_DIALOG);
|
|
130 | 108 |
panel.getListener().setDestination(file, folder); |
131 |
bandSelectorwindow = new MainWindow(panel, Messages.getText("bands"), 500, 400, this, true); |
|
109 |
actions = new MainDialogActions(panel, file, folder); |
|
110 |
bandSelectorwindow = new MainWindow(panel, Messages.getText("add_files"), 500, 400, this, true); |
|
132 | 111 |
PluginServices.getMDIManager().addCentredWindow(bandSelectorwindow); |
133 | 112 |
} |
134 | 113 |
|
114 |
//Button of load layer in the main dialog |
|
135 | 115 |
if(e.getSource() == bandSelectorwindow.getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR1)) { |
136 |
loadLayer(); |
|
116 |
actions.loadLayer();
|
|
137 | 117 |
} |
138 | 118 |
|
119 |
//Button of create one file with al files |
|
139 | 120 |
if(e.getSource() == bandSelectorwindow.getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR2)) { |
140 |
|
|
121 |
actions.buildOneLayer(); |
|
141 | 122 |
} |
142 | 123 |
|
143 | 124 |
} |
144 |
|
|
145 |
|
|
146 |
private void saveMff(RasterDataStore mainRasterStore) { |
|
147 |
MultiFileDataParameters params = (MultiFileDataParameters)mainRasterStore.getParameters(); |
|
148 |
ArrayList<File> uriList = new ArrayList<File>(); |
|
149 |
List<RasterProvider> providers = params.getProviders(); |
|
150 |
for (int i = 0; i < providers.size(); i++) { |
|
151 |
uriList.add(new File(providers.get(i).getURI())); |
|
152 |
} |
|
153 |
try { |
|
154 |
MultiFileFormat.saveMultiFileFormat(file, folder, uriList); |
|
155 |
} catch (IOException e) { |
|
156 |
RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_mff"), panel, e); |
|
157 |
} |
|
158 |
} |
|
159 |
|
|
160 |
private void saveMetadata() { |
|
161 |
int rBand = panel.getAssignedBand(RasterDataStore.RED_BAND); |
|
162 |
int gBand = panel.getAssignedBand(RasterDataStore.GREEN_BAND); |
|
163 |
int bBand = panel.getAssignedBand(RasterDataStore.BLUE_BAND); |
|
164 |
int aBand = panel.getAssignedBand(RasterDataStore.ALPHA_BAND); |
|
165 |
|
|
166 |
if (!isCorrectAssignedBand(rBand, gBand, bBand, aBand)) { |
|
167 |
RasterSwingLibrary.messageBoxError(Messages.getText("combinacion_no_asignable"), panel); |
|
168 |
return; |
|
169 |
} |
|
170 |
|
|
171 |
ColorInterpretation ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation( |
|
172 |
new String[]{ColorInterpretation.ALPHA_BAND, ColorInterpretation.RED_BAND, ColorInterpretation.GREEN_BAND, ColorInterpretation.BLUE_BAND}); |
|
173 |
try { |
|
174 |
// Combinaci?n GRAY |
|
175 |
if ((rBand == gBand) && (rBand == bBand) && (rBand >= 0)) { |
|
176 |
for (int iBand = 0; iBand < panel.getARGBTable().getRowCount(); iBand++) { |
|
177 |
ci.setColorInterpValue(iBand, ColorInterpretation.UNDEF_BAND); |
|
178 |
} |
|
179 |
ci.setColorInterpValue(rBand, ColorInterpretation.GRAY_BAND); |
|
180 |
ci.setColorInterpValue(aBand, ColorInterpretation.ALPHA_BAND); |
|
181 |
} else { |
|
182 |
// Combinaci?n RGB |
|
183 |
for (int iBand = 0; iBand < panel.getARGBTable().getRowCount(); iBand++) |
|
184 |
ci.setColorInterpValue(iBand, panel.getColorInterpretationByBand(iBand)); |
|
185 |
} |
|
186 |
RasterLocator.getManager().getProviderServices().saveObjectToRmfFile(file, ci); |
|
187 |
} catch (RmfSerializerException exc) { |
|
188 |
RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_rmf"), panel, exc); |
|
189 |
} catch (NotInitializeException exc) { |
|
190 |
RasterSwingLibrary.messageBoxError(Messages.getText("table_not_initialize"), panel, exc); |
|
191 |
} |
|
192 |
} |
|
193 |
|
|
194 |
public void loadLayerInView(RasterDataStore mainRasterStore) throws LoadLayerException { |
|
195 |
MapContextManager mcm = MapContextLocator.getMapContextManager(); |
|
196 |
FLyrRaster lyr = (FLyrRaster) mcm.createLayer(file, mainRasterStore); |
|
197 |
|
|
198 |
getView().getMapControl().getMapContext().beginAtomicEvent(); |
|
199 |
getView().getMapControl().getMapContext().getLayers().addLayer(lyr); |
|
200 |
getView().getMapControl().getMapContext().invalidate(); |
|
201 |
getView().getMapControl().getMapContext().endAtomicEvent(); |
|
202 |
} |
|
203 |
|
|
204 |
private AbstractViewPanel getView() { |
|
205 |
if(selectedView == null) { |
|
206 |
IWindow[] wList = PluginServices.getMDIManager().getAllWindows(); |
|
207 |
for (int i = 0; i < wList.length; i++) { |
|
208 |
if(wList[i] instanceof AbstractViewPanel) |
|
209 |
selectedView = (AbstractViewPanel)wList[i]; |
|
210 |
} |
|
211 |
} |
|
212 |
return selectedView; |
|
213 |
} |
|
214 |
|
|
215 |
public void loadLayer() { |
|
216 |
RasterDataStore mainRasterStore = panel.getResult(); |
|
217 |
if(mainRasterStore == null) { |
|
218 |
return; |
|
219 |
} |
|
220 |
|
|
221 |
saveMff(mainRasterStore); |
|
222 |
saveMetadata(); |
|
223 |
try { |
|
224 |
loadLayerInView(mainRasterStore); |
|
225 |
} catch (LoadLayerException e) { |
|
226 |
RasterSwingLibrary.messageBoxError(Messages.getText("error_loading_layer"), panel, e); |
|
227 |
} |
|
228 |
} |
|
229 |
|
|
230 |
private boolean isCorrectAssignedBand(int r, int g, int b, int a) { |
|
231 |
// Si es gris es correcta la asignacion |
|
232 |
if ((r == g) && (r == b) && (r >= 0)) { |
|
233 |
// Si el alpha esta asignado a la misma banda es incorrecto |
|
234 |
if (r == a) |
|
235 |
return false; |
|
236 |
// En caso contrario es correcto |
|
237 |
return true; |
|
238 |
} |
|
239 |
|
|
240 |
// Si dos bandas coinciden, se dice que no es correcta la asignacion |
|
241 |
int list[] = { r, g, b, a }; |
|
242 |
for (int i = 0; i <= 3; i++) |
|
243 |
for (int j = 0; j <= 3; j++) |
|
244 |
if ((i != j) && (list[i] == list[j]) && (list[i] > -1)) |
|
245 |
return false; |
|
246 |
|
|
247 |
return true; |
|
248 |
} |
|
249 | 125 |
} |
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/MainWindow.java | ||
---|---|---|
87 | 87 |
getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL).addActionListener(this); |
88 | 88 |
} |
89 | 89 |
|
90 |
info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE); |
|
90 |
info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
|
|
91 | 91 |
info.setTitle(title); |
92 | 92 |
info.setWidth(w); |
93 | 93 |
info.setHeight(h); |
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPanel.java | ||
---|---|---|
440 | 440 |
* @param flag R, G o B se selecciona por medio de un flag que los identifica |
441 | 441 |
* @return Banda de la imagen asignada al flag pasado por par?metro |
442 | 442 |
*/ |
443 |
public int getAssignedBand(int flag) {
|
|
443 |
public int getColorInterpretationByColorBandBand(int flag) {
|
|
444 | 444 |
DefaultTableModel model = ((DefaultTableModel) getARGBTable().getModel()); |
445 | 445 |
if ((flag & RasterDataStore.ALPHA_BAND) == RasterDataStore.ALPHA_BAND) { |
446 | 446 |
for (int nBand = 0; nBand < getARGBTable().getModel().getRowCount(); nBand++) |
... | ... | |
495 | 495 |
return ColorInterpretation.UNDEF_BAND; |
496 | 496 |
} |
497 | 497 |
|
498 |
|
|
498 | 499 |
public void tableChanged(TableModelEvent e) { |
499 | 500 |
getARGBTable().revalidate(); |
500 | 501 |
revalidate(); |
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPropertiesListener.java | ||
---|---|---|
111 | 111 |
} |
112 | 112 |
|
113 | 113 |
if (e.getSource().equals(bandSetupPanel.getSaveButton())) { |
114 |
int rBand = bandSetupPanel.getAssignedBand(RasterDataStore.RED_BAND);
|
|
115 |
int gBand = bandSetupPanel.getAssignedBand(RasterDataStore.GREEN_BAND);
|
|
116 |
int bBand = bandSetupPanel.getAssignedBand(RasterDataStore.BLUE_BAND);
|
|
117 |
int aBand = bandSetupPanel.getAssignedBand(RasterDataStore.ALPHA_BAND);
|
|
114 |
int rBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND);
|
|
115 |
int gBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.GREEN_BAND);
|
|
116 |
int bBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.BLUE_BAND);
|
|
117 |
int aBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND);
|
|
118 | 118 |
|
119 | 119 |
if (!isCorrectAssignedBand(rBand, gBand, bBand, aBand)) { |
120 | 120 |
RasterSwingLibrary.messageBoxError(Messages.getText("combinacion_no_asignable"), bandSetupPanel); |
... | ... | |
303 | 303 |
|
304 | 304 |
public void setNewBandsPositionInRendering() { |
305 | 305 |
if (fLayer != null && fLayer.getRender() != null) { |
306 |
fLayer.getRender().setRenderBands(new int[]{bandSetupPanel.getAssignedBand(RasterDataStore.RED_BAND),
|
|
307 |
bandSetupPanel.getAssignedBand(RasterDataStore.GREEN_BAND),
|
|
308 |
bandSetupPanel.getAssignedBand(RasterDataStore.BLUE_BAND)});
|
|
309 |
int alphaBand = bandSetupPanel.getAssignedBand(RasterDataStore.ALPHA_BAND);
|
|
306 |
fLayer.getRender().setRenderBands(new int[]{bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND),
|
|
307 |
bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.GREEN_BAND),
|
|
308 |
bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.BLUE_BAND)});
|
|
309 |
int alphaBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND);
|
|
310 | 310 |
// Ultima transparencia aplicada en el renderizador |
311 | 311 |
Transparency gt = fLayer.getRender().getLastTransparency(); |
312 | 312 |
if(gt != null) |
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text.properties | ||
---|---|---|
17 | 17 |
character_not_valid=Caracter no valido |
18 | 18 |
create_multifile=Crear capa multifichero |
19 | 19 |
load_layer=Cargar capa |
20 |
generate_file=Generar fichero |
|
20 |
generate_file=Generar fichero |
|
21 |
select_output_file=Capa de salida |
|
22 |
add_files=A?adir ficheros |
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/resources-plugin/org/gvsig/raster/multifile/app/i18n/text_en.properties | ||
---|---|---|
17 | 17 |
character_not_valid=Character not valid |
18 | 18 |
create_multifile=Create layer multifile |
19 | 19 |
load_layer=Load layer |
20 |
generate_file=Builds a file |
|
20 |
generate_file=Builds a file |
|
21 |
select_output_file=Output layer |
|
22 |
add_files=Add files |
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/pom.xml | ||
---|---|---|
37 | 37 |
<artifactId>org.gvsig.raster.mainplugin</artifactId> |
38 | 38 |
<scope>compile</scope> |
39 | 39 |
</dependency> |
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.raster.algorithm</artifactId> |
|
43 |
<scope>compile</scope> |
|
44 |
</dependency> |
|
40 | 45 |
<dependency> |
41 | 46 |
<groupId>org.gvsig</groupId> |
42 | 47 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/store/serializer/ColorInterpretationRmfSerializer.java | ||
---|---|---|
87 | 87 |
public void read(String xml) throws ParsingException { |
88 | 88 |
String cInterp = null; |
89 | 89 |
datasetCI = new DataStoreColorInterpretation(); |
90 |
int band = 0; |
|
91 | 90 |
|
92 | 91 |
KXmlParser parser = new KXmlParser(); |
93 | 92 |
Reader reader = new StringReader(xml); |
... | ... | |
110 | 109 |
for (int i = 0; i < nBands; i++) { |
111 | 110 |
cInterp = parserString(parser, BAND, null); |
112 | 111 |
datasetCI.setColorInterpValue(i, cInterp); |
113 |
band ++; |
|
114 | 112 |
} |
115 | 113 |
} |
116 | 114 |
break; |
... | ... | |
142 | 140 |
|
143 | 141 |
b.append("<" + MAIN_TAG + ">\n"); |
144 | 142 |
putProperty(b, BANDCOUNT, datasetCI.length(), 1); |
143 |
|
|
145 | 144 |
for (int i = 0; i < datasetCI.length(); i++) { |
146 | 145 |
String ci = datasetCI.get(i); |
147 | 146 |
if (ci != null) |
Also available in: Unified diff