Revision 1535

View differences:

org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177/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.177</version>
10

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

  
17
	<properties>
18
		<!-- El plugin versions:use-latest-versions falla con scope import -->
19
		<!-- asi que toca usar el versions:update-properties que si que funciona -->
20
		<org.gvsig.raster.version>2.2.167</org.gvsig.raster.version>
21
		<org.gvsig.toolbox.version>1.0.102</org.gvsig.toolbox.version>
22
    <gvsig.tools.version>3.0.296</gvsig.tools.version>
23
	</properties>
24
	<scm>
25
		<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-geoprocess/org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177</connection>
26
		<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-geoprocess/org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177</developerConnection>
27
		<url>https://devel.gvsig.org/redmine/projects/gvsig-geoprocess/repository/show/org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177</url>
28
	</scm>
29

  
30
	<repositories>
31
		<repository>
32
			<id>gvsig-public-http-repository</id>
33
			<name>gvSIG maven public HTTP repository</name>
34
			<url>http://devel.gvsig.org/m2repo/j2se</url>
35
			<releases>
36
				<enabled>true</enabled>
37
				<updatePolicy>daily</updatePolicy>
38
				<checksumPolicy>warn</checksumPolicy>
39
			</releases>
40
			<snapshots>
41
				<enabled>true</enabled>
42
				<updatePolicy>daily</updatePolicy>
43
				<checksumPolicy>warn</checksumPolicy>
44
			</snapshots>
45
		</repository>
46
	</repositories>
47

  
48
	<dependencyManagement>
49
		<dependencies>
50
	    <dependency>
51
        <groupId>org.gvsig</groupId>
52
        <artifactId>org.gvsig.tools</artifactId>
53
        <version>${gvsig.tools.version}</version>
54
        <type>pom</type>
55
        <scope>import</scope>
56
	    </dependency>
57
			<dependency>
58
				<groupId>org.gvsig</groupId>
59
				<artifactId>org.gvsig.raster</artifactId>
60
				<version>${org.gvsig.raster.version}</version>
61
				<type>pom</type>
62
				<scope>import</scope>
63
			</dependency>
64
			<dependency>
65
				<groupId>org.gvsig</groupId>
66
				<artifactId>org.gvsig.toolbox</artifactId>
67
				<version>${org.gvsig.toolbox.version}</version>
68
				<type>pom</type>
69
				<scope>import</scope>
70
			</dependency>
71
			<dependency>
72
				<groupId>org.gvsig</groupId>
73
				<artifactId>org.gvsig.geoprocess.app.mainplugin</artifactId>
74
				<version>2.2.177</version>
75
			</dependency>
76
			<dependency>
77
				<groupId>org.gvsig</groupId>
78
				<artifactId>org.gvsig.geoprocess.lib.api</artifactId>
79
				<version>2.2.177</version>
80
			</dependency>
81
			<dependency>
82
				<groupId>org.gvsig</groupId>
83
				<artifactId>org.gvsig.geoprocess.lib.sextante</artifactId>
84
				<version>2.2.177</version>
85
			</dependency>
86
			<dependency>
87
				<groupId>org.gvsig</groupId>
88
				<artifactId>org.gvsig.geoprocess.algorithm.base</artifactId>
89
				<version>2.2.177</version>
90
			</dependency>
91
			<dependency>
92
				<groupId>org.gvsig</groupId>
93
				<artifactId>org.gvsig.geoprocess.algorithm.buffer</artifactId>
94
				<version>2.2.177</version>
95
			</dependency>
96
			<dependency>
97
				<groupId>org.gvsig</groupId>
98
				<artifactId>org.gvsig.geoprocess.algorithm.clip</artifactId>
99
				<version>2.2.177</version>
100
			</dependency>
101
			<dependency>
102
				<groupId>org.gvsig</groupId>
103
				<artifactId>org.gvsig.geoprocess.algorithm.convexhull</artifactId>
104
				<version>2.2.177</version>
105
			</dependency>
106
			<dependency>
107
				<groupId>org.gvsig</groupId>
108
				<artifactId>org.gvsig.geoprocess.algorithm.difference</artifactId>
109
				<version>2.2.177</version>
110
			</dependency>
111
			<dependency>
112
				<groupId>org.gvsig</groupId>
113
				<artifactId>org.gvsig.geoprocess.algorithm.dissolve</artifactId>
114
				<version>2.2.177</version>
115
			</dependency>
116
			<dependency>
117
				<groupId>org.gvsig</groupId>
118
				<artifactId>org.gvsig.geoprocess.algorithm.fusespatially</artifactId>
119
				<version>2.2.177</version>
120
			</dependency>
121
			<dependency>
122
				<groupId>org.gvsig</groupId>
123
				<artifactId>org.gvsig.geoprocess.algorithm.intersection</artifactId>
124
				<version>2.2.177</version>
125
			</dependency>
126
			<dependency>
127
				<groupId>org.gvsig</groupId>
128
				<artifactId>org.gvsig.geoprocess.algorithm.merge</artifactId>
129
				<version>2.2.177</version>
130
			</dependency>
131
			<dependency>
132
				<groupId>org.gvsig</groupId>
133
				<artifactId>org.gvsig.geoprocess.algorithm.reproject</artifactId>
134
				<version>2.2.177</version>
135
			</dependency>
136
			<dependency>
137
				<groupId>org.gvsig</groupId>
138
				<artifactId>org.gvsig.geoprocess.algorithm.spatialjoin</artifactId>
139
				<version>2.2.177</version>
140
			</dependency>
141
			<dependency>
142
				<groupId>org.gvsig</groupId>
143
				<artifactId>org.gvsig.geoprocess.algorithm.union</artifactId>
144
				<version>2.2.177</version>
145
			</dependency>
146
			<dependency>
147
				<groupId>org.gvsig</groupId>
148
				<artifactId>org.gvsig.geoprocess.algorithm.xyshift</artifactId>
149
				<version>2.2.177</version>
150
			</dependency>
151
			<dependency>
152
				<groupId>org.gvsig</groupId>
153
				<artifactId>org.gvsig.geoprocess.algorithm.groupby</artifactId>
154
				<version>2.2.177</version>
155
			</dependency>
156
			<dependency>
157
				<groupId>org.gvsig</groupId>
158
				<artifactId>org.gvsig.geoprocess.algorithm.lateralbuffer</artifactId>
159
				<version>2.2.177</version>
160
			</dependency>
161
			<dependency>
162
				<groupId>org.gvsig</groupId>
163
				<artifactId>org.gvsig.geoprocess.algorithm.splitlines</artifactId>
164
				<version>2.2.177</version>
165
			</dependency>
166
      <dependency>
167
        <groupId>org.gvsig</groupId>
168
        <artifactId>org.gvsig.geoprocess.algorithm.dispersepoints</artifactId>
169
        <version>2.2.177</version>
170
      </dependency>
171
			<dependency>
172
				<groupId>org.japura</groupId>
173
				<artifactId>org.japura</artifactId>
174
				<version>1.14.0</version>
175
			</dependency>
176
  <dependency>
177
    <groupId>org.mapdb</groupId>
178
    <artifactId>mapdb</artifactId>
179
    <version>3.0.5</version>
180
  </dependency>
181

  
182

  
183
          <dependency>
184
            <groupId>org.jetbrains.kotlin</groupId>
185
            <artifactId>kotlin-stdlib</artifactId>
186
            <version>1.0.7</version>
187
          </dependency>
188

  
189
          <dependency>
190
            <groupId>org.jetbrains.kotlin</groupId>
191
            <artifactId>kotlin-runtime</artifactId>
192
            <version>1.0.7</version>
193
          </dependency>
194

  
195
          <dependency>
196
            <groupId>org.eclipse.collections</groupId>
197
            <artifactId>eclipse-collections-api</artifactId>
198
            <version>7.1.1</version>
199
          </dependency>
200

  
201
          <dependency>
202
            <groupId>net.jcip</groupId>
203
            <artifactId>jcip-annotations</artifactId>
204
            <version>1.0</version>
205
          </dependency>
206

  
207
          <dependency>
208
            <groupId>org.eclipse.collections</groupId>
209
            <artifactId>eclipse-collections</artifactId>
210
            <version>7.1.1</version>
211
          </dependency>
212

  
213
          <dependency>
214
            <groupId>org.eclipse.collections</groupId>
215
            <artifactId>eclipse-collections-forkjoin</artifactId>
216
            <version>7.1.1</version>
217
          </dependency>
218

  
219
          <dependency>
220
            <groupId>com.google.guava</groupId>
221
            <artifactId>guava</artifactId>
222
            <version>19.0</version>
223
          </dependency>
224

  
225
          <dependency>
226
            <groupId>net.jpountz.lz4</groupId>
227
            <artifactId>lz4</artifactId>
228
            <version>1.3.0</version>
229
          </dependency>
230

  
231
          <dependency>
232
            <groupId>org.mapdb</groupId>
233
            <artifactId>elsa</artifactId>
234
            <version>3.0.0-M5</version>
235
          </dependency>
236

  
237
		</dependencies>
238
	</dependencyManagement>
239

  
240
	<build>
241
		<plugins>
242
			<plugin>
243
				<groupId>org.apache.maven.plugins</groupId>
244
				<artifactId>maven-release-plugin</artifactId>
245
				<configuration>
246
					<tagBase>https://devel.gvsig.org/svn/gvsig-geoprocess/org.gvsig.geoprocess/tags/</tagBase>
247
					<goals>deploy</goals>
248
				</configuration>
249
			</plugin>
250

  
251
			<plugin>
252
				<groupId>org.apache.maven.plugins</groupId>
253
				<artifactId>maven-compiler-plugin</artifactId>
254
				<version>2.0.2</version>
255
				<configuration>
256
					<source>1.8</source>
257
					<target>1.8</target>
258
					<encoding>ISO-8859-1</encoding>
259
				</configuration>
260
			</plugin>
261

  
262
<!-- 			<plugin>
263
				<groupId>org.codehaus.mojo</groupId>
264
				<artifactId>animal-sniffer-maven-plugin</artifactId>
265
				<executions>
266
					<execution>
267
						<id>check-java-api</id>
268
						<phase>test</phase>
269
						<goals>
270
							<goal>check</goal>
271
						</goals>
272
						<configuration>
273
							<signature>
274
								<groupId>org.codehaus.mojo.signature
275
								</groupId>
276
								<artifactId>java16</artifactId>
277
								<version>1.0</version>
278
							</signature>
279
						</configuration>
280
					</execution>
281
				</executions>
282
			</plugin> -->
283

  
284
		</plugins>
285
	</build>
286

  
287
	<modules>
288
		<module>org.gvsig.geoprocess.lib</module>
289
		<module>org.gvsig.geoprocess.app</module>
290
		<module>org.gvsig.geoprocess.algorithm</module>
291
	</modules>
292
</project>
0 293

  
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177/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.177/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.177/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25

  
26
  <dependencySets>
27
    <dependencySet>
28
      <useProjectArtifact>false</useProjectArtifact>
29
	  <useTransitiveDependencies>true</useTransitiveDependencies>
30
      <outputDirectory>lib</outputDirectory>
31
      <includes> 
32
				<include>org.gvsig:org.gvsig.geoprocess.app.mainplugin</include>
33
				<include>org.gvsig:org.gvsig.geoprocess.lib.api</include>
34
				<include>org.gvsig:org.gvsig.geoprocess.lib.sextante</include>
35
				<include>org.gvsig:org.gvsig.toolbox.core</include>
36
				<include>org.gvsig:org.gvsig.toolbox.gui</include>
37
				<include>org.gvsig:org.gvsig.toolbox.math</include>
38
				<include>gnu.trove:trove</include>
39
				<include>gov.nist.math:jama</include>
40
				<include>org.nfunk:jep</include>
41
				<include>bsh:bsh:jar</include>
42
				<include>jfree:jcommon</include>
43
				<include>jfree:jfreechart</include>
44
				<include>net.sf:jgraph</include>
45
				<include>tablelayout:TableLayout</include>
46
				<include>org.japura:org.japura</include>
47
	  </includes>
48
	</dependencySet>
49
  </dependencySets>
50
</assembly>
0 51

  
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/extension/GeoprocessPointSelectionListener.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.extension;
25

  
26
import java.awt.geom.Point2D;
27

  
28
import javax.swing.JOptionPane;
29

  
30
import es.unex.sextante.gui.core.NamedPoint;
31
import es.unex.sextante.gui.core.SextanteGUI;
32

  
33
import org.gvsig.fmap.mapcontrol.MapControl;
34
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
35
import org.gvsig.fmap.mapcontrol.tools.PointSelectionListener;
36
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent;
37
import org.gvsig.i18n.Messages;
38

  
39
/**
40
 * Tool to collect points over the gvSIG view document window, to be used
41
 * in the geoprocess parameters extension definition.
42
 * 
43
 * @author gvSIG Team
44
 * @version $Id$
45
 */
46
public class GeoprocessPointSelectionListener extends PointSelectionListener {
47

  
48
    /**
49
     * Listener constructor with a given {@link MapControl}.
50
     * 
51
     * @param mapControl
52
     *            to use to get the points from
53
     */
54
    public GeoprocessPointSelectionListener(MapControl mapControl) {
55
        super(mapControl);
56
    }
57

  
58
    public void point(final PointEvent event) throws BehaviorException {
59
        Point2D point = event.getPoint();
60
        Point2D mapPoint = mapCtrl.getViewPort().toMapPoint(point);
61

  
62
        // TODO: create an andami dialog window.
63
        String pointName =
64
            JOptionPane.showInputDialog(
65
                null,
66
                "X: " + Double.toString(mapPoint.getX()) + "\n" + "Y: "
67
                    + Double.toString(mapPoint.getY()) + "\n"
68
                    + Messages.getText("Point_name") + ":",
69
                Messages.getText("New_point"));
70

  
71
        if (pointName != null) {
72
            NamedPoint namedPoint = new NamedPoint(pointName, mapPoint);
73
            SextanteGUI.getGUIFactory().getCoordinatesList().add(namedPoint);
74
        }
75
    }
76
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/extension/AddDependencyExtension.java
1
/**
2
 *
3
 */
4
package org.gvsig.geoprocess.extension;
5

  
6
import org.gvsig.andami.PluginServices;
7
import org.gvsig.andami.PluginsLocator;
8
import org.gvsig.andami.PluginsManager;
9
import org.gvsig.andami.plugins.Extension;
10

  
11
/**
12
 * @author fdiaz
13
 *
14
 */
15
public class AddDependencyExtension extends Extension {
16

  
17
	/* (non-Javadoc)
18
	 * @see org.gvsig.andami.plugins.IExtension#initialize()
19
	 */
20
	@Override
21
	public void initialize() {
22

  
23
    	PluginsManager pluginsManager = PluginsLocator.getManager();
24
		PluginServices geoprocessMainPlugin = pluginsManager.getPlugin(GeoprocessExtension.class);
25
		if (geoprocessMainPlugin!=null){
26
			geoprocessMainPlugin.addDependencyWithPlugin(this.getPlugin());
27
		}
28
	}
29

  
30
	/* (non-Javadoc)
31
	 * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
32
	 */
33
	@Override
34
	public void execute(String actionCommand) {
35
		// TODO Auto-generated method stub
36

  
37
	}
38

  
39
	/* (non-Javadoc)
40
	 * @see org.gvsig.andami.plugins.IExtension#isEnabled()
41
	 */
42
	@Override
43
	public boolean isEnabled() {
44
		// TODO Auto-generated method stub
45
		return false;
46
	}
47

  
48
	/* (non-Javadoc)
49
	 * @see org.gvsig.andami.plugins.IExtension#isVisible()
50
	 */
51
	@Override
52
	public boolean isVisible() {
53
		// TODO Auto-generated method stub
54
		return false;
55
	}
56

  
57
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/extension/GeoprocessExtension.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.extension;
25

  
26
import java.awt.Frame;
27
import java.io.File;
28
import java.io.IOException;
29
import java.util.HashMap;
30

  
31
import es.unex.sextante.gui.additionalResults.AdditionalResults;
32
import es.unex.sextante.gui.core.IGUIFactory;
33
import es.unex.sextante.gui.core.SextanteGUI;
34
import es.unex.sextante.gui.history.History;
35

  
36
import org.apache.commons.io.FileUtils;
37
import org.gvsig.andami.PluginServices;
38
import org.gvsig.andami.PluginsLocator;
39
import org.gvsig.andami.PluginsManager;
40
import org.gvsig.andami.plugins.Extension;
41
import org.gvsig.andami.ui.mdiManager.IWindow;
42
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
43
import org.gvsig.geoprocess.lib.api.GeoProcessLocator;
44
import org.gvsig.geoprocess.lib.sextante.SextanteGeoProcessManager;
45
import org.gvsig.geoprocess.lib.sextante.core.DefaultInputFactory;
46
import org.gvsig.geoprocess.lib.sextante.core.DefaultOutputFactory;
47
import org.gvsig.geoprocess.lib.sextante.core.DefaultPostProcessTaskFactory;
48
import org.gvsig.geoprocess.sextante.gui.core.GUIFactory;
49
import org.slf4j.Logger;
50
import org.slf4j.LoggerFactory;
51

  
52
/**
53
 * Extension to show Geoprocess GUI utilities.
54
 *
55
 * @author gvSIG Team
56
 * @version $Id$
57
 */
58
public class GeoprocessExtension extends Extension {
59
	private static final Logger logger = LoggerFactory.getLogger(GeoprocessExtension.class);
60

  
61
    private static final String GEOPROCESS_SELECTOR = "GEOPROCESS_SELECTOR";
62

  
63
    private static final String GEOPROCESS_MODELER = "GEOPROCESS_MODELER";
64

  
65
    private static final String GEOPROCESS_HISTORY = "GEOPROCESS_HISTORY";
66

  
67
    private static final String GEOPROCESS_COMMAND_LINE =
68
        "GEOPROCESS_COMMAND_LINE";
69

  
70
    private static final String GEOPROCESS_RESULTS = "GEOPROCESS_RESULTS";
71

  
72
    private static final String GEOPROCESS_DATAEXPLORER =
73
        "GEOPROCESS_DATAEXPLORER";
74

  
75
    private static final String GEOPROCESS_HELP = "GEOPROCESS_HELP";
76

  
77
    public void initialize() {
78
		PluginsManager pluginsManager = PluginsLocator.getManager();
79
		PluginServices plugin = pluginsManager.getPlugin(this);
80

  
81
		SextanteGUI.setSextanteInstallPath(plugin.getPluginDirectory().getAbsolutePath());
82
		SextanteGUI.setSextanteHomePath(plugin.getPluginHomeFolder().getAbsolutePath());
83
    }
84

  
85
    public void execute(String actionCommand) {
86

  
87
        IGUIFactory guiFactory = SextanteGUI.getGUIFactory();
88

  
89
        if (GEOPROCESS_SELECTOR.equals(actionCommand)) {
90
            guiFactory.showToolBoxDialog();
91
            return;
92
        }
93

  
94
        if (GEOPROCESS_MODELER.equals(actionCommand)) {
95
            guiFactory.showModelerDialog();
96
            return;
97
        }
98

  
99
        if (GEOPROCESS_HISTORY.equals(actionCommand)) {
100
            guiFactory.showHistoryDialog();
101
            return;
102
        }
103

  
104
        if (GEOPROCESS_COMMAND_LINE.equals(actionCommand)) {
105
            guiFactory.showCommandLineDialog();
106
            return;
107
        }
108

  
109
        if (GEOPROCESS_RESULTS.equals(actionCommand)) {
110
            guiFactory.showAdditionalResultsDialog(AdditionalResults
111
                .getComponents());
112
            return;
113
        }
114

  
115
        if (GEOPROCESS_DATAEXPLORER.equals(actionCommand)) {
116
            guiFactory.showDataExplorer();
117
            return;
118
        }
119

  
120
        if (GEOPROCESS_HELP.equals(actionCommand)) {
121
            guiFactory.showHelpWindow();
122
            return;
123
        }
124
    }
125

  
126
    public boolean isEnabled() {
127
        return true;
128
    }
129

  
130
    public boolean isVisible() {
131
    	IWindow w = PluginServices.getMDIManager().getActiveWindow();
132
    	if(w instanceof AbstractViewPanel)
133
    		return true;
134
    	return false;
135
    }
136

  
137
	public void postInitialize(){
138
		PluginsManager pluginsManager = PluginsLocator.getManager();
139
		installHomeFolder("models");
140
		installHomeFolder("scripts");
141

  
142
		pluginsManager.addStartupTask("InitializeSextanteGUI", new InitializeSextanteGUI(), true, 400);
143
        SextanteGUI.addAlgorithmProvider(
144
        		(SextanteGeoProcessManager) GeoProcessLocator.getGeoProcessManager());
145

  
146
        HashMap<String, String> map = new HashMap<String, String>();
147
        map.put("isFirstTimeUsingSextante", Boolean.FALSE.toString());
148

  
149
        SextanteGUI.setCustomDefaultSettings(map);
150
	}
151

  
152
	private void installHomeFolder(String string) {
153
		PluginsManager pluginsManager = PluginsLocator.getManager();
154
		PluginServices plugin = pluginsManager.getPlugin(this);
155

  
156
		plugin.getPluginDirectory();
157
		File srcDir = new File(plugin.getPluginDirectory(),string);
158
		File destDir = new File(plugin.getPluginHomeFolder(),string);
159
		if (destDir.exists()){
160
			return;
161
		}
162
		try {
163
			FileUtils.copyDirectory(srcDir, destDir);
164
		} catch (IOException e) {
165
			logger.warn("Can't install folder '"+srcDir.getAbsolutePath()+"' in '"+destDir.getAbsolutePath()+"'", e);
166
		}
167
	}
168

  
169
	class InitializeSextanteGUI implements Runnable {
170

  
171
		@Override
172
		public void run() {
173
		        SextanteGUI.initialize();
174
		        // Sextante API uses collection implementations :(
175
		        SextanteGUI.setMainFrame(((Frame) PluginServices.getMainFrame()));
176
		        SextanteGUI.setOutputFactory(new DefaultOutputFactory());
177
		        SextanteGUI.setInputFactory(new DefaultInputFactory());
178
		        SextanteGUI.setPostProcessTaskFactory(new DefaultPostProcessTaskFactory());
179
		        SextanteGUI.setGUIFactory(new GUIFactory());
180
		        History.startSession();
181

  
182

  
183
		}
184

  
185
	}
186
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/extension/GeoprocessPointSelectionExtension.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.extension;
25

  
26
import org.gvsig.andami.plugins.Extension;
27
import org.gvsig.app.ApplicationLocator;
28
import org.gvsig.app.ApplicationManager;
29
import org.gvsig.app.project.documents.view.gui.IView;
30
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener;
31
import org.gvsig.fmap.mapcontrol.MapControl;
32
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
33
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior;
34
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior;
35

  
36
/**
37
 * Collector of points over the gvSIG view document window, to be used
38
 * in the geoprocess parameters extension definition.
39
 * 
40
 * @author gvSIG Team
41
 * @version $Id$
42
 */
43
public class GeoprocessPointSelectionExtension extends Extension {
44

  
45
    private final static String TOOL_NAME = "GeoprocessingPointSelector";
46
    private ApplicationManager manager;
47

  
48
    public void initialize() {
49
        manager = ApplicationLocator.getManager();
50
    }
51

  
52
    public void execute(final String s) {
53
        MapControl mapControl =
54
            ((IView) manager.getActiveWindow()).getMapControl();
55
        GeoprocessPointSelectionListener pointSelectorListener =
56
            new GeoprocessPointSelectionListener(mapControl);
57
        StatusBarListener listener = new StatusBarListener(mapControl);
58
        mapControl.addBehavior(TOOL_NAME, new Behavior[] {
59
            new PointBehavior(pointSelectorListener),
60
            new MouseMovementBehavior(listener) });
61
        mapControl.setTool(TOOL_NAME);
62
    }
63

  
64
    public boolean isEnabled() {
65
        return manager.getActiveWindow() instanceof IView;
66
    }
67

  
68
    public boolean isVisible() {
69
        return manager.getActiveWindow() instanceof IView;
70
    }
71
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177/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.177/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.177/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.177/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.177/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.177/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.177/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
 *
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;
25

  
26
import java.awt.BorderLayout;
27

  
28
import javax.swing.JComponent;
29
import javax.swing.JPanel;
30

  
31
import es.unex.sextante.core.IInputFactory;
32
import es.unex.sextante.gui.core.SextanteGUI;
33
import es.unex.sextante.gui.toolbox.ToolboxPanel;
34

  
35
import org.gvsig.andami.ui.mdiManager.IWindow;
36
import org.gvsig.andami.ui.mdiManager.IWindowListener;
37
import org.gvsig.andami.ui.mdiManager.WindowInfo;
38

  
39
/**
40
 * Geoprocess modeler window. By default uses a DIALOG type window profile and
41
 * info. Also the window info uses the size from the size of the provided JPanel
42
 * to include.
43
 * 
44
 * @author gvSIG Team
45
 * @version $Id$
46
 */
47
public abstract class GeoprocessWindow extends JPanel implements IWindow,
48
    IWindowListener {
49

  
50
    private static final long serialVersionUID = -677659097155651764L;
51

  
52
    private WindowInfo windowInfo;
53
    private ToolboxPanel toolboxPanel;
54

  
55
    protected JComponent mainComponent;
56

  
57
    /**
58
     * Creates a new {@link GeoprocessWindow}.
59
     * 
60
     * @param toolbox
61
     *            the main geoprocess selector panel
62
     */
63
    public GeoprocessWindow(ToolboxPanel toolbox) {
64
        toolboxPanel = toolbox;
65
        initializeDataObjects();
66

  
67
        initializeUI();
68

  
69
        windowInfo = createWindowInfo();
70
    }
71

  
72
    /**
73
     * Initializes the sextante data objects.
74
     */
75
    protected void initializeDataObjects() {
76
        IInputFactory inputFactory = SextanteGUI.getInputFactory();
77
        if (inputFactory.getDataObjects() == null) {
78
            inputFactory.createDataObjects();
79
        }
80
    }
81

  
82
    /**
83
     * Initializes de window user interface.
84
     */
85
    protected void initializeUI() {
86
        mainComponent = getMainComponent();
87
        this.setLayout(new BorderLayout(0, 0));
88
        this.add(mainComponent);
89
    }
90

  
91
    /**
92
     * Initializes the window info object.
93
     */
94
    protected WindowInfo createWindowInfo() {
95
        WindowInfo windowInfo =
96
            new WindowInfo(WindowInfo.ICONIFIABLE | WindowInfo.RESIZABLE
97
                | WindowInfo.MAXIMIZABLE);
98
        // new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
99
        windowInfo.setTitle(getTitle());
100
        windowInfo.setWidth(mainComponent.getWidth());
101
        windowInfo.setHeight(mainComponent.getHeight());
102

  
103
        return windowInfo;
104
    }
105

  
106
    public Object getWindowProfile() {
107
        return WindowInfo.EDITOR_PROFILE;
108
        // return WindowInfo.DIALOG_PROFILE;
109
    }
110

  
111
    public WindowInfo getWindowInfo() {
112
        return windowInfo;
113
    }
114

  
115
    public void windowActivated() {
116
        // Nothing to do
117
    }
118

  
119
    public void windowClosed() {
120
        if (toolboxPanel == null) {
121
            SextanteGUI.getInputFactory().clearDataObjects();
122
        }
123
    }
124

  
125
    /**
126
     * Return the title of the window.
127
     * 
128
     * @return the title of the window
129
     */
130
    protected abstract String getTitle();
131

  
132
    /**
133
     * Return the panel to show in the window.
134
     * 
135
     * @return the panel to show in the window
136
     */
137
    protected abstract JComponent getMainComponent();
138
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin/src/main/java/org/gvsig/geoprocess/sextante/gui/history/HistoryWindow.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.history;
25

  
26
import info.clearthought.layout.TableLayout;
27
import info.clearthought.layout.TableLayoutConstants;
28

  
29
import java.awt.event.ActionEvent;
30
import java.awt.event.ActionListener;
31

  
32
import javax.swing.JButton;
33
import javax.swing.JComponent;
34
import javax.swing.JPanel;
35

  
36
import es.unex.sextante.core.Sextante;
37
import es.unex.sextante.gui.history.HistoryPanel;
38
import es.unex.sextante.gui.toolbox.ToolboxPanel;
39

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

  
42
/**
43
 * Geoprocess history window.
44
 * 
45
 * @author gvSIG Team
46
 * @version $Id$
47
 */
48
public class HistoryWindow extends GeoprocessWindow {
49

  
50
    private static final long serialVersionUID = -677659097155651764L;
51

  
52
    private HistoryPanel historyPanel;
53

  
54
    /**
55
     * Creates a new {@link HistoryWindow}.
56
     * 
57
     * @param toolbox
58
     *            the main geoprocess selector panel
59
     */
60
    public HistoryWindow(ToolboxPanel toolbox) {
61
        super(toolbox);
62
    }
63

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

  
69
    @Override
70
    protected JComponent getMainComponent() {
71
        JPanel panel = new JPanel();
72
        historyPanel = new HistoryPanel();
73

  
74
        panel.setPreferredSize(new java.awt.Dimension(650, 380));
75
        panel.setSize(new java.awt.Dimension(650, 380));
76
        TableLayout tableLayout =
77
            new TableLayout(
78
                new double[][] {
79
                    { 7.0, TableLayoutConstants.FILL,
80
                        TableLayoutConstants.FILL, TableLayoutConstants.FILL,
81
                        TableLayoutConstants.FILL, 7.0 },
82
                    { TableLayoutConstants.FILL, 3.0, 30.0, 3.0 } });
83
        tableLayout.setHGap(5);
84
        tableLayout.setVGap(5);
85
        panel.setLayout(tableLayout);
86

  
87
        panel.add(historyPanel, "1, 0, 4, 0");
88

  
89
        JButton clearHistoryButton = new JButton();
90
        panel.add(clearHistoryButton, "1, 2, 2, 2");
91
        clearHistoryButton.setText(Sextante.getText("Clear_history"));
92
        clearHistoryButton.addActionListener(new ActionListener() {
93

  
94
            public void actionPerformed(final ActionEvent evt) {
95
                historyPanel.clearHistory();
96
            }
97
        });
98

  
99
        JButton clearLogButton = new JButton();
100
        panel.add(clearLogButton, "3, 2, 4, 2");
101
        clearLogButton.setText(Sextante.getText("Clear_log"));
102
        clearLogButton.addActionListener(new ActionListener() {
103

  
104
            public void actionPerformed(final ActionEvent evt) {
105
                historyPanel.clearLog();
106
            }
107
        });
108

  
109
        return panel;
110
    }
111

  
112
}
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.177/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.177/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

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff