Revision 577
org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.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.desktop</artifactId> |
|
6 |
<version>2.0.105</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.vectorediting.offset</artifactId> |
|
9 |
<version>1.0.0-SNAPSHOT</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/${project.artifactId}/trunk/${project.artifactId}</connection> |
|
35 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-vectorediting/${project.artifactId}/trunk/${project.artifactId}</developerConnection> |
|
36 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-vector-editing/repository/show/${project.artifactId}/trunk/${project.artifactId}</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> |
|
63 |
org.gvsig.vectorediting |
|
64 |
</artifactId> |
|
65 |
<version>${org.gvsig.vectorediting.version}</version> |
|
66 |
<scope>import</scope> |
|
67 |
<type>pom</type> |
|
68 |
</dependency> |
|
69 |
<dependency> |
|
70 |
<groupId>org.gvsig</groupId> |
|
71 |
<artifactId>org.gvsig.vectorediting.offset.lib.prov.offset</artifactId> |
|
72 |
<version>1.0.0-SNAPSHOT</version> |
|
73 |
</dependency> |
|
74 |
</dependencies> |
|
75 |
</dependencyManagement> |
|
76 |
|
|
77 |
<modules> |
|
78 |
<module>org.gvsig.vectorediting.offset.lib</module> |
|
79 |
<module>org.gvsig.vectorediting.offset.app</module> |
|
80 |
</modules> |
|
81 |
|
|
82 |
<properties> |
|
83 |
<org.gvsig.vectorediting.version>1.0.17</org.gvsig.vectorediting.version> |
|
84 |
</properties> |
|
85 |
</project> |
org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.offset/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.0-SNAPSHOT</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/trunk/org.gvsig.vectorediting.offset/org.gvsig.vectorediting.offset.app/org.gvsig.vectorediting.offset.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Fri Oct 09 12:07:32 CEST 2015 |
|
2 |
buildNumber=1 |
org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.offset/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="600800000"> |
|
29 |
<selectable-tool name="modify-offset" /> |
|
30 |
</tool-bar> |
|
31 |
|
|
32 |
</extension> |
|
33 |
</extensions> |
|
34 |
</plugin-config> |
org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.offset/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/trunk/org.gvsig.vectorediting.offset/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.0-SNAPSHOT</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/trunk/org.gvsig.vectorediting.offset/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.0-SNAPSHOT</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/trunk/org.gvsig.vectorediting.offset/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/trunk/org.gvsig.vectorediting.offset/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 |
|
|
25 |
package org.gvsig.vectorediting.offset.lib.prov.offset; |
|
26 |
|
|
27 |
import java.awt.geom.AffineTransform; |
|
28 |
import java.util.ArrayList; |
|
29 |
import java.util.HashMap; |
|
30 |
import java.util.LinkedHashMap; |
|
31 |
import java.util.List; |
|
32 |
import java.util.Map; |
|
33 |
|
|
34 |
import org.apache.commons.lang3.mutable.MutableDouble; |
|
35 |
import org.gvsig.fmap.dal.exception.DataException; |
|
36 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
37 |
import org.gvsig.fmap.dal.feature.Feature; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
39 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
40 |
import org.gvsig.fmap.geom.Geometry; |
|
41 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
42 |
import org.gvsig.fmap.geom.GeometryManager; |
|
43 |
import org.gvsig.fmap.geom.aggregate.Aggregate; |
|
44 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
|
45 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
46 |
import org.gvsig.fmap.geom.aggregate.MultiSurface; |
|
47 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
48 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
49 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
|
50 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
|
51 |
import org.gvsig.fmap.geom.primitive.Circle; |
|
52 |
import org.gvsig.fmap.geom.primitive.Circumference; |
|
53 |
import org.gvsig.fmap.geom.primitive.Curve; |
|
54 |
import org.gvsig.fmap.geom.primitive.Ellipse; |
|
55 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
56 |
import org.gvsig.fmap.geom.primitive.Line; |
|
57 |
import org.gvsig.fmap.geom.primitive.OrientablePrimitive; |
|
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.Surface; |
|
62 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
63 |
import org.gvsig.tools.ToolsLocator; |
|
64 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
65 |
import org.gvsig.tools.dynobject.DynObject; |
|
66 |
import org.gvsig.tools.i18n.I18nManager; |
|
67 |
import org.gvsig.tools.locator.LocatorException; |
|
68 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
69 |
import org.gvsig.vectorediting.lib.api.DrawingStatus; |
|
70 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter; |
|
71 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter.TYPE; |
|
72 |
import org.gvsig.vectorediting.lib.api.exceptions.DrawServiceException; |
|
73 |
import org.gvsig.vectorediting.lib.api.exceptions.FinishServiceException; |
|
74 |
import org.gvsig.vectorediting.lib.api.exceptions.InvalidEntryException; |
|
75 |
import org.gvsig.vectorediting.lib.api.exceptions.StartServiceException; |
|
76 |
import org.gvsig.vectorediting.lib.spi.AbstractEditingProvider; |
|
77 |
import org.gvsig.vectorediting.lib.spi.DefaultDrawingStatus; |
|
78 |
import org.gvsig.vectorediting.lib.spi.DefaultEditingServiceParameter; |
|
79 |
import org.gvsig.vectorediting.lib.spi.EditingProvider; |
|
80 |
import org.gvsig.vectorediting.lib.spi.EditingProviderFactory; |
|
81 |
import org.gvsig.vectorediting.lib.spi.EditingProviderLocator; |
|
82 |
import org.gvsig.vectorediting.lib.spi.EditingProviderManager; |
|
83 |
import org.gvsig.vectorediting.lib.spi.EditingProviderServices; |
|
84 |
|
|
85 |
public class OffsetEditingProvider extends AbstractEditingProvider implements |
|
86 |
EditingProvider { |
|
87 |
|
|
88 |
private final Double PRECISION=new Double(1.0e-5); |
|
89 |
|
|
90 |
private I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
91 |
|
|
92 |
private EditingServiceParameter selectionParameter; |
|
93 |
|
|
94 |
private EditingServiceParameter pointParameter; |
|
95 |
|
|
96 |
private Map<EditingServiceParameter, Object> values; |
|
97 |
|
|
98 |
private FeatureStore featureStore; |
|
99 |
|
|
100 |
public OffsetEditingProvider(ProviderServices providerServices, |
|
101 |
DynObject parameters) { |
|
102 |
super(providerServices); |
|
103 |
this.featureStore = |
|
104 |
(FeatureStore) parameters |
|
105 |
.getDynValue(EditingProviderFactory.FEATURE_STORE_FIELD); |
|
106 |
|
|
107 |
this.selectionParameter = |
|
108 |
new DefaultEditingServiceParameter("selection", |
|
109 |
i18nManager.getTranslation("selection"), TYPE.SELECTION); |
|
110 |
|
|
111 |
this.pointParameter = |
|
112 |
new DefaultEditingServiceParameter("offset_distance", |
|
113 |
i18nManager.getTranslation("offset_distance"), |
|
114 |
TYPE.POSITION); |
|
115 |
} |
|
116 |
|
|
117 |
public EditingServiceParameter next() { |
|
118 |
|
|
119 |
if (values.get(selectionParameter) == null) { |
|
120 |
return selectionParameter; |
|
121 |
} else if (values.get(pointParameter) == null) { |
|
122 |
return pointParameter; |
|
123 |
} |
|
124 |
return null; |
|
125 |
} |
|
126 |
|
|
127 |
public DrawingStatus getDrawingStatus(Point mousePosition) |
|
128 |
throws DrawServiceException { |
|
129 |
DefaultDrawingStatus drawingStatus = new DefaultDrawingStatus(); |
|
130 |
EditingProviderManager editingProviderManager = |
|
131 |
EditingProviderLocator.getProviderManager(); |
|
132 |
ISymbol auxiliaryLineSymbolEditing = editingProviderManager.getSymbol("auxiliary-line-symbol-editing"); |
|
133 |
ISymbol auxiliaryPointSymbolEditing = editingProviderManager.getSymbol("auxiliary-point-symbol-editing"); |
|
134 |
ISymbol lineSymbolEditing = editingProviderManager.getSymbol("line-symbol-editing"); |
|
135 |
ISymbol polygonSymbolEditing = editingProviderManager.getSymbol("polygon-symbol-editing"); |
|
136 |
|
|
137 |
|
|
138 |
FeatureSelection selected = |
|
139 |
(FeatureSelection) values.get(selectionParameter); |
|
140 |
try { |
|
141 |
if ((selected != null) && !selected.isEmpty()) { |
|
142 |
Point point=null; |
|
143 |
Object pointValue = (Point) values.get(pointParameter); |
|
144 |
if ((pointValue != null) && (pointValue instanceof Point)) { |
|
145 |
point=(Point)pointValue; |
|
146 |
}else{ |
|
147 |
point=mousePosition; |
|
148 |
Line line; |
|
149 |
line = |
|
150 |
GeometryLocator.getGeometryManager().createLine( |
|
151 |
featureStore.getDefaultFeatureType() |
|
152 |
.getDefaultGeometryAttribute().getGeomType() |
|
153 |
.getSubType()); |
|
154 |
Point closestPoint=getClosestPoint(point,selected); |
|
155 |
//TODO |
|
156 |
Point perpendicularPoint=null; |
|
157 |
MutableDouble normalModule=new MutableDouble(); |
|
158 |
try { |
|
159 |
perpendicularPoint=getPerpendicularPoint(closestPoint, point,selected,normalModule); |
|
160 |
//normalModule=getNormalModule(closestPoint, point,selected); |
|
161 |
} catch (Exception e) { |
|
162 |
throw new DrawServiceException(e); |
|
163 |
} |
|
164 |
line.addVertex(closestPoint); |
|
165 |
//line.addVertex(point); |
|
166 |
line.addVertex(perpendicularPoint); |
|
167 |
|
|
168 |
drawingStatus.addStatus(line, auxiliaryLineSymbolEditing, ""); |
|
169 |
|
|
170 |
AffineTransform at; |
|
171 |
try { |
|
172 |
at = getSymmetryAffineTransform(normalModule.getValue()); |
|
173 |
} catch (Exception e) { |
|
174 |
throw new DrawServiceException(e); |
|
175 |
} |
|
176 |
|
|
177 |
DisposableIterator it; |
|
178 |
it = selected.fastIterator(); |
|
179 |
|
|
180 |
while (it.hasNext()) { |
|
181 |
Feature feat = (Feature) it.next(); |
|
182 |
Geometry transformedGeometry = feat.getDefaultGeometry().cloneGeometry(); |
|
183 |
transformedGeometry.transform(at); |
|
184 |
|
|
185 |
ISymbol symbol=null; |
|
186 |
if(transformedGeometry instanceof Curve || transformedGeometry instanceof MultiCurve){ |
|
187 |
symbol = lineSymbolEditing; |
|
188 |
} else if(transformedGeometry instanceof Surface || transformedGeometry instanceof MultiSurface){ |
|
189 |
symbol = polygonSymbolEditing; |
|
190 |
} else if(transformedGeometry instanceof Point || transformedGeometry instanceof MultiPoint){ |
|
191 |
symbol = auxiliaryPointSymbolEditing; |
|
192 |
} |
|
193 |
if(transformedGeometry instanceof Aggregate){ |
|
194 |
int primitivesNumber = ((Aggregate)transformedGeometry).getPrimitivesNumber(); |
|
195 |
for (int i = 0; i < primitivesNumber; i++) { |
|
196 |
drawingStatus.addStatus(((Aggregate)transformedGeometry).getPrimitiveAt(i), symbol, ""); |
|
197 |
} |
|
198 |
} else { |
|
199 |
drawingStatus.addStatus(transformedGeometry, symbol, ""); |
|
200 |
} |
|
201 |
} |
|
202 |
it.dispose(); |
|
203 |
} |
|
204 |
return drawingStatus; |
|
205 |
} |
|
206 |
} catch (Exception e) { |
|
207 |
throw new DrawServiceException(e); |
|
208 |
} |
|
209 |
return null; |
|
210 |
} |
|
211 |
|
|
212 |
private AffineTransform getSymmetryAffineTransform(Double distance) |
|
213 |
throws GeometryOperationNotSupportedException, |
|
214 |
GeometryOperationException { |
|
215 |
|
|
216 |
AffineTransform translate = |
|
217 |
AffineTransform.getTranslateInstance(distance, |
|
218 |
0); |
|
219 |
|
|
220 |
return translate; |
|
221 |
} |
|
222 |
|
|
223 |
|
|
224 |
public void stop() { |
|
225 |
values.clear(); |
|
226 |
} |
|
227 |
|
|
228 |
private void validateAndInsertValue(EditingServiceParameter param, |
|
229 |
Object value) throws InvalidEntryException { |
|
230 |
if (param == selectionParameter) { |
|
231 |
if (value instanceof FeatureSelection) { |
|
232 |
values.put(param, value); |
|
233 |
return; |
|
234 |
} |
|
235 |
} else if (param == pointParameter) { |
|
236 |
if (value instanceof Point) { |
|
237 |
values.put(param, value); |
|
238 |
return; |
|
239 |
} |
|
240 |
} |
|
241 |
} |
|
242 |
|
|
243 |
public List<EditingServiceParameter> getParameters() { |
|
244 |
List<EditingServiceParameter> list = |
|
245 |
new ArrayList<EditingServiceParameter>(); |
|
246 |
list.add(selectionParameter); |
|
247 |
list.add(pointParameter); |
|
248 |
return list; |
|
249 |
} |
|
250 |
|
|
251 |
public void setValue(Object value) throws InvalidEntryException { |
|
252 |
EditingServiceParameter param = next(); |
|
253 |
validateAndInsertValue(param, value); |
|
254 |
} |
|
255 |
|
|
256 |
public void finishAndStore() throws FinishServiceException { |
|
257 |
|
|
258 |
FeatureSelection selected = |
|
259 |
(FeatureSelection) values.get(selectionParameter); |
|
260 |
try { |
|
261 |
if (!selected.isEmpty()) { |
|
262 |
Point point = (Point) values.get(pointParameter); |
|
263 |
if ((point != null)) { |
|
264 |
|
|
265 |
Double distance; |
|
266 |
try { |
|
267 |
Point closestPoint=getClosestPoint(point,selected); |
|
268 |
distance = point.distance(closestPoint); |
|
269 |
} catch (GeometryOperationNotSupportedException e1) { |
|
270 |
throw new FinishServiceException(e1); |
|
271 |
} catch (GeometryOperationException e1) { |
|
272 |
throw new FinishServiceException(e1); |
|
273 |
} |
|
274 |
|
|
275 |
AffineTransform at; |
|
276 |
try { |
|
277 |
at = getSymmetryAffineTransform(distance); |
|
278 |
} catch (GeometryOperationNotSupportedException e) { |
|
279 |
throw new FinishServiceException(e); |
|
280 |
} catch (GeometryOperationException e) { |
|
281 |
throw new FinishServiceException(e); |
|
282 |
} |
|
283 |
|
|
284 |
DisposableIterator it; |
|
285 |
it = selected.fastIterator(); |
|
286 |
|
|
287 |
while (it.hasNext()) { |
|
288 |
Feature feature = (Feature) it.next(); |
|
289 |
Geometry geom = |
|
290 |
feature.getDefaultGeometry().cloneGeometry(); |
|
291 |
geom.transform(at); |
|
292 |
|
|
293 |
// Se crea una feature nueva copiando los valores de |
|
294 |
// la feature original excepto aquellos que sean PK |
|
295 |
EditingProviderServices editingProviderServices = |
|
296 |
(EditingProviderServices) getProviderServices(); |
|
297 |
EditableFeature editableFeature = |
|
298 |
editingProviderServices |
|
299 |
.getFeatureCopyWithoutPK(featureStore, |
|
300 |
feature); |
|
301 |
editableFeature.setDefaultGeometry(geom); |
|
302 |
editingProviderServices |
|
303 |
.insertFeatureIntoFeatureStore(editableFeature, |
|
304 |
featureStore); |
|
305 |
|
|
306 |
} |
|
307 |
it.dispose(); |
|
308 |
featureStore.getFeatureSelection().deselectAll(); |
|
309 |
} |
|
310 |
} |
|
311 |
} catch (DataException e) { |
|
312 |
throw new FinishServiceException(e); |
|
313 |
} |
|
314 |
} |
|
315 |
|
|
316 |
private Double getNormalModule(Point closestPoint, Point distancePoint,FeatureSelection selected) |
|
317 |
throws DataException, CreateEnvelopeException, GeometryOperationNotSupportedException, GeometryOperationException, CreateGeometryException, LocatorException{ |
|
318 |
|
|
319 |
MutableDouble distance=null; |
|
320 |
getPerpendicularPoint(closestPoint, distancePoint, selected, distance); |
|
321 |
return distance.getValue(); |
|
322 |
} |
|
323 |
|
|
324 |
private Point getPerpendicularPoint(Point closestPoint, Point distancePoint,FeatureSelection selected) |
|
325 |
throws DataException, CreateEnvelopeException, GeometryOperationNotSupportedException, GeometryOperationException, CreateGeometryException, LocatorException{ |
|
326 |
return getPerpendicularPoint(closestPoint,distancePoint,selected,null); |
|
327 |
} |
|
328 |
|
|
329 |
|
|
330 |
private Point getPerpendicularPoint(Point closestPoint, Point distancePoint,FeatureSelection selected, MutableDouble normalModule) |
|
331 |
throws DataException, CreateEnvelopeException, GeometryOperationNotSupportedException, GeometryOperationException, CreateGeometryException, LocatorException{ |
|
332 |
|
|
333 |
int subType = featureStore.getDefaultFeatureType() |
|
334 |
.getDefaultGeometryAttribute().getGeomType() |
|
335 |
.getSubType(); |
|
336 |
|
|
337 |
Geometry containingGeometry=getContainingGeometry(selected, closestPoint); |
|
338 |
|
|
339 |
if (containingGeometry instanceof Circle || containingGeometry instanceof Ellipse || |
|
340 |
containingGeometry instanceof Circumference || containingGeometry instanceof PeriEllipse){ |
|
341 |
if (containingGeometry instanceof Circle){ |
|
342 |
Circle circle=(Circle)containingGeometry; |
|
343 |
Circumference circumference =(Circumference)GeometryLocator. |
|
344 |
getGeometryManager().create(Geometry.TYPES.CIRCUMFERENCE, subType); |
|
345 |
circumference.setPoints(circle.getCenter(), circle.getRadious()); |
|
346 |
containingGeometry=circumference; |
|
347 |
} |
|
348 |
if (containingGeometry instanceof Ellipse || containingGeometry instanceof Circumference){ |
|
349 |
Ellipse ellipse=(Ellipse)containingGeometry; |
|
350 |
PeriEllipse periellipse =(PeriEllipse)GeometryLocator. |
|
351 |
getGeometryManager().create(Geometry.TYPES.PERIELLIPSE, subType); |
|
352 |
periellipse.setPoints(ellipse.getAxis1Start(), ellipse.getAxis1End(), ellipse.getAxis2Dist()); |
|
353 |
containingGeometry=periellipse; |
|
354 |
} |
|
355 |
if (containingGeometry instanceof PeriEllipse){ |
|
356 |
Integer direction; |
|
357 |
if (containingGeometry.contains(distancePoint)){ |
|
358 |
direction=-1; |
|
359 |
}else{ |
|
360 |
direction=1; |
|
361 |
} |
|
362 |
normalModule.setValue(closestPoint.distance(distancePoint)*direction); |
|
363 |
return distancePoint; |
|
364 |
} |
|
365 |
} |
|
366 |
|
|
367 |
Line containingLine=null; |
|
368 |
if (containingGeometry!=null){ |
|
369 |
containingLine = getContainingLine(containingGeometry, closestPoint, subType); |
|
370 |
} |
|
371 |
|
|
372 |
if (containingLine!=null){ |
|
373 |
Double module=containingLine.perimeter(); |
|
374 |
|
|
375 |
Point point0=containingLine.getVertex(0); |
|
376 |
Point point1=containingLine.getVertex(1); |
|
377 |
|
|
378 |
Double unitarianX=(point1.getX()-point0.getX())/module; |
|
379 |
Double unitarianY=(point1.getY()-point0.getY())/module; |
|
380 |
|
|
381 |
Point unitarianPoint=GeometryLocator.getGeometryManager().createPoint( |
|
382 |
unitarianX, |
|
383 |
unitarianY, |
|
384 |
subType); |
|
385 |
|
|
386 |
Double perpendicularAngle=Math.PI/2; |
|
387 |
AffineTransform rotate = AffineTransform.getRotateInstance(perpendicularAngle); |
|
388 |
unitarianPoint.transform(rotate); |
|
389 |
|
|
390 |
Double distance=getDirectedDistance(closestPoint, distancePoint, containingLine); |
|
391 |
|
|
392 |
unitarianPoint.setX(unitarianPoint.getX()*distance); |
|
393 |
unitarianPoint.setY(unitarianPoint.getY()*distance); |
|
394 |
|
|
395 |
unitarianPoint.setX(unitarianPoint.getX()+closestPoint.getX()); |
|
396 |
unitarianPoint.setY(unitarianPoint.getY()+closestPoint.getY()); |
|
397 |
|
|
398 |
if (distance>0){ |
|
399 |
normalModule.setValue(unitarianPoint.distance(closestPoint)); |
|
400 |
}else{ |
|
401 |
normalModule.setValue(-unitarianPoint.distance(closestPoint)); |
|
402 |
} |
|
403 |
|
|
404 |
|
|
405 |
return unitarianPoint; |
|
406 |
} |
|
407 |
return null; |
|
408 |
} |
|
409 |
|
|
410 |
private Double getDirectedDistance(Point pointInLine, Point distancePoint, Line line) |
|
411 |
throws GeometryOperationNotSupportedException, GeometryOperationException{ |
|
412 |
Double distance=distancePoint.distance(pointInLine); |
|
413 |
EditingProviderServices editingProviderServices = |
|
414 |
(EditingProviderServices) getProviderServices(); |
|
415 |
Double angle = editingProviderServices.getAngle(pointInLine, distancePoint); |
|
416 |
double angleLine = editingProviderServices.getAngle(line.getVertex(0), line.getVertex(1)); |
|
417 |
|
|
418 |
Double angleDifference=angle - angleLine; |
|
419 |
if ( angleDifference<0 ){ |
|
420 |
angleDifference+=2*Math.PI; |
|
421 |
} |
|
422 |
if (angleDifference > Math.PI ) { |
|
423 |
distance = -distance; // perpendicularAngle=3*Math.PI/2; |
|
424 |
} |
|
425 |
return distance; |
|
426 |
} |
|
427 |
|
|
428 |
private Line getContainingLine(Geometry containingGeometry, |
|
429 |
Point containedPoint, int subType) |
|
430 |
throws CreateGeometryException, |
|
431 |
GeometryOperationNotSupportedException, GeometryOperationException { |
|
432 |
if (containingGeometry instanceof Line ||containingGeometry instanceof Polygon ){ |
|
433 |
OrientablePrimitive orientableGeometry=(OrientablePrimitive)containingGeometry; |
|
434 |
for (int i=0; i<orientableGeometry.getNumVertices()-1;i++){ |
|
435 |
Point point=orientableGeometry.getVertex(i); |
|
436 |
Point nextPoint=orientableGeometry.getVertex(i+1); |
|
437 |
Line line = |
|
438 |
GeometryLocator.getGeometryManager().createLine( |
|
439 |
subType); |
|
440 |
line.addVertex(point); |
|
441 |
line.addVertex(nextPoint); |
|
442 |
//FIXME |
|
443 |
//if (line.contains(closestPoint)){ |
|
444 |
if (line.isWithinDistance(containedPoint, PRECISION)){ |
|
445 |
return line; |
|
446 |
} |
|
447 |
} |
|
448 |
} |
|
449 |
return null; |
|
450 |
} |
|
451 |
|
|
452 |
private Geometry getContainingGeometry (FeatureSelection selected,Point point) |
|
453 |
throws DataException, GeometryOperationNotSupportedException, GeometryOperationException{ |
|
454 |
|
|
455 |
DisposableIterator it; |
|
456 |
it = selected.fastIterator(); |
|
457 |
while (it.hasNext()) { |
|
458 |
Feature feat = (Feature) it.next(); |
|
459 |
Geometry geometry = feat.getDefaultGeometry(); |
|
460 |
if(geometry instanceof Aggregate){ |
|
461 |
int primitivesNumber = ((Aggregate)geometry).getPrimitivesNumber(); |
|
462 |
for (int i = 0; i < primitivesNumber; i++) { |
|
463 |
Geometry primitiveGeometry=((Aggregate)geometry).getPrimitiveAt(i); |
|
464 |
if (primitiveGeometry instanceof Polygon) { |
|
465 |
Polygon geomPoly = (Polygon)primitiveGeometry; |
|
466 |
//FIXME |
|
467 |
if (geomPoly.isWithinDistance(point, PRECISION)){ |
|
468 |
//if (geomPoly.touches(point)){ |
|
469 |
return primitiveGeometry; |
|
470 |
} |
|
471 |
//FIXME |
|
472 |
//} else if(primitiveGeometry.contains(closestPoint)){ |
|
473 |
} else if(primitiveGeometry.isWithinDistance(point, PRECISION)){ |
|
474 |
return primitiveGeometry; |
|
475 |
} |
|
476 |
} |
|
477 |
} else { |
|
478 |
if (geometry instanceof Polygon) { |
|
479 |
Polygon geomPoly = (Polygon)geometry; |
|
480 |
//FIXME |
|
481 |
if (geomPoly.isWithinDistance(point, PRECISION)){ |
|
482 |
//if (geomPoly.touches(point)){ |
|
483 |
return geometry; |
|
484 |
} |
|
485 |
//FIXME |
|
486 |
//} else if(geometry.contains(closestPoint)){ |
|
487 |
} else if(geometry.isWithinDistance(point, PRECISION)){ |
|
488 |
return geometry; |
|
489 |
} |
|
490 |
} |
|
491 |
} |
|
492 |
return null; |
|
493 |
} |
|
494 |
|
|
495 |
private Point getClosestPoint(Point point, FeatureSelection selected) |
|
496 |
throws DataException, GeometryOperationNotSupportedException, |
|
497 |
GeometryOperationException{ |
|
498 |
|
|
499 |
DisposableIterator it; |
|
500 |
it = selected.fastIterator(); |
|
501 |
ArrayList<Point> closestPoints = new ArrayList<Point>(); |
|
502 |
while (it.hasNext()) { |
|
503 |
Feature feat = (Feature) it.next(); |
|
504 |
Geometry geometry = feat.getDefaultGeometry(); |
|
505 |
Geometry[] geoms = point.closestPoints(geometry); |
|
506 |
if (geoms!=null){ |
|
507 |
for (int i=0;i<geoms.length;i++){ |
|
508 |
Geometry closePoint=geoms[i]; |
|
509 |
if (closePoint!=null && closePoint instanceof Point){ |
|
510 |
closestPoints.add((Point)closePoint); |
|
511 |
} |
|
512 |
} |
|
513 |
} |
|
514 |
} |
|
515 |
it.dispose(); |
|
516 |
double minorDistance=Double.POSITIVE_INFINITY; |
|
517 |
Point closestPoint=null; |
|
518 |
for (Point closePoint:closestPoints){ |
|
519 |
double distance=point.distance(closePoint); |
|
520 |
if (distance<minorDistance && distance>Double.valueOf(0)){ |
|
521 |
minorDistance=distance; |
|
522 |
closestPoint=closePoint; |
|
523 |
} |
|
524 |
} |
|
525 |
return closestPoint; |
|
526 |
} |
|
527 |
|
|
528 |
|
|
529 |
public Geometry finish() throws FinishServiceException { |
|
530 |
return null; |
|
531 |
} |
|
532 |
|
|
533 |
public void start() throws StartServiceException { |
|
534 |
this.values = new HashMap<EditingServiceParameter, Object>(); |
|
535 |
FeatureSelection selected = null; |
|
536 |
if (featureStore != null) { |
|
537 |
try { |
|
538 |
selected = |
|
539 |
(FeatureSelection) featureStore.getFeatureSelection() |
|
540 |
.clone(); |
|
541 |
} catch (DataException e) { |
|
542 |
throw new StartServiceException(e); |
|
543 |
} catch (CloneNotSupportedException e) { |
|
544 |
// Do nothing |
|
545 |
} |
|
546 |
if ((selected != null) && (selected.getSelectedCount() > 0)) { |
|
547 |
values.put(selectionParameter, selected); |
|
548 |
} |
|
549 |
} |
|
550 |
} |
|
551 |
|
|
552 |
public String getName() { |
|
553 |
return OffsetEditingProviderFactory.PROVIDER_NAME; |
|
554 |
} |
|
555 |
|
|
556 |
} |
org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.offset/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.ToolsLocator; |
|
29 |
import org.gvsig.tools.dynobject.DynClass; |
|
30 |
import org.gvsig.tools.dynobject.DynObject; |
|
31 |
import org.gvsig.tools.service.spi.AbstractProviderFactory; |
|
32 |
import org.gvsig.tools.service.spi.Provider; |
|
33 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
34 |
import org.gvsig.vectorediting.lib.api.EditingServiceInfo; |
|
35 |
import org.gvsig.vectorediting.lib.spi.DefaultEditingServiceinfo; |
|
36 |
import org.gvsig.vectorediting.lib.spi.EditingProviderFactory; |
|
37 |
|
|
38 |
public class OffsetEditingProviderFactory extends AbstractProviderFactory |
|
39 |
implements EditingProviderFactory { |
|
40 |
|
|
41 |
public static final String PROVIDER_NAME = "modify-offset"; |
|
42 |
|
|
43 |
private final static String PROVIDER_DESCRIPTION = |
|
44 |
"Creates offset geometries from selection"; |
|
45 |
|
|
46 |
public void initialize() { |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public EditingServiceInfo getServiceInfo() { |
|
51 |
EditingServiceInfo serviceInfo = |
|
52 |
new DefaultEditingServiceinfo(PROVIDER_NAME, "", false, null, |
|
53 |
new int[] { Geometry.TYPES.POINT, Geometry.TYPES.MULTIPOINT, |
|
54 |
Geometry.TYPES.SURFACE, Geometry.TYPES.MULTISURFACE, |
|
55 |
Geometry.TYPES.CURVE, Geometry.TYPES.MULTICURVE }); |
|
56 |
|
|
57 |
return serviceInfo; |
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
protected Provider doCreate(DynObject parameters, ProviderServices services) { |
|
62 |
return new OffsetEditingProvider(services, parameters); |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
public DynObject createParameters() { |
|
67 |
DynObject dynobject = super.createParameters(); |
|
68 |
dynobject.setDynValue(PROVIDER_NAME_FIELD, PROVIDER_NAME); |
|
69 |
return dynobject; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
protected DynClass createParametersDynClass() { |
|
74 |
DynClass dynclass = |
|
75 |
ToolsLocator.getDynObjectManager().createDynClass(PROVIDER_NAME, |
|
76 |
PROVIDER_DESCRIPTION); |
|
77 |
|
|
78 |
dynclass.addDynFieldString(PROVIDER_NAME_FIELD); |
|
79 |
dynclass.addDynFieldObject(FEATURE_STORE_FIELD); |
|
80 |
dynclass.addDynFieldObject(MAPCONTEXT_FIELD); |
|
81 |
|
|
82 |
return dynclass; |
|
83 |
} |
|
84 |
|
|
85 |
} |
org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.offset/org.gvsig.vectorediting.offset.lib/org.gvsig.vectorediting.offset.lib.prov/org.gvsig.vectorediting.offset.lib.prov.offset/src/main/resources/i18n/text.properties | ||
---|---|---|
1 |
modify_offset = Geometr\u00eda sim\u00e9trica Offset |
|
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 |
org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.offset/org.gvsig.vectorediting.offset.lib/org.gvsig.vectorediting.offset.lib.prov/org.gvsig.vectorediting.offset.lib.prov.offset/src/main/resources/i18n/text_en.properties | ||
---|---|---|
1 |
modify_offset = Symmetrical geometry offset |
|
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 |
org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.offset/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/trunk/org.gvsig.vectorediting.offset/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.0-SNAPSHOT</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 |
</dependencies> |
|
25 |
</project> |
org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.offset/org.gvsig.vectorediting.offset.lib/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.0-SNAPSHOT</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.vectorediting.offset.lib</artifactId> |
|
9 |
<packaging>pom</packaging> |
|
10 |
<name>org.gvsig.vectorediting.offset.lib</name> |
|
11 |
<modules> |
|
12 |
<module>org.gvsig.vectorediting.offset.lib.prov</module> |
|
13 |
</modules> |
|
14 |
</project> |
Also available in: Unified diff