gvsig-geoprocess / org.gvsig.geoprocess / trunk / org.gvsig.geoprocess / org.gvsig.geoprocess.app / org.gvsig.geoprocess.app.sextante / src / main / java / org / gvsig / geoprocess / app / sextante / SextanteAlgorithmsExtension.java @ 245
History | View | Annotate | Download (2.38 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2012 gvSIG Association.
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.geoprocess.app.sextante; |
25 |
|
26 |
import java.util.HashMap; |
27 |
import java.util.Map; |
28 |
|
29 |
import es.unex.sextante.core.GeoAlgorithm; |
30 |
import es.unex.sextante.core.Sextante; |
31 |
|
32 |
import org.gvsig.andami.PluginsLocator; |
33 |
import org.gvsig.andami.plugins.Extension; |
34 |
import org.gvsig.geoprocess.extension.GeoprocessExtension; |
35 |
|
36 |
/**
|
37 |
* Sextante algorithms extension.
|
38 |
*
|
39 |
* @author gvSIG Team
|
40 |
* @version $Id$
|
41 |
*/
|
42 |
public class SextanteAlgorithmsExtension extends Extension { |
43 |
|
44 |
public void execute(String actionCommand) { |
45 |
// Nothing to do
|
46 |
} |
47 |
|
48 |
public void initialize() { |
49 |
|
50 |
// HACK: The initialize method removes all previously registered
|
51 |
// algorithms, so we must get them before and add again afterwards.
|
52 |
Map<String, HashMap<String, GeoAlgorithm>> algorithms = |
53 |
Sextante.getAlgorithms(); |
54 |
|
55 |
// The sextante algorithms jar files are copied into the
|
56 |
// org.gvsig.geoprocess.app.mainplugin plugin as sextante looks
|
57 |
// for resource bundles using its own classloader
|
58 |
Sextante.initialize((PluginsLocator.getManager() |
59 |
.getPlugin(GeoprocessExtension.class).getPluginDirectory() |
60 |
.getAbsolutePath()) + "/lib");
|
61 |
|
62 |
// Readd previous algorithms just in case
|
63 |
if (algorithms != null) { |
64 |
Sextante.getAlgorithms().putAll(algorithms); |
65 |
} |
66 |
} |
67 |
|
68 |
public boolean isEnabled() { |
69 |
return true; |
70 |
} |
71 |
|
72 |
public boolean isVisible() { |
73 |
return true; |
74 |
} |
75 |
} |