Revision 1075
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.geoprocess.algorithm</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>org.gvsig.geoprocess.algorithm</name> |
|
8 |
|
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.geoprocess</artifactId> |
|
12 |
<version>2.2.93</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<dependencies> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.geoprocess.app.mainplugin</artifactId> |
|
19 |
<scope>compile</scope> |
|
20 |
</dependency> |
|
21 |
<dependency> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<artifactId>org.gvsig.geoprocess.lib.api</artifactId> |
|
24 |
<scope>compile</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.geoprocess.lib.sextante</artifactId> |
|
29 |
<scope>compile</scope> |
|
30 |
</dependency> |
|
31 |
<dependency> |
|
32 |
<groupId>com.vividsolutions</groupId> |
|
33 |
<artifactId>jts</artifactId> |
|
34 |
<scope>compile</scope> |
|
35 |
</dependency> |
|
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
39 |
<scope>compile</scope> |
|
40 |
</dependency> |
|
41 |
<!-- |
|
42 |
<dependency> |
|
43 |
<groupId>org.gvsig</groupId> |
|
44 |
<artifactId>org.gvsig.fmap.geometry.generalpath</artifactId> |
|
45 |
<scope>runtime</scope> |
|
46 |
</dependency> |
|
47 |
<dependency> |
|
48 |
<groupId>org.gvsig</groupId> |
|
49 |
<artifactId>org.gvsig.fmap.geometry.operation</artifactId> |
|
50 |
<scope>compile</scope> |
|
51 |
</dependency> |
|
52 |
--> |
|
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.dal.impl</artifactId> |
|
61 |
<scope>compile</scope> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>org.gvsig</groupId> |
|
65 |
<artifactId>org.gvsig.toolbox.core</artifactId> |
|
66 |
<scope>compile</scope> |
|
67 |
</dependency> |
|
68 |
<dependency> |
|
69 |
<groupId>org.gvsig</groupId> |
|
70 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
71 |
<scope>compile</scope> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>org.gvsig</groupId> |
|
75 |
<artifactId>org.gvsig.i18n</artifactId> |
|
76 |
<scope>compile</scope> |
|
77 |
</dependency> |
|
78 |
<dependency> |
|
79 |
<groupId>org.gvsig</groupId> |
|
80 |
<artifactId>org.gvsig.ui</artifactId> |
|
81 |
<scope>compile</scope> |
|
82 |
</dependency> |
|
83 |
<dependency> |
|
84 |
<groupId>org.gvsig</groupId> |
|
85 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
86 |
<scope>compile</scope> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.gvsig</groupId> |
|
90 |
<artifactId>org.gvsig.projection.cresques.ui</artifactId> |
|
91 |
<scope>compile</scope> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>org.gvsig</groupId> |
|
95 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
96 |
<scope>runtime</scope> |
|
97 |
</dependency> |
|
98 |
<dependency> |
|
99 |
<groupId>org.gvsig</groupId> |
|
100 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
101 |
<scope>compile</scope> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.gvsig</groupId> |
|
105 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
106 |
<scope>compile</scope> |
|
107 |
</dependency> |
|
108 |
<dependency> |
|
109 |
<groupId>org.gvsig</groupId> |
|
110 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
111 |
<scope>compile</scope> |
|
112 |
</dependency> |
|
113 |
</dependencies> |
|
114 |
|
|
115 |
<modules> |
|
116 |
<module>org.gvsig.geoprocess.algorithm.base</module> |
|
117 |
<module>org.gvsig.geoprocess.algorithm.buffer</module> |
|
118 |
<module>org.gvsig.geoprocess.algorithm.clip</module> |
|
119 |
<module>org.gvsig.geoprocess.algorithm.convexhull</module> |
|
120 |
<module>org.gvsig.geoprocess.algorithm.difference</module> |
|
121 |
<module>org.gvsig.geoprocess.algorithm.dissolve</module> |
|
122 |
<module>org.gvsig.geoprocess.algorithm.fusespatially</module> |
|
123 |
<module>org.gvsig.geoprocess.algorithm.intersection</module> |
|
124 |
<module>org.gvsig.geoprocess.algorithm.merge</module> |
|
125 |
<module>org.gvsig.geoprocess.algorithm.reproject</module> |
|
126 |
<module>org.gvsig.geoprocess.algorithm.union</module> |
|
127 |
<module>org.gvsig.geoprocess.algorithm.xyshift</module> |
|
128 |
<module>org.gvsig.geoprocess.algorithm.spatialjoin</module> |
|
129 |
<module>org.gvsig.geoprocess.algorithm.groupby</module> |
|
130 |
<module>org.gvsig.geoprocess.algorithm.lateralbuffer</module> |
|
131 |
<module>org.gvsig.geoprocess.algorithm.splitlines</module> |
|
132 |
<module>org.gvsig.geoprocess.algorithm.dispersepoints</module> |
|
133 |
</modules> |
|
134 |
</project> |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.difference/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.geoprocess.algorithm.difference</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.geoprocess.algorithm.difference</name> |
|
7 |
|
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.geoprocess.algorithm</artifactId> |
|
11 |
<version>2.2.93</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
<dependencies> |
|
15 |
<dependency> |
|
16 |
<groupId>org.gvsig</groupId> |
|
17 |
<artifactId>org.gvsig.geoprocess.algorithm.base</artifactId> |
|
18 |
<scope>compile</scope> |
|
19 |
</dependency> |
|
20 |
</dependencies> |
|
21 |
|
|
22 |
</project> |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.difference/src/main/resources/org/gvsig/geoprocess/algorithm/difference/difference.properties | ||
---|---|---|
1 |
# |
|
2 |
# gvSIG. Desktop Geographic Information System. |
|
3 |
# |
|
4 |
# Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
# |
|
6 |
# This program is free software; you can redistribute it and/or |
|
7 |
# modify it under the terms of the GNU General Public License |
|
8 |
# as published by the Free Software Foundation; either version 2 |
|
9 |
# of the License, or (at your option) any later version. |
|
10 |
# |
|
11 |
# This program is distributed in the hope that it will be useful, |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
# GNU General Public License for more details. |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU General Public License |
|
17 |
# along with this program; if not, write to the Free Software |
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
# MA 02110-1301, USA. |
|
20 |
# |
|
21 |
# For any additional information, do not hesitate to contact us |
|
22 |
# at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
# |
|
24 |
|
|
25 |
basic_vect_algorithms=Capas vectoriales |
|
26 |
Difference=Diferencia |
|
27 |
Input_layer=Capa de entrada |
|
28 |
Overlays_layer=Capa de revestimiento |
|
29 |
Selected_geometries=Geometrias seleccionadas |
|
30 |
Selected_geometries_input_layer_dif=Geom. seleccionadas(Capa entrada) |
|
31 |
Selected_geometries_overlay_layer_dif=Geom. seleccionadas(Capa revestimiento) |
|
32 |
problems_with_some_geometries=El proceso ha terminado pero ocurri? un error en alguna geometr?a. Es posible que el resultado no sea del todo exacto. Consulte el log. |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.difference/src/main/resources/org/gvsig/geoprocess/algorithm/difference/difference_en.properties | ||
---|---|---|
1 |
# |
|
2 |
# gvSIG. Desktop Geographic Information System. |
|
3 |
# |
|
4 |
# Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
# |
|
6 |
# This program is free software; you can redistribute it and/or |
|
7 |
# modify it under the terms of the GNU General Public License |
|
8 |
# as published by the Free Software Foundation; either version 2 |
|
9 |
# of the License, or (at your option) any later version. |
|
10 |
# |
|
11 |
# This program is distributed in the hope that it will be useful, |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
# GNU General Public License for more details. |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU General Public License |
|
17 |
# along with this program; if not, write to the Free Software |
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
# MA 02110-1301, USA. |
|
20 |
# |
|
21 |
# For any additional information, do not hesitate to contact us |
|
22 |
# at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
# |
|
24 |
|
|
25 |
basic_vect_algorithms=Vector layers tools |
|
26 |
Difference=Difference |
|
27 |
Input_layer=Input cover |
|
28 |
Overlays_layer=Overlay cover |
|
29 |
Selected_geometries=Selected features |
|
30 |
Selected_geometries_input_layer_dif=Selected features (Input cover) |
|
31 |
Selected_geometries_overlay_layer_dif=Selected features (Overlay cover) |
|
32 |
problems_with_some_geometries=The process has ended but an error happened in some geometry. Maybe the result not be totally accuracy. See the log. |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.difference/src/main/resources/help/DifferenceAlgorithm.xml | ||
---|---|---|
1 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 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 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 |
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 |
<help> |
|
28 |
<element name="DESCRIPTION" text='El geoproceso diferencia trabaja con dos capas: la capa de entrada y la capa de solape. Es conocido como NOT Espacial, y permite obtener aquellas zonas de una capa que no están presentes en la otra capa. Las geometrías tanto de la "capa de entrada" como de la "capa de solape" pueden ser polígonos, líneas o de puntos. La capa resultante conservará intacto el esquema alfanumérico de la capa de entrada, pues al fin y al cabo nos viene a dar más información sobre ésta: aquellas zonas que son geométricamente disjuntas de la geometría de la capa de solape. Este Geoproceso puede ser de gran utilidad en numerosas situaciones. Por ejemplo, se puede considerar como el complemento (contrario) del Geoproceso Recortar/Clip. Si Recortar permite excluir todo aquello que no pertenezca a un ámbito geográfico de estudio, Diferencia permite realizar justamente lo contrario: excluir de nuestra capa de trabajo un determinado ámbito. Esto es de utilidad por ejemplo en el caso de traspaso de competencias territoriales entre diferentes Administraciones. Así, si una Administración Estatal traspasa determinadas competencias a una Regional, puede decidir excluir de sus bases de datos la zona geográfica objeto del traspaso.' description="Descripción" type="0"> |
|
29 |
<image description="" file="differencedesc.png"> |
|
30 |
</image> |
|
31 |
</element> |
|
32 |
<element name="ADDITIONAL_INFO" text="" description="Información adicional" type="0"> |
|
33 |
</element> |
|
34 |
<element name="EXTENSION_AUTHOR" text="Nacho Brodin" description="Algoritmo creado por" type="0"> |
|
35 |
</element> |
|
36 |
<element name="HELP_AUTHOR" text="" description="Ayuda creada por" type="0"> |
|
37 |
</element> |
|
38 |
<element name="USER_NOTES" text="" description="Notas de usuario" type="0"> |
|
39 |
</element> |
|
40 |
<element name="LAYER" text="" description="Capa de entrada" type="3"> |
|
41 |
</element> |
|
42 |
<element name="DIF" text="" description="Capa de revestimiento" type="3"> |
|
43 |
</element> |
|
44 |
<element name="CHECK" text="" description="Geometrias seleccionadas" type="3"> |
|
45 |
</element> |
|
46 |
<element name="OUTPUT_DESCRIPTION" text="" description="Descripción" type="2"> |
|
47 |
</element> |
|
48 |
<element name="RESULT" text="" description="Diferencia" type="2"> |
|
49 |
</element> |
|
50 |
</help> |
|
51 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.difference/src/main/resources/help/DifferenceAlgorithm_en.xml | ||
---|---|---|
1 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 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 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 |
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 |
<help> |
|
28 |
<element name="DESCRIPTION" text='This geoprocess is an overlay geoprocess. It work with two layers: the input layer and the overlay layer. It is usually called "Spatial NOT", because it stracts the geometry of a layer which is not in the other layer. By desing it only work with polygon layers (input and overlay). Result layer will have the alphanumeric schema of the input layer.' description="Descripción" type="0"> |
|
29 |
<image description="" file="differencedesc.png"> |
|
30 |
</image> |
|
31 |
</element> |
|
32 |
<element name="ADDITIONAL_INFO" text="" description="Información adicional" type="0"> |
|
33 |
</element> |
|
34 |
<element name="EXTENSION_AUTHOR" text="Nacho Brodin" description="Algoritmo creado por" type="0"> |
|
35 |
</element> |
|
36 |
<element name="HELP_AUTHOR" text="" description="Ayuda creada por" type="0"> |
|
37 |
</element> |
|
38 |
<element name="USER_NOTES" text="" description="Notas de usuario" type="0"> |
|
39 |
</element> |
|
40 |
<element name="LAYER" text="" description="Capa de entrada" type="3"> |
|
41 |
</element> |
|
42 |
<element name="DIF" text="" description="Capa de revestimiento" type="3"> |
|
43 |
</element> |
|
44 |
<element name="CHECK" text="" description="Geometrias seleccionadas" type="3"> |
|
45 |
</element> |
|
46 |
<element name="OUTPUT_DESCRIPTION" text="" description="Descripción" type="2"> |
|
47 |
</element> |
|
48 |
<element name="RESULT" text="" description="Diferencia" type="2"> |
|
49 |
</element> |
|
50 |
</help> |
|
51 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.difference/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.geoprocess.algorithm.difference.DifferenceLibrary |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.difference/src/main/java/org/gvsig/geoprocess/algorithm/difference/DifferenceOperation.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
|
|
26 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
27 |
* |
|
28 |
* Copyright (C) 2010 Generalitat Valenciana. |
|
29 |
* |
|
30 |
* This program is free software; you can redistribute it and/or |
|
31 |
* modify it under the terms of the GNU General Public License |
|
32 |
* as published by the Free Software Foundation; either version 2 |
|
33 |
* of the License, or (at your option) any later version. |
|
34 |
* |
|
35 |
* This program is distributed in the hope that it will be useful, |
|
36 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
37 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
38 |
* GNU General Public License for more details. |
|
39 |
* |
|
40 |
* You should have received a copy of the GNU General Public License |
|
41 |
* along with this program; if not, write to the Free Software |
|
42 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
43 |
*/ |
|
44 |
|
|
45 |
package org.gvsig.geoprocess.algorithm.difference; |
|
46 |
|
|
47 |
import com.vividsolutions.jts.geom.Geometry; |
|
48 |
import com.vividsolutions.jts.precision.EnhancedPrecisionOp; |
|
49 |
|
|
50 |
import es.unex.sextante.core.Sextante; |
|
51 |
|
|
52 |
import org.gvsig.fmap.dal.exception.DataException; |
|
53 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
54 |
import org.gvsig.fmap.dal.feature.Feature; |
|
55 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
56 |
import org.gvsig.geoprocess.algorithm.base.core.GeometryOperation; |
|
57 |
import org.gvsig.geoprocess.algorithm.base.util.GeometryUtil; |
|
58 |
import org.gvsig.geoprocess.lib.sextante.AbstractSextanteGeoProcess; |
|
59 |
import org.slf4j.Logger; |
|
60 |
import org.slf4j.LoggerFactory; |
|
61 |
/** |
|
62 |
* Difference between two geometries |
|
63 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
64 |
*/ |
|
65 |
public class DifferenceOperation extends GeometryOperation { |
|
66 |
private Logger log = LoggerFactory.getLogger(DifferenceOperation.class); |
|
67 |
private boolean errorInfo = false; |
|
68 |
|
|
69 |
/** |
|
70 |
* Clipping geometry: the convex hull of the |
|
71 |
* clipping layer |
|
72 |
*/ |
|
73 |
private Geometry overlaysGeom = null; |
|
74 |
|
|
75 |
public DifferenceOperation(org.gvsig.fmap.geom.Geometry overlays, AbstractSextanteGeoProcess p) { |
|
76 |
super(p); |
|
77 |
if(overlays != null) |
|
78 |
this.overlaysGeom = GeometryUtil.geomToJTS(overlays); |
|
79 |
} |
|
80 |
|
|
81 |
public boolean getErrorInfo() { |
|
82 |
return errorInfo; |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* clips feature's geometry with the clipping geometry, preserving |
|
87 |
* feature's original attributes. |
|
88 |
* If feature's geometry doesn't touch clipping geometry, it will be |
|
89 |
* ignored. |
|
90 |
*/ |
|
91 |
public EditableFeature invoke(org.gvsig.fmap.geom.Geometry g, Feature feature) { |
|
92 |
if(g == null) |
|
93 |
return lastEditFeature; |
|
94 |
|
|
95 |
com.vividsolutions.jts.geom.Geometry jtsGeom = GeometryUtil.geomToJTS(g); |
|
96 |
|
|
97 |
try { |
|
98 |
if(overlaysGeom == null) |
|
99 |
return persister.addFeature(feature, jtsGeom); |
|
100 |
|
|
101 |
if(!jtsGeom.getEnvelope().intersects(overlaysGeom.getEnvelope())) { |
|
102 |
lastEditFeature = persister.addFeature(feature, jtsGeom); |
|
103 |
return lastEditFeature; |
|
104 |
} |
|
105 |
|
|
106 |
if(jtsGeom.intersects(overlaysGeom)) { |
|
107 |
try { |
|
108 |
Geometry newGeom = EnhancedPrecisionOp.difference(jtsGeom, overlaysGeom); |
|
109 |
if(!newGeom.isEmpty()) |
|
110 |
lastEditFeature = persister.addFeature(feature, newGeom); |
|
111 |
} catch (com.vividsolutions.jts.geom.TopologyException e) { |
|
112 |
errorInfo = true; |
|
113 |
log.info("Problems operating difference: ", e); |
|
114 |
} |
|
115 |
} else |
|
116 |
lastEditFeature = persister.addFeature(feature, jtsGeom); |
|
117 |
} catch (CreateGeometryException e) { |
|
118 |
Sextante.addErrorToLog(e); |
|
119 |
} catch (DataException e) { |
|
120 |
Sextante.addErrorToLog(e); |
|
121 |
} |
|
122 |
return lastEditFeature; |
|
123 |
} |
|
124 |
|
|
125 |
/** |
|
126 |
* clips feature's geometry with the clipping geometry, preserving |
|
127 |
* feature's original attributes. |
|
128 |
* If feature's geometry doesn't touch clipping geometry, it will be |
|
129 |
* ignored. |
|
130 |
*/ |
|
131 |
public void invoke(org.gvsig.fmap.geom.Geometry g, EditableFeature feature) { |
|
132 |
if(g == null) |
|
133 |
return; |
|
134 |
|
|
135 |
com.vividsolutions.jts.geom.Geometry jtsGeom = GeometryUtil.geomToJTS(g); |
|
136 |
|
|
137 |
try { |
|
138 |
if(overlaysGeom == null) |
|
139 |
persister.addFeature(feature, jtsGeom); |
|
140 |
|
|
141 |
if(!jtsGeom.getEnvelope().intersects(overlaysGeom.getEnvelope())) |
|
142 |
persister.addFeature(feature, jtsGeom); |
|
143 |
|
|
144 |
if(jtsGeom.intersects(overlaysGeom)) { |
|
145 |
try { |
|
146 |
Geometry newGeom = EnhancedPrecisionOp.difference(jtsGeom, overlaysGeom); |
|
147 |
persister.addFeature(feature, newGeom); |
|
148 |
} catch (CreateGeometryException e) { |
|
149 |
Sextante.addErrorToLog(e); |
|
150 |
} catch (DataException e) { |
|
151 |
Sextante.addErrorToLog(e); |
|
152 |
} |
|
153 |
} else |
|
154 |
persister.addFeature(feature, jtsGeom); |
|
155 |
} catch (DataException e) { |
|
156 |
Sextante.addErrorToLog(e); |
|
157 |
} catch (CreateGeometryException e) { |
|
158 |
Sextante.addErrorToLog(e); |
|
159 |
} |
|
160 |
} |
|
161 |
|
|
162 |
} |
|
163 |
|
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.difference/src/main/java/org/gvsig/geoprocess/algorithm/difference/DifferenceLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.difference; |
|
25 |
|
|
26 |
import org.gvsig.geoprocess.algorithm.base.core.AlgorithmAbstractLibrary; |
|
27 |
import org.gvsig.i18n.Messages; |
|
28 |
import org.gvsig.tools.library.LibraryException; |
|
29 |
|
|
30 |
/** |
|
31 |
* Initialization of DifferenceLibrary library. |
|
32 |
* |
|
33 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
34 |
*/ |
|
35 |
public class DifferenceLibrary extends AlgorithmAbstractLibrary { |
|
36 |
|
|
37 |
@Override |
|
38 |
protected void doInitialize() throws LibraryException { |
|
39 |
|
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
protected void doPostInitialize() throws LibraryException { |
|
44 |
Messages.addResourceFamily( |
|
45 |
"org.gvsig.geoprocess.algorithm.difference.difference", |
|
46 |
DifferenceLibrary.class.getClassLoader(), DifferenceLibrary.class |
|
47 |
.getClass().getName()); |
|
48 |
registerGeoProcess(new DifferenceAlgorithm()); |
|
49 |
} |
|
50 |
|
|
51 |
} |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.difference/src/main/java/org/gvsig/geoprocess/algorithm/difference/DifferenceAlgorithm.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.difference; |
|
25 |
|
|
26 |
import javax.swing.JOptionPane; |
|
27 |
|
|
28 |
import org.gvsig.fmap.dal.exception.DataException; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
30 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
31 |
import org.gvsig.geoprocess.algorithm.base.core.ScalableUnionOperation; |
|
32 |
import org.gvsig.geoprocess.lib.sextante.AbstractSextanteGeoProcess; |
|
33 |
import org.gvsig.geoprocess.lib.sextante.dataObjects.FlyrVectIVectorLayer; |
|
34 |
|
|
35 |
import es.unex.sextante.core.Sextante; |
|
36 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
37 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
|
38 |
import es.unex.sextante.exceptions.RepeatedParameterNameException; |
|
39 |
import es.unex.sextante.outputs.OutputVectorLayer; |
|
40 |
|
|
41 |
/** |
|
42 |
* Difference algorithm |
|
43 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
44 |
*/ |
|
45 |
public class DifferenceAlgorithm extends AbstractSextanteGeoProcess { |
|
46 |
public static final String RESULT_POL = "RESULT_POL"; |
|
47 |
public static final String RESULT_POINT = "RESULT_POINT"; |
|
48 |
public static final String RESULT_LINE = "RESULT_LINE"; |
|
49 |
public static final String LAYER = "LAYER"; |
|
50 |
public static final String DIF = "DIF"; |
|
51 |
public static final String SELECTGEOM_INPUT = "SELECTGEOM_INPUT"; |
|
52 |
public static final String SELECTGEOM_OVERLAY = "SELECTGEOM_OVERLAY"; |
|
53 |
|
|
54 |
public void defineCharacteristics(){ |
|
55 |
setName(getTranslation("Difference")); |
|
56 |
setGroup(getTranslation("basic_vect_algorithms")); |
|
57 |
// setGeneratesUserDefinedRasterOutput(false); |
|
58 |
|
|
59 |
try { |
|
60 |
m_Parameters.addInputVectorLayer(LAYER, getTranslation("Input_layer"), |
|
61 |
IVectorLayer.SHAPE_TYPE_WRONG, |
|
62 |
true); |
|
63 |
m_Parameters.addInputVectorLayer(DIF, getTranslation("Overlays_layer"), |
|
64 |
IVectorLayer.SHAPE_TYPE_WRONG, |
|
65 |
true); |
|
66 |
m_Parameters.addBoolean(SELECTGEOM_INPUT, |
|
67 |
getTranslation("Selected_geometries_input_layer_dif"), false); |
|
68 |
m_Parameters.addBoolean(SELECTGEOM_OVERLAY, |
|
69 |
getTranslation("Selected_geometries_overlay_layer_dif"), false); |
|
70 |
} catch (RepeatedParameterNameException e) { |
|
71 |
Sextante.addErrorToLog(e); |
|
72 |
} |
|
73 |
|
|
74 |
addOutputVectorLayer(RESULT_POL, getTranslation("Difference_polygon"), |
|
75 |
OutputVectorLayer.SHAPE_TYPE_POLYGON); |
|
76 |
addOutputVectorLayer(RESULT_LINE, getTranslation("Difference_line"), |
|
77 |
OutputVectorLayer.SHAPE_TYPE_LINE); |
|
78 |
addOutputVectorLayer(RESULT_POINT, getTranslation("Difference_point"), |
|
79 |
OutputVectorLayer.SHAPE_TYPE_POINT); |
|
80 |
} |
|
81 |
|
|
82 |
/* |
|
83 |
* (non-Javadoc) |
|
84 |
* @see es.unex.sextante.core.GeoAlgorithm#processAlgorithm() |
|
85 |
*/ |
|
86 |
public boolean processAlgorithm() throws GeoAlgorithmExecutionException { |
|
87 |
if(existsOutPutFile(RESULT_POL, 0) || |
|
88 |
existsOutPutFile(RESULT_LINE, 0) || |
|
89 |
existsOutPutFile(RESULT_POINT, 0)) { |
|
90 |
throw new GeoAlgorithmExecutionException(getTranslation("file_exists")); |
|
91 |
} |
|
92 |
org.gvsig.fmap.geom.Geometry overlayGeometry = null; |
|
93 |
IVectorLayer dif = m_Parameters.getParameterValueAsVectorLayer(DIF); |
|
94 |
IVectorLayer layer = m_Parameters.getParameterValueAsVectorLayer(LAYER); |
|
95 |
boolean selectedGeomInput = m_Parameters.getParameter(SELECTGEOM_INPUT).getParameterValueAsBoolean(); |
|
96 |
boolean selectedGeomOutput = m_Parameters.getParameter(SELECTGEOM_OVERLAY).getParameterValueAsBoolean(); |
|
97 |
|
|
98 |
try { |
|
99 |
overlayGeometry = ScalableUnionOperation.joinLayerGeometries(dif, selectedGeomOutput); |
|
100 |
} catch (Exception e) { |
|
101 |
Sextante.addErrorToLog(e); |
|
102 |
return false; |
|
103 |
} |
|
104 |
|
|
105 |
FeatureStore storeLayer = null; |
|
106 |
if(layer instanceof FlyrVectIVectorLayer) |
|
107 |
storeLayer = ((FlyrVectIVectorLayer)layer).getFeatureStore(); |
|
108 |
else |
|
109 |
return false; |
|
110 |
|
|
111 |
DifferenceOperation operation = null; |
|
112 |
|
|
113 |
try { |
|
114 |
FeatureType featureType = storeLayer.getDefaultFeatureType(); |
|
115 |
|
|
116 |
operation = new DifferenceOperation(overlayGeometry, this); |
|
117 |
operation.setTaskStatus(getStatus()); |
|
118 |
|
|
119 |
if (isPolygon(storeLayer) || isUndefined(storeLayer)) { |
|
120 |
FeatureStore outFeatStore = |
|
121 |
buildOutPutStore(featureType, IVectorLayer.SHAPE_TYPE_POLYGON, |
|
122 |
getTranslation("Difference_polygon"), RESULT_POL); |
|
123 |
|
|
124 |
operation.computesGeometryOperation(storeLayer, outFeatStore, |
|
125 |
attrNames, selectedGeomInput, selectedGeomOutput, true); |
|
126 |
} else { |
|
127 |
buildOutPutStore(featureType, IVectorLayer.SHAPE_TYPE_POLYGON, |
|
128 |
getTranslation("Null_polygon"), RESULT_POL); |
|
129 |
} |
|
130 |
|
|
131 |
if (isLine(storeLayer) || isUndefined(storeLayer)) { |
|
132 |
FeatureStore outFeatStore = |
|
133 |
buildOutPutStore(featureType, IVectorLayer.SHAPE_TYPE_LINE, |
|
134 |
getTranslation("Difference_line"), RESULT_LINE); |
|
135 |
|
|
136 |
operation.computesGeometryOperation(storeLayer, outFeatStore, |
|
137 |
attrNames, selectedGeomInput, selectedGeomOutput, true); |
|
138 |
} else { |
|
139 |
buildOutPutStore(featureType.getCopy(), IVectorLayer.SHAPE_TYPE_LINE, |
|
140 |
getTranslation("Null_line"), RESULT_LINE); |
|
141 |
} |
|
142 |
|
|
143 |
if (isPoint(storeLayer) || isUndefined(storeLayer)) { |
|
144 |
FeatureStore outFeatStore = |
|
145 |
buildOutPutStore(featureType.getCopy(), IVectorLayer.SHAPE_TYPE_POINT, |
|
146 |
getTranslation("Difference_point"), RESULT_POINT); |
|
147 |
|
|
148 |
operation.computesGeometryOperation(storeLayer, outFeatStore, |
|
149 |
attrNames, selectedGeomInput, selectedGeomOutput, true); |
|
150 |
} else { |
|
151 |
buildOutPutStore(featureType.getCopy(), IVectorLayer.SHAPE_TYPE_POINT, |
|
152 |
getTranslation("Null_point"), RESULT_POINT); |
|
153 |
} |
|
154 |
|
|
155 |
} catch (DataException e) { |
|
156 |
Sextante.addErrorToLog(e); |
|
157 |
return false; |
|
158 |
} |
|
159 |
if(getTaskMonitor().isCanceled()) |
|
160 |
return false; |
|
161 |
if(operation != null && operation.getErrorInfo()) |
|
162 |
JOptionPane.showMessageDialog(null, |
|
163 |
getTranslation("problems_with_some_geometries"), "Error", |
|
164 |
JOptionPane.WARNING_MESSAGE); |
|
165 |
return true; |
|
166 |
} |
|
167 |
|
|
168 |
} |
|
0 | 169 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.reproject/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.geoprocess.algorithm.reproject.ReprojectLibrary |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.reproject/src/main/resources/org/gvsig/geoprocess/algorithm/reproject/reproject_en.properties | ||
---|---|---|
1 |
# |
|
2 |
# gvSIG. Desktop Geographic Information System. |
|
3 |
# |
|
4 |
# Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
# |
|
6 |
# This program is free software; you can redistribute it and/or |
|
7 |
# modify it under the terms of the GNU General Public License |
|
8 |
# as published by the Free Software Foundation; either version 2 |
|
9 |
# of the License, or (at your option) any later version. |
|
10 |
# |
|
11 |
# This program is distributed in the hope that it will be useful, |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
# GNU General Public License for more details. |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU General Public License |
|
17 |
# along with this program; if not, write to the Free Software |
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
# MA 02110-1301, USA. |
|
20 |
# |
|
21 |
# For any additional information, do not hesitate to contact us |
|
22 |
# at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
# |
|
24 |
|
|
25 |
basic_vect_algorithms=Vector layers tools |
|
26 |
Reproject=Reproject |
|
27 |
Input_layer=Input cover |
|
28 |
Selected_geometries=Selected geometries |
|
29 |
Projection=Projection |
|
30 |
Proyeccion_Destino=Projection of destination |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.reproject/src/main/resources/org/gvsig/geoprocess/algorithm/reproject/reproject.properties | ||
---|---|---|
1 |
# |
|
2 |
# gvSIG. Desktop Geographic Information System. |
|
3 |
# |
|
4 |
# Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
# |
|
6 |
# This program is free software; you can redistribute it and/or |
|
7 |
# modify it under the terms of the GNU General Public License |
|
8 |
# as published by the Free Software Foundation; either version 2 |
|
9 |
# of the License, or (at your option) any later version. |
|
10 |
# |
|
11 |
# This program is distributed in the hope that it will be useful, |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
# GNU General Public License for more details. |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU General Public License |
|
17 |
# along with this program; if not, write to the Free Software |
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
# MA 02110-1301, USA. |
|
20 |
# |
|
21 |
# For any additional information, do not hesitate to contact us |
|
22 |
# at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
# |
|
24 |
|
|
25 |
basic_vect_algorithms=Capas vectoriales |
|
26 |
Reproject=Reproyecci?n |
|
27 |
Input_layer=Capa de entrada |
|
28 |
Selected_geometries=Geometrias seleccionadas |
|
29 |
Projection=Proyecci?n |
|
30 |
Proyeccion_Destino=Proyecci?n destino |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.reproject/src/main/resources/help/ReprojectAlgorithm.xml | ||
---|---|---|
1 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 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 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 |
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 |
<help> |
|
28 |
<element name="DESCRIPTION" text="Este geoproceso permite cambiar la proyección geodésica de los elementos vectoriales de la capa de entrada. Para tal fín, el usuario deberá especificar la nueva proyección a aplicar. Este geoproceso puede ser de gran utilidad para hacer concordar cartografías en un mismo proyecto cartografías que se encuentran en proyecciones distintas." description="Descripción" type="0"> |
|
29 |
<image description="" file="reprojectdesc.png"> |
|
30 |
</image> |
|
31 |
</element> |
|
32 |
<element name="ADDITIONAL_INFO" text="" description="Información adicional" type="0"> |
|
33 |
</element> |
|
34 |
<element name="EXTENSION_AUTHOR" text="Nacho Brodin" description="Algoritmo creado por" type="0"> |
|
35 |
</element> |
|
36 |
<element name="HELP_AUTHOR" text="" description="Ayuda creada por" type="0"> |
|
37 |
</element> |
|
38 |
<element name="USER_NOTES" text="" description="Notas de usuario" type="0"> |
|
39 |
</element> |
|
40 |
<element name="LAYER" text="" description="Capa de entrada" type="3"> |
|
41 |
</element> |
|
42 |
<element name="SELECTED_GEOM" text="" description="Geometrias seleccionadas" type="3"> |
|
43 |
</element> |
|
44 |
<element name="DST_PROJECTION" text="" description="Proyección" type="3"> |
|
45 |
</element> |
|
46 |
<element name="OUTPUT_DESCRIPTION" text="" description="Descripción" type="2"> |
|
47 |
</element> |
|
48 |
<element name="RESULT" text="" description="Reproyección" type="2"> |
|
49 |
</element> |
|
50 |
</help> |
|
51 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.reproject/src/main/resources/help/ReprojectAlgorithm_en.xml | ||
---|---|---|
1 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 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 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 |
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 |
<help> |
|
28 |
<element name="DESCRIPTION" text="This geoprocess reproject all features of the input layer. To do that, user must specify the new projection for them. This is useful to load layers with different projections in a same project." description="Descripción" type="0"> |
|
29 |
<image description="" file="reprojectdesc.png"> |
|
30 |
</image> |
|
31 |
</element> |
|
32 |
<element name="ADDITIONAL_INFO" text="" description="Información adicional" type="0"> |
|
33 |
</element> |
|
34 |
<element name="EXTENSION_AUTHOR" text="Nacho Brodin" description="Algoritmo creado por" type="0"> |
|
35 |
</element> |
|
36 |
<element name="HELP_AUTHOR" text="" description="Ayuda creada por" type="0"> |
|
37 |
</element> |
|
38 |
<element name="USER_NOTES" text="" description="Notas de usuario" type="0"> |
|
39 |
</element> |
|
40 |
<element name="LAYER" text="" description="Capa de entrada" type="3"> |
|
41 |
</element> |
|
42 |
<element name="SELECTED_GEOM" text="" description="Geometrias seleccionadas" type="3"> |
|
43 |
</element> |
|
44 |
<element name="DST_PROJECTION" text="" description="Proyección" type="3"> |
|
45 |
</element> |
|
46 |
<element name="OUTPUT_DESCRIPTION" text="" description="Descripción" type="2"> |
|
47 |
</element> |
|
48 |
<element name="RESULT" text="" description="Reproyección" type="2"> |
|
49 |
</element> |
|
50 |
</help> |
|
51 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.reproject/src/main/java/org/gvsig/geoprocess/algorithm/reproject/ReprojectAlgorithm.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.reproject; |
|
25 |
|
|
26 |
import org.cresques.cts.IProjection; |
|
27 |
import org.gvsig.fmap.crs.CRSFactory; |
|
28 |
import org.gvsig.fmap.dal.exception.DataException; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
30 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
31 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
32 |
import org.gvsig.geoprocess.lib.sextante.AbstractSextanteGeoProcess; |
|
33 |
import org.gvsig.geoprocess.lib.sextante.dataObjects.FlyrVectIVectorLayer; |
|
34 |
|
|
35 |
import es.unex.sextante.core.Sextante; |
|
36 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
37 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
|
38 |
import es.unex.sextante.exceptions.RepeatedParameterNameException; |
|
39 |
import es.unex.sextante.gui.algorithm.GeoAlgorithmParametersPanel; |
|
40 |
import es.unex.sextante.outputs.OutputVectorLayer; |
|
41 |
|
|
42 |
/** |
|
43 |
* Reproject algorithm |
|
44 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
45 |
*/ |
|
46 |
public class ReprojectAlgorithm extends AbstractSextanteGeoProcess { |
|
47 |
public static final String RESULT_POL = "RESULT_POL"; |
|
48 |
public static final String RESULT_POINT = "RESULT_POINT"; |
|
49 |
public static final String RESULT_LINE = "RESULT_LINE"; |
|
50 |
public static final String LAYER = "LAYER"; |
|
51 |
public static final String SELECTED_GEOM = "SELECTED_GEOM"; |
|
52 |
public static final String DST_PROJECTION = "DST_PROJECTION"; |
|
53 |
|
|
54 |
/* |
|
55 |
* (non-Javadoc) |
|
56 |
* @see es.unex.sextante.core.GeoAlgorithm#defineCharacteristics() |
|
57 |
*/ |
|
58 |
public void defineCharacteristics() { |
|
59 |
setName(getTranslation("Reproject")); |
|
60 |
setGroup(getTranslation("basic_vect_algorithms")); |
|
61 |
// setGeneratesUserDefinedRasterOutput(false); |
|
62 |
|
|
63 |
try { |
|
64 |
m_Parameters.addInputVectorLayer(LAYER, |
|
65 |
getTranslation("Input_layer"), |
|
66 |
IVectorLayer.SHAPE_TYPE_WRONG, |
|
67 |
true); |
|
68 |
m_Parameters.addBoolean(SELECTED_GEOM, |
|
69 |
getTranslation("Selected_geometries"), |
|
70 |
false); |
|
71 |
m_Parameters |
|
72 |
.addString(DST_PROJECTION, getTranslation("Projection")); |
|
73 |
|
|
74 |
addOutputVectorLayer(RESULT_POL, getTranslation("Reproject_polygon"), |
|
75 |
OutputVectorLayer.SHAPE_TYPE_POLYGON); |
|
76 |
addOutputVectorLayer(RESULT_LINE, getTranslation("Reproject_line"), |
|
77 |
OutputVectorLayer.SHAPE_TYPE_LINE); |
|
78 |
addOutputVectorLayer(RESULT_POINT, getTranslation("Reproject_point"), |
|
79 |
OutputVectorLayer.SHAPE_TYPE_POINT); |
|
80 |
|
|
81 |
} catch (RepeatedParameterNameException e) { |
|
82 |
Sextante.addErrorToLog(e); |
|
83 |
} |
|
84 |
} |
|
85 |
|
|
86 |
/* |
|
87 |
* (non-Javadoc) |
|
88 |
* @see es.unex.sextante.core.GeoAlgorithm#processAlgorithm() |
|
89 |
*/ |
|
90 |
public boolean processAlgorithm() throws GeoAlgorithmExecutionException { |
|
91 |
if(existsOutPutFile(RESULT_POL, 0) || |
|
92 |
existsOutPutFile(RESULT_LINE, 0) || |
|
93 |
existsOutPutFile(RESULT_POINT, 0)) { |
|
94 |
throw new GeoAlgorithmExecutionException(getTranslation("file_exists")); |
|
95 |
} |
|
96 |
IVectorLayer layer = m_Parameters.getParameterValueAsVectorLayer(LAYER); |
|
97 |
boolean selectedGeom = m_Parameters.getParameterValueAsBoolean(SELECTED_GEOM); |
|
98 |
String dstProj = m_Parameters.getParameterValueAsString(DST_PROJECTION); |
|
99 |
|
|
100 |
FeatureStore storeLayer = null; |
|
101 |
if(layer instanceof FlyrVectIVectorLayer) |
|
102 |
storeLayer = ((FlyrVectIVectorLayer)layer).getFeatureStore(); |
|
103 |
else |
|
104 |
return false; |
|
105 |
|
|
106 |
try { |
|
107 |
FeatureSet features = null; |
|
108 |
features = storeLayer.getFeatureSet(); |
|
109 |
FeatureType featureType = features.getDefaultFeatureType(); |
|
110 |
/*FeatureStore outFeatStore = |
|
111 |
buildOutPutStore(featureType, layer.getShapeType(), |
|
112 |
getTranslation("Reproject"), RESULT); |
|
113 |
IProjection projOutput = CRSFactory.getCRS(dstProj); |
|
114 |
ReprojectOperation operation = new ReprojectOperation(((IProjection)layer.getCRS()), projOutput, this); |
|
115 |
operation.setTaskStatus(getStatus()); |
|
116 |
operation.computesFeatureOperation(storeLayer, outFeatStore, attrNames, selectedGeom, true);*/ |
|
117 |
|
|
118 |
IProjection projOutput = CRSFactory.getCRS(dstProj); |
|
119 |
ReprojectOperation operation = new ReprojectOperation(((IProjection)layer.getCRS()), projOutput, this); |
|
120 |
operation.setTaskStatus(getStatus()); |
|
121 |
|
|
122 |
if (isPolygon(storeLayer) || isUndefined(storeLayer)) { |
|
123 |
FeatureStore outFeatStore = |
|
124 |
buildOutPutStore(featureType, IVectorLayer.SHAPE_TYPE_POLYGON, |
|
125 |
getTranslation("Reproject_polygon"), RESULT_POL); |
|
126 |
operation.computesFeatureOperation(storeLayer, outFeatStore, attrNames, |
|
127 |
selectedGeom, false, true); |
|
128 |
} else { |
|
129 |
buildOutPutStore(featureType, IVectorLayer.SHAPE_TYPE_POLYGON, |
|
130 |
getTranslation("Null_polygon"), RESULT_POL); |
|
131 |
} |
|
132 |
|
|
133 |
if (isLine(storeLayer) || isUndefined(storeLayer)) { |
|
134 |
FeatureStore outFeatStore = |
|
135 |
buildOutPutStore(featureType, IVectorLayer.SHAPE_TYPE_LINE, |
|
136 |
getTranslation("Reproject_line"), RESULT_LINE); |
|
137 |
operation.computesFeatureOperation(storeLayer, outFeatStore, attrNames, |
|
138 |
selectedGeom, false, true); |
|
139 |
} else { |
|
140 |
buildOutPutStore(featureType.getCopy(), IVectorLayer.SHAPE_TYPE_LINE, |
|
141 |
getTranslation("Null_line"), RESULT_LINE); |
|
142 |
} |
|
143 |
|
|
144 |
if (isPoint(storeLayer) || isUndefined(storeLayer)) { |
|
145 |
FeatureStore outFeatStore = |
|
146 |
buildOutPutStore(featureType.getCopy(), IVectorLayer.SHAPE_TYPE_POINT, |
|
147 |
getTranslation("Reproject_point"), RESULT_POINT); |
|
148 |
operation.computesFeatureOperation(storeLayer, outFeatStore, attrNames, |
|
149 |
selectedGeom, false, true); |
|
150 |
} else { |
|
151 |
buildOutPutStore(featureType.getCopy(), IVectorLayer.SHAPE_TYPE_POINT, |
|
152 |
getTranslation("Null_point"), RESULT_POINT); |
|
153 |
} |
|
154 |
} catch (DataException e) { |
|
155 |
Sextante.addErrorToLog(e); |
|
156 |
return false; |
|
157 |
} |
|
158 |
|
|
159 |
if(getTaskMonitor().isCanceled()) |
|
160 |
return false; |
|
161 |
|
|
162 |
return true; |
|
163 |
} |
|
164 |
|
|
165 |
@Override |
|
166 |
public Class<? extends GeoAlgorithmParametersPanel> getCustomParametersPanelClass() { |
|
167 |
return ReprojectParametersPanel.class; |
|
168 |
} |
|
169 |
} |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.reproject/src/main/java/org/gvsig/geoprocess/algorithm/reproject/ReprojectOperation.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.reproject; |
|
25 |
|
|
26 |
import java.util.Iterator; |
|
27 |
import java.util.List; |
|
28 |
|
|
29 |
import es.unex.sextante.core.Sextante; |
|
30 |
|
|
31 |
import org.cresques.cts.ICoordTrans; |
|
32 |
import org.cresques.cts.IProjection; |
|
33 |
|
|
34 |
import org.gvsig.fmap.dal.exception.DataException; |
|
35 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
36 |
import org.gvsig.fmap.dal.feature.Feature; |
|
37 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
38 |
import org.gvsig.geoprocess.algorithm.base.core.GeometryOperation; |
|
39 |
import org.gvsig.geoprocess.lib.sextante.AbstractSextanteGeoProcess; |
|
40 |
|
|
41 |
/** |
|
42 |
* Operation to reproject a Feature |
|
43 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
44 |
*/ |
|
45 |
public class ReprojectOperation extends GeometryOperation { |
|
46 |
private ICoordTrans transf = null; |
|
47 |
|
|
48 |
public ReprojectOperation(IProjection srcProj, IProjection dstProj, AbstractSextanteGeoProcess p) { |
|
49 |
super(p); |
|
50 |
this.transf = srcProj.getCT(dstProj); |
|
51 |
} |
|
52 |
|
|
53 |
/* |
|
54 |
* (non-Javadoc) |
|
55 |
* @see org.gvsig.geoprocess.algorithm.base.core.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.dal.feature.Feature) |
|
56 |
*/ |
|
57 |
@SuppressWarnings("unchecked") |
|
58 |
public EditableFeature invoke(org.gvsig.fmap.geom.Geometry g, Feature feature) { |
|
59 |
List geomList = feature.getGeometries(); |
|
60 |
try { |
|
61 |
if(geomList == null) { |
|
62 |
org.gvsig.fmap.geom.Geometry geom = feature.getDefaultGeometry(); |
|
63 |
geom.reProject(transf); |
|
64 |
EditableFeature editFeat = feature.getEditable(); |
|
65 |
editFeat.setDefaultGeometry(geom); |
|
66 |
persister.addFeature(feature, geom); |
|
67 |
} else { |
|
68 |
Iterator<org.gvsig.fmap.geom.Geometry> itGeom = geomList.iterator(); |
|
69 |
EditableFeature editFeat = null; |
|
70 |
boolean first = true; |
|
71 |
int nGeom = 0; |
|
72 |
while(itGeom.hasNext()) { |
|
73 |
org.gvsig.fmap.geom.Geometry geom = itGeom.next(); |
|
74 |
geom.reProject(transf); |
|
75 |
editFeat = feature.getEditable(); |
|
76 |
editFeat.setGeometry(nGeom, geom); |
|
77 |
nGeom ++; |
|
78 |
if(first) |
|
79 |
persister.addFeature(editFeat, geom); |
|
80 |
else |
|
81 |
persister.addGeometryToExistingFeature(editFeat, geom); |
|
82 |
} |
|
83 |
} |
|
84 |
} catch (DataException e) { |
|
85 |
Sextante.addErrorToLog(e); |
|
86 |
} catch (CreateGeometryException e) { |
|
87 |
Sextante.addErrorToLog(e); |
|
88 |
} |
|
89 |
|
|
90 |
return lastEditFeature; |
|
91 |
} |
|
92 |
|
|
93 |
@Override |
|
94 |
public void invoke(org.gvsig.fmap.geom.Geometry g, EditableFeature featureInput) { |
|
95 |
} |
|
96 |
} |
|
97 |
|
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.93/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.reproject/src/main/java/org/gvsig/geoprocess/algorithm/reproject/ReprojectParametersPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.reproject; |
|
25 |
|
|
26 |
import java.awt.Dimension; |
|
27 |
import java.awt.GridBagConstraints; |
|
28 |
import java.awt.GridBagLayout; |
|
29 |
import java.awt.Insets; |
|
30 |
import java.awt.event.ActionEvent; |
|
31 |
import java.awt.event.ActionListener; |
|
32 |
|
|
33 |
import javax.swing.ComboBoxModel; |
|
34 |
import javax.swing.DefaultComboBoxModel; |
|
35 |
import javax.swing.JCheckBox; |
|
36 |
import javax.swing.JComboBox; |
|
37 |
import javax.swing.JLabel; |
|
38 |
import javax.swing.JPanel; |
|
39 |
|
|
40 |
import org.cresques.cts.IProjection; |
|
41 |
import org.gvsig.app.gui.panels.CRSSelectPanel; |
|
42 |
import org.gvsig.fmap.crs.CRSFactory; |
|
43 |
import org.gvsig.geoprocess.lib.api.GeoProcessLocator; |
|
44 |
import org.gvsig.geoprocess.sextante.gui.algorithm.AlgorithmOutputPanel; |
|
45 |
|
|
46 |
import es.unex.sextante.core.GeoAlgorithm; |
|
47 |
import es.unex.sextante.core.ObjectAndDescription; |
|
48 |
import es.unex.sextante.core.OutputObjectsSet; |
|
49 |
import es.unex.sextante.core.ParametersSet; |
|
50 |
import es.unex.sextante.core.Sextante; |
|
51 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
52 |
import es.unex.sextante.gui.algorithm.GeoAlgorithmParametersPanel; |
|
53 |
import es.unex.sextante.gui.algorithm.OutputChannelSelectionPanel; |
|
54 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
55 |
import es.unex.sextante.outputs.Output; |
|
56 |
|
|
57 |
/** |
|
58 |
* Panel for reproject algorithm |
|
59 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
60 |
*/ |
|
61 |
public class ReprojectParametersPanel extends GeoAlgorithmParametersPanel implements ActionListener { |
|
62 |
private static final long serialVersionUID = 1L; |
|
63 |
private GeoAlgorithm m_Algorithm = null; |
|
64 |
private JComboBox layersCombo = null; |
|
65 |
private JCheckBox selectionOnly = null; |
|
66 |
//private AlgorithmOutputPanel output = null; |
|
67 |
private JLabel projLabel = null; |
|
68 |
private CRSSelectPanel projectionSrcSelector = null; |
|
69 |
private IProjection targetLayerProjection = null; |
|
70 |
private AlgorithmOutputPanel algorithmOutputPanel = null; |
|
71 |
private OutputChannelSelectionPanel outputChannelSelectionPanelPol; |
|
72 |
private OutputChannelSelectionPanel outputChannelSelectionPanelLine; |
|
73 |
private OutputChannelSelectionPanel outputChannelSelectionPanelPoint; |
|
74 |
private JPanel outputPanel; |
|
75 |
|
|
76 |
public ReprojectParametersPanel() { |
|
77 |
super(); |
|
78 |
} |
|
79 |
|
|
80 |
public void init(GeoAlgorithm algorithm) { |
|
81 |
m_Algorithm = algorithm; |
|
82 |
initGUI(); |
|
83 |
init(); |
|
84 |
} |
|
85 |
|
|
86 |
private void initGUI() { |
|
87 |
GridBagLayout gbl = new GridBagLayout(); |
|
88 |
this.setLayout(gbl); |
|
89 |
|
|
90 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
91 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
92 |
gbc.weightx = 1.0; |
|
93 |
gbc.gridx = 0; |
|
94 |
gbc.gridy = 0; |
|
95 |
gbc.insets = new Insets(15, 5, 15, 0); |
|
96 |
this.add(getComboPanel(GeoProcessLocator.getGeoProcessManager().getTranslation("Input_layer"), getLayersCombo()), gbc); |
|
97 |
|
|
98 |
gbc.gridy = 1; |
|
99 |
gbc.insets = new Insets(0, 5, 15, 0); |
|
100 |
this.add(getSelectionCheck(), gbc); |
|
101 |
|
|
102 |
gbc.gridy = 2; |
|
103 |
this.add(getCurrentProjLabel(), gbc); |
|
104 |
|
|
105 |
gbc.gridy = 3; |
|
106 |
this.add(getProjectionSelector(), gbc); |
|
107 |
|
|
108 |
gbc.gridy = 4; |
|
109 |
gbc.fill = GridBagConstraints.BOTH; |
|
110 |
gbc.weighty = 1.0; |
|
111 |
gbc.weightx = 1.0; |
|
112 |
this.add(new JPanel(), gbc); |
|
113 |
|
|
114 |
gbc.gridy = 5; |
|
115 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
116 |
gbc.weighty = 0.0; |
|
117 |
this.add(getOutputChannelSelectionPanel(), gbc); |
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
121 |
* Gets the output panel (SEXTANTE) |
|
122 |
* @return |
|
123 |
*/ |
|
124 |
private JPanel getOutputChannelSelectionPanel() { |
|
125 |
if(outputPanel == null) { |
|
126 |
try { |
|
127 |
outputPanel = new JPanel(); |
|
128 |
outputPanel.setLayout(new GridBagLayout()); |
|
129 |
|
|
130 |
final OutputObjectsSet ooSet = m_Algorithm.getOutputObjects(); |
|
131 |
final Output out_pol = ooSet.getOutput(ReprojectAlgorithm.RESULT_POL); |
|
132 |
final Output out_line = ooSet.getOutput(ReprojectAlgorithm.RESULT_LINE); |
|
133 |
final Output out_point = ooSet.getOutput(ReprojectAlgorithm.RESULT_POINT); |
|
134 |
|
|
135 |
outputChannelSelectionPanelPol = new OutputChannelSelectionPanel(out_pol, m_Algorithm.getParameters()); |
|
136 |
outputChannelSelectionPanelLine = new OutputChannelSelectionPanel(out_line, m_Algorithm.getParameters()); |
|
137 |
outputChannelSelectionPanelPoint = new OutputChannelSelectionPanel(out_point, m_Algorithm.getParameters()); |
|
138 |
|
|
139 |
String label = GeoProcessLocator.getGeoProcessManager().getTranslation("Reproject"); |
|
140 |
|
|
141 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
142 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
143 |
gbc.insets = new Insets(0, 0, 4, 0); |
|
144 |
gbc.weightx = 1; |
|
145 |
gbc.gridx = 0; |
|
146 |
gbc.gridy = 0; |
|
147 |
outputPanel.add(new JLabel(" " + label + " [" + |
|
148 |
GeoProcessLocator.getGeoProcessManager().getTranslation("Polygon") + "] "), gbc); |
|
149 |
|
|
150 |
gbc.gridx = 0; |
|
151 |
gbc.gridy = 1; |
|
152 |
outputPanel.add(new JLabel(" " + label + " [" + |
|
153 |
GeoProcessLocator.getGeoProcessManager().getTranslation("Line") + "] "), gbc); |
|
154 |
|
|
155 |
gbc.gridx = 0; |
|
156 |
gbc.gridy = 2; |
|
157 |
outputPanel.add(new JLabel(" " + label + " [" + |
|
158 |
GeoProcessLocator.getGeoProcessManager().getTranslation("Point") + "] "), gbc); |
|
159 |
|
|
160 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
161 |
gbc.weightx = 1; |
|
162 |
gbc.gridx = 1; |
|
163 |
gbc.gridy = 0; |
|
164 |
outputPanel.add(outputChannelSelectionPanelPol, gbc); |
|
165 |
|
|
166 |
gbc.gridx = 1; |
|
167 |
gbc.gridy = 1; |
|
168 |
outputPanel.add(outputChannelSelectionPanelLine, gbc); |
|
169 |
|
|
170 |
gbc.gridx = 1; |
|
171 |
gbc.gridy = 2; |
|
172 |
outputPanel.add(outputChannelSelectionPanelPoint, gbc); |
|
173 |
} catch (final Exception e) { |
|
174 |
Sextante.addErrorToLog(e); |
|
175 |
} |
|
176 |
} |
|
177 |
return outputPanel; |
|
178 |
} |
|
179 |
|
|
180 |
/** |
|
181 |
* Gets the output panel (DAL) |
|
182 |
* @return |
|
183 |
*/ |
|
184 |
@SuppressWarnings("unused") |
|
185 |
private AlgorithmOutputPanel getAlgorithmOutputPanel() { |
|
186 |
if(algorithmOutputPanel == null) |
|
187 |
algorithmOutputPanel = new AlgorithmOutputPanel(); |
|
188 |
return algorithmOutputPanel; |
|
189 |
} |
|
190 |
|
|
191 |
/** |
|
192 |
* Gets a new JPanel with the text and JComboBox |
|
193 |
* @param text |
|
194 |
* @param combo |
|
195 |
* @return |
|
196 |
*/ |
|
197 |
public JPanel getComboPanel(String text, JComboBox combo) { |
|
198 |
JPanel panel = new JPanel(); |
|
199 |
GridBagLayout gbl = new GridBagLayout(); |
|
200 |
panel.setLayout(gbl); |
|
201 |
|
|
202 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
203 |
gbc.fill = GridBagConstraints.NONE; |
|
204 |
gbc.weightx = 0; |
|
205 |
gbc.gridx = 0; |
|
206 |
gbc.insets = new Insets(0, 2, 0, 50); |
|
207 |
JLabel label = new JLabel(text); |
|
208 |
label.setPreferredSize(new Dimension(180, 18)); |
|
209 |
panel.add(label, gbc); |
|
210 |
|
|
211 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
212 |
gbc.weightx = 1.0; |
|
213 |
gbc.gridx = 1; |
|
214 |
gbc.anchor = GridBagConstraints.EAST; |
|
215 |
gbc.insets = new Insets(0, 2, 0, 0); |
|
216 |
panel.add(combo, gbc); |
|
217 |
return panel; |
|
218 |
} |
|
219 |
|
|
220 |
/** |
|
221 |
* Gets a ComboBox |
|
222 |
* @return |
|
223 |
*/ |
|
224 |
public JComboBox getLayersCombo() { |
|
225 |
if(layersCombo == null) { |
|
226 |
layersCombo = new JComboBox(); |
|
227 |
layersCombo.setPreferredSize(new Dimension(0, 18)); |
|
228 |
ComboBoxModel comboModel = new DefaultComboBoxModel(getLayerList()); |
|
229 |
layersCombo.setModel(comboModel); |
|
230 |
layersCombo.addActionListener(this); |
|
231 |
} |
|
232 |
return layersCombo; |
|
233 |
} |
|
234 |
|
|
235 |
|
|
236 |
/** |
|
237 |
* Gets a CheckBox |
|
238 |
* @return |
|
239 |
*/ |
Also available in: Unified diff