Revision 273
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/describe.java | ||
---|---|---|
20 | 20 |
final CallStack callstack, |
21 | 21 |
final String sName) { |
22 | 22 |
|
23 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
23 | 24 |
final Object obj = SextanteGUI.getInputFactory().getInputFromName(sName.trim()); |
24 | 25 |
if (obj == null) { |
25 | 26 |
env.println("Invalid object: " + sName.trim()); |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/getrasterlayers.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.IRasterLayer; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
|
|
9 |
public class getrasterlayers { |
|
10 |
|
|
11 |
public static String[] invoke(final Interpreter env, |
|
12 |
final CallStack callstack) { |
|
13 |
|
|
14 |
final IRasterLayer[] rasterLayers = SextanteGUI.getInputFactory().getRasterLayers(); |
|
15 |
final String[] sNames = new String[rasterLayers.length]; |
|
16 |
for (int i = 0; i < rasterLayers.length; i++) { |
|
17 |
sNames[i] = rasterLayers[i].getName(); |
|
18 |
} |
|
19 |
|
|
20 |
return sNames; |
|
21 |
|
|
22 |
} |
|
23 |
|
|
24 |
} |
|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.IRasterLayer; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
|
|
9 |
public class getrasterlayers { |
|
10 |
|
|
11 |
public static String[] invoke(final Interpreter env, |
|
12 |
final CallStack callstack) { |
|
13 |
|
|
14 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
15 |
final IRasterLayer[] rasterLayers = SextanteGUI.getInputFactory().getRasterLayers(); |
|
16 |
final String[] sNames = new String[rasterLayers.length]; |
|
17 |
for (int i = 0; i < rasterLayers.length; i++) { |
|
18 |
sNames[i] = rasterLayers[i].getName(); |
|
19 |
} |
|
20 |
|
|
21 |
return sNames; |
|
22 |
|
|
23 |
} |
|
24 |
|
|
25 |
} |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/getvectorlayers.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.core.AbstractInputFactory; |
|
6 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
7 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
8 |
|
|
9 |
public class getvectorlayers { |
|
10 |
|
|
11 |
public static String[] invoke(final Interpreter env, |
|
12 |
final CallStack callstack) { |
|
13 |
|
|
14 |
final IVectorLayer[] vectorLayers = SextanteGUI.getInputFactory().getVectorLayers(AbstractInputFactory.SHAPE_TYPE_ANY); |
|
15 |
final String[] sNames = new String[vectorLayers.length]; |
|
16 |
for (int i = 0; i < vectorLayers.length; i++) { |
|
17 |
sNames[i] = vectorLayers[i].getName(); |
|
18 |
} |
|
19 |
|
|
20 |
return sNames; |
|
21 |
|
|
22 |
} |
|
23 |
|
|
24 |
} |
|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.core.AbstractInputFactory; |
|
6 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
7 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
8 |
|
|
9 |
public class getvectorlayers { |
|
10 |
|
|
11 |
public static String[] invoke(final Interpreter env, |
|
12 |
final CallStack callstack) { |
|
13 |
|
|
14 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
15 |
final IVectorLayer[] vectorLayers = SextanteGUI.getInputFactory().getVectorLayers(AbstractInputFactory.SHAPE_TYPE_ANY); |
|
16 |
final String[] sNames = new String[vectorLayers.length]; |
|
17 |
for (int i = 0; i < vectorLayers.length; i++) { |
|
18 |
sNames[i] = vectorLayers[i].getName(); |
|
19 |
} |
|
20 |
|
|
21 |
return sNames; |
|
22 |
|
|
23 |
} |
|
24 |
|
|
25 |
} |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/setnodata.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.IRasterLayer; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
/** |
|
9 |
* A BeanShell command to set the nodata value of a raster layer |
|
10 |
* |
|
11 |
* @author volaya |
|
12 |
* |
|
13 |
*/ |
|
14 |
public class setnodata { |
|
15 |
|
|
16 |
public static void invoke(final Interpreter env, |
|
17 |
final CallStack callstack, |
|
18 |
final String sName, |
|
19 |
final double dNoDataValue) { |
|
20 |
|
|
21 |
final Object obj = SextanteGUI.getInputFactory().getInputFromName(sName.trim()); |
|
22 |
if (obj == null) { |
|
23 |
env.println("Invalid object: " + sName.trim()); |
|
24 |
} |
|
25 |
else if (obj instanceof IRasterLayer) { |
|
26 |
final IRasterLayer layer = (IRasterLayer) obj; |
|
27 |
layer.setNoDataValue(dNoDataValue); |
|
28 |
} |
|
29 |
else { |
|
30 |
env.println("Object must be a raster layer"); |
|
31 |
} |
|
32 |
|
|
33 |
} |
|
34 |
|
|
35 |
} |
|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.IRasterLayer; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
/** |
|
9 |
* A BeanShell command to set the nodata value of a raster layer |
|
10 |
* |
|
11 |
* @author volaya |
|
12 |
* |
|
13 |
*/ |
|
14 |
public class setnodata { |
|
15 |
|
|
16 |
public static void invoke(final Interpreter env, |
|
17 |
final CallStack callstack, |
|
18 |
final String sName, |
|
19 |
final double dNoDataValue) { |
|
20 |
|
|
21 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
22 |
final Object obj = SextanteGUI.getInputFactory().getInputFromName(sName.trim()); |
|
23 |
if (obj == null) { |
|
24 |
env.println("Invalid object: " + sName.trim()); |
|
25 |
} |
|
26 |
else if (obj instanceof IRasterLayer) { |
|
27 |
final IRasterLayer layer = (IRasterLayer) obj; |
|
28 |
layer.setNoDataValue(dNoDataValue); |
|
29 |
} |
|
30 |
else { |
|
31 |
env.println("Object must be a raster layer"); |
|
32 |
} |
|
33 |
|
|
34 |
} |
|
35 |
|
|
36 |
} |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/close.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.IDataObject; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
public class close { |
|
9 |
|
|
10 |
public static void invoke(final Interpreter env, |
|
11 |
final CallStack callstack, |
|
12 |
final String sName) { |
|
13 |
|
|
14 |
final Object obj = SextanteGUI.getInputFactory().getInputFromName(sName.trim()); |
|
15 |
if (obj == null) { |
|
16 |
env.println("Invalid object: " + sName.trim()); |
|
17 |
} |
|
18 |
else if (obj instanceof IDataObject) { |
|
19 |
final IDataObject layer = (IDataObject) obj; |
|
20 |
SextanteGUI.getInputFactory().close(layer.getName()); |
|
21 |
} |
|
22 |
|
|
23 |
} |
|
24 |
|
|
25 |
} |
|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.IDataObject; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
public class close { |
|
9 |
|
|
10 |
public static void invoke(final Interpreter env, |
|
11 |
final CallStack callstack, |
|
12 |
final String sName) { |
|
13 |
|
|
14 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
15 |
final Object obj = SextanteGUI.getInputFactory().getInputFromName(sName.trim()); |
|
16 |
if (obj == null) { |
|
17 |
env.println("Invalid object: " + sName.trim()); |
|
18 |
} |
|
19 |
else if (obj instanceof IDataObject) { |
|
20 |
final IDataObject layer = (IDataObject) obj; |
|
21 |
SextanteGUI.getInputFactory().close(layer.getName()); |
|
22 |
} |
|
23 |
|
|
24 |
} |
|
25 |
|
|
26 |
} |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/extent.java | ||
---|---|---|
23 | 23 |
public static void invoke(final Interpreter env, |
24 | 24 |
final CallStack callstack, |
25 | 25 |
final String sLayer) { |
26 |
|
|
27 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
26 | 28 |
try { |
27 | 29 |
final ILayer layer = (ILayer) SextanteGUI.getInputFactory().getInputFromName(sLayer); |
28 | 30 |
if ((layer instanceof I3DRasterLayer) || (layer instanceof IRasterLayer)) { |
... | ... | |
44 | 46 |
final String sLayer, |
45 | 47 |
final double dCellSize) { |
46 | 48 |
|
49 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
47 | 50 |
try { |
48 | 51 |
final IVectorLayer layer = (IVectorLayer) SextanteGUI.getInputFactory().getInputFromName(sLayer); |
49 | 52 |
final AnalysisExtent ge = new AnalysisExtent(); |
... | ... | |
60 | 63 |
env.println("Could not set analysis extent"); |
61 | 64 |
} |
62 | 65 |
|
63 |
|
|
64 | 66 |
} |
65 | 67 |
|
66 | 68 |
|
... | ... | |
72 | 74 |
final double yMax, |
73 | 75 |
final double dCellSize) { |
74 | 76 |
|
77 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
75 | 78 |
try { |
76 | 79 |
final AnalysisExtent ge = new AnalysisExtent(); |
77 | 80 |
ge.setCellSize(dCellSize); |
... | ... | |
97 | 100 |
final double dCellSize, |
98 | 101 |
final double dCellSizeZ) { |
99 | 102 |
|
103 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
100 | 104 |
try { |
101 | 105 |
final AnalysisExtent ae = new AnalysisExtent(); |
102 | 106 |
ae.setCellSize(dCellSize); |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/rename.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.IDataObject; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
/** |
|
9 |
* A BeanShell command to rename a SEXTANTE data object |
|
10 |
* |
|
11 |
* @author volaya |
|
12 |
* |
|
13 |
*/ |
|
14 |
public class rename { |
|
15 |
|
|
16 |
public static void invoke(final Interpreter env, |
|
17 |
final CallStack callstack, |
|
18 |
final String sName, |
|
19 |
final String sNewName) { |
|
20 |
|
|
21 |
final Object obj = SextanteGUI.getInputFactory().getInputFromName(sName.trim()); |
|
22 |
if (obj == null) { |
|
23 |
env.println("Invalid object: " + sName.trim()); |
|
24 |
} |
|
25 |
if (obj instanceof IDataObject) { |
|
26 |
((IDataObject) obj).setName(sNewName); |
|
27 |
} |
|
28 |
|
|
29 |
} |
|
30 |
|
|
31 |
} |
|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.IDataObject; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
/** |
|
9 |
* A BeanShell command to rename a SEXTANTE data object |
|
10 |
* |
|
11 |
* @author volaya |
|
12 |
* |
|
13 |
*/ |
|
14 |
public class rename { |
|
15 |
|
|
16 |
public static void invoke(final Interpreter env, |
|
17 |
final CallStack callstack, |
|
18 |
final String sName, |
|
19 |
final String sNewName) { |
|
20 |
|
|
21 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
22 |
final Object obj = SextanteGUI.getInputFactory().getInputFromName(sName.trim()); |
|
23 |
if (obj == null) { |
|
24 |
env.println("Invalid object: " + sName.trim()); |
|
25 |
} else if (obj instanceof IDataObject) { |
|
26 |
((IDataObject) obj).setName(sNewName); |
|
27 |
} |
|
28 |
|
|
29 |
} |
|
30 |
|
|
31 |
} |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/runalg.java | ||
---|---|---|
235 | 235 |
final String sAlgName, |
236 | 236 |
final Object[] args) { |
237 | 237 |
|
238 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
238 | 239 |
final String[] sArgs = new String[args.length]; |
239 | 240 |
for (int i = 0; i < args.length; i++) { |
240 | 241 |
sArgs[i] = args[i].toString(); |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/data.java | ||
---|---|---|
19 | 19 |
public static void invoke(final Interpreter env, |
20 | 20 |
final CallStack callstack) { |
21 | 21 |
|
22 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
22 | 23 |
final StringBuffer sb = new StringBuffer(); |
23 | 24 |
final IRasterLayer[] rasterLayers = SextanteGUI.getInputFactory().getRasterLayers(); |
24 | 25 |
sb.append("RASTER LAYERS\n"); |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/cmd/bshcommands/gettables.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.ITable; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
public class gettables { |
|
9 |
|
|
10 |
public static String[] invoke(final Interpreter env, |
|
11 |
final CallStack callstack) { |
|
12 |
|
|
13 |
final ITable[] tables = SextanteGUI.getInputFactory().getTables(); |
|
14 |
final String[] sNames = new String[tables.length]; |
|
15 |
for (int i = 0; i < tables.length; i++) { |
|
16 |
sNames[i] = tables[i].getName(); |
|
17 |
} |
|
18 |
|
|
19 |
return sNames; |
|
20 |
|
|
21 |
} |
|
22 |
|
|
23 |
} |
|
1 |
package es.unex.sextante.gui.cmd.bshcommands; |
|
2 |
|
|
3 |
import bsh.CallStack; |
|
4 |
import bsh.Interpreter; |
|
5 |
import es.unex.sextante.dataObjects.ITable; |
|
6 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
7 |
|
|
8 |
public class gettables { |
|
9 |
|
|
10 |
public static String[] invoke(final Interpreter env, |
|
11 |
final CallStack callstack) { |
|
12 |
|
|
13 |
SextanteGUI.getInputFactory().createDataObjects(); |
|
14 |
final ITable[] tables = SextanteGUI.getInputFactory().getTables(); |
|
15 |
final String[] sNames = new String[tables.length]; |
|
16 |
for (int i = 0; i < tables.length; i++) { |
|
17 |
sNames[i] = tables[i].getName(); |
|
18 |
} |
|
19 |
|
|
20 |
return sNames; |
|
21 |
|
|
22 |
} |
|
23 |
|
|
24 |
} |
Also available in: Unified diff