Revision 554
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/org.gvsig.vectorediting.app/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<groupId>org.gvsig</groupId> |
|
6 |
<artifactId>org.gvsig.vectorediting.app</artifactId> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<version>1.0.17</version> |
|
9 |
<name>${project.artifactId}</name> |
|
10 |
<description>This plugin add to gvSIG a tool to show Vectorediting messages</description> |
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.vectorediting</artifactId> |
|
14 |
<version>1.0.17</version> |
|
15 |
</parent> |
|
16 |
<dependencyManagement> |
|
17 |
<dependencies> |
|
18 |
|
|
19 |
</dependencies> |
|
20 |
</dependencyManagement> |
|
21 |
|
|
22 |
<modules> |
|
23 |
<module>org.gvsig.vectorediting.app.mainplugin</module> |
|
24 |
</modules> |
|
25 |
|
|
26 |
</project> |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/org.gvsig.vectorediting.app/maven-howto.rst | ||
---|---|---|
1 |
|
|
2 |
================================== |
|
3 |
Usefull maven "howtos" and FAQs |
|
4 |
================================== |
|
5 |
|
|
6 |
.. contents:: |
|
7 |
|
|
8 |
How to reduce the process of "install" to run as fast as possible. |
|
9 |
------------------------------------------------------------------- |
|
10 |
|
|
11 |
Can reduce install execution skiping test execution and compilation, |
|
12 |
javadoc generation, test signature checking, license checking, and |
|
13 |
attach sources in jar. |
|
14 |
|
|
15 |
mvn -Danimal.sniffer.skip=true -Dmaven.test.skip=true -Dsource.skip=true -DskipTests -Dmaven.javadoc.skip=true install |
|
16 |
|
|
17 |
How to increment the build number of gvSIG plugins |
|
18 |
---------------------------------------------------- |
|
19 |
|
|
20 |
To increase the build number of gvSIG plugins, yo can do: |
|
21 |
|
|
22 |
mvn -Dincrease-build-number process-sources |
|
23 |
|
|
24 |
How to deploy a package of a gvSIG plugin |
|
25 |
-------------------------------------------- |
|
26 |
|
|
27 |
Yo can deploy the package of a gvSIG plugin with: |
|
28 |
|
|
29 |
mvn -Ddeploy-package -Duser=USER -Dpassword=PASSWORD install |
|
30 |
|
|
31 |
Notes: |
|
32 |
- Require that the gvsig.package.info.poolURL property that this set to the correct value. |
|
33 |
- The process uses WEBDAV to upload the packages, gvspkg and gvspki, and require |
|
34 |
access to write in the location specified by gvsig.package.info.poolURL |
|
35 |
- If "user" or "password" is not present, the process ask its each time it need. |
|
36 |
- If folder specified in gvsig.package.info.poolURL does not exist, the process try to create it. |
|
37 |
- The process create a file "addon-request.txt" in the target with the information to |
|
38 |
add to the ticket to request the update of the package in the main repository of |
|
39 |
packages of gvSIG. |
|
40 |
|
|
41 |
How to skip attach sources in jar from command line |
|
42 |
------------------------------------------------------ |
|
43 |
|
|
44 |
If in the project is enabled by default the generation of jar whith |
|
45 |
the sources of the project, you can disable this setting the property |
|
46 |
"source.skip" to true in the command line:: |
|
47 |
|
|
48 |
mvn -Dsource.skip=true install |
|
49 |
|
|
50 |
How to skip test compile from command line |
|
51 |
-------------------------------------------- |
|
52 |
|
|
53 |
You can skip the compilation of test setting the propety "maven.test.skip" |
|
54 |
to true in the command line:: |
|
55 |
|
|
56 |
mvn -Dmaven.test.skip=true install |
|
57 |
|
|
58 |
|
|
59 |
How to skip test execution from command line |
|
60 |
---------------------------------------------- |
|
61 |
|
|
62 |
You can skip the tests execution setting the propety "skipTests" to true |
|
63 |
in the command line:: |
|
64 |
|
|
65 |
mvn -DskipTests install |
|
66 |
|
|
67 |
How to skip javadoc generation from command line |
|
68 |
-------------------------------------------------- |
|
69 |
|
|
70 |
You can skip the javadoc generation setting the property |
|
71 |
"maven.javadoc.skip" to true in the command line:: |
|
72 |
|
|
73 |
mvn -Dmaven.javadoc.skip=true install |
|
74 |
|
|
75 |
How to skip test signature cheks from command line |
|
76 |
--------------------------------------------------- |
|
77 |
|
|
78 |
You can skip the signature check setting the property |
|
79 |
"animal.sniffer.skip" to true in the command line:: |
|
80 |
|
|
81 |
mvn -Danimal.sniffer.skip=true install |
|
82 |
|
|
83 |
How to install a project without install submodules |
|
84 |
---------------------------------------------------------- |
|
85 |
|
|
86 |
To install a project with submodules and only install the |
|
87 |
parent project without submodules use the option "--non-recursive" :: |
|
88 |
|
|
89 |
mvn --non-recursive install |
|
90 |
|
|
91 |
|
|
92 |
How to skip test compilation |
|
93 |
-------------------------------- |
|
94 |
|
|
95 |
To configure a project to don't run the compilation |
|
96 |
of test you can add to this pom the next configuration of |
|
97 |
the plugin "maven-compiler-plugin":: |
|
98 |
|
|
99 |
<build> |
|
100 |
<plugins> |
|
101 |
... |
|
102 |
<plugin> |
|
103 |
<!-- Skip compilation tests --> |
|
104 |
<groupId>org.apache.maven.plugins</groupId> |
|
105 |
<artifactId>maven-compiler-plugin</artifactId> |
|
106 |
<executions> |
|
107 |
<execution> |
|
108 |
<id>default-testCompile</id> |
|
109 |
<phase>process-test-sources</phase> |
|
110 |
<goals> |
|
111 |
<goal>testCompile</goal> |
|
112 |
</goals> |
|
113 |
<configuration> |
|
114 |
<skip>true</skip> |
|
115 |
</configuration> |
|
116 |
</execution> |
|
117 |
</executions> |
|
118 |
</plugin> |
|
119 |
... |
|
120 |
</plugins> |
|
121 |
</build> |
|
122 |
|
|
123 |
Skip test execution |
|
124 |
---------------------- |
|
125 |
|
|
126 |
To configure a project to don't run the execution |
|
127 |
of test you can add to this pom the next configuration of |
|
128 |
the plugin "maven-surefire-plugin":: |
|
129 |
|
|
130 |
|
|
131 |
<build> |
|
132 |
<plugins> |
|
133 |
... |
|
134 |
<plugin> |
|
135 |
<!-- Skip test execution --> |
|
136 |
<groupId>org.apache.maven.plugins</groupId> |
|
137 |
<artifactId>maven-surefire-plugin</artifactId> |
|
138 |
<configuration> |
|
139 |
<skipTests>true</skipTests> |
|
140 |
</configuration> |
|
141 |
</plugin> |
|
142 |
... |
|
143 |
</plugins> |
|
144 |
</build> |
|
145 |
|
|
146 |
Continue on test failure |
|
147 |
----------------------------- |
|
148 |
|
|
149 |
You can configure a project to continue on test execution |
|
150 |
failure. To do this add to the pom of the project the next |
|
151 |
configuration of plugin "maven-surefire-plugin" :: |
|
152 |
|
|
153 |
<build> |
|
154 |
<plugins> |
|
155 |
... |
|
156 |
<plugin> |
|
157 |
<!-- Continue on test failure --> |
|
158 |
<groupId>org.apache.maven.plugins</groupId> |
|
159 |
<artifactId>maven-surefire-plugin</artifactId> |
|
160 |
<configuration> |
|
161 |
<testFailureIgnore>true</testFailureIgnore> |
|
162 |
</configuration> |
|
163 |
</plugin> |
|
164 |
... |
|
165 |
</plugins> |
|
166 |
</build> |
|
167 |
|
|
168 |
|
|
169 |
Set java compatibility |
|
170 |
-------------------------- |
|
171 |
|
|
172 |
To set the compatibility with a java version add to the |
|
173 |
pom of the project the next configuration of plugin |
|
174 |
"maven-compiler-plugin" :: |
|
175 |
|
|
176 |
<build> |
|
177 |
<plugins> |
|
178 |
... |
|
179 |
<plugin> |
|
180 |
<!-- Set java compatibility --> |
|
181 |
<groupId>org.apache.maven.plugins</groupId> |
|
182 |
<artifactId>maven-compiler-plugin</artifactId> |
|
183 |
<configuration> |
|
184 |
<source>1.5</source> |
|
185 |
<target>1.5</target> |
|
186 |
<encoding>ISO-8859-1</encoding> |
|
187 |
</configuration> |
|
188 |
</plugin> |
|
189 |
... |
|
190 |
</plugins> |
|
191 |
</build> |
|
192 |
|
|
193 |
Packaging tests in jar |
|
194 |
------------------------ |
|
195 |
|
|
196 |
Test classes do not packaging in jar by default. |
|
197 |
To packing add to pom:: |
|
198 |
|
|
199 |
<build> |
|
200 |
<plugins> |
|
201 |
... |
|
202 |
<plugin> |
|
203 |
<!-- Packaging tests in jar --> |
|
204 |
<groupId>org.apache.maven.plugins</groupId> |
|
205 |
<artifactId>maven-jar-plugin</artifactId> |
|
206 |
<executions> |
|
207 |
<!-- Generates a jar file only with the test classes --> |
|
208 |
<execution> |
|
209 |
<goals> |
|
210 |
<goal>test-jar</goal> |
|
211 |
</goals> |
|
212 |
<configuration> |
|
213 |
<includes> |
|
214 |
<include>**/**</include> |
|
215 |
</includes> |
|
216 |
</configuration> |
|
217 |
</execution> |
|
218 |
</executions> |
|
219 |
</plugin> |
|
220 |
... |
|
221 |
</plugins> |
|
222 |
</build> |
|
223 |
|
|
224 |
How to set a dependency with tests jar |
|
225 |
----------------------------------------- |
|
226 |
|
|
227 |
You can set a dependency with a test jar adding to |
|
228 |
the declaration of the dependency the scope of |
|
229 |
test and the type of "test-jar":: |
|
230 |
|
|
231 |
<dependency> |
|
232 |
<groupId>...</groupId> |
|
233 |
<artifactId>...</artifactId> |
|
234 |
<type>test-jar</type> |
|
235 |
<scope>test</scope> |
|
236 |
</dependency> |
|
237 |
|
|
238 |
How use ant in maven |
|
239 |
------------------------- |
|
240 |
|
|
241 |
You can use ant embed in the pom of you project. |
|
242 |
To do this use:: |
|
243 |
|
|
244 |
<plugin> |
|
245 |
<artifactId>maven-antrun-plugin</artifactId> |
|
246 |
<version>1.7</version> |
|
247 |
<executions> |
|
248 |
<execution> |
|
249 |
<phase>generate-sources</phase> |
|
250 |
<configuration> |
|
251 |
<target> |
|
252 |
<echo>Hello world!</echo> |
|
253 |
</target> |
|
254 |
</configuration> |
|
255 |
<goals> |
|
256 |
<goal>run</goal> |
|
257 |
</goals> |
|
258 |
</execution> |
|
259 |
</executions> |
|
260 |
</plugin> |
|
261 |
|
|
262 |
Fail when execute "mvn deploy" with "No connector available" |
|
263 |
------------------------------------------------------------- |
|
264 |
|
|
265 |
When execute a "mvn deploy" fail with the error:: |
|
266 |
|
|
267 |
[INFO] ------------------------------------------------------------------------ |
|
268 |
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy |
|
269 |
(default-deploy) on project org.gvsig.desktop: Failed to deploy artifacts/metadata: |
|
270 |
No connector available to access repository gvsig-repository (dav:https://devel.gvsig.org/m2repo/j2se) |
|
271 |
of type default using the available factories WagonRepositoryConnectorFactory -> [Help 1] |
|
272 |
[ERROR] |
|
273 |
|
|
274 |
This happens to be configured the webdav wagon as an extension in the section "build":: |
|
275 |
|
|
276 |
... |
|
277 |
<build> |
|
278 |
<extensions> |
|
279 |
<extension> |
|
280 |
<groupId>org.apache.maven.wagon</groupId> |
|
281 |
<artifactId>wagon-webdav-jackrabbit</artifactId> |
|
282 |
<version>1.0-beta-7</version> |
|
283 |
</extension> |
|
284 |
</extensions> |
|
285 |
... |
|
286 |
|
|
287 |
Fail when execute "mvn release: prepare" with "svn command failed... Could not authenticate" |
|
288 |
------------------------------------------------------------------------------------------------ |
|
289 |
|
|
290 |
When running "mvn release: prepare" updates poms, compiles, and then |
|
291 |
fails with the following error :: |
|
292 |
|
|
293 |
[INFO] ------------------------------------------------------------------------ |
|
294 |
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:prepare |
|
295 |
(default-cli) on project org.gvsig.desktop: Unable to commit files |
|
296 |
[ERROR] Provider message: |
|
297 |
[ERROR] The svn command failed. |
|
298 |
[ERROR] Command output: |
|
299 |
[ERROR] svn: Commit failed (details follow): |
|
300 |
[ERROR] svn: MKACTIVITY of '/svn/gvsig-desktop/!svn/act/931a27bc-57e8-45d9-adcd-5a2cf54a7045': |
|
301 |
authorization failed: Could not authenticate to server: rejected Basic challenge (https://devel.gvsig.org) |
|
302 |
[ERROR] -> [Help 1] |
|
303 |
[ERROR] |
|
304 |
[ERROR] |
|
305 |
|
|
306 |
Apparently maven in linux system use the svn of system and if you're not |
|
307 |
authenticated when trying to access to the repository, svn fails. |
|
308 |
|
|
309 |
This is solved by executing a commit from the command line on |
|
310 |
some file of the project (only if you have not enabled the option |
|
311 |
"store-passwords = no" in $ HOME / .subversion / config). For example, you |
|
312 |
can add or remove at the end of "pom.xml" a blank line and then run |
|
313 |
from the command line :: |
|
314 |
|
|
315 |
svn ci -m "" pom.xml |
|
316 |
|
|
317 |
Another option that works on Windows in declaring the user and password in the command: |
|
318 |
|
|
319 |
mvn release:prepare -Dusername=[username] -Dpassword=[password] |
|
320 |
|
|
321 |
|
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Thu Aug 27 08:40:19 CEST 2015 |
|
2 |
buildNumber=23 |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/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. --> |
|
12 |
<assembly> |
|
13 |
<id>gvsig-plugin-package</id> |
|
14 |
<formats> |
|
15 |
<format>zip</format> |
|
16 |
</formats> |
|
17 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
18 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
19 |
<files> |
|
20 |
<file> |
|
21 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
22 |
<outputDirectory>lib</outputDirectory> |
|
23 |
</file> |
|
24 |
<file> |
|
25 |
<source>target/package.info</source> |
|
26 |
</file> |
|
27 |
</files> |
|
28 |
|
|
29 |
<fileSets> |
|
30 |
<fileSet> |
|
31 |
<directory>src/main/resources-plugin</directory> |
|
32 |
<outputDirectory>.</outputDirectory> |
|
33 |
</fileSet> |
|
34 |
</fileSets> |
|
35 |
|
|
36 |
|
|
37 |
<dependencySets> |
|
38 |
<dependencySet> |
|
39 |
<useProjectArtifact>false</useProjectArtifact> |
|
40 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
41 |
<outputDirectory>lib</outputDirectory> |
|
42 |
<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 |
<include>org.gvsig:org.gvsig.vectorediting.lib.prov.trimline</include> |
|
74 |
<include>org.gvsig:org.gvsig.vectorediting.lib.prov.rectangularmatrix</include> |
|
75 |
<include>org.gvsig:org.gvsig.vectorediting.lib.prov.polarmatrix</include> |
|
76 |
<include>org.gvsig:org.gvsig.vectorediting.lib.prov.editvertex</include> |
|
77 |
<include>org.gvsig:org.gvsig.vectorediting.lib.prov.remove</include> |
|
78 |
<include>org.gvsig:org.gvsig.vectorediting.lib.prov.converttopolyline</include> |
|
79 |
<include>org.gvsig:org.gvsig.vectorediting.lib.prov.reversedirection</include> |
|
80 |
</includes> |
|
81 |
</dependencySet> |
|
82 |
</dependencySets> |
|
83 |
|
|
84 |
</assembly> |
|
85 |
|
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/vectorediting/app/mainplugin/ServiceExtension.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2014 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.vectorediting.app.mainplugin; |
|
25 |
|
|
26 |
import org.gvsig.andami.plugins.Extension; |
|
27 |
import org.gvsig.app.ApplicationLocator; |
|
28 |
import org.gvsig.app.ApplicationManager; |
|
29 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
30 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
33 |
import org.gvsig.vectorediting.swing.api.EditingContext; |
|
34 |
import org.gvsig.vectorediting.swing.api.EditingSwingLocator; |
|
35 |
import org.gvsig.vectorediting.swing.api.EditingSwingManager; |
|
36 |
|
|
37 |
public class ServiceExtension extends Extension { |
|
38 |
|
|
39 |
public void initialize() { |
|
40 |
} |
|
41 |
|
|
42 |
public void execute(String actionCommand) { |
|
43 |
IView view = getActiveView(); |
|
44 |
EditingSwingManager swingManager = |
|
45 |
EditingSwingLocator.getSwingManager(); |
|
46 |
|
|
47 |
if (view != null) { |
|
48 |
EditingContext editingContext = |
|
49 |
swingManager.getEditingContext(view.getMapControl()); |
|
50 |
editingContext.activateService(actionCommand); |
|
51 |
} |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
public boolean isEnabled() { |
|
56 |
return this.isVisible(); |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public boolean isEnabled(String action) { |
|
61 |
IView view = getActiveView(); |
|
62 |
FLyrVect activeLayer = getActiveLayer(view); |
|
63 |
|
|
64 |
if ((view != null) && (activeLayer != null) && activeLayer.isEditing() && action!=null) { |
|
65 |
EditingSwingManager swingManager = |
|
66 |
EditingSwingLocator.getSwingManager(); |
|
67 |
EditingContext editingContext = |
|
68 |
swingManager.getEditingContext(view.getMapControl()); |
|
69 |
return editingContext.isServiceCompatible(action); |
|
70 |
} |
|
71 |
return false; |
|
72 |
} |
|
73 |
|
|
74 |
public boolean isVisible() { |
|
75 |
IView view = getActiveView(); |
|
76 |
FLyrVect activeLayer = getActiveLayer(view); |
|
77 |
return ((view != null) && (activeLayer != null) && activeLayer |
|
78 |
.isEditing()); |
|
79 |
} |
|
80 |
|
|
81 |
@Override |
|
82 |
public boolean isVisible(String action) { |
|
83 |
return this.isVisible(); |
|
84 |
} |
|
85 |
|
|
86 |
@Override |
|
87 |
public boolean canQueryByAction() { |
|
88 |
return true; |
|
89 |
} |
|
90 |
|
|
91 |
private IView getActiveView() { |
|
92 |
|
|
93 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
94 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
95 |
return view; |
|
96 |
} |
|
97 |
|
|
98 |
private FLyrVect getActiveLayer(IView view) { |
|
99 |
if (view != null) { |
|
100 |
ViewDocument viewDocument = view.getViewDocument(); |
|
101 |
FLayer[] actives = |
|
102 |
viewDocument.getMapContext().getLayers().getActives(); |
|
103 |
|
|
104 |
if ((actives.length == 1) && (actives[0] instanceof FLyrVect)) { |
|
105 |
return (FLyrVect) actives[0]; |
|
106 |
} |
|
107 |
} |
|
108 |
return null; |
|
109 |
} |
|
110 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/vectorediting/app/mainplugin/EditingExtension.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2014 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.vectorediting.app.mainplugin; |
|
25 |
|
|
26 |
import java.io.File; |
|
27 |
import java.util.ArrayList; |
|
28 |
import java.util.Iterator; |
|
29 |
import java.util.List; |
|
30 |
|
|
31 |
import org.slf4j.Logger; |
|
32 |
import org.slf4j.LoggerFactory; |
|
33 |
|
|
34 |
import org.gvsig.andami.IconThemeHelper; |
|
35 |
import org.gvsig.andami.PluginServices; |
|
36 |
import org.gvsig.andami.PluginsLocator; |
|
37 |
import org.gvsig.andami.actioninfo.ActionInfoManager; |
|
38 |
import org.gvsig.andami.plugins.Extension; |
|
39 |
import org.gvsig.andami.plugins.IExtension; |
|
40 |
import org.gvsig.andami.plugins.status.IExtensionStatus; |
|
41 |
import org.gvsig.andami.plugins.status.IUnsavedData; |
|
42 |
import org.gvsig.andami.plugins.status.UnsavedData; |
|
43 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
44 |
import org.gvsig.andami.ui.mdiManager.SingletonWindow; |
|
45 |
import org.gvsig.app.ApplicationLocator; |
|
46 |
import org.gvsig.app.ApplicationManager; |
|
47 |
import org.gvsig.app.project.DocumentsContainer; |
|
48 |
import org.gvsig.app.project.documents.Document; |
|
49 |
import org.gvsig.app.project.documents.gui.IDocumentWindow; |
|
50 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
51 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
|
52 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
53 |
import org.gvsig.app.project.documents.view.toc.actions.EndEditingTocMenuEntry; |
|
54 |
import org.gvsig.app.project.documents.view.toc.actions.StartEditingTocMenuEntry; |
|
55 |
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener; |
|
56 |
import org.gvsig.fmap.dal.exception.DataException; |
|
57 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
58 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
59 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
60 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
61 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
62 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
63 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
64 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException; |
|
65 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
|
66 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
67 |
import org.gvsig.fmap.mapcontrol.MapControlCreationListener; |
|
68 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
|
69 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
|
70 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior; |
|
71 |
import org.gvsig.tools.ToolsLocator; |
|
72 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
73 |
import org.gvsig.tools.observer.Notification; |
|
74 |
import org.gvsig.tools.observer.Observable; |
|
75 |
import org.gvsig.tools.observer.Observer; |
|
76 |
import org.gvsig.utils.swing.threads.IMonitorableTask; |
|
77 |
import org.gvsig.vectorediting.lib.spi.EditingProviderLocator; |
|
78 |
import org.gvsig.vectorediting.lib.spi.EditingProviderManager; |
|
79 |
import org.gvsig.vectorediting.swing.api.EditingContext; |
|
80 |
import org.gvsig.vectorediting.swing.api.EditingSwingLocator; |
|
81 |
import org.gvsig.vectorediting.swing.api.EditingSwingManager; |
|
82 |
|
|
83 |
public class EditingExtension extends Extension implements Observer { |
|
84 |
|
|
85 |
private static Logger logger = LoggerFactory.getLogger(EditingExtension.class); |
|
86 |
|
|
87 |
public void execute(String actionCommand) { |
|
88 |
|
|
89 |
IView view = getActiveView(); |
|
90 |
EditingSwingManager swingManager = |
|
91 |
EditingSwingLocator.getSwingManager(); |
|
92 |
|
|
93 |
if (view != null) { |
|
94 |
|
|
95 |
FLyrVect layer = getActiveLayer(view); |
|
96 |
EditingContext editingContext = |
|
97 |
swingManager.getEditingContext(view.getMapControl()); |
|
98 |
|
|
99 |
if ("start-editing".equals(actionCommand)) { |
|
100 |
|
|
101 |
if (canBeEdited(layer)) { |
|
102 |
MapControl mapControl = view.getMapControl(); |
|
103 |
StatusBarListener sbl = new StatusBarListener(mapControl); |
|
104 |
editingContext.beginEdition(layer); |
|
105 |
editingContext.addObserver(this); |
|
106 |
ApplicationLocator.getManager().refreshMenusAndToolBars(); |
|
107 |
} |
|
108 |
|
|
109 |
} else if ("end-editing".equals(actionCommand)) { |
|
110 |
|
|
111 |
if ((layer != null) && layer.isEditing()) { |
|
112 |
editingContext.endEdition(layer); |
|
113 |
ApplicationLocator.getManager().refreshMenusAndToolBars(); |
|
114 |
} |
|
115 |
|
|
116 |
} |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
public void initialize() { |
|
121 |
registerIcons(); |
|
122 |
|
|
123 |
// Disable default view panel console. Uses editing context console. |
|
124 |
DefaultViewPanel.setDisableConsole(true); |
|
125 |
|
|
126 |
// Adding TOC menu entry |
|
127 |
ExtensionPoint exPoint = ToolsLocator.getExtensionPointManager().add( |
|
128 |
"View_TocActions", ""); |
|
129 |
exPoint.append( |
|
130 |
StartEditingTocMenuEntry.EXTENSION_POINT_NAME, |
|
131 |
"TOC popup menu to start vector layer's editing", |
|
132 |
new StartEditingTocMenuEntry()); |
|
133 |
exPoint.append( |
|
134 |
EndEditingTocMenuEntry.EXTENSION_POINT_NAME, |
|
135 |
"TOC popup menu to end vector layer's editing", |
|
136 |
new EndEditingTocMenuEntry()); |
|
137 |
} |
|
138 |
|
|
139 |
|
|
140 |
private void registerIcons() { |
|
141 |
IconThemeHelper.registerIcon("vectorediting", "vector-editing", this); |
|
142 |
} |
|
143 |
|
|
144 |
@Override |
|
145 |
public void postInitialize() { |
|
146 |
super.postInitialize(); |
|
147 |
registerSymbols(); |
|
148 |
|
|
149 |
MapControlLocator.getMapControlManager().addMapControlCreationListener(new MapControlCreationListener() { |
|
150 |
|
|
151 |
public MapControl mapControlCreated(MapControl mapControl) { |
|
152 |
EditingContext editingContext = EditingSwingLocator.getSwingManager().getEditingContext(mapControl); |
|
153 |
StatusBarListener sbl = new StatusBarListener(mapControl); |
|
154 |
editingContext.setDefaultBehaviors(new Behavior[] { new MouseMovementBehavior(sbl) }); |
|
155 |
editingContext.addObserver(EditingExtension.this); |
|
156 |
ApplicationLocator.getManager().refreshMenusAndToolBars(); |
|
157 |
return mapControl; |
|
158 |
} |
|
159 |
}); |
|
160 |
} |
|
161 |
|
|
162 |
/** |
|
163 |
* Register all symbols in the plugin symbols folder in the providerManager. |
|
164 |
* The description of the symbols must be unique because the key used for registration is the proper description of the symbol. |
|
165 |
* |
|
166 |
*/ |
|
167 |
private void registerSymbols() { |
|
168 |
|
|
169 |
EditingProviderManager providerManager = |
|
170 |
EditingProviderLocator.getProviderManager(); |
|
171 |
|
|
172 |
SymbolManager symbolManager = MapContextLocator.getSymbolManager(); |
|
173 |
File pluginFolder = getPlugin().getPluginDirectory(); |
|
174 |
String pathSeparator = System.getProperty("file.separator"); |
|
175 |
String symbolsPath = pluginFolder.getAbsolutePath()+pathSeparator+"symbols"+pathSeparator+"editing"; |
|
176 |
File symbolsFolder = new File(symbolsPath); |
|
177 |
ISymbol[] symbols = null; |
|
178 |
try { |
|
179 |
symbols = symbolManager.loadSymbols(symbolsFolder); |
|
180 |
} catch (SymbolException e) { |
|
181 |
logger.warn("No symbols loaded from "+symbolsPath, e); |
|
182 |
} |
|
183 |
|
|
184 |
if (symbols != null) { |
|
185 |
for (int i = 0; i < symbols.length; i++) { |
|
186 |
ISymbol symbol = symbols[i]; |
|
187 |
String description = symbol.getDescription(); |
|
188 |
providerManager.registerSymbol(description, symbol); |
|
189 |
} |
|
190 |
} |
|
191 |
} |
|
192 |
|
|
193 |
public boolean isEnabled() { |
|
194 |
return true; |
|
195 |
} |
|
196 |
|
|
197 |
public boolean isVisible() { |
|
198 |
return true; |
|
199 |
} |
|
200 |
|
|
201 |
@Override |
|
202 |
public boolean isVisible(String action) { |
|
203 |
IView view = getActiveView(); |
|
204 |
FLyrVect activeLayer = getActiveLayer(view); |
|
205 |
|
|
206 |
if ("start-editing".equals(action)) { |
|
207 |
return ((view != null) && (activeLayer != null) && !activeLayer |
|
208 |
.isEditing()); |
|
209 |
|
|
210 |
} else { |
|
211 |
return ((view != null) && (activeLayer != null) && activeLayer |
|
212 |
.isEditing()); |
|
213 |
|
|
214 |
} |
|
215 |
} |
|
216 |
|
|
217 |
@Override |
|
218 |
public boolean isEnabled(String action) { |
|
219 |
|
|
220 |
IView vista = getActiveView(); |
|
221 |
FLyrVect activeLayer = getActiveLayer(vista); |
|
222 |
|
|
223 |
if ("start-editing".equals(action)) { |
|
224 |
return (canBeEdited(activeLayer)); |
|
225 |
|
|
226 |
} else if ("end-editing".equals(action)) { |
|
227 |
return activeLayer.isEditing(); |
|
228 |
|
|
229 |
} |
|
230 |
|
|
231 |
return false; |
|
232 |
|
|
233 |
} |
|
234 |
|
|
235 |
@Override |
|
236 |
public boolean canQueryByAction() { |
|
237 |
return true; |
|
238 |
} |
|
239 |
|
|
240 |
private IView getActiveView() { |
|
241 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
242 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
243 |
return view; |
|
244 |
} |
|
245 |
|
|
246 |
private boolean canBeEdited(FLyrVect layer) { |
|
247 |
if (layer != null && layer.isAvailable()) { |
|
248 |
|
|
249 |
boolean isWritable = layer.isWritable(); |
|
250 |
boolean isNotTransformed = |
|
251 |
layer.getFeatureStore().getTransforms().isEmpty(); |
|
252 |
|
|
253 |
return isWritable && isNotTransformed && !layer.isEditing(); |
|
254 |
} |
|
255 |
|
|
256 |
return false; |
|
257 |
} |
|
258 |
|
|
259 |
private FLyrVect getActiveLayer(IView vista) { |
|
260 |
if (vista != null) { |
|
261 |
ViewDocument viewDocument = vista.getViewDocument(); |
|
262 |
FLayer[] actives = |
|
263 |
viewDocument.getMapContext().getLayers().getActives(); |
|
264 |
|
|
265 |
if ((actives.length == 1) && (actives[0] instanceof FLyrVect)) { |
|
266 |
return (FLyrVect) actives[0]; |
|
267 |
} |
|
268 |
} |
|
269 |
return null; |
|
270 |
} |
|
271 |
|
|
272 |
public void update(Observable observable, Object notification) { |
|
273 |
|
|
274 |
if (notification instanceof Notification){ |
|
275 |
ApplicationManager appManager = |
|
276 |
ApplicationLocator.getManager(); |
|
277 |
Notification n = (Notification)notification; |
|
278 |
if (n.getType().equalsIgnoreCase(EditingContext.CHANGE_SELECTED_TOOL_NOTIFICATION)){ |
|
279 |
String name = (String)n.getValue(); |
|
280 |
logger.info("Changed selected tool to '{}'", name); |
|
281 |
PluginServices.getMainFrame().setSelectedTool(name); |
|
282 |
appManager.refreshMenusAndToolBars(); |
|
283 |
|
|
284 |
} else if (n.getType().equalsIgnoreCase(EditingContext.REFRESH_TOOLS_NOTIFICATION)){ |
|
285 |
appManager.refreshMenusAndToolBars(); |
|
286 |
} |
|
287 |
} |
|
288 |
} |
|
289 |
|
|
290 |
private List<FLyrVect> getEditedLayers(){ |
|
291 |
List<FLyrVect> editedLayers = new ArrayList<FLyrVect>(); |
|
292 |
|
|
293 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
294 |
IWindow[] windows = application.getUIManager().getOrderedWindows(); |
|
295 |
for (int i = 0; i < windows.length; i++) { |
|
296 |
IWindow window = windows[i]; |
|
297 |
if (window instanceof SingletonWindow && window instanceof IDocumentWindow) { |
|
298 |
// Recorremos las ventanas. |
|
299 |
// Cogemos el model de aquellas que sea de tipo Document. |
|
300 |
// Si el model es de tipo View, |
|
301 |
// comprobamos que adem?s sean de tipo View. |
|
302 |
// Le pedimos al mapContext de la View las layers |
|
303 |
// y a?adimos a editedLayers aquellas layers vectoriales que est?n en edici?n. |
|
304 |
Document document; |
|
305 |
try { |
|
306 |
document = (Document) ((SingletonWindow) window).getWindowModel(); |
|
307 |
} catch (ClassCastException e) { |
|
308 |
// Do nothing, skip this window |
|
309 |
continue; |
|
310 |
} |
|
311 |
if (ViewDocument.class.isAssignableFrom(document.getClass())) { |
|
312 |
ViewDocument view = (ViewDocument) document; |
|
313 |
MapContext mapContext = view.getMapContext(); |
|
314 |
if (mapContext != null) { |
|
315 |
FLayers layers = mapContext.getLayers(); |
|
316 |
for (int j = 0; j < layers.getLayersCount(); j++) { |
|
317 |
FLayer lyr = layers.getLayer(j); |
|
318 |
if (lyr instanceof FLyrVect) { |
|
319 |
FLyrVect layerVect = (FLyrVect) lyr; |
|
320 |
if (layerVect.isEditing()) { |
|
321 |
editedLayers.add(layerVect); |
|
322 |
} |
|
323 |
} |
|
324 |
} |
|
325 |
} |
|
326 |
} |
|
327 |
} |
|
328 |
} |
|
329 |
return editedLayers; |
|
330 |
} |
|
331 |
|
|
332 |
private List<IUnsavedData> getUnsavedData(List<FLyrVect> editedLayers){ |
|
333 |
List<IUnsavedData> unsavedData = new ArrayList<IUnsavedData>(); |
|
334 |
for (Iterator iterator = editedLayers.iterator(); iterator.hasNext();) { |
|
335 |
FLyrVect editedLayer = (FLyrVect) iterator.next(); |
|
336 |
IUnsavedData unsavedDataLayer = new UnsavedLayer(this, editedLayer); |
|
337 |
unsavedData.add(unsavedDataLayer); |
|
338 |
} |
|
339 |
return unsavedData; |
|
340 |
|
|
341 |
} |
|
342 |
|
|
343 |
private static class UnsavedLayer extends UnsavedData { |
|
344 |
private FLyrVect layer; |
|
345 |
|
|
346 |
public UnsavedLayer(IExtension extension, FLyrVect layer) { |
|
347 |
super(extension); |
|
348 |
this.layer = layer; |
|
349 |
} |
|
350 |
|
|
351 |
@Override |
|
352 |
public String getDescription() { |
|
353 |
return layer.getName(); |
|
354 |
} |
|
355 |
|
|
356 |
@Override |
|
357 |
public String getResourceName() { |
|
358 |
return layer.getFeatureStore().getFullName(); |
|
359 |
} |
|
360 |
|
|
361 |
@Override |
|
362 |
public boolean saveData() { |
|
363 |
FeatureStore featureStore = layer.getFeatureStore(); |
|
364 |
if(featureStore.isEditing()){ |
|
365 |
try { |
|
366 |
featureStore.finishEditing(); |
|
367 |
return true; |
|
368 |
} catch (DataException e) { |
|
369 |
throw new RuntimeException(e); |
|
370 |
} |
|
371 |
} |
|
372 |
return true; |
|
373 |
} |
|
374 |
} |
|
375 |
|
|
376 |
@Override |
|
377 |
public IExtensionStatus getStatus() { |
|
378 |
List<FLyrVect> editedLayers = getEditedLayers(); |
|
379 |
final List<IUnsavedData> unsavedData = getUnsavedData(editedLayers); |
|
380 |
|
|
381 |
return new IExtensionStatus() { |
|
382 |
|
|
383 |
public boolean hasUnsavedData() { |
|
384 |
if(unsavedData == null){ |
|
385 |
return false; |
|
386 |
} |
|
387 |
return !unsavedData.isEmpty(); |
|
388 |
} |
|
389 |
|
|
390 |
public boolean hasRunningProcesses() { |
|
391 |
return false; |
|
392 |
} |
|
393 |
|
|
394 |
public IUnsavedData[] getUnsavedData() { |
|
395 |
if(unsavedData == null){ |
|
396 |
return null; |
|
397 |
} |
|
398 |
return unsavedData.toArray(new IUnsavedData[0]); |
|
399 |
} |
|
400 |
|
|
401 |
public IMonitorableTask[] getRunningProcesses() { |
|
402 |
return null; |
|
403 |
} |
|
404 |
}; |
|
405 |
} |
|
406 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/toc/actions/EndEditingTocMenuEntry.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.app.project.documents.view.toc.actions; |
|
25 |
|
|
26 |
import org.slf4j.Logger; |
|
27 |
import org.slf4j.LoggerFactory; |
|
28 |
|
|
29 |
import org.gvsig.andami.PluginServices; |
|
30 |
import org.gvsig.andami.plugins.IExtension; |
|
31 |
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction; |
|
32 |
import org.gvsig.app.project.documents.view.toc.ITocItem; |
|
33 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
34 |
import org.gvsig.vectorediting.app.mainplugin.EditingExtension; |
|
35 |
|
|
36 |
|
|
37 |
public class EndEditingTocMenuEntry extends AbstractTocContextMenuAction { |
|
38 |
|
|
39 |
public static final String EXTENSION_POINT_NAME = "EndEditing"; |
|
40 |
|
|
41 |
private IExtension ext = null; |
|
42 |
|
|
43 |
private static Logger logger = |
|
44 |
LoggerFactory.getLogger(EndEditingTocMenuEntry.class); |
|
45 |
|
|
46 |
public String getGroup() { |
|
47 |
return "vectorEditing"; |
|
48 |
} |
|
49 |
|
|
50 |
public int getGroupOrder() { |
|
51 |
return 0; |
|
52 |
} |
|
53 |
|
|
54 |
public int getOrder() { |
|
55 |
return 1; |
|
56 |
} |
|
57 |
|
|
58 |
public String getText() { |
|
59 |
return PluginServices.getText(this, "end_editing"); |
|
60 |
} |
|
61 |
|
|
62 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
|
63 |
return ((EditingExtension)getExtension()).isEnabled("end-editing"); |
|
64 |
} |
|
65 |
|
|
66 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
|
67 |
return ((EditingExtension)getExtension()).isVisible("end-editing"); |
|
68 |
} |
|
69 |
|
|
70 |
|
|
71 |
public void execute(ITocItem item, FLayer[] selItems) { |
|
72 |
getExtension().execute("end-editing"); |
|
73 |
} |
|
74 |
|
|
75 |
private IExtension getExtension() { |
|
76 |
|
|
77 |
if (ext == null) { |
|
78 |
ext = PluginServices.getExtension(EditingExtension.class); |
|
79 |
} |
|
80 |
return ext; |
|
81 |
} |
|
82 |
|
|
83 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/toc/actions/StartEditingTocMenuEntry.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.app.project.documents.view.toc.actions; |
|
25 |
|
|
26 |
import org.slf4j.Logger; |
|
27 |
import org.slf4j.LoggerFactory; |
|
28 |
|
|
29 |
import org.gvsig.andami.PluginServices; |
|
30 |
import org.gvsig.andami.plugins.IExtension; |
|
31 |
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction; |
|
32 |
import org.gvsig.app.project.documents.view.toc.ITocItem; |
|
33 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
34 |
import org.gvsig.vectorediting.app.mainplugin.EditingExtension; |
|
35 |
|
|
36 |
|
|
37 |
public class StartEditingTocMenuEntry extends AbstractTocContextMenuAction { |
|
38 |
|
|
39 |
public static final String EXTENSION_POINT_NAME = "StartEditing"; |
|
40 |
|
|
41 |
private IExtension ext = null; |
|
42 |
|
|
43 |
private static Logger logger = |
|
44 |
LoggerFactory.getLogger(StartEditingTocMenuEntry.class); |
|
45 |
|
|
46 |
public String getGroup() { |
|
47 |
return "vectorEditing"; |
|
48 |
} |
|
49 |
|
|
50 |
public int getGroupOrder() { |
|
51 |
return 0; |
|
52 |
} |
|
53 |
|
|
54 |
public int getOrder() { |
|
55 |
return 0; |
|
56 |
} |
|
57 |
|
|
58 |
public String getText() { |
|
59 |
return PluginServices.getText(this, "start_editing"); |
|
60 |
} |
|
61 |
|
|
62 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
|
63 |
return ((EditingExtension)getExtension()).isEnabled("start-editing"); |
|
64 |
} |
|
65 |
|
|
66 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
|
67 |
return ((EditingExtension)getExtension()).isVisible("start-editing"); |
|
68 |
} |
|
69 |
|
|
70 |
|
|
71 |
public void execute(ITocItem item, FLayer[] selItems) { |
|
72 |
getExtension().execute("start-editing"); |
|
73 |
} |
|
74 |
|
|
75 |
private IExtension getExtension() { |
|
76 |
|
|
77 |
if (ext == null) { |
|
78 |
ext = PluginServices.getExtension(EditingExtension.class); |
|
79 |
} |
|
80 |
return ext; |
|
81 |
} |
|
82 |
|
|
83 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
1 |
start_editing = Comenzar edici\u00F3n |
|
2 |
end_editing = Terminar edici\u00F3n |
|
3 |
insert_point = Insertar punto |
|
4 |
insert_multipoint = Insertar MultiPunto |
|
5 |
insert_line = Insertar l\u00EDnea |
|
6 |
insert_arc = Insertar arco |
|
7 |
insert_circle_cr = Insertar c\u00EDrculo (centro y radio) |
|
8 |
insert_circumference_cr = Insertar circunferencia (centro y radio) |
|
9 |
insert_circle_3p = Insertar c\u00EDrculo (tres puntos) |
|
10 |
insert_circumference_3p = Insertar circunferencia (tres puntos) |
|
11 |
insert_ellipse = Insertar elipse |
|
12 |
insert_filled_ellipse = Insertar elipse rellena |
|
13 |
insert_polyline = Insertar polil\u00EDnea |
|
14 |
insert_polygon = Insertar pol\u00EDgono |
|
15 |
insert_regular_polygon = Insertar pol\u00EDgono regular |
|
16 |
insert_filled_regular_polygon = Insertar pol\u00EDgono regular relleno |
|
17 |
insert_rectangle = Insertar rect\u00E1ngulo |
|
18 |
insert_filled_rectangle = Insertar rect\u00E1ngulo relleno |
|
19 |
insert_spline= Insertar curva spline |
|
20 |
insert_filled_spline = Insertar curva spline rellena |
|
21 |
insert_rectangular_matrix = Matriz rectangular de geometr\u00EDas |
|
22 |
insert_polar_matrix = Matriz polar de geometr\u00EDas |
|
23 |
modify_internal_polygon = Pol\u00EDgono interno |
|
24 |
modify_explode_geometry = Descomponer geometr\u00EDa |
|
25 |
modify_move = Mover geometr\u00EDa |
|
26 |
modify_rotate = Rotar geometr\u00EDa |
|
27 |
modify_duplicate = Duplicar geometr\u00EDa |
|
28 |
modify_split_line = Partir linea por un punto |
|
29 |
modify_split = Partir geometr\u00EDa |
|
30 |
modify_scale = Escalar geometr\u00EDa |
|
31 |
modify_simplify = Simplificar geometr\u00EDa |
|
32 |
modify_join = Unir geometr\u00EDas |
|
33 |
insert_autopolygon = Insertar autopol\u00EDgono |
|
34 |
modify_stretch = Estirar geometr\u00EDa |
|
35 |
modify_extend_line = Alargar l\u00EDnea hasta objeto |
|
36 |
modify_trim_line = Recortar l\u00EDnea por un objeto |
|
37 |
modify_edit_vertex = Editar v\u00E9rtice |
|
38 |
modify_convert_to_polyline= Convertir a polil\u00EDnea |
|
39 |
modify_reverse_direction=Invertir direcci\u00F3n |
|
40 |
uniqueselection = Seleccione una \u00FAnica geometr\u00EDa |
|
41 |
selectvertex = Seleccione un v\u00E9rtice |
|
42 |
new_position = Nueva posici\u00F3n |
|
43 |
insert_vertex = Insertar v\u00E9rtice |
|
44 |
remove_vertex = Eliminar v\u00E9rtice |
|
45 |
selection=Selecci\u00F3n |
|
46 |
invalid_option=Opci\u00F3n no v\u00E1lida |
|
47 |
center=Centro |
|
48 |
radius=Radio |
|
49 |
save_changes_performed=Guardar cambios realizados |
|
50 |
discard= Descartar |
|
51 |
discard_and_loose_changes= Descartar cambios y perder los cambios |
|
52 |
continue= Continuar |
|
53 |
do_not_save_yet_stay_in_editing_mode= No guardar los cambios y seguir en modo edici\u00F3n |
|
54 |
indicate_new_point= Indique un nuevo punto |
|
55 |
arc_mode = Modo arco |
|
56 |
line_mode = Modo l\u00EDnea |
|
57 |
select_new_tool= Seleccione una nueva herramienta |
|
58 |
draw_geometry_to_internal_polygon= Seleccione una herramienta para dibujar un pol\u00EDgono interno |
|
59 |
draw_geometry_to_autopolygon = Seleccione una herramienta para dibujar un autopol\u00EDgono |
|
60 |
draw_geometry_to_split = Seleccione una herramienta para partir las geometr\u00EDas |
|
61 |
draw_geometry_to_select_vertex = Seleccione una herramienta poligonal para seleccionar v\u00E9rtices |
|
62 |
save = Guardar |
|
63 |
discard = Descartar |
|
64 |
continue = Continuar |
|
65 |
export = Exportar |
|
66 |
ask_save_layer = \u00BFDesea guardar la capa |
|
67 |
can_not_write_layer = No existe writer para este formato de capa o no tiene permisos de escritura.\n\u00BFQu\u00E9 desea hacer? |
|
68 |
save_changes_performed = Guardar cambios realizados |
|
69 |
discard_and_loose_changes = Descartar y perder los cambios |
|
70 |
export_to_another_format = Exportar a otro formato |
|
71 |
do_not_save_yet_stay_in_editing_mode = No guardar los cambios y seguir editando |
|
72 |
first_point= Primer punto |
|
73 |
second_point= Segundo punto |
|
74 |
third_point= Tercer punto |
|
75 |
start_point= Punto de inicio |
|
76 |
middle_point= Punto medio |
|
77 |
end_point= Punto final |
|
78 |
first_point_A_axis = Primer punto del eje A |
|
79 |
second_point_A_axis = Segundo punto del eje A |
|
80 |
length_of_B_axis= Longitud del eje B |
|
81 |
inscribed = Inscrito |
|
82 |
circumscribed = Circunscrito |
|
83 |
sides_of_regular_polygon = Indique los lados del poligono regular |
|
84 |
center_of_regular_polygon = Centro del pol\u00EDguno regular |
|
85 |
point_of_circle = Punto del c\u00EDrculo del pol\u00EDgono |
|
86 |
sides = Lados |
|
87 |
key_arc_mode = A |
|
88 |
key_line_mode = L |
|
89 |
key_close = C |
|
90 |
key_finish = F |
|
91 |
key_inscribed = I |
|
92 |
key_circumscribed = C |
|
93 |
key_remove_last_point = Q |
|
94 |
remove_last_point = Quitar \u00FAltimo punto |
|
95 |
close_polyline = Cerrar polil\u00EDnea |
|
96 |
close_spline = Cerrar curva spline |
|
97 |
new_point = Nuevo punto |
|
98 |
new_value = Nuevo valor |
|
99 |
finished = finalizada |
|
100 |
center_of_rotation = Centro de rotaci\u00F3n |
|
101 |
angle_of_rotation = \u00C1ngulo de rotaci\u00F3n (grados) |
|
102 |
origin_point = Origen |
|
103 |
scale_factor_or_reference_point = Factor de escala o punto de referencia |
|
104 |
second_scale_point = Segundo punto para la escala |
|
105 |
tolerance = Tolerancia |
|
106 |
line_to_extend = Seleccione l\u00EDnea para alargar |
|
107 |
line_to_trim = Seleccione l\u00EDnea para partir |
|
108 |
modify_smooth_line = Suavizar l\u00EDnea |
|
109 |
intermediate_steps_1_9 = Pasos intermedios [1,9] |
|
110 |
algorithm = algoritmo |
|
111 |
natural_cubic_splines = Splines c\u00FAbicos naturales |
|
112 |
bezier_curves = Curvas B\u00E9zier |
|
113 |
b_splines = B-splines |
|
114 |
key_natural_cubic_splines = 1 |
|
115 |
key_bezier_curves = 2 |
|
116 |
key_b_splines = 3 |
|
117 |
columns_number = N\u00FAmero de columnas |
|
118 |
rows_number = N\u00FAmero de filas |
|
119 |
distance_between_columns = Distancia entre columnas |
|
120 |
distance_between_rows = Distancia entre filas |
|
121 |
key_yes= S |
|
122 |
key_no = N |
|
123 |
yes = Si |
|
124 |
no = No |
|
125 |
number_of_total_elements = N\u00FAmero de elementos totales |
|
126 |
rotate_elements = Rotar elementos? |
|
127 |
angle_between_elements = Angulo entre elementos |
|
128 |
modify = modificar |
|
129 |
insert = insertar |
|
130 |
Modify = Modificar |
|
131 |
Insert = Insertar |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.17/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
1 |
start_editing = Start editing |
|
2 |
end_editing = End editing |
|
3 |
insert_point = Insert point |
|
4 |
insert_multipoint = Insert MultiPoint |
|
5 |
insert_line = Insert line |
|
6 |
insert_arc = Insert arc |
|
7 |
insert_circle_cr=Insert circle (center & radius) |
|
8 |
insert_circumference_cr=Insert circumference (center & radius) |
|
9 |
insert_circle_3p = Insert circle (three point) |
|
10 |
insert_circumference_3p = Insert circumference (three points) |
|
11 |
insert_ellipse = Insert ellipse |
|
12 |
insert_filled_ellipse = Insert filled ellipse |
|
13 |
insert_polyline = Insert polyline |
|
14 |
insert_polygon = Insert polygon |
|
15 |
insert_regular_polygon = Insert regular polygon |
|
16 |
insert_filled_regular_polygon = Insert filled regular polygon |
|
17 |
insert_rectangle = Insert rectangle |
|
18 |
insert_filled_rectangle = Insert filled rectangle |
|
19 |
insert_spline= Insert spline curve |
|
20 |
insert_filled_spline = Insert filled spline |
|
21 |
insert_rectangular_matrix = Rectangular matrix of geometries |
|
22 |
insert_polar_matrix = Polar matrix of geometries |
|
23 |
modify_internal_polygon = Internal polygon |
|
24 |
modify_explode_geometry = Explode geometry |
|
25 |
modify_move = Move geometry |
|
26 |
modify_rotate = Rotate geometry |
|
27 |
modify_duplicate = Duplicate geometry |
|
28 |
modify_split_line = Split line open by a point |
|
29 |
modify_split = Split geometry |
|
30 |
modify_scale = Scale geometry |
|
31 |
modify_simplify = Simplify geometry |
|
32 |
insert_autopolygon = Insert autopolygon |
|
33 |
modify_join = Join geometries |
|
34 |
modify_stretch = Stretch geometry |
|
35 |
modify_extend_line = Extend line to object |
|
36 |
modify_trim_line = Trim line by object |
|
37 |
modify_edit_vertex = Edit vertex |
|
38 |
modify_convert_to_polyline= Convert to polyline |
|
39 |
modify_reverse_direction=Reverse direction |
|
40 |
uniqueselection = Select only one geometry |
|
41 |
selectvertex = Select a vertex |
|
42 |
new_position = New position |
|
43 |
insert_vertex = Insertr vertex |
|
44 |
remove_vertex = Remove vertex |
|
45 |
selection=Selection |
|
46 |
invalid_option=Invalid option |
|
47 |
center=Center |
|
48 |
radius=Radius |
|
49 |
save_changes_performed=Save changed performed |
|
50 |
discard= Discard |
|
51 |
discard_and_loose_changes= Discard changes and loose changes |
|
52 |
continue= Continue |
|
53 |
do_not_save_yet_stay_in_editing_mode= Don't save changes and continue editing |
|
54 |
indicate_new_point= Indicate new point |
|
55 |
arc_mode = Arc mode |
|
56 |
line_mode = Line mode |
|
57 |
select_new_tool= Select a new tool |
|
58 |
draw_geometry_to_interal_polygon= Select tool to draw a internal polygon |
|
59 |
draw_geometry_to_autopolygon = Select tool to draw an autopolygon |
|
60 |
draw_geometry_to_split = Select tool to split selected geometries |
|
61 |
draw_geometry_to_select_vertex = Select a polygonal tool to select vertex |
|
62 |
save = Save |
|
63 |
discard = Discard |
|
64 |
continue = Continue |
|
65 |
export = Export |
|
66 |
ask_save_layer = Would you really like to save the layer |
|
67 |
can_not_write_layer = There are not writer for this layer format or you don't have write permissions.\nWhat do you want to do? |
|
68 |
save_changes_performed = Save changed performed |
|
69 |
discard_and_loose_changes = Discard and loose changes |
|
70 |
export_to_another_format = Export to another format |
|
71 |
do_not_save_yet_stay_in_editing_mode = Do not save changes and continue editing |
|
72 |
first_point= First point |
|
73 |
second_point= Second point |
|
74 |
start_point= Start point |
|
75 |
middle_point= Middle point |
|
76 |
third_point= Third point |
|
77 |
end_point= End point |
|
78 |
first_point_A_axis = First point of A axis |
|
79 |
second_point_A_axis = Second point of A axis |
|
80 |
length_of_B_axis= Length of B axis |
|
81 |
inscribed = Inscribed |
|
82 |
circumscribed = Circumscribed |
|
83 |
sides_of_regular_polygon = Indicate sides of regular polygon |
|
84 |
center_of_regular_polygon = Center of regular polygon |
|
85 |
point_of_circle = Point of circle of polygon |
|
86 |
sides = Sides |
|
87 |
key_arc_mode = A |
|
88 |
key_line_mode = L |
|
89 |
key_close = C |
|
90 |
key_finish = F |
|
91 |
key_inscribed = I |
|
92 |
key_circumscribed = C |
|
93 |
key_remove_last_point = R |
Also available in: Unified diff