Revision 119 org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/core/SextanteGUI.java
SextanteGUI.java | ||
---|---|---|
29 | 29 |
import es.unex.sextante.gui.cmd.ScriptAlgorithmProvider; |
30 | 30 |
import es.unex.sextante.gui.help.HelpIO; |
31 | 31 |
import es.unex.sextante.gui.modeler.ModelerAlgorithmProvider; |
32 |
import es.unex.sextante.gui.r.RAlgorithmProvider; |
|
33 | 32 |
import es.unex.sextante.gui.settings.Setting; |
34 | 33 |
import es.unex.sextante.gui.settings.SextanteGeneralSettings; |
34 |
import es.unex.sextante.gui.settings.SextanteGrassSettings; |
|
35 |
import es.unex.sextante.gui.settings.SextanteModelerSettings; |
|
35 | 36 |
import es.unex.sextante.gui.settings.SextanteRSettings; |
36 |
import es.unex.sextante.gui.settings.SextanteGrassSettings; |
|
37 | 37 |
import es.unex.sextante.gui.settings.SextanteSagaSettings; |
38 |
import es.unex.sextante.gui.settings.SextanteModelerSettings; |
|
39 | 38 |
import es.unex.sextante.gui.settings.SextanteScriptsSettings; |
40 | 39 |
|
41 | 40 |
|
... | ... | |
44 | 43 |
* used by GUI elements |
45 | 44 |
*/ |
46 | 45 |
public class SextanteGUI { |
47 |
public static String resourcePrefix = "org.gvsig.toolbox";
|
|
46 |
public static String resourcePrefix = "org.gvsig.toolbox"; |
|
48 | 47 |
public static final int HISTORY = 0; |
49 | 48 |
public static final int COMMANDLINE = 1; |
50 | 49 |
|
... | ... | |
60 | 59 |
|
61 | 60 |
private static boolean m_bShowOnlyActiveAlgorithms = false; |
62 | 61 |
private static String m_sOutputFolder; |
63 |
private static String m_sSextantePath; |
|
64 | 62 |
private static HashMap<String, String> m_Settings = new HashMap<String, String>(); |
65 | 63 |
private static HashMap<String, String> m_DefaultSettings = new HashMap<String, String>(); |
66 | 64 |
private static IDataRenderer m_Renderer; |
65 |
private static String m_sSextanteHomePath; |
|
66 |
private static String m_sSextanteInstallPath; |
|
67 | 67 |
|
68 | 68 |
|
69 | 69 |
private final static HashMap<String, Class> m_ParametersPanel = new HashMap<String, Class>(); |
... | ... | |
89 | 89 |
public final static Color COLOR_PURPLE = new Color(163, 71, 255, 255); |
90 | 90 |
public final static Color COLOR_BROWN_LIGHT = new Color(255, 168, 82, 255); |
91 | 91 |
public final static Color COLOR_BROWN_DARK = new Color(204, 102, 0, 255); |
92 |
|
|
93 |
|
|
94 |
static {
|
|
95 |
|
|
92 |
|
|
93 |
|
|
94 |
static { |
|
95 |
|
|
96 | 96 |
m_AlgorithmProviders.add(new ScriptAlgorithmProvider()); |
97 | 97 |
m_AlgorithmProviders.add(new ModelerAlgorithmProvider()); |
98 | 98 |
|
... | ... | |
101 | 101 |
|
102 | 102 |
/** |
103 | 103 |
* Sets a new main frame. This will be used as the parent frame by SEXTANTE GUI elements |
104 |
*
|
|
104 |
* |
|
105 | 105 |
* @param frame |
106 | 106 |
* The main frame |
107 | 107 |
*/ |
... | ... | |
114 | 114 |
|
115 | 115 |
/** |
116 | 116 |
* Returns the current main frame |
117 |
*
|
|
117 |
* |
|
118 | 118 |
* @return the current main frame |
119 | 119 |
*/ |
120 | 120 |
public static Frame getMainFrame() { |
... | ... | |
128 | 128 |
|
129 | 129 |
/** |
130 | 130 |
* Returns the current input factory |
131 |
*
|
|
131 |
* |
|
132 | 132 |
* @see IInputFactory. |
133 | 133 |
* @return the current input factory |
134 | 134 |
*/ |
... | ... | |
141 | 141 |
|
142 | 142 |
/** |
143 | 143 |
* Sets a new input factory as the current one |
144 |
*
|
|
144 |
* |
|
145 | 145 |
* @param inputFactory |
146 | 146 |
* the new input factory |
147 | 147 |
*/ |
... | ... | |
154 | 154 |
|
155 | 155 |
/** |
156 | 156 |
* Returns the current OutputFactory |
157 |
*
|
|
157 |
* |
|
158 | 158 |
* @return the current OutputFactory |
159 | 159 |
*/ |
160 | 160 |
public static OutputFactory getOutputFactory() { |
... | ... | |
166 | 166 |
|
167 | 167 |
/** |
168 | 168 |
* sets a new output factory |
169 |
*
|
|
169 |
* |
|
170 | 170 |
* @param outputFactory |
171 | 171 |
* the new output factory |
172 | 172 |
*/ |
... | ... | |
180 | 180 |
|
181 | 181 |
/** |
182 | 182 |
* Returns the current GUIFactory |
183 |
*
|
|
183 |
* |
|
184 | 184 |
* @return the current GUIFactory |
185 | 185 |
*/ |
186 | 186 |
public static IGUIFactory getGUIFactory() { |
... | ... | |
192 | 192 |
|
193 | 193 |
/** |
194 | 194 |
* sets a new GUI factory |
195 |
*
|
|
195 |
* |
|
196 | 196 |
* @param guiFactory |
197 | 197 |
* the new GUI factory |
198 | 198 |
*/ |
... | ... | |
205 | 205 |
|
206 | 206 |
/** |
207 | 207 |
* Returns the task to post-process the algorithm outputs, usually to add them to the GUI of the GIS app. |
208 |
*
|
|
208 |
* |
|
209 | 209 |
* @param alg |
210 | 210 |
* the algorithm to postprocess. Since this task will mainly deal with output results, the algorithm should have |
211 | 211 |
* been previously executed, so it contains non-null output values |
... | ... | |
213 | 213 |
* if this parameter is true, the task will show the results dialog if the algorithm has produced some kind of |
214 | 214 |
* output other than layers or tables. If it is false, those results will be added to the set of current |
215 | 215 |
* results, but the results dialog will not be shown |
216 |
*
|
|
216 |
* |
|
217 | 217 |
* @return a task to postprocess the given algorithm |
218 | 218 |
*/ |
219 | 219 |
public static Runnable getPostProcessTask(final GeoAlgorithm alg, |
... | ... | |
226 | 226 |
|
227 | 227 |
/** |
228 | 228 |
* Sets the current post process task factory |
229 |
*
|
|
229 |
* |
|
230 | 230 |
* @param factory |
231 | 231 |
* the new post-process task factory |
232 | 232 |
*/ |
... | ... | |
241 | 241 |
|
242 | 242 |
/** |
243 | 243 |
* Adds an algorithm provider. This has to be done before calling initialize(), so the providers can be initialized as well. |
244 |
*
|
|
244 |
* |
|
245 | 245 |
* @param provider |
246 | 246 |
* the algorithm provider to add |
247 | 247 |
*/ |
... | ... | |
256 | 256 |
/** |
257 | 257 |
* Checks if a portable directory exists and has the required access privileges. |
258 | 258 |
* Non-existing directories will be created if possible. |
259 |
* Displays a GUI warning message if there are problems, and exits with a corresponding error code.
|
|
260 |
*
|
|
259 |
* Displays a GUI warning message if there are problems, and exits with a corresponding error code. |
|
260 |
* |
|
261 | 261 |
* @param dir String with name of folder/directory to be checked. Use only a relative path here. |
262 | 262 |
* @param read_only set to "true" if only read access is required |
263 | 263 |
* @param provider name of the algorithm provider for which this folder is being checked. |
264 | 264 |
* @return "0" if all is OK, "1" if directory does not exist and could not be created, "2" if access is forbidden, "3" if a _file_ with that name already exists |
265 | 265 |
*/ |
266 | 266 |
public static int checkDir ( String dir, boolean read_only, String provider ) { |
267 |
|
|
268 |
final File f = new File ( SextanteGUI.getSextantePath() + File.separator + dir );
|
|
269 |
|
|
267 |
|
|
268 |
final File f = new File ( SextanteGUI.getSextanteHomePath() + File.separator + dir );
|
|
269 |
|
|
270 | 270 |
if ( f.exists() ) { |
271 | 271 |
if ( f.isFile() ) { |
272 |
JOptionPane.showMessageDialog(null,
|
|
273 |
Sextante.getText("portable_dir_error") + " " + f.getAbsolutePath() + ".\n" +
|
|
272 |
JOptionPane.showMessageDialog(null, |
|
273 |
Sextante.getText("portable_dir_error") + " " + f.getAbsolutePath() + ".\n" + |
|
274 | 274 |
Sextante.getText("portable_dir_is_file") + "\n" + |
275 | 275 |
Sextante.getText("portable_provider_not_usable") + " <html></i>" + provider + "+</i>+</html>." |
276 | 276 |
, "Inane warning", JOptionPane.WARNING_MESSAGE); |
... | ... | |
279 | 279 |
if ( read_only ) { |
280 | 280 |
if ( f.canRead() ) { |
281 | 281 |
return ( 0 ); |
282 |
}
|
|
282 |
} |
|
283 | 283 |
} |
284 | 284 |
if ( f.canWrite() ) { |
285 | 285 |
return ( 0 ); |
286 | 286 |
} |
287 | 287 |
if ( read_only ) { |
288 |
JOptionPane.showMessageDialog(null,
|
|
288 |
JOptionPane.showMessageDialog(null, |
|
289 | 289 |
Sextante.getText("portable_dir_error") + " " + f.getAbsolutePath() + |
290 | 290 |
Sextante.getText("portable_dir_error_ro") + "\n" + ":" + |
291 | 291 |
Sextante.getText("portable_dir_no_access") + "\n" + |
292 | 292 |
Sextante.getText("portable_provider_not_usable") + " <html></i>" + provider + "+</i>+</html>." |
293 | 293 |
, "Inane warning", JOptionPane.WARNING_MESSAGE); |
294 | 294 |
} else { |
295 |
JOptionPane.showMessageDialog(null,
|
|
295 |
JOptionPane.showMessageDialog(null, |
|
296 | 296 |
Sextante.getText("portable_dir_error") + " " + f.getAbsolutePath() + |
297 | 297 |
Sextante.getText("portable_dir_error_rw") + "\n" + ":" + |
298 | 298 |
Sextante.getText("portable_dir_no_access") + "\n" + |
299 | 299 |
Sextante.getText("portable_provider_not_usable") + " <html></i>" + provider + "+</i>+</html>." |
300 |
, "Inane warning", JOptionPane.WARNING_MESSAGE);
|
|
300 |
, "Inane warning", JOptionPane.WARNING_MESSAGE); |
|
301 | 301 |
} |
302 |
return ( 2 );
|
|
302 |
return ( 2 ); |
|
303 | 303 |
} |
304 |
|
|
304 |
|
|
305 | 305 |
/* directory does not exist: attempt to create it */ |
306 | 306 |
if ( f.mkdir() == false ) { |
307 |
JOptionPane.showMessageDialog(null,
|
|
308 |
Sextante.getText("portable_dir_error") + " " + f.getAbsolutePath() + ".\n" +
|
|
307 |
JOptionPane.showMessageDialog(null, |
|
308 |
Sextante.getText("portable_dir_error") + " " + f.getAbsolutePath() + ".\n" + |
|
309 | 309 |
Sextante.getText("portable_dir_no_create") + "\n" + |
310 | 310 |
Sextante.getText("portable_provider_not_usable") + " <html></i>" + provider + "+</i>+</html>." |
311 |
, "Inane warning", JOptionPane.WARNING_MESSAGE);
|
|
311 |
, "Inane warning", JOptionPane.WARNING_MESSAGE); |
|
312 | 312 |
return ( 1 ); |
313 | 313 |
} |
314 |
|
|
314 |
|
|
315 | 315 |
return ( 0 ); |
316 | 316 |
} |
317 |
|
|
318 |
|
|
317 |
|
|
318 |
|
|
319 | 319 |
/** |
320 | 320 |
* Checks if a file exists in one of the portable folders, and if it has the required access privileges. |
321 |
* Displays a GUI warning message if there are problems, and exits with a corresponding error code.
|
|
322 |
*
|
|
321 |
* Displays a GUI warning message if there are problems, and exits with a corresponding error code. |
|
322 |
* |
|
323 | 323 |
* @param file String with name of file to be checked. Use only a relative path here. |
324 | 324 |
* @param read_only set to "true" if only read access is required |
325 | 325 |
* @param provider name of the algorithm provider for which this file is being checked. |
326 | 326 |
* @return "0" if all is OK, "1" if file does not exist, "2" if access is forbidden, "3" if a _directory_ with that name already exists |
327 | 327 |
*/ |
328 | 328 |
public static int checkFile ( String file, boolean read_only, String provider ) { |
329 |
|
|
330 |
final File f = new File ( SextanteGUI.getSextantePath() + File.separator + file );
|
|
331 |
|
|
329 |
|
|
330 |
final File f = new File ( SextanteGUI.getSextanteHomePath() + File.separator + file );
|
|
331 |
|
|
332 | 332 |
if ( f.exists() ) { |
333 | 333 |
if ( f.isDirectory() ) { |
334 |
JOptionPane.showMessageDialog(null,
|
|
335 |
Sextante.getText("portable_file_error") + " " + f.getAbsolutePath() + ".\n" +
|
|
334 |
JOptionPane.showMessageDialog(null, |
|
335 |
Sextante.getText("portable_file_error") + " " + f.getAbsolutePath() + ".\n" + |
|
336 | 336 |
Sextante.getText("portable_file_is_dir") + "\n" + |
337 | 337 |
Sextante.getText("portable_provider_not_usable") + " <html></i>" + provider + "+</i>+</html>." |
338 | 338 |
, "Inane warning", JOptionPane.WARNING_MESSAGE); |
... | ... | |
341 | 341 |
if ( read_only ) { |
342 | 342 |
if ( f.canRead() ) { |
343 | 343 |
return ( 0 ); |
344 |
}
|
|
344 |
} |
|
345 | 345 |
} |
346 | 346 |
if ( f.canWrite() ) { |
347 | 347 |
return ( 0 ); |
348 | 348 |
} |
349 | 349 |
if ( read_only ) { |
350 |
JOptionPane.showMessageDialog(null,
|
|
350 |
JOptionPane.showMessageDialog(null, |
|
351 | 351 |
Sextante.getText("portable_file_error") + " " + f.getAbsolutePath() + |
352 | 352 |
Sextante.getText("portable_file_error_ro") + "\n" + ":" + |
353 | 353 |
Sextante.getText("portable_file_no_access") + "\n" + |
354 | 354 |
Sextante.getText("portable_provider_not_usable") + " <html></i>" + provider + "+</i>+</html>." |
355 | 355 |
, "Inane warning", JOptionPane.WARNING_MESSAGE); |
356 | 356 |
} else { |
357 |
JOptionPane.showMessageDialog(null,
|
|
357 |
JOptionPane.showMessageDialog(null, |
|
358 | 358 |
Sextante.getText("portable_file_error") + " " + f.getAbsolutePath() + |
359 | 359 |
Sextante.getText("portable_file_error_rw") + "\n" + ":" + |
360 | 360 |
Sextante.getText("portable_file_no_access") + "\n" + |
361 | 361 |
Sextante.getText("portable_provider_not_usable") + " <html></i>" + provider + "+</i>+</html>." |
362 |
, "Inane warning", JOptionPane.WARNING_MESSAGE);
|
|
362 |
, "Inane warning", JOptionPane.WARNING_MESSAGE); |
|
363 | 363 |
} |
364 |
return ( 2 );
|
|
364 |
return ( 2 ); |
|
365 | 365 |
} |
366 |
|
|
366 |
|
|
367 | 367 |
return ( 1 ); |
368 |
}
|
|
369 |
|
|
370 |
|
|
368 |
} |
|
369 |
|
|
370 |
|
|
371 | 371 |
/** |
372 | 372 |
* Portable SEXTANTE requires that external providers' (e.g. GRASS) algorithms |
373 | 373 |
* and user-editable scripts are stored in folders within the SEXTANTE extension |
... | ... | |
378 | 378 |
* warning if anythign goes wrong. |
379 | 379 |
*/ |
380 | 380 |
public static void checkPortableFolders () { |
381 |
|
|
381 |
|
|
382 | 382 |
String sPath; |
383 | 383 |
int result; |
384 |
|
|
385 |
|
|
384 |
|
|
385 |
|
|
386 | 386 |
sPath = new String (""); |
387 | 387 |
|
388 | 388 |
if ( Boolean.parseBoolean(SextanteGUI.getSettingParameterValue(SextanteRSettings.R_PORTABLE)) == true ) { |
389 | 389 |
/* set R binaries folder */ |
390 | 390 |
result = checkDir ( Sextante.PORTABLE_R_FOLDER, true, "R" ); |
391 |
sPath = SextanteGUI.getSextantePath() + File.separator + Sextante.PORTABLE_R_FOLDER;
|
|
392 |
SextanteGUI.setSettingParameterValue(SextanteRSettings.R_FOLDER, sPath);
|
|
393 |
|
|
391 |
sPath = SextanteGUI.getSextanteInstallPath() + File.separator + Sextante.PORTABLE_R_FOLDER;
|
|
392 |
SextanteGUI.setSettingParameterValue(SextanteRSettings.R_FOLDER, sPath); |
|
393 |
|
|
394 | 394 |
/* set R user scripts folder */ |
395 | 395 |
result = checkDir ( Sextante.PORTABLE_R_SCRIPTS_FOLDER, false, "R user scripts" ); |
396 |
sPath = SextanteGUI.getSextantePath() + File.separator + Sextante.PORTABLE_R_SCRIPTS_FOLDER; |
|
396 |
sPath = SextanteGUI.getSextanteInstallPath() + File.separator + Sextante.PORTABLE_R_SCRIPTS_FOLDER;
|
|
397 | 397 |
SextanteGUI.setSettingParameterValue(SextanteRSettings.R_SCRIPTS_FOLDER, sPath); |
398 | 398 |
} |
399 | 399 |
if ( Boolean.parseBoolean(SextanteGUI.getSettingParameterValue(SextanteGrassSettings.GRASS_PORTABLE)) == true ) { |
400 | 400 |
/* set GRASS binaries folder */ |
401 | 401 |
result = checkDir ( Sextante.PORTABLE_GRASS_FOLDER, true, "GRASS GIS" ); |
402 |
sPath = SextanteGUI.getSextantePath() + File.separator + Sextante.PORTABLE_GRASS_FOLDER;
|
|
402 |
sPath = SextanteGUI.getSextanteInstallPath() + File.separator + Sextante.PORTABLE_GRASS_FOLDER;
|
|
403 | 403 |
SextanteGUI.setSettingParameterValue(SextanteGrassSettings.GRASS_FOLDER, sPath); |
404 | 404 |
/* set GRASS shell support (MSYS) binaries folder (Windows only) */ |
405 | 405 |
if ( Sextante.isWindows() ) { |
406 | 406 |
result = checkFile ( Sextante.PORTABLE_MSYS_FILE, true, "GRASS GIS shell scripts" ); |
407 |
sPath = SextanteGUI.getSextantePath() + File.separator + Sextante.PORTABLE_MSYS_FILE;
|
|
407 |
sPath = SextanteGUI.getSextanteInstallPath() + File.separator + Sextante.PORTABLE_MSYS_FILE;
|
|
408 | 408 |
SextanteGUI.setSettingParameterValue(SextanteGrassSettings.GRASS_WIN_SHELL, sPath); |
409 | 409 |
} |
410 | 410 |
} |
411 | 411 |
if ( Boolean.parseBoolean(SextanteGUI.getSettingParameterValue(SextanteSagaSettings.SAGA_PORTABLE)) == true ) { |
412 | 412 |
/* set SAGA binaries folder */ |
413 | 413 |
result = checkDir ( Sextante.PORTABLE_SAGA_FOLDER, true, "SAGA GIS" ); |
414 |
sPath = SextanteGUI.getSextantePath() + File.separator + Sextante.PORTABLE_SAGA_FOLDER;
|
|
414 |
sPath = SextanteGUI.getSextanteInstallPath() + File.separator + Sextante.PORTABLE_SAGA_FOLDER;
|
|
415 | 415 |
SextanteGUI.setSettingParameterValue(SextanteSagaSettings.SAGA_FOLDER, sPath); |
416 | 416 |
} |
417 | 417 |
if ( Boolean.parseBoolean(SextanteGUI.getSettingParameterValue(SextanteScriptsSettings.SCRIPTS_PORTABLE)) == true ) { |
418 | 418 |
/* set user scripts folder */ |
419 |
result = checkDir ( Sextante.PORTABLE_SCRIPTS_FOLDER, true, "SEXTANTE user scripts" );
|
|
420 |
sPath = SextanteGUI.getSextantePath() + File.separator + Sextante.PORTABLE_SCRIPTS_FOLDER;
|
|
419 |
result = checkDir ( Sextante.PORTABLE_SCRIPTS_FOLDER, true, "Toolbox user scripts" );
|
|
420 |
sPath = SextanteGUI.getSextanteHomePath() + File.separator + Sextante.PORTABLE_SCRIPTS_FOLDER;
|
|
421 | 421 |
SextanteGUI.setSettingParameterValue(SextanteScriptsSettings.SCRIPTS_FOLDER, sPath); |
422 | 422 |
} |
423 | 423 |
if ( Boolean.parseBoolean(SextanteGUI.getSettingParameterValue(SextanteModelerSettings.MODELS_PORTABLE)) == true ) { |
424 | 424 |
/* set user models folder */ |
425 |
result = checkDir ( Sextante.PORTABLE_MODELS_FOLDER, true, "SEXTANTE user models" );
|
|
426 |
sPath = SextanteGUI.getSextantePath() + File.separator + Sextante.PORTABLE_MODELS_FOLDER;
|
|
425 |
result = checkDir ( Sextante.PORTABLE_MODELS_FOLDER, true, "Toolbox user models" );
|
|
426 |
sPath = SextanteGUI.getSextanteHomePath() + File.separator + Sextante.PORTABLE_MODELS_FOLDER;
|
|
427 | 427 |
SextanteGUI.setSettingParameterValue(SextanteModelerSettings.MODELS_FOLDER, sPath); |
428 |
}
|
|
428 |
} |
|
429 | 429 |
} |
430 |
|
|
431 |
|
|
430 |
|
|
431 |
|
|
432 | 432 |
/** |
433 | 433 |
* Initializes the GUI parameters and resources. It takes GUI resources (custom panels, etc.) from classpath jars. Should be |
434 | 434 |
* called before setting parameters using other methods from this class, except for the setSextantePath() and |
... | ... | |
445 | 445 |
/** |
446 | 446 |
* Initializes the GUI parameters and resources. It takes GUI resources (custom panels, etc.) from the specified urls. Should |
447 | 447 |
* be called before setting parameters using other methods from this class, except for the setSextantePath() method. |
448 |
*
|
|
448 |
* |
|
449 | 449 |
* @param jars |
450 | 450 |
* the urls of the jar files with custom GUI resources |
451 | 451 |
*/ |
... | ... | |
460 | 460 |
/** |
461 | 461 |
* Initializes the GUI parameters and resources. It takes GUI resources (custom panels, etc.) from the specified folder. Should |
462 | 462 |
* be called before setting parameters using other methods from this class, except for the setSextantePath() method. |
463 |
*
|
|
463 |
* |
|
464 | 464 |
* @param sFolder |
465 | 465 |
* the folder with jars with custom GUI resources |
466 | 466 |
*/ |
... | ... | |
479 | 479 |
readConfigFile(); |
480 | 480 |
|
481 | 481 |
checkPortableFolders(); |
482 |
|
|
482 |
|
|
483 | 483 |
//this loads built-in SEXTANTE algorithms and resources |
484 | 484 |
loadResources(); |
485 | 485 |
|
... | ... | |
493 | 493 |
addCustomParametersPanel(provider.getCustomParameterPanels()); |
494 | 494 |
} |
495 | 495 |
} |
496 |
|
|
496 |
|
|
497 | 497 |
} |
498 | 498 |
|
499 | 499 |
|
... | ... | |
522 | 522 |
/** |
523 | 523 |
* This methods sets default setting values different from the hard-coded ones. It should be called right before initializing |
524 | 524 |
* this class |
525 |
*
|
|
525 |
* |
|
526 | 526 |
* @param map |
527 | 527 |
* the map with new default settings |
528 | 528 |
*/ |
... | ... | |
567 | 567 |
|
568 | 568 |
/** |
569 | 569 |
* Returns the path to help files |
570 |
*
|
|
570 |
* |
|
571 | 571 |
* @return the path to help files |
572 | 572 |
*/ |
573 | 573 |
public static String getHelpPath() { |
574 | 574 |
|
575 |
return m_sSextantePath + File.separator + "help";
|
|
575 |
return getSextanteInstallPath() + File.separator + "help";
|
|
576 | 576 |
|
577 | 577 |
} |
578 | 578 |
|
... | ... | |
580 | 580 |
/** |
581 | 581 |
* Sets the current path to sextante folder. This is the folder where help files and additional software should be located. |
582 | 582 |
* This should be done before initializing this class, since this folder is used by some algorithm providers |
583 |
*
|
|
583 |
* |
|
584 | 584 |
* @param sPath |
585 | 585 |
* the path to sextante help and additional programs |
586 |
* @deprecated Use {@link #setSextanteInstallPath(String)} or {@link #setSextanteHomePath(String)} |
|
586 | 587 |
*/ |
587 | 588 |
public static void setSextantePath(final String sPath) { |
588 | 589 |
|
589 |
m_sSextantePath = sPath; |
|
590 |
m_sSextanteInstallPath = sPath;
|
|
590 | 591 |
|
591 | 592 |
} |
592 | 593 |
|
593 | 594 |
|
594 | 595 |
/** |
595 | 596 |
* Returns the path to sextante help and additional programs |
596 |
*
|
|
597 |
* |
|
597 | 598 |
* @return the path to sextante help and additional programs |
599 |
* |
|
600 |
* @deprecated Use {@link #getSextanteInstallPath()} or {@link #getSextanteHomePath()} |
|
598 | 601 |
*/ |
599 | 602 |
public static String getSextantePath() { |
600 | 603 |
|
601 |
return m_sSextantePath; |
|
604 |
return m_sSextanteInstallPath;
|
|
602 | 605 |
|
603 | 606 |
} |
604 | 607 |
|
608 |
public static String getSextanteHomePath() { |
|
609 |
return m_sSextanteHomePath; |
|
610 |
} |
|
605 | 611 |
|
612 |
public static String getSextanteInstallPath() { |
|
613 |
return m_sSextanteInstallPath; |
|
614 |
} |
|
615 |
|
|
616 |
public static void setSextanteHomePath(String path) { |
|
617 |
m_sSextanteHomePath = path; |
|
618 |
|
|
619 |
} |
|
620 |
|
|
621 |
public static void setSextanteInstallPath(String path) { |
|
622 |
m_sSextanteInstallPath = path; |
|
623 |
|
|
624 |
} |
|
625 |
|
|
626 |
|
|
627 |
|
|
606 | 628 |
/** |
607 | 629 |
* Returns the default folder for output data. |
608 |
*
|
|
630 |
* |
|
609 | 631 |
* @return the default folder for output data. |
610 | 632 |
*/ |
611 | 633 |
public static String getOutputFolder() { |
... | ... | |
622 | 644 |
|
623 | 645 |
/** |
624 | 646 |
* Returns the default value to represent "No Data" (null) raster cells. |
625 |
*
|
|
647 |
* |
|
626 | 648 |
* @return the current "No Data" value. |
627 | 649 |
*/ |
628 | 650 |
private static Double getDefaultNoDataValue() { |
... | ... | |
707 | 729 |
|
708 | 730 |
/** |
709 | 731 |
* Returns the path to the SEXTANTE config file. |
710 |
*
|
|
732 |
* |
|
711 | 733 |
* @return A string with the full the path and name of the SEXTANTE config file. |
712 | 734 |
*/ |
713 | 735 |
private static String getConfigFile() { |
... | ... | |
724 | 746 |
* By default, this is the folder "sextante" in the user's home folder. |
725 | 747 |
* But it is also possible to set a different folder through the |
726 | 748 |
* Java property "SEXTANTE.confDir" when launching the VM: |
727 |
*
|
|
749 |
* |
|
728 | 750 |
* java -DSEXTANTE.confDir=<path> |
729 |
*
|
|
751 |
* |
|
730 | 752 |
* @return A string with the full path and name of the config folder. |
731 | 753 |
*/ |
732 | 754 |
public static String getUserFolder() { |
... | ... | |
734 | 756 |
String sPath; |
735 | 757 |
String sConfDir; |
736 | 758 |
|
737 |
|
|
759 |
|
|
738 | 760 |
// default is to use system's home folder setting |
739 |
sPath = System.getProperty("user.home") + File.separator + "sextante";
|
|
740 |
|
|
761 |
sPath = System.getProperty("user.home") + File.separator + "sextante"; |
|
762 |
|
|
741 | 763 |
// check if SEXTANTE.confDir has been set |
742 |
sConfDir = System.getProperty("SEXTANTE.confDir");
|
|
764 |
sConfDir = System.getProperty("SEXTANTE.confDir"); |
|
743 | 765 |
if ( sConfDir != null ) { |
744 | 766 |
sConfDir = sConfDir.trim(); |
745 | 767 |
if ( sConfDir.length() > 0 ) { |
... | ... | |
763 | 785 |
|
764 | 786 |
/** |
765 | 787 |
* Returns the type of the last element from which a command-line command was executed |
766 |
*
|
|
788 |
* |
|
767 | 789 |
* @return the type of the element from which a command-line command was executed. SextanteGUI.HISTORY if the last component |
768 | 790 |
* was the history panel; SextanteGUI.COMMANDLINE if it was the regular SEXTANTE console |
769 | 791 |
*/ |
... | ... | |
777 | 799 |
/** |
778 | 800 |
* Sets the type of the last element from which a command-line command was executed. This has to be called from any component |
779 | 801 |
* that allows execution of commands |
780 |
*
|
|
802 |
* |
|
781 | 803 |
* @param iLast |
782 | 804 |
* one of the following constants: SextanteGUI.HISTORY if the last component was the history panel; |
783 | 805 |
* SextanteGUI.COMMANDLINE if it was the regular SEXTANTE console |
... | ... | |
792 | 814 |
/** |
793 | 815 |
* Gets the dialog from which the last command--line command was executed. This will be used as the parent dialog for task |
794 | 816 |
* monitors or message dialogs generated by the execution of that command. |
795 |
*
|
|
817 |
* |
|
796 | 818 |
* @return the dialog from which the last command--line command was executed |
797 | 819 |
*/ |
798 | 820 |
public static JDialog getLastCommandOriginParentDialog() { |
... | ... | |
804 | 826 |
|
805 | 827 |
/** |
806 | 828 |
* Sets the dialog (if any) that contains the element from which the last command--line command was executed |
807 |
*
|
|
829 |
* |
|
808 | 830 |
* @param parent |
809 | 831 |
* the dialog (if any) that contains the element from which the last command--line command was executed |
810 | 832 |
*/ |
... | ... | |
818 | 840 |
/** |
819 | 841 |
* Returns true if only active algorithms (those that can be executed with the current data objects) should be shown in the |
820 | 842 |
* toolbox |
821 |
*
|
|
843 |
* |
|
822 | 844 |
* @return true if only active algorithms (those that can be executed with the current data objects) should be shown in the |
823 | 845 |
* toolbox |
824 | 846 |
*/ |
... | ... | |
832 | 854 |
/** |
833 | 855 |
* Sets whether only active algorithms (those that can be executed with the current data objects) should be shown in the |
834 | 856 |
* toolbox |
835 |
*
|
|
857 |
* |
|
836 | 858 |
* @param showOnlyActiveAlgorithms |
837 | 859 |
* must be true if only active algorithms (those that can be executed with the current data objects) should be |
838 | 860 |
* shown in the toolbox |
... | ... | |
846 | 868 |
|
847 | 869 |
/** |
848 | 870 |
* puts a collection of settings into the settings map |
849 |
*
|
|
871 |
* |
|
850 | 872 |
* @param settings |
851 | 873 |
* the map with settings values. |
852 | 874 |
*/ |
... | ... | |
859 | 881 |
|
860 | 882 |
/** |
861 | 883 |
* Modifies the passed string, so it can be used as a safe data object name (without special characters) |
862 |
*
|
|
884 |
* |
|
863 | 885 |
* @param sName |
864 | 886 |
* the name to modify |
865 | 887 |
* @return the modified safe name (with no special characters) |
... | ... | |
1035 | 1057 |
|
1036 | 1058 |
/** |
1037 | 1059 |
* Returns the renderer to use for layers created by SEXTANTE algorithms |
1038 |
*
|
|
1060 |
* |
|
1039 | 1061 |
*/ |
1040 | 1062 |
public static IDataRenderer getDataRenderer() { |
1041 | 1063 |
|
Also available in: Unified diff