Revision 344

View differences:

org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG
2
  Association. This program is free software; you can redistribute it and/or modify
3
  it under the terms of the GNU General Public License as published by the Free Software
4
  Foundation; either version 3 of the License, or (at your option) any later version.
5
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
6
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7
  PURPOSE. See the GNU General Public License for more details. You should have received
8
  a copy of the GNU General Public License along with this program; if not, write to
9
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
10
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
11
  or visit our website www.gvsig.com. -->
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
-->
12 26
<assembly>
13 27
  <id>gvsig-plugin-package</id>
14 28
  <formats>
......
40 54
      <useTransitiveDependencies>false</useTransitiveDependencies>
41 55
      <outputDirectory>lib</outputDirectory>
42 56
      <includes>
43
        <include>org.gvsig:org.gvsig.vectorediting.lib.api</include>
44
        <include>org.gvsig:org.gvsig.vectorediting.swing.api</include>
45
        <include>org.gvsig:org.gvsig.vectorediting.lib.impl</include>
46
        <include>org.gvsig:org.gvsig.vectorediting.swing.impl</include>
47
        <include>org.gvsig:org.gvsig.vectorediting.lib.spi</include>
48
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.point</include>
49
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.circlecr</include>
50
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.circle3p</include>
51
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.polyline</include>
52
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.internalpolygon</include>
53
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.line</include>
54
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.arc</include>
55
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.ellipse</include>
56
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.regularpolygon</include>
57
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.rectangle</include>
58
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.spline</include>
59
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.explode</include>
60
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.move</include>
61
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.rotate</include>
62
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.duplicate</include>
63
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.scale</include>
64
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.splitline</include>
65
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.simplify</include>
66
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.multipoint</include>
67
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.autopolygon</include>
68
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.join</include>
69
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.stretch</include>
70
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.extendline</include>
71
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.split</include>
72
        <include>org.gvsig:org.gvsig.vectorediting.lib.prov.smoothline</include>
73

  
57
		<include>org.gvsig:org.gvsig.vectorediting.lib.api</include>
58
		<include>org.gvsig:org.gvsig.vectorediting.swing.api</include>
59
		<include>org.gvsig:org.gvsig.vectorediting.lib.impl</include>
60
		<include>org.gvsig:org.gvsig.vectorediting.swing.impl</include>
61
		<include>org.gvsig:org.gvsig.vectorediting.lib.spi</include>
62
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.point</include>
63
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.circlecr</include>
64
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.circle3p</include>
65
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.polyline</include>
66
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.internalpolygon</include>
67
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.line</include>
68
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.arc</include>
69
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.ellipse</include>
70
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.regularpolygon</include>
71
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.rectangle</include>
72
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.spline</include>
73
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.explode</include>
74
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.move</include>
75
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.rotate</include>
76
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.duplicate</include>
77
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.scale</include>
78
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.splitline</include>
79
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.simplify</include>
80
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.multipoint</include>
81
	    <include>org.gvsig:org.gvsig.vectorediting.lib.prov.autopolygon</include>
82
		<include>org.gvsig:org.gvsig.vectorediting.lib.prov.join</include>
83
	    <include>org.gvsig:org.gvsig.vectorediting.lib.prov.stretch</include>
84
	    <include>org.gvsig:org.gvsig.vectorediting.lib.prov.extendline</include>
85
	    <include>org.gvsig:org.gvsig.vectorediting.lib.prov.split</include>
86
	    <include>org.gvsig:org.gvsig.vectorediting.lib.prov.smoothline</include>
87
	    <include>org.gvsig:org.gvsig.vectorediting.lib.prov.trimline</include>
74 88
      </includes>
75 89
    </dependencySet>
76 90
  </dependencySets>
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/resources-plugin/i18n/text.properties
31 31
insert_autopolygon = Insertar autopol\u00edgono
32 32
modify_stretch = Estirar geometr\u00eda
33 33
modify_extend_line = Alargar l\u00ednea hasta objeto
34
modify_trim_line = Recortar linea por un objeto
34 35
selection=Selecci\u00f3n
35 36
invalid_option=Opci\u00f3n no v\u00e1lida
36 37
center=Centro
......
90 91
scale_factor_or_reference_point = Factor de escala o punto de referencia
91 92
second_scale_point = Segundo punto para la escala
92 93
tolerance = Tolerancia
93
line_to_extend = Seleccione lineas para alargar
94
line_to_extend = Seleccione l\u00enea para alargar
95
line_to_trim = Seleccione l\u00enea para partir  
94 96
modify_smooth_line = Suavizar l\u00ednea
95 97
intermediate_steps_1_9 = Pasos intermedios [1,9]
96 98
algorithm = algoritmo
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
31 31
modify_join = Join geometries
32 32
modify_stretch = Stretch geometry
33 33
modify_extend_line = Extend line to object
34
modify_trim_line = Trim line by object
34 35
selection=Selection
35 36
invalid_option=Invalid option
36 37
center=Center
......
90 91
scale_factor_or_reference_point = Scale factor or reference point
91 92
second_scale_point = Second scale point
92 93
tolerance = Tolerance
93
line_to_extend = Select lines to extend
94
line_to_extend = Select line to extend
95
line_to_trim = Select line to trim
94 96
modify_smooth_line = Smooth line
95 97
intermediate_steps_1_9 = Intermediate steps [1,9]
96 98
algorithm = algorithm
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/resources-plugin/config.xml
131 131
      <action name="modify-duplicate" label="modify_duplicate" tooltip="modify_duplicate"
132 132
        position="601002900" action-command="modify-duplicate" icon="modify-duplicate"
133 133
        accelerator="" />
134

  
134
        
135 135
       <action name="modify-split" label="modify_split" tooltip="modify_split"
136 136
        position="601003000" action-command="modify-split" icon="modify-split"
137 137
        accelerator="" />
138

  
138
        
139 139
      <action name="modify-split-line" label="modify_split_line" tooltip="modify_split_line"
140 140
        position="601003050" action-command="modify-split-line" icon="modify-split-line"
141 141
        accelerator="" />
......
151 151
      <action name="modify-join" label="modify_join"
152 152
        tooltip="modify_join" position="601003300" action-command="modify-join"
153 153
        icon="modify-join" accelerator="" />
154

  
154
        
155 155
      <action name="insert-autopolygon" label="insert_autopolygon"
156 156
        tooltip="insert_autopolygon" position="601003400" action-command="insert-autopolygon"
157 157
        icon="insert-autopolygon" accelerator="" />
......
159 159
      <action name="modify-stretch" label="modify_stretch" tooltip="modify_stretch"
160 160
        position="601003500" action-command="modify-stretch" icon="modify-stretch"
161 161
        accelerator="" />
162

  
162
        
163 163
      <action name="modify-extend-line" label="modify_extend_line" tooltip="modify_extend_line"
164 164
        position="601003600" action-command="modify-extend-line" icon="modify-extend-line"
165 165
        accelerator="" />
166

  
166
       
167
      <action name="modify-trim-line" label="modify_trim_line" tooltip="modify_trim_line"
168
        position="601003700" action-command="modify-trim-line" icon="modify-trim-line"
169
        accelerator="" />
170
        
167 171
      <action name="modify-smooth-line" label="modify_smooth_line" tooltip="modify_smooth_line"
168
        position="601003700" action-command="modify-smooth-line" icon="modify-smooth-line"
172
        position="601003800" action-command="modify-smooth-line" icon="modify-smooth-line"
169 173
        accelerator="" />
174
      
170 175

  
171

  
172 176
      <menu text="Layer/Insert/insert_point" name="insert-point" />
173 177
      <menu text="Layer/Insert/insert_multipoint" name="insert-multipoint" />
174 178
      <menu text="Layer/Insert/insert_line" name="insert-line" />
......
200 204
      <menu text="Layer/Modify/modify_join" name="modify-join" />
201 205
      <menu text="Layer/Modify/modify_stretch" name="modify-stretch" />
202 206
      <menu text="Layer/Modify/modify_extend_line" name="modify-extend-line" />
207
      <menu text="Layer/Modify/modify_trim_line" name="modify-extend-line" />
203 208
      <menu text="Layer/Modify/modify_smooth_line" name="modify-smooth-line" />
204 209

  
205 210
      <tool-bar name="vector_editing" position="600800000">
......
234 239
        <selectable-tool name="modify-join" />
235 240
        <selectable-tool name="modify-stretch" />
236 241
        <selectable-tool name="modify-extend-line" />
242
        <selectable-tool name="modify-trim-line" />
237 243
        <selectable-tool name="modify-smooth-line" />
238 244
      </tool-bar>
239 245

  
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/pom.xml
204 204
				org.gvsig.vectorediting.lib.prov.split
205 205
			</artifactId>
206 206
		</dependency>
207
    <dependency>
208
      <groupId>org.gvsig</groupId>
209
      <artifactId>
210
        org.gvsig.vectorediting.lib.prov.smoothline
211
      </artifactId>
212
    </dependency>
207
		<dependency>
208
        	<groupId>org.gvsig</groupId>
209
        	<artifactId>
210
        		org.gvsig.vectorediting.lib.prov.smoothline
211
      		</artifactId>
212
   	 	</dependency>
213
		<dependency>
214
			<groupId>org.gvsig</groupId>
215
			<artifactId>
216
				org.gvsig.vectorediting.lib.prov.trimline
217
			</artifactId>
218
		</dependency>
213 219
	</dependencies>
214 220
</project>
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/pom.xml
1 1
<?xml version="1.0" encoding="ISO-8859-1"?>
2 2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
  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
  <groupId>org.gvsig</groupId>
6
  <artifactId>org.gvsig.vectorediting</artifactId>
7
  <packaging>pom</packaging>
8
  <version>1.0.1-SNAPSHOT</version>
9
  <name>${project.artifactId}</name>
10
  <description>Vectorediting project</description>
11
  <parent>
12
    <groupId>org.gvsig</groupId>
13
    <artifactId>org.gvsig.desktop</artifactId>
14
    <version>2.0.72</version>
15
  </parent>
16
  <url>https://devel.gvsig.org/sites/org.gvsig.vectorediting/${project.version}</url>
17
  <scm>
18
    <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-vectorediting/org.gvsig.vectorediting/trunk/${project.artifactId}</connection>
19
    <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-vectorediting/org.gvsig.vectorediting/trunk/${project.artifactId}</developerConnection>
20
    <url>https://devel.gvsig.org/redmine/projects/gvsig-vector-editing/repository/show/org.gvsig.vectorediting/trunk/${project.artifactId}</url>
21
  </scm>
22
  <repositories>
23
    <repository>
24
      <id>gvsig-public-http-repository</id>
25
      <name>gvSIG maven public HTTP repository</name>
26
      <url>http://devel.gvsig.org/m2repo/j2se</url>
27
      <releases>
28
        <enabled>true</enabled>
29
        <updatePolicy>daily</updatePolicy>
30
        <checksumPolicy>warn</checksumPolicy>
31
      </releases>
32
      <snapshots>
33
        <enabled>true</enabled>
34
        <updatePolicy>daily</updatePolicy>
35
        <checksumPolicy>warn</checksumPolicy>
36
      </snapshots>
37
    </repository>
38
  </repositories>
3
	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
	<groupId>org.gvsig</groupId>
6
	<artifactId>org.gvsig.vectorediting</artifactId>
7
	<packaging>pom</packaging>
8
	<version>1.0.1-SNAPSHOT</version>
9
	<name>${project.artifactId}</name>
10
	<description>Vectorediting project</description>
11
	<parent>
12
		<groupId>org.gvsig</groupId>
13
		<artifactId>org.gvsig.desktop</artifactId>
14
		<version>2.0.72</version>
15
	</parent>
16
	<url>https://devel.gvsig.org/sites/org.gvsig.vectorediting/${project.version}</url>
17
	<scm>
18
		<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-vectorediting/org.gvsig.vectorediting/trunk/${project.artifactId}</connection>
19
		<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-vectorediting/org.gvsig.vectorediting/trunk/${project.artifactId}</developerConnection>
20
		<url>https://devel.gvsig.org/redmine/projects/gvsig-vector-editing/repository/show/org.gvsig.vectorediting/trunk/${project.artifactId}</url>
21
	</scm>
22
	<repositories>
23
		<repository>
24
			<id>gvsig-public-http-repository</id>
25
			<name>gvSIG maven public HTTP repository</name>
26
			<url>http://devel.gvsig.org/m2repo/j2se</url>
27
			<releases>
28
				<enabled>true</enabled>
29
				<updatePolicy>daily</updatePolicy>
30
				<checksumPolicy>warn</checksumPolicy>
31
			</releases>
32
			<snapshots>
33
				<enabled>true</enabled>
34
				<updatePolicy>daily</updatePolicy>
35
				<checksumPolicy>warn</checksumPolicy>
36
			</snapshots>
37
		</repository>
38
	</repositories>
39 39

  
40
  <distributionManagement>
41
    <site>
42
      <id>gvsig-repository</id>
43
      <url>dav:https://devel.gvsig.org/download/projects/gvsig-vectorediting/pool/${project.artifactId}/${project.version}</url>
44
    </site>
45
  </distributionManagement>
40
	<distributionManagement>
41
		<site>
42
			<id>gvsig-repository</id>
43
			<url>dav:https://devel.gvsig.org/download/projects/gvsig-vectorediting/pool/${project.artifactId}/${project.version}</url>
44
		</site>
45
	</distributionManagement>
46 46

  
47
  <build>
48
    <plugins>
49
      <plugin>
50
        <groupId>org.apache.maven.plugins</groupId>
51
        <artifactId>maven-release-plugin</artifactId>
52
        <configuration>
53
          <tagBase>https://devel.gvsig.org/svn/gvsig-vectorediting/org.gvsig.vectorediting/tags</tagBase>
54
        </configuration>
55
      </plugin>
56
    </plugins>
57
  </build>
47
	<build>
48
		<plugins>
49
			<plugin>
50
				<groupId>org.apache.maven.plugins</groupId>
51
				<artifactId>maven-release-plugin</artifactId>
52
				<configuration>
53
					<tagBase>https://devel.gvsig.org/svn/gvsig-vectorediting/org.gvsig.vectorediting/tags</tagBase>
54
				</configuration>
55
			</plugin>
56
		</plugins>
57
	</build>
58 58

  
59
  <modules>
60
    <module>org.gvsig.vectorediting.lib</module>
61
    <module>org.gvsig.vectorediting.swing</module>
62
    <module>org.gvsig.vectorediting.main</module>
63
    <module>org.gvsig.vectorediting.app</module>
64
  </modules>
59
	<modules>
60
		<module>org.gvsig.vectorediting.lib</module>
61
		<module>org.gvsig.vectorediting.swing</module>
62
		<module>org.gvsig.vectorediting.main</module>
63
		<module>org.gvsig.vectorediting.app</module>
64
	</modules>
65 65

  
66
  <dependencyManagement>
67
    <dependencies>
68
      <dependency>
69
        <groupId>org.gvsig</groupId>
70
        <artifactId>org.gvsig.vectorediting.lib.api</artifactId>
71
        <version>1.0.1-SNAPSHOT</version>
72
      </dependency>
73
      <dependency>
74
        <groupId>org.gvsig</groupId>
75
        <artifactId>
66
	<dependencyManagement>
67
		<dependencies>
68
			<dependency>
69
				<groupId>org.gvsig</groupId>
70
				<artifactId>org.gvsig.vectorediting.lib.api</artifactId>
71
				<version>1.0.1-SNAPSHOT</version>
72
			</dependency>
73
			<dependency>
74
				<groupId>org.gvsig</groupId>
75
				<artifactId>
76 76
					org.gvsig.vectorediting.lib.impl
77 77
				</artifactId>
78
        <version>1.0.1-SNAPSHOT</version>
79
      </dependency>
80
      <dependency>
81
        <groupId>org.gvsig</groupId>
82
        <artifactId>org.gvsig.vectorediting.lib.spi</artifactId>
83
        <version>1.0.1-SNAPSHOT</version>
84
      </dependency>
85
      <dependency>
86
        <groupId>org.gvsig</groupId>
87
        <artifactId>
78
				<version>1.0.1-SNAPSHOT</version>
79
			</dependency>
80
			<dependency>
81
				<groupId>org.gvsig</groupId>
82
				<artifactId>org.gvsig.vectorediting.lib.spi</artifactId>
83
				<version>1.0.1-SNAPSHOT</version>
84
			</dependency>
85
			<dependency>
86
				<groupId>org.gvsig</groupId>
87
				<artifactId>
88 88
					org.gvsig.vectorediting.swing.api
89 89
				</artifactId>
90
        <version>1.0.1-SNAPSHOT</version>
91
      </dependency>
92
      <dependency>
93
        <groupId>org.gvsig</groupId>
94
        <artifactId>
90
				<version>1.0.1-SNAPSHOT</version>
91
			</dependency>
92
			<dependency>
93
				<groupId>org.gvsig</groupId>
94
				<artifactId>
95 95
					org.gvsig.vectorediting.swing.impl
96 96
				</artifactId>
97
        <version>1.0.1-SNAPSHOT</version>
98
      </dependency>
99
      <dependency>
100
        <groupId>org.gvsig</groupId>
101
        <artifactId>
97
				<version>1.0.1-SNAPSHOT</version>
98
			</dependency>
99
			<dependency>
100
				<groupId>org.gvsig</groupId>
101
				<artifactId>
102 102
					org.gvsig.vectorediting.lib.prov.point
103 103
				</artifactId>
104
        <version>1.0.1-SNAPSHOT</version>
105
      </dependency>
106
      <dependency>
107
        <groupId>org.gvsig</groupId>
108
        <artifactId>
104
				<version>1.0.1-SNAPSHOT</version>
105
			</dependency>
106
			<dependency>
107
				<groupId>org.gvsig</groupId>
108
				<artifactId>
109 109
					org.gvsig.vectorediting.lib.prov.circlecr
110 110
				</artifactId>
111
        <version>1.0.1-SNAPSHOT</version>
112
      </dependency>
113
      <dependency>
114
        <groupId>org.gvsig</groupId>
115
        <artifactId>
111
				<version>1.0.1-SNAPSHOT</version>
112
			</dependency>
113
			<dependency>
114
				<groupId>org.gvsig</groupId>
115
				<artifactId>
116 116
					org.gvsig.vectorediting.lib.prov.polyline
117 117
				</artifactId>
118
        <version>1.0.1-SNAPSHOT</version>
119
      </dependency>
120
      <dependency>
121
        <groupId>org.gvsig</groupId>
122
        <artifactId>
118
				<version>1.0.1-SNAPSHOT</version>
119
			</dependency>
120
			<dependency>
121
				<groupId>org.gvsig</groupId>
122
				<artifactId>
123 123
					org.gvsig.vectorediting.lib.prov.symmetry
124 124
				</artifactId>
125
        <version>1.0.0-SNAPSHOT</version>
126
      </dependency>
127
      <dependency>
128
        <groupId>org.gvsig</groupId>
129
        <artifactId>
125
				<version>1.0.0-SNAPSHOT</version>
126
			</dependency>
127
			<dependency>
128
				<groupId>org.gvsig</groupId>
129
				<artifactId>
130 130
					org.gvsig.vectorediting.lib.prov.internalpolygon
131 131
				</artifactId>
132
        <version>1.0.1-SNAPSHOT</version>
133
      </dependency>
134
      <dependency>
135
        <groupId>org.gvsig</groupId>
136
        <artifactId>
132
				<version>1.0.1-SNAPSHOT</version>
133
			</dependency>
134
			<dependency>
135
				<groupId>org.gvsig</groupId>
136
				<artifactId>
137 137
                    org.gvsig.vectorediting.lib.prov.line
138 138
                </artifactId>
139
        <version>1.0.1-SNAPSHOT</version>
140
      </dependency>
141
      <dependency>
142
        <groupId>org.gvsig</groupId>
143
        <artifactId>
139
				<version>1.0.1-SNAPSHOT</version>
140
			</dependency>
141
			<dependency>
142
				<groupId>org.gvsig</groupId>
143
				<artifactId>
144 144
                    org.gvsig.vectorediting.lib.prov.arc
145 145
                </artifactId>
146
        <version>1.0.1-SNAPSHOT</version>
147
      </dependency>
148
      <dependency>
149
        <groupId>org.gvsig</groupId>
150
        <artifactId>
146
				<version>1.0.1-SNAPSHOT</version>
147
			</dependency>
148
			<dependency>
149
				<groupId>org.gvsig</groupId>
150
				<artifactId>
151 151
					org.gvsig.vectorediting.app.mainplugin
152 152
				</artifactId>
153
        <version>1.0.1-SNAPSHOT</version>
154
      </dependency>
155
      <dependency>
156
        <groupId>org.gvsig</groupId>
157
        <artifactId>
153
				<version>1.0.1-SNAPSHOT</version>
154
			</dependency>
155
			<dependency>
156
				<groupId>org.gvsig</groupId>
157
				<artifactId>
158 158
					org.gvsig.vectorediting.lib.prov.ellipse
159 159
				</artifactId>
160
        <version>1.0.1-SNAPSHOT</version>
161
      </dependency>
162
      <dependency>
163
        <groupId>org.gvsig</groupId>
164
        <artifactId>
160
				<version>1.0.1-SNAPSHOT</version>
161
			</dependency>
162
			<dependency>
163
				<groupId>org.gvsig</groupId>
164
				<artifactId>
165 165
					org.gvsig.vectorediting.lib.prov.regularpolygon
166 166
				</artifactId>
167
        <version>1.0.1-SNAPSHOT</version>
168
      </dependency>
169
      <dependency>
170
        <groupId>org.gvsig</groupId>
171
        <artifactId>
167
				<version>1.0.1-SNAPSHOT</version>
168
			</dependency>
169
			<dependency>
170
				<groupId>org.gvsig</groupId>
171
				<artifactId>
172 172
					org.gvsig.vectorediting.lib.prov.rectangle
173 173
				</artifactId>
174
        <version>1.0.1-SNAPSHOT</version>
175
      </dependency>
176
      <dependency>
177
        <groupId>org.gvsig</groupId>
178
        <artifactId>
174
				<version>1.0.1-SNAPSHOT</version>
175
			</dependency>
176
			<dependency>
177
				<groupId>org.gvsig</groupId>
178
				<artifactId>
179 179
					org.gvsig.vectorediting.lib.prov.spline
180 180
				</artifactId>
181
        <version>1.0.1-SNAPSHOT</version>
182
      </dependency>
183
      <dependency>
184
        <groupId>org.gvsig</groupId>
185
        <artifactId>
181
				<version>1.0.1-SNAPSHOT</version>
182
			</dependency>
183
			<dependency>
184
				<groupId>org.gvsig</groupId>
185
				<artifactId>
186 186
					org.gvsig.vectorediting.lib.prov.circle3p
187 187
				</artifactId>
188
        <version>1.0.1-SNAPSHOT</version>
189
      </dependency>
190
      <dependency>
191
        <groupId>org.gvsig</groupId>
192
        <artifactId>
188
				<version>1.0.1-SNAPSHOT</version>
189
			</dependency>
190
			<dependency>
191
				<groupId>org.gvsig</groupId>
192
				<artifactId>
193 193
					org.gvsig.vectorediting.lib.prov.explode
194 194
				</artifactId>
195
        <version>1.0.1-SNAPSHOT</version>
196
      </dependency>
197
      <dependency>
198
        <groupId>org.gvsig</groupId>
199
        <artifactId>
195
				<version>1.0.1-SNAPSHOT</version>
196
			</dependency>
197
			<dependency>
198
				<groupId>org.gvsig</groupId>
199
				<artifactId>
200 200
					org.gvsig.vectorediting.lib.prov.move
201 201
				</artifactId>
202
        <version>1.0.1-SNAPSHOT</version>
203
      </dependency>
204
      <dependency>
205
        <groupId>org.gvsig</groupId>
206
        <artifactId>
202
				<version>1.0.1-SNAPSHOT</version>
203
			</dependency>
204
			<dependency>
205
				<groupId>org.gvsig</groupId>
206
				<artifactId>
207 207
					org.gvsig.vectorediting.lib.prov.rotate
208 208
				</artifactId>
209
        <version>1.0.1-SNAPSHOT</version>
210
      </dependency>
211
      <dependency>
212
        <groupId>org.gvsig</groupId>
213
        <artifactId>
209
				<version>1.0.1-SNAPSHOT</version>
210
			</dependency>
211
			<dependency>
212
				<groupId>org.gvsig</groupId>
213
				<artifactId>
214 214
					org.gvsig.vectorediting.lib.prov.duplicate
215 215
				</artifactId>
216
        <version>1.0.1-SNAPSHOT</version>
217
      </dependency>
218
      <dependency>
219
        <groupId>org.gvsig</groupId>
220
        <artifactId>
216
				<version>1.0.1-SNAPSHOT</version>
217
			</dependency>
218
			<dependency>
219
				<groupId>org.gvsig</groupId>
220
				<artifactId>
221 221
					org.gvsig.vectorediting.lib.prov.splitline
222 222
				</artifactId>
223
        <version>1.0.1-SNAPSHOT</version>
224
      </dependency>
225
      <dependency>
226
        <groupId>org.gvsig</groupId>
227
        <artifactId>
223
				<version>1.0.1-SNAPSHOT</version>
224
			</dependency>
225
			<dependency>
226
				<groupId>org.gvsig</groupId>
227
				<artifactId>
228 228
					org.gvsig.vectorediting.lib.prov.scale
229 229
				</artifactId>
230
        <version>1.0.1-SNAPSHOT</version>
231
      </dependency>
232
      <dependency>
233
        <groupId>org.gvsig</groupId>
234
        <artifactId>
230
				<version>1.0.1-SNAPSHOT</version>
231
			</dependency>
232
			<dependency>
233
				<groupId>org.gvsig</groupId>
234
				<artifactId>
235 235
					org.gvsig.vectorediting.lib.prov.simplify
236 236
				</artifactId>
237
        <version>1.0.1-SNAPSHOT</version>
238
      </dependency>
239
      <dependency>
240
        <groupId>org.gvsig</groupId>
241
        <artifactId>
237
				<version>1.0.1-SNAPSHOT</version>
238
			</dependency>
239
			<dependency>
240
				<groupId>org.gvsig</groupId>
241
				<artifactId>
242 242
					org.gvsig.vectorediting.lib.prov.multipoint
243 243
				</artifactId>
244
        <version>1.0.1-SNAPSHOT</version>
245
      </dependency>
246
      <dependency>
247
        <groupId>org.gvsig</groupId>
248
        <artifactId>
244
				<version>1.0.1-SNAPSHOT</version>
245
			</dependency>
246
			<dependency>
247
				<groupId>org.gvsig</groupId>
248
				<artifactId>
249 249
                    org.gvsig.vectorediting.lib.prov.autopolygon
250 250
                </artifactId>
251
        <version>1.0.1-SNAPSHOT</version>
252
      </dependency>
253
      <dependency>
254
        <groupId>org.gvsig</groupId>
255
        <artifactId>
251
				<version>1.0.1-SNAPSHOT</version>
252
			</dependency>
253
			<dependency>
254
				<groupId>org.gvsig</groupId>
255
				<artifactId>
256 256
					org.gvsig.vectorediting.lib.prov.join
257 257
				</artifactId>
258
        <version>1.0.1-SNAPSHOT</version>
259
      </dependency>
260
      <dependency>
261
        <groupId>org.gvsig</groupId>
262
        <artifactId>
258
				<version>1.0.1-SNAPSHOT</version>
259
			</dependency>
260
			<dependency>
261
				<groupId>org.gvsig</groupId>
262
				<artifactId>
263 263
                    org.gvsig.vectorediting.lib.prov.stretch
264 264
                </artifactId>
265
        <version>1.0.1-SNAPSHOT</version>
266
      </dependency>
267
      <dependency>
268
        <groupId>org.gvsig</groupId>
269
        <artifactId>
265
				<version>1.0.1-SNAPSHOT</version>
266
			</dependency>
267
			<dependency>
268
				<groupId>org.gvsig</groupId>
269
				<artifactId>
270 270
      		        org.gvsig.vectorediting.lib.prov.extendline
271 271
      	        </artifactId>
272
        <version>1.0.1-SNAPSHOT</version>
273
      </dependency>
274
      <dependency>
275
        <groupId>org.gvsig</groupId>
276
        <artifactId>
272
				<version>1.0.1-SNAPSHOT</version>
273
			</dependency>
274
			<dependency>
275
				<groupId>org.gvsig</groupId>
276
				<artifactId>
277 277
					org.gvsig.vectorediting.lib.prov.split
278 278
				</artifactId>
279
        <version>1.0.1-SNAPSHOT</version>
280
      </dependency>
281
      <dependency>
282
        <groupId>org.gvsig</groupId>
283
        <artifactId>
284
          org.gvsig.vectorediting.lib.prov.smoothline
285
        </artifactId>
286
        <version>1.0.1-SNAPSHOT</version>
287
      </dependency>
288
    </dependencies>
289
  </dependencyManagement>
279
				<version>1.0.1-SNAPSHOT</version>
280
			</dependency>
281
			<dependency>
282
        		<groupId>org.gvsig</groupId>
283
        		<artifactId>
284
          			org.gvsig.vectorediting.lib.prov.smoothline
285
        		</artifactId>
286
        		<version>1.0.1-SNAPSHOT</version>
287
      		</dependency>
288
			<dependency>
289
				<groupId>org.gvsig</groupId>
290
				<artifactId>
291
					org.gvsig.vectorediting.lib.prov.trimline
292
				</artifactId>
293
				<version>1.0.1-SNAPSHOT</version>
294
			</dependency>
295
		</dependencies>
296
	</dependencyManagement>
290 297
</project>
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.main/src/main/java/org/gvsig/vectorediting/main/Main.java
113 113
import org.gvsig.vectorediting.lib.prov.spline.SplineEditingProviderFactory;
114 114
import org.gvsig.vectorediting.lib.prov.split.SplitEditingProviderFactory;
115 115
import org.gvsig.vectorediting.lib.prov.splitline.SplitLineEditingProviderFactory;
116
import org.gvsig.vectorediting.lib.prov.trimline.TrimLineEditingProviderFactory;
116 117
import org.gvsig.vectorediting.lib.spi.EditingProviderLocator;
117 118
import org.gvsig.vectorediting.lib.spi.EditingProviderManager;
118 119
import org.gvsig.vectorediting.swing.api.EditingContext;
......
252 253
        buttons.add(new JButton(getSplitLineAction()));
253 254
        buttons.add(new JButton(getSplitAction()));
254 255
        buttons.add(new JButton(getExtendLineAction()));
256
        buttons.add(new JButton(getTrimLineAction()));
255 257
        buttons.add(new JButton(getSimplifyAction()));
256 258
        buttons.add(new JButton(getScaleAction()));
257 259
        buttons.add(new JButton(getJoinAction()));
......
700 702
            }
701 703
        };
702 704
    }
705
    
706
    private AbstractAction getTrimLineAction() {
707
        return new AbstractAction("modify-trim-line") {
703 708

  
709
            /**
710
             *
711
             */
712
            private static final long serialVersionUID = -5366590032240258186L;
713

  
714
            public void actionPerformed(ActionEvent e) {
715
                editingContext = swingManager.getEditingContext(mapControl);
716
                editingContext
717
                    .activateService(TrimLineEditingProviderFactory.PROVIDER_NAME);
718
            }
719
        };
720
    }
721

  
704 722
    private AbstractAction getEndEditingExtensionAction() {
705 723
        return new AbstractAction("end-editing") {
706 724

  
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.main/pom.xml
225 225
                org.gvsig.vectorediting.lib.prov.smoothline
226 226
            </artifactId>
227 227
        </dependency>
228
        <dependency>
229
            <groupId>org.gvsig</groupId>
230
            <artifactId>
231
                org.gvsig.vectorediting.lib.prov.trimline
232
            </artifactId>
233
        </dependency>
228 234

  
229 235
		<!-- runtime dependencies -->
230 236
		<dependency>
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.lib/org.gvsig.vectorediting.lib.prov/org.gvsig.vectorediting.lib.prov.trimline/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.vectorediting.lib.prov.trimline.TrimLineEditingLibrary
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.lib/org.gvsig.vectorediting.lib.prov/org.gvsig.vectorediting.lib.prov.trimline/src/main/java/org/gvsig/vectorediting/lib/prov/trimline/TrimLineEditingProvider.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 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
package org.gvsig.vectorediting.lib.prov.trimline;
26

  
27
import java.util.ArrayList;
28
import java.util.List;
29

  
30
import org.cresques.cts.IProjection;
31

  
32
import org.gvsig.fmap.dal.exception.DataException;
33
import org.gvsig.fmap.dal.feature.EditableFeature;
34
import org.gvsig.fmap.dal.feature.Feature;
35
import org.gvsig.fmap.dal.feature.FeatureQuery;
36
import org.gvsig.fmap.dal.feature.FeatureSelection;
37
import org.gvsig.fmap.dal.feature.FeatureSet;
38
import org.gvsig.fmap.dal.feature.FeatureStore;
39
import org.gvsig.fmap.geom.Geometry;
40
import org.gvsig.fmap.geom.GeometryLocator;
41
import org.gvsig.fmap.geom.GeometryManager;
42
import org.gvsig.fmap.geom.aggregate.MultiCurve;
43
import org.gvsig.fmap.geom.exception.CreateGeometryException;
44
import org.gvsig.fmap.geom.operation.GeometryOperationException;
45
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
46
import org.gvsig.fmap.geom.primitive.Curve;
47
import org.gvsig.fmap.geom.primitive.Point;
48
import org.gvsig.fmap.geom.primitive.Primitive;
49
import org.gvsig.fmap.geom.type.GeometryType;
50
import org.gvsig.fmap.mapcontext.MapContext;
51
import org.gvsig.fmap.mapcontext.layers.vectorial.IntersectsGeometryEvaluator;
52
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
53
import org.gvsig.tools.dispose.DisposableIterator;
54
import org.gvsig.tools.dynobject.DynObject;
55
import org.gvsig.tools.exception.BaseException;
56
import org.gvsig.tools.service.spi.ProviderServices;
57
import org.gvsig.tools.visitor.VisitCanceledException;
58
import org.gvsig.tools.visitor.Visitor;
59
import org.gvsig.vectorediting.lib.api.DrawingStatus;
60
import org.gvsig.vectorediting.lib.api.EditingServiceParameter;
61
import org.gvsig.vectorediting.lib.api.EditingServiceParameter.TYPE;
62
import org.gvsig.vectorediting.lib.api.exceptions.DrawServiceException;
63
import org.gvsig.vectorediting.lib.api.exceptions.FinishServiceException;
64
import org.gvsig.vectorediting.lib.api.exceptions.InvalidEntryException;
65
import org.gvsig.vectorediting.lib.api.exceptions.StartServiceException;
66
import org.gvsig.vectorediting.lib.api.exceptions.StopServiceException;
67
import org.gvsig.vectorediting.lib.prov.trimline.operation.TrimLineOperation;
68
import org.gvsig.vectorediting.lib.prov.trimline.operation.TrimLineOperationUtils;
69
import org.gvsig.vectorediting.lib.spi.AbstractEditingProvider;
70
import org.gvsig.vectorediting.lib.spi.DefaultDrawingStatus;
71
import org.gvsig.vectorediting.lib.spi.DefaultEditingServiceParameter;
72
import org.gvsig.vectorediting.lib.spi.EditingProvider;
73
import org.gvsig.vectorediting.lib.spi.EditingProviderFactory;
74
import org.gvsig.vectorediting.lib.spi.EditingProviderLocator;
75
import org.gvsig.vectorediting.lib.spi.EditingProviderManager;
76

  
77
/**
78
 * @author llmarques
79
 *
80
 */
81
public class TrimLineEditingProvider extends AbstractEditingProvider implements
82
    EditingProvider {
83

  
84
    private final int TOLERANCE_PIXELS = 3;
85

  
86
    private Point insertedPoint;
87

  
88
    private EditingServiceParameter selectionParameter;
89

  
90
    private EditingServiceParameter linesToTrimParameter;
91

  
92
    private FeatureSelection selection;
93

  
94
    private FeatureSet linesToTrim;
95

  
96
    private FeatureStore featureStore;
97

  
98
    private MapContext mapContext;
99

  
100
    /**
101
     * Default constructor.
102
     *
103
     * @param providerServices
104
     *            available services for this provider
105
     * @param parameters
106
     *            of this provider
107
     */
108
    public TrimLineEditingProvider(ProviderServices services,
109
        DynObject parameters) {
110
        super(services);
111

  
112
        this.featureStore =
113
            (FeatureStore) parameters
114
                .getDynValue(EditingProviderFactory.FEATURE_STORE_FIELD);
115

  
116
        this.mapContext =
117
            (MapContext) parameters
118
                .getDynValue(EditingProviderFactory.MAPCONTEXT_FIELD);
119

  
120
        this.selectionParameter =
121
            new DefaultEditingServiceParameter("selection", "selection",
122
                TYPE.SELECTION);
123

  
124
        this.linesToTrimParameter =
125
            new DefaultEditingServiceParameter("line_to_trim", "line_to_trim",
126
                TYPE.POSITION);
127
    }
128

  
129
    public EditingServiceParameter next() {
130
        if (selection == null) {
131
            return selectionParameter;
132
        } else if (linesToTrim == null) {
133
            return linesToTrimParameter;
134
        }
135
        return null;
136
    }
137

  
138
    public DrawingStatus getDrawingStatus(Point mousePosition)
139
        throws DrawServiceException {
140
        if (selection != null) {
141
            DefaultDrawingStatus drawingStatus = new DefaultDrawingStatus();
142

  
143
            EditingProviderManager editingProviderManager =
144
                EditingProviderLocator.getProviderManager();
145
            ISymbol lineSymbolEditing =
146
                editingProviderManager.getSymbol("line-symbol-editing");
147

  
148
            double tolerance =
149
                mapContext.getViewPort().toMapDistance(TOLERANCE_PIXELS);
150

  
151
            Geometry buffer;
152
            FeatureSet geometries;
153
            DisposableIterator it = null;
154
            try {
155
                // Create buffer with tolerance to get the geometry to be
156
                // extended
157
                buffer = mousePosition.buffer(tolerance);
158
                geometries = getGeometryByBuffer(buffer);
159

  
160
                it = geometries.fastIterator();
161
                while (it.hasNext()) {
162
                    Feature feature = (Feature) it.next();
163
                    if (!selection.isSelected(feature)) {
164
                        Geometry geometry = feature.getDefaultGeometry();
165

  
166
                        if (geometry instanceof MultiCurve) {
167
                            MultiCurve multiCurve = (MultiCurve) geometry;
168

  
169
                            for (int i = 0; i < multiCurve
170
                                .getPrimitivesNumber(); i++) {
171

  
172
                                Curve curve = multiCurve.getCurveAt(i);
173
                                MultiCurve extendedCurve =
174
                                    trimLine(mousePosition, curve);
175
                                for (int j = 0; j < extendedCurve
176
                                    .getPrimitivesNumber(); j++) {
177
                                    drawingStatus.addStatus(
178
                                        extendedCurve.getCurveAt(j),
179
                                        lineSymbolEditing, "");
180
                                }
181
                            }
182

  
183
                        } else if (geometry instanceof Curve) {
184
                            Curve curve = (Curve) geometry;
185
                            MultiCurve extendedCurve =
186
                                trimLine(mousePosition, curve);
187
                            for (int j = 0; j < extendedCurve
188
                                .getPrimitivesNumber(); j++) {
189
                                drawingStatus.addStatus(
190
                                    extendedCurve.getCurveAt(j),
191
                                    lineSymbolEditing, "");
192
                            }
193
                        }
194
                    }
195
                }
196
            } catch (BaseException e) {
197
                throw new DrawServiceException(e);
198
            } finally {
199
                it.dispose();
200
            }
201
            return drawingStatus;
202
        }
203
        return null;
204
    }
205

  
206
    private MultiCurve trimLine(Point point, Curve curve)
207
        throws GeometryOperationNotSupportedException,
208
        GeometryOperationException, DataException, CreateGeometryException {
209

  
210
        TrimLineOperation operation =
211
            TrimLineOperationUtils.getOperation((Primitive) curve);
212

  
213
        return operation.trimLine(curve, point, selection);
214
    }
215

  
216
    public void stop() throws StopServiceException {
217
        linesToTrim = null;
218
    }
219

  
220
    public List<EditingServiceParameter> getParameters() {
221
        List<EditingServiceParameter> parameters =
222
            new ArrayList<EditingServiceParameter>();
223
        parameters.add(selectionParameter);
224
        parameters.add(linesToTrimParameter);
225
        return parameters;
226
    }
227

  
228
    public void setValue(Object value) throws InvalidEntryException {
229
        EditingServiceParameter parameter = next();
230
        validateAndInsertValue(parameter, value);
231
    }
232

  
233
    private void validateAndInsertValue(
234
        final EditingServiceParameter parameter, Object value)
235
        throws InvalidEntryException {
236

  
237
        if (parameter == selectionParameter
238
            && value instanceof FeatureSelection) {
239

  
240
            FeatureSelection featureSelection = (FeatureSelection) value;
241

  
242
            if (featureSelection.getSelectedCount() > 0) {
243
                try {
244
                    featureSelection.accept(new Visitor() {
245

  
246
                        public void visit(Object obj)
247
                            throws VisitCanceledException, BaseException {
248
                            Feature feature = (Feature) obj;
249
                            Geometry geometry = feature.getDefaultGeometry();
250
                            GeometryType geoType = geometry.getGeometryType();
251

  
252
                            if (!geoType.isTypeOf(SURFACE)
253
                                && !geoType.isTypeOf(MULTISURFACE)
254
                                && !geoType.isTypeOf(CURVE)
255
                                && !geoType.isTypeOf(MULTICURVE)) {
256
                                throw new InvalidEntryException(null);
257
                            }
258
                        }
259
                    });
260

  
261
                    selection = featureSelection;
262
                    return;
263
                } catch (BaseException e) {
264
                    throw new InvalidEntryException(e);
265
                }
266
            }
267
        } else if (parameter == linesToTrimParameter && value instanceof Point) {
268

  
269
            Point point = (Point) value;
270

  
271
            try {
272
                double tolerance =
273
                    mapContext.getViewPort().toMapDistance(TOLERANCE_PIXELS);
274

  
275
                // Create buffer with tolerance to get geometries to be
276
                // extended
277
                Geometry buffer = point.buffer(tolerance);
278
                FeatureSet geometries = getGeometryByBuffer(buffer);
279

  
280
                if (geometries.getSize() > 0) {
281

  
282
                    geometries.accept(new Visitor() {
283

  
284
                        public void visit(Object obj)
285
                            throws VisitCanceledException, BaseException {
286

  
287
                            Feature feature = (Feature) obj;
288
                            final Geometry geometry =
289
                                feature.getDefaultGeometry();
290
                            GeometryType geoType = geometry.getGeometryType();
291

  
292
                            if (!geoType.isTypeOf(CURVE)
293
                                && !geoType.isTypeOf(MULTICURVE)) {
294
                                throw new InvalidEntryException(null);
295
                            }
296
                        }
297
                    });
298

  
299
                    insertedPoint = point;
300
                    linesToTrim = geometries;
301
                    return;
302
                }
303
            } catch (BaseException e) {
304
                throw new InvalidEntryException(e);
305
            }
306
        }
307
        throw new InvalidEntryException(null);
308
    }
309

  
310
    private FeatureSet getGeometryByBuffer(Geometry buffer)
311
        throws DataException {
312
        FeatureQuery queryByGeometry = featureStore.createFeatureQuery();
313

  
314
        // Get default SRS of default feature type
315
        IProjection defaultSRS =
316
            this.featureStore.getDefaultFeatureType().getDefaultSRS();
317

  
318
        // Name of default geometry type
319
        String geomName =
320
            featureStore.getDefaultFeatureType()
321
                .getDefaultGeometryAttributeName();
322

  
323
        IntersectsGeometryEvaluator iee =
324
            new IntersectsGeometryEvaluator(buffer, defaultSRS,
325
                featureStore.getDefaultFeatureType(), geomName);
326

  
327
        queryByGeometry.setFilter(iee);
328
        queryByGeometry.setAttributeNames(null);
329
        return this.featureStore.getFeatureSet(queryByGeometry);
330
    }
331

  
332
    public Geometry finish() throws FinishServiceException {
333
        return null;
334
    }
335

  
336
    public void finishAndStore() throws FinishServiceException {
337

  
338
        if (selection != null && linesToTrim != null) {
339

  
340
            try {
341
                linesToTrim.accept(new Visitor() {
342

  
343
                    public void visit(Object obj)
344
                        throws VisitCanceledException, BaseException {
345
                        Feature feature = (Feature) obj;
346
                        Geometry geometry = feature.getDefaultGeometry();
347
                        EditableFeature eFeature = feature.getEditable();
348

  
349
                        if (geometry instanceof Curve) {
350

  
351
                            Curve curveToTrim = (Curve) geometry;
352
                            MultiCurve result =
353
                                trimLine(insertedPoint, curveToTrim);
354
                            eFeature.setDefaultGeometry(result);
355

  
356
                        } else if (geometry instanceof MultiCurve) {
357

  
358
                            int subType =
359
                                geometry.getGeometryType().getSubType();
360
                            MultiCurve multiCurveTrimmed =
361
                                createMultiCurve(subType);
362
                            MultiCurve multiCurveToTrim = (MultiCurve) geometry;
363

  
364
                            double minDistance = Double.POSITIVE_INFINITY;
365
                            int nearestCurveIndex = -1;
366

  
367
                            for (int i = 0; i < multiCurveToTrim
368
                                .getPrimitivesNumber(); i++) {
369

  
370
                                Curve curveToTrim =
371
                                    multiCurveToTrim.getCurveAt(i);
372

  
373
                                double distance =
374
                                    curveToTrim.distance(insertedPoint);
375
                                if (distance < minDistance) {
376
                                    nearestCurveIndex = i;
377
                                    minDistance = distance;
378
                                }
379
                            }
380

  
381
                            MultiCurve result =
382
                                trimLine(insertedPoint, multiCurveToTrim
383
                                    .getCurveAt(nearestCurveIndex));
384

  
385
                            for (int i = 0; i < result.getPrimitivesNumber(); i++) {
386
                                multiCurveTrimmed.addCurve(result.getCurveAt(i));
387
                            }
388

  
389
                            for (int i = 0; i < multiCurveToTrim
390
                                .getPrimitivesNumber(); i++) {
391
                                if (i != nearestCurveIndex) {
392
                                    multiCurveTrimmed.addCurve(multiCurveToTrim
393
                                        .getCurveAt(i));
394
                                }
395
                            }
396

  
397
                            eFeature.setDefaultGeometry(multiCurveTrimmed);
398
                        }
399

  
400
                        linesToTrim.update(eFeature);
401
                    }
402
                });
403
            } catch (BaseException e) {
404
                throw new FinishServiceException(e);
405
            }
406
        }
407
    }
408

  
409
    private MultiCurve createMultiCurve(int subtype)
410
        throws FinishServiceException, CreateGeometryException {
411

  
412
        GeometryManager geoManager = GeometryLocator.getGeometryManager();
413
        MultiCurve extendedMultiCurve = null;
414

  
415
        extendedMultiCurve = geoManager.createMultiCurve(subtype);
416

  
417
        return extendedMultiCurve;
418
    }
419

  
420
    public void start() throws StartServiceException, InvalidEntryException {
421
        linesToTrim = null;
422
        FeatureSelection selected = null;
423
        if (featureStore != null && selection == null) {
424
            try {
425
                selected = featureStore.getFeatureSelection();
426
            } catch (DataException e) {
427
                throw new StartServiceException(e);
428
            }
429
            if (selected.getSelectedCount() > 0) {
430
                try {
431
                    setValue(selected);
432
                } catch (InvalidEntryException e) {
433
                    throw new InvalidEntryException(e);
434
                }
435
            }
436
        }
437

  
438
    }
439

  
440
    public String getName() {
441
        return TrimLineEditingProviderFactory.PROVIDER_NAME;
442
    }
443

  
444
}
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.lib/org.gvsig.vectorediting.lib.prov/org.gvsig.vectorediting.lib.prov.trimline/src/main/java/org/gvsig/vectorediting/lib/prov/trimline/TrimLineEditingProviderFactory.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 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
package org.gvsig.vectorediting.lib.prov.trimline;
26

  
27
import org.gvsig.fmap.geom.Geometry;
28
import org.gvsig.tools.ToolsLocator;
29
import org.gvsig.tools.dynobject.DynClass;
30
import org.gvsig.tools.dynobject.DynObject;
31
import org.gvsig.tools.service.spi.AbstractProviderFactory;
32
import org.gvsig.tools.service.spi.Provider;
33
import org.gvsig.tools.service.spi.ProviderServices;
34
import org.gvsig.vectorediting.lib.api.EditingServiceInfo;
35
import org.gvsig.vectorediting.lib.spi.DefaultEditingServiceinfo;
36
import org.gvsig.vectorediting.lib.spi.EditingProviderFactory;
37

  
38
/**
39
 * @author llmarques
40
 *
41
 */
42
public class TrimLineEditingProviderFactory extends AbstractProviderFactory
43
    implements EditingProviderFactory {
44

  
45
    public static final String PROVIDER_NAME = "modify-trim-line";
46

  
47
    private final static String PROVIDER_DESCRIPTION =
48
        "Trim lines by cutting edges";
49

  
50
    public void initialize() {
51
    }
52

  
53
    public EditingServiceInfo getServiceInfo() {
54
        EditingServiceInfo serviceInfo =
55
            new DefaultEditingServiceinfo(PROVIDER_NAME, PROVIDER_DESCRIPTION,
56
                false, null, new int[] { Geometry.TYPES.CURVE,
57
                    Geometry.TYPES.MULTICURVE });
58

  
59
        return serviceInfo;
60
    }
61

  
62
    @Override
63
    protected Provider doCreate(DynObject parameters, ProviderServices services) {
64
        return new TrimLineEditingProvider(services, parameters);
65
    }
66
    
67
    @Override
68
    public DynObject createParameters() {
69
        DynObject dynobject = super.createParameters();
70
        dynobject.setDynValue(PROVIDER_NAME_FIELD, PROVIDER_NAME);
71
        return dynobject;
72
    }
73

  
74
    @Override
75
    protected DynClass createParametersDynClass() {
76
        DynClass dynclass =
77
            ToolsLocator.getDynObjectManager().createDynClass(PROVIDER_NAME,
78
                PROVIDER_DESCRIPTION);
79

  
80
        dynclass.addDynFieldString(PROVIDER_NAME_FIELD);
81
        dynclass.addDynFieldObject(FEATURE_STORE_FIELD);
82
        dynclass.addDynFieldObject(MAPCONTEXT_FIELD);
83

  
84
        return dynclass;
85
    }
86

  
87
}
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.lib/org.gvsig.vectorediting.lib.prov/org.gvsig.vectorediting.lib.prov.trimline/src/main/java/org/gvsig/vectorediting/lib/prov/trimline/TrimLineEditingLibrary.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 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
package org.gvsig.vectorediting.lib.prov.trimline;
26

  
27
import org.gvsig.fmap.geom.Geometry.TYPES;
28
import org.gvsig.tools.ToolsLocator;
29
import org.gvsig.tools.i18n.I18nManager;
30
import org.gvsig.tools.library.AbstractLibrary;
31
import org.gvsig.tools.library.Library;
32
import org.gvsig.tools.library.LibraryException;
33
import org.gvsig.vectorediting.lib.prov.trimline.operation.ArcTrimLineOperation;
34
import org.gvsig.vectorediting.lib.prov.trimline.operation.CurveTrimLineOperation;
35
import org.gvsig.vectorediting.lib.prov.trimline.operation.TrimLineOperationUtils;
36
import org.gvsig.vectorediting.lib.spi.EditingProviderLocator;
37
import org.gvsig.vectorediting.lib.spi.EditingProviderManager;
38

  
39
/**
40
 * @author llmarques
41
 *
42
 */
43
public class TrimLineEditingLibrary extends AbstractLibrary implements Library {
44

  
45
    @Override
46
    protected void doInitialize() throws LibraryException {
47
    }
48

  
49
    @Override
50
    protected void doPostInitialize() throws LibraryException {
51
        EditingProviderManager manager =
52
            EditingProviderLocator.getProviderManager();
53

  
54
        manager.addProviderFactory(new TrimLineEditingProviderFactory());
55

  
56
        manager.registerIcon("vectorediting-tools", "modify-trim-line", this
57
            .getClass().getClassLoader(), this.getClass().getName());
58
        
59
        TrimLineOperationUtils.register(new ArcTrimLineOperation(), TYPES.ARC);
60
        TrimLineOperationUtils.register(new CurveTrimLineOperation(), TYPES.SPLINE);
61
        TrimLineOperationUtils.register(new CurveTrimLineOperation(), TYPES.LINE);
62
        TrimLineOperationUtils.register(new CurveTrimLineOperation(), TYPES.CURVE);
63

  
64
        registerTranslations();
65
    }
66

  
67
    private void registerTranslations() {
68
        I18nManager manager = ToolsLocator.getI18nManager();
69
        manager.addResourceFamily("i18n/text",
70
            this.getClass().getClassLoader(), "modify-trim-line");
71
    }
72

  
73
}
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.lib/org.gvsig.vectorediting.lib.prov/org.gvsig.vectorediting.lib.prov.trimline/src/main/java/org/gvsig/vectorediting/lib/prov/trimline/operation/TrimLineOperation.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 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.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff