Revision 727
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/java/org/gvsig/topology/app/mainplugin/DataSetsTreeModel.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.topology.app.mainplugin; |
25 | 25 |
|
26 |
import javax.swing.ImageIcon; |
|
26 | 27 |
import javax.swing.event.TreeModelListener; |
27 | 28 |
import javax.swing.tree.TreeModel; |
28 | 29 |
import javax.swing.tree.TreePath; |
30 |
import org.gvsig.andami.IconThemeHelper; |
|
29 | 31 |
import org.gvsig.app.project.documents.view.ViewDocument; |
30 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
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; |
|
32 | 36 |
import org.gvsig.fmap.mapcontrol.CompoundLayersTreeModel; |
33 | 37 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
34 | 38 |
import org.gvsig.tools.swing.api.ListElement; |
39 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
|
35 | 40 |
import org.gvsig.topology.lib.api.TopologyLocator; |
36 | 41 |
import org.gvsig.topology.swing.api.TopologySwingServices; |
37 | 42 |
|
... | ... | |
72 | 77 |
public Object getChild(Object parent, int index) { |
73 | 78 |
parent = this.getNode(parent); |
74 | 79 |
Object x = this.deletaged.getChild(parent, index); |
75 |
if( x instanceof FLyrVect ) {
|
|
76 |
FLyrVect layer = (FLyrVect)x;
|
|
77 |
FeatureStore store = layer.getFeatureStore();
|
|
80 |
if( x instanceof SingleLayer ) {
|
|
81 |
SingleLayer layer = (SingleLayer)x;
|
|
82 |
DataStore store = layer.getDataStore();
|
|
78 | 83 |
x = TopologyLocator.getTopologyManager().createDataSet( |
79 | 84 |
layer.getName(), |
80 | 85 |
store |
... | ... | |
115 | 120 |
public void removeTreeModelListener(TreeModelListener l) { |
116 | 121 |
this.deletaged.removeTreeModelListener(l); |
117 | 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 |
} |
|
118 | 145 |
|
119 | 146 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/java/org/gvsig/topology/app/mainplugin/TopologyExtension.java | ||
---|---|---|
26 | 26 |
import java.awt.event.ActionEvent; |
27 | 27 |
import java.awt.event.ActionListener; |
28 | 28 |
import org.apache.commons.lang.StringUtils; |
29 |
import org.gvsig.andami.IconThemeHelper; |
|
29 | 30 |
import org.gvsig.andami.plugins.Extension; |
30 | 31 |
import org.gvsig.app.ApplicationLocator; |
31 | 32 |
import org.gvsig.app.ApplicationManager; |
... | ... | |
66 | 67 |
|
67 | 68 |
TopologySwingManager swingManager = TopologySwingLocator.getTopologySwingManager(); |
68 | 69 |
swingManager.setDefaultServices(services); |
69 |
|
|
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); |
|
70 | 74 |
} |
71 | 75 |
|
72 | 76 |
|
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/java/org/gvsig/topology/app/mainplugin/AppTopologyServices.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.topology.app.mainplugin; |
25 | 25 |
|
26 |
import java.io.File; |
|
26 | 27 |
import java.util.ArrayList; |
27 | 28 |
import java.util.HashMap; |
28 | 29 |
import java.util.List; |
29 | 30 |
import java.util.Map; |
31 |
import javax.swing.ImageIcon; |
|
30 | 32 |
import javax.swing.tree.TreeModel; |
31 | 33 |
import org.apache.commons.lang3.mutable.Mutable; |
32 | 34 |
import org.apache.commons.lang3.mutable.MutableObject; |
35 |
import org.gvsig.andami.IconThemeHelper; |
|
36 |
import org.gvsig.andami.PluginsLocator; |
|
33 | 37 |
import org.gvsig.app.ApplicationLocator; |
34 | 38 |
import org.gvsig.app.ApplicationManager; |
35 | 39 |
import org.gvsig.app.project.Project; |
36 | 40 |
import org.gvsig.app.project.documents.Document; |
37 | 41 |
import org.gvsig.app.project.documents.view.ViewDocument; |
38 | 42 |
import org.gvsig.app.project.documents.view.ViewManager; |
43 |
import org.gvsig.fmap.dal.EditingNotification; |
|
44 |
import org.gvsig.fmap.dal.EditingNotificationManager; |
|
39 | 45 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
46 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
47 |
import org.gvsig.fmap.geom.Geometry; |
|
48 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
|
49 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
50 |
import org.gvsig.fmap.geom.aggregate.MultiSurface; |
|
51 |
import org.gvsig.fmap.geom.primitive.Curve; |
|
40 | 52 |
import org.gvsig.fmap.geom.primitive.Envelope; |
41 | 53 |
import org.gvsig.fmap.geom.primitive.Point; |
54 |
import org.gvsig.fmap.geom.primitive.Surface; |
|
55 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
56 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
42 | 57 |
import org.gvsig.fmap.mapcontext.ViewPort; |
43 | 58 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
44 | 59 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
45 | 60 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
46 | 61 |
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener; |
62 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
47 | 63 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
48 | 64 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
65 |
import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
|
66 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
67 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol_v2; |
|
68 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
|
69 |
import org.gvsig.fmap.mapcontrol.swing.dynobject.DynObjectEditor; |
|
70 |
import org.gvsig.tools.dynobject.DynObject; |
|
49 | 71 |
import org.gvsig.tools.exception.BaseException; |
72 |
import org.gvsig.tools.observer.Observable; |
|
73 |
import org.gvsig.tools.observer.Observer; |
|
74 |
import org.gvsig.tools.swing.api.ListElement; |
|
50 | 75 |
import org.gvsig.tools.visitor.VisitCanceledException; |
51 | 76 |
import org.gvsig.tools.visitor.Visitor; |
52 | 77 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
... | ... | |
62 | 87 |
public class AppTopologyServices implements TopologySwingServices { |
63 | 88 |
|
64 | 89 |
private static final Logger LOGGER = LoggerFactory.getLogger(AppTopologyServices.class); |
65 |
|
|
90 |
|
|
66 | 91 |
private class WorkingAreaViewPortListener implements ViewPortListener { |
67 |
|
|
92 |
|
|
68 | 93 |
private WorkingAreaChangedListener workingAreaChangedListener; |
69 | 94 |
private ViewPort viewPort; |
70 |
|
|
95 |
|
|
71 | 96 |
public WorkingAreaViewPortListener(ViewPort viewPort, WorkingAreaChangedListener workingAreaChangedListener) { |
72 | 97 |
this.workingAreaChangedListener = workingAreaChangedListener; |
73 | 98 |
this.viewPort = viewPort; |
... | ... | |
76 | 101 |
public ViewPort getViewPort() { |
77 | 102 |
return this.viewPort; |
78 | 103 |
} |
79 |
|
|
104 |
|
|
80 | 105 |
@Override |
81 | 106 |
public void extentChanged(ExtentEvent e) { |
82 | 107 |
this.workingAreaChangedListener.workingAreaChanged(e.getNewExtent()); |
... | ... | |
91 | 116 |
} |
92 | 117 |
} |
93 | 118 |
|
119 |
private class EditingNotificationObserver implements Observer { |
|
120 |
|
|
121 |
public EditingNotificationObserver() { |
|
122 |
|
|
123 |
} |
|
124 |
|
|
125 |
@Override |
|
126 |
public void update(Observable o, Object notification) { |
|
127 |
EditingNotification n = (EditingNotification) notification; |
|
128 |
if (n.isCancelable() && n.getFeature() != null) { |
|
129 |
try { |
|
130 |
DynObject data = n.getFeature().getAsDynObject(); |
|
131 |
DynObjectEditor editor = new DynObjectEditor(data); |
|
132 |
editor.setTitle("Topology - " + n.getFeature().getType().getName()); |
|
133 |
editor.editObject(true); |
|
134 |
if (editor.isCanceled()) { |
|
135 |
n.cancel(); |
|
136 |
} else { |
|
137 |
editor.getData(data); |
|
138 |
} |
|
139 |
} catch (Exception ex) { |
|
140 |
LOGGER.warn("Problems showing the feature in a form.", ex); |
|
141 |
} |
|
142 |
} |
|
143 |
} |
|
144 |
} |
|
145 |
|
|
94 | 146 |
private Map<WorkingAreaChangedListener, WorkingAreaViewPortListener> workingAreaListener; |
95 |
|
|
147 |
private ISymbol errorPolygonSymbol = null; |
|
148 |
private ISymbol errorPointSymbol = null; |
|
149 |
private ISymbol errorLineSymbol = null; |
|
150 |
private EditingNotificationObserver editingNotificationObserver = null; |
|
151 |
|
|
96 | 152 |
public AppTopologyServices() { |
97 | 153 |
this.workingAreaListener = new HashMap<>(); |
98 | 154 |
} |
99 |
|
|
155 |
|
|
100 | 156 |
@Override |
101 | 157 |
public TreeModel getDataSetTreeModel() { |
102 | 158 |
ApplicationManager application = ApplicationLocator.getManager(); |
... | ... | |
108 | 164 |
public FeatureStore getFeatureStore(final TopologyDataSet dataSet) { |
109 | 165 |
final Mutable<FeatureStore> store = new MutableObject<>(); |
110 | 166 |
store.setValue(null); |
111 |
|
|
167 |
|
|
112 | 168 |
ApplicationManager application = ApplicationLocator.getManager(); |
113 | 169 |
Project project = application.getCurrentProject(); |
114 |
|
|
170 |
|
|
115 | 171 |
List<Document> views = new ArrayList<>(); |
116 | 172 |
views.add(project.getActiveDocument(ViewManager.TYPENAME)); |
117 | 173 |
// views.addAll(project.getDocuments(ViewManager.TYPENAME)); |
118 | 174 |
|
119 | 175 |
for (Document view : views) { |
120 |
if( view == null ) {
|
|
176 |
if (view == null) {
|
|
121 | 177 |
continue; |
122 | 178 |
} |
123 |
FLayers layers = ((ViewDocument)view).getMapContext().getLayers(); |
|
179 |
FLayers layers = ((ViewDocument) view).getMapContext().getLayers();
|
|
124 | 180 |
try { |
125 | 181 |
layers.accept(new Visitor() { |
126 | 182 |
@Override |
127 | 183 |
public void visit(Object o) throws VisitCanceledException, BaseException { |
128 |
if( o instanceof FLyrVect ) {
|
|
184 |
if (o instanceof FLyrVect) {
|
|
129 | 185 |
FLyrVect layer = (FLyrVect) o; |
130 |
if( dataSet.isThisStore(layer.getFeatureStore()) ) {
|
|
186 |
if (dataSet.isThisStore(layer.getFeatureStore())) {
|
|
131 | 187 |
store.setValue(layer.getFeatureStore()); |
132 | 188 |
throw new VisitCanceledException(); |
133 | 189 |
} |
... | ... | |
147 | 203 |
public void zoomTo(Envelope envelope) { |
148 | 204 |
ApplicationManager application = ApplicationLocator.getManager(); |
149 | 205 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
150 |
if( viewdoc == null ) {
|
|
206 |
if (viewdoc == null) {
|
|
151 | 207 |
return; |
152 | 208 |
} |
153 | 209 |
ViewPort viewPort = viewdoc.getMapContext().getViewPort(); |
... | ... | |
159 | 215 |
try { |
160 | 216 |
ApplicationManager application = ApplicationLocator.getManager(); |
161 | 217 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
162 |
if( viewdoc == null ) {
|
|
218 |
if (viewdoc == null) {
|
|
163 | 219 |
return; |
164 | 220 |
} |
165 | 221 |
viewdoc.getMapContext().invalidate(); |
... | ... | |
167 | 223 |
LOGGER.warn("Cant refresh view", ex); |
168 | 224 |
} |
169 | 225 |
} |
170 |
|
|
226 |
|
|
171 | 227 |
@Override |
172 | 228 |
public void centerTo(Point point) { |
173 | 229 |
try { |
174 | 230 |
ApplicationManager application = ApplicationLocator.getManager(); |
175 | 231 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
176 |
if( viewdoc == null ) {
|
|
232 |
if (viewdoc == null) {
|
|
177 | 233 |
return; |
178 | 234 |
} |
179 | 235 |
ViewPort viewPort = viewdoc.getMapContext().getViewPort(); |
... | ... | |
189 | 245 |
public Envelope getWorkingArea() { |
190 | 246 |
ApplicationManager application = ApplicationLocator.getManager(); |
191 | 247 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
192 |
if( viewdoc == null ) {
|
|
248 |
if (viewdoc == null) {
|
|
193 | 249 |
return null; |
194 | 250 |
} |
195 | 251 |
ViewPort viewPort = viewdoc.getMapContext().getViewPort(); |
... | ... | |
200 | 256 |
public void addWorkingAreaChangedListener(WorkingAreaChangedListener listener) { |
201 | 257 |
ApplicationManager application = ApplicationLocator.getManager(); |
202 | 258 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
203 |
if( viewdoc == null ) {
|
|
259 |
if (viewdoc == null) {
|
|
204 | 260 |
return; |
205 | 261 |
} |
206 | 262 |
ViewPort viewPort = viewdoc.getMapContext().getViewPort(); |
207 | 263 |
WorkingAreaViewPortListener viewPortListener = this.workingAreaListener.get(listener); |
208 |
if( viewPortListener==null ) {
|
|
264 |
if (viewPortListener == null) {
|
|
209 | 265 |
viewPortListener = new WorkingAreaViewPortListener(viewPort, listener); |
210 | 266 |
this.workingAreaListener.put(listener, viewPortListener); |
211 | 267 |
} else { |
212 |
if( viewPort != viewPortListener.getViewPort() ) {
|
|
268 |
if (viewPort != viewPortListener.getViewPort()) {
|
|
213 | 269 |
viewPortListener.getViewPort().removeViewPortListener(viewPortListener); |
214 | 270 |
viewPortListener = new WorkingAreaViewPortListener(viewPort, listener); |
215 | 271 |
this.workingAreaListener.put(listener, viewPortListener); |
... | ... | |
221 | 277 |
@Override |
222 | 278 |
public void removeWorkingAreaChangedListener(WorkingAreaChangedListener listener) { |
223 | 279 |
WorkingAreaViewPortListener viewPortListener = this.workingAreaListener.get(listener); |
224 |
if( viewPortListener==null ) {
|
|
280 |
if (viewPortListener == null) {
|
|
225 | 281 |
return; |
226 | 282 |
} |
227 |
viewPortListener.getViewPort().removeViewPortListener(viewPortListener);
|
|
283 |
viewPortListener.getViewPort().removeViewPortListener(viewPortListener); |
|
228 | 284 |
} |
229 |
|
|
230 |
|
|
285 |
|
|
286 |
@Override |
|
287 |
public void addError(Geometry geom) { |
|
288 |
if (this.errorPointSymbol == null) { |
|
289 |
try { |
|
290 |
File pluginfolder = PluginsLocator.getManager().getPlugin(this).getPluginDirectory(); |
|
291 |
File folder = new File(pluginfolder, "symbols"); |
|
292 |
ISymbol[] symbols = MapContextLocator.getSymbolManager().loadSymbols(folder); |
|
293 |
for (ISymbol symbol : symbols) { |
|
294 |
if (symbol instanceof ISymbol_v2) { |
|
295 |
String symbolid = ((ISymbol_v2) symbol).getID(); |
|
296 |
switch(symbolid) { |
|
297 |
case "topology-error-polygon": |
|
298 |
this.errorPolygonSymbol = symbol; |
|
299 |
break; |
|
300 |
case "topology-error-line": |
|
301 |
this.errorLineSymbol = symbol; |
|
302 |
break; |
|
303 |
case "topology-error-point": |
|
304 |
this.errorPointSymbol = symbol; |
|
305 |
break; |
|
306 |
} |
|
307 |
} |
|
308 |
} |
|
309 |
} catch (Exception ex) { |
|
310 |
} |
|
311 |
} |
|
312 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
313 |
ViewDocument viewdoc = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
314 |
MapContext mapContext = viewdoc.getMapContext(); |
|
315 |
GraphicLayer gl = mapContext.getGraphicsLayer(); |
|
316 |
gl.removeGraphics("topology-errors"); |
|
317 |
if ( geom!=null ) { |
|
318 |
ISymbol symbol = null; |
|
319 |
if( geom instanceof Point || geom instanceof MultiPoint) { |
|
320 |
symbol = this.errorPointSymbol; |
|
321 |
} else if( geom instanceof Curve || geom instanceof MultiCurve ) { |
|
322 |
symbol = this.errorLineSymbol; |
|
323 |
} else if( geom instanceof Surface || geom instanceof MultiSurface ) { |
|
324 |
symbol = this.errorPolygonSymbol; |
|
325 |
} |
|
326 |
if (symbol != null) { |
|
327 |
int symbolid = gl.getSymbolId(symbol); |
|
328 |
if (symbolid < 0) { |
|
329 |
gl.addSymbol(symbol); |
|
330 |
symbolid = gl.getSymbolId(symbol); |
|
331 |
} |
|
332 |
gl.addGraphic("topology-errors", geom, symbolid); |
|
333 |
} |
|
334 |
} |
|
335 |
mapContext.invalidate(); |
|
336 |
} |
|
337 |
|
|
338 |
@Override |
|
339 |
public void setShowFormWhenEdit(boolean showFormWhenEdit) { |
|
340 |
if (this.editingNotificationObserver == null) { |
|
341 |
this.editingNotificationObserver = new EditingNotificationObserver(); |
|
342 |
} |
|
343 |
EditingNotificationManager editingNotificationManager = DALSwingLocator.getEditingNotificationManager(); |
|
344 |
if (showFormWhenEdit) { |
|
345 |
editingNotificationManager.addObserver(this.editingNotificationObserver); |
|
346 |
} else { |
|
347 |
editingNotificationManager.deleteObserver(this.editingNotificationObserver); |
|
348 |
} |
|
349 |
} |
|
350 |
|
|
351 |
@Override |
|
352 |
public ImageIcon getTreeIcon(TreeModel model, Object item) { |
|
353 |
return ((DataSetsTreeModel)model).getTreeIcon(item); |
|
354 |
} |
|
355 |
|
|
231 | 356 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
9 | 9 |
_Show_errors=Mostrar errores |
10 | 10 |
_Show_exceptions=Mostrar excepciones |
11 | 11 |
_Show_only_in_visible_extent=Mostrar solo en el area visible |
12 |
_Show_form_when_modify_geometry=Mostrar formulario al modificar la geometria |
|
12 | 13 |
_Zoom=Zoom |
13 |
_Center=Centrar |
|
14 |
Center_geometry=Centrar geometria |
|
15 |
_Center_error=Centrar error |
|
14 | 16 |
_Actions=Acciones |
15 | 17 |
_Action=Acci\u00f3n |
16 | 18 |
_Update=Actualizar |
... | ... | |
24 | 26 |
_Add_dataset=A\u00f1adir conjunto de datos |
25 | 27 |
_Remove_rule=Eliminar regla |
26 | 28 |
_Add_rule=A\u00f1adir regla |
29 |
_Edit_rule=Modificar regla |
|
27 | 30 |
_Contains_Point=Contiene punto |
28 | 31 |
_Primary_dataset=Conjunto de datos primario |
29 | 32 |
_Secondary_dataset=Conjunto de datos secundario |
... | ... | |
35 | 38 |
_Accept=Aceptar |
36 | 39 |
_Execute=Ejecutar |
37 | 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/trunk/org.gvsig.topology/org.gvsig.topology.app/org.gvsig.topology.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
9 | 9 |
_Show_errors=Show errors |
10 | 10 |
_Show_exceptions=Show exceptions |
11 | 11 |
_Show_only_in_visible_extent=Show only in visible extent |
12 |
_Show_form_when_modify_geometry=Show form when modify geometry |
|
12 | 13 |
_Zoom=Zoom |
13 |
_Center=Center |
|
14 |
_Center_geometry=Center geometry |
|
15 |
_Center_error=Center error |
|
14 | 16 |
_Actions=Actions |
15 | 17 |
_Action=Action |
16 | 18 |
_Update=Update |
... | ... | |
24 | 26 |
_Add_dataset=Add dataset |
25 | 27 |
_Remove_rule=Remove rule |
26 | 28 |
_Add_rule=Add rule |
29 |
_Edit_rule=Edit rule |
|
27 | 30 |
_Primary_dataset=Primary dataset |
28 | 31 |
_Secondary_dataset=Secondary dataset |
29 | 32 |
_Rule=Rule |
... | ... | |
34 | 37 |
_Accept=Accept |
35 | 38 |
_Execute=Execute |
36 | 39 |
_Any_rule=Any rule |
40 |
_Erase_error_marks=Erase error marks |
|
41 |
_Select_a_dataset=Select a dataset |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.api/src/main/java/org/gvsig/topology/lib/api/TopologyManager.java | ||
---|---|---|
24 | 24 |
package org.gvsig.topology.lib.api; |
25 | 25 |
|
26 | 26 |
import java.util.List; |
27 |
import org.gvsig.fmap.dal.feature.FeatureStore;
|
|
27 |
import org.gvsig.fmap.dal.DataStore;
|
|
28 | 28 |
|
29 | 29 |
/** |
30 | 30 |
* |
... | ... | |
42 | 42 |
|
43 | 43 |
public void addRuleFactories(TopologyRuleFactory factory); |
44 | 44 |
|
45 |
public TopologyDataSet createDataSet(String name, FeatureStore store);
|
|
45 |
public TopologyDataSet createDataSet(String name, DataStore store);
|
|
46 | 46 |
|
47 | 47 |
public void setDefaultServices(TopologyServices services); |
48 | 48 |
|
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.api/src/main/java/org/gvsig/topology/lib/api/TopologyReport.java | ||
---|---|---|
44 | 44 |
TopologyDataSet dataSet1, |
45 | 45 |
TopologyDataSet dataSet2, |
46 | 46 |
Geometry geometry, |
47 |
Geometry error, |
|
47 | 48 |
FeatureReference feature1, |
48 | 49 |
FeatureReference feature2, |
49 | 50 |
boolean exception, |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.api/src/main/java/org/gvsig/topology/lib/api/TopologyReportLine.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
public Geometry getGeometry(); |
42 | 42 |
|
43 |
public Geometry getError(); |
|
44 |
|
|
43 | 45 |
public FeatureReference getFeature1(); |
44 | 46 |
|
45 | 47 |
public FeatureReference getFeature2(); |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.api/src/main/java/org/gvsig/topology/lib/api/TopologyDataSet.java | ||
---|---|---|
24 | 24 |
package org.gvsig.topology.lib.api; |
25 | 25 |
|
26 | 26 |
import org.gvsig.expressionevaluator.Expression; |
27 |
import org.gvsig.fmap.dal.DataStore; |
|
27 | 28 |
import org.gvsig.fmap.dal.exception.DataException; |
28 | 29 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
29 | 30 |
import org.gvsig.fmap.dal.feature.Feature; |
... | ... | |
49 | 50 |
|
50 | 51 |
public String getName(); |
51 | 52 |
|
52 |
public FeatureStore getStore();
|
|
53 |
public DataStore getStore();
|
|
53 | 54 |
|
55 |
public FeatureStore getFeatureStore(); |
|
56 |
|
|
54 | 57 |
public boolean isThisStore(FeatureStore featureStore); |
55 | 58 |
|
56 | 59 |
public int getGeometryType() ; |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.api/src/main/java/org/gvsig/topology/lib/api/TopologyPlan.java | ||
---|---|---|
24 | 24 |
package org.gvsig.topology.lib.api; |
25 | 25 |
|
26 | 26 |
import java.util.Collection; |
27 |
import org.gvsig.fmap.dal.DataStore; |
|
27 | 28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
28 | 29 |
import org.gvsig.tools.task.SimpleTaskStatus; |
29 | 30 |
|
... | ... | |
52 | 53 |
|
53 | 54 |
public void execute(); |
54 | 55 |
|
55 |
public TopologyDataSet addDataSet(String name, FeatureStore store);
|
|
56 |
public TopologyDataSet addDataSet(String name, DataStore store);
|
|
56 | 57 |
|
57 | 58 |
public TopologyDataSet addDataSet(TopologyDataSet dataSet); |
58 | 59 |
|
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.api/src/main/java/org/gvsig/topology/lib/api/TopologyRuleFactory.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
public TopologyRule createRule(TopologyPlan plan, String dataSet1, String dataSet2, double tolerance); |
46 | 46 |
|
47 |
public TopologyRule createRule(TopologyPlan plan); |
|
48 |
|
|
49 | 47 |
public boolean hasSecondaryDataSet(); |
50 | 48 |
|
51 | 49 |
public boolean canApplyToDataSet(TopologyDataSet dataSet); |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.api/src/main/java/org/gvsig/topology/lib/spi/AbstractTopologyRule.java | ||
---|---|---|
56 | 56 |
private String dataSet1; |
57 | 57 |
private String dataSet2; |
58 | 58 |
|
59 |
// protected TopologyReport report; |
|
60 | 59 |
protected List<TopologyRuleAction> actions; |
61 | 60 |
|
62 | 61 |
protected AbstractTopologyRule( |
63 | 62 |
TopologyPlan plan, |
64 |
TopologyRuleFactory factory |
|
65 |
) { |
|
66 |
this.plan = plan; |
|
67 |
this.factory = factory; |
|
68 |
|
|
69 |
this.tolerance = plan.getTolerance(); |
|
70 |
this.dataSet1 = null; |
|
71 |
this.dataSet2 = null; |
|
72 |
// this.report = null; |
|
73 |
this.actions = new ArrayList<>(); |
|
74 |
} |
|
75 |
|
|
76 |
protected AbstractTopologyRule( |
|
77 |
TopologyPlan plan, |
|
78 | 63 |
TopologyRuleFactory factory, |
79 | 64 |
double tolerance, |
80 | 65 |
String dataSet1, |
81 | 66 |
String dataSet2 |
82 | 67 |
) { |
83 |
this(plan,factory); |
|
68 |
this.plan = plan; |
|
69 |
this.factory = factory; |
|
84 | 70 |
this.tolerance = tolerance; |
85 | 71 |
this.dataSet1 = dataSet1; |
86 | 72 |
this.dataSet2 = dataSet2; |
73 |
this.actions = new ArrayList<>(); |
|
87 | 74 |
} |
88 | 75 |
|
89 | 76 |
protected AbstractTopologyRule( |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/DefaultTopologyReportLine.java | ||
---|---|---|
45 | 45 |
private final FeatureReference feature2; |
46 | 46 |
private boolean exception; |
47 | 47 |
private final String description; |
48 |
private Geometry errorGeometry; |
|
48 | 49 |
|
49 | 50 |
DefaultTopologyReportLine(DefaultTopologyReport report, |
50 | 51 |
TopologyRule rule, |
51 | 52 |
TopologyDataSet dataSet1, |
52 | 53 |
TopologyDataSet dataSet2, |
53 | 54 |
Geometry geometry, |
55 |
Geometry error, |
|
54 | 56 |
FeatureReference feature1, |
55 | 57 |
FeatureReference feature2, |
56 | 58 |
boolean exception, |
... | ... | |
65 | 67 |
this.feature2 = feature2; |
66 | 68 |
this.exception = exception; |
67 | 69 |
this.description = description; |
70 |
this.errorGeometry = error; |
|
68 | 71 |
} |
69 | 72 |
|
70 | 73 |
@Override |
... | ... | |
110 | 113 |
public String getDescription() { |
111 | 114 |
return description; |
112 | 115 |
} |
116 |
|
|
117 |
@Override |
|
118 |
public Geometry getError() { |
|
119 |
return this.errorGeometry; |
|
120 |
} |
|
113 | 121 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/DefaultTopologyDataSet.java | ||
---|---|---|
29 | 29 |
import org.apache.commons.lang3.StringUtils; |
30 | 30 |
import org.apache.commons.lang3.mutable.MutableObject; |
31 | 31 |
import org.gvsig.expressionevaluator.Expression; |
32 |
import org.gvsig.fmap.dal.DataStore; |
|
32 | 33 |
import org.gvsig.fmap.dal.EditingNotification; |
33 | 34 |
import org.gvsig.fmap.dal.EditingNotificationManager; |
34 | 35 |
import org.gvsig.fmap.dal.exception.DataException; |
... | ... | |
70 | 71 |
|
71 | 72 |
private TopologyServices services; |
72 | 73 |
private String name; |
73 |
private FeatureStore store;
|
|
74 |
private DataStore store;
|
|
74 | 75 |
private boolean needFinishEditing; |
75 | 76 |
private String fullName; |
76 | 77 |
private PropertiesSupportHelper propertiesHelper; |
... | ... | |
85 | 86 |
this.propertiesHelper = new PropertiesSupportHelper(); |
86 | 87 |
} |
87 | 88 |
|
88 |
public DefaultTopologyDataSet(TopologyServices services, String name, FeatureStore store) {
|
|
89 |
public DefaultTopologyDataSet(TopologyServices services, String name, DataStore store) {
|
|
89 | 90 |
this.services = services; |
90 | 91 |
this.name = name; |
91 | 92 |
this.store = store; |
... | ... | |
128 | 129 |
@Override |
129 | 130 |
public String toString() { |
130 | 131 |
try { |
131 |
FeatureAttributeDescriptor attr = this.getStore().getDefaultFeatureType().getDefaultGeometryAttribute(); |
|
132 |
FeatureAttributeDescriptor attr = this.getFeatureStore().getDefaultFeatureType().getDefaultGeometryAttribute();
|
|
132 | 133 |
String geomType = attr.getGeomType().getName(); |
133 | 134 |
return this.name + " ("+ geomType + ")"; |
134 | 135 |
} catch(Exception ex) { |
... | ... | |
137 | 138 |
} |
138 | 139 |
|
139 | 140 |
@Override |
140 |
public FeatureStore getStore() {
|
|
141 |
public DataStore getStore() {
|
|
141 | 142 |
if (this.store == null) { |
142 | 143 |
this.store = this.services.getFeatureStore(this); |
143 | 144 |
} |
... | ... | |
145 | 146 |
} |
146 | 147 |
|
147 | 148 |
@Override |
149 |
public FeatureStore getFeatureStore() { |
|
150 |
if (this.store == null) { |
|
151 |
this.store = this.services.getFeatureStore(this); |
|
152 |
} |
|
153 |
return (FeatureStore) this.store; |
|
154 |
} |
|
155 |
|
|
156 |
@Override |
|
148 | 157 |
public long getSize() { |
149 | 158 |
try { |
150 |
long size = this.getStore().getFeatureCount(); |
|
159 |
long size = this.getFeatureStore().getFeatureCount();
|
|
151 | 160 |
return size; |
152 | 161 |
} catch (DataException ex) { |
153 | 162 |
// TODO: mensage al log |
... | ... | |
166 | 175 |
@Override |
167 | 176 |
public int getGeometryType() { |
168 | 177 |
try { |
169 |
FeatureStore theStore = this.getStore(); |
|
178 |
FeatureStore theStore = this.getFeatureStore();
|
|
170 | 179 |
FeatureType featureType = theStore.getDefaultFeatureType(); |
171 | 180 |
FeatureAttributeDescriptor attr = featureType.getDefaultGeometryAttribute(); |
172 | 181 |
GeometryType geomType = attr.getGeomType(); |
... | ... | |
178 | 187 |
|
179 | 188 |
@Override |
180 | 189 |
public void accept(Visitor visitor) throws VisitCanceledException { |
181 |
FeatureStore st = this.getStore(); |
|
190 |
FeatureStore st = this.getFeatureStore();
|
|
182 | 191 |
try { |
183 | 192 |
st.accept(visitor); |
184 | 193 |
} catch(VisitCanceledException ex) { |
... | ... | |
190 | 199 |
|
191 | 200 |
@Override |
192 | 201 |
public void edit() throws DataException { |
193 |
FeatureStore theStore = this.getStore(); |
|
202 |
FeatureStore theStore = this.getFeatureStore();
|
|
194 | 203 |
if (!theStore.isEditing()) { |
195 | 204 |
theStore.edit(); |
196 | 205 |
this.needFinishEditing = true; |
... | ... | |
200 | 209 |
@Override |
201 | 210 |
public void finishEditing() throws DataException { |
202 | 211 |
if (this.needFinishEditing) { |
203 |
this.getStore().finishEditing(); |
|
212 |
this.getFeatureStore().finishEditing();
|
|
204 | 213 |
} |
205 | 214 |
} |
206 | 215 |
|
207 | 216 |
@Override |
208 | 217 |
public EditableFeature createNewFeature() throws DataException { |
209 |
EditableFeature f = this.getStore().createNewFeature(); |
|
218 |
EditableFeature f = this.getFeatureStore().createNewFeature();
|
|
210 | 219 |
return f; |
211 | 220 |
} |
212 | 221 |
|
... | ... | |
218 | 227 |
|
219 | 228 |
EditingNotificationManager editingNotificationManager |
220 | 229 |
= DALSwingLocator.getEditingNotificationManager(); |
221 |
FeatureStore theStore = this.getStore(); |
|
230 |
FeatureStore theStore = this.getFeatureStore();
|
|
222 | 231 |
|
223 | 232 |
EditingNotification notification |
224 | 233 |
= editingNotificationManager.notifyObservers(this, // source |
... | ... | |
344 | 353 |
public SpatialIndex getSpatialIndex() { |
345 | 354 |
if( this.spatialIndex == null ) { |
346 | 355 |
this.spatialIndex = new MutableObject<>(); |
347 |
FeatureStore theStore = this.getStore(); |
|
356 |
FeatureStore theStore = this.getFeatureStore();
|
|
348 | 357 |
FeatureStoreProviderFactory storeFactory = (FeatureStoreProviderFactory) theStore.getProviderFactory(); |
349 | 358 |
if( storeFactory.useLocalIndexesCanImprovePerformance()==FeatureStoreProviderFactory.YES ) { |
350 | 359 |
try { |
... | ... | |
396 | 405 |
@Override |
397 | 406 |
public Feature findFirst(Expression filter) { |
398 | 407 |
try { |
399 |
return this.getStore().findFirst(filter); |
|
408 |
return this.getFeatureStore().findFirst(filter);
|
|
400 | 409 |
} catch (Exception ex) { |
401 | 410 |
return null; |
402 | 411 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/DefaultTopologyManager.java | ||
---|---|---|
27 | 27 |
import java.util.Collections; |
28 | 28 |
import java.util.List; |
29 | 29 |
import org.apache.commons.lang3.StringUtils; |
30 |
import org.gvsig.fmap.dal.DataStore; |
|
30 | 31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
31 | 32 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
32 | 33 |
import org.gvsig.topology.lib.api.TopologyManager; |
... | ... | |
85 | 86 |
} |
86 | 87 |
|
87 | 88 |
@Override |
88 |
public TopologyDataSet createDataSet(String name, FeatureStore store) {
|
|
89 |
public TopologyDataSet createDataSet(String name, DataStore store) {
|
|
89 | 90 |
TopologyDataSet dataSet = new DefaultTopologyDataSet(this.services, name, store); |
90 | 91 |
return dataSet; |
91 | 92 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/DefaultTopologyPlan.java | ||
---|---|---|
30 | 30 |
import java.util.HashMap; |
31 | 31 |
import java.util.List; |
32 | 32 |
import java.util.Map; |
33 |
import org.gvsig.fmap.dal.DataStore; |
|
33 | 34 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
34 | 35 |
import org.gvsig.fmap.geom.GeometryLocator; |
35 | 36 |
import org.gvsig.fmap.geom.GeometryManager; |
... | ... | |
165 | 166 |
} |
166 | 167 |
|
167 | 168 |
@Override |
168 |
public TopologyDataSet addDataSet(String name, FeatureStore store) {
|
|
169 |
public TopologyDataSet addDataSet(String name, DataStore store) {
|
|
169 | 170 |
TopologyDataSet dataSet = manager.createDataSet(name, store); |
170 | 171 |
return this.addDataSet(dataSet); |
171 | 172 |
} |
... | ... | |
313 | 314 |
for (Object o : jsonRules) { |
314 | 315 |
JSONObject jsonRule = (JSONObject) o; |
315 | 316 |
TopologyRuleFactory factory = this.manager.getRulefactory(jsonRule.getString("__factoryId")); |
316 |
TopologyRule rule = factory.createRule(this); |
|
317 |
TopologyRule rule = factory.createRule(this,null, null, -1);
|
|
317 | 318 |
rule.fromJSON(jsonRule); |
318 | 319 |
this.addRule(rule); |
319 | 320 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/DefaultTopologyReport.java | ||
---|---|---|
30 | 30 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator; |
31 | 31 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorManager; |
32 | 32 |
import org.gvsig.expressionevaluator.MutableSymbolTable; |
33 |
import org.gvsig.expressionevaluator.spi.AbstractSymbolTable; |
|
34 | 33 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
35 | 34 |
import org.gvsig.fmap.geom.Geometry; |
36 | 35 |
import org.gvsig.tools.task.SimpleTaskStatus; |
37 | 36 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
38 | 37 |
import org.gvsig.topology.lib.api.TopologyPlan; |
39 | 38 |
import org.gvsig.topology.lib.api.TopologyReport; |
40 |
import static org.gvsig.topology.lib.api.TopologyReport.IS_ERROR; |
|
41 |
import static org.gvsig.topology.lib.api.TopologyReport.RULE_ID; |
|
42 | 39 |
import org.gvsig.topology.lib.api.TopologyReportLine; |
43 | 40 |
import org.gvsig.topology.lib.api.TopologyReportLineSet; |
44 | 41 |
import org.gvsig.topology.lib.api.TopologyRule; |
... | ... | |
72 | 69 |
} |
73 | 70 |
SimpleTaskStatus theTaskStatus = plan.getTaskStatus(); |
74 | 71 |
try { |
72 |
theTaskStatus.push(); |
|
75 | 73 |
theTaskStatus.restart(); |
76 | 74 |
theTaskStatus.message("Preparing filter"); |
77 | 75 |
theTaskStatus.setAutoremove(true); |
... | ... | |
105 | 103 |
if (theTaskStatus.isRunning()) { |
106 | 104 |
theTaskStatus.terminate(); |
107 | 105 |
} |
106 |
theTaskStatus.pop(); |
|
108 | 107 |
this.completed = true; |
109 | 108 |
} |
110 | 109 |
} |
... | ... | |
121 | 120 |
|
122 | 121 |
@Override |
123 | 122 |
public TopologyReportLine addLine(TopologyRule rule, TopologyDataSet dataSet1, |
124 |
TopologyDataSet dataSet2, Geometry geometry, |
|
123 |
TopologyDataSet dataSet2, Geometry geometry, Geometry error,
|
|
125 | 124 |
FeatureReference feature1, FeatureReference feature2, |
126 | 125 |
boolean exception, String description |
127 | 126 |
) { |
128 | 127 |
TopologyReportLine line = new DefaultTopologyReportLine( |
129 |
this, rule, dataSet1, dataSet2, geometry, feature1, feature2,
|
|
130 |
exception, description |
|
128 |
this, rule, dataSet1, dataSet2, geometry, error, feature1,
|
|
129 |
feature2, exception, description
|
|
131 | 130 |
); |
132 | 131 |
this.lines.add(line); |
133 | 132 |
this.changeListenerHelper.fireEvent(); |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/ContainsPointRule.java | ||
---|---|---|
34 | 34 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
35 | 35 |
import org.gvsig.fmap.geom.Geometry; |
36 | 36 |
import org.gvsig.fmap.geom.primitive.Point; |
37 |
import org.gvsig.fmap.geom.primitive.Polygon; |
|
38 | 37 |
import org.gvsig.tools.dynobject.DynObject; |
39 | 38 |
import org.gvsig.tools.task.SimpleTaskStatus; |
40 | 39 |
import org.gvsig.topology.lib.spi.AbstractTopologyRule; |
... | ... | |
92 | 91 |
|
93 | 92 |
public ContainsPointRule( |
94 | 93 |
TopologyPlan plan, |
95 |
TopologyRuleFactory factory |
|
96 |
) { |
|
97 |
super(plan, factory); |
|
98 |
this.actions.add(new CreateFetureAction()); |
|
99 |
} |
|
100 |
|
|
101 |
public ContainsPointRule( |
|
102 |
TopologyPlan plan, |
|
103 | 94 |
TopologyRuleFactory factory, |
104 | 95 |
double tolerance, |
105 | 96 |
String dataSet1, |
... | ... | |
114 | 105 |
protected void check(SimpleTaskStatus taskStatus, TopologyReport report, Feature feature1) throws Exception { |
115 | 106 |
FeatureSet set = null; |
116 | 107 |
try { |
117 |
FeatureStore store2 = this.getDataSet2().getStore(); |
|
108 |
FeatureStore store2 = this.getDataSet2().getFeatureStore();
|
|
118 | 109 |
if (this.expression == null) { |
119 | 110 |
ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager(); |
120 | 111 |
this.expression = manager.createExpression(); |
... | ... | |
124 | 115 |
Geometry polygon = feature1.getDefaultGeometry(); |
125 | 116 |
TopologyDataSet theDataSet = this.getDataSet2(); |
126 | 117 |
if (theDataSet.getSpatialIndex() != null) { |
127 |
boolean ok = false;
|
|
118 |
boolean contains = false;
|
|
128 | 119 |
for (FeatureReference featureReference : theDataSet.query(polygon)) { |
129 | 120 |
Feature feature2 = featureReference.getFeature(); |
130 |
if( polygon.contains(feature2.getDefaultGeometry()) ) { |
|
131 |
ok = true; |
|
121 |
Geometry otherPoint = feature2.getDefaultGeometry(); |
|
122 |
if( otherPoint!=null && polygon.contains(otherPoint) ) { |
|
123 |
contains = true; |
|
132 | 124 |
break; |
133 | 125 |
} |
134 | 126 |
} |
135 |
if( !ok ) {
|
|
127 |
if( !contains ) {
|
|
136 | 128 |
report.addLine(this, |
137 | 129 |
this.getDataSet1(), |
138 | 130 |
this.getDataSet2(), |
139 | 131 |
polygon, |
132 |
polygon, |
|
140 | 133 |
feature1.getReference(), |
141 | 134 |
null, |
142 | 135 |
false, |
... | ... | |
159 | 152 |
this.getDataSet1(), |
160 | 153 |
this.getDataSet2(), |
161 | 154 |
polygon, |
155 |
polygon, |
|
162 | 156 |
feature1.getReference(), |
163 | 157 |
null, |
164 | 158 |
false, |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/ContainsNullRule.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
public ContainsNullRule( |
42 | 42 |
TopologyPlan plan, |
43 |
TopologyRuleFactory factory |
|
44 |
) { |
|
45 |
super(plan, factory); |
|
46 |
} |
|
47 |
|
|
48 |
public ContainsNullRule( |
|
49 |
TopologyPlan plan, |
|
50 | 43 |
TopologyRuleFactory factory, |
51 | 44 |
double tolerance, |
52 | 45 |
String dataSet1, |
... | ... | |
64 | 57 |
this.getDataSet1(), |
65 | 58 |
this.getDataSet2(), |
66 | 59 |
feature1.getDefaultGeometry(), |
60 |
null, |
|
67 | 61 |
feature1.getReference(), |
68 | 62 |
null, |
69 | 63 |
false, |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/MustNotOverlapPolygonRule.java | ||
---|---|---|
134 | 134 |
|
135 | 135 |
public MustNotOverlapPolygonRule( |
136 | 136 |
TopologyPlan plan, |
137 |
TopologyRuleFactory factory |
|
138 |
) { |
|
139 |
super(plan, factory); |
|
140 |
this.addAction(new CreateFetureAction()); |
|
141 |
this.addAction(new MergeAction()); |
|
142 |
this.addAction(new SubtractAction()); |
|
143 |
} |
|
144 |
|
|
145 |
public MustNotOverlapPolygonRule( |
|
146 |
TopologyPlan plan, |
|
147 | 137 |
TopologyRuleFactory factory, |
148 | 138 |
double tolerance, |
149 | 139 |
String dataSet1 |
... | ... | |
174 | 164 |
continue; |
175 | 165 |
} |
176 | 166 |
Feature feature = reference.getFeature(); |
177 |
if (polygon.overlaps(feature.getDefaultGeometry())) { |
|
167 |
Geometry otherPolygon = feature.getDefaultGeometry(); |
|
168 |
if (otherPolygon!=null && polygon.overlaps(otherPolygon)) {; |
|
169 |
Geometry error = otherPolygon.difference(polygon); |
|
178 | 170 |
report.addLine(this, |
179 | 171 |
theDataSet, |
180 | 172 |
null, |
181 | 173 |
polygon, |
174 |
error, |
|
182 | 175 |
feature1.getReference(), |
183 | 176 |
null, |
184 | 177 |
false, |
... | ... | |
198 | 191 |
) |
199 | 192 |
).toString() |
200 | 193 |
); |
201 |
if (theDataSet.findFirst(this.expression) != null) { |
|
194 |
Feature feature = theDataSet.findFirst(this.expression); |
|
195 |
if ( feature != null) { |
|
196 |
Geometry otherPolygon = feature.getDefaultGeometry(); |
|
197 |
Geometry error = null; |
|
198 |
if( otherPolygon!=null ) { |
|
199 |
error = polygon.difference(otherPolygon); |
|
200 |
} |
|
202 | 201 |
report.addLine(this, |
203 | 202 |
theDataSet, |
204 | 203 |
null, |
205 | 204 |
polygon, |
205 |
error, |
|
206 | 206 |
feature1.getReference(), |
207 | 207 |
null, |
208 | 208 |
false, |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PointMustBeProperlyInsidePolygonRule.java | ||
---|---|---|
82 | 82 |
|
83 | 83 |
public PointMustBeProperlyInsidePolygonRule( |
84 | 84 |
TopologyPlan plan, |
85 |
TopologyRuleFactory factory |
|
86 |
) { |
|
87 |
super(plan, factory); |
|
88 |
this.actions.add(new DeleteAction()); |
|
89 |
} |
|
90 |
|
|
91 |
public PointMustBeProperlyInsidePolygonRule( |
|
92 |
TopologyPlan plan, |
|
93 | 85 |
TopologyRuleFactory factory, |
94 | 86 |
double tolerance, |
95 | 87 |
String dataSet1, |
... | ... | |
104 | 96 |
protected void check(SimpleTaskStatus taskStatus, TopologyReport report, Feature feature1) throws Exception { |
105 | 97 |
FeatureSet set = null; |
106 | 98 |
try { |
107 |
FeatureStore store2 = this.getDataSet2().getStore(); |
|
99 |
FeatureStore store2 = this.getDataSet2().getFeatureStore();
|
|
108 | 100 |
if (this.expression == null) { |
109 | 101 |
ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager(); |
110 | 102 |
this.expression = manager.createExpression(); |
... | ... | |
113 | 105 |
} |
114 | 106 |
Geometry point = feature1.getDefaultGeometry(); |
115 | 107 |
TopologyDataSet theDataSet = this.getDataSet2(); |
116 |
// if (theDataSet.getSpatialIndex() != null) { |
|
117 |
// boolean ok = false; |
|
118 |
// for (FeatureReference featureReference : theDataSet.query(point)) { |
|
119 |
// Feature feature2 = featureReference.getFeature(); |
|
120 |
// if( feature2.getDefaultGeometry().overlaps(point) ) { |
|
121 |
// ok = true; |
|
122 |
// break; |
|
123 |
// } |
|
124 |
// } |
|
125 |
// if( !ok ) { |
|
126 |
// report.addLine(this, |
|
127 |
// this.getDataSet1(), |
|
128 |
// this.getDataSet2(), |
|
129 |
// point, |
|
130 |
// feature1.getReference(), |
|
131 |
// null, |
|
132 |
// false, |
|
133 |
// "The point are error where are not inside a polygon." |
|
134 |
// ); |
|
135 |
// } |
|
136 |
// } else { |
|
108 |
if (theDataSet.getSpatialIndex() != null) { |
|
109 |
boolean contained = false; |
|
110 |
for (FeatureReference featureReference : theDataSet.query(point)) { |
|
111 |
Feature feature2 = featureReference.getFeature(); |
|
112 |
Geometry otherPolygon = feature2.getDefaultGeometry(); |
|
113 |
if( otherPolygon!=null && otherPolygon.contains(point) ) { |
|
114 |
contained = true; |
|
115 |
break; |
|
116 |
} |
|
117 |
} |
|
118 |
if( !contained ) { |
|
119 |
report.addLine(this, |
|
120 |
this.getDataSet1(), |
|
121 |
this.getDataSet2(), |
|
122 |
point, |
|
123 |
point, |
|
124 |
feature1.getReference(), |
|
125 |
null, |
|
126 |
false, |
|
127 |
"The point are error where are not inside a polygon." |
|
128 |
); |
|
129 |
} |
|
130 |
} else { |
|
137 | 131 |
this.expression.setPhrase( |
138 | 132 |
this.expressionBuilder.ifnull( |
139 | 133 |
this.expressionBuilder.column(this.geomName), |
140 | 134 |
this.expressionBuilder.constant(false), |
141 |
this.expressionBuilder.ST_Overlaps(
|
|
135 |
this.expressionBuilder.ST_Contains(
|
|
142 | 136 |
this.expressionBuilder.column(this.geomName), |
143 | 137 |
this.expressionBuilder.geometry(point) |
144 | 138 |
) |
... | ... | |
149 | 143 |
this.getDataSet1(), |
150 | 144 |
this.getDataSet2(), |
151 | 145 |
point, |
146 |
point, |
|
152 | 147 |
feature1.getReference(), |
153 | 148 |
null, |
154 | 149 |
false, |
155 | 150 |
"The point are error where are not inside a polygon." |
156 | 151 |
); |
157 | 152 |
} |
158 |
// }
|
|
153 |
} |
|
159 | 154 |
} catch (Exception ex) { |
160 | 155 |
LOGGER.warn("Can't check feature.", ex); |
161 | 156 |
} finally { |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/MustBeLargerThanToleranceLineRule.java | ||
---|---|---|
69 | 69 |
|
70 | 70 |
public MustBeLargerThanToleranceLineRule( |
71 | 71 |
TopologyPlan plan, |
72 |
TopologyRuleFactory factory |
|
73 |
) { |
|
74 |
super(plan, factory); |
|
75 |
this.actions.add(new DeleteAction()); |
|
76 |
} |
|
77 |
|
|
78 |
public MustBeLargerThanToleranceLineRule( |
|
79 |
TopologyPlan plan, |
|
80 | 72 |
TopologyRuleFactory factory, |
81 | 73 |
double tolerance, |
82 | 74 |
String dataSet1, |
... | ... | |
91 | 83 |
public void check(SimpleTaskStatus taskStatus, TopologyReport report, Feature feature) throws Exception { |
92 | 84 |
Geometry geom = feature.getDefaultGeometry(); |
93 | 85 |
if( geom.perimeter()<this.getTolerance() ) { |
94 |
report.addLine(this, this.getDataSet1(), null,
|
|
95 |
geom, feature.getReference(), null, false, |
|
86 |
report.addLine(this, this.getDataSet1(), null, |
|
87 |
geom, null, feature.getReference(), null, false,
|
|
96 | 88 |
"The length of the line is less than the specified tolerance" |
97 | 89 |
); |
98 | 90 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/ContainsPointRuleFactory.java | ||
---|---|---|
58 | 58 |
return rule; |
59 | 59 |
} |
60 | 60 |
|
61 |
@Override |
|
62 |
public TopologyRule createRule(TopologyPlan plan) { |
|
63 |
TopologyRule rule = new ContainsPointRule(plan, this); |
|
64 |
return rule; |
|
65 |
} |
|
66 | 61 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/ContainsNullRuleFactory.java | ||
---|---|---|
55 | 55 |
return rule; |
56 | 56 |
} |
57 | 57 |
|
58 |
@Override |
|
59 |
public TopologyRule createRule(TopologyPlan plan) { |
|
60 |
TopologyRule rule = new ContainsNullRule(plan, this); |
|
61 |
return rule; |
|
62 |
} |
|
63 | 58 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/MustNotOverlapPolygonRuleFactory.java | ||
---|---|---|
56 | 56 |
return rule; |
57 | 57 |
} |
58 | 58 |
|
59 |
@Override |
|
60 |
public TopologyRule createRule(TopologyPlan plan) { |
|
61 |
TopologyRule rule = new MustNotOverlapPolygonRule(plan, this); |
|
62 |
return rule; |
|
63 |
} |
|
64 | 59 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PointMustBeProperlyInsidePolygonRuleFactory.java | ||
---|---|---|
58 | 58 |
return rule; |
59 | 59 |
} |
60 | 60 |
|
61 |
@Override |
|
62 |
public TopologyRule createRule(TopologyPlan plan) { |
|
63 |
TopologyRule rule = new PointMustBeProperlyInsidePolygonRule(plan, this); |
|
64 |
return rule; |
|
65 |
} |
|
66 | 61 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/MustBeLargerThanToleranceLineRuleFactory.java | ||
---|---|---|
49 | 49 |
} |
50 | 50 |
|
51 | 51 |
@Override |
52 |
public TopologyRule createRule(TopologyPlan plan) { |
|
53 |
TopologyRule rule = new MustBeLargerThanToleranceLineRule(plan, this); |
|
54 |
return rule; |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 | 52 |
public TopologyRule createRule(TopologyPlan plan, String dataSet1, String dataSet2, double tolerance) { |
59 | 53 |
TopologyRule rule = new MustBeLargerThanToleranceLineRule(plan, this, tolerance, dataSet1, dataSet2); |
60 | 54 |
return rule; |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.swing/org.gvsig.topology.swing.api/src/main/java/org/gvsig/topology/swing/api/TopologySwingServices.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.topology.swing.api; |
25 | 25 |
|
26 |
import javax.swing.ImageIcon; |
|
26 | 27 |
import javax.swing.tree.TreeModel; |
28 |
import javax.swing.tree.TreePath; |
|
29 |
import org.gvsig.fmap.geom.Geometry; |
|
27 | 30 |
import org.gvsig.fmap.geom.primitive.Envelope; |
28 | 31 |
import org.gvsig.fmap.geom.primitive.Point; |
29 | 32 |
import org.gvsig.topology.lib.api.TopologyServices; |
... | ... | |
52 | 55 |
public void removeWorkingAreaChangedListener(WorkingAreaChangedListener listener); |
53 | 56 |
|
54 | 57 |
public void refreshView(); |
58 |
|
|
59 |
public void addError(Geometry geom); |
|
60 |
|
|
61 |
public void setShowFormWhenEdit(boolean showFormWhenEdit); |
|
62 |
|
|
63 |
public ImageIcon getTreeIcon(TreeModel model, Object item); |
|
55 | 64 |
} |
Also available in: Unified diff