Revision 42021
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.gvsig.selectiontools.app</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.m2e.core.maven2Builder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
</buildSpec> |
|
14 |
<natures> |
|
15 |
<nature>org.eclipse.m2e.core.maven2Nature</nature> |
|
16 |
</natures> |
|
17 |
</projectDescription> |
|
0 | 18 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.selectiontools.app</artifactId> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.desktop.plugin</artifactId> |
|
11 |
<version>2.0.87</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
<modules> |
|
15 |
<module>org.gvsig.selectiontools.app.mainplugin</module> |
|
16 |
</modules> |
|
17 |
|
|
18 |
</project> |
|
0 | 19 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
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/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.selectiontools.app.mainplugin</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>Tools: Selection tools</name> |
|
7 |
<description> |
|
8 |
This plugin add to the view advanced selection tools: |
|
9 |
- select all |
|
10 |
- by buffer |
|
11 |
- by cicle |
|
12 |
- by polilyne |
|
13 |
</description> |
|
14 |
|
|
15 |
<parent> |
|
16 |
<groupId>org.gvsig</groupId> |
|
17 |
<artifactId>org.gvsig.selectiontools.app</artifactId> |
|
18 |
<version>2.0.87</version> |
|
19 |
</parent> |
|
20 |
|
|
21 |
|
|
22 |
<dependencies> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.andami</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.i18n</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.about.api</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
<dependency> |
|
54 |
<groupId>org.gvsig</groupId> |
|
55 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
56 |
<scope>compile</scope> |
|
57 |
</dependency> |
|
58 |
<dependency> |
|
59 |
<groupId>org.gvsig</groupId> |
|
60 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
61 |
<scope>compile</scope> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>org.gvsig</groupId> |
|
65 |
<artifactId>org.gvsig.ui</artifactId> |
|
66 |
<scope>compile</scope> |
|
67 |
</dependency> |
|
68 |
<dependency> |
|
69 |
<groupId>org.gvsig</groupId> |
|
70 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
71 |
<scope>compile</scope> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>org.gvsig</groupId> |
|
75 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
76 |
<scope>compile</scope> |
|
77 |
</dependency> |
|
78 |
<dependency> |
|
79 |
<groupId>org.gvsig</groupId> |
|
80 |
<artifactId>org.gvsig.utils</artifactId> |
|
81 |
<scope>compile</scope> |
|
82 |
</dependency> |
|
83 |
<dependency> |
|
84 |
<groupId>org.gvsig</groupId> |
|
85 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
86 |
<scope>compile</scope> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.gvsig</groupId> |
|
90 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
91 |
<scope>compile</scope> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>org.slf4j</groupId> |
|
95 |
<artifactId>slf4j-api</artifactId> |
|
96 |
<scope>compile</scope> |
|
97 |
</dependency> |
|
98 |
</dependencies> |
|
99 |
|
|
100 |
<build> |
|
101 |
<plugins> |
|
102 |
|
|
103 |
</plugins> |
|
104 |
</build> |
|
105 |
|
|
106 |
<properties> |
|
107 |
<gvsig.package.info.categories>View,Vector</gvsig.package.info.categories> |
|
108 |
<gvsig.package.info.codealias>org.gvsig.selectiontools.app.extension</gvsig.package.info.codealias> |
|
109 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
110 |
</properties> |
|
111 |
</project> |
|
0 | 112 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/.classpath | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="src" output="target/classes" path="src/main/java"> |
|
4 |
<attributes> |
|
5 |
<attribute name="optional" value="true"/> |
|
6 |
<attribute name="maven.pomderived" value="true"/> |
|
7 |
</attributes> |
|
8 |
</classpathentry> |
|
9 |
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> |
|
10 |
<attributes> |
|
11 |
<attribute name="maven.pomderived" value="true"/> |
|
12 |
</attributes> |
|
13 |
</classpathentry> |
|
14 |
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> |
|
15 |
<attributes> |
|
16 |
<attribute name="optional" value="true"/> |
|
17 |
<attribute name="maven.pomderived" value="true"/> |
|
18 |
</attributes> |
|
19 |
</classpathentry> |
|
20 |
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> |
|
21 |
<attributes> |
|
22 |
<attribute name="maven.pomderived" value="true"/> |
|
23 |
</attributes> |
|
24 |
</classpathentry> |
|
25 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"> |
|
26 |
<attributes> |
|
27 |
<attribute name="maven.pomderived" value="true"/> |
|
28 |
</attributes> |
|
29 |
</classpathentry> |
|
30 |
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> |
|
31 |
<attributes> |
|
32 |
<attribute name="maven.pomderived" value="true"/> |
|
33 |
</attributes> |
|
34 |
</classpathentry> |
|
35 |
<classpathentry kind="output" path="target/classes"/> |
|
36 |
</classpath> |
|
0 | 37 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Sat Feb 07 19:40:13 CET 2015 |
|
2 |
buildNumber=2152 |
|
0 | 3 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.gvsig.selectiontools.app.mainplugin</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>org.eclipse.m2e.core.maven2Builder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
</buildSpec> |
|
19 |
<natures> |
|
20 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
21 |
<nature>org.eclipse.m2e.core.maven2Nature</nature> |
|
22 |
</natures> |
|
23 |
</projectDescription> |
|
0 | 24 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/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/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
28 |
|
|
29 |
<!-- |
|
30 |
Log4J configuration file for unit tests execution. |
|
31 |
--> |
|
32 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
33 |
|
|
34 |
<!-- Appender configuration to show logging messages through the console --> |
|
35 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
36 |
<layout class="org.apache.log4j.PatternLayout"> |
|
37 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
38 |
</layout> |
|
39 |
</appender> |
|
40 |
|
|
41 |
<!-- |
|
42 |
Activate logging messages of DEBUG level of higher only for the |
|
43 |
org.gvsig.tools packages. |
|
44 |
You can put full classes names or packages instead, to configure |
|
45 |
logging for all the classes and subpackages of the package. |
|
46 |
--> |
|
47 |
<category name="org.gvsig.tools"> |
|
48 |
<priority value="DEBUG" /> |
|
49 |
</category> |
|
50 |
<category name="org.gvsig.selectiontools"> |
|
51 |
<priority value="DEBUG" /> |
|
52 |
</category> |
|
53 |
|
|
54 |
<!-- |
|
55 |
By default, show only logging messages of INFO level or higher, |
|
56 |
through the previously configured CONSOLE appender. |
|
57 |
--> |
|
58 |
<root> |
|
59 |
<priority value="INFO" /> |
|
60 |
<appender-ref ref="CONSOLE" /> |
|
61 |
</root> |
|
62 |
</log4j:configuration> |
|
0 | 63 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<!-- |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
|
|
25 |
--> |
|
26 |
<assembly> |
|
27 |
<id>gvsig-plugin-package</id> |
|
28 |
<formats> |
|
29 |
<format>zip</format> |
|
30 |
</formats> |
|
31 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
32 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
33 |
<files> |
|
34 |
<file> |
|
35 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
36 |
<outputDirectory>lib</outputDirectory> |
|
37 |
</file> |
|
38 |
<file> |
|
39 |
<source>target/package.info</source> |
|
40 |
</file> |
|
41 |
</files> |
|
42 |
|
|
43 |
<fileSets> |
|
44 |
<fileSet> |
|
45 |
<directory>src/main/resources-plugin</directory> |
|
46 |
<outputDirectory>.</outputDirectory> |
|
47 |
</fileSet> |
|
48 |
</fileSets> |
|
49 |
|
|
50 |
<!-- |
|
51 |
<dependencySets> |
|
52 |
<dependencySet> |
|
53 |
<useProjectArtifact>false</useProjectArtifact> |
|
54 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
55 |
<outputDirectory>lib</outputDirectory> |
|
56 |
<includes> |
|
57 |
<include>groupId:artifactId</include> |
|
58 |
</includes> |
|
59 |
</dependencySet> |
|
60 |
</dependencySets> |
|
61 |
--> |
|
62 |
</assembly> |
|
63 |
|
|
0 | 64 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/src/main/java/org/gvsig/selectiontools/app/extension/tools/CircleSelectListener.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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.selectiontools.app.extension.tools; |
|
25 |
|
|
26 |
import org.gvsig.andami.PluginServices; |
|
27 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
28 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
|
29 |
import org.gvsig.fmap.mapcontrol.tools.Events.MeasureEvent; |
|
30 |
|
|
31 |
/** |
|
32 |
* |
|
33 |
* @version 06/04/2009 |
|
34 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
35 |
*/ |
|
36 |
public class CircleSelectListener extends CircleSelectionListener { |
|
37 |
|
|
38 |
public CircleSelectListener(MapControl mc) { |
|
39 |
super(mc); |
|
40 |
} |
|
41 |
|
|
42 |
public void circle(MeasureEvent event) throws BehaviorException { |
|
43 |
super.circle(event); |
|
44 |
PluginServices.getMainFrame().enableControls(); |
|
45 |
} |
|
46 |
} |
|
0 | 47 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/src/main/java/org/gvsig/selectiontools/app/extension/tools/PolyLineSelectionListener.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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.selectiontools.app.extension.tools; |
|
25 |
|
|
26 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
27 |
* |
|
28 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
29 |
* of the Valencian Government (CIT) |
|
30 |
* |
|
31 |
* This program is free software; you can redistribute it and/or |
|
32 |
* modify it under the terms of the GNU General Public License |
|
33 |
* as published by the Free Software Foundation; either version 2 |
|
34 |
* of the License, or (at your option) any later version. |
|
35 |
* |
|
36 |
* This program is distributed in the hope that it will be useful, |
|
37 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
38 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
39 |
* GNU General Public License for more details. |
|
40 |
* |
|
41 |
* You should have received a copy of the GNU General Public License |
|
42 |
* along with this program; if not, write to the Free Software |
|
43 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
44 |
* MA 02110-1301, USA. |
|
45 |
* |
|
46 |
*/ |
|
47 |
|
|
48 |
import java.awt.Cursor; |
|
49 |
import java.awt.Image; |
|
50 |
import java.awt.Point; |
|
51 |
import java.awt.Toolkit; |
|
52 |
|
|
53 |
import javax.swing.ImageIcon; |
|
54 |
|
|
55 |
import org.gvsig.andami.IconThemeHelper; |
|
56 |
import org.gvsig.andami.PluginServices; |
|
57 |
import org.gvsig.andami.messages.NotificationManager; |
|
58 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
59 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
60 |
import org.gvsig.fmap.geom.Geometry; |
|
61 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
62 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
63 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
64 |
import org.gvsig.fmap.geom.GeometryManager; |
|
65 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
66 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
67 |
import org.gvsig.fmap.geom.primitive.Surface; |
|
68 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
69 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
70 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
71 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
|
72 |
import org.gvsig.fmap.mapcontrol.tools.Events.MeasureEvent; |
|
73 |
import org.gvsig.fmap.mapcontrol.tools.Listeners.PolylineListener; |
|
74 |
|
|
75 |
/** |
|
76 |
* <p> |
|
77 |
* Listener that selects all features of the active and vector layers which |
|
78 |
* intersect with the defined polyline in the associated {@link MapControl |
|
79 |
* MapControl} object. |
|
80 |
* </p> |
|
81 |
* |
|
82 |
* <p> |
|
83 |
* The selection will be produced after user finishes the creation of the |
|
84 |
* polyline. |
|
85 |
* </p> |
|
86 |
* |
|
87 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
88 |
*/ |
|
89 |
public class PolyLineSelectionListener implements PolylineListener { |
|
90 |
|
|
91 |
/** |
|
92 |
* The image to display when the cursor is active. |
|
93 |
*/ |
|
94 |
// private final Image img = PluginServices.getIconTheme().get("cursor-select-by-polygon").getImage(); |
|
95 |
|
|
96 |
/** |
|
97 |
* The cursor used to work with this tool listener. |
|
98 |
* |
|
99 |
* @see #getCursor() |
|
100 |
*/ |
|
101 |
private Cursor cur = null; |
|
102 |
|
|
103 |
/** |
|
104 |
* Reference to the <code>MapControl</code> object that uses. |
|
105 |
*/ |
|
106 |
private MapControl mapCtrl; |
|
107 |
|
|
108 |
/** |
|
109 |
* <p> |
|
110 |
* Creates a new <code>PolygonSelectionListener</code> object. |
|
111 |
* </p> |
|
112 |
* |
|
113 |
* @param mc |
|
114 |
* the <code>MapControl</code> where is drawn the polyline |
|
115 |
*/ |
|
116 |
public PolyLineSelectionListener(MapControl mc) { |
|
117 |
this.mapCtrl = mc; |
|
118 |
} |
|
119 |
|
|
120 |
/* |
|
121 |
* (non-Javadoc) |
|
122 |
* |
|
123 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor() |
|
124 |
*/ |
|
125 |
public Cursor getCursor() { |
|
126 |
if( cur == null ) { |
|
127 |
cur = Toolkit.getDefaultToolkit().createCustomCursor(this.getImageCursor(), |
|
128 |
new Point(16, 16), |
|
129 |
""); |
|
130 |
} |
|
131 |
return cur; |
|
132 |
} |
|
133 |
|
|
134 |
/* |
|
135 |
* (non-Javadoc) |
|
136 |
* |
|
137 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing() |
|
138 |
*/ |
|
139 |
public boolean cancelDrawing() { |
|
140 |
return false; |
|
141 |
} |
|
142 |
|
|
143 |
/* |
|
144 |
* (non-Javadoc) |
|
145 |
* |
|
146 |
* @see |
|
147 |
* com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#points(com.iver |
|
148 |
* .cit.gvsig.fmap.tools.Events.MeasureEvent) |
|
149 |
*/ |
|
150 |
public void points(MeasureEvent event) throws BehaviorException { |
|
151 |
} |
|
152 |
|
|
153 |
/* |
|
154 |
* (non-Javadoc) |
|
155 |
* |
|
156 |
* @see |
|
157 |
* com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#pointFixed(com |
|
158 |
* .iver.cit.gvsig.fmap.tools.Events.MeasureEvent) |
|
159 |
*/ |
|
160 |
public void pointFixed(MeasureEvent event) throws BehaviorException { |
|
161 |
} |
|
162 |
|
|
163 |
/* |
|
164 |
* (non-Javadoc) |
|
165 |
* |
|
166 |
* @see |
|
167 |
* com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#polylineFinished |
|
168 |
* (com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent) |
|
169 |
*/ |
|
170 |
public void polylineFinished(MeasureEvent event) throws BehaviorException { |
|
171 |
try { |
|
172 |
GeneralPathX gp = event.getGP(); |
|
173 |
GeometryManager manager = GeometryLocator.getGeometryManager(); |
|
174 |
Geometry geom = null; |
|
175 |
Surface surface = null; |
|
176 |
try { |
|
177 |
surface = |
|
178 |
(Surface) manager.create(TYPES.SURFACE, SUBTYPES.GEOM2D); |
|
179 |
surface.setGeneralPath(gp); |
|
180 |
geom = surface; |
|
181 |
} catch (CreateGeometryException e1) { |
|
182 |
NotificationManager.showMessageError(PluginServices.getText(null, |
|
183 |
"Failed_creating_geometry"), |
|
184 |
e1); |
|
185 |
} |
|
186 |
if (geom == null) |
|
187 |
return; |
|
188 |
|
|
189 |
FLayer[] actives = mapCtrl.getMapContext().getLayers().getActives(); |
|
190 |
|
|
191 |
for (int i = 0; i < actives.length; i++) { |
|
192 |
if (actives[i] instanceof FLyrVect) { |
|
193 |
FLyrVect lyrVect = (FLyrVect) actives[i]; |
|
194 |
FeatureSet newSelection = null; |
|
195 |
|
|
196 |
newSelection = |
|
197 |
lyrVect.queryByGeometry(geom, lyrVect.getFeatureStore() |
|
198 |
.getDefaultFeatureType()); |
|
199 |
|
|
200 |
if (event.getEvent().isControlDown()) { |
|
201 |
((FeatureSelection) lyrVect.getDataStore() |
|
202 |
.getSelection()).select(newSelection); |
|
203 |
} else { |
|
204 |
lyrVect.getFeatureStore().setSelection(newSelection); |
|
205 |
} |
|
206 |
} |
|
207 |
} |
|
208 |
} catch (com.vividsolutions.jts.geom.TopologyException topEx) { |
|
209 |
NotificationManager.showMessageError(PluginServices.getText(null, |
|
210 |
"Failed_selecting_geometries_by_polyline_topology_exception_explanation"), |
|
211 |
topEx); |
|
212 |
} catch (Exception ex) { |
|
213 |
NotificationManager.showMessageError(PluginServices.getText(null, |
|
214 |
"Failed_selecting_geometries"), ex); |
|
215 |
} |
|
216 |
} |
|
217 |
|
|
218 |
public Image getImageCursor() { |
|
219 |
return IconThemeHelper.getImage("cursor-select-by-polyline"); |
|
220 |
} |
|
221 |
} |
|
0 | 222 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/src/main/java/org/gvsig/selectiontools/app/extension/tools/buffer/gui/BufferConfigurationPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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.selectiontools.app.extension.tools.buffer.gui; |
|
25 |
|
|
26 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
27 |
* |
|
28 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
29 |
* of the Valencian Government (CIT) |
|
30 |
* |
|
31 |
* This program is free software; you can redistribute it and/or |
|
32 |
* modify it under the terms of the GNU General Public License |
|
33 |
* as published by the Free Software Foundation; either version 2 |
|
34 |
* of the License, or (at your option) any later version. |
|
35 |
* |
|
36 |
* This program is distributed in the hope that it will be useful, |
|
37 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
38 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
39 |
* GNU General Public License for more details. |
|
40 |
* |
|
41 |
* You should have received a copy of the GNU General Public License |
|
42 |
* along with this program; if not, write to the Free Software |
|
43 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
44 |
* MA 02110-1301, USA. |
|
45 |
* |
|
46 |
*/ |
|
47 |
|
|
48 |
import java.awt.Dimension; |
|
49 |
import java.awt.FlowLayout; |
|
50 |
import java.awt.event.ActionEvent; |
|
51 |
import java.awt.event.ActionListener; |
|
52 |
import java.awt.event.ComponentAdapter; |
|
53 |
import java.awt.event.ComponentEvent; |
|
54 |
import java.util.ArrayList; |
|
55 |
import java.util.Arrays; |
|
56 |
import java.util.Iterator; |
|
57 |
import java.util.List; |
|
58 |
|
|
59 |
import javax.swing.BorderFactory; |
|
60 |
import javax.swing.JCheckBox; |
|
61 |
import javax.swing.JLabel; |
|
62 |
import javax.swing.JOptionPane; |
|
63 |
import javax.swing.JPanel; |
|
64 |
import javax.swing.JTextField; |
|
65 |
|
|
66 |
import org.gvsig.andami.PluginServices; |
|
67 |
import org.gvsig.andami.messages.NotificationManager; |
|
68 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
69 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
70 |
import org.gvsig.app.ApplicationLocator; |
|
71 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
72 |
import org.gvsig.fmap.dal.exception.DataException; |
|
73 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
74 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
75 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
|
76 |
import org.gvsig.gui.beans.incrementabletask.IncrementableTask; |
|
77 |
import org.gvsig.gui.beans.progresspanel.ProgressPanel; |
|
78 |
import org.gvsig.i18n.Messages; |
|
79 |
import org.gvsig.selectiontools.app.extension.tools.buffer.process.BufferSelectionProcess; |
|
80 |
import org.gvsig.utils.swing.JComboBox; |
|
81 |
|
|
82 |
/** |
|
83 |
* |
|
84 |
* |
|
85 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
86 |
*/ |
|
87 |
public class BufferConfigurationPanel extends JPanel implements IWindow { |
|
88 |
|
|
89 |
private WindowInfo viewInfo = null; |
|
90 |
private final short Window_Width = 354; |
|
91 |
private final short Window_Height = 315; // 35; |
|
92 |
private JTextField distanceText = null; |
|
93 |
private JComboBox distanceUnitsCombo = null; |
|
94 |
private JComboBox polygonSidesCombo = null; |
|
95 |
private JComboBox lineSidesCombo = null; |
|
96 |
private JComboBox pointSidesCombo = null; |
|
97 |
private JComboBox multiPointSidesCombo = null; |
|
98 |
private JLabel distanceUnitsLabel = null; |
|
99 |
private JLabel polygonSideLabel = null; |
|
100 |
private JLabel lineSideLabel = null; |
|
101 |
private JLabel pointSideLabel = null; |
|
102 |
private JLabel multiPointSideLabel = null; |
|
103 |
private JPanel polygonSidePanel = null; |
|
104 |
private JPanel lineSidePanel = null; |
|
105 |
private JPanel pointSidePanel = null; |
|
106 |
private JPanel multiPointSidePanel = null; |
|
107 |
private JLabel widthLabel = null; |
|
108 |
private JPanel widthPanel = null; |
|
109 |
// private JPanel distanceUnits = null; |
|
110 |
private JPanel sidePanel = null; |
|
111 |
private JPanel optionsPanel = null; |
|
112 |
private AdaptedAcceptCancelPanel acceptCancelPanel = null; |
|
113 |
private List<FLyrVect> layers; |
|
114 |
private MapControl mapControl; |
|
115 |
private IView view; |
|
116 |
private JCheckBox multiLayerSelectionCBox; |
|
117 |
private SideInfo outside, inside, out_in_side; |
|
118 |
|
|
119 |
/** |
|
120 |
* Creates a new form where user can define the option of the buffer. |
|
121 |
*/ |
|
122 |
public BufferConfigurationPanel(List<FLyrVect> layers, IView view) { |
|
123 |
super(); |
|
124 |
|
|
125 |
this.layers = layers; |
|
126 |
this.view = view; |
|
127 |
this.mapControl = view.getMapControl(); |
|
128 |
|
|
129 |
initialize(); |
|
130 |
} |
|
131 |
|
|
132 |
public BufferConfigurationPanel(FLyrVect[] array, IView view) { |
|
133 |
this(Arrays.asList(array),view); |
|
134 |
} |
|
135 |
|
|
136 |
/** |
|
137 |
* Initializes this component. |
|
138 |
*/ |
|
139 |
private void initialize() { |
|
140 |
outside = |
|
141 |
new SideInfo(BufferSelectionProcess.BUFFER_OUTSIDE_POLY, |
|
142 |
PluginServices.getText(null, "Outside")); |
|
143 |
inside = |
|
144 |
new SideInfo(BufferSelectionProcess.BUFFER_INSIDE_POLY, |
|
145 |
PluginServices.getText(null, "Inside")); |
|
146 |
out_in_side = |
|
147 |
new SideInfo(BufferSelectionProcess.BUFFER_INSIDE_OUTSIDE_POLY, |
|
148 |
PluginServices.getText(null, "Both")); |
|
149 |
|
|
150 |
setLayout(new FlowLayout()); |
|
151 |
add(getWidthPanel()); |
|
152 |
add(getSidePanel()); |
|
153 |
add(getOptionsPanel()); |
|
154 |
add(getAdaptedAcceptCancelPanel()); |
|
155 |
} |
|
156 |
|
|
157 |
private JPanel getOptionsPanel() { |
|
158 |
if (optionsPanel == null) { |
|
159 |
optionsPanel = new JPanel(); |
|
160 |
optionsPanel.setLayout(new FlowLayout()); |
|
161 |
optionsPanel.setPreferredSize(new Dimension(344, 80)); // 106)); |
|
162 |
optionsPanel.setBorder(BorderFactory.createTitledBorder(PluginServices.getText(optionsPanel, |
|
163 |
"Options"))); |
|
164 |
optionsPanel.add(getMultiLayerSelectionCBox()); |
|
165 |
} |
|
166 |
|
|
167 |
return optionsPanel; |
|
168 |
} |
|
169 |
|
|
170 |
private JCheckBox getMultiLayerSelectionCBox() { |
|
171 |
if (multiLayerSelectionCBox == null) { |
|
172 |
multiLayerSelectionCBox = new JCheckBox(); |
|
173 |
multiLayerSelectionCBox.setPreferredSize(new Dimension(330, 22)); |
|
174 |
multiLayerSelectionCBox.setText(PluginServices.getText(multiLayerSelectionCBox, |
|
175 |
"_MultiLayer_selection")); |
|
176 |
multiLayerSelectionCBox.setSelected(true); |
|
177 |
multiLayerSelectionCBox.setToolTipText(PluginServices.getText(null, |
|
178 |
"multiLayerSelection_checkbox_TOOLTIP_HTML_explanation")); |
|
179 |
} |
|
180 |
|
|
181 |
return multiLayerSelectionCBox; |
|
182 |
} |
|
183 |
|
|
184 |
private JPanel getWidthPanel() { |
|
185 |
if (widthPanel == null) { |
|
186 |
widthPanel = new JPanel(); |
|
187 |
widthPanel.setPreferredSize(new Dimension(344, 55)); |
|
188 |
widthPanel.setBorder(BorderFactory.createTitledBorder(PluginServices.getText(widthPanel, |
|
189 |
"Width"))); |
|
190 |
widthPanel.setLayout(new FlowLayout()); |
|
191 |
widthPanel.add(getWidthLabel()); |
|
192 |
widthPanel.add(getWidthText()); |
|
193 |
widthPanel.add(getDistanceUnitsLabel()); |
|
194 |
widthPanel.add(getDistanceUnitsCombo()); |
|
195 |
} |
|
196 |
|
|
197 |
return widthPanel; |
|
198 |
} |
|
199 |
|
|
200 |
private JLabel getWidthLabel() { |
|
201 |
if (widthLabel == null) { |
|
202 |
widthLabel = new JLabel(); |
|
203 |
widthLabel.setPreferredSize(new Dimension(68, 22)); |
|
204 |
widthLabel.setText(PluginServices.getText(widthLabel, "Width")); |
|
205 |
widthLabel.setToolTipText(PluginServices.getText(null, |
|
206 |
"bufferWidth_TOOLTIP_HTML_explanation")); |
|
207 |
} |
|
208 |
|
|
209 |
return widthLabel; |
|
210 |
} |
|
211 |
|
|
212 |
private JTextField getWidthText() { |
|
213 |
if (distanceText == null) { |
|
214 |
/* |
|
215 |
DecimalFormat decimalFormat = new DecimalFormat(); |
|
216 |
|
|
217 |
decimalFormat.setDecimalSeparatorAlwaysShown(true); |
|
218 |
decimalFormat.setMaximumIntegerDigits(12); |
|
219 |
decimalFormat.setMinimumIntegerDigits(1); |
|
220 |
decimalFormat.setMinimumFractionDigits(2); |
|
221 |
decimalFormat.setMaximumFractionDigits(4); |
|
222 |
|
|
223 |
decimalFormat.getDecimalFormatSymbols().setDecimalSeparator('.'); |
|
224 |
|
|
225 |
NumberFormatter numberFormatter = new NumberFormatter(); |
|
226 |
numberFormatter.setAllowsInvalid(false); |
|
227 |
numberFormatter.setOverwriteMode(false); |
|
228 |
numberFormatter.setCommitsOnValidEdit(true); |
|
229 |
numberFormatter.setMinimum(new Double(0)); |
|
230 |
numberFormatter.setFormat(decimalFormat); |
|
231 |
*/ |
|
232 |
|
|
233 |
// numberFormatter.setFormat(new |
|
234 |
// DecimalFormat("([+]|[-])?[0-9]+([.][0-9]+)?")); |
|
235 |
|
|
236 |
distanceText = new JTextField(); |
|
237 |
distanceText.setPreferredSize(new Dimension(85, 22)); |
|
238 |
distanceText.setText("100"); |
|
239 |
} |
|
240 |
|
|
241 |
return distanceText; |
|
242 |
} |
|
243 |
|
|
244 |
private JLabel getDistanceUnitsLabel() { |
|
245 |
if (distanceUnitsLabel == null) { |
|
246 |
distanceUnitsLabel = |
|
247 |
new JLabel(PluginServices.getText(distanceUnitsLabel, "Unit")); |
|
248 |
distanceUnitsLabel.setAlignmentX(JLabel.RIGHT_ALIGNMENT); |
|
249 |
distanceUnitsLabel.setPreferredSize(new Dimension(68, 22)); |
|
250 |
distanceUnitsLabel.setToolTipText(PluginServices.getText(null, |
|
251 |
"distanceUnitsLabel_TOOLTIP_HTML_explanation")); |
|
252 |
} |
|
253 |
|
|
254 |
return distanceUnitsLabel; |
|
255 |
} |
|
256 |
|
|
257 |
private JComboBox getDistanceUnitsCombo() { |
|
258 |
if (distanceUnitsCombo == null) { |
|
259 |
distanceUnitsCombo = new JComboBox(); |
|
260 |
distanceUnitsCombo.setPreferredSize(new Dimension(85, 22)); |
|
261 |
distanceUnitsCombo.addItem("km"); |
|
262 |
distanceUnitsCombo.addItem("m"); |
|
263 |
distanceUnitsCombo.addItem("cm"); |
|
264 |
distanceUnitsCombo.addItem("mm"); |
|
265 |
distanceUnitsCombo.addItem("mi"); |
|
266 |
distanceUnitsCombo.addItem("Ya"); |
|
267 |
distanceUnitsCombo.addItem("ft"); |
|
268 |
distanceUnitsCombo.addItem("in"); |
|
269 |
// distanceUnitsCombo.addItem("?"); |
|
270 |
distanceUnitsCombo.setSelectedIndex(1); // By default in meters |
|
271 |
distanceUnitsCombo.setToolTipText(PluginServices.getText(null, |
|
272 |
"distanceUnitsLabel_TOOLTIP_HTML_explanation")); |
|
273 |
} |
|
274 |
|
|
275 |
return distanceUnitsCombo; |
|
276 |
} |
|
277 |
|
|
278 |
private JPanel getSidePanel() { |
|
279 |
if (sidePanel == null) { |
|
280 |
sidePanel = new JPanel(); |
|
281 |
sidePanel.setLayout(new FlowLayout()); |
|
282 |
sidePanel.setPreferredSize(new Dimension(344, 166)); |
|
283 |
sidePanel.setBorder(BorderFactory.createTitledBorder(PluginServices.getText(sidePanel, |
|
284 |
"Side"))); |
|
285 |
sidePanel.setToolTipText(PluginServices.getText(null, |
|
286 |
"sideLabel_TOOLTIP_HTML_explanation")); |
|
287 |
sidePanel.add(getPolygonSidePanel()); |
|
288 |
sidePanel.add(getLineSidePanel()); |
|
289 |
sidePanel.add(getPointSidePanel()); |
|
290 |
sidePanel.add(getMultiPointSidePanel()); |
|
291 |
} |
|
292 |
|
|
293 |
return sidePanel; |
|
294 |
} |
|
295 |
|
|
296 |
private JPanel getPolygonSidePanel() { |
|
297 |
if (polygonSidePanel == null) { |
|
298 |
polygonSidePanel = new JPanel(); |
|
299 |
polygonSidePanel.setPreferredSize(new Dimension(336, 28)); |
|
300 |
polygonSidePanel.add(getPolygonSideLabel()); |
|
301 |
polygonSidePanel.add(getPolygonSidesCombo()); |
|
302 |
} |
|
303 |
|
|
304 |
return polygonSidePanel; |
|
305 |
} |
|
306 |
|
|
307 |
private JLabel getPolygonSideLabel() { |
|
308 |
if (polygonSideLabel == null) { |
|
309 |
polygonSideLabel = |
|
310 |
new JLabel(PluginServices.getText(polygonSideLabel, "Polygon")); |
|
311 |
polygonSideLabel.setPreferredSize(new Dimension(90, 22)); |
|
312 |
polygonSideLabel.setToolTipText(PluginServices.getText(null, |
|
313 |
"polygonSideLabel_TOOLTIP_HTML_explanation")); |
|
314 |
} |
|
315 |
|
|
316 |
return polygonSideLabel; |
|
317 |
} |
|
318 |
|
|
319 |
private JComboBox getPolygonSidesCombo() { |
|
320 |
if (polygonSidesCombo == null) { |
|
321 |
polygonSidesCombo = new JComboBox(); |
|
322 |
polygonSidesCombo.setPreferredSize(new Dimension(230, 22)); |
|
323 |
polygonSidesCombo.addItem(outside); |
|
324 |
polygonSidesCombo.addItem(inside); |
|
325 |
// polygonSidesCombo.addItem(out_in_side); // Disabled because fails |
|
326 |
// quite often |
|
327 |
polygonSidesCombo.setToolTipText(PluginServices.getText(null, |
|
328 |
"polygonSideLabel_TOOLTIP_HTML_explanation")); |
|
329 |
} |
|
330 |
|
|
331 |
return polygonSidesCombo; |
|
332 |
} |
|
333 |
|
|
334 |
private JPanel getLineSidePanel() { |
|
335 |
if (lineSidePanel == null) { |
|
336 |
lineSidePanel = new JPanel(); |
|
337 |
lineSidePanel.setPreferredSize(new Dimension(336, 28)); |
|
338 |
lineSidePanel.add(getLineSideLabel()); |
|
339 |
lineSidePanel.add(getLineSidesCombo()); |
|
340 |
} |
|
341 |
|
|
342 |
return lineSidePanel; |
|
343 |
} |
|
344 |
|
|
345 |
private JLabel getLineSideLabel() { |
|
346 |
if (lineSideLabel == null) { |
|
347 |
lineSideLabel = |
|
348 |
new JLabel(PluginServices.getText(lineSideLabel, "Line")); |
|
349 |
lineSideLabel.setPreferredSize(new Dimension(90, 22)); |
|
350 |
lineSideLabel.setToolTipText(PluginServices.getText(null, |
|
351 |
"lineSideLabel_TOOLTIP_HTML_explanation")); |
|
352 |
} |
|
353 |
|
|
354 |
return lineSideLabel; |
|
355 |
} |
|
356 |
|
|
357 |
private JComboBox getLineSidesCombo() { |
|
358 |
if (lineSidesCombo == null) { |
|
359 |
lineSidesCombo = new JComboBox(); |
|
360 |
lineSidesCombo.setPreferredSize(new Dimension(230, 22)); |
|
361 |
lineSidesCombo.addItem(outside); |
|
362 |
lineSidesCombo.setToolTipText(PluginServices.getText(null, |
|
363 |
"lineSideLabel_TOOLTIP_HTML_explanation")); |
|
364 |
} |
|
365 |
|
|
366 |
return lineSidesCombo; |
|
367 |
} |
|
368 |
|
|
369 |
private JPanel getPointSidePanel() { |
|
370 |
if (pointSidePanel == null) { |
|
371 |
pointSidePanel = new JPanel(); |
|
372 |
pointSidePanel.setPreferredSize(new Dimension(336, 28)); |
|
373 |
pointSidePanel.add(getPointSideLabel()); |
|
374 |
pointSidePanel.add(getPointSidesCombo()); |
|
375 |
} |
|
376 |
|
|
377 |
return pointSidePanel; |
|
378 |
} |
|
379 |
|
|
380 |
private JLabel getPointSideLabel() { |
|
381 |
if (pointSideLabel == null) { |
|
382 |
pointSideLabel = |
|
383 |
new JLabel(PluginServices.getText(pointSideLabel, "Point")); |
|
384 |
pointSideLabel.setPreferredSize(new Dimension(90, 22)); |
|
385 |
pointSideLabel.setToolTipText(PluginServices.getText(null, |
|
386 |
"pointSideLabel_TOOLTIP_HTML_explanation")); |
|
387 |
} |
|
388 |
|
|
389 |
return pointSideLabel; |
|
390 |
} |
|
391 |
|
|
392 |
private JComboBox getPointSidesCombo() { |
|
393 |
if (pointSidesCombo == null) { |
|
394 |
pointSidesCombo = new JComboBox(); |
|
395 |
pointSidesCombo.setPreferredSize(new Dimension(230, 22)); |
|
396 |
pointSidesCombo.addItem(outside); |
|
397 |
pointSidesCombo.setToolTipText(PluginServices.getText(null, |
|
398 |
"pointSideLabel_TOOLTIP_HTML_explanation")); |
|
399 |
} |
|
400 |
|
|
401 |
return pointSidesCombo; |
|
402 |
} |
|
403 |
|
|
404 |
private JPanel getMultiPointSidePanel() { |
|
405 |
if (multiPointSidePanel == null) { |
|
406 |
multiPointSidePanel = new JPanel(); |
|
407 |
multiPointSidePanel.setPreferredSize(new Dimension(336, 28)); |
|
408 |
multiPointSidePanel.add(getMultiPointSideLabel()); |
|
409 |
multiPointSidePanel.add(getMultiPointSidesCombo()); |
|
410 |
} |
|
411 |
|
|
412 |
return multiPointSidePanel; |
|
413 |
} |
|
414 |
|
|
415 |
private JLabel getMultiPointSideLabel() { |
|
416 |
if (multiPointSideLabel == null) { |
|
417 |
multiPointSideLabel = |
|
418 |
new JLabel(PluginServices.getText(multiPointSideLabel, |
|
419 |
"MultiPoint")); |
|
420 |
multiPointSideLabel.setPreferredSize(new Dimension(90, 22)); |
|
421 |
multiPointSideLabel.setToolTipText(PluginServices.getText(null, |
|
422 |
"multiPointSideLabel_TOOLTIP_HTML_explanation")); |
|
423 |
} |
|
424 |
|
|
425 |
return multiPointSideLabel; |
|
426 |
} |
|
427 |
|
|
428 |
private JComboBox getMultiPointSidesCombo() { |
|
429 |
if (multiPointSidesCombo == null) { |
|
430 |
multiPointSidesCombo = new JComboBox(); |
|
431 |
multiPointSidesCombo.setPreferredSize(new Dimension(230, 22)); |
|
432 |
multiPointSidesCombo.addItem(outside); |
|
433 |
multiPointSidesCombo.setToolTipText(PluginServices.getText(null, |
|
434 |
"multiPointSideLabel_TOOLTIP_HTML_explanation")); |
|
435 |
} |
|
436 |
|
|
437 |
return multiPointSidesCombo; |
|
438 |
} |
|
439 |
|
|
440 |
/** |
|
441 |
* <p> |
|
442 |
* This method initializes acceptCancelPanel. |
|
443 |
* </p> |
|
444 |
* |
|
445 |
* @return an adapted {@link AcceptCancelPanel AcceptCancelPanel} |
|
446 |
*/ |
|
447 |
private AdaptedAcceptCancelPanel getAdaptedAcceptCancelPanel() { |
|
448 |
if (acceptCancelPanel == null) { |
|
449 |
acceptCancelPanel = new AdaptedAcceptCancelPanel(); |
|
450 |
} |
|
451 |
|
|
452 |
return acceptCancelPanel; |
|
453 |
} |
|
454 |
|
|
455 |
/* |
|
456 |
* (non-Javadoc) |
|
457 |
* |
|
458 |
* @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo() |
|
459 |
*/ |
|
460 |
public WindowInfo getWindowInfo() { |
|
461 |
if (viewInfo == null) { |
|
462 |
viewInfo = new WindowInfo(WindowInfo.MODALDIALOG); |
|
463 |
viewInfo.setTitle( |
|
464 |
Messages.getText("Select_by_buffer")); |
|
465 |
viewInfo.setWidth(Window_Width); |
|
466 |
viewInfo.setHeight(Window_Height); |
|
467 |
} |
|
468 |
|
|
469 |
return viewInfo; |
|
470 |
} |
|
471 |
|
|
472 |
/** |
|
473 |
* <p> |
|
474 |
* Adapts {@link AcceptCancelPanel AcceptCancelPanel} to be used as a |
|
475 |
* component of the <code>BufferConfigurationPanel</code> panel. |
|
476 |
* </p> |
|
477 |
* |
|
478 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
479 |
*/ |
|
480 |
private class AdaptedAcceptCancelPanel extends AcceptCancelPanel { |
|
481 |
|
|
482 |
public AdaptedAcceptCancelPanel() { |
|
483 |
super(); |
|
484 |
|
|
485 |
addOkButtonActionListener(getOKAction()); |
|
486 |
addCancelButtonActionListener(getCancelAction()); |
|
487 |
setPreferredSize(new Dimension(350, 30)); |
|
488 |
} |
|
489 |
|
|
490 |
/** |
|
491 |
* <p> |
|
492 |
* Create the action that will be executed when user pressed the |
|
493 |
* <i>ok</i> button. |
|
494 |
* </p> |
|
495 |
* |
|
496 |
* @return action that will be executed when user pressed the |
|
497 |
* <i>cancel</i> |
|
498 |
* button |
|
499 |
*/ |
|
500 |
private ActionListener getOKAction() { |
|
501 |
// OK button action |
|
502 |
return new ActionListener() { |
|
503 |
|
|
504 |
/* |
|
505 |
* @see |
|
506 |
* java.awt.event.ActionListener#actionPerformed(java.awt.event |
|
507 |
* .ActionEvent) |
|
508 |
*/ |
|
509 |
public void actionPerformed(ActionEvent e) { |
|
510 |
|
|
511 |
/* 1- Validates the buffer width */ |
|
512 |
double width; |
|
513 |
|
|
514 |
try { |
|
515 |
width = Double.parseDouble(getWidthText().getText()); |
|
516 |
/* |
|
517 |
.replaceAll("(\\.)?", "") |
|
518 |
.replace(",", ".")); // Formats the decimal |
|
519 |
// number to be parsed |
|
520 |
* |
|
521 |
*/ |
|
522 |
} catch (Exception ex) { |
|
523 |
|
|
524 |
JOptionPane.showMessageDialog( |
|
525 |
ApplicationLocator.getManager().getRootComponent(), |
|
526 |
Messages.getText("_Invalid_width_value") |
|
527 |
+ " : \"" + getWidthText().getText() + "\"", |
|
528 |
Messages.getText("Select_by_buffer"), |
|
529 |
JOptionPane.WARNING_MESSAGE); |
|
530 |
return; |
|
531 |
} |
|
532 |
|
|
533 |
/* 2- Closes this window */ |
|
534 |
closeThis(); |
|
535 |
|
|
536 |
|
|
537 |
/* 3- Creates the process */ |
|
538 |
// checks layers to proccess if multilayer is not selected |
|
539 |
List<FLyrVect> tmpLayersToProccess = new ArrayList<FLyrVect>(); |
|
540 |
tmpLayersToProccess.addAll(layers); |
|
541 |
if (!multiLayerSelectionCBox.isSelected()) { |
|
542 |
Iterator<FLyrVect> iter = |
|
543 |
tmpLayersToProccess.iterator(); |
|
544 |
FLyrVect curLayer; |
|
545 |
while (iter.hasNext()) { |
|
546 |
curLayer = (FLyrVect) iter.next(); |
|
547 |
try { |
|
548 |
if (curLayer.getFeatureStore() |
|
549 |
.getFeatureSelection() |
|
550 |
.isEmpty()) { |
|
551 |
iter.remove(); |
|
552 |
} |
|
553 |
} catch (DataException e1) { |
|
554 |
NotificationManager.showMessageError(PluginServices.getText(null, |
|
555 |
"Failed_selecting_layer"), |
|
556 |
e1); |
|
557 |
return; |
|
558 |
|
|
559 |
} |
|
560 |
} |
|
561 |
} |
|
562 |
FLyrVect[] layersToProcess = |
|
563 |
(FLyrVect[]) tmpLayersToProccess.toArray(new FLyrVect[tmpLayersToProccess.size()]); |
|
564 |
|
|
565 |
BufferSelectionProcess iprocess = |
|
566 |
new BufferSelectionProcess(PluginServices.getText(this, |
|
567 |
"Select_by_buffer"), |
|
568 |
PluginServices.getText(this, |
|
569 |
"Ongoing_process_please_wait"), |
|
570 |
mapControl, |
|
571 |
((SideInfo) getPolygonSidesCombo().getSelectedItem()).getSide(), |
|
572 |
((SideInfo) getLineSidesCombo().getSelectedItem()).getSide(), |
|
573 |
((SideInfo) getPointSidesCombo().getSelectedItem()).getSide(), |
|
574 |
((SideInfo) getMultiPointSidesCombo().getSelectedItem()).getSide(), |
|
575 |
width, |
|
576 |
(short) getDistanceUnitsCombo().getSelectedIndex(), |
|
577 |
layersToProcess, |
|
578 |
getMultiLayerSelectionCBox().isSelected());// getAddBufferLayersCBox().isSelected(), |
|
579 |
// getAddInfluenceAreaLayersCBox().isSelected(), |
|
580 |
// getMultiLayerSelectionCBox().isSelected()); |
|
581 |
IncrementableTask iTask = |
|
582 |
new IncrementableTask(iprocess, |
|
583 |
new ProgressPanel(false)); |
|
584 |
iTask.addIncrementableListener(iprocess); |
|
585 |
iprocess.setIncrementableTask(iTask); |
|
586 |
|
|
587 |
iTask.getProgressPanel() |
|
588 |
.addComponentListener(new ComponentAdapter() { |
|
589 |
public void componentHidden(ComponentEvent e) { |
|
590 |
mapControl.getMapContext().invalidate(); |
|
591 |
} |
|
592 |
}); |
|
593 |
|
|
594 |
/* 4- Starts the process */ |
|
595 |
iprocess.start(); |
|
596 |
iTask.start(); |
|
597 |
} |
|
598 |
}; |
|
599 |
} |
|
600 |
|
|
601 |
/** |
|
602 |
* <p> |
|
603 |
* Create the action that will be executed when user pressed the |
|
604 |
* <i>cancel</i> button. |
|
605 |
* </p> |
|
606 |
* |
|
607 |
* @return action that will be executed when user pressed the |
|
608 |
* <i>cancel</i> |
|
609 |
* button |
|
610 |
*/ |
|
611 |
private ActionListener getCancelAction() { |
|
612 |
// Cancel button action |
|
613 |
return new ActionListener() { |
|
614 |
|
|
615 |
/* |
|
616 |
* @see |
|
617 |
* java.awt.event.ActionListener#actionPerformed(java.awt.event |
|
618 |
* .ActionEvent) |
|
619 |
*/ |
|
620 |
public void actionPerformed(ActionEvent e) { |
|
621 |
closeThis(); |
|
622 |
} |
|
623 |
}; |
|
624 |
} |
|
625 |
} |
|
626 |
|
|
627 |
/** |
|
628 |
* <p> |
|
629 |
* Closes this window. |
|
630 |
* </p> |
|
631 |
*/ |
|
632 |
private void closeThis() { |
|
633 |
PluginServices.getMDIManager().closeWindow(this); |
|
634 |
} |
|
635 |
|
|
636 |
/** |
|
637 |
* |
|
638 |
* |
|
639 |
* |
|
640 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
641 |
*/ |
|
642 |
private class SideInfo { |
|
643 |
|
|
644 |
private byte side; |
|
645 |
private String name; |
|
646 |
|
|
647 |
public SideInfo(byte side, String name) { |
|
648 |
this.side = side; |
|
649 |
this.name = name; |
|
650 |
} |
|
651 |
|
|
652 |
public String toString() { |
|
653 |
return name; |
|
654 |
} |
|
655 |
|
|
656 |
public String getName() { |
|
657 |
return name; |
|
658 |
} |
|
659 |
|
|
660 |
public byte getSide() { |
|
661 |
return side; |
|
662 |
} |
|
663 |
} |
|
664 |
|
|
665 |
public Object getWindowProfile() { |
|
666 |
return WindowInfo.DIALOG_PROFILE; |
|
667 |
} |
|
668 |
} |
|
0 | 669 |
tags/org.gvsig.desktop-2.0.87/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/src/main/java/org/gvsig/selectiontools/app/extension/tools/buffer/process/BufferSelectionProcess.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 3 |
|
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.selectiontools.app.extension.tools.buffer.process; |
|
25 |
|
|
26 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
27 |
* |
|
28 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
29 |
* of the Valencian Government (CIT) |
|
30 |
* |
|
31 |
* This program is free software; you can redistribute it and/or |
|
32 |
* modify it under the terms of the GNU General Public License |
|
33 |
* as published by the Free Software Foundation; either version 2 |
|
34 |
* of the License, or (at your option) any later version. |
|
35 |
* |
|
36 |
* This program is distributed in the hope that it will be useful, |
|
37 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
38 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
39 |
* GNU General Public License for more details. |
|
40 |
* |
|
41 |
* You should have received a copy of the GNU General Public License |
|
42 |
* along with this program; if not, write to the Free Software |
|
43 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
44 |
* MA 02110-1301, USA. |
|
45 |
* |
|
46 |
*/ |
|
47 |
|
|
48 |
import java.awt.event.MouseAdapter; |
|
49 |
import java.awt.event.MouseEvent; |
|
50 |
import java.util.ArrayList; |
|
51 |
import java.util.Iterator; |
|
52 |
|
|
53 |
import javax.swing.JButton; |
|
54 |
|
|
55 |
import org.cresques.cts.ICoordTrans; |
|
56 |
import org.cresques.cts.IProjection; |
|
57 |
import org.gvsig.andami.PluginServices; |
|
58 |
import org.gvsig.andami.messages.NotificationManager; |
|
59 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
60 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
61 |
import org.gvsig.fmap.dal.DataSet; |
|
62 |
import org.gvsig.fmap.dal.feature.Feature; |
|
63 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
64 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
65 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
66 |
import org.gvsig.fmap.geom.Geometry; |
|
67 |
import org.gvsig.fmap.geom.GeometryException; |
|
68 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
|
69 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
70 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
71 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
72 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
73 |
import org.gvsig.gui.beans.incrementabletask.IncrementableProcess; |
|
74 |
import org.gvsig.gui.beans.incrementabletask.IncrementableTask; |
|
75 |
import org.gvsig.selectiontools.app.extension.tools.buffer.gui.BufferConfigurationPanel; |
|
76 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
77 |
|
|
78 |
/** |
|
79 |
* |
|
80 |
* |
|
81 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
82 |
*/ |
|
83 |
public class BufferSelectionProcess extends IncrementableProcess { |
|
84 |
|
|
85 |
// private boolean layerWasBeingEdited = false; |
|
86 |
|
|
87 |
private MapControl mapControl = null; |
Also available in: Unified diff