Revision 654

View differences:

org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3

  
4
	<modelVersion>4.0.0</modelVersion>
5
	<artifactId>org.gvsig.geoprocess</artifactId>
6
	<packaging>pom</packaging>
7
	<name>org.gvsig.geoprocess</name>
8
	<description>Geoprocessing projects</description>
9
	<version>2.2.22</version>
10

  
11
	<parent>
12
        <groupId>org.gvsig</groupId>
13
        <artifactId>org.gvsig.desktop</artifactId>
14
        <version>2.0.85</version>
15
    </parent>
16

  
17
	<scm>
18
		<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-geoprocess/org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22</connection>
19
		<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-geoprocess/org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22</developerConnection>
20
		<url>https://devel.gvsig.org/redmine/projects/gvsig-geoprocess/repository/show/org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22</url>
21
	</scm>
22

  
23
	<repositories>
24
		<repository>
25
			<id>gvsig-public-http-repository</id>
26
			<name>gvSIG maven public HTTP repository</name>
27
			<url>http://devel.gvsig.org/m2repo/j2se</url>
28
			<releases>
29
				<enabled>true</enabled>
30
				<updatePolicy>daily</updatePolicy>
31
				<checksumPolicy>warn</checksumPolicy>
32
			</releases>
33
			<snapshots>
34
				<enabled>true</enabled>
35
				<updatePolicy>daily</updatePolicy>
36
				<checksumPolicy>warn</checksumPolicy>
37
			</snapshots>
38
		</repository>
39
	</repositories>
40

  
41
	<dependencyManagement>
42
		<dependencies>
43
			<dependency>
44
				<groupId>org.gvsig</groupId>
45
		                <artifactId>org.gvsig.raster</artifactId>
46
		                <version>2.2.10</version>
47
		                <type>pom</type>
48
		                <scope>import</scope>
49
                        </dependency>
50
			<dependency>
51
				<groupId>org.gvsig</groupId>
52
				<artifactId>org.gvsig.toolbox</artifactId>
53
				<version>1.0.16</version>
54
				<type>pom</type>
55
				<scope>import</scope>
56
				<optional>true</optional>
57
			</dependency>
58
			<dependency>
59
				<groupId>org.gvsig</groupId>
60
				<artifactId>org.gvsig.geoprocess.app.mainplugin</artifactId>
61
				<version>2.2.22</version>
62
			</dependency>
63
			<dependency>
64
				<groupId>org.gvsig</groupId>
65
				<artifactId>org.gvsig.geoprocess.lib.api</artifactId>
66
				<version>2.2.22</version>
67
			</dependency>
68
			<dependency>
69
				<groupId>org.gvsig</groupId>
70
				<artifactId>org.gvsig.geoprocess.lib.sextante</artifactId>
71
				<version>2.2.22</version>
72
			</dependency>
73
			<dependency>
74
		    	<groupId>org.gvsig</groupId>
75
   				<artifactId>org.gvsig.geoprocess.algorithm.base</artifactId>
76
            	<version>2.2.22</version>
77
   			</dependency>
78
			<dependency>
79
	            <groupId>org.gvsig</groupId>
80
	            <artifactId>org.gvsig.geoprocess.algorithm.buffer</artifactId>
81
	            <version>2.2.22</version>
82
	        </dependency>
83
	        <dependency>
84
	            <groupId>org.gvsig</groupId>
85
	            <artifactId>org.gvsig.geoprocess.algorithm.clip</artifactId>
86
	            <version>2.2.22</version>
87
	        </dependency>
88
	        <dependency>
89
	            <groupId>org.gvsig</groupId>
90
	            <artifactId>org.gvsig.geoprocess.algorithm.convexhull</artifactId>
91
	            <version>2.2.22</version>
92
	        </dependency>
93
	        <dependency>
94
	            <groupId>org.gvsig</groupId>
95
	            <artifactId>org.gvsig.geoprocess.algorithm.difference</artifactId>
96
	            <version>2.2.22</version>
97
	        </dependency>
98
	        <dependency>
99
	            <groupId>org.gvsig</groupId>
100
	            <artifactId>org.gvsig.geoprocess.algorithm.dissolve</artifactId>
101
	            <version>2.2.22</version>
102
	        </dependency>
103
	        <dependency>
104
	            <groupId>org.gvsig</groupId>
105
	            <artifactId>org.gvsig.geoprocess.algorithm.fusespatially</artifactId>
106
	            <version>2.2.22</version>
107
	        </dependency>
108
	        <dependency>
109
	            <groupId>org.gvsig</groupId>
110
	            <artifactId>org.gvsig.geoprocess.algorithm.intersection</artifactId>
111
	            <version>2.2.22</version>
112
	        </dependency>
113
	        <dependency>
114
	            <groupId>org.gvsig</groupId>
115
	            <artifactId>org.gvsig.geoprocess.algorithm.merge</artifactId>
116
	            <version>2.2.22</version>
117
	        </dependency>
118
	        <dependency>
119
	            <groupId>org.gvsig</groupId>
120
	            <artifactId>org.gvsig.geoprocess.algorithm.reproject</artifactId>
121
	            <version>2.2.22</version>
122
	        </dependency>
123
	        <dependency>
124
	            <groupId>org.gvsig</groupId>
125
	            <artifactId>org.gvsig.geoprocess.algorithm.spatialjoin</artifactId>
126
	            <version>2.2.22</version>
127
	        </dependency>
128
	        <dependency>
129
	            <groupId>org.gvsig</groupId>
130
	            <artifactId>org.gvsig.geoprocess.algorithm.union</artifactId>
131
	            <version>2.2.22</version>
132
	        </dependency>
133
	        <dependency>
134
	            <groupId>org.gvsig</groupId>
135
	            <artifactId>org.gvsig.geoprocess.algorithm.xyshift</artifactId>
136
	            <version>2.2.22</version>
137
	        </dependency>
138
	        <dependency>
139
	            <groupId>org.gvsig</groupId>
140
	            <artifactId>org.gvsig.geoprocess.algorithm.groupby</artifactId>
141
	            <version>2.2.22</version>
142
	        </dependency>
143
            <dependency>
144
	            <groupId>org.gvsig</groupId>
145
	            <artifactId>org.gvsig.geoprocess.algorithm.lateralbuffer</artifactId>
146
	            <version>2.2.22</version>
147
	        </dependency>
148
	        <dependency>
149
	            <groupId>org.gvsig</groupId>
150
	            <artifactId>org.gvsig.geoprocess.algorithm.splitlines</artifactId>
151
	            <version>2.2.22</version>
152
	        </dependency>
153
	        <dependency>
154
            	<groupId>org.japura</groupId>
155
            	<artifactId>org.japura</artifactId>
156
            	<version>1.14.0</version>
157
        	</dependency>
158
		</dependencies>
159
	</dependencyManagement>
160

  
161
	<build>
162
        <plugins>
163
            <plugin>
164
                <groupId>org.apache.maven.plugins</groupId>
165
                <artifactId>maven-release-plugin</artifactId>
166
                <configuration>
167
                    <tagBase>https://devel.gvsig.org/svn/gvsig-geoprocess/org.gvsig.geoprocess/tags/</tagBase>
168
                    <goals>deploy</goals>
169
                </configuration>
170
            </plugin>
171

  
172
        	<plugin>
173
            	<groupId>org.apache.maven.plugins</groupId>
174
            	<artifactId>maven-compiler-plugin</artifactId>
175
            	<version>2.0.2</version>
176
            	<configuration>
177
                	<source>1.6</source>
178
                	<target>1.6</target>
179
                	<encoding>ISO-8859-1</encoding>
180
            	</configuration>
181
        	</plugin>
182

  
183
        	<plugin>
184
              <groupId>org.codehaus.mojo</groupId>
185
              <artifactId>animal-sniffer-maven-plugin</artifactId>
186
              <executions>
187
                <execution>
188
                    <id>check-java-api</id>
189
                    <phase>test</phase>
190
                    <goals>
191
                        <goal>check</goal>
192
                    </goals>
193
                    <configuration>
194
                        <signature>
195
                            <groupId>org.codehaus.mojo.signature
196
                            </groupId>
197
                            <artifactId>java16</artifactId>
198
                            <version>1.0</version>
199
                        </signature>
200
                    </configuration>
201
                </execution>
202
              </executions>
203
             </plugin>
204

  
205
        </plugins>
206
    </build>
207

  
208
	 <modules>
209
		<module>org.gvsig.geoprocess.lib</module>
210
		<module>org.gvsig.geoprocess.app</module>
211
		<module>org.gvsig.geoprocess.algorithm</module>
212
	</modules>
213
</project>
0 214

  
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/README.txt
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

  
25
The first time you checkout the current project to a new workspace, 
26
you have to prepare it to be able to work easily with maven from
27
eclipse itself.
28

  
0 29

  
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/buildNumber.properties
1
#Mon Feb 16 10:06:28 CET 2015
2
buildNumber=2099
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/test/java/org/gvsig/sextante/app/extension/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
    <modelVersion>4.0.0</modelVersion>
4
    <artifactId>org.gvsig.sextante.app.extension</artifactId>
5
    <packaging>jar</packaging>
6
    <name>org.gvsig.sextante.app.extension</name>
7
    <version>2.0.0-SNAPSHOT</version>
8
    <description>Sextante bindings</description>
9

  
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>org.gvsig.sextante.app</artifactId>
13
        <version>2.0.0-SNAPSHOT</version>
14
    </parent>
15
    
16
    <dependencies>
17
        <dependency>
18
            <groupId>org.gvsig</groupId>
19
            <artifactId>org.gvsig.about.api</artifactId>
20
            <scope>compile</scope>
21
        </dependency>
22
    </dependencies>
23

  
24
    <profiles>
25
        <profile>
26
            <id>gvsig-install</id>
27
            <activation>
28
                <activeByDefault>true</activeByDefault>
29
            </activation>
30
            <properties>
31
                <!--  gvSIG installation folder -->
32
                <gvsig.install.dir>${basedir}/../../build/product</gvsig.install.dir>
33
            </properties>
34
        </profile>
35
    </profiles>
36
</project>
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/gui/AlgorithmOutputPanel.java
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.gui;
25

  
26
/**
27
 * @author gvSIG Team
28
 * @version $Id$
29
 * @deprecated use
30
 *             org.gvsig.geoprocess.sextante.gui.algorithm.AlgorithmOutputPanel
31
 *             instead
32
 */
33
public class AlgorithmOutputPanel extends
34
    org.gvsig.geoprocess.sextante.gui.algorithm.AlgorithmOutputPanel {
35

  
36
    // Nothing to add
37
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/gui/DEPRECATED
1
This package is fully deprecated.
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/core/CompositeSourceOutputChannel.java
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.core;
25

  
26

  
27
/**
28
 * Parameters used in a output layer
29
 * 
30
 * @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a>
31
 * @author gvSIG Team
32
 * @deprecated use
33
 *             org.gvsig.geoprocess.lib.sextante.outputs.CompositeSourceIOutputChannel
34
 *             instead
35
 */
36
public class CompositeSourceOutputChannel extends
37
    org.gvsig.geoprocess.lib.sextante.outputs.CompositeSourceIOutputChannel {
38

  
39
    public CompositeSourceOutputChannel(Object parameters) {
40
        super(parameters);
41
    }
42

  
43
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/core/IProgressModel.java
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.core;
25

  
26

  
27
/**
28
 * Interface to assign the bar increment
29
 * 
30
 * @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a>
31
 * @deprecated use {@link ProgressModel} instead
32
 */
33
public interface IProgressModel {
34

  
35
    /**
36
     * Assigns the new bar position
37
     * 
38
     * @param iStep
39
     */
40
    public void setProgress(int iStep);
41

  
42
    /**
43
     * Sets the number of steps
44
     * 
45
     * @param nSteps
46
     */
47
    public void setTotalNumberOfSteps(int nSteps);
48
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/core/gvGeoAlgorithm.java
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.core;
25

  
26
import org.gvsig.geoprocess.lib.sextante.AbstractSextanteGeoProcess;
27

  
28
/**
29
 * Base class for gvSIG algorithms
30
 * 
31
 * @author Nacho Brodin (nachobrodin@gmail.com)
32
 * @deprecated use {@link AbstractSextanteGeoProcess} instead
33
 */
34
public abstract class gvGeoAlgorithm extends AbstractSextanteGeoProcess
35
    implements IProgressModel {
36

  
37
    public void setProgress(int iStep) {
38
        getStatus().setCurValue(iStep);
39
    }
40

  
41
    public void setTotalNumberOfSteps(int nSteps) {
42
        getStatus().setRangeOfValues(0, nSteps);
43
    }
44

  
45
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/core/DEPRECATED
1
This package is fully deprecated.
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/sextante/gui/cmd/BSHWindow.java
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.sextante.gui.cmd;
25

  
26
import java.awt.BorderLayout;
27
import java.awt.Dimension;
28
import java.io.FileReader;
29

  
30
import javax.swing.JComponent;
31
import javax.swing.JPanel;
32

  
33
import bsh.Interpreter;
34
import bsh.util.JConsole;
35
import es.unex.sextante.core.Sextante;
36
import es.unex.sextante.gui.cmd.ScriptsIO;
37
import es.unex.sextante.gui.core.SextanteGUI;
38
import es.unex.sextante.gui.toolbox.ToolboxPanel;
39

  
40
import org.gvsig.geoprocess.sextante.gui.GeoprocessWindow;
41

  
42

  
43
/**
44
 * Window with a BeanShell shell to execute geoprocess.
45
 * 
46
 * @author gvSIG Team
47
 * @version $Id$
48
 */
49
public class BSHWindow extends GeoprocessWindow {
50

  
51
    private static final long serialVersionUID = 3805562395822654358L;
52

  
53
    /**
54
     * Creates a new {@link BSHWindow}.
55
     * 
56
     * @param toolbox
57
     *            the main geoprocess selector panel
58
     */
59
    public BSHWindow(ToolboxPanel toolbox) {
60
        super(toolbox);
61
        SextanteGUI.setLastCommandOrigin(SextanteGUI.COMMANDLINE);
62
        // SextanteGUI.setLastCommandOriginParentDialog(this);
63
    }
64

  
65
    @Override
66
    protected String getTitle() {
67
        return Sextante.getText("Command_line");
68
    }
69

  
70
    @Override
71
    protected JComponent getMainComponent() {
72
        JPanel panel = new JPanel();
73
        panel.setSize(new Dimension(400, 300));
74
        panel.setPreferredSize(new Dimension(400, 300));
75
        panel.setLayout(new BorderLayout());
76
        JConsole console = new JConsole();
77
        panel.add("Center", console);
78
        Interpreter interpreter = new Interpreter(console);
79
        interpreter.getNameSpace().importCommands(
80
            "es.unex.sextante.gui.cmd.bshcommands");
81
        String[] files = ScriptsIO.getScriptFiles();
82
        if (files != null) {
83
            for (int i = 0; i < files.length; i++) {
84
                try {
85
                    FileReader reader = new FileReader(files[i]);
86
                    interpreter.eval(reader);
87
                } catch (Exception e) {
88
                    // Nothing to do
89
                }
90
            }
91
        }
92
        new Thread(interpreter).start();
93

  
94
        return panel;
95
    }
96

  
97
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/sextante/gui/algorithm/AlgorithmOutputPanel.java
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.sextante.gui.algorithm;
25

  
26
import java.awt.GridBagConstraints;
27
import java.awt.GridBagLayout;
28

  
29
import javax.swing.JPanel;
30

  
31
import es.unex.sextante.core.GeoAlgorithm;
32

  
33
import org.gvsig.fmap.dal.DataServerExplorer;
34
import org.gvsig.fmap.dal.NewDataStoreParameters;
35
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
36
import org.gvsig.fmap.mapcontrol.dal.swing.datastore.DataStoreParametersCreationPanel;
37
import org.gvsig.fmap.mapcontrol.dal.swing.datastore.DefaultDataStoreParametersCreationPanel;
38
import org.gvsig.geoprocess.lib.sextante.dataObjects.OutputParameters;
39

  
40
/**
41
 * 
42
 * @author Nacho Brodin (nachobrodin@gmail.com)
43
 */
44
public class AlgorithmOutputPanel extends JPanel{
45

  
46
    private static final long serialVersionUID = -7028024211190671537L;
47

  
48
    private DataStoreParametersCreationPanel dataStoreCreationPanel = null;
49

  
50
    public AlgorithmOutputPanel() {
51
        super();
52
        initGUI();
53
    }
54

  
55
    public void init(GeoAlgorithm algorithm) {
56
        //m_Algorithm = algorithm;
57
        initGUI();
58
    }
59

  
60
    private void initGUI() {
61
        GridBagLayout gbl = new GridBagLayout();
62
        this.setLayout(gbl);
63

  
64
        GridBagConstraints gbc = new GridBagConstraints();
65
        gbc.fill = GridBagConstraints.HORIZONTAL;
66
        gbc.weightx = 1.0;
67
        gbc.gridx = 0;
68
        gbc.gridy = 0;      
69
        this.add(getDataStoreCreationPanel(), gbc);		
70
    }
71

  
72
    /**
73
     * Gets a ComboBox
74
     * @return
75
     */
76
    public DataStoreParametersCreationPanel getDataStoreCreationPanel() {
77
        if(dataStoreCreationPanel == null) {
78
            dataStoreCreationPanel = new DefaultDataStoreParametersCreationPanel();		         
79
        }
80
        return dataStoreCreationPanel;
81
    }
82

  
83
    public Object getOutputParameters() {
84
        NewDataStoreParameters newDataStoreParameters = 
85
            getDataStoreCreationPanel().getDataStoreParameters();
86
        DataServerExplorer dataServerExplorer =
87
            getDataStoreCreationPanel().getDataServerExplorer();
88
        if ((newDataStoreParameters != null) && (dataServerExplorer != null)){	    
89
            return new OutputParameters((NewFeatureStoreParameters)newDataStoreParameters,
90
                dataServerExplorer);
91
        }else{
92
            return null;
93
        }
94
    }
95
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/sextante/gui/algorithm/ParametersPanel.java
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.sextante.gui.algorithm;
25

  
26
import javax.swing.JPanel;
27

  
28
import es.unex.sextante.core.OutputObjectsSet;
29
import es.unex.sextante.exceptions.WrongOutputIDException;
30
import es.unex.sextante.gui.algorithm.DefaultParametersPanel;
31
import es.unex.sextante.gui.algorithm.OutputParameterContainer;
32
import es.unex.sextante.gui.algorithm.ParameterContainer;
33
import es.unex.sextante.outputs.Output;
34

  
35
import org.gvsig.geoprocess.core.CompositeSourceOutputChannel;
36
import org.gvsig.geoprocess.lib.sextante.dataObjects.OutputParameters;
37

  
38
/**
39
 * Default panel for gvSIG algorithms
40
 * 
41
 * @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a>
42
 */
43
public class ParametersPanel extends DefaultParametersPanel {
44

  
45
    private static final long serialVersionUID = 1L;
46

  
47
    @SuppressWarnings("unchecked")
48
    protected void addOutputObjects(JPanel pane) {
49
        String sDescription;
50
        OutputObjectsSet ooset = m_Algorithm.getOutputObjects();
51

  
52
        m_iCurrentRow = 0;
53

  
54
        for (int i = 0; i < ooset.getOutputObjectsCount(); i++) {
55
            Output out = ooset.getOutput(i);
56

  
57
            sDescription =
58
                out.getDescription() + "[" + out.getTypeDescription() + "]";
59
            addTitleLabel(pane, sDescription, m_iCurrentRow, false);
60

  
61
            AlgorithmOutputPanel algorithmOutputPanel =
62
                new AlgorithmOutputPanel();
63

  
64
            pane.add(algorithmOutputPanel,
65
                getStringTableCoords(2, m_iCurrentRow));
66
            m_iCurrentRow++;
67
            m_OutputParameterContainer.add(new OutputParameterContainer(out
68
                .getName(), algorithmOutputPanel));
69
        }
70
    }
71

  
72
    public void assignParameters() {
73

  
74
        boolean bAssigningOK = true;
75
        int i;
76
        ParameterContainer parameterContainer;
77
        String sType;
78

  
79
        for (i = 0; i < m_ParameterContainer.size(); i++) {
80
            parameterContainer =
81
                (ParameterContainer) m_ParameterContainer.get(i);
82
            sType = parameterContainer.getType();
83
            if (sType.equals("Table")) {
84
                bAssigningOK = assignInputTable(parameterContainer);
85
            } else
86
                if (sType.equals("Vector Layer")
87
                    || sType.equals("Raster Layer")) {
88
                    bAssigningOK = assignInputLayer(parameterContainer);
89
                } else
90
                    if (sType.equals("Numerical Value")) {
91
                        bAssigningOK =
92
                            assignInputNumericalValue(parameterContainer);
93
                    } else
94
                        if (sType.equals("String")) {
95
                            bAssigningOK =
96
                                assignInputString(parameterContainer);
97
                        } else
98
                            if (sType.equals("Boolean")) {
99
                                bAssigningOK =
100
                                    assignInputBoolean(parameterContainer);
101
                            } else
102
                                if (sType.equals("Fixed Table")) {
103
                                    bAssigningOK =
104
                                        assignInputFixedTable(parameterContainer);
105
                                } else
106
                                    if (sType.equals("Multiple Input")) {
107
                                        bAssigningOK =
108
                                            assignInputMultipleInput(parameterContainer);
109
                                    } else
110
                                        if (sType.equals("Point")) {
111
                                            bAssigningOK =
112
                                                assignInputPoint(parameterContainer);
113
                                        } else
114
                                            if (parameterContainer.getType()
115
                                                .equals("Filepath")) {
116
                                                bAssigningOK =
117
                                                    assignInputFilepath(parameterContainer);
118
                                            } else
119
                                                if (sType.equals("Table Field")
120
                                                    || sType
121
                                                        .equals("Selection")
122
                                                    || sType.equals("Band")) {
123
                                                    bAssigningOK =
124
                                                        assignInputSelection(parameterContainer);
125
                                                }
126

  
127
            if (!bAssigningOK) {
128
                return;
129
            }
130

  
131
        }
132

  
133
        OutputObjectsSet ooset = m_Algorithm.getOutputObjects();
134
        for (i = 0; i < m_OutputParameterContainer.size(); i++) {
135
            OutputParameterContainer opc =
136
                (OutputParameterContainer) m_OutputParameterContainer.get(i);
137
            Output out;
138
            try {
139
                out = ooset.getOutput(opc.getName());
140
                AlgorithmOutputPanel op =
141
                    (AlgorithmOutputPanel) opc.getContainer();
142
                Object obj = op.getOutputParameters();
143
                if (obj == null) {
144
                    return;
145
                }
146
                if (obj instanceof OutputParameters)
147
                    out.setOutputChannel(new CompositeSourceOutputChannel(obj));
148
            } catch (WrongOutputIDException e) {
149
            }
150
        }
151

  
152
        return;
153

  
154
    }
155
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/sextante/gui/toolbox/ToolboxWindow.java
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.sextante.gui.toolbox;
25

  
26
import java.awt.BorderLayout;
27
import java.beans.PropertyChangeEvent;
28
import java.beans.PropertyChangeListener;
29

  
30
import javax.swing.ImageIcon;
31
import javax.swing.JDialog;
32
import javax.swing.JPanel;
33
import javax.swing.JScrollPane;
34
import javax.swing.JTree;
35
import javax.swing.JViewport;
36
import javax.swing.event.TreeExpansionEvent;
37
import javax.swing.event.TreeExpansionListener;
38
import javax.swing.tree.DefaultMutableTreeNode;
39
import javax.swing.tree.DefaultTreeModel;
40

  
41
import org.gvsig.andami.ui.mdiManager.IWindow;
42
import org.gvsig.andami.ui.mdiManager.IWindowListener;
43
import org.gvsig.andami.ui.mdiManager.SingletonWindow;
44
import org.gvsig.andami.ui.mdiManager.WindowInfo;
45
import org.gvsig.app.ApplicationLocator;
46
import org.gvsig.app.ApplicationManager;
47
import org.gvsig.app.project.Project;
48
import org.gvsig.app.project.documents.ProjectDocumentListener;
49
import org.gvsig.app.project.documents.view.ViewDocument;
50
import org.gvsig.app.project.documents.view.gui.IView;
51
import org.gvsig.fmap.mapcontext.layers.CancelationException;
52
import org.gvsig.fmap.mapcontext.layers.FLayers;
53
import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent;
54
import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener;
55
import org.gvsig.fmap.mapcontext.layers.LayerPositionEvent;
56
import org.gvsig.i18n.Messages;
57

  
58
import es.unex.sextante.core.IInputFactory;
59
import es.unex.sextante.gui.core.SextanteGUI;
60
import es.unex.sextante.gui.toolbox.AlgorithmsPanel;
61
import es.unex.sextante.gui.toolbox.IToolboxDialog;
62
import es.unex.sextante.gui.toolbox.ToolboxPanel;
63

  
64
/**
65
 * Geoprocess selector window.
66
 * 
67
 * @author gvSIG Team
68
 * @version $Id$
69
 */
70
public class ToolboxWindow extends JPanel implements SingletonWindow,
71
    IWindowListener, LayerCollectionListener, PropertyChangeListener,
72
    ProjectDocumentListener, IToolboxDialog, TreeExpansionListener {
73

  
74
    private static final long serialVersionUID = 2205888138813789720L;
75
    private WindowInfo windowInfo;
76
    private ToolboxPanel toolboxPanel;
77
    private ApplicationManager manager = ApplicationLocator.getManager();
78

  
79
    /**
80
     * Default constructor.
81
     */
82
    public ToolboxWindow() {
83
        IInputFactory inputFactory = SextanteGUI.getInputFactory();
84
        if (inputFactory.getDataObjects() == null) {
85
            inputFactory.createDataObjects();
86
        }
87

  
88
        windowInfo =
89
            new WindowInfo(WindowInfo.PALETTE | WindowInfo.MAXIMIZABLE
90
                | WindowInfo.RESIZABLE | WindowInfo.ICONIFIABLE);
91
        
92
        toolboxPanel = new ToolboxPanel(this, null, new ImageIcon());
93
        windowInfo.setWidth(toolboxPanel.getWidth());
94
        windowInfo.setHeight(toolboxPanel.getHeight());
95
        windowInfo.setPersistence(true);
96
        this.setLayout(new BorderLayout(0, 0));
97
        this.add(toolboxPanel);
98
        addListeners();
99
       // removeBaseTreeText(true);
100
    }
101
    
102
    /**
103
     * Big ?apa to remove the word "Algorithm"
104
     * @deprecated the work has been changed in the own library
105
     */
106
    private void removeBaseTreeText(boolean register) {
107
    	for (int i = 0; i < toolboxPanel.getComponentCount(); i++) {
108
			if(toolboxPanel.getComponent(i) instanceof AlgorithmsPanel) {
109
				AlgorithmsPanel p = (AlgorithmsPanel)toolboxPanel.getComponent(i);
110
				for (int j = 0; j < p.getComponentCount(); j++) {
111
					if(p.getComponent(j) instanceof JScrollPane) {
112
						JScrollPane scrollPane = (JScrollPane)p.getComponent(j);
113
						JViewport vp = scrollPane.getViewport();
114
						for (int k = 0; k < vp.getComponentCount(); k++) {
115
							if(vp.getComponent(k) instanceof JTree) {
116
								JTree tree = (JTree)vp.getComponent(k);
117
								if(register)
118
									tree.addTreeExpansionListener(this);
119
								DefaultTreeModel model = (DefaultTreeModel)tree.getModel();
120
								DefaultMutableTreeNode node = (DefaultMutableTreeNode)model.getRoot();
121
								node.setUserObject("");
122
							}
123
						}
124
					}
125
				}
126
			}
127
		}
128
    }
129

  
130
    private void addListeners() {
131
        doForEachFLayers(new FLayersAction() {
132

  
133
            public void performAction(FLayers layers) {
134
                layers.addLayerCollectionListener(ToolboxWindow.this);
135
            }
136
        });
137
    }
138

  
139
    private void removeListeners() {
140
        doForEachFLayers(new FLayersAction() {
141

  
142
            public void performAction(FLayers layers) {
143
                layers.removeLayerCollectionListener(ToolboxWindow.this);
144
            }
145
        });
146
    }
147

  
148
    private void doForEachFLayers(FLayersAction action) {
149
        // Register a propertyChangeListener to capture events when a new
150
        // document is added in gvSIG
151
        Project project = manager.getCurrentProject();
152
        project.addPropertyChangeListener(this);
153

  
154
        // Register addLayerCollectionListener in existing views
155
        IWindow[] window = manager.getUIManager().getAllWindows();
156
        for (int i = 0; i < window.length; i++) {
157
            if (window[i] instanceof IView) {
158
                FLayers layers =
159
                    ((IView) window[i]).getMapControl().getMapContext()
160
                        .getLayers();
161
                action.performAction(layers);
162
            }
163
        }
164
    }
165

  
166
    public WindowInfo getWindowInfo() {
167
        return windowInfo;
168
    }
169

  
170
    public Object getWindowProfile() {
171
        return WindowInfo.TOOL_PROFILE;
172
    }
173

  
174
    public Object getWindowModel() {
175
        return "GeoprocessingSelector";
176
    }
177

  
178
    public ToolboxPanel getToolboxPanel() {
179
        return toolboxPanel;
180
    }
181

  
182
    public void cancel() {
183
        removeListeners();
184
        manager.getUIManager().closeWindow(this);
185
    }
186

  
187
    public void windowActivated() {
188
        // Nothing to do
189
    }
190

  
191
    public void windowClosed() {
192
        removeListeners();
193
        SextanteGUI.getInputFactory().clearDataObjects();
194
    }
195

  
196
    public void propertyChange(PropertyChangeEvent evt) {
197
        if (evt.getPropertyName().equals("addDocument")) {
198
            if (evt.getNewValue() instanceof ViewDocument) {
199
                ViewDocument dvd = (ViewDocument) evt.getNewValue();
200
                dvd.addListener(this);
201
            }
202
        }
203
    }
204

  
205
    /**
206
     * Event thrown when a window (View) is created. This method registers a
207
     * listener in FLayers. When a new layer is going to be
208
     * added or removed the methods layerAdded and layerRemoved will catch this
209
     * event.
210
     */
211
    public void windowCreated(IWindow window) {
212
        if (window instanceof IView) {
213
            final FLayers layers =
214
                ((IView) window).getMapControl().getMapContext().getLayers();
215
            layers.addLayerCollectionListener(this);
216
        }
217
    }
218

  
219
    public void layerAdded(final LayerCollectionEvent e) {
220
        // this could be done more elegantly, just adding the new layers...
221
        // but it works fine this way ;-)
222
        SextanteGUI.getInputFactory().clearDataObjects();
223
        SextanteGUI.getInputFactory().createDataObjects();
224
    }
225

  
226
    public void layerRemoved(final LayerCollectionEvent e) {
227
        SextanteGUI.getInputFactory().clearDataObjects();
228
        SextanteGUI.getInputFactory().createDataObjects();
229
    }
230

  
231
    public void layerMoved(final LayerPositionEvent e) {
232
        // Nothing to do
233
    }
234

  
235
    public void layerAdding(final LayerCollectionEvent e)
236
        throws CancelationException {
237
        // Nothing to do
238
    }
239

  
240
    public void layerMoving(final LayerPositionEvent e)
241
        throws CancelationException {
242
        // Nothing to do
243
    }
244

  
245
    public void layerRemoving(final LayerCollectionEvent e)
246
        throws CancelationException {
247
        // Nothing to do
248
    }
249

  
250
    public void visibilityChanged(final LayerCollectionEvent e)
251
        throws CancelationException {
252
        // Nothing to do
253
    }
254

  
255
    public JDialog getDialog() {
256
        // Nothing to do
257
        return null;
258
    }
259

  
260
    public void setAlgorithmsCount(int count) {
261
        getWindowInfo().setTitle(
262
            Messages.getText("Geoprocessing_Toolbox") + " - " + Integer.toString(count)
263
                + " " + Messages.getText("tools"));
264
    }
265

  
266
    /**
267
     * Performs an action over a {@link FLayers} instance.
268
     * 
269
     * @author gvSIG Team
270
     * @version $Id$
271
     */
272
    private static interface FLayersAction {
273

  
274
        /**
275
         * Performs an action over a {@link FLayers} instance.
276
         * 
277
         * @param layers
278
         *            to perform the action with
279
         */
280
        void performAction(FLayers layers);
281
    }
282

  
283
	public void treeCollapsed(TreeExpansionEvent event) {
284
	}
285

  
286
	public void treeExpanded(TreeExpansionEvent event) {
287
		//removeBaseTreeText(false);
288
	}
289

  
290
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/sextante/gui/modeler/ModelerWindow.java
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.sextante.gui.modeler;
25

  
26
import javax.swing.JComponent;
27

  
28
import es.unex.sextante.core.Sextante;
29
import es.unex.sextante.gui.modeler.ModelerPanel;
30
import es.unex.sextante.gui.toolbox.ToolboxPanel;
31

  
32
import org.gvsig.andami.ui.mdiManager.WindowInfo;
33
import org.gvsig.geoprocess.sextante.gui.GeoprocessWindow;
34

  
35
/**
36
 * Geoprocess modeler window.
37
 * 
38
 * @author gvSIG Team
39
 * @version $Id$
40
 */
41
public class ModelerWindow extends GeoprocessWindow {
42

  
43
    private static final long serialVersionUID = -677659097155651764L;
44

  
45
    /**
46
     * Creates a new {@link ModelerWindow}.
47
     * 
48
     * @param toolbox
49
     *            the main geoprocess selector panel
50
     */
51
    public ModelerWindow(ToolboxPanel toolbox) {
52
        super(toolbox);
53
    }
54

  
55
    @Override
56
    protected String getTitle() {
57
        return Sextante.getText("Modeler");
58
    }
59

  
60
    @Override
61
    protected JComponent getMainComponent() {
62
        return new ModelerPanel(null);
63
    }
64

  
65
    public Object getWindowProfile() {
66
        return WindowInfo.DIALOG_PROFILE;
67
    }
68

  
69
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/sextante/gui/core/GUIFactory.java
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.sextante.gui.core;
25

  
26
import java.util.ArrayList;
27
import java.util.HashMap;
28
import java.util.Iterator;
29
import java.util.List;
30

  
31
import javax.swing.ImageIcon;
32

  
33
import org.gvsig.andami.ui.mdiManager.MDIManager;
34
import org.gvsig.app.ApplicationLocator;
35
import org.gvsig.app.project.Project;
36
import org.gvsig.app.project.documents.Document;
37
import org.gvsig.app.project.documents.view.ViewDocument;
38
import org.gvsig.app.project.documents.view.ViewManager;
39
import org.gvsig.fmap.mapcontext.layers.FLayer;
40
import org.gvsig.fmap.mapcontext.layers.FLayers;
41
import org.gvsig.geoprocess.sextante.gui.cmd.BSHWindow;
42
import org.gvsig.geoprocess.sextante.gui.dataExplorer.DataExplorerWindow;
43
import org.gvsig.geoprocess.sextante.gui.history.HistoryWindow;
44
import org.gvsig.geoprocess.sextante.gui.modeler.ModelerWindow;
45
import org.gvsig.geoprocess.sextante.gui.toolbox.ToolboxWindow;
46

  
47
import es.unex.sextante.dataObjects.IDataObject;
48
import es.unex.sextante.gui.core.DefaultGUIFactory;
49
import es.unex.sextante.gui.core.NameAndIcon;
50
import es.unex.sextante.gui.core.ToolboxAction;
51
import es.unex.sextante.gui.exceptions.WrongViewNameException;
52
import es.unex.sextante.gui.toolbox.ToolboxPanel;
53

  
54
/**
55
 * Geoprocess UI factory.
56
 * 
57
 * @author gvSIG Team
58
 * @version $Id$
59
 */
60
public class GUIFactory extends DefaultGUIFactory {
61

  
62
    private ToolboxWindow toolbox;
63
    private MDIManager uiManager = ApplicationLocator.getManager().getUIManager();
64
    private static final HashMap<NameAndIcon, ArrayList<ToolboxAction>> map = new HashMap<NameAndIcon, ArrayList<ToolboxAction>>();
65
    
66
    public void showToolBoxDialog() {
67
        uiManager.addWindow(getToolBoxWindow());
68
    }
69

  
70
    private ToolboxWindow getToolBoxWindow() {
71
        if (toolbox == null) {
72
            toolbox = new ToolboxWindow();
73
            m_Toolbox = toolbox.getToolboxPanel();
74
        }
75
        return toolbox;
76
    }
77

  
78
    public ToolboxPanel getToolboxPanel() {
79
        // return getToolBoxWindow().getToolboxPanel();
80
        return m_Toolbox;
81
    }
82

  
83
    public void showModelerDialog() {
84
        ModelerWindow modeler = new ModelerWindow(getToolboxPanel());
85
        uiManager.addWindow(modeler);
86
    }
87

  
88
    public void showHistoryDialog() {
89
        HistoryWindow history = new HistoryWindow(getToolboxPanel());
90
        uiManager.addWindow(history);
91
    }
92

  
93
    public void showCommandLineDialog() {
94
        BSHWindow bsh = new BSHWindow(getToolboxPanel());
95
        uiManager.addWindow(bsh);
96
    }
97

  
98
    public void showDataExplorer() {
99
        DataExplorerWindow dataExplorer =
100
            new DataExplorerWindow(getToolboxPanel());
101
        uiManager.addWindow(dataExplorer);
102
    }
103

  
104
    public void addToView(IDataObject obj, String viewName)
105
        throws WrongViewNameException {
106

  
107
        Project project = ApplicationLocator.getManager().getCurrentProject();
108
        List<Document> views = project.getDocuments(ViewManager.TYPENAME);
109
        for (int i = 0; i < views.size(); i++) {
110
            ViewDocument view = (ViewDocument) views.get(i);
111
            if (view.getName().equals(viewName)) {
112
                FLayers layers = view.getMapContext().getLayers();
113
                Object layer = obj.getBaseDataObject();
114
                if (layer instanceof FLayer) {
115
                    layers.addLayer((FLayer) layer);
116
                }
117
                return;
118
            }
119
        }
120

  
121
        throw new WrongViewNameException();
122
    }
123
    
124
    @Override
125
    public HashMap<NameAndIcon, ArrayList<ToolboxAction>> getToolboxActions() {
126
//       final NameAndIcon nai = new NameAndIcon("gvSIG", null);
127
//       final ArrayList<ToolboxAction> algs = new ArrayList<ToolboxAction>();
128
//       algs.add(new PruebaToolboxAction());
129
//       map.put(nai, algs);
130
       return map;
131
    }
132
    
133
    public static void registerExternalTool(String groupName, ImageIcon icon, ToolboxAction toolBoxAction) {
134
    	Iterator<NameAndIcon> it = map.keySet().iterator();
135
    	ArrayList<ToolboxAction> algs = null;
136
    	NameAndIcon key = null;
137
    	while(it.hasNext()) {
138
    		key = it.next();
139
    		if(key.getName().equals(groupName)) {
140
    			algs = map.get(key);
141
    			break;
142
    		}
143
    	}
144
    	
145
    	if(algs == null) {
146
    		algs = new ArrayList<ToolboxAction>();
147
    		key = new NameAndIcon(groupName, icon);
148
    	}
149
    	
150
    	 algs.add(toolBoxAction);
151
    	 map.put(key, algs);
152
    }
153

  
154
    // public Class getDefaultParametersPanel() {
155
    //
156
    // return ParametersPanel.class;
157
    //
158
    // }
159
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/sextante/gui/dataExplorer/DataExplorerWindow.java
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.sextante.gui.dataExplorer;
25

  
26
import javax.swing.JComponent;
27

  
28
import es.unex.sextante.core.Sextante;
29
import es.unex.sextante.gui.dataExplorer.DataExplorerPanel;
30
import es.unex.sextante.gui.toolbox.ToolboxPanel;
31

  
32
import org.gvsig.geoprocess.sextante.gui.GeoprocessWindow;
33

  
34
/**
35
 * Geoprocess data explorer window.
36
 * 
37
 * @author gvSIG Team
38
 * @version $Id$
39
 */
40
public class DataExplorerWindow extends GeoprocessWindow {
41

  
42
    private static final long serialVersionUID = -3142501226718670393L;
43

  
44
    /**
45
     * Creates a new {@link DataExplorerWindow}.
46
     * 
47
     * @param toolbox
48
     *            the main geoprocess selector panel
49
     */
50
    public DataExplorerWindow(ToolboxPanel toolbox) {
51
        super(toolbox);
52
    }
53

  
54
    @Override
55
    protected String getTitle() {
56
        return Sextante.getText("Data");
57
    }
58

  
59
    @Override
60
    protected JComponent getMainComponent() {
61
        return new DataExplorerPanel();
62
    }
63
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.22/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/sextante/gui/GeoprocessWindow.java
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
 *
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff