Revision 5988 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

View differences:

MainDialogActions.java
29 29
import org.gvsig.raster.multifile.io.MultiFileFormat;
30 30
import org.gvsig.raster.swing.RasterSwingLibrary;
31 31

  
32
/**
33
 * @author gvSIG team
34
 *
35
 */
32 36
public class MainDialogActions implements IProcessActions {
33 37
	private String                          file                 = null;
34 38
	private String                          folder               = null;
35 39
	private BandSelectorPanel               panel                = null;
36 40
	private AbstractViewPanel               selectedView         = null;
37
	
41

  
42
	/**
43
	 * @param panel
44
	 * @param file
45
	 * @param folder
46
	 */
38 47
	public MainDialogActions(BandSelectorPanel panel, String file, String folder) {
39 48
		this.file = file;
40 49
		this.folder = folder;
41 50
		this.panel = panel;
42 51
	}
43
	
52

  
53
	/**
54
	 *
55
	 */
44 56
	public void buildOneLayer() {
45 57
		RasterDataStore mainRasterStore = panel.getResult();
46 58
		saveMetadata();
47
		
59

  
48 60
		DataProcess clippingProcess = null;
49 61
		try {
50 62
			clippingProcess = RasterBaseAlgorithmLibrary.getManager().createRasterTask("ClippingProcess");
......
58 70
		clippingProcess.addParam("resolution", new int[]{(int) mainRasterStore.getWidth(),
59 71
					 										 (int) mainRasterStore.getHeight()});
60 72
		clippingProcess.addParam("suffix", ".tif");
61
		
73

  
62 74
		clippingProcess.addParam("filename", folder + File.separator + file);
63 75
		clippingProcess.addParam("layer", mainRasterStore);
64 76
		int[] drawableBands = new int[mainRasterStore.getBandCount()];
......
76 88
		clippingProcess.addParam("driverparams", params);*/
77 89
		clippingProcess.start();
78 90
	}
79
	
91

  
92
	/**
93
	 *
94
	 */
80 95
	public void loadLayer() {
81 96
		RasterDataStore mainRasterStore = panel.getResult();
82 97
		if(mainRasterStore == null) {
83 98
			return;
84 99
		}
85
		
100

  
86 101
		saveMff(mainRasterStore);
87 102
		saveMetadata();
88 103
		try {
......
91 106
			RasterSwingLibrary.messageBoxError(Messages.getText("error_loading_layer"), panel, e);
92 107
		}
93 108
	}
94
	
109

  
95 110
	private void saveMff(RasterDataStore mainRasterStore) {
96 111
		MultiFileDataParameters params = (MultiFileDataParameters)mainRasterStore.getParameters();
97 112
		ArrayList<File> uriList = new ArrayList<File>();
......
105 120
			RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_mff"), panel, e);
106 121
		}
107 122
	}
108
	
123

  
109 124
	private void saveMetadata() {
110 125
		RasterDataStore mainRasterStore = panel.getResult();
111 126
		int rBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND);
......
142 157
			RasterSwingLibrary.messageBoxError(Messages.getText("table_not_initialize"), panel, exc);
143 158
		}
144 159
	}
145
	
160

  
146 161
	private void loadLayerInView(RasterDataStore mainRasterStore) throws LoadLayerException {
147 162
		MapContextManager mcm = MapContextLocator.getMapContextManager();
148 163
		FLyrRaster lyr = (FLyrRaster) mcm.createLayer(file, mainRasterStore);
......
153 168
		getView().getMapControl().getMapContext().invalidate();
154 169
		getView().getMapControl().getMapContext().endAtomicEvent();
155 170
	}
156
	
171

  
157 172
	private AbstractViewPanel getView() {
158 173
		if(selectedView == null) {
159 174
			IWindow[] wList = PluginServices.getMDIManager().getAllWindows();
......
164 179
		}
165 180
		return selectedView;
166 181
	}
167
	
182

  
168 183
	private boolean isCorrectAssignedBand(int r, int g, int b, int a) {
169 184
		// Si es gris es correcta la asignacion
170 185
		if ((r == g) && (r == b) && (r >= 0)) {
......
187 202

  
188 203
	public void interrupted() {
189 204
		// TODO Auto-generated method stub
190
		
205

  
191 206
	}
192 207

  
193 208
	public void end(Object param) {
194
		
209

  
195 210
	}
196 211

  
197 212
	public void updateProgress(int current, int total) {
198 213
		// TODO Auto-generated method stub
199
		
214

  
200 215
	}
201 216
}

Also available in: Unified diff