Revision 4384
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/pom.xml | ||
---|---|---|
1 |
<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"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.desktop</artifactId> |
|
6 |
<version>2.0.448</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.vectorediting.offset</artifactId> |
|
9 |
<version>1.0.216</version> |
|
10 |
<packaging>pom</packaging> |
|
11 |
<name>org.gvsig.vectorediting.offset</name> |
|
12 |
<description>Project that provides the offset vector editing tool</description> |
|
13 |
|
|
14 |
<repositories> |
|
15 |
<repository> |
|
16 |
<id>gvsig-public-http-repository</id> |
|
17 |
<name>gvSIG maven public HTTP repository</name> |
|
18 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
19 |
<releases> |
|
20 |
<enabled>true</enabled> |
|
21 |
<updatePolicy>daily</updatePolicy> |
|
22 |
<checksumPolicy>warn</checksumPolicy> |
|
23 |
</releases> |
|
24 |
<snapshots> |
|
25 |
<enabled>true</enabled> |
|
26 |
<updatePolicy>daily</updatePolicy> |
|
27 |
<checksumPolicy>warn</checksumPolicy> |
|
28 |
</snapshots> |
|
29 |
</repository> |
|
30 |
</repositories> |
|
31 |
|
|
32 |
<url>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</url> |
|
33 |
<scm> |
|
34 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-vectorediting/org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216</connection> |
|
35 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-vectorediting/org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216</developerConnection> |
|
36 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-vector-editing/repository/show/org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216</url> |
|
37 |
</scm> |
|
38 |
|
|
39 |
<distributionManagement> |
|
40 |
<site> |
|
41 |
<id>gvsig-repository</id> |
|
42 |
<url>dav:https://devel.gvsig.org/download/projects/gvsig-vectorediting/pool/${project.artifactId}/${project.version}</url> |
|
43 |
</site> |
|
44 |
</distributionManagement> |
|
45 |
|
|
46 |
<build> |
|
47 |
<plugins> |
|
48 |
<plugin> |
|
49 |
<groupId>org.apache.maven.plugins</groupId> |
|
50 |
<artifactId>maven-release-plugin</artifactId> |
|
51 |
<configuration> |
|
52 |
<tagBase>https://devel.gvsig.org/svn/gvsig-vectorediting/${project.artifactId}/tags</tagBase> |
|
53 |
</configuration> |
|
54 |
</plugin> |
|
55 |
</plugins> |
|
56 |
</build> |
|
57 |
|
|
58 |
<dependencyManagement> |
|
59 |
<dependencies> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId> org.gvsig.vectorediting </artifactId> |
|
63 |
<version>${org.gvsig.vectorediting.version}</version> |
|
64 |
<scope>import</scope> |
|
65 |
<type>pom</type> |
|
66 |
</dependency> |
|
67 |
<dependency> |
|
68 |
<groupId>org.gvsig</groupId> |
|
69 |
<artifactId>org.gvsig.vectorediting.offset.lib.prov.offset</artifactId> |
|
70 |
<version>1.0.216</version> |
|
71 |
</dependency> |
|
72 |
</dependencies> |
|
73 |
</dependencyManagement> |
|
74 |
|
|
75 |
<modules> |
|
76 |
<module>org.gvsig.vectorediting.offset.lib</module> |
|
77 |
<module>org.gvsig.vectorediting.offset.app</module> |
|
78 |
</modules> |
|
79 |
|
|
80 |
<properties> |
|
81 |
<org.gvsig.vectorediting.version>1.0.264</org.gvsig.vectorediting.version> |
|
82 |
</properties> |
|
83 |
</project> |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.app/org.gvsig.vectorediting.offset.app.mainplugin/pom.xml | ||
---|---|---|
1 |
<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"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.vectorediting.offset.app</artifactId> |
|
6 |
<version>1.0.216</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.vectorediting.offset.app.mainplugin</artifactId> |
|
9 |
<name>org.gvsig.vectorediting.offset.app.mainplugin</name> |
|
10 |
|
|
11 |
<properties> |
|
12 |
<!-- Package info property values --> |
|
13 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
14 |
<gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0-A, required: org.gvsig.vectorediting.app.mainplugin -ge 1.0.0, conflict: org.gvsig.editing.app.mainplugin -ge 1</gvsig.package.info.dependencies> |
|
15 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
16 |
<gvsig.package.info.name>Tools: Vector editing offset provider</gvsig.package.info.name> |
|
17 |
<gvsig.package.info.description>Symmetry provider: provides offset geometries.</gvsig.package.info.description> |
|
18 |
<gvsig.package.info.categories>Vector</gvsig.package.info.categories> |
|
19 |
<gvsig.package.info.javaVM>j1_6</gvsig.package.info.javaVM> |
|
20 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-vectorediting/pool</gvsig.package.info.poolURL> |
|
21 |
</properties> |
|
22 |
|
|
23 |
<dependencies> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.vectorediting.app.mainplugin</artifactId> |
|
27 |
<scope>compile</scope> |
|
28 |
</dependency> |
|
29 |
<dependency> |
|
30 |
<groupId>org.gvsig</groupId> |
|
31 |
<artifactId>org.gvsig.vectorediting.lib.api</artifactId> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.vectorediting.lib.impl</artifactId> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.vectorediting.lib.spi</artifactId> |
|
40 |
</dependency> |
|
41 |
<dependency> |
|
42 |
<groupId>org.gvsig</groupId> |
|
43 |
<artifactId>org.gvsig.vectorediting.offset.lib.prov.offset</artifactId> |
|
44 |
</dependency> |
|
45 |
</dependencies> |
|
46 |
</project> |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.app/org.gvsig.vectorediting.offset.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Tue Jun 11 11:12:56 CEST 2024 |
|
2 |
buildNumber=224 |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.app/org.gvsig.vectorediting.offset.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<!-- |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
|
|
25 |
--> |
|
26 |
<assembly> |
|
27 |
<id>gvsig-plugin-package</id> |
|
28 |
<formats> |
|
29 |
<format>zip</format> |
|
30 |
</formats> |
|
31 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
32 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
33 |
<files> |
|
34 |
<file> |
|
35 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
36 |
<outputDirectory>lib</outputDirectory> |
|
37 |
</file> |
|
38 |
<file> |
|
39 |
<source>target/package.info</source> |
|
40 |
</file> |
|
41 |
</files> |
|
42 |
|
|
43 |
<fileSets> |
|
44 |
<fileSet> |
|
45 |
<directory>src/main/resources-plugin</directory> |
|
46 |
<outputDirectory>.</outputDirectory> |
|
47 |
</fileSet> |
|
48 |
</fileSets> |
|
49 |
|
|
50 |
|
|
51 |
<dependencySets> |
|
52 |
<dependencySet> |
|
53 |
<useProjectArtifact>false</useProjectArtifact> |
|
54 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
55 |
<outputDirectory>lib</outputDirectory> |
|
56 |
<includes> |
|
57 |
<include>org.gvsig:org.gvsig.vectorediting.offset.lib.prov.offset</include> |
|
58 |
</includes> |
|
59 |
</dependencySet> |
|
60 |
</dependencySets> |
|
61 |
|
|
62 |
</assembly> |
|
63 |
|
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.app/org.gvsig.vectorediting.offset.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
1 |
modify_offset = Geometr\u00eda paralela |
|
2 |
selection=Selecci\u00f3n |
|
3 |
first_point_of_symmetry_axis=Primer punto del eje de simetr\u00eda |
|
4 |
second_point_of_symmetry_axis=Segundo punto del eje de simetr\u00eda |
|
5 |
delete_original_geometries_question=\u00bfDesea borrar las geometr\u00edas originales? |
|
6 |
short_yes=S |
|
7 |
short_no=N |
|
8 |
delete_original_geometries = Eliminar geometr\u00edas originales |
|
9 |
keep_original_geometries = Mantener geometr\u00edas originales |
|
10 |
offset_distance=Distancia |
|
11 |
_left=Izquierdo |
|
12 |
_right=Derecho |
|
13 |
_short_left=I |
|
14 |
_short_right=D |
|
15 |
_side=Lado |
|
16 |
side=Lado |
|
17 |
_round=Redondeado |
|
18 |
_mitre=Inglete |
|
19 |
_bevel=Bisel |
|
20 |
_short_round=R |
|
21 |
_short_mitre=I |
|
22 |
_short_bevel=B |
|
23 |
_join_style=Estilo de uni\u00f3n |
|
24 |
joinStyle=Estilo de uni\u00f3n |
|
25 |
equidistant_offsets=Paralelas equidistantes |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.app/org.gvsig.vectorediting.offset.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
1 |
modify_offset = Parallel geometry |
|
2 |
selection = Selection |
|
3 |
first_point_of_symmetry_axis=First point of the symmetry axis |
|
4 |
second_point_of_symmetry_axis=Second point of the symmetry axis |
|
5 |
delete_original_geometries_question=Delete original geometries? |
|
6 |
short_yes=Y |
|
7 |
short_no=N |
|
8 |
delete_original_geometries = Delete original geometries |
|
9 |
keep_original_geometries = Keep original geometries |
|
10 |
offset_distance= Distance |
|
11 |
_Left=Left |
|
12 |
_right=Right |
|
13 |
_short_left=L |
|
14 |
_short_right=R |
|
15 |
_side=Side |
|
16 |
side=Side |
|
17 |
_round=Round |
|
18 |
_mitre=Mitre |
|
19 |
_bevel=Bevel |
|
20 |
_short_round=R |
|
21 |
_short_mitre=M |
|
22 |
_short_bevel=B |
|
23 |
_join_style=Join style |
|
24 |
joinStyle=Join style |
|
25 |
equidistant_offsets=Equidistantes offsets |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.app/org.gvsig.vectorediting.offset.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 |
|
3 |
gvSIG Association. This program is free software; you can redistribute it |
|
4 |
and/or modify it under the terms of the GNU General Public License as published |
|
5 |
by the Free Software Foundation; either version 3 of the License, or (at |
|
6 |
your option) any later version. This program is distributed in the hope that |
|
7 |
it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
|
8 |
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
9 |
Public License for more details. You should have received a copy of the GNU |
|
10 |
General Public License along with this program; if not, write to the Free |
|
11 |
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
|
12 |
USA. For any additional information, do not hesitate to contact us at info |
|
13 |
AT gvsig.com, or visit our website www.gvsig.com. --> |
|
14 |
<plugin-config> |
|
15 |
<depends plugin-name="org.gvsig.vectorediting.app.mainplugin" /> |
|
16 |
<resourceBundle name="text" /> |
|
17 |
<libraries library-dir="lib" /> |
|
18 |
<extensions> |
|
19 |
<extension class-name="org.gvsig.vectorediting.app.mainplugin.ServiceExtension" |
|
20 |
description="" active="true" priority="1"> |
|
21 |
|
|
22 |
<action name="modify-offset" label="modify_offset" |
|
23 |
tooltip="modify_offset" position="601004400" action-command="modify-offset" |
|
24 |
icon="modify-offset" accelerator="" /> |
|
25 |
|
|
26 |
<menu text="Layer/Modify/modify_offset" name="modify-offset" /> |
|
27 |
|
|
28 |
<tool-bar name="vector_editing" position="4000"> |
|
29 |
<selectable-tool name="modify-offset" /> |
|
30 |
</tool-bar> |
|
31 |
|
|
32 |
</extension> |
|
33 |
</extensions> |
|
34 |
</plugin-config> |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.app/org.gvsig.vectorediting.offset.app.mainplugin/src/main/resources/README.txt | ||
---|---|---|
1 |
==== |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
==== |
|
25 |
|
|
26 |
Put into this folder the resources to be included in the plugin jar. |
|
27 |
|
|
0 | 28 |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.app/pom.xml | ||
---|---|---|
1 |
<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"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.vectorediting.offset</artifactId> |
|
6 |
<version>1.0.216</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.vectorediting.offset.app</artifactId> |
|
9 |
<packaging>pom</packaging> |
|
10 |
<name>org.gvsig.vectorediting.offset.app</name> |
|
11 |
<modules> |
|
12 |
<module>org.gvsig.vectorediting.offset.app.mainplugin</module> |
|
13 |
</modules> |
|
14 |
</project> |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.lib/org.gvsig.vectorediting.offset.lib.prov/pom.xml | ||
---|---|---|
1 |
<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"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.vectorediting.offset.lib</artifactId> |
|
6 |
<version>1.0.216</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.vectorediting.offset.lib.prov</artifactId> |
|
9 |
<packaging>pom</packaging> |
|
10 |
<name>org.gvsig.vectorediting.offset.lib.prov</name> |
|
11 |
<modules> |
|
12 |
<module> |
|
13 |
org.gvsig.vectorediting.offset.lib.prov.offset |
|
14 |
</module> |
|
15 |
</modules> |
|
16 |
</project> |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.lib/org.gvsig.vectorediting.offset.lib.prov/org.gvsig.vectorediting.offset.lib.prov.offset/pom.xml | ||
---|---|---|
1 |
<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"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.vectorediting.offset.lib.prov</artifactId> |
|
6 |
<version>1.0.216</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.vectorediting.offset.lib.prov.offset</artifactId> |
|
9 |
<name>org.gvsig.vectorediting.offset.lib.prov.offset</name> |
|
10 |
|
|
11 |
<dependencies> |
|
12 |
<dependency> |
|
13 |
<groupId>org.gvsig</groupId> |
|
14 |
<artifactId>org.gvsig.vectorediting.lib.api</artifactId> |
|
15 |
</dependency> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.vectorediting.lib.impl</artifactId> |
|
19 |
</dependency> |
|
20 |
<dependency> |
|
21 |
<groupId>org.gvsig</groupId> |
|
22 |
<artifactId>org.gvsig.vectorediting.lib.spi</artifactId> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
27 |
</dependency> |
|
28 |
</dependencies> |
|
29 |
</project> |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.lib/org.gvsig.vectorediting.offset.lib.prov/org.gvsig.vectorediting.offset.lib.prov.offset/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.vectorediting.offset.lib.prov.offset.OffsetEditingLibrary |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.lib/org.gvsig.vectorediting.offset.lib.prov/org.gvsig.vectorediting.offset.lib.prov.offset/src/main/java/org/gvsig/vectorediting/offset/lib/prov/offset/OffsetEditingProviderFactory.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 |
|
|
25 |
package org.gvsig.vectorediting.offset.lib.prov.offset; |
|
26 |
|
|
27 |
import org.gvsig.fmap.geom.Geometry; |
|
28 |
import org.gvsig.tools.dynobject.DynObject; |
|
29 |
import org.gvsig.tools.service.spi.Provider; |
|
30 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
31 |
import org.gvsig.vectorediting.lib.api.EditingServiceInfo; |
|
32 |
import org.gvsig.vectorediting.lib.spi.AbstractEditingProviderFactory; |
|
33 |
import org.gvsig.vectorediting.lib.spi.DefaultEditingServiceinfo; |
|
34 |
|
|
35 |
public class OffsetEditingProviderFactory extends AbstractEditingProviderFactory { |
|
36 |
|
|
37 |
public static final String PROVIDER_NAME = "modify-offset"; |
|
38 |
|
|
39 |
private final static String PROVIDER_DESCRIPTION = |
|
40 |
"Creates offset geometries from selection"; |
|
41 |
|
|
42 |
public OffsetEditingProviderFactory() { |
|
43 |
super(PROVIDER_NAME, PROVIDER_DESCRIPTION); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public EditingServiceInfo getServiceInfo() { |
|
48 |
EditingServiceInfo serviceInfo = |
|
49 |
new DefaultEditingServiceinfo(PROVIDER_NAME, "", false, null, |
|
50 |
new int[] { //Geometry.TYPES.POINT, Geometry.TYPES.MULTIPOINT, |
|
51 |
Geometry.TYPES.SURFACE, Geometry.TYPES.MULTISURFACE, |
|
52 |
Geometry.TYPES.LINE, Geometry.TYPES.MULTILINE, |
|
53 |
Geometry.TYPES.POLYGON, Geometry.TYPES.MULTIPOLYGON, |
|
54 |
Geometry.TYPES.CURVE, Geometry.TYPES.MULTICURVE }); |
|
55 |
|
|
56 |
return serviceInfo; |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
protected Provider doCreate(DynObject parameters, ProviderServices services) { |
|
61 |
return new OffsetEditingProvider(services, parameters); |
|
62 |
} |
|
63 |
|
|
64 |
} |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.lib/org.gvsig.vectorediting.offset.lib.prov/org.gvsig.vectorediting.offset.lib.prov.offset/src/main/java/org/gvsig/vectorediting/offset/lib/prov/offset/OffsetEditingLibrary.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 |
|
|
25 |
package org.gvsig.vectorediting.offset.lib.prov.offset; |
|
26 |
|
|
27 |
import org.gvsig.tools.ToolsLocator; |
|
28 |
import org.gvsig.tools.i18n.I18nManager; |
|
29 |
import org.gvsig.tools.library.AbstractLibrary; |
|
30 |
import org.gvsig.tools.library.LibraryException; |
|
31 |
import org.gvsig.vectorediting.lib.api.EditingLibrary; |
|
32 |
import org.gvsig.vectorediting.lib.spi.EditingProviderLocator; |
|
33 |
import org.gvsig.vectorediting.lib.spi.EditingProviderManager; |
|
34 |
|
|
35 |
/** |
|
36 |
* Library for default implementation initialization and configuration. |
|
37 |
* |
|
38 |
* @author gvSIG team |
|
39 |
* @version $Id$ |
|
40 |
*/ |
|
41 |
public class OffsetEditingLibrary extends AbstractLibrary { |
|
42 |
|
|
43 |
@Override |
|
44 |
public void doRegistration() { |
|
45 |
registerAsServiceOf(EditingLibrary.class); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected void doInitialize() throws LibraryException { |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
protected void doPostInitialize() throws LibraryException { |
|
54 |
EditingProviderManager manager = |
|
55 |
EditingProviderLocator.getProviderManager(); |
|
56 |
|
|
57 |
manager.addProviderFactory(new OffsetEditingProviderFactory()); |
|
58 |
|
|
59 |
manager.registerIcon("vectorediting-tools", "modify-offset", this |
|
60 |
.getClass().getClassLoader(), this.getClass().getName()); |
|
61 |
|
|
62 |
registerTranslations(); |
|
63 |
} |
|
64 |
|
|
65 |
private void registerTranslations() { |
|
66 |
I18nManager manager = ToolsLocator.getI18nManager(); |
|
67 |
manager.addResourceFamily("i18n.text", |
|
68 |
this.getClass().getClassLoader(), "offset-editing"); |
|
69 |
} |
|
70 |
|
|
71 |
} |
org.gvsig.vectorediting.offset/tags/org.gvsig.vectorediting.offset-1.0.216/org.gvsig.vectorediting.offset.lib/org.gvsig.vectorediting.offset.lib.prov/org.gvsig.vectorediting.offset.lib.prov.offset/src/main/java/org/gvsig/vectorediting/offset/lib/prov/offset/OffsetEditingProvider.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.offset.lib.prov.offset; |
|
25 |
|
|
26 |
import java.text.DecimalFormat; |
|
27 |
import java.util.ArrayList; |
|
28 |
import java.util.Collections; |
|
29 |
import java.util.HashMap; |
|
30 |
import java.util.List; |
|
31 |
import java.util.Map; |
|
32 |
import org.apache.commons.collections.CollectionUtils; |
|
33 |
import org.apache.commons.lang3.StringUtils; |
|
34 |
import org.gvsig.fmap.dal.exception.DataException; |
|
35 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
36 |
import org.gvsig.fmap.dal.feature.Feature; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
39 |
import org.gvsig.fmap.geom.Geometry; |
|
40 |
import static org.gvsig.fmap.geom.Geometry.JOIN_STYLE_ROUND; |
|
41 |
import org.gvsig.fmap.geom.GeometryException; |
|
42 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
43 |
import org.gvsig.fmap.geom.GeometryManager; |
|
44 |
import org.gvsig.fmap.geom.GeometryUtils; |
|
45 |
import org.gvsig.fmap.geom.aggregate.Aggregate; |
|
46 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
|
47 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
48 |
import org.gvsig.fmap.geom.aggregate.MultiSurface; |
|
49 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
|
50 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
|
51 |
import org.gvsig.fmap.geom.primitive.Arc; |
|
52 |
import org.gvsig.fmap.geom.primitive.Circle; |
|
53 |
import org.gvsig.fmap.geom.primitive.Circumference; |
|
54 |
import org.gvsig.fmap.geom.primitive.Curve; |
|
55 |
import org.gvsig.fmap.geom.primitive.Ellipse; |
|
56 |
import org.gvsig.fmap.geom.primitive.FilledSpline; |
|
57 |
import org.gvsig.fmap.geom.primitive.Line; |
|
58 |
import org.gvsig.fmap.geom.primitive.PeriEllipse; |
|
59 |
import org.gvsig.fmap.geom.primitive.Point; |
|
60 |
import org.gvsig.fmap.geom.primitive.Polygon; |
|
61 |
import org.gvsig.fmap.geom.primitive.Primitive; |
|
62 |
import org.gvsig.fmap.geom.primitive.Spline; |
|
63 |
import org.gvsig.fmap.geom.primitive.Surface; |
|
64 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
65 |
import org.gvsig.symbology.SymbologyLocator; |
|
66 |
import org.gvsig.symbology.SymbologyManager; |
|
67 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.ISimpleTextSymbol; |
|
68 |
import org.gvsig.tools.ToolsLocator; |
|
69 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
70 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
71 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
72 |
import org.gvsig.tools.dynobject.DynObject; |
|
73 |
import org.gvsig.tools.i18n.I18nManager; |
|
74 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
75 |
import org.gvsig.vectorediting.lib.api.DrawingStatus; |
|
76 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter; |
|
77 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter.TYPE; |
|
78 |
import org.gvsig.vectorediting.lib.api.exceptions.DrawServiceException; |
|
79 |
import org.gvsig.vectorediting.lib.api.exceptions.FinishServiceException; |
|
80 |
import org.gvsig.vectorediting.lib.api.exceptions.InvalidEntryException; |
|
81 |
import org.gvsig.vectorediting.lib.api.exceptions.StartServiceException; |
|
82 |
import org.gvsig.vectorediting.lib.api.exceptions.StopServiceException; |
|
83 |
import org.gvsig.vectorediting.lib.spi.AbstractEditingProvider; |
|
84 |
import org.gvsig.vectorediting.lib.spi.DefaultDrawingStatus; |
|
85 |
import org.gvsig.vectorediting.lib.spi.DefaultEditingServiceParameter; |
|
86 |
import org.gvsig.vectorediting.lib.spi.DefaultEditingServiceParameterOptions; |
|
87 |
import org.gvsig.vectorediting.lib.spi.EditingProvider; |
|
88 |
import org.gvsig.vectorediting.lib.spi.EditingProviderFactory; |
|
89 |
import org.gvsig.vectorediting.lib.spi.EditingProviderLocator; |
|
90 |
import org.gvsig.vectorediting.lib.spi.EditingProviderManager; |
|
91 |
import org.gvsig.vectorediting.lib.spi.EditingProviderServices; |
|
92 |
|
|
93 |
public class OffsetEditingProvider extends AbstractEditingProvider implements |
|
94 |
EditingProvider { |
|
95 |
|
|
96 |
private static final Double PRECISION = 1.0e-5; |
|
97 |
|
|
98 |
private static final String SIDE = "_side"; |
|
99 |
|
|
100 |
private static final String LEFT = "_left"; |
|
101 |
|
|
102 |
private static final String RIGHT = "_right"; |
|
103 |
|
|
104 |
private static final String SHORT_LEFT = "_short_left"; |
|
105 |
|
|
106 |
private static final String SHORT_RIGHT = "_short_right"; |
|
107 |
|
|
108 |
private static final String JOIN_STYLE = "_join_style"; |
|
109 |
|
|
110 |
private static final String ROUND = "_round"; |
|
111 |
|
|
112 |
private static final String MITRE = "_mitre"; |
|
113 |
|
|
114 |
private static final String BEVEL = "_bevel"; |
|
115 |
|
|
116 |
private static final String SHORT_ROUND = "_short_round"; |
|
117 |
|
|
118 |
private static final String SHORT_MITRE = "_short_mitre"; |
|
119 |
|
|
120 |
private static final String SHORT_BEVEL = "_short_bevel"; |
|
121 |
|
|
122 |
private final EditingServiceParameter selectionParameter; |
|
123 |
|
|
124 |
private final EditingServiceParameter offsetParameter; |
|
125 |
|
|
126 |
private final EditingServiceParameter sideParameter; |
|
127 |
|
|
128 |
private final DefaultEditingServiceParameter joinStyleParameter; |
|
129 |
|
|
130 |
private final EditingServiceParameter equidistantOffsets; |
|
131 |
|
|
132 |
private final EditingServiceParameter deleteOriginalGeometriesParameter; |
|
133 |
|
|
134 |
// private boolean deleteOriginalGeometries = false; |
|
135 |
|
|
136 |
private Map<EditingServiceParameter, Object> values; |
|
137 |
|
|
138 |
// private final Map<String, String> options; |
|
139 |
|
|
140 |
private final FeatureStore featureStore; |
|
141 |
|
|
142 |
private List<Feature> selectedFeatures; |
|
143 |
|
|
144 |
|
|
145 |
public OffsetEditingProvider(ProviderServices providerServices, DynObject parameters) { |
|
146 |
super(providerServices); |
|
147 |
this.featureStore = (FeatureStore) parameters.getDynValue(EditingProviderFactory.FEATURE_STORE_FIELD); |
|
148 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
149 |
|
|
150 |
EditingProviderServices editingProviderServices |
|
151 |
= (EditingProviderServices) getProviderServices(); |
|
152 |
|
|
153 |
this.selectionParameter |
|
154 |
= new DefaultEditingServiceParameter("selection", |
|
155 |
i18nManager.getTranslation("selection"), TYPE.SELECTION); |
|
156 |
|
|
157 |
this.offsetParameter |
|
158 |
= new DefaultEditingServiceParameter("offset_distance", |
|
159 |
i18nManager.getTranslation("offset_distance"), |
|
160 |
TYPE.POSITION, TYPE.VALUE, TYPE.DISTANCE); |
|
161 |
|
|
162 |
Map<String, String> sideOptions = new HashMap<>(); |
|
163 |
sideOptions.put(i18nManager.getTranslation(SHORT_LEFT), i18nManager.getTranslation(LEFT)); |
|
164 |
sideOptions.put(i18nManager.getTranslation(SHORT_RIGHT), i18nManager.getTranslation(RIGHT)); |
|
165 |
|
|
166 |
String sideConsoleMsg |
|
167 |
= ((EditingProviderServices)providerServices).makeConsoleMessage( |
|
168 |
i18nManager.getTranslation(SIDE), sideOptions); |
|
169 |
|
|
170 |
|
|
171 |
this.sideParameter |
|
172 |
= new DefaultEditingServiceParameter("side", |
|
173 |
sideConsoleMsg, |
|
174 |
sideOptions, |
|
175 |
TYPE.OPTION, TYPE.POSITION).setDataType(DataTypes.STRING); |
|
176 |
|
|
177 |
DefaultEditingServiceParameterOptions joinStyleOptions = new DefaultEditingServiceParameterOptions() |
|
178 |
.add(i18nManager.getTranslation(ROUND), ROUND, i18nManager.getTranslation(SHORT_ROUND)) |
|
179 |
.add(i18nManager.getTranslation(MITRE), MITRE, i18nManager.getTranslation(SHORT_MITRE)) |
|
180 |
.add(i18nManager.getTranslation(BEVEL), BEVEL, i18nManager.getTranslation(SHORT_BEVEL)); |
|
181 |
|
|
182 |
|
|
183 |
String joinStyleConsoleMsg = ((EditingProviderServices)providerServices).makeConsoleMessage( |
|
184 |
i18nManager.getTranslation(JOIN_STYLE), joinStyleOptions); |
|
185 |
|
|
186 |
this.joinStyleParameter |
|
187 |
= new DefaultEditingServiceParameter( |
|
188 |
"joinStyle", |
|
189 |
joinStyleConsoleMsg, |
|
190 |
joinStyleOptions, |
|
191 |
i18nManager.getTranslation(SHORT_ROUND), |
|
192 |
true, |
|
193 |
TYPE.OPTION); //.setDataType(DataTypes.STRING); |
|
194 |
this.joinStyleParameter.setDefaultValue(ROUND); |
|
195 |
|
|
196 |
|
|
197 |
this.equidistantOffsets = new DefaultEditingServiceParameter("equidistant_offsets", "equidistant_offsets", true, TYPE.VALUE); |
|
198 |
this.equidistantOffsets.setDefaultValue(1); |
|
199 |
|
|
200 |
DefaultEditingServiceParameterOptions deleteOriginalGeometriesOptions2 = new DefaultEditingServiceParameterOptions() |
|
201 |
.add("delete_original_geometries", true, i18nManager.getTranslation("_yes")) |
|
202 |
.add("keep_original_geometries", false, i18nManager.getTranslation("_no")); |
|
203 |
|
|
204 |
String consoleMsg |
|
205 |
= editingProviderServices.makeConsoleMessage( |
|
206 |
"delete_original_geometries_question", deleteOriginalGeometriesOptions2); |
|
207 |
|
|
208 |
this.deleteOriginalGeometriesParameter |
|
209 |
= new DefaultEditingServiceParameter( |
|
210 |
i18nManager.getTranslation("delete_original_geometries"), |
|
211 |
consoleMsg, |
|
212 |
deleteOriginalGeometriesOptions2, |
|
213 |
false, |
|
214 |
TYPE.OPTION).setDataType(DataTypes.BOOLEAN); |
|
215 |
|
|
216 |
} |
|
217 |
|
|
218 |
@Override |
|
219 |
public EditingServiceParameter next() { |
|
220 |
|
|
221 |
if (values.get(selectionParameter) == null) { |
|
222 |
return selectionParameter; |
|
223 |
} |
|
224 |
if (values.get(offsetParameter) == null) { |
|
225 |
return offsetParameter; |
|
226 |
} |
|
227 |
if (values.get(sideParameter) == null) { |
|
228 |
Object offsetValue = values.get(offsetParameter); |
|
229 |
if (!(offsetValue instanceof Point)) { |
|
230 |
Double distance = (Double) offsetValue; |
|
231 |
if (distance >= 0) { |
|
232 |
return sideParameter; |
|
233 |
} |
|
234 |
} |
|
235 |
} |
|
236 |
|
|
237 |
if (values.get(deleteOriginalGeometriesParameter) == null) { |
|
238 |
return this.deleteOriginalGeometriesParameter; |
|
239 |
} |
|
240 |
|
|
241 |
return null; |
|
242 |
} |
|
243 |
|
|
244 |
@Override |
|
245 |
public DrawingStatus getDrawingStatus(Point mousePosition) throws DrawServiceException { |
|
246 |
DefaultDrawingStatus drawingStatus = new DefaultDrawingStatus(); |
|
247 |
EditingProviderManager editingProviderManager |
|
248 |
= EditingProviderLocator.getProviderManager(); |
|
249 |
EditingProviderServices editingProviderServices = |
|
250 |
(EditingProviderServices) getProviderServices(); |
|
251 |
int subtype; |
|
252 |
try { |
|
253 |
subtype = editingProviderServices.getSubType(featureStore); |
|
254 |
} catch (DataException e2) { |
|
255 |
throw new DrawServiceException(e2); |
|
256 |
} |
|
257 |
ISymbol auxiliaryLineSymbolEditing = editingProviderManager.getSymbol("auxiliary-line-symbol-editing"); |
|
258 |
ISymbol auxiliaryPointSymbolEditing = editingProviderManager.getSymbol("auxiliary-point-symbol-editing"); |
|
259 |
ISymbol auxiliaryLineSymbolEditingDirection = editingProviderManager.getSymbol("auxiliary-line-symbol-editing-direction"); |
|
260 |
ISymbol lineSymbolEditing = editingProviderManager.getSymbol("line-symbol-editing"); |
|
261 |
ISymbol polygonSymbolEditing = editingProviderManager.getSymbol("polygon-symbol-editing"); |
|
262 |
|
|
263 |
if (values != null) { |
|
264 |
Number equidistantOffsetsNumberValue = ((Number) values.get(this.equidistantOffsets)); |
|
265 |
int equidistantOffsetsValue = equidistantOffsetsNumberValue != null ? equidistantOffsetsNumberValue.intValue() : ((Number) this.equidistantOffsets.getDefaultValue()).intValue(); |
|
266 |
|
|
267 |
// FeatureSelection selected |
|
268 |
// = (FeatureSelection) values.get(selectionParameter); |
|
269 |
try { |
|
270 |
if ( CollectionUtils.isNotEmpty(selectedFeatures)) { |
|
271 |
|
|
272 |
Point point; // = null; |
|
273 |
double distance = 0.0; |
|
274 |
double side = 1.0; |
|
275 |
Object offsetValue = values.get(offsetParameter); |
|
276 |
|
|
277 |
if (offsetValue != null) { |
|
278 |
if (offsetValue instanceof Point) { |
|
279 |
distance = Math.abs(getMinDistance(selectedFeatures, (Point) offsetValue)); |
|
280 |
} else { |
|
281 |
distance = (Double) offsetValue; |
|
282 |
} |
|
283 |
|
|
284 |
Object sideValue = values.get(sideParameter); |
|
285 |
if (sideValue == null) { |
|
286 |
point = mousePosition; |
|
287 |
side = Math.signum(getMinDistance(selectedFeatures, point)); |
|
288 |
} else { |
|
289 |
Double signum = getSideSignum((String) sideValue); |
|
290 |
if (signum != null) { |
|
291 |
side = signum; |
|
292 |
} |
|
293 |
} |
|
294 |
} else { |
|
295 |
point = mousePosition; |
|
296 |
Geometry closestGeometry = getClosestGeometry(selectedFeatures, point); |
|
297 |
Point closestPoint = getClosestPoint(closestGeometry, point); |
|
298 |
distance = getMinDistance(selectedFeatures, point); //closestPoint.distance(point); //getMinDistance(selected, point); |
|
299 |
ISymbol symbol = lineSymbolEditing; |
|
300 |
Line auxLine = GeometryUtils.createLine(closestPoint, point, subtype); |
|
301 |
drawingStatus.addStatus( |
|
302 |
auxLine, |
|
303 |
auxiliaryLineSymbolEditing, |
|
304 |
"" |
|
305 |
); |
|
306 |
|
|
307 |
Point pointText = GeometryUtils.createPoint( |
|
308 |
0.5 * (closestPoint.getX() + point.getX()), |
|
309 |
0.5 * (closestPoint.getY() + point.getY()) |
|
310 |
); |
|
311 |
|
|
312 |
ISimpleTextSymbol textSymbol = getTextSymbol(); |
|
313 |
drawingStatus.addStatus( |
|
314 |
pointText, |
|
315 |
textSymbol, |
|
316 |
new DecimalFormat("#.0#").format(distance) |
|
317 |
); |
|
318 |
|
|
319 |
} |
|
320 |
|
|
321 |
int joinStyleValue = coerceJoinStyle(values.get(joinStyleParameter)); |
|
322 |
// |
|
323 |
// DisposableIterator it; |
|
324 |
// it = selected.fastIterator(); |
|
325 |
// |
|
326 |
// while (it.hasNext()) { |
|
327 |
for (Feature feat : selectedFeatures) { |
|
328 |
|
|
329 |
ISymbol previewSymbol = this.getPreviewSymbol(feat); |
|
330 |
|
|
331 |
for (int c = 1; c <= equidistantOffsetsValue; c++) { |
|
332 |
|
|
333 |
Geometry transformedGeometry = feat.getDefaultGeometry().offset(joinStyleValue, c * distance * side); |
|
334 |
|
|
335 |
ISymbol symbol = null; |
|
336 |
if (transformedGeometry instanceof Curve || transformedGeometry instanceof MultiCurve) { |
|
337 |
symbol = lineSymbolEditing; |
|
338 |
drawingStatus.addStatus(feat.getDefaultGeometry(), auxiliaryLineSymbolEditingDirection, "Direction"); |
|
339 |
} else if (transformedGeometry instanceof Surface || transformedGeometry instanceof MultiSurface) { |
|
340 |
symbol = polygonSymbolEditing; |
|
341 |
} else if (transformedGeometry instanceof Point || transformedGeometry instanceof MultiPoint) { |
|
342 |
symbol = auxiliaryPointSymbolEditing; |
|
343 |
} |
|
344 |
if (transformedGeometry instanceof Aggregate) { |
|
345 |
int primitivesNumber = ((Aggregate) transformedGeometry).getPrimitivesNumber(); |
|
346 |
for (int i = 0; i < primitivesNumber; i++) { |
|
347 |
final Primitive primitive = ((Aggregate) transformedGeometry).getPrimitiveAt(i); |
|
348 |
drawingStatus.addStatus(primitive, symbol, ""); |
|
349 |
drawingStatus.addStatus(primitive, previewSymbol, ""); |
|
350 |
} |
|
351 |
} else { |
|
352 |
drawingStatus.addStatus(transformedGeometry, symbol, ""); |
|
353 |
drawingStatus.addStatus(transformedGeometry, previewSymbol, ""); |
|
354 |
} |
|
355 |
} |
|
356 |
} |
|
357 |
// DisposeUtils.disposeQuietly(it); |
|
358 |
} |
|
359 |
} catch (Exception e) { |
|
360 |
throw new DrawServiceException(e); |
|
361 |
} |
|
362 |
} |
|
363 |
return drawingStatus; |
|
364 |
} |
|
365 |
|
|
366 |
/** |
|
367 |
* @param selected |
|
368 |
* @param point |
|
369 |
* @return |
|
370 |
* @throws DataException |
|
371 |
* @throws GeometryOperationException |
|
372 |
* @throws GeometryOperationNotSupportedException |
|
373 |
* @throws GeometryException |
|
374 |
*/ |
|
375 |
private double getMinDistance(List<Feature> selected, Point point) throws DataException, GeometryOperationNotSupportedException, GeometryOperationException, GeometryException { |
|
376 |
// Geometry closestGeometry = getClosestGeometry(selected, point); |
|
377 |
// if(closestGeometry != null){ |
|
378 |
// return closestGeometry.distance(point); |
|
379 |
// } |
|
380 |
// //No deber?a pasar por aqu? |
|
381 |
double minorDistance = Double.POSITIVE_INFINITY; |
|
382 |
// DisposableIterator it; |
|
383 |
// it = selected.fastIterator(); |
|
384 |
// while (it.hasNext()) { |
|
385 |
|
|
386 |
for (Feature feature : selected) { |
|
387 |
Geometry geometry = feature.getDefaultGeometry(); |
|
388 |
double distance = getDistance(geometry, point); |
|
389 |
if (distance < minorDistance) { |
|
390 |
minorDistance = distance; |
|
391 |
} |
|
392 |
} |
|
393 |
// it.dispose(); |
|
394 |
return minorDistance; |
|
395 |
|
|
396 |
} |
|
397 |
|
|
398 |
private Geometry getClosestGeometry(List<Feature> selected, Point point) throws DataException, GeometryOperationNotSupportedException, GeometryOperationException, GeometryException { |
|
399 |
double minorDistance = Double.POSITIVE_INFINITY; |
|
400 |
// DisposableIterator it; |
|
401 |
// it = selected.fastIterator(); |
|
402 |
Geometry closestGeometry = null; |
|
403 |
// while (it.hasNext()) { |
|
404 |
for (Feature feature : selected) { |
|
405 |
// Feature feat = (Feature) it.next(); |
|
406 |
Geometry geometry = feature.getDefaultGeometry(); |
|
407 |
double distance = getDistance(geometry, point); |
|
408 |
if (distance < minorDistance) { |
|
409 |
closestGeometry = geometry; |
|
410 |
minorDistance = distance; |
|
411 |
} |
|
412 |
} |
|
413 |
// it.dispose(); |
|
414 |
return closestGeometry; |
|
415 |
|
|
416 |
} |
|
417 |
|
|
418 |
/** |
|
419 |
* @param geometry |
|
420 |
* @param point |
|
421 |
* @return |
|
422 |
* @throws GeometryOperationException |
|
423 |
* @throws GeometryOperationNotSupportedException |
|
424 |
* @throws GeometryException |
|
425 |
*/ |
|
426 |
private double getDistance(Geometry geometry, Point point) throws GeometryOperationNotSupportedException, GeometryOperationException, GeometryException { |
|
427 |
// Point closest = getClosestPoint(geometry, point); |
|
428 |
// if(closest != null) { |
|
429 |
// return closest.distance(point); |
|
430 |
// } |
|
431 |
//No deber?a pasar por aqu? |
|
432 |
GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
433 |
if (geometry instanceof Arc) { |
|
434 |
Arc arc = (Arc) geometry; |
|
435 |
Point center = arc.getCenterPoint(); |
|
436 |
double radius = center.distance(arc.getInitPoint()); |
|
437 |
double distance = center.distance(point) - radius; |
|
438 |
return distance; |
|
439 |
} |
|
440 |
|
|
441 |
if (geometry instanceof Circle) { |
|
442 |
Circle circle = (Circle) geometry; |
|
443 |
return circle.getCenter().distance(point) - circle.getRadious(); |
|
444 |
} |
|
445 |
if (geometry instanceof Circumference) { |
|
446 |
Circumference circumference = (Circumference) geometry; |
|
447 |
return circumference.getCenter().distance(point) - circumference.getRadious(); |
|
448 |
} |
|
449 |
if (geometry instanceof PeriEllipse) { |
|
450 |
double minDistance = Double.POSITIVE_INFINITY; |
|
451 |
PeriEllipse ellipse = (PeriEllipse) geometry; |
|
452 |
Geometry[] closestPoints = point.closestPoints(ellipse); |
|
453 |
if (closestPoints != null) { |
|
454 |
for (Geometry closestPoint : closestPoints) { |
|
455 |
if (!point.equals(closestPoint)) { |
|
456 |
double distance = closestPoint.distance(point); |
|
457 |
if (distance < minDistance) { |
|
458 |
minDistance = distance; |
|
459 |
} |
|
460 |
} |
|
461 |
} |
|
462 |
} |
|
463 |
Ellipse auxEllipse = (Ellipse) geomManager.create(Geometry.TYPES.ELLIPSE, geometry.getGeometryType().getSubType()); |
|
464 |
auxEllipse.setPoints(ellipse.getAxis1Start(), ellipse.getAxis1End(), ellipse.getAxis2Dist()); |
|
465 |
if (auxEllipse.contains(point)) { |
|
466 |
return -minDistance; |
|
467 |
} |
|
468 |
return minDistance; |
|
469 |
} |
|
470 |
if (geometry instanceof Ellipse) { |
|
471 |
Ellipse ellipse = (Ellipse) geometry; |
|
472 |
PeriEllipse auxPeriEllipse = (PeriEllipse) geomManager.create(Geometry.TYPES.PERIELLIPSE, geometry.getGeometryType().getSubType()); |
|
473 |
auxPeriEllipse.setPoints(ellipse.getAxis1Start(), ellipse.getAxis1End(), ellipse.getAxis2Dist()); |
|
474 |
double distance = getDistance(auxPeriEllipse, point); |
|
475 |
|
|
476 |
return distance; |
|
477 |
} |
|
478 |
|
|
479 |
if (geometry instanceof Spline || geometry instanceof FilledSpline) { |
|
480 |
return getDistance(geometry.toLines().getPrimitiveAt(0), point); |
|
481 |
} |
|
482 |
|
|
483 |
if (geometry instanceof Line) { |
|
484 |
Line line = (Line) geometry; |
|
485 |
double minDistance = Double.POSITIVE_INFINITY; |
|
486 |
Geometry[] closestPoints = point.closestPoints(line); |
|
487 |
Point closestPoint = null; |
|
488 |
if (closestPoints != null) { |
|
489 |
for (Geometry closestPoint1 : closestPoints) { |
|
490 |
Point p = (Point) closestPoint1; |
|
491 |
if (!point.equals(p)) { |
|
492 |
double distance = p.distance(point); |
|
493 |
if (distance < minDistance) { |
|
494 |
minDistance = distance; |
|
495 |
closestPoint = p; |
|
496 |
} |
|
497 |
} |
|
498 |
} |
|
499 |
} |
|
500 |
if (closestPoint != null) { |
|
501 |
for (int i = 0; i < line.getNumVertices() - 1; i++) { |
|
502 |
Line segment = (Line) geomManager.create(Geometry.TYPES.LINE, geometry.getGeometryType().getSubType()); |
|
503 |
segment.addVertex(line.getVertex(i)); |
|
504 |
segment.addVertex(line.getVertex(i + 1)); |
|
505 |
if (segment.isWithinDistance(closestPoint, PRECISION)) { |
|
506 |
if (line.getVertex(0).equals(line.getVertex(line.getNumVertices() - 1))) { //isClosed |
|
507 |
if (line.toPolygons().contains(point)) { |
|
508 |
return -minDistance; |
|
509 |
} |
|
510 |
return minDistance; |
|
511 |
} else { |
|
512 |
return getDirectedDistance(closestPoint, point, segment); |
|
513 |
} |
|
514 |
} |
|
515 |
} |
|
516 |
} |
|
517 |
} |
|
518 |
|
|
519 |
if (geometry instanceof Polygon) { |
|
520 |
Polygon polygon = (Polygon) geometry; |
|
521 |
if (!polygon.contains(point)) { |
|
522 |
double minDistance = Double.POSITIVE_INFINITY; |
|
523 |
Geometry[] closestPoints = point.closestPoints(polygon); |
|
524 |
Point closestPoint = null; |
|
525 |
if (closestPoints != null) { |
|
526 |
for (Geometry closestPoint1 : closestPoints) { |
|
527 |
Point p = (Point) closestPoint1; |
|
528 |
if (!point.equals(p)) { |
|
529 |
double distance = p.distance(point); |
|
530 |
if (distance < minDistance) { |
|
531 |
minDistance = distance; |
|
532 |
closestPoint = p; |
|
533 |
} |
|
534 |
} |
|
535 |
} |
|
536 |
} |
|
537 |
if (closestPoint != null) { |
|
538 |
return closestPoint.distance(point); |
|
539 |
} |
|
540 |
} else { |
|
541 |
Line auxLine = (Line) polygon.toLines().getPrimitiveAt(0); |
|
542 |
if (auxLine != null) { |
|
543 |
return getDistance(auxLine, point); |
|
544 |
} |
|
545 |
} |
|
546 |
} |
|
547 |
|
|
548 |
if (geometry instanceof Aggregate) { |
|
549 |
double minDistance = Double.POSITIVE_INFINITY; |
|
550 |
Aggregate aggregate2 = (Aggregate) geometry; |
|
551 |
for (int i = 0; i < aggregate2.getPrimitivesNumber(); i++) { |
|
552 |
double distance = getDistance(aggregate2.getPrimitiveAt(i), point); |
|
553 |
if (distance < minDistance) { |
|
554 |
minDistance = distance; |
|
555 |
} |
|
556 |
} |
|
557 |
return minDistance; |
|
558 |
} |
|
559 |
return 0.0; |
|
560 |
} |
|
561 |
|
|
562 |
|
|
563 |
private Point getClosestPoint(Geometry geometry, Point point) throws GeometryOperationNotSupportedException, GeometryOperationException, GeometryException { |
|
564 |
GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
565 |
if (geometry instanceof Line) { |
|
566 |
Line line = (Line) geometry; |
|
567 |
return (Point)line.closestPoints(point)[0]; |
|
568 |
} else { |
|
569 |
return (Point)geometry.toLines().getPrimitiveAt(0).closestPoints(point)[0]; |
|
570 |
} |
|
571 |
// if (geometry instanceof Arc) { |
|
572 |
// return (Point)geometry.toLines().getPrimitiveAt(0).closestPoints(point)[0]; |
|
573 |
// } |
|
574 |
// |
|
575 |
// if (geometry instanceof Circle) { |
|
576 |
// return (Point)geometry.toLines().getPrimitiveAt(0).closestPoints(point)[0]; |
|
577 |
// } |
|
578 |
// if (geometry instanceof Circumference) { |
|
579 |
// return (Point)geometry.toLines().getPrimitiveAt(0).closestPoints(point)[0]; |
|
580 |
// } |
|
581 |
// if (geometry instanceof PeriEllipse) { |
|
582 |
// return (Point)geometry.toLines().getPrimitiveAt(0).closestPoints(point)[0]; |
|
583 |
// } |
|
584 |
// if (geometry instanceof Ellipse) { |
|
585 |
// return (Point)geometry.toLines().getPrimitiveAt(0).closestPoints(point)[0]; |
|
586 |
// } |
|
587 |
// |
|
588 |
// if (geometry instanceof Spline || geometry instanceof FilledSpline) { |
|
589 |
// return (Point)geometry.toLines().getPrimitiveAt(0).closestPoints(point)[0]; |
|
590 |
// } |
|
591 |
// |
|
592 |
// |
|
593 |
// if (geometry instanceof Polygon) { |
|
594 |
// return (Point)geometry.toLines().getPrimitiveAt(0).closestPoints(point)[0]; |
|
595 |
// } |
|
596 |
// |
|
597 |
// if (geometry instanceof Aggregate) { |
|
598 |
// return (Point)geometry.toLines().getPrimitiveAt(0).closestPoints(point)[0]; |
|
599 |
// } |
|
600 |
// return null; |
|
601 |
} |
|
602 |
|
|
603 |
// |
|
604 |
@Override |
|
605 |
public void stop() { |
|
606 |
values.clear(); |
|
607 |
this.selectedFeatures = Collections.EMPTY_LIST; |
|
608 |
} |
|
609 |
|
|
610 |
@Override |
|
611 |
public void restart() throws StartServiceException, InvalidEntryException, StopServiceException { |
|
612 |
// values.put(selectionParameter, null); |
|
613 |
values.put(offsetParameter, null); |
|
614 |
values.put(sideParameter, null); |
|
615 |
values.put(deleteOriginalGeometriesParameter, null); |
|
616 |
} |
|
617 |
|
|
618 |
|
|
619 |
private void validateAndInsertValue(EditingServiceParameter param, |
|
620 |
Object value) throws InvalidEntryException { |
|
621 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
622 |
|
|
623 |
try { |
|
624 |
if (param == selectionParameter) { |
|
625 |
if (value instanceof FeatureSelection) { |
|
626 |
FeatureSelection featureSelection = (FeatureSelection) value; |
|
627 |
if (featureSelection.getSelectedCount() > 0) { |
|
628 |
values.put(param, value); |
|
629 |
this.selectedFeatures = this.getSelectedFeaturesCopy(featureSelection); |
|
630 |
} |
|
631 |
} |
|
632 |
} else if (param == joinStyleParameter) { |
|
633 |
if (value instanceof String) { |
|
634 |
values.put(param, fixJoinStyle(value)); |
|
635 |
} |
|
636 |
} else if (param == offsetParameter) { |
|
637 |
if (value instanceof Point) { |
|
638 |
Double distance = getMinDistance(this.selectedFeatures, (Point) value); |
|
639 |
if (distance == 0.0) { |
|
640 |
throw new IllegalArgumentException("distance can't be 0"); |
|
641 |
} |
|
642 |
values.put(param, Math.abs(distance)); |
|
643 |
values.put(sideParameter, coerceSide(distance)); |
|
644 |
return; |
|
645 |
} |
|
646 |
if (value instanceof Double) { |
|
647 |
Double distance = (Double) value; |
|
648 |
if (distance > 0) { |
|
649 |
values.put(param, value); |
|
650 |
} else if (distance == 0.0) { |
|
651 |
throw new IllegalArgumentException("distance can't be 0"); |
|
652 |
} else { |
|
653 |
values.put(param, Math.abs(distance)); |
|
654 |
values.put(sideParameter, coerceSide(distance)); |
|
655 |
} |
|
656 |
} |
|
657 |
} else if (param == sideParameter) { |
|
658 |
if (value instanceof Point) { |
|
659 |
values.put(param, coerceSide(getMinDistance(this.selectedFeatures, (Point) value))); |
|
660 |
return; |
|
661 |
} |
|
662 |
if (value instanceof String) { |
|
663 |
values.put(param, coerceSide(value)); |
|
664 |
} |
|
665 |
} else if (param == equidistantOffsets) { |
|
666 |
if (value instanceof Number) { |
|
667 |
int intValue = ((Number) value).intValue(); |
|
668 |
if(intValue >= 1) { |
|
669 |
values.put(param, ((Number) value).intValue()); |
|
670 |
} |
|
671 |
} |
|
672 |
} else if (param == deleteOriginalGeometriesParameter) { |
|
673 |
values.put(param, param.getOptions2().getValue(value, param.getDefaultValue())); |
|
674 |
} |
|
675 |
} catch (Exception e) { |
|
676 |
throw new InvalidEntryException(e); |
|
677 |
} |
|
678 |
|
|
679 |
} |
|
680 |
|
|
681 |
private String coerceSide(Object value) throws InvalidEntryException { |
|
682 |
|
|
683 |
if (value instanceof Double) { |
|
684 |
return (Double) value >= 0 ? LEFT : RIGHT; |
|
685 |
} |
|
686 |
if (value instanceof String) { |
|
687 |
Double signum = getSideSignum((String) value); |
|
688 |
if (signum != null) { |
|
689 |
return signum >= 0 ? LEFT : RIGHT; |
|
690 |
} |
|
691 |
} |
|
692 |
throw new InvalidEntryException(null); |
|
693 |
} |
|
694 |
|
|
695 |
private String fixJoinStyle(Object value) throws InvalidEntryException { |
|
696 |
|
|
697 |
if (value instanceof String) { |
|
698 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
699 |
String joinStyleTrim = ((String)value).trim(); |
|
700 |
if (StringUtils.equalsIgnoreCase(joinStyleTrim, ROUND) |
|
701 |
|| StringUtils.startsWithIgnoreCase(i18nManager.getTranslation(ROUND), joinStyleTrim)) { |
|
702 |
return ROUND; |
|
703 |
} else if (StringUtils.equalsIgnoreCase(joinStyleTrim, BEVEL) |
|
704 |
|| StringUtils.startsWithIgnoreCase(i18nManager.getTranslation(BEVEL), joinStyleTrim)) { |
|
705 |
return BEVEL; |
|
706 |
} else if (StringUtils.equalsIgnoreCase(joinStyleTrim, MITRE) |
|
707 |
|| StringUtils.startsWithIgnoreCase(i18nManager.getTranslation(MITRE), joinStyleTrim)) { |
|
708 |
return MITRE; |
|
709 |
} |
|
710 |
} |
|
711 |
throw new InvalidEntryException(null); |
|
712 |
} |
|
713 |
|
|
714 |
private Double getSideSignum(String side) { |
|
715 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
716 |
String sideTrim = side.trim(); |
|
717 |
if (StringUtils.equalsIgnoreCase(sideTrim, LEFT) |
|
718 |
|| StringUtils.startsWithIgnoreCase(i18nManager.getTranslation(LEFT), sideTrim)) { |
|
719 |
return 1.0; |
|
720 |
} else if (StringUtils.equalsIgnoreCase(sideTrim, RIGHT) |
|
721 |
|| StringUtils.startsWithIgnoreCase(i18nManager.getTranslation(RIGHT), sideTrim)) { |
|
722 |
return -1.0; |
|
723 |
} |
|
724 |
return null; |
|
725 |
} |
|
726 |
|
|
727 |
@Override |
|
728 |
public List<EditingServiceParameter> getParameters() { |
|
729 |
List<EditingServiceParameter> list |
|
730 |
= new ArrayList<>(); |
|
731 |
list.add(selectionParameter); |
|
732 |
list.add(joinStyleParameter); |
|
733 |
list.add(offsetParameter); |
|
734 |
list.add(sideParameter); |
|
735 |
list.add(equidistantOffsets); |
|
736 |
list.add(deleteOriginalGeometriesParameter); |
|
737 |
return list; |
|
738 |
} |
|
739 |
|
|
740 |
@Override |
|
741 |
public void setValue(EditingServiceParameter parameter, Object value) throws InvalidEntryException { |
|
742 |
validateAndInsertValue(parameter, value); |
|
743 |
} |
|
744 |
|
|
745 |
@Override |
|
746 |
public void setValue(Object value) throws InvalidEntryException { |
|
747 |
EditingServiceParameter param = next(); |
|
748 |
validateAndInsertValue(param, value); |
|
749 |
} |
|
750 |
|
|
751 |
@Override |
|
752 |
public void finishAndStore() throws FinishServiceException { |
|
753 |
|
|
754 |
// FeatureSelection selected |
|
755 |
// = (FeatureSelection) values.get(selectionParameter); |
|
756 |
try { |
|
757 |
if (CollectionUtils.isNotEmpty(selectedFeatures)) { |
|
758 |
double side = 1.0; |
|
759 |
Object sideValue = values.get(sideParameter); |
|
760 |
if (sideValue != null) { |
|
761 |
if (sideValue instanceof String) { |
|
762 |
Double signum = getSideSignum((String) sideValue); |
|
763 |
side = signum != null ? signum : null; |
|
764 |
} |
|
765 |
} |
|
766 |
double distance = ((Double) values.get(offsetParameter)) * side; |
|
767 |
|
|
768 |
// DisposableIterator it; |
|
769 |
// it = selected.fastIterator(); |
|
770 |
int joinStyleValue = coerceJoinStyle(values.get(joinStyleParameter)); |
|
771 |
Number equidistantOffsetsNumberValue = ((Number) values.get(this.equidistantOffsets)); |
|
772 |
int equidistantOffsetsValue = equidistantOffsetsNumberValue != null ? equidistantOffsetsNumberValue.intValue() : ((Number)this.equidistantOffsets.getDefaultValue()).intValue(); |
|
773 |
for (Feature feature : selectedFeatures) { |
|
774 |
|
|
775 |
// } |
|
776 |
// while (it.hasNext()) { |
|
777 |
// Feature feature = (Feature) it.next(); |
|
778 |
for (int c = 1; c <= equidistantOffsetsValue; c++) { |
|
779 |
|
|
780 |
Geometry geom; |
|
781 |
try { |
|
782 |
geom = feature.getDefaultGeometry().offset(joinStyleValue, c * distance); |
|
783 |
} catch (GeometryOperationNotSupportedException | GeometryOperationException e) { |
|
784 |
throw new FinishServiceException(e); |
|
785 |
} |
|
786 |
|
|
787 |
if ((boolean) values.get(deleteOriginalGeometriesParameter) && c == 1) { |
|
788 |
// Se sustituye la geometr?a original por la primera calculada |
|
789 |
EditableFeature editableFeature |
|
790 |
= feature.getEditable(); |
|
791 |
editableFeature.setDefaultGeometry(geom); |
|
792 |
((EditingProviderServices) getProviderServices()) |
|
793 |
.updateFeatureInFeatureStore(editableFeature, |
|
794 |
featureStore); |
|
795 |
} else { |
|
796 |
// Se crea una feature nueva copiando los valores de |
|
797 |
// la feature original excepto aquellos que sean PK |
|
798 |
EditingProviderServices editingProviderServices |
|
799 |
= (EditingProviderServices) getProviderServices(); |
|
800 |
EditableFeature editableFeature |
|
801 |
= editingProviderServices |
|
802 |
.getFeatureCopyWithoutUniqueIndex(featureStore, |
|
803 |
feature); |
|
804 |
editableFeature.setDefaultGeometry(geom); |
|
805 |
editingProviderServices |
|
806 |
.insertFeatureIntoFeatureStore(editableFeature, |
|
807 |
featureStore); |
|
808 |
} |
|
809 |
} |
|
810 |
|
|
811 |
} |
|
812 |
// it.dispose(); |
|
813 |
// featureStore.getFeatureSelection().deselectAll(); |
|
814 |
} |
|
815 |
} catch (DataException e) { |
|
816 |
throw new FinishServiceException(e); |
|
817 |
} |
|
818 |
} |
|
819 |
|
|
820 |
private Double getDirectedDistance(Point pointInLine, Point distancePoint, Line line) |
|
821 |
throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
822 |
Double distance = distancePoint.distance(pointInLine); |
|
823 |
EditingProviderServices editingProviderServices |
|
824 |
= (EditingProviderServices) getProviderServices(); |
|
825 |
Double angle = editingProviderServices.getAngle(pointInLine, distancePoint); |
|
826 |
double angleLine = editingProviderServices.getAngle(line.getVertex(0), line.getVertex(1)); |
|
827 |
|
|
828 |
Double angleDifference = angle - angleLine; |
|
829 |
if (angleDifference < 0) { |
|
830 |
angleDifference += 2 * Math.PI; |
|
831 |
} |
|
832 |
if (angleDifference > Math.PI) { |
|
833 |
distance = -distance; |
|
834 |
} |
|
835 |
return distance; |
|
836 |
} |
|
837 |
|
|
838 |
@Override |
|
839 |
public Geometry finish() throws FinishServiceException { |
|
840 |
return null; |
|
841 |
} |
|
842 |
|
|
843 |
@Override |
|
844 |
public void start() throws StartServiceException { |
|
845 |
this.values = new HashMap<>(); |
|
846 |
this.selectedFeatures = Collections.EMPTY_LIST; |
|
847 |
FeatureSelection selected = null; |
|
848 |
if (featureStore != null) { |
|
849 |
try { |
|
850 |
selected |
|
851 |
= (FeatureSelection) featureStore.getFeatureSelection() |
|
852 |
.clone(); |
|
853 |
} catch (DataException e) { |
|
854 |
throw new StartServiceException(e); |
|
855 |
} catch (CloneNotSupportedException e) { |
|
856 |
// Do nothing |
|
857 |
} |
|
858 |
if ((selected != null) && (selected.getSelectedCount() > 0)) { |
|
859 |
values.put(selectionParameter, selected); |
|
860 |
this.selectedFeatures = this.getSelectedFeaturesCopy(selected); |
|
861 |
} |
|
862 |
} |
|
863 |
} |
|
864 |
|
|
865 |
@Override |
|
866 |
public String getName() { |
|
867 |
return OffsetEditingProviderFactory.PROVIDER_NAME; |
|
868 |
} |
|
869 |
|
|
870 |
private int coerceJoinStyle(Object joinStyle) { |
|
871 |
if(joinStyle instanceof String) { |
|
872 |
switch ((String)joinStyle) { |
|
873 |
default: |
|
874 |
case ROUND: |
|
875 |
return JOIN_STYLE_ROUND; |
|
876 |
case MITRE: |
|
877 |
return Geometry.JOIN_STYLE_MITRE; |
|
878 |
case BEVEL: |
|
879 |
return Geometry.JOIN_STYLE_BEVEL; |
|
880 |
} |
|
881 |
} |
|
882 |
return JOIN_STYLE_ROUND; |
|
883 |
} |
|
884 |
|
|
885 |
@Override |
|
886 |
public boolean isEnabled(EditingServiceParameter parameter) { |
|
887 |
if (parameter == joinStyleParameter) { |
|
888 |
return true; |
|
889 |
} |
|
890 |
if (parameter == equidistantOffsets) { |
|
891 |
return true; |
|
892 |
} |
|
893 |
return true; |
|
894 |
} |
|
895 |
|
|
896 |
private ISimpleTextSymbol getTextSymbol(){ |
|
897 |
SymbologyManager symbologyManager = SymbologyLocator.getSymbologyManager(); |
|
898 |
ISimpleTextSymbol textSymbol = symbologyManager.createSimpleTextSymbol(); |
|
899 |
textSymbol.setFontSize(10); |
|
900 |
return textSymbol; |
|
901 |
} |
|
902 |
|
|
903 |
@Override |
|
904 |
public Object getValue(EditingServiceParameter parameter) { |
|
905 |
return values!=null?values.get(parameter):null; |
Also available in: Unified diff