Revision 2561
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.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.topology</artifactId> |
|
6 |
<version>1.0.43</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.topology.app</artifactId> |
|
9 |
<packaging>pom</packaging> |
|
10 |
<name>${project.artifactId}</name> |
|
11 |
<modules> |
|
12 |
<module>org.gvsig.topology.app.mainplugin</module> |
|
13 |
</modules> |
|
14 |
</project> |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Tue Oct 06 18:19:46 CEST 2020 |
|
2 |
buildNumber=49 |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
1 |
#Translations for language [es] |
|
2 |
#Thu Nov 20 10:10:09 CET 2014 |
|
3 |
_Topology=Topologia |
|
4 |
_Create_or_edit_plan=Crear o modificar plan |
|
5 |
_Execute_plan=Ejecutar plan |
|
6 |
_Topology_plan_error_inspector=Inspector de errores del Plan de topologia |
|
7 |
_Topology_plan=Plan de topologia |
|
8 |
_Show=Mostrar |
|
9 |
_Show_errors=Mostrar errores |
|
10 |
_Show_exceptions=Mostrar excepciones |
|
11 |
_Show_only_in_visible_extent=Mostrar solo en el area visible |
|
12 |
_Show_form_when_modify_geometry=Mostrar formulario al modificar la geometria |
|
13 |
_Zoom=Zoom |
|
14 |
Center_geometry=Centrar geometria |
|
15 |
_Center_error=Centrar error |
|
16 |
_Actions=Acciones |
|
17 |
_Action=Acci\u00f3n |
|
18 |
_Update=Actualizar |
|
19 |
_Name=Nombre |
|
20 |
_Tolerance=Tolerancia |
|
21 |
_DataSets=Conjuntos de datos |
|
22 |
_Dataset1=Conjunto de datos1 |
|
23 |
_Dataset2=Conjunto de datos2 |
|
24 |
_Rules=Reglas |
|
25 |
_Remove_dataset=Eliminar conjunto de datos |
|
26 |
_Add_dataset=A\u00f1adir conjunto de datos |
|
27 |
_Remove_rule=Eliminar regla |
|
28 |
_Add_rule=A\u00f1adir regla |
|
29 |
_Edit_rule=Modificar regla |
|
30 |
_Contains_Point=Contiene punto |
|
31 |
_Primary_dataset=Conjunto de datos primario |
|
32 |
_Secondary_dataset=Conjunto de datos secundario |
|
33 |
_Rule=Regla |
|
34 |
_Add_new_rule=A\u00f1adir nueva regla |
|
35 |
_Exception=Excepcion |
|
36 |
_Errors=Errores |
|
37 |
_Parameters=Parametros |
|
38 |
_Accept=Aceptar |
|
39 |
_Execute=Ejecutar |
|
40 |
_Any_rule=Cualquier regla |
|
41 |
_Erase_error_marks=Eliminar marcas de errores |
|
42 |
_Select_a_dataset=Seleccione un conjunto de datos |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
1 |
#Translations for language [en] |
|
2 |
#Thu Nov 20 10:10:15 CET 2014 |
|
3 |
_Topology=Topology |
|
4 |
_Create_or_edit_plan=Create or edit plan |
|
5 |
_Execute_plan=Execute plan |
|
6 |
_Topology_plan_error_inspector=Topology plan error inspector |
|
7 |
_Topology_plan=Topology plan |
|
8 |
_Show=Show |
|
9 |
_Show_errors=Show errors |
|
10 |
_Show_exceptions=Show exceptions |
|
11 |
_Show_only_in_visible_extent=Show only in visible extent |
|
12 |
_Show_form_when_modify_geometry=Show form when modify geometry |
|
13 |
_Zoom=Zoom |
|
14 |
_Center_geometry=Center geometry |
|
15 |
_Center_error=Center error |
|
16 |
_Actions=Actions |
|
17 |
_Action=Action |
|
18 |
_Update=Update |
|
19 |
_Name=Name |
|
20 |
_Tolerance=Tolerance |
|
21 |
_DataSets=Datasets |
|
22 |
_Dataset1=Dataset1 |
|
23 |
_Dataset2=Dataset2 |
|
24 |
_Rules=Rules |
|
25 |
_Remove_dataset=Remove dataset |
|
26 |
_Add_dataset=Add dataset |
|
27 |
_Remove_rule=Remove rule |
|
28 |
_Add_rule=Add rule |
|
29 |
_Edit_rule=Edit rule |
|
30 |
_Primary_dataset=Primary dataset |
|
31 |
_Secondary_dataset=Secondary dataset |
|
32 |
_Rule=Rule |
|
33 |
_Add_new_rule=Add new rule |
|
34 |
_Exception=Exception |
|
35 |
_Errors=Errors |
|
36 |
_Parameters=Parameters |
|
37 |
_Accept=Accept |
|
38 |
_Execute=Execute |
|
39 |
_Any_rule=Any rule |
|
40 |
_Erase_error_marks=Erase error marks |
|
41 |
_Select_a_dataset=Select a dataset |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.app/org.gvsig.topology.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-2014 gvSIG |
|
3 |
Association. This program is free software; you can redistribute it and/or modify |
|
4 |
it under the terms of the GNU General Public License as published by the Free Software |
|
5 |
Foundation; either version 3 of the License, or (at your option) any later version. |
|
6 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|
7 |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
8 |
PURPOSE. See the GNU General Public License for more details. You should have received |
|
9 |
a copy of the GNU General Public License along with this program; if not, write to |
|
10 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
|
11 |
USA. For any additional information, do not hesitate to contact us at info AT gvsig.com, |
|
12 |
or visit our website www.gvsig.com. --> |
|
13 |
<plugin-config> |
|
14 |
<depends plugin-name="org.gvsig.app.mainplugin" /> |
|
15 |
<depends plugin-name="org.gvsig.app.document.table.app.mainplugin" /> |
|
16 |
<resourceBundle name="text" /> |
|
17 |
<libraries library-dir="lib" /> |
|
18 |
<extensions> |
|
19 |
|
|
20 |
|
|
21 |
<extension class-name="org.gvsig.topology.app.mainplugin.TopologyExtension" |
|
22 |
description="" active="true" priority="1"> |
|
23 |
<action |
|
24 |
name="tools-topology-create-or-modify" |
|
25 |
label="_Show_create_or_edit_topology_plan" |
|
26 |
position="908300100" |
|
27 |
tooltip="_Show_create_or_edit_topology_plan" |
|
28 |
action-command="tools-topology-create-or-modify" |
|
29 |
icon="tools-topology-create-or-modify" |
|
30 |
accelerator="" |
|
31 |
/> |
|
32 |
<action |
|
33 |
name="tools-topology-execute" |
|
34 |
label="_Execute_topology_plan" |
|
35 |
position="908300200" |
|
36 |
tooltip="_Execute_topology_plan" |
|
37 |
action-command="tools-topology-execute" |
|
38 |
icon="tools-topology-execute" |
|
39 |
accelerator="" |
|
40 |
/> |
|
41 |
|
|
42 |
<menu text="tools/_Topology" |
|
43 |
position="908300000" |
|
44 |
is_separator="true"/> |
|
45 |
<menu text="tools/_Topology/_Create_or_edit_plan" |
|
46 |
name="tools-topology-create-or-modify"/> |
|
47 |
<menu text="tools/_Topology/_Execute_plan" |
|
48 |
name="tools-topology-execute"/> |
|
49 |
|
|
50 |
<!-- |
|
51 |
<tool-bar name="topology" position="2000"> |
|
52 |
<action-tool name="tools-topology-create-or-modify"/> |
|
53 |
<action-tool name="tools-topology-execute"/> |
|
54 |
</tool-bar> |
|
55 |
--> |
|
56 |
</extension> |
|
57 |
|
|
58 |
|
|
59 |
</extensions> |
|
60 |
</plugin-config> |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.app/org.gvsig.topology.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.topology.lib.api</include> |
|
58 |
<include>org.gvsig:org.gvsig.topology.lib.impl</include> |
|
59 |
<include>org.gvsig:org.gvsig.topology.swing.api</include> |
|
60 |
<include>org.gvsig:org.gvsig.topology.swing.impl</include> |
|
61 |
</includes> |
|
62 |
</dependencySet> |
|
63 |
</dependencySets> |
|
64 |
|
|
65 |
</assembly> |
|
66 |
|
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/java/org/gvsig/topology/app/mainplugin/AppTopologyServices.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.topology.app.mainplugin; |
|
25 |
|
|
26 |
import java.io.File; |
|
27 |
import java.util.ArrayList; |
|
28 |
import java.util.HashMap; |
|
29 |
import java.util.List; |
|
30 |
import java.util.Map; |
|
31 |
import javax.swing.DefaultListModel; |
|
32 |
import javax.swing.ImageIcon; |
|
33 |
import javax.swing.ListModel; |
|
34 |
import javax.swing.tree.TreeModel; |
|
35 |
import org.apache.commons.lang3.mutable.Mutable; |
|
36 |
import org.apache.commons.lang3.mutable.MutableObject; |
|
37 |
import org.gvsig.andami.IconThemeHelper; |
|
38 |
import org.gvsig.andami.PluginsLocator; |
|
39 |
import org.gvsig.app.ApplicationLocator; |
|
40 |
import org.gvsig.app.ApplicationManager; |
|
41 |
import org.gvsig.app.project.Project; |
|
42 |
import org.gvsig.app.project.documents.Document; |
|
43 |
import org.gvsig.app.project.documents.table.TableDocument; |
|
44 |
import org.gvsig.app.project.documents.table.TableManager; |
|
45 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
46 |
import org.gvsig.app.project.documents.view.ViewManager; |
|
47 |
import org.gvsig.fmap.dal.EditingNotification; |
|
48 |
import org.gvsig.fmap.dal.EditingNotificationManager; |
|
49 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
50 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
51 |
import org.gvsig.fmap.geom.Geometry; |
|
52 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
|
53 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
54 |
import org.gvsig.fmap.geom.aggregate.MultiSurface; |
|
55 |
import org.gvsig.fmap.geom.primitive.Curve; |
|
56 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
57 |
import org.gvsig.fmap.geom.primitive.Point; |
|
58 |
import org.gvsig.fmap.geom.primitive.Surface; |
|
59 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
60 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
61 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
62 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
|
63 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
|
64 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
|
65 |
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener; |
|
66 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
67 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
68 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
69 |
import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
|
70 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
71 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol_v2; |
|
72 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
|
73 |
import org.gvsig.fmap.mapcontrol.swing.dynobject.DynObjectEditor; |
|
74 |
import org.gvsig.tools.dynobject.DynObject; |
|
75 |
import org.gvsig.tools.exception.BaseException; |
|
76 |
import org.gvsig.tools.observer.Observable; |
|
77 |
import org.gvsig.tools.observer.Observer; |
|
78 |
import org.gvsig.tools.swing.api.ListElement; |
|
79 |
import org.gvsig.tools.visitor.VisitCanceledException; |
|
80 |
import org.gvsig.tools.visitor.Visitor; |
|
81 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
|
82 |
import org.gvsig.topology.lib.api.TopologyLocator; |
|
83 |
import org.gvsig.topology.lib.api.TopologyManager; |
|
84 |
import org.gvsig.topology.swing.api.TopologySwingServices; |
|
85 |
import org.slf4j.Logger; |
|
86 |
import org.slf4j.LoggerFactory; |
|
87 |
|
|
88 |
/** |
|
89 |
* |
|
90 |
* @author jjdelcerro |
|
91 |
*/ |
|
92 |
@SuppressWarnings("UseSpecificCatch") |
|
93 |
public class AppTopologyServices implements TopologySwingServices { |
|
94 |
|
|
95 |
private static final Logger LOGGER = LoggerFactory.getLogger(AppTopologyServices.class); |
|
96 |
|
|
97 |
private class WorkingAreaViewPortListener implements ViewPortListener { |
|
98 |
|
|
99 |
private WorkingAreaChangedListener workingAreaChangedListener; |
|
100 |
private ViewPort viewPort; |
|
101 |
|
|
102 |
public WorkingAreaViewPortListener(ViewPort viewPort, WorkingAreaChangedListener workingAreaChangedListener) { |
|
103 |
this.workingAreaChangedListener = workingAreaChangedListener; |
|
104 |
this.viewPort = viewPort; |
|
105 |
} |
|
106 |
|
|
107 |
public ViewPort getViewPort() { |
|
108 |
return this.viewPort; |
|
109 |
} |
|
110 |
|
|
111 |
@Override |
|
112 |
public void extentChanged(ExtentEvent e) { |
|
113 |
this.workingAreaChangedListener.workingAreaChanged(e.getNewExtent()); |
|
114 |
} |
|
115 |
|
|
116 |
@Override |
|
117 |
public void backColorChanged(ColorEvent e) { |
|
118 |
} |
|
119 |
|
|
120 |
@Override |
|
121 |
public void projectionChanged(ProjectionEvent e) { |
|
122 |
} |
|
123 |
} |
|
124 |
|
|
125 |
private class EditingNotificationObserver implements Observer { |
|
126 |
|
|
127 |
public EditingNotificationObserver() { |
|
128 |
|
|
129 |
} |
|
130 |
|
|
131 |
@Override |
|
132 |
public void update(Observable o, Object notification) { |
|
133 |
EditingNotification n = (EditingNotification) notification; |
|
134 |
if (n.isCancelable() && n.getFeature() != null) { |
|
135 |
try { |
|
136 |
DynObject data = n.getFeature().getAsDynObject(); |
|
137 |
DynObjectEditor editor = new DynObjectEditor(data); |
|
138 |
editor.setTitle("Topology - " + n.getFeature().getType().getName()); |
|
139 |
editor.editObject(true); |
|
140 |
if (editor.isCanceled()) { |
|
141 |
n.cancel(); |
|
142 |
} else { |
|
143 |
editor.getData(data); |
|
144 |
} |
|
145 |
} catch (Exception ex) { |
|
146 |
LOGGER.warn("Problems showing the feature in a form.", ex); |
|
147 |
} |
|
148 |
} |
|
149 |
} |
|
150 |
} |
|
151 |
|
|
152 |
private Map<WorkingAreaChangedListener, WorkingAreaViewPortListener> workingAreaListener; |
|
153 |
private ISymbol errorPolygonSymbol = null; |
|
154 |
private ISymbol errorPointSymbol = null; |
|
155 |
private ISymbol errorLineSymbol = null; |
|
156 |
private EditingNotificationObserver editingNotificationObserver = null; |
|
157 |
|
|
158 |
public AppTopologyServices() { |
|
159 |
this.workingAreaListener = new HashMap<>(); |
|
160 |
} |
|
161 |
|
|
162 |
@Override |
|
163 |
public TreeModel getDataSetTreeModel() { |
|
164 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
165 |
ViewDocument view = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
166 |
return new DataSetsTreeModel(this, view); |
|
167 |
} |
|
168 |
|
|
169 |
@Override |
|
170 |
public ListModel getTablesListModel() { |
|
171 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
172 |
Project project = application.getCurrentProject(); |
|
173 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
|
174 |
|
|
175 |
DefaultListModel<TopologyDataSet> model = new DefaultListModel<TopologyDataSet>(); |
|
176 |
|
|
177 |
List<Document> docs = project.getDocuments(TableManager.TYPENAME); |
|
178 |
for (Document doc : docs) { |
|
179 |
TableDocument table=(TableDocument) doc; |
|
180 |
TopologyDataSet dataset = manager.createDataSet(table.getName(), table.getFeatureStore()); |
|
181 |
model.addElement(dataset); |
|
182 |
} |
|
183 |
return model; |
|
184 |
} |
|
185 |
|
|
186 |
|
|
187 |
|
|
188 |
@Override |
|
189 |
public FeatureStore getFeatureStore(final TopologyDataSet dataSet) { |
|
190 |
final Mutable<FeatureStore> store = new MutableObject<>(); |
|
191 |
store.setValue(null); |
|
192 |
|
|
193 |
|
|
194 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
195 |
Project project = application.getCurrentProject(); |
|
196 |
|
|
197 |
List<Document> views = new ArrayList<>(); |
|
198 |
views.add(project.getActiveDocument(ViewManager.TYPENAME)); |
|
199 |
// views.addAll(project.getDocuments(ViewManager.TYPENAME)); |
|
200 |
|
|
201 |
for (Document view : views) { |
|
202 |
if (view == null) { |
|
203 |
continue; |
|
204 |
} |
|
205 |
FLayers layers = ((ViewDocument) view).getMapContext().getLayers(); |
|
206 |
try { |
|
207 |
layers.accept(new Visitor() { |
|
208 |
@Override |
|
209 |
public void visit(Object o) throws VisitCanceledException, BaseException { |
|
210 |
if (o instanceof FLyrVect) { |
|
211 |
FLyrVect layer = (FLyrVect) o; |
|
212 |
if (dataSet.isThisStore(layer.getFeatureStore())) { |
|
213 |
store.setValue(layer.getFeatureStore()); |
|
214 |
throw new VisitCanceledException(); |
|
215 |
} |
|
216 |
} |
|
217 |
} |
|
218 |
}); |
|
219 |
} catch (VisitCanceledException ex) { |
|
220 |
break; |
|
221 |
} catch (Exception ex) { |
|
222 |
throw new RuntimeException(ex); |
|
223 |
} |
|
224 |
} |
|
225 |
if (store.getValue()==null){ |
|
226 |
for (Document document : project.getDocuments(TableManager.TYPENAME)) { |
|
227 |
TableDocument table= (TableDocument) document; |
|
228 |
if (dataSet.isThisStore(table.getFeatureStore())) { |
|
229 |
store.setValue(table.getFeatureStore()); |
|
230 |
break; |
|
231 |
} |
|
232 |
} |
|
233 |
} |
|
234 |
return store.getValue(); |
|
235 |
} |
|
236 |
|
|
237 |
@Override |
|
238 |
public void zoomTo(Envelope envelope) { |
|
239 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
240 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
241 |
if (viewdoc == null) { |
|
242 |
return; |
|
243 |
} |
|
244 |
ViewPort viewPort = viewdoc.getMapContext().getViewPort(); |
|
245 |
viewPort.setEnvelope(envelope); |
|
246 |
} |
|
247 |
|
|
248 |
@Override |
|
249 |
public void refreshView() { |
|
250 |
try { |
|
251 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
252 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
253 |
if (viewdoc == null) { |
|
254 |
return; |
|
255 |
} |
|
256 |
viewdoc.getMapContext().invalidate(); |
|
257 |
} catch (Exception ex) { |
|
258 |
LOGGER.warn("Cant refresh view", ex); |
|
259 |
} |
|
260 |
} |
|
261 |
|
|
262 |
@Override |
|
263 |
public void centerTo(Point point) { |
|
264 |
try { |
|
265 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
266 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
267 |
if (viewdoc == null) { |
|
268 |
return; |
|
269 |
} |
|
270 |
ViewPort viewPort = viewdoc.getMapContext().getViewPort(); |
|
271 |
Envelope envelope = (Envelope) viewPort.getEnvelope().clone(); |
|
272 |
envelope.centerTo(point); |
|
273 |
viewPort.setEnvelope(envelope); |
|
274 |
} catch (Exception ex) { |
|
275 |
LOGGER.warn("Cant center view", ex); |
|
276 |
} |
|
277 |
} |
|
278 |
|
|
279 |
@Override |
|
280 |
public Envelope getWorkingArea() { |
|
281 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
282 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
283 |
if (viewdoc == null) { |
|
284 |
return null; |
|
285 |
} |
|
286 |
ViewPort viewPort = viewdoc.getMapContext().getViewPort(); |
|
287 |
return viewPort.getEnvelope(); |
|
288 |
} |
|
289 |
|
|
290 |
@Override |
|
291 |
public void addWorkingAreaChangedListener(WorkingAreaChangedListener listener) { |
|
292 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
293 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
294 |
if (viewdoc == null) { |
|
295 |
return; |
|
296 |
} |
|
297 |
ViewPort viewPort = viewdoc.getMapContext().getViewPort(); |
|
298 |
WorkingAreaViewPortListener viewPortListener = this.workingAreaListener.get(listener); |
|
299 |
if (viewPortListener == null) { |
|
300 |
viewPortListener = new WorkingAreaViewPortListener(viewPort, listener); |
|
301 |
this.workingAreaListener.put(listener, viewPortListener); |
|
302 |
} else { |
|
303 |
if (viewPort != viewPortListener.getViewPort()) { |
|
304 |
viewPortListener.getViewPort().removeViewPortListener(viewPortListener); |
|
305 |
viewPortListener = new WorkingAreaViewPortListener(viewPort, listener); |
|
306 |
this.workingAreaListener.put(listener, viewPortListener); |
|
307 |
} |
|
308 |
} |
|
309 |
viewPortListener.getViewPort().addViewPortListener(viewPortListener); |
|
310 |
} |
|
311 |
|
|
312 |
@Override |
|
313 |
public void removeWorkingAreaChangedListener(WorkingAreaChangedListener listener) { |
|
314 |
WorkingAreaViewPortListener viewPortListener = this.workingAreaListener.get(listener); |
|
315 |
if (viewPortListener == null) { |
|
316 |
return; |
|
317 |
} |
|
318 |
viewPortListener.getViewPort().removeViewPortListener(viewPortListener); |
|
319 |
} |
|
320 |
|
|
321 |
@Override |
|
322 |
public void addError(Geometry geom) { |
|
323 |
if (this.errorPointSymbol == null) { |
|
324 |
try { |
|
325 |
File pluginfolder = PluginsLocator.getManager().getPlugin(this).getPluginDirectory(); |
|
326 |
File folder = new File(pluginfolder, "symbols"); |
|
327 |
ISymbol[] symbols = MapContextLocator.getSymbolManager().loadSymbols(folder); |
|
328 |
for (ISymbol symbol : symbols) { |
|
329 |
if (symbol instanceof ISymbol_v2) { |
|
330 |
String symbolid = ((ISymbol_v2) symbol).getID(); |
|
331 |
switch(symbolid) { |
|
332 |
case "topology-error-polygon": |
|
333 |
this.errorPolygonSymbol = symbol; |
|
334 |
break; |
|
335 |
case "topology-error-line": |
|
336 |
this.errorLineSymbol = symbol; |
|
337 |
break; |
|
338 |
case "topology-error-point": |
|
339 |
this.errorPointSymbol = symbol; |
|
340 |
break; |
|
341 |
} |
|
342 |
} |
|
343 |
} |
|
344 |
} catch (Exception ex) { |
|
345 |
} |
|
346 |
} |
|
347 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
348 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
349 |
MapContext mapContext = viewdoc.getMapContext(); |
|
350 |
GraphicLayer gl = mapContext.getGraphicsLayer(); |
|
351 |
gl.removeGraphics("topology-errors"); |
|
352 |
if ( geom!=null ) { |
|
353 |
ISymbol symbol = null; |
|
354 |
if( geom instanceof Point || geom instanceof MultiPoint) { |
|
355 |
symbol = this.errorPointSymbol; |
|
356 |
} else if( geom instanceof Curve || geom instanceof MultiCurve ) { |
|
357 |
symbol = this.errorLineSymbol; |
|
358 |
} else if( geom instanceof Surface || geom instanceof MultiSurface ) { |
|
359 |
symbol = this.errorPolygonSymbol; |
|
360 |
} |
|
361 |
if (symbol != null) { |
|
362 |
int symbolid = gl.getSymbolId(symbol); |
|
363 |
if (symbolid < 0) { |
|
364 |
gl.addSymbol(symbol); |
|
365 |
symbolid = gl.getSymbolId(symbol); |
|
366 |
} |
|
367 |
gl.addGraphic("topology-errors", geom, symbolid); |
|
368 |
} |
|
369 |
} |
|
370 |
mapContext.invalidate(); |
|
371 |
} |
|
372 |
|
|
373 |
@Override |
|
374 |
public void setShowFormWhenEdit(boolean showFormWhenEdit) { |
|
375 |
if (this.editingNotificationObserver == null) { |
|
376 |
this.editingNotificationObserver = new EditingNotificationObserver(); |
|
377 |
} |
|
378 |
EditingNotificationManager editingNotificationManager = DALSwingLocator.getEditingNotificationManager(); |
|
379 |
if (showFormWhenEdit) { |
|
380 |
editingNotificationManager.addObserver(this.editingNotificationObserver); |
|
381 |
} else { |
|
382 |
editingNotificationManager.deleteObserver(this.editingNotificationObserver); |
|
383 |
} |
|
384 |
} |
|
385 |
|
|
386 |
@Override |
|
387 |
public ImageIcon getTreeIcon(TreeModel model, Object item) { |
|
388 |
return ((DataSetsTreeModel)model).getTreeIcon(item); |
|
389 |
} |
|
390 |
|
|
391 |
} |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/java/org/gvsig/topology/app/mainplugin/DataSetsTreeModel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.topology.app.mainplugin; |
|
25 |
|
|
26 |
import javax.swing.ImageIcon; |
|
27 |
import javax.swing.event.TreeModelListener; |
|
28 |
import javax.swing.tree.TreeModel; |
|
29 |
import javax.swing.tree.TreePath; |
|
30 |
import org.gvsig.andami.IconThemeHelper; |
|
31 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
32 |
import org.gvsig.fmap.dal.DataStore; |
|
33 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
34 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
35 |
import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer; |
|
36 |
import org.gvsig.fmap.mapcontrol.CompoundLayersTreeModel; |
|
37 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
|
38 |
import org.gvsig.tools.swing.api.ListElement; |
|
39 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
|
40 |
import org.gvsig.topology.lib.api.TopologyLocator; |
|
41 |
import org.gvsig.topology.swing.api.TopologySwingServices; |
|
42 |
|
|
43 |
/** |
|
44 |
* |
|
45 |
* @author jjdelcerro |
|
46 |
*/ |
|
47 |
public class DataSetsTreeModel implements TreeModel { |
|
48 |
|
|
49 |
private final ViewDocument view; |
|
50 |
private final CompoundLayersTreeModel deletaged; |
|
51 |
private final TopologySwingServices services; |
|
52 |
private final ListElement<Object> root; |
|
53 |
|
|
54 |
public DataSetsTreeModel(TopologySwingServices services, ViewDocument view) { |
|
55 |
this.services = services; |
|
56 |
this.view = view; |
|
57 |
CompoundLayersTreeModel model = (CompoundLayersTreeModel) MapControlLocator.getMapControlManager().createCompoundLayersTreeModel(); |
|
58 |
model.addLayers(view.getMapContext().getLayers()); |
|
59 |
this.deletaged = model; |
|
60 |
this.root = new ListElement<>("Project", this.deletaged.getRoot()); |
|
61 |
|
|
62 |
} |
|
63 |
|
|
64 |
private Object getNode(Object value) { |
|
65 |
if( value instanceof ListElement ) { |
|
66 |
return ((ListElement) value).getValue(); |
|
67 |
} |
|
68 |
return value; |
|
69 |
} |
|
70 |
|
|
71 |
@Override |
|
72 |
public Object getRoot() { |
|
73 |
return this.root; |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
public Object getChild(Object parent, int index) { |
|
78 |
parent = this.getNode(parent); |
|
79 |
Object x = this.deletaged.getChild(parent, index); |
|
80 |
if( x instanceof SingleLayer ) { |
|
81 |
SingleLayer layer = (SingleLayer)x; |
|
82 |
DataStore store = layer.getDataStore(); |
|
83 |
x = TopologyLocator.getTopologyManager().createDataSet( |
|
84 |
layer.getName(), |
|
85 |
store |
|
86 |
); |
|
87 |
} |
|
88 |
return x; |
|
89 |
} |
|
90 |
|
|
91 |
@Override |
|
92 |
public int getChildCount(Object parent) { |
|
93 |
parent = this.getNode(parent); |
|
94 |
return this.deletaged.getChildCount(parent); |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
public boolean isLeaf(Object node) { |
|
99 |
node = this.getNode(node); |
|
100 |
return this.deletaged.isLeaf(node); |
|
101 |
} |
|
102 |
|
|
103 |
@Override |
|
104 |
public void valueForPathChanged(TreePath path, Object newValue) { |
|
105 |
this.deletaged.valueForPathChanged(path, newValue); |
|
106 |
} |
|
107 |
|
|
108 |
@Override |
|
109 |
public int getIndexOfChild(Object parent, Object child) { |
|
110 |
parent = this.getNode(parent); |
|
111 |
return this.deletaged.getIndexOfChild(parent, child); |
|
112 |
} |
|
113 |
|
|
114 |
@Override |
|
115 |
public void addTreeModelListener(TreeModelListener l) { |
|
116 |
this.deletaged.addTreeModelListener(l); |
|
117 |
} |
|
118 |
|
|
119 |
@Override |
|
120 |
public void removeTreeModelListener(TreeModelListener l) { |
|
121 |
this.deletaged.removeTreeModelListener(l); |
|
122 |
} |
|
123 |
|
|
124 |
public ImageIcon getTreeIcon(Object item) { |
|
125 |
if( this.getRoot()==item ) { |
|
126 |
return IconThemeHelper.getImageIcon("topology-tree-project"); |
|
127 |
} |
|
128 |
if (item instanceof ListElement) { |
|
129 |
item = ((ListElement) item).getValue(); |
|
130 |
} |
|
131 |
if( this.view.getMapContext().getLayers()==item ) { |
|
132 |
return IconThemeHelper.getImageIcon("document-view-tree-icon"); |
|
133 |
} |
|
134 |
if (item instanceof TopologyDataSet) { |
|
135 |
DataStore store = ((TopologyDataSet)item).getStore(); |
|
136 |
String iconName = MapContextLocator.getMapContextManager().getIconLayer(store); |
|
137 |
return IconThemeHelper.getImageIcon(iconName); |
|
138 |
} |
|
139 |
if (item instanceof FLayer) { |
|
140 |
String iconName = ((FLayer) item).getTocImageIcon(); |
|
141 |
return IconThemeHelper.getImageIcon(iconName); |
|
142 |
} |
|
143 |
return IconThemeHelper.getImageIcon("topology-tree-folder"); |
|
144 |
} |
|
145 |
|
|
146 |
} |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/java/org/gvsig/topology/app/mainplugin/TopologyExtension.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.topology.app.mainplugin; |
|
25 |
|
|
26 |
import java.awt.event.ActionEvent; |
|
27 |
import java.awt.event.ActionListener; |
|
28 |
import org.apache.commons.lang.StringUtils; |
|
29 |
import org.gvsig.andami.IconThemeHelper; |
|
30 |
import org.gvsig.andami.plugins.Extension; |
|
31 |
import org.gvsig.app.ApplicationLocator; |
|
32 |
import org.gvsig.app.ApplicationManager; |
|
33 |
import org.gvsig.app.project.documents.Document; |
|
34 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
35 |
import org.gvsig.app.project.documents.view.ViewManager; |
|
36 |
import org.gvsig.tools.ToolsLocator; |
|
37 |
import org.gvsig.tools.i18n.I18nManager; |
|
38 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
39 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
40 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
41 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
42 |
import org.gvsig.topology.lib.api.TopologyLocator; |
|
43 |
import org.gvsig.topology.lib.api.TopologyManager; |
|
44 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
45 |
import org.gvsig.topology.swing.api.JTopologyPlanProperties; |
|
46 |
import org.gvsig.topology.swing.api.JTopologyReport; |
|
47 |
import org.gvsig.topology.swing.api.TopologySwingLocator; |
|
48 |
import org.gvsig.topology.swing.api.TopologySwingManager; |
|
49 |
|
|
50 |
/** |
|
51 |
* |
|
52 |
* @author jjdelcerro |
|
53 |
*/ |
|
54 |
public class TopologyExtension extends Extension { |
|
55 |
|
|
56 |
@Override |
|
57 |
public void initialize() { |
|
58 |
|
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public void postInitialize() { |
|
63 |
AppTopologyServices services = new AppTopologyServices(); |
|
64 |
|
|
65 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
|
66 |
manager.setDefaultServices(services); |
|
67 |
|
|
68 |
TopologySwingManager swingManager = TopologySwingLocator.getTopologySwingManager(); |
|
69 |
swingManager.setDefaultServices(services); |
|
70 |
|
|
71 |
IconThemeHelper.registerIcon("document", "document-view-tree-icon", this); |
|
72 |
IconThemeHelper.registerIcon("topology", "topology-tree-folder", this); |
|
73 |
IconThemeHelper.registerIcon("topology", "topology-tree-project", this); |
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
@Override |
|
78 |
public void execute(String action) { |
|
79 |
if( StringUtils.equalsIgnoreCase("tools-topology-create-or-modify", action) ) { |
|
80 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
81 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
82 |
final ViewDocument view = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
83 |
if( view==null ) { |
|
84 |
// TODO: Mensaje de se necesita una vista |
|
85 |
return; |
|
86 |
} |
|
87 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
|
88 |
TopologySwingManager swingManager = TopologySwingLocator.getTopologySwingManager(); |
|
89 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
90 |
|
|
91 |
final JTopologyPlanProperties panel = swingManager.createJTopologyPlan(); |
|
92 |
|
|
93 |
TopologyPlan plan = manager.createTopologyPlan(); |
|
94 |
String jsonPlan = (String) view.getProperty("TopologyPlan"); |
|
95 |
if( !StringUtils.isEmpty(jsonPlan) ) { |
|
96 |
plan.fromJSON(jsonPlan); |
|
97 |
} |
|
98 |
panel.put(plan); |
|
99 |
|
|
100 |
final Dialog dlg = winManager.createDialog( |
|
101 |
panel.asJComponent(), |
|
102 |
i18n.getTranslation("_Topology_plan"), |
|
103 |
null, |
|
104 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
105 |
); |
|
106 |
dlg.addActionListener(new ActionListener() { |
|
107 |
@Override |
|
108 |
public void actionPerformed(ActionEvent e) { |
|
109 |
if( dlg.getAction()==WindowManager_v2.BUTTON_OK ) { |
|
110 |
TopologyPlan plan = panel.fetch(null); |
|
111 |
view.setProperty("TopologyPlan", plan.toJSON().toString()); |
|
112 |
} |
|
113 |
} |
|
114 |
}); |
|
115 |
dlg.show(WindowManager.MODE.WINDOW); |
|
116 |
|
|
117 |
} else if( StringUtils.equalsIgnoreCase("tools-topology-execute", action) ) { |
|
118 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
119 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
120 |
final ViewDocument view = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
121 |
if( view==null ) { |
|
122 |
// TODO: Mensaje de se necesita una vista |
|
123 |
return; |
|
124 |
} |
|
125 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
|
126 |
final TopologySwingManager swingManager = TopologySwingLocator.getTopologySwingManager(); |
|
127 |
final WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
128 |
|
|
129 |
|
|
130 |
String jsonPlan = (String) view.getProperty("TopologyPlan"); |
|
131 |
if( StringUtils.isEmpty(jsonPlan) ) { |
|
132 |
// TODO: Mensaje de crear plan |
|
133 |
return; |
|
134 |
} |
|
135 |
|
|
136 |
final TopologyPlan plan = manager.createTopologyPlan(); |
|
137 |
plan.fromJSON(jsonPlan); |
|
138 |
JTopologyReport panel = swingManager.createJTopologyReport(plan); |
|
139 |
panel.put(plan); |
|
140 |
winManager.showWindow( |
|
141 |
panel.asJComponent(), |
|
142 |
i18n.getTranslation("_Topology_plan_error_inspector") + " ("+plan.getName()+")", |
|
143 |
WindowManager.MODE.TOOL |
|
144 |
); |
|
145 |
|
|
146 |
Thread th = new Thread(new Runnable() { |
|
147 |
@Override |
|
148 |
public void run() { |
|
149 |
plan.execute(); |
|
150 |
} |
|
151 |
}, "TopologyPlan-"+ plan.getName()); |
|
152 |
th.start(); |
|
153 |
} |
|
154 |
} |
|
155 |
|
|
156 |
@Override |
|
157 |
public boolean isEnabled() { |
|
158 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
159 |
Document view = application.getActiveDocument(ViewManager.TYPENAME); |
|
160 |
return view!=null; |
|
161 |
} |
|
162 |
|
|
163 |
@Override |
|
164 |
public boolean isVisible() { |
|
165 |
return true; |
|
166 |
} |
|
167 |
|
|
168 |
} |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.app/org.gvsig.topology.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.topology.app</artifactId> |
|
6 |
<version>1.0.43</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.topology.app.mainplugin</artifactId> |
|
9 |
<name>${project.artifactId}</name> |
|
10 |
<dependencies> |
|
11 |
<dependency> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
14 |
<scope>compile</scope> |
|
15 |
</dependency> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.topology.lib.api</artifactId> |
|
19 |
<scope>compile</scope> |
|
20 |
</dependency> |
|
21 |
<dependency> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<artifactId>org.gvsig.topology.lib.impl</artifactId> |
|
24 |
<scope>runtime</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.topology.swing.api</artifactId> |
|
29 |
<scope>compile</scope> |
|
30 |
</dependency> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.topology.swing.impl</artifactId> |
|
34 |
<scope>runtime</scope> |
|
35 |
</dependency> |
|
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId> |
|
39 |
<scope>compile</scope> |
|
40 |
</dependency> |
|
41 |
</dependencies> |
|
42 |
|
|
43 |
<properties> |
|
44 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
45 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
46 |
<gvsig.package.info.dependencies>required: org.gvsig.app -ge 2.2.0</gvsig.package.info.dependencies> |
|
47 |
<gvsig.package.info.categories /> |
|
48 |
<gvsig.package.info.name>Topology framework</gvsig.package.info.name> |
|
49 |
<gvsig.package.info.description>Topology framework and basic rules</gvsig.package.info.description> |
|
50 |
<gvsig.package.info.owner>gvSIG Association</gvsig.package.info.owner> |
|
51 |
<gvsig.package.info.javaVM>j1_8</gvsig.package.info.javaVM> |
|
52 |
<gvsig.package.info.sourcesURL>${project.scm.url}</gvsig.package.info.sourcesURL> |
|
53 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-topology/pool</gvsig.package.info.poolURL> |
|
54 |
</properties> |
|
55 |
|
|
56 |
</project> |
|
0 | 57 |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.topology.lib.impl.TopologyImplLibrary |
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/resources/org/gvsig/topology/rules/es/ContainsPoint.json | ||
---|---|---|
1 |
{ |
|
2 |
"id": "ContainsPoint", |
|
3 |
"name": "Contiene un punto", |
|
4 |
"description": [ |
|
5 |
"<img src=\"@@@.d/contains_point2.png\">\n", |
|
6 |
"El poligono superior es un error porque no contiene ningun punto.\n\n", |
|
7 |
"Requiere que cada poligono del conjunto de datos contenga al menos un punto del otro conjunto de datos.\n", |
|
8 |
"Los puntos deben estar contenidos en el poligono, no en su perimetro,\n" |
|
9 |
], |
|
10 |
"actions" : { |
|
11 |
"CreateFeature": { |
|
12 |
"name" : "Crear feature", |
|
13 |
"description": [ |
|
14 |
"<i>Crear feature</i> realiza la correccion creando un nuevo punto en", |
|
15 |
"la feature, en el centroide del poligono que ha causado el error.\n", |
|
16 |
"El punto creado en la feature se garantiza que estara dentro del polygono de la feature." |
|
17 |
] |
|
18 |
} |
|
19 |
} |
|
20 |
} |
|
21 |
|
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/resources/org/gvsig/topology/rules/es/MustBeLargerThanToleranceLine.json | ||
---|---|---|
1 |
{ |
|
2 |
"id": "MustBeLargerThanToleranceLine", |
|
3 |
"name": "Debe ser mayor que la tolerancia", |
|
4 |
"description": [ |
|
5 |
"<img src=\"@@@.d/MustBeLargerThanToleranceLine.png\">\n", |
|
6 |
"Requiere que una feature no colapse durante el proceso de validacion.\n", |
|
7 |
"Esta regla es obligatoria para una topologia y aplica a todas las features de typo linea.\n", |
|
8 |
"En instancias donde esta regla es violada, la geometria original permanece sin cambios.\n" |
|
9 |
], |
|
10 |
"actions" : { |
|
11 |
"delete": { |
|
12 |
"name" : "Eliminar", |
|
13 |
"description": [ |
|
14 |
"Elimina las Removes features que colapsaran durante el proceso", |
|
15 |
"de validacion basado en la tolerancia topologica." |
|
16 |
] |
|
17 |
} |
|
18 |
} |
|
19 |
} |
|
20 |
|
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/resources/org/gvsig/topology/rules/en/ContainsPoint.json | ||
---|---|---|
1 |
{ |
|
2 |
"id": "ContainsPoint", |
|
3 |
"name": "Contains Point", |
|
4 |
"description": [ |
|
5 |
"<img src=\"@@@.d/contains_point2.png\">\n", |
|
6 |
"The top polygon is an error because it does not contain a point.\n\n", |
|
7 |
"Requires that a polygon in the primary dataset contain at least one", |
|
8 |
"point from the secondary dataset.\n", |
|
9 |
"Points must be within the polygon, not on the boundary.\n", |
|
10 |
"This is useful when every polygon should have at least one associated", |
|
11 |
"point, such as when parcels must have an address point." |
|
12 |
], |
|
13 |
"actions" : { |
|
14 |
"CreateFeature": { |
|
15 |
"name" : "Create feature", |
|
16 |
"description": [ |
|
17 |
"The Create Feature fix creates a new point feature at the centroid", |
|
18 |
"of the polygon feature that is causing the error.\n", |
|
19 |
"The point feature that is created is guaranteed to be within the polygon feature." |
|
20 |
] |
|
21 |
} |
|
22 |
} |
|
23 |
} |
|
24 |
|
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/resources/org/gvsig/topology/rules/en/MustNotOverlapPolygon.json | ||
---|---|---|
1 |
{ |
|
2 |
"id": "MustNotOverlapPolygon", |
|
3 |
"name": "Must Not Overlap", |
|
4 |
"description": [ |
|
5 |
"<img src=\"@@@.d/must_not_overlap.png\">\n", |
|
6 |
"Requires that the interior of polygons in the dataset not overlap.", |
|
7 |
"The polygons can share edges or vertices.", |
|
8 |
"This rule is used when an area cannot belong to two or more polygons.", |
|
9 |
"The polygons overlaps when the geometries have some points in common;", |
|
10 |
"but not all points in common (so if one geometry is inside the other", |
|
11 |
"overlaps would be false).", |
|
12 |
"The overlapping section must be the same kind of shape as the two geometries;", |
|
13 |
"so two polygons that touch on a point are not considered to be overlapping.", |
|
14 |
"It is useful for modeling administrative boundaries, such as ZIP Codes", |
|
15 |
"or voting districts, and mutually exclusive area classifications,", |
|
16 |
"such as land cover or landform type." |
|
17 |
], |
|
18 |
"actions" : { |
|
19 |
"CreateFeature": { |
|
20 |
"name" : "Create feature", |
|
21 |
"description": [ |
|
22 |
"The Create Feature fix creates a new polygon feature out of", |
|
23 |
"the error shape and removes the portion of overlap from each", |
|
24 |
"of the features, causing the error to create a planar", |
|
25 |
"representation of the feature geometry.\n", |
|
26 |
"This fix can be applied to one or more selected Must Not Overlap errors." |
|
27 |
] |
|
28 |
}, |
|
29 |
"Subtract": { |
|
30 |
"name" : "Subtract", |
|
31 |
"description": [ |
|
32 |
"The Subtract fix removes the overlapping portion of geometry", |
|
33 |
"from each feature that is causing the error and leaves a gap", |
|
34 |
"or void in its place. This fix can be applied to one or more", |
|
35 |
"selected Must Not Overlap errors." |
|
36 |
] |
|
37 |
}, |
|
38 |
"Merge": { |
|
39 |
"name" : "Merge", |
|
40 |
"description": [ |
|
41 |
"The Merge fix adds the portion of overlap from one feature", |
|
42 |
"and subtracts it from the others that are violating the rule.", |
|
43 |
"You need to pick the feature that receives the portion of", |
|
44 |
"overlap using the Merge dialog box.", |
|
45 |
"This fix can be applied to one Must Not Overlap error only." |
|
46 |
] |
|
47 |
} |
|
48 |
} |
|
49 |
} |
|
50 |
|
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/resources/org/gvsig/topology/rules/en/MustBeLargerThanToleranceLine.json | ||
---|---|---|
1 |
{ |
|
2 |
"id": "MustBeLargerThanToleranceLine", |
|
3 |
"name": "Must Be Larger Than Tolerance", |
|
4 |
"description": [ |
|
5 |
"<img src=\"@@@.d/MustBeLargerThanToleranceLine.png\">\n", |
|
6 |
"Requires that a feature does not collapse during a validate process.\n", |
|
7 |
"This rule is mandatory for a topology and applies to all line feature classes.\n", |
|
8 |
"In instances where this rule is violated, the original geometry is left unchanged.\n" |
|
9 |
], |
|
10 |
"actions" : { |
|
11 |
"delete": { |
|
12 |
"name" : "Delete", |
|
13 |
"description": [ |
|
14 |
"Removes line features that would collapse during the validate", |
|
15 |
"process based on the topology's tolerance." |
|
16 |
] |
|
17 |
} |
|
18 |
} |
|
19 |
} |
|
20 |
|
org.gvsig.topology/tags/org.gvsig.topology-1.0.43/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/DefaultTopologyReportLine.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.topology.lib.impl; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
|
27 |
import org.gvsig.fmap.geom.Geometry; |
|
28 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
|
29 |
import org.gvsig.topology.lib.api.TopologyReport; |
|
30 |
import org.gvsig.topology.lib.api.TopologyReportLine; |
|
31 |
import org.gvsig.topology.lib.api.TopologyRule; |
|
32 |
|
|
33 |
/** |
|
34 |
* |
|
35 |
* @author jjdelcerro |
|
36 |
*/ |
|
37 |
public class DefaultTopologyReportLine implements TopologyReportLine { |
|
38 |
|
|
39 |
private final TopologyReport report; |
|
40 |
private final TopologyRule rule; |
|
41 |
private final TopologyDataSet dataSet1; |
|
42 |
private final TopologyDataSet dataSet2; |
|
43 |
private final Geometry geometry; |
|
44 |
private final FeatureReference feature1; |
|
45 |
private final FeatureReference feature2; |
|
46 |
private final int primitive1; |
|
47 |
private final int primitive2; |
|
48 |
private boolean exception; |
|
49 |
private final String description; |
|
50 |
private final String data; |
|
51 |
private final Geometry errorGeometry; |
|
52 |
|
|
53 |
DefaultTopologyReportLine(DefaultTopologyReport report, |
|
54 |
TopologyRule rule, |
|
55 |
TopologyDataSet dataSet1, |
|
56 |
TopologyDataSet dataSet2, |
|
57 |
Geometry geometry, |
|
58 |
Geometry error, |
|
59 |
FeatureReference feature1, |
|
60 |
FeatureReference feature2, |
|
61 |
int primitive1, |
|
62 |
int primitive2, |
|
63 |
boolean exception, |
|
64 |
String description, |
|
65 |
String data |
|
66 |
) { |
|
67 |
this.report = report; |
|
68 |
this.rule = rule; |
|
69 |
this.dataSet1 = dataSet1; |
|
70 |
this.dataSet2 = dataSet2; |
|
71 |
this.geometry = geometry; |
|
72 |
this.feature1 = feature1; |
|
73 |
this.feature2 = feature2; |
|
74 |
this.primitive1 = primitive1; |
|
75 |
this.primitive2 = primitive2; |
|
76 |
this.exception = exception; |
|
77 |
this.description = description; |
Also available in: Unified diff