49 |
49 |
|
50 |
50 |
/**
|
51 |
51 |
* Actions when the process finalizes or is interrupted
|
52 |
|
*
|
|
52 |
*
|
53 |
53 |
* Nacho Brodin (nachobrodin@gmail.com)
|
54 |
54 |
*/
|
55 |
55 |
public class ProcessEndActions implements IProcessActions {
|
... | ... | |
66 |
66 |
this.window = window;
|
67 |
67 |
this.inputLyr = lyr;
|
68 |
68 |
}
|
69 |
|
|
|
69 |
|
70 |
70 |
@SuppressWarnings("unchecked")
|
71 |
71 |
public void end(Object param) {
|
72 |
72 |
if(window != null) {
|
73 |
73 |
PluginServices.getMDIManager().closeWindow(window);
|
74 |
74 |
window = null;
|
75 |
75 |
}
|
76 |
|
|
|
76 |
|
77 |
77 |
HashMap<String, Object> params = (HashMap<String, Object>)param;
|
78 |
78 |
String processName = (String)params.get(ProcessParamsManagement.PROCESS_NAME);
|
79 |
|
|
80 |
|
//End the process
|
|
79 |
|
|
80 |
//End the process
|
81 |
81 |
if (processName.equals(TasseledCapAlgorithmLibrary.TASSELEDCAP_PROCESS_LABEL)) {
|
82 |
82 |
String fileName = (String)params.get("FILENAME");
|
83 |
83 |
long milis = (Long)params.get("TIME");
|
... | ... | |
85 |
85 |
RasterSwingLocator.getSwingManager().showSummaryProcessDialog(fileName, milis);
|
86 |
86 |
}
|
87 |
87 |
}
|
88 |
|
|
|
88 |
|
89 |
89 |
/**
|
90 |
90 |
* Acciones que se realizan al finalizar de crear los recortes de imagen.
|
91 |
91 |
* Este m?todo es llamado por el thread TailRasterProcess al finalizar.
|
... | ... | |
102 |
102 |
}
|
103 |
103 |
}
|
104 |
104 |
}
|
105 |
|
|
|
105 |
|
106 |
106 |
/**
|
107 |
|
* Gets the view
|
|
107 |
* Gets the view
|
108 |
108 |
* @return
|
109 |
109 |
*/
|
110 |
110 |
private AbstractViewPanel getView() {
|
... | ... | |
122 |
122 |
}
|
123 |
123 |
return null;
|
124 |
124 |
}
|
125 |
|
|
|
125 |
|
126 |
126 |
@SuppressWarnings("deprecation")
|
127 |
127 |
private void loadLayer(String fileName, String layerName) throws RasterNotLoadException {
|
128 |
128 |
if(fileName == null)
|
... | ... | |
135 |
135 |
|
136 |
136 |
try {
|
137 |
137 |
DataManager dataManager = DALLocator.getDataManager();
|
138 |
|
|
|
138 |
|
139 |
139 |
ProviderServices provServ = RasterLocator.getManager().getProviderServices();
|
140 |
140 |
RasterDataParameters storeParameters = provServ.createParameters(fileName);
|
141 |
|
storeParameters.setURI(fileName);
|
142 |
|
|
|
141 |
storeParameters.setURI(new File(fileName).toURI());
|
|
142 |
|
143 |
143 |
MapContextManager mcm = MapContextLocator.getMapContextManager();
|
144 |
|
|
|
144 |
|
145 |
145 |
DataStore dataStore = null;
|
146 |
146 |
try {
|
147 |
147 |
dataStore = dataManager.createStore(storeParameters);
|
... | ... | |
152 |
152 |
} catch (ProviderNotRegisteredException e) {
|
153 |
153 |
throw new RasterNotLoadException("Error al cargar la capa.");
|
154 |
154 |
}
|
155 |
|
|
|
155 |
|
156 |
156 |
if(layerName == null) {
|
157 |
157 |
int endIndex = fileName.lastIndexOf(".");
|
158 |
158 |
if (endIndex < 0)
|
159 |
159 |
endIndex = fileName.length();
|
160 |
|
|
|
160 |
|
161 |
161 |
layerName = fileName.substring(fileName.lastIndexOf(File.separator) + 1, endIndex);
|
162 |
162 |
}
|
163 |
|
|
|
163 |
|
164 |
164 |
FLayer lyr = mcm.createLayer(layerName, dataStore);
|
165 |
165 |
theView.getMapControl().getMapContext().getLayers().addLayer(lyr);
|
166 |
166 |
|
167 |
167 |
} catch (LoadLayerException e) {
|
168 |
168 |
throw new RasterNotLoadException("Error al cargar la capa.");
|
169 |
|
}
|
|
169 |
}
|
170 |
170 |
theView.getMapControl().getMapContext().invalidate();
|
171 |
171 |
theView.getMapControl().getMapContext().endAtomicEvent();
|
172 |
172 |
}
|
173 |
|
|
|
173 |
|
174 |
174 |
public void interrupted() {
|
175 |
175 |
|
176 |
176 |
}
|
177 |
|
|
|
177 |
|
178 |
178 |
public void updateProgress(int current, int total) {
|
179 |
|
|
|
179 |
|
180 |
180 |
}
|
181 |
181 |
}
|