Revision 39681

View differences:

tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/prepare-workspace.xml
1
<project name="org.gvsig.initial.build" default="prepare-workspace">
2

  
3
	<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" />
4

  
5
	<property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." />
6
	<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" />
7
	<property name="build.jar.version" value="1.0.8-SNAPSHOT" />
8
	<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
9

  
10
	<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" />
11

  
12
	<target name="check-maven-base-build-available">
13
		<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" />
14
	</target>
15

  
16
	<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available">
17
		<!-- Unzip de build jar file from the maven repository into the workspace root folder -->
18
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
19
			<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}">
20
				<patternset>
21
					<exclude name="META-INF/**" />
22
				</patternset>
23
			</zipfileset>
24
		</copy>
25
	</target>
26

  
27
	<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available">
28
		<mkdir dir="target" />
29

  
30
		<!-- Download the build jar file -->
31
		<get src="http://devel.gvsig.org/m2repo/j2se/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" />
32

  
33
		<!-- Unzip de build jar file into the workspace root folder -->
34
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
35
			<zipfileset src="target/${build.jar.file}">
36
				<patternset>
37
					<exclude name="META-INF/**" />
38
				</patternset>
39
			</zipfileset>
40
		</copy>
41

  
42
	</target>
43
	
44
	<target name="find.depends.natives.file">
45
	    <condition property="depends.natives.file.exists">
46
            <available file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES"/>
47
	    </condition>	
48
	</target>
49
	
50
	<target name="find.gvsig.platform.properties.file" 
51
			depends="find.depends.natives.file"
52
			if="depends.natives.file.exists">
53
	    <condition property="gvsig.platform.exists">
54
            <available file="${user.home}/.gvsig.platform.properties"/>
55
	    </condition>	
56
	</target>
57
	
58
	<target name="check.gvsig.platform.properties" 
59
			depends="find.gvsig.platform.properties.file">
60
		<fail if="depends.natives.file.exists" unless="gvsig.platform.exists">
61
ERROR!!
62
	
63
You have to define your gvSIG platform properties, 
64
by creating the file: ${user.home}/.gvsig.platform.properties
65
with the following content:
66

  
67
native_platform=linux
68
native_distribution=all
69
native_compiler=gcc4
70
native_arch=i386
71
native_libraryType=dynamic
72
export native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType}
73

  
74
Replace the fifth initial variables values with the ones appropiate 
75
to your platform.
76
	
77
If you use maven in the command line, you can use the previous file also
78
to define the MAVEN_OPTS environment variable, by adding to your 
79
.bash_rc file something like this:
80

  
81
if [ -f "${HOME}/.gvsig.platform.properties" ]
82
then
83
    . ${HOME}/.gvsig.platform.properties
84
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m -Dnative-classifier=${native_classifier}"
85
else
86
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m"
87
fi
88

  
89
It will work if you use the bash shell. In any other case or platform, you'll
90
have to define your MAVEN_OPTS environment variable and set the 
91
"native-classifier" parameter directly.
92
		</fail>			
93
	
94
	</target>
95

  
96
	<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties">
97

  
98
		<mkdir dir="target" />
99

  
100
		<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" />
101

  
102
		<!-- Copy the maven launchers to the workspace metadata folder -->
103
		<copy todir="${workspace.basedir}/.metadata">
104
			<fileset dir="${build.basedir}/eclipse-launchers">
105
				<exclude name="**/org.eclipse.jdt.core.prefs" />
106
				<exclude name="**/org.eclipse.core.variables.prefs" />
107
			</fileset>
108
		</copy>
109

  
110
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true">
111
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" />
112
		</concat>
113
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true">
114
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" />
115
		</concat>
116

  
117
		<!-- Configure the eclipse workspace -->
118
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" />
119

  
120
		<!-- Configure the gvSIG profile -->
121
		<ant antfile="${build.basedir}/check-gvsig-profile.xml" />
122

  
123
		<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" />
124

  
125
		<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
126
			<classpath>
127
				<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" />
128
			</classpath>
129
		</taskdef>
130

  
131
		<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}">
132
			<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" />
133
		</xmltask>
134

  
135
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
136
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
137

  
138
		<!-- Compile, install and generate eclipse projects -->
139
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" />
140

  
141
		<echo>INFORMATION!!!</echo>
142
		<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo>
143

  
144
		<!-- TODO: copiar al proyecto de configuraciĆ³n general -->
145
	</target>
146

  
147
	<target name="clean">
148
		<delete dir="target" />
149
	</target>
150
	
151
</project>
0 152

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
	<modelVersion>4.0.0</modelVersion>
6
	<artifactId>org.gvsig.selectiontools.app</artifactId>
7
	<packaging>pom</packaging>
8
	<version>1.0.0-SNAPSHOT</version>
9
	<name>org.gvsig.selectiontools.app</name>
10
	<description>Advanced selection tools:
11
- select all
12
- by buffer
13
- by cicle
14
- by polilyne
15
</description>
16
    <parent>
17
        <groupId>org.gvsig</groupId>
18
        <artifactId>org.gvsig.maven.base.extension.pom</artifactId>
19
        <version>1.0.8-SNAPSHOT</version>
20
    </parent>
21
    <scm>
22
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.selectiontools.app</connection>
23
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.selectiontools.app</developerConnection>
24
        <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/extensions/org.gvsig.selectiontools.app</url>
25
    </scm>
26
	<repositories>
27
		<repository>
28
			<id>gvsig-public-http-repository</id>
29
			<name>gvSIG maven public HTTP repository</name>
30
            <url>http://devel.gvsig.org/m2repo/j2se</url>
31
			<releases>
32
				<enabled>true</enabled>
33
				<updatePolicy>daily</updatePolicy>
34
				<checksumPolicy>warn</checksumPolicy>
35
			</releases>
36
			<snapshots>
37
				<enabled>true</enabled>
38
				<updatePolicy>daily</updatePolicy>
39
				<checksumPolicy>warn</checksumPolicy>
40
			</snapshots>
41
		</repository>
42
	</repositories>
43
    <dependencyManagement>
44
        <dependencies>          
45
            <dependency>
46
                <groupId>org.gvsig</groupId>
47
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
48
                <version>2.0.1-SNAPSHOT</version>
49
                <type>pom</type>
50
                <scope>import</scope>
51
            </dependency>
52
        </dependencies>
53
    </dependencyManagement>
54
	<modules>
55
		<module>org.gvsig.selectiontools.app.extension</module>
56
	</modules>
57
	<properties>
58
		<package.info.state>testing</package.info.state>
59
		<!-- alpha-devel -->
60
	</properties>
61

  
62
</project>
0 63

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/README.txt
1
The first time you checkout the current project to a new workspace, 
2
you have to prepare it to be able to work easily with maven from
3
eclipse itself.
4

  
5
Perform the following steps:
6

  
7
1.- Launch the *prepare-workspace.xml* ant build file. 
8
    You can do it by loading the file into the ant view, 
9
    and running the default task, or right-clicking the 
10
    file from the package explorer or the navigator and
11
    select the option: *Run as > Ant build*. 
12
    
13
2.- Restart eclipse.
14

  
15
3.- Import the subprojects of the project you have just checked out.
16

  
17
Those steps are only needed once per workspace.     
18

  
0 19

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/distribution/distribution.xml
1
<assembly>
2
</assembly>
0 3

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Fri Jan 25 13:07:04 CET 2013
3
buildNumber=2082
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5
	<modelVersion>4.0.0</modelVersion>
6
	<artifactId>org.gvsig.selectiontools.app.extension</artifactId>
7
	<packaging>jar</packaging>
8
	<name>Tools: Selection tools</name>
9
	<parent>
10
		<groupId>org.gvsig</groupId>
11
		<artifactId>org.gvsig.selectiontools.app</artifactId>
12
		<version>1.0.0-SNAPSHOT</version>
13
	</parent>
14

  
15
	<dependencies>
16
		<dependency>
17
			<groupId>org.gvsig</groupId>
18
			<artifactId>org.gvsig.andami</artifactId>
19
            <scope>compile</scope>
20
		</dependency>
21
		<dependency>
22
			<groupId>org.gvsig</groupId>
23
			<artifactId>org.gvsig.i18n</artifactId>
24
            <scope>compile</scope>
25
		</dependency>
26
		<dependency>
27
			<groupId>org.gvsig</groupId>
28
			<artifactId>org.gvsig.tools.lib</artifactId>
29
            <scope>compile</scope>
30
		</dependency>
31
		<dependency>
32
			<groupId>org.gvsig</groupId>
33
			<artifactId>org.gvsig.tools.swing.api</artifactId>
34
            <scope>compile</scope>
35
		</dependency>
36
        <dependency>
37
			<groupId>org.gvsig</groupId>
38
			<artifactId>org.gvsig.app</artifactId>
39
			<version>2.0-SNAPSHOT</version>
40
            <scope>compile</scope>
41
		</dependency>
42
        <dependency>
43
            <groupId>org.gvsig</groupId>
44
            <artifactId>org.gvsig.about.api</artifactId>
45
            <scope>compile</scope>
46
        </dependency>
47
        <dependency>
48
            <groupId>org.gvsig</groupId>
49
            <artifactId>org.gvsig.fmap.dal</artifactId>
50
            <scope>compile</scope>
51
        </dependency>
52
        <dependency>
53
            <groupId>org.gvsig</groupId>
54
            <artifactId>org.gvsig.fmap.geometry</artifactId>
55
            <scope>compile</scope>
56
        </dependency>
57
        <dependency>
58
            <groupId>org.gvsig</groupId>
59
            <artifactId>org.gvsig.ui</artifactId>
60
            <scope>compile</scope>
61
        </dependency>
62
        <dependency>
63
            <groupId>org.gvsig</groupId>
64
            <artifactId>org.gvsig.fmap.mapcontext</artifactId>
65
            <scope>compile</scope>
66
        </dependency>
67
        <dependency>
68
            <groupId>org.gvsig</groupId>
69
            <artifactId>org.gvsig.fmap.control</artifactId>
70
            <scope>compile</scope>
71
        </dependency>
72
        <dependency>
73
            <groupId>org.gvsig</groupId>
74
            <artifactId>org.gvsig.utils</artifactId>
75
            <scope>compile</scope>
76
        </dependency>
77
        <dependency>
78
            <groupId>org.gvsig</groupId>
79
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
80
            <scope>compile</scope>
81
        </dependency>
82
        <dependency>
83
            <groupId>org.gvsig</groupId>
84
            <artifactId>org.gvsig.projection</artifactId>
85
            <scope>compile</scope>
86
        </dependency>
87
        <dependency>
88
            <groupId>org.slf4j</groupId>
89
            <artifactId>slf4j-api</artifactId>
90
            <scope>compile</scope>
91
        </dependency>
92
        <dependency>
93
            <groupId>com.vividsolutions</groupId>
94
            <artifactId>jts</artifactId>
95
            <scope>compile</scope>
96
        </dependency>
97
	</dependencies>
98
	<description>Advanced selection tools: 
99
- select all 
100
- by buffer 
101
- by cicle 
102
- by polilyne
103
</description>
104
	<profiles>
105
		<profile>
106
			<id>gvsig-install</id>
107
			<activation>
108
				<activeByDefault>true</activeByDefault>
109
			</activation>
110
			<properties>
111
				<!--
112
					Default gvSIG installation folder relative to the current workspace
113
				-->
114
				<gvsig.install.dir>${basedir}/../../build/product</gvsig.install.dir>
115
			</properties>
116
		</profile>
117
	</profiles>
118
	<properties>
119
        <package.info.categories>View,Vector</package.info.categories>
120
	</properties>
121
</project>
0 122

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/distribution/distribution.xml
1
<assembly>
2
	<id>distribution</id>
3
	<formats>
4
		<format>dir</format>
5
	</formats>
6
	<fileSets>
7
		<!-- Estructure for the extension -->
8
		<fileSet>
9
			<directory>src/main/resources</directory>
10
			<outputDirectory>${extension.install.dir.name}
11
			</outputDirectory>
12
		</fileSet>
13
	</fileSets>
14
	<files>
15
        <file>
16
            <source>package.info</source>
17
            <outputDirectory>${extension.install.dir.name}
18
            </outputDirectory>
19
        </file>
20
    </files>
21
    <dependencySets>
22
		<dependencySet>
23
			<outputDirectory>${extension.install.dir.name}/${library-dir}
24
			</outputDirectory>
25
			<includes>
26
				<include>org.gvsig:org.gvsig.selectiontools.app.extension</include>
27
			</includes>
28
		</dependencySet>
29
	</dependencySets>
30
</assembly>
0 31

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Fri Jan 25 13:07:04 CET 2013
3
buildNumber=2074
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/src/test/resources/README.txt
1
Put into this folder the resources needed by your test classes.
2

  
3
This folder is added to the Tests classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your tests classes.
0 9

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.selectiontools">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/src/main/resources/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app" />
4
	<resourceBundle name="text"/>
5
	<libraries library-dir="lib"/>
6
	<extensions>
7

  
8
<!--  		<extension class-name="org.gvsig.selectiontools.app.extension.AboutSelectionToolsExtension" -->
9
<!--             description="Extension Selection Tools of the Consejer?a de Medio Ambiente of the Junta de Castilla y Le?n Project." -->
10
<!-- 			active="true" -->
11
<!-- 			priority="1"> -->
12
<!-- 		</extension> -->
13
		
14
		<extension class-name="org.gvsig.selectiontools.app.extension.SelectAllExtension"
15
			description="Extension that allows select all geometries of the selected vectorial layers."
16
			active="true"
17
			priority="30">
18
			<menu text="Selection/SelectAll"
19
				action-command="SELALL"
20
				tooltip="SelectAll"
21
				icon="selection-select-all"
22
				position="300400000"/>
23
			<tool-bar name="Tools_Select" position="6">
24
				<selectable-tool icon="selection-select-all" action-command="SELALL" tooltip="SelectAll" position="7"/>
25
			</tool-bar>
26
		</extension>		
27
		 <extension class-name="org.gvsig.selectiontools.app.extension.SelectByCircleExtension"
28
			description="Extension that allows select all geometries of the selected vectorial layers that are contained or intersect with a circle defined by the user."
29
			active="true"
30
			priority="30">
31
			<menu text="Selection/Select_by_circle"
32
				action-command="SELCIRCLE"
33
				tooltip="Select_by_circle"
34
				icon="selection-select-by-circle"
35
				position="301000000"/>
36
			<tool-bar name="Tools_Select" position="6">
37
				<selectable-tool icon="selection-select-by-circle" action-command="SELCIRCLE" tooltip="Select_by_circle" position="6"/>
38
			</tool-bar>
39
		</extension>		
40
		<extension class-name="org.gvsig.selectiontools.app.extension.SelectByPolylineExtension"
41
			description="Extension that allows select all geometries of the selected vectorial layers that intersect with a polyline defined by the user."
42
			active="false"
43
			priority="30">
44
			<menu text="Selection/Select_by_polyline"
45
				action-command="SELPOLYLINE"
46
				tooltip="Select_by_polyline"
47
				icon="selection-select-by-polyline"
48
				position="301300000"/>
49
			<tool-bar name="Tools_Select" position="6">
50
				<selectable-tool icon="selection-select-by-polyline" action-command="SELPOLYLINE" tooltip="Select_by_polyline" position="5"/>
51
			</tool-bar>
52
		</extension>		
53

  
54
 		<extension class-name="org.gvsig.selectiontools.app.extension.SelectByBufferExtension"
55
			description="Extension that allows select all geometries of the selected vectorial layers that intersect with a buffer around their previously selected geometries."
56
			active="true"
57
			priority="30">
58
			<menu text="Selection/Select_by_buffer"
59
				action-command="SELBUFFER"
60
				tooltip="Select_by_buffer"
61
				icon="selection-select-by-buffer"
62
				position="300900000"/>
63
			<tool-bar name="Tools_Select" position="6">
64
				<action-tool icon="selection-select-by-buffer" action-command="SELBUFFER" tooltip="Select_by_buffer" position="7"/>
65
			</tool-bar>
66
		</extension>
67
				
68
	</extensions>
69
</plugin-config>
0 70

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/src/main/java/org/gvsig/selectiontools/app/extension/SelectAllExtension.java
1
package org.gvsig.selectiontools.app.extension;
2

  
3
/* gvSIG. Geographic Information System of the Valencian Government
4
 *
5
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
6
 * of the Valencian Government (CIT)
7
 * 
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 * 
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *  
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
21
 * MA  02110-1301, USA.
22
 * 
23
 */
24

  
25
import org.gvsig.andami.IconThemeHelper;
26
import org.gvsig.andami.PluginServices;
27
import org.gvsig.andami.messages.NotificationManager;
28
import org.gvsig.andami.plugins.Extension;
29
import org.gvsig.andami.ui.mdiManager.IWindow;
30
import org.gvsig.app.project.documents.view.ViewDocument;
31
import org.gvsig.app.project.documents.view.gui.IView;
32
import org.gvsig.fmap.dal.exception.DataException;
33
import org.gvsig.fmap.dal.feature.FeatureStore;
34
import org.gvsig.fmap.mapcontext.MapContext;
35
import org.gvsig.fmap.mapcontext.layers.FLayer;
36
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
37
import org.gvsig.fmap.mapcontrol.MapControl;
38

  
39
/**
40
 * <p>
41
 * Extension to add support for selecting all the features of a vector layer.
42
 * </p>
43
 * 
44
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
45
 */
46
public class SelectAllExtension extends Extension {
47

  
48
    /*
49
     * @see com.iver.andami.plugins.IExtension#initialize()
50
     */
51
    public void initialize() {
52
    	IconThemeHelper.registerIcon("action", "selection-select-all", this);
53
    }
54

  
55
    /*
56
     * (non-Javadoc)
57
     * 
58
     * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
59
     */
60
    public void execute(String actionCommand) {
61
        if (actionCommand.equals("SELALL")) {
62
            IWindow view = PluginServices.getMDIManager().getActiveWindow();
63
            if (view instanceof IView) {
64
                MapControl mc = ((IView) view).getMapControl();
65
                FLayer[] activeLayers =
66
                    mc.getMapContext().getLayers().getActives();
67

  
68
                FLayer layer;
69

  
70
                for (int i = 0; i < activeLayers.length; i++) {
71
                    layer = activeLayers[i];
72

  
73
                    if ((layer.isAvailable()) && (layer instanceof FLyrVect)) {
74
                        FLyrVect lyrVect = (FLyrVect) layer;
75

  
76
                        try {
77
                            FeatureStore fs = lyrVect.getFeatureStore();
78
                            fs.getFeatureSelection().selectAll();
79
                        } catch (DataException e) {
80
                            NotificationManager.showMessageError("Data exception",
81
                                e);
82
                        }
83
                    }
84
                }
85
            }
86
        }
87
    }
88

  
89
    /*
90
     * @see com.iver.andami.plugins.IExtension#isVisible()
91
     */
92
    public boolean isVisible() {
93
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
94

  
95
        if (f == null) {
96
            return false;
97
        }
98

  
99
        if (f instanceof IView) {
100
            IView vista = (IView) f;
101
            ViewDocument viewDocument = vista.getViewDocument(); // .getModel();
102
            MapContext mapa = viewDocument.getMapContext();
103

  
104
            return mapa.getLayers().getLayersCount() > 0;
105
        }
106

  
107
        return false;
108
    }
109

  
110
    /*
111
     * @see com.iver.andami.plugins.IExtension#isEnabled()
112
     */
113
    public boolean isEnabled() {
114
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
115

  
116
        if (f == null) {
117
            return false;
118
        }
119

  
120
        if (f instanceof IView) {
121
            IView vista = (IView) f;
122
            ViewDocument viewDocument = vista.getViewDocument();
123
            MapContext mapa = viewDocument.getMapContext();
124

  
125
            FLayer layers[] = mapa.getLayers().getActives();
126
            FLayer layer;
127

  
128
            for (int i = 0; i < layers.length; i++) {
129
                layer = layers[i];
130

  
131
                if ((layer instanceof FLyrVect) && (layer.isAvailable())
132
                    && (layer.isActive()))
133
                    return true;
134
            }
135
        }
136

  
137
        return false;
138
    }
139
}
0 140

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/src/main/java/org/gvsig/selectiontools/app/extension/SelectByCircleExtension.java
1
package org.gvsig.selectiontools.app.extension;
2

  
3
import org.gvsig.andami.IconThemeHelper;
4
import org.gvsig.andami.PluginServices;
5
import org.gvsig.andami.plugins.Extension;
6
import org.gvsig.andami.ui.mdiManager.IWindow;
7
import org.gvsig.app.project.documents.view.ViewDocument;
8
import org.gvsig.app.project.documents.view.gui.IView;
9
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener;
10
import org.gvsig.fmap.mapcontext.MapContext;
11
import org.gvsig.fmap.mapcontext.layers.FLayer;
12
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
13
import org.gvsig.fmap.mapcontrol.MapControl;
14
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
15
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior;
16
import org.gvsig.selectiontools.app.extension.tools.CircleSelectListener;
17
import org.gvsig.selectiontools.app.extension.tools.behavior.CircleSelectionBehavior;
18

  
19
/* gvSIG. Geographic Information System of the Valencian Government
20
 *
21
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
22
 * of the Valencian Government (CIT)
23
 * 
24
 * This program is free software; you can redistribute it and/or
25
 * modify it under the terms of the GNU General Public License
26
 * as published by the Free Software Foundation; either version 2
27
 * of the License, or (at your option) any later version.
28
 * 
29
 * This program is distributed in the hope that it will be useful,
30
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
 * GNU General Public License for more details.
33
 *  
34
 * You should have received a copy of the GNU General Public License
35
 * along with this program; if not, write to the Free Software
36
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
37
 * MA  02110-1301, USA.
38
 * 
39
 */
40

  
41
/**
42
 * <p>
43
 * Extension to add support for selecting the geometries of the active vector
44
 * layers that intersect with a circle defined by the user.
45
 * </p>
46
 * 
47
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
48
 */
49
public class SelectByCircleExtension extends Extension {
50

  
51
    public static final String CIRCLE_SELECTION_TOOL_NAME = "circleSelection";
52

  
53
    /*
54
     * @see com.iver.andami.plugins.IExtension#initialize()
55
     */
56
    public void initialize() {
57
    	IconThemeHelper.registerIcon("action", "selection-select-by-circle", this);
58
    	IconThemeHelper.registerIcon("cursor", "cursor-select-by-circle", this);
59
    }
60

  
61
    /*
62
     * (non-Javadoc)
63
     * 
64
     * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
65
     */
66
    public void execute(String actionCommand) {
67
        if (actionCommand.equals("SELCIRCLE")) {
68
            IWindow window = PluginServices.getMDIManager().getActiveWindow();
69
            if (window instanceof IView) {
70
                IView view = (IView) window;
71
                // Selection by circle
72
                MapControl mc = view.getMapControl();
73

  
74
                // If current's view MapControl doesn't have the
75
                // "CircleSelection" tool, adds it
76
                if (!mc.getNamesMapTools()
77
                    .containsKey(CIRCLE_SELECTION_TOOL_NAME)) {
78
                    CircleSelectListener circleSelListener =
79
                        new CircleSelectListener(mc);
80
                    mc.addBehavior(CIRCLE_SELECTION_TOOL_NAME, new Behavior[] {
81
                        new CircleSelectionBehavior(circleSelListener),
82
                        new MouseMovementBehavior(new StatusBarListener(mc)) });
83
                }
84

  
85
                mc.setTool(CIRCLE_SELECTION_TOOL_NAME);
86
            }
87
        }
88
    }
89

  
90
    /*
91
     * @see com.iver.andami.plugins.IExtension#isVisible()
92
     */
93
    public boolean isVisible() {
94
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
95

  
96
        if (f == null) {
97
            return false;
98
        }
99

  
100
        if (f instanceof IView) {
101
            IView vista = (IView) f;
102
            ViewDocument model = vista.getViewDocument();
103
            MapContext mapa = model.getMapContext();
104

  
105
            return mapa.getLayers().getLayersCount() > 0;
106
        }
107

  
108
        return false;
109
    }
110

  
111
    /*
112
     * @see com.iver.andami.plugins.IExtension#isEnabled()
113
     */
114
    public boolean isEnabled() {
115
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
116

  
117
        if (f == null) {
118
            return false;
119
        }
120

  
121
        if (f instanceof IView) {
122
            IView vista = (IView) f;
123
            ViewDocument model = vista.getViewDocument();
124
            MapContext mapa = model.getMapContext();
125

  
126
            FLayer layers[] = mapa.getLayers().getActives();
127
            FLayer layer;
128

  
129
            for (int i = 0; i < layers.length; i++) {
130
                layer = layers[i];
131

  
132
                if ((layer instanceof FLyrVect) && (layer.isAvailable())
133
                    && (layer.isActive()))
134
                    return true;
135
            }
136
        }
137

  
138
        return false;
139
    }
140
}
0 141

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/src/main/java/org/gvsig/selectiontools/app/extension/tools/CircleSelectListener.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22

  
23
package org.gvsig.selectiontools.app.extension.tools;
24

  
25
import org.gvsig.andami.PluginServices;
26
import org.gvsig.fmap.mapcontrol.MapControl;
27
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
28
import org.gvsig.fmap.mapcontrol.tools.Events.MeasureEvent;
29

  
30
/**
31
 * 
32
 * @version 06/04/2009
33
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
34
 */
35
public class CircleSelectListener extends CircleSelectionListener {
36

  
37
    public CircleSelectListener(MapControl mc) {
38
        super(mc);
39
    }
40

  
41
    public void circle(MeasureEvent event) throws BehaviorException {
42
        super.circle(event);
43
        PluginServices.getMainFrame().enableControls();
44
    }
45
}
0 46

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/src/main/java/org/gvsig/selectiontools/app/extension/tools/PolyLineSelectionListener.java
1
package org.gvsig.selectiontools.app.extension.tools;
2

  
3
/* gvSIG. Geographic Information System of the Valencian Government
4
 *
5
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
6
 * of the Valencian Government (CIT)
7
 * 
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 * 
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *  
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
21
 * MA  02110-1301, USA.
22
 * 
23
 */
24

  
25
import java.awt.Cursor;
26
import java.awt.Image;
27
import java.awt.Point;
28
import java.awt.Toolkit;
29

  
30
import javax.swing.ImageIcon;
31

  
32
import org.gvsig.andami.IconThemeHelper;
33
import org.gvsig.andami.PluginServices;
34
import org.gvsig.andami.messages.NotificationManager;
35
import org.gvsig.fmap.dal.feature.FeatureSelection;
36
import org.gvsig.fmap.dal.feature.FeatureSet;
37
import org.gvsig.fmap.geom.Geometry;
38
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
39
import org.gvsig.fmap.geom.Geometry.TYPES;
40
import org.gvsig.fmap.geom.GeometryLocator;
41
import org.gvsig.fmap.geom.GeometryManager;
42
import org.gvsig.fmap.geom.exception.CreateGeometryException;
43
import org.gvsig.fmap.geom.primitive.GeneralPathX;
44
import org.gvsig.fmap.geom.primitive.Surface;
45
import org.gvsig.fmap.mapcontext.layers.FLayer;
46
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
47
import org.gvsig.fmap.mapcontrol.MapControl;
48
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
49
import org.gvsig.fmap.mapcontrol.tools.Events.MeasureEvent;
50
import org.gvsig.fmap.mapcontrol.tools.Listeners.PolylineListener;
51

  
52
/**
53
 * <p>
54
 * Listener that selects all features of the active and vector layers which
55
 * intersect with the defined polyline in the associated {@link MapControl
56
 * MapControl} object.
57
 * </p>
58
 * 
59
 * <p>
60
 * The selection will be produced after user finishes the creation of the
61
 * polyline.
62
 * </p>
63
 * 
64
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
65
 */
66
public class PolyLineSelectionListener implements PolylineListener {
67

  
68
    /**
69
     * The image to display when the cursor is active.
70
     */
71
//    private final Image img = PluginServices.getIconTheme().get("cursor-select-by-polygon").getImage();
72

  
73
    /**
74
     * The cursor used to work with this tool listener.
75
     * 
76
     * @see #getCursor()
77
     */
78
    private Cursor cur = null;
79

  
80
    /**
81
     * Reference to the <code>MapControl</code> object that uses.
82
     */
83
    private MapControl mapCtrl;
84

  
85
    /**
86
     * <p>
87
     * Creates a new <code>PolygonSelectionListener</code> object.
88
     * </p>
89
     * 
90
     * @param mc
91
     *            the <code>MapControl</code> where is drawn the polyline
92
     */
93
    public PolyLineSelectionListener(MapControl mc) {
94
        this.mapCtrl = mc;
95
    }
96

  
97
    /*
98
     * (non-Javadoc)
99
     * 
100
     * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor()
101
     */
102
    public Cursor getCursor() {
103
    	if( cur == null ) {
104
    		cur = Toolkit.getDefaultToolkit().createCustomCursor(this.getImageCursor(),
105
    		        new Point(16, 16),
106
    		        "");
107
    	}
108
        return cur;
109
    }
110

  
111
    /*
112
     * (non-Javadoc)
113
     * 
114
     * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing()
115
     */
116
    public boolean cancelDrawing() {
117
        return false;
118
    }
119

  
120
    /*
121
     * (non-Javadoc)
122
     * 
123
     * @see
124
     * com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#points(com.iver
125
     * .cit.gvsig.fmap.tools.Events.MeasureEvent)
126
     */
127
    public void points(MeasureEvent event) throws BehaviorException {
128
    }
129

  
130
    /*
131
     * (non-Javadoc)
132
     * 
133
     * @see
134
     * com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#pointFixed(com
135
     * .iver.cit.gvsig.fmap.tools.Events.MeasureEvent)
136
     */
137
    public void pointFixed(MeasureEvent event) throws BehaviorException {
138
    }
139

  
140
    /*
141
     * (non-Javadoc)
142
     * 
143
     * @see
144
     * com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#polylineFinished
145
     * (com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent)
146
     */
147
    public void polylineFinished(MeasureEvent event) throws BehaviorException {
148
        try {
149
            GeneralPathX gp = event.getGP();
150
            GeometryManager manager = GeometryLocator.getGeometryManager();
151
            Geometry geom = null;
152
            Surface surface = null;
153
            try {
154
                surface =
155
                    (Surface) manager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);
156
                surface.setGeneralPath(gp);
157
                geom = surface;
158
            } catch (CreateGeometryException e1) {
159
                NotificationManager.showMessageError(PluginServices.getText(null,
160
                    "Failed_creating_geometry"),
161
                    e1);
162
            }
163
            if (geom == null)
164
                return;
165

  
166
            FLayer[] actives = mapCtrl.getMapContext().getLayers().getActives();
167

  
168
            for (int i = 0; i < actives.length; i++) {
169
                if (actives[i] instanceof FLyrVect) {
170
                    FLyrVect lyrVect = (FLyrVect) actives[i];
171
                    FeatureSet newSelection = null;
172

  
173
                    newSelection =
174
                        lyrVect.queryByGeometry(geom, lyrVect.getFeatureStore()
175
                            .getDefaultFeatureType());
176

  
177
                    if (event.getEvent().isControlDown()) {
178
                        ((FeatureSelection) lyrVect.getDataStore()
179
                            .getSelection()).select(newSelection);
180
                    } else {
181
                        lyrVect.getFeatureStore().setSelection(newSelection);
182
                    }
183
                }
184
            }
185
        } catch (com.vividsolutions.jts.geom.TopologyException topEx) {
186
            NotificationManager.showMessageError(PluginServices.getText(null,
187
                "Failed_selecting_geometries_by_polyline_topology_exception_explanation"),
188
                topEx);
189
        } catch (Exception ex) {
190
            NotificationManager.showMessageError(PluginServices.getText(null,
191
                "Failed_selecting_geometries"), ex);
192
        }
193
    }
194

  
195
    public Image getImageCursor() {
196
        return IconThemeHelper.getImage("cursor-select-by-polyline");
197
    }
198
}
0 199

  
tags/v2_0_0_Build_2063/extensions/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.extension/src/main/java/org/gvsig/selectiontools/app/extension/tools/buffer/process/BufferSelectionProcess.java
1
package org.gvsig.selectiontools.app.extension.tools.buffer.process;
2

  
3
/* gvSIG. Geographic Information System of the Valencian Government
4
 *
5
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
6
 * of the Valencian Government (CIT)
7
 * 
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 * 
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *  
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
21
 * MA  02110-1301, USA.
22
 * 
23
 */
24

  
25
import java.awt.event.MouseAdapter;
26
import java.awt.event.MouseEvent;
27
import java.util.ArrayList;
28
import java.util.Iterator;
29

  
30
import javax.swing.JButton;
31

  
32
import org.cresques.cts.IProjection;
33
import org.gvsig.andami.PluginServices;
34
import org.gvsig.andami.messages.NotificationManager;
35
import org.gvsig.andami.ui.mdiManager.IWindow;
36
import org.gvsig.app.project.documents.view.gui.IView;
37
import org.gvsig.fmap.dal.feature.Feature;
38
import org.gvsig.fmap.dal.feature.FeatureSelection;
39
import org.gvsig.fmap.dal.feature.FeatureSet;
40
import org.gvsig.fmap.geom.Geometry;
41
import org.gvsig.fmap.mapcontext.MapContext;
42
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
43
import org.gvsig.fmap.mapcontrol.MapControl;
44
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
45
import org.gvsig.gui.beans.incrementabletask.IncrementableProcess;
46
import org.gvsig.gui.beans.incrementabletask.IncrementableTask;
47
import org.gvsig.selectiontools.app.extension.tools.buffer.gui.BufferConfigurationPanel;
48
import org.gvsig.tools.dispose.DisposableIterator;
49

  
50
/**
51
 * 
52
 * 
53
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
54
 */
55
public class BufferSelectionProcess extends IncrementableProcess {
56

  
57
    // private boolean layerWasBeingEdited = false;
58

  
59
    private MapControl mapControl = null;
60
    private byte pol_side = -1;
61
    private byte line_side = -1;
62
    private byte point_side = -1;
63
    private byte multi_point_side = -1;
64
    private short selectedDistanceUnit = -1;
65
    private FLyrVect[] layers = null;
66
    private final double f_width;
67
    private boolean multiLayerSelection = false;
68

  
69
    /**
70
     * For polygonal buffers, only compute interior buffers
71
     */
72
    public static final byte BUFFER_INSIDE_POLY = 0;
73

  
74
    /**
75
     * For polygonal buffers, only compute exterior buffers (is the default
76
     * operation, it applies to any geometry type)
77
     */
78
    public static final byte BUFFER_OUTSIDE_POLY = 1;
79

  
80
    /**
81
     * For polygonal buffers, compute interior and exterior buffers
82
     */
83
    public static final byte BUFFER_INSIDE_OUTSIDE_POLY = 2;
84

  
85
    /**
86
     * Buffer with square cap
87
     */
88
    public static final byte CAP_SQUARE = 0;
89
    /**
90
     * Buffer with round cap
91
     */
92
    public static final byte CAP_ROUND = 1;
93

  
94
    /**
95
     * flag that represents buffer computing with one only buffer distance.
96
     */
97
    public static final byte CONSTANT_DISTANCE_STRATEGY = 0;
98

  
99
    /**
100
     * buffer computing with variable buffer distance in function of feature
101
     * attribute value
102
     */
103
    public static final byte ATTRIBUTE_DISTANCE_STRATEGY = 1;
104

  
105
    /**
106
     * Creates a new
107
     * <p>
108
     * BufferSelectionProcess
109
     * </p>
110
     * .
111
     * 
112
     * @param title
113
     *            of the progress dialog
114
     * @param label
115
     *            the label that explains the process
116
     * @param mapControl
117
     *            reference to the current active view's <code>MapControl</code>
118
     *            .
119
     * @param pol_side
120
     *            side of the buffer in a polyline layer:
121
     *            {@link BufferConfigurationPanel#OUTSIDE
122
     *            BufferConfigurationPanel#OUTSIDE},
123
     *            {@link BufferConfigurationPanel#INSIDE
124
     *            BufferConfigurationPanel#INSIDE}, or
125
     *            {@link BufferConfigurationPanel#OUTSIDE_AND_INSIDE
126
     *            BufferConfigurationPanel#OUTSIDE_AND_INSIDE}
127
     * @param line_side
128
     *            side of the buffer in a line layer:
129
     *            {@link BufferConfigurationPanel#OUTSIDE_AND_INSIDE
130
     *            BufferConfigurationPanel#OUTSIDE_AND_INSIDE}
131
     * @param point_side
132
     *            side of the buffer in a point layer:
133
     *            {@link BufferConfigurationPanel#OUTSIDE
134
     *            BufferConfigurationPanel#OUTSIDE}
135
     * @param multi_point_side
136
     *            side of the buffer in a multi point layer:
137
     *            {@link BufferConfigurationPanel#OUTSIDE
138
     *            BufferConfigurationPanel#OUTSIDE}
139
     * @param width
140
     *            buffer's width
141
     * @param selectedDistanceUnit
142
     *            distance unit selected
143
     * @param activeLayers
144
     *            current active view's active layers
145
     * @param showBufferLayers
146
     *            determines if will show the layers with the buffers as new
147
     *            temporal layers
148
     * @param multiLayerSelection
149
     *            determines if the selection in each active layer affects the
150
     *            other
151
     */
152
    public BufferSelectionProcess(String title,
153
        String label,
154
        MapControl mapControl,
155
        byte pol_side,
156
        byte line_side,
157
        byte point_side,
158
        byte multi_point_side,
159
        double width,
160
        short selectedDistanceUnit,
161
        FLyrVect[] activeLayers,
162
        boolean multiLayerSelection) {
163
        super(title);
164

  
165
        this.label = label;
166
        this.mapControl = mapControl;
167
        this.pol_side = pol_side;
168
        this.line_side = line_side;
169
        this.point_side = point_side;
170
        this.multi_point_side = multi_point_side;
171
        this.f_width = width;
172
        this.selectedDistanceUnit = selectedDistanceUnit;
173
        this.layers = activeLayers;
174
        this.multiLayerSelection = multiLayerSelection;
175
        this.isPausable = true;
176
    }
177

  
178
    /**
179
     * Sets the object that will display the evolution of this loading process
180
     * as a progress dialog.
181
     * 
182
     * @param iTask
183
     *            the object that will display the evolution of this loading
184
     *            process
185
     */
186
    public void setIncrementableTask(IncrementableTask iTask) {
187
        this.iTask = iTask;
188
        iTask.setAskCancel(true);
189
        iTask.getButtonsPanel().addAccept();
190
        iTask.getButtonsPanel().setEnabled(ButtonsPanel.BUTTON_ACCEPT, false);
191

  
192
        JButton jButton =
193
            iTask.getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT);
194
        jButton.addMouseListener(new MouseAdapter() {
195

  
196
            /*
197
             * (non-Javadoc)
198
             * 
199
             * @see
200
             * java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent
201
             * )
202
             */
203
            public void mouseClicked(MouseEvent e) {
204
                processFinalize();
205
            }
206
        });
207
    }
208

  
209
    /**
210
     * Importation process.
211
     * 
212
     * @throws InterruptedException
213
     *             if fails the process
214
     */
215
    public void process() throws InterruptedException {
216
        percentage = 5;
217
        double inc = 0;
218
        FeatureSelection selections[] = new FeatureSelection[layers.length];
219
        ArrayList<Geometry> buffer[] = new ArrayList[layers.length];
220
        try {
221

  
222
            /* 2- Gets the distance relation */
223
            percentage = 6;
224

  
225
            /* 3- Stores the new selections */
226
            FLyrVect layer = null;
227

  
228
            // int size;
229

  
230
            percentage = 9;
231

  
232
            /* 4- Gets the buffer and intersects to select new geometries */
233
            double width = 1; // default value (not used)
234
            byte side;
235

  
236
            percentage = 11;
237

  
238
            boolean isProjected = false;
239

  
240
            IWindow f = PluginServices.getMDIManager().getActiveWindow();
241
            if (f instanceof IView) {
242
                IView vista = (IView) f;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff