Revision 4563
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/customizablerule/CustomizableRule0ActionsImpl.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2021 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.customizablerule; |
|
25 |
|
|
26 |
import org.apache.commons.lang3.StringUtils; |
|
27 |
import org.gvsig.expressionevaluator.Expression; |
|
28 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
|
29 |
import org.gvsig.expressionevaluator.MutableSymbolTable; |
|
30 |
import org.gvsig.fmap.dal.DALLocator; |
|
31 |
import org.gvsig.fmap.dal.DataTypeUtils; |
|
32 |
import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable; |
|
33 |
import org.gvsig.fmap.dal.feature.Feature; |
|
34 |
import org.gvsig.tools.ToolsLocator; |
|
35 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
36 |
import org.gvsig.topology.lib.api.TopologyReport; |
|
37 |
import org.gvsig.topology.lib.api.TopologyRuleFactory; |
|
38 |
import static org.gvsig.topology.lib.impl.customizablerule.CustomizableRule0ActionsFactory.PARAM_CHECK_NAME; |
|
39 |
import static org.gvsig.topology.lib.impl.customizablerule.CustomizableRule0ActionsFactory.PARAM_ERRMSG_NAME; |
|
40 |
import org.gvsig.topology.lib.spi.AbstractTopologyRule; |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
* @author gvSIG Team |
|
45 |
*/ |
|
46 |
@SuppressWarnings("UseSpecificCatch") |
|
47 |
public class CustomizableRule0ActionsImpl |
|
48 |
extends AbstractTopologyRule |
|
49 |
{ |
|
50 |
|
|
51 |
|
|
52 |
protected Expression check; |
|
53 |
protected String errmsg; |
|
54 |
protected FeatureSymbolTable featureSymbolTable; |
|
55 |
protected MutableSymbolTable symbolTable; |
|
56 |
|
|
57 |
public CustomizableRule0ActionsImpl() { |
|
58 |
|
|
59 |
} |
|
60 |
|
|
61 |
public CustomizableRule0ActionsImpl( |
|
62 |
TopologyRuleFactory factory, |
|
63 |
double tolerance, |
|
64 |
String dataSet1, |
|
65 |
String dataSet2 |
|
66 |
) { |
|
67 |
super(factory, tolerance, dataSet1, dataSet2); |
|
68 |
} |
|
69 |
|
|
70 |
@Override |
|
71 |
protected void check(SimpleTaskStatus taskStatus, TopologyReport report, Feature feature1) throws Exception { |
|
72 |
if (this.symbolTable == null) { |
|
73 |
this.featureSymbolTable = DALLocator.getDataManager().createFeatureSymbolTable(); |
|
74 |
this.symbolTable = this.featureSymbolTable.createParent(); |
|
75 |
this.symbolTable.setVar("rule", this); |
|
76 |
} |
|
77 |
if( this.check == null ) { |
|
78 |
this.check = (Expression) this.getParameters().getDynValue(PARAM_CHECK_NAME); |
|
79 |
} |
|
80 |
this.symbolTable.setVar("taskStatus", taskStatus); |
|
81 |
this.symbolTable.setVar("report", report); |
|
82 |
this.symbolTable.setVar("feature1", feature1); |
|
83 |
this.featureSymbolTable.setFeature(feature1); |
|
84 |
Object n = this.check.execute(this.featureSymbolTable); |
|
85 |
if( DataTypeUtils.isTrue(n, false) ) { |
|
86 |
return; |
|
87 |
} |
|
88 |
report.addLine( |
|
89 |
this, |
|
90 |
this.getDataSet1(), |
|
91 |
null, // Dataset2 |
|
92 |
feature1.getDefaultGeometry(), |
|
93 |
null, // Error |
|
94 |
feature1.getReference(), |
|
95 |
null, // feature2 |
|
96 |
false, // is an exception? |
|
97 |
getErrorMessage() |
|
98 |
); |
|
99 |
} |
|
100 |
|
|
101 |
private String getErrorMessage() { |
|
102 |
if( this.errmsg == null ) { |
|
103 |
this.errmsg = (String) this.getParameters().getDynValue(PARAM_ERRMSG_NAME); |
|
104 |
if( StringUtils.isBlank(this.errmsg) ) { |
|
105 |
this.errmsg = ToolsLocator.getI18nManager().getTranslation("_The_verification_expression_was_not_met"); |
|
106 |
} |
|
107 |
} |
|
108 |
return this.errmsg; |
|
109 |
} |
|
110 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/customizablerule/CustomizableRule0ActionsFactory.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2021 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.customizablerule; |
|
25 |
|
|
26 |
import org.gvsig.expressionevaluator.DataTypes; |
|
27 |
import org.gvsig.expressionevaluator.Expression; |
|
28 |
import org.gvsig.json.Json; |
|
29 |
import org.gvsig.tools.ToolsLocator; |
|
30 |
import org.gvsig.tools.dynobject.DynClass; |
|
31 |
import org.gvsig.tools.dynobject.DynField_v2; |
|
32 |
import org.gvsig.tools.dynobject.DynObject; |
|
33 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
34 |
import org.gvsig.tools.dynobject.DynStruct_v2; |
|
35 |
import org.gvsig.tools.i18n.I18nManager; |
|
36 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
|
37 |
import org.gvsig.topology.lib.api.TopologyLocator; |
|
38 |
import org.gvsig.topology.lib.api.TopologyManager; |
|
39 |
import org.gvsig.topology.lib.api.TopologyRule; |
|
40 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleFactory; |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
* @author gvSIG Team |
|
45 |
*/ |
|
46 |
@SuppressWarnings("UseSpecificCatch") |
|
47 |
public class CustomizableRule0ActionsFactory extends AbstractTopologyRuleFactory { |
|
48 |
|
|
49 |
public static final String NAME = "Customizable0"; |
|
50 |
|
|
51 |
public static final String PARAM_CHECK_NAME = "check"; |
|
52 |
public static final String PARAM_ERRMSG_NAME = "errmsg"; |
|
53 |
|
|
54 |
private DynStruct_v2 ruleParametersDefinition; |
|
55 |
|
|
56 |
public CustomizableRule0ActionsFactory() { |
|
57 |
super( |
|
58 |
NAME, |
|
59 |
"Customizable0", |
|
60 |
"", |
|
61 |
null |
|
62 |
); |
|
63 |
DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager(); |
|
64 |
this.ruleParametersDefinition = (DynStruct_v2) dynObjectManager.get("Topology", "CustomizableRule0Parameters"); |
|
65 |
if( ruleParametersDefinition==null ) { |
|
66 |
ruleParametersDefinition = (DynStruct_v2) dynObjectManager.createDynClass("Topology", "CustomizableRule0Parameters", null); |
|
67 |
DynField_v2 param; |
|
68 |
param = (DynField_v2) ruleParametersDefinition.addDynField(PARAM_CHECK_NAME,DataTypes.EXPRESSION); |
|
69 |
param.setMandatory(true); |
|
70 |
param.setLabel("_Check_expression"); |
|
71 |
param.setDescription("_Verification_expression_If_false_the_rule_fails"); |
|
72 |
|
|
73 |
param = (DynField_v2) ruleParametersDefinition.addDynFieldString(PARAM_ERRMSG_NAME); |
|
74 |
param.setMandatory(true); |
|
75 |
param.setLabel("_Error_message"); |
|
76 |
param.setDescription("_Message_to_show_if_check_fail"); |
|
77 |
|
|
78 |
// DynField_v2 action = (DynField_v2) ruleParametersDefinition.addDynField("action"); |
|
79 |
// action.setType(DataTypes.EXPRESSION); |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
public String getName() { |
|
85 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
86 |
return i18n.getTranslation("_Customizable"); |
|
87 |
} |
|
88 |
|
|
89 |
@Override |
|
90 |
public boolean canApplyToDataSet(TopologyDataSet dataSet) { |
|
91 |
return true; |
|
92 |
} |
|
93 |
|
|
94 |
@Override |
|
95 |
public boolean canApplyToSecondaryDataSet(TopologyDataSet dataSet) { |
|
96 |
return true; |
|
97 |
} |
|
98 |
|
|
99 |
@Override |
|
100 |
public TopologyRule createRule(String dataSet1, String dataSet2, double tolerance) { |
|
101 |
TopologyRule rule = new CustomizableRule0ActionsImpl(this, tolerance, dataSet1, dataSet2); |
|
102 |
return rule; |
|
103 |
} |
|
104 |
|
|
105 |
@Override |
|
106 |
public boolean hasRuleParameters() { |
|
107 |
return true; |
|
108 |
} |
|
109 |
|
|
110 |
@Override |
|
111 |
public DynObject createRuleParameters() { |
|
112 |
DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager(); |
|
113 |
DynObject param = dynObjectManager.createDynObject(this.ruleParametersDefinition); |
|
114 |
return param; |
|
115 |
} |
|
116 |
|
|
117 |
public static void selfRegister() { |
|
118 |
try { |
|
119 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
|
120 |
manager.addRuleFactories(new CustomizableRule0ActionsFactory()); |
|
121 |
Json.registerSerializer(CustomizableRule0ActionsImpl.class); |
|
122 |
} catch(Exception ex) { |
|
123 |
LOGGER.warn("Can't register topology rule from "+CustomizableRule0ActionsFactory.class.getSimpleName(), ex); |
|
124 |
} |
|
125 |
} |
|
126 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/customizablerule/CustomizableRuleActionImpl.java | ||
---|---|---|
1 |
package org.gvsig.topology.lib.impl.customizablerule; |
|
2 |
|
|
3 |
import javax.json.JsonObject; |
|
4 |
import org.gvsig.expressionevaluator.Expression; |
|
5 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
|
6 |
import org.gvsig.expressionevaluator.MutableSymbolTable; |
|
7 |
import org.gvsig.json.Json; |
|
8 |
import org.gvsig.json.JsonObjectBuilder; |
|
9 |
import org.gvsig.json.SupportJson; |
|
10 |
import org.gvsig.tools.dynobject.DynObject; |
|
11 |
import org.gvsig.topology.lib.api.ExecuteTopologyRuleActionException; |
|
12 |
import org.gvsig.topology.lib.api.TopologyReportLine; |
|
13 |
import org.gvsig.topology.lib.api.TopologyRule; |
|
14 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleAction; |
|
15 |
|
|
16 |
/** |
|
17 |
* |
|
18 |
* @author gvSIG Team |
|
19 |
*/ |
|
20 |
public class CustomizableRuleActionImpl |
|
21 |
extends AbstractTopologyRuleAction |
|
22 |
implements SupportJson { |
|
23 |
|
|
24 |
protected Expression action; |
|
25 |
protected MutableSymbolTable symbolTable; |
|
26 |
|
|
27 |
public CustomizableRuleActionImpl() { |
|
28 |
super(CustomizableRule0ActionsFactory.NAME); |
|
29 |
} |
|
30 |
|
|
31 |
public Expression getAction() { |
|
32 |
return this.action; |
|
33 |
} |
|
34 |
|
|
35 |
public void setAction(Expression action) { |
|
36 |
this.action = action; |
|
37 |
} |
|
38 |
|
|
39 |
public void setId(String id) { |
|
40 |
this.idAction = id; |
|
41 |
} |
|
42 |
|
|
43 |
public void setName(String name) { |
|
44 |
this.name = name; |
|
45 |
} |
|
46 |
|
|
47 |
public void setShortDescription(String description) { |
|
48 |
this.shortDescription = description; |
|
49 |
} |
|
50 |
|
|
51 |
public MutableSymbolTable getSymbolTable() { |
|
52 |
if (this.symbolTable == null) { |
|
53 |
this.symbolTable = ExpressionUtils.createSymbolTable(); |
|
54 |
this.symbolTable.setVar("action", this); |
|
55 |
} |
|
56 |
return this.symbolTable; |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public int execute(TopologyRule rule, TopologyReportLine line, DynObject parameters) throws ExecuteTopologyRuleActionException { |
|
61 |
MutableSymbolTable st = this.getSymbolTable(); |
|
62 |
st.setVar("rule", rule); |
|
63 |
st.setVar("line", line); |
|
64 |
st.setVar("parameters", parameters); |
|
65 |
this.action.execute(symbolTable); |
|
66 |
return EXECUTE_OK; |
|
67 |
} |
|
68 |
|
|
69 |
@Override |
|
70 |
public void fromJson(JsonObject json) { |
|
71 |
this.idAction = (String) Json.toObject(json, "idAction"); |
|
72 |
this.idRule = (String) Json.toObject(json, "idRule"); |
|
73 |
this.name = (String) Json.toObject(json, "name"); |
|
74 |
this.shortDescription = (String) Json.toObject(json, "shortDescription"); |
|
75 |
this.action = (Expression) Json.toObject(json, "expression"); |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public JsonObject toJson() { |
|
80 |
return toJsonBuilder().build(); |
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
public JsonObjectBuilder toJsonBuilder() { |
|
85 |
JsonObjectBuilder builder = Json.createObjectBuilder(); |
|
86 |
builder.add("idAction", idAction); |
|
87 |
builder.add("idRule", idRule); |
|
88 |
builder.add("name", name); |
|
89 |
builder.add("shortDescription", shortDescription); |
|
90 |
builder.add("expression", action); |
|
91 |
return builder; |
|
92 |
} |
|
93 |
|
|
94 |
} |
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 javax.json.JsonArray; |
|
34 |
import javax.json.JsonObject; |
|
35 |
import javax.json.JsonValue; |
|
33 | 36 |
import org.gvsig.fmap.dal.DataStore; |
34 | 37 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
35 | 38 |
import org.gvsig.fmap.geom.GeometryLocator; |
36 | 39 |
import org.gvsig.fmap.geom.GeometryManager; |
37 | 40 |
import org.gvsig.fmap.geom.type.GeometryType; |
41 |
import org.gvsig.json.Json; |
|
42 |
import org.gvsig.json.JsonArrayBuilder; |
|
43 |
import org.gvsig.json.JsonObjectBuilder; |
|
38 | 44 |
import org.gvsig.tools.ToolsLocator; |
39 | 45 |
import org.gvsig.tools.task.SimpleTaskStatus; |
40 | 46 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
... | ... | |
43 | 49 |
import org.gvsig.topology.lib.api.TopologyRule; |
44 | 50 |
import org.gvsig.topology.lib.api.TopologyRuleFactory; |
45 | 51 |
import org.gvsig.topology.lib.api.TopologyServices; |
46 |
import org.json.JSONArray; |
|
47 |
import org.json.JSONObject; |
|
52 |
import org.gvsig.topology.lib.spi.AbstractTopologyRule; |
|
48 | 53 |
import org.slf4j.Logger; |
49 | 54 |
import org.slf4j.LoggerFactory; |
50 | 55 |
|
... | ... | |
125 | 130 |
return this.services; |
126 | 131 |
} |
127 | 132 |
|
133 |
@Override |
|
128 | 134 |
public SimpleTaskStatus getTaskStatus() { |
129 | 135 |
if( this.taskStatus == null ) { |
130 | 136 |
this.taskStatus = ToolsLocator.getTaskStatusManager() |
... | ... | |
226 | 232 |
"Can't apply rule '"+factory.getName()+"' to the datasets '"+dataSet1+"/"+dataSet2+"'." |
227 | 233 |
); |
228 | 234 |
} |
229 |
TopologyRule rule = factory.createRule(this, dataSet1, dataSet2, tolerance);
|
|
235 |
TopologyRule rule = factory.createRule(dataSet1, dataSet2, tolerance); |
|
230 | 236 |
return this.addRule(rule); |
231 | 237 |
} |
232 | 238 |
|
233 | 239 |
@Override |
234 | 240 |
public TopologyRule addRule(TopologyRule rule) { |
241 |
if( rule.getPlan()!=null && rule.getPlan()!=this ) { |
|
242 |
rule = (AbstractTopologyRule) org.gvsig.tools.lang.Cloneable.cloneQuietly(rule); |
|
243 |
} |
|
244 |
((AbstractTopologyRule)rule).setPlan(this); |
|
235 | 245 |
this.rules.add(rule); |
236 | 246 |
return rule; |
237 | 247 |
} |
... | ... | |
282 | 292 |
} |
283 | 293 |
|
284 | 294 |
@Override |
285 |
public JSONObject toJSON() { |
|
286 |
JSONObject me = new JSONObject(); |
|
295 |
public JsonObject toJson() { |
|
296 |
return this.toJsonBuilder().build(); |
|
297 |
} |
|
287 | 298 |
|
288 |
me.put("name", this.name); |
|
289 |
me.put("tolerance", this.tolerance); |
|
290 |
me.put("acceptExceptions", this.acceptExceptions); |
|
299 |
@Override |
|
300 |
public JsonObjectBuilder toJsonBuilder() { |
|
301 |
JsonObjectBuilder me = Json.createObjectBuilder(); |
|
302 |
me.add_class(this); |
|
303 |
me.add("name", this.name); |
|
304 |
me.add("tolerance", this.tolerance); |
|
305 |
me.add("acceptExceptions", this.acceptExceptions); |
|
291 | 306 |
|
292 |
JSONArray jsonDataSets= new JSONArray();
|
|
307 |
JsonArrayBuilder jsonDataSets = Json.createArrayBuilder();
|
|
293 | 308 |
for (TopologyDataSet dataSet : this.dataSets.values()) { |
294 |
jsonDataSets.put(((DefaultTopologyDataSet)dataSet).toJSON());
|
|
309 |
jsonDataSets.add((DefaultTopologyDataSet)dataSet);
|
|
295 | 310 |
} |
296 |
me.put("dataSets", jsonDataSets);
|
|
311 |
me.add("dataSets", jsonDataSets);
|
|
297 | 312 |
|
298 |
JSONArray jsonRules = new JSONArray();
|
|
313 |
JsonArrayBuilder jsonRules = Json.createArrayBuilder();
|
|
299 | 314 |
for (TopologyRule rule : this.rules) { |
300 |
JSONObject jsonRule = rule.toJSON(); |
|
301 |
jsonRule.put("__factoryId", rule.getFactory().getId()); |
|
302 |
jsonRules.put(jsonRule); |
|
315 |
jsonRules.add(rule); |
|
303 | 316 |
} |
304 |
me.put("rules", jsonRules);
|
|
317 |
me.add("rules", jsonRules);
|
|
305 | 318 |
|
306 | 319 |
return me; |
307 | 320 |
} |
308 | 321 |
|
309 | 322 |
@Override |
310 |
public void fromJSON(String json) { |
|
311 |
this.fromJSON(new JSONObject(json)); |
|
312 |
} |
|
313 |
|
|
314 |
@Override |
|
315 |
public void fromJSON(JSONObject jsonPlan) { |
|
316 |
|
|
323 |
public void fromJson(JsonObject jsonPlan) { |
|
317 | 324 |
this.name = jsonPlan.getString("name"); |
318 |
this.tolerance = jsonPlan.getDouble("tolerance");
|
|
325 |
this.tolerance = jsonPlan.getJsonNumber("tolerance").doubleValue();
|
|
319 | 326 |
this.acceptExceptions = jsonPlan.getBoolean("acceptExceptions"); |
320 | 327 |
|
321 |
JSONArray jsonDataSets = jsonPlan.getJSONArray("dataSets");
|
|
322 |
for (Object o : jsonDataSets) {
|
|
328 |
JsonArray jsonDataSets = jsonPlan.getJsonArray("dataSets");
|
|
329 |
for (JsonValue o : jsonDataSets) {
|
|
323 | 330 |
TopologyDataSet dataSet = new DefaultTopologyDataSet(); |
324 |
dataSet.fromJSON((JSONObject) o);
|
|
331 |
dataSet.fromJson((JsonObject) o);
|
|
325 | 332 |
this.dataSets.put(dataSet.getName(),dataSet); |
326 | 333 |
} |
327 | 334 |
|
328 |
JSONArray jsonRules = jsonPlan.getJSONArray("rules"); |
|
329 |
for (Object o : jsonRules) { |
|
330 |
JSONObject jsonRule = (JSONObject) o; |
|
331 |
TopologyRuleFactory factory = this.manager.getRulefactory(jsonRule.getString("__factoryId")); |
|
332 |
TopologyRule rule = factory.createRule(this,null, null, -1); |
|
333 |
rule.fromJSON(jsonRule); |
|
335 |
JsonArray jsonRules = jsonPlan.getJsonArray("rules"); |
|
336 |
for (JsonValue o : jsonRules) { |
|
337 |
TopologyRule rule = (TopologyRule) Json.toObject(o); |
|
334 | 338 |
this.addRule(rule); |
335 | 339 |
} |
336 | 340 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/TopologyImplLibrary.java | ||
---|---|---|
30 | 30 |
import org.gvsig.tools.library.LibraryException; |
31 | 31 |
import org.gvsig.topology.lib.api.TopologyLibrary; |
32 | 32 |
import org.gvsig.topology.lib.api.TopologyLocator; |
33 |
import org.gvsig.topology.lib.api.TopologyManager;
|
|
33 |
import org.gvsig.topology.lib.impl.customizablerule.CustomizableRule0ActionsFactory;
|
|
34 | 34 |
import org.gvsig.topology.rule.GeometryMustNotBeNullRuleFactory; |
35 | 35 |
import org.gvsig.topology.rule.LineMustBeCoveredByBoundaryOfPolygonRuleFactory; |
36 | 36 |
import org.gvsig.topology.rule.PolygonContainsPointRuleFactory; |
... | ... | |
64 | 64 |
|
65 | 65 |
@Override |
66 | 66 |
protected void doPostInitialize() throws LibraryException { |
67 |
CustomizableRule0ActionsFactory.selfRegister(); |
|
67 | 68 |
GeometryMustNotBeNullRuleFactory.selfRegister(); |
68 | 69 |
LineMustBeCoveredByBoundaryOfPolygonRuleFactory.selfRegister(); |
69 | 70 |
LineMustBeLargerThanToleranceRuleFactory.selfRegister(); |
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 | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import java.util.Iterator; |
27 | 27 |
import java.util.Map; |
28 |
import javax.json.JsonObject; |
|
28 | 29 |
import org.apache.commons.collections.IteratorUtils; |
29 | 30 |
import org.apache.commons.lang3.StringUtils; |
30 | 31 |
import org.apache.commons.lang3.mutable.MutableObject; |
31 | 32 |
import org.gvsig.expressionevaluator.Expression; |
32 |
import org.gvsig.expressionevaluator.ExpressionBuilder; |
|
33 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator; |
|
34 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorManager; |
|
35 | 33 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
36 | 34 |
import org.gvsig.expressionevaluator.GeometryExpressionBuilder; |
37 | 35 |
import org.gvsig.expressionevaluator.GeometryExpressionUtils; |
... | ... | |
54 | 52 |
import org.gvsig.fmap.geom.GeometryUtils; |
55 | 53 |
import org.gvsig.fmap.geom.SpatialIndex; |
56 | 54 |
import org.gvsig.fmap.geom.type.GeometryType; |
55 |
import org.gvsig.json.Json; |
|
56 |
import org.gvsig.json.JsonObjectBuilder; |
|
57 | 57 |
import org.gvsig.tools.dispose.DisposableIterator; |
58 | 58 |
import org.gvsig.tools.exception.BaseException; |
59 | 59 |
import org.gvsig.tools.util.PropertiesSupportHelper; |
... | ... | |
64 | 64 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
65 | 65 |
import org.gvsig.topology.lib.api.TopologyLocator; |
66 | 66 |
import org.gvsig.topology.lib.api.TopologyManager; |
67 |
import org.json.JSONObject; |
|
68 | 67 |
import org.gvsig.topology.lib.api.TopologyServices; |
69 | 68 |
import org.slf4j.Logger; |
70 | 69 |
import org.slf4j.LoggerFactory; |
... | ... | |
324 | 323 |
} |
325 | 324 |
|
326 | 325 |
@Override |
327 |
public JSONObject toJSON() { |
|
328 |
JSONObject jsonDataSet = new JSONObject(); |
|
329 |
jsonDataSet.put("name", this.name); |
|
330 |
jsonDataSet.put("fullName", this.fullName); |
|
331 |
|
|
332 |
return jsonDataSet; |
|
326 |
public JsonObject toJson() { |
|
327 |
return this.toJsonBuilder().build(); |
|
333 | 328 |
} |
334 | 329 |
|
335 | 330 |
@Override |
336 |
public void fromJSON(String json) { |
|
337 |
this.fromJSON(new JSONObject(json)); |
|
331 |
public JsonObjectBuilder toJsonBuilder() { |
|
332 |
JsonObjectBuilder jsonDataSet = Json.createObjectBuilder(); |
|
333 |
jsonDataSet.add("name", this.name); |
|
334 |
jsonDataSet.add("fullName", this.fullName); |
|
335 |
|
|
336 |
return jsonDataSet; |
|
338 | 337 |
} |
339 | 338 |
|
340 | 339 |
@Override |
341 |
public void fromJSON(JSONObject json) {
|
|
340 |
public void fromJson(JsonObject json) {
|
|
342 | 341 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
343 | 342 |
this.name = json.getString("name"); |
344 | 343 |
this.fullName = null; |
345 |
if( json.has("fullName") ) {
|
|
344 |
if( json.containsKey("fullName") ) {
|
|
346 | 345 |
this.fullName = json.getString("fullName"); |
347 | 346 |
} |
348 | 347 |
this.store = null; |
... | ... | |
380 | 379 |
); |
381 | 380 |
final SpatialIndex dataIndex = theStore.wrapSpatialIndex(geomIndex); |
382 | 381 |
try { |
383 |
store.accept(new Visitor() { |
|
384 |
@Override |
|
385 |
public void visit(Object o) throws VisitCanceledException, BaseException { |
|
386 |
Feature f = (Feature) o; |
|
387 |
Geometry geom = f.getDefaultGeometry(); |
|
388 |
if (geom != null) { |
|
389 |
dataIndex.insert(geom, f); |
|
390 |
} |
|
382 |
store.accept((Object o) -> { |
|
383 |
Feature f = (Feature) o; |
|
384 |
Geometry geom = f.getDefaultGeometry(); |
|
385 |
if (geom != null) { |
|
386 |
dataIndex.insert(geom, f); |
|
391 | 387 |
} |
392 | 388 |
}); |
393 | 389 |
} catch (VisitCanceledException ex) { |
... | ... | |
440 | 436 |
} |
441 | 437 |
FeatureSet set = theStore.getFeatureSet(expression); |
442 | 438 |
final DisposableIterator it = set.fastIterator(); |
443 |
return new Iterable<FeatureReference>() {
|
|
439 |
return () -> new Iterator<FeatureReference>() {
|
|
444 | 440 |
@Override |
445 |
public Iterator<FeatureReference> iterator() { |
|
446 |
return new Iterator<FeatureReference>() { |
|
447 |
@Override |
|
448 |
public boolean hasNext() { |
|
449 |
return it.hasNext(); |
|
450 |
} |
|
451 |
|
|
452 |
@Override |
|
453 |
public FeatureReference next() { |
|
454 |
Feature f = (Feature) it.next(); |
|
455 |
return f.getReference(); |
|
456 |
} |
|
457 |
}; |
|
441 |
public boolean hasNext() { |
|
442 |
return it.hasNext(); |
|
458 | 443 |
} |
444 |
|
|
445 |
@Override |
|
446 |
public FeatureReference next() { |
|
447 |
Feature f = (Feature) it.next(); |
|
448 |
return f.getReference(); |
|
449 |
} |
|
459 | 450 |
}; |
460 | 451 |
|
461 | 452 |
} catch(Exception ex) { |
... | ... | |
466 | 457 |
if( it == null ) { |
467 | 458 |
return (Iterable<FeatureReference>) IteratorUtils.EMPTY_ITERATOR; |
468 | 459 |
} |
469 |
return new Iterable<FeatureReference>() { |
|
470 |
@Override |
|
471 |
public Iterator<FeatureReference> iterator() { |
|
472 |
return it; |
|
473 |
} |
|
474 |
}; |
|
460 |
return () -> it; |
|
475 | 461 |
} |
476 | 462 |
|
477 | 463 |
@Override |
... | ... | |
508 | 494 |
} |
509 | 495 |
FeatureSet set = theStore.getFeatureSet(expression); |
510 | 496 |
final DisposableIterator it = set.fastIterator(); |
511 |
return new Iterable<Feature>() { |
|
512 |
@Override |
|
513 |
public Iterator<Feature> iterator() { |
|
514 |
return it; |
|
515 |
} |
|
516 |
}; |
|
497 |
return () -> it; |
|
517 | 498 |
|
518 | 499 |
} catch(Exception ex) { |
519 | 500 |
return (Iterable<Feature>) IteratorUtils.EMPTY_ITERATOR; |
... | ... | |
523 | 504 |
if( it == null ) { |
524 | 505 |
return (Iterable<Feature>) IteratorUtils.EMPTY_ITERATOR; |
525 | 506 |
} |
526 |
return new Iterable<Feature>() {
|
|
507 |
return () -> new Iterator<Feature>() {
|
|
527 | 508 |
@Override |
528 |
public Iterator<Feature> iterator() { |
|
529 |
return new Iterator<Feature>() { |
|
530 |
@Override |
|
531 |
public boolean hasNext() { |
|
532 |
return it.hasNext(); |
|
533 |
} |
|
534 |
|
|
535 |
@Override |
|
536 |
public Feature next() { |
|
537 |
FeatureReference ref = (FeatureReference) it.next(); |
|
538 |
try { |
|
539 |
return ref.getFeature(); |
|
540 |
} catch (DataException ex) { |
|
541 |
return null; |
|
542 |
} |
|
543 |
} |
|
544 |
}; |
|
509 |
public boolean hasNext() { |
|
510 |
return it.hasNext(); |
|
545 | 511 |
} |
512 |
|
|
513 |
@Override |
|
514 |
public Feature next() { |
|
515 |
FeatureReference ref = (FeatureReference) it.next(); |
|
516 |
try { |
|
517 |
return ref.getFeature(); |
|
518 |
} catch (DataException ex) { |
|
519 |
return null; |
|
520 |
} |
|
521 |
} |
|
546 | 522 |
}; |
547 | 523 |
} |
548 | 524 |
|
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/CustomizableRuleFactory.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2021 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.rule; |
|
25 |
|
|
26 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
|
27 |
import org.gvsig.topology.lib.api.TopologyLocator; |
|
28 |
import org.gvsig.topology.lib.api.TopologyManager; |
|
29 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
30 |
import org.gvsig.topology.lib.api.TopologyRule; |
|
31 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleFactory; |
|
32 |
|
|
33 |
/** |
|
34 |
* |
|
35 |
* @author gvSIG Team |
|
36 |
*/ |
|
37 |
@SuppressWarnings("UseSpecificCatch") |
|
38 |
public class CustomizableRuleFactory extends AbstractTopologyRuleFactory { |
|
39 |
|
|
40 |
public static final String NAME = "Customizable"; |
|
41 |
|
|
42 |
public CustomizableRuleFactory() { |
|
43 |
super( |
|
44 |
NAME, |
|
45 |
"Customizable", |
|
46 |
"", |
|
47 |
null |
|
48 |
); |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public boolean canApplyToDataSet(TopologyDataSet dataSet) { |
|
53 |
return true; |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public boolean canApplyToSecondaryDataSet(TopologyDataSet dataSet) { |
|
58 |
return true; |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public TopologyRule createRule(TopologyPlan plan, String dataSet1, String dataSet2, double tolerance) { |
|
63 |
TopologyRule rule = new CustomizableRule(plan, this, tolerance, dataSet1, dataSet2); |
|
64 |
return rule; |
|
65 |
} |
|
66 |
|
|
67 |
public static void selfRegister() { |
|
68 |
try { |
|
69 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
|
70 |
manager.addRuleFactories(new CustomizableRuleFactory()); |
|
71 |
} catch(Exception ex) { |
|
72 |
LOGGER.warn("Can't register topology rule from "+CustomizableRuleFactory.class.getSimpleName(), ex); |
|
73 |
} |
|
74 |
} |
|
75 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/CustomizableRule.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2021 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.rule; |
|
25 |
|
|
26 |
import org.gvsig.expressionevaluator.Expression; |
|
27 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
|
28 |
import org.gvsig.expressionevaluator.MutableSymbolTable; |
|
29 |
import org.gvsig.fmap.dal.feature.Feature; |
|
30 |
import org.gvsig.tools.dynobject.DynObject; |
|
31 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
32 |
import org.gvsig.topology.lib.api.ExecuteTopologyRuleActionException; |
|
33 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
34 |
import org.gvsig.topology.lib.api.TopologyReport; |
|
35 |
import org.gvsig.topology.lib.api.TopologyReportLine; |
|
36 |
import org.gvsig.topology.lib.api.TopologyRule; |
|
37 |
import org.gvsig.topology.lib.api.TopologyRuleFactory; |
|
38 |
import org.gvsig.topology.lib.spi.AbstractTopologyRule; |
|
39 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleAction; |
|
40 |
import org.gvsig.topology.lib.api.TopologyCustomizableRule; |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
* @author gvSIG Team |
|
45 |
*/ |
|
46 |
@SuppressWarnings("UseSpecificCatch") |
|
47 |
public class CustomizableRule |
|
48 |
extends AbstractTopologyRule |
|
49 |
implements TopologyCustomizableRule |
|
50 |
{ |
|
51 |
|
|
52 |
private static class CustomizableActionImpl |
|
53 |
extends AbstractTopologyRuleAction |
|
54 |
implements TopologyCustomizableRuleAction |
|
55 |
{ |
|
56 |
|
|
57 |
protected Expression action; |
|
58 |
protected MutableSymbolTable symbolTable; |
|
59 |
|
|
60 |
public CustomizableActionImpl() { |
|
61 |
super(CustomizableRuleFactory.NAME); |
|
62 |
} |
|
63 |
|
|
64 |
@Override |
|
65 |
public Expression getAction() { |
|
66 |
return this.action; |
|
67 |
} |
|
68 |
|
|
69 |
@Override |
|
70 |
public void setAction(Expression action) { |
|
71 |
this.action = action; |
|
72 |
} |
|
73 |
|
|
74 |
@Override |
|
75 |
public void setId(String id) { |
|
76 |
this.idAction = id; |
|
77 |
} |
|
78 |
|
|
79 |
@Override |
|
80 |
public void setName(String name) { |
|
81 |
this.name = name; |
|
82 |
} |
|
83 |
|
|
84 |
@Override |
|
85 |
public void setShortDescription(String description) { |
|
86 |
this.shortDescription = description; |
|
87 |
} |
|
88 |
|
|
89 |
@Override |
|
90 |
public MutableSymbolTable getSymbolTable() { |
|
91 |
if (this.symbolTable == null) { |
|
92 |
this.symbolTable = ExpressionUtils.createSymbolTable(); |
|
93 |
} |
|
94 |
return this.symbolTable; |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
public int execute(TopologyRule rule, TopologyReportLine line, DynObject parameters) throws ExecuteTopologyRuleActionException { |
|
99 |
MutableSymbolTable st = this.getSymbolTable(); |
|
100 |
st.setVar("rute", rule); |
|
101 |
st.setVar("line", line); |
|
102 |
st.setVar("parameters", parameters); |
|
103 |
this.action.execute(symbolTable); |
|
104 |
return EXECUTE_OK; |
|
105 |
} |
|
106 |
|
|
107 |
|
|
108 |
} |
|
109 |
|
|
110 |
protected Expression check; |
|
111 |
protected MutableSymbolTable symbolTable; |
|
112 |
|
|
113 |
public CustomizableRule( |
|
114 |
TopologyPlan plan, |
|
115 |
TopologyRuleFactory factory, |
|
116 |
double tolerance, |
|
117 |
String dataSet1, |
|
118 |
String dataSet2 |
|
119 |
) { |
|
120 |
super(plan, factory, tolerance, dataSet1, dataSet2); |
|
121 |
} |
|
122 |
|
|
123 |
@Override |
|
124 |
public void setCheck(Expression check) { |
|
125 |
this.check = check; |
|
126 |
} |
|
127 |
|
|
128 |
@Override |
|
129 |
public Expression getCheck() { |
|
130 |
return this.check; |
|
131 |
} |
|
132 |
|
|
133 |
@Override |
|
134 |
public TopologyCustomizableRuleAction createAction() { |
|
135 |
CustomizableActionImpl action = new CustomizableActionImpl(); |
|
136 |
return action; |
|
137 |
} |
|
138 |
|
|
139 |
@Override |
|
140 |
public MutableSymbolTable getSymbolTable() { |
|
141 |
if (this.symbolTable == null) { |
|
142 |
this.symbolTable = ExpressionUtils.createSymbolTable(); |
|
143 |
} |
|
144 |
return this.symbolTable; |
|
145 |
} |
|
146 |
|
|
147 |
@Override |
|
148 |
protected void check(SimpleTaskStatus taskStatus, TopologyReport report, Feature feature1) throws Exception { |
|
149 |
MutableSymbolTable st = this.getSymbolTable(); |
|
150 |
st.setVar("taskStatus", taskStatus); |
|
151 |
st.setVar("report", report); |
|
152 |
st.setVar("feature1", feature1); |
|
153 |
this.check.execute(st); |
|
154 |
} |
|
155 |
|
|
156 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PolygonMustNotOverlapWithPolygonRule.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
40 | 40 |
import org.gvsig.tools.task.SimpleTaskStatus; |
41 | 41 |
import org.gvsig.topology.lib.api.ExecuteTopologyRuleActionException; |
42 | 42 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
43 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
44 | 43 |
import org.gvsig.topology.lib.api.TopologyReport; |
45 | 44 |
import org.gvsig.topology.lib.api.TopologyReportLine; |
46 | 45 |
import org.gvsig.topology.lib.api.TopologyRule; |
... | ... | |
127 | 126 |
private GeometryExpressionBuilder expressionBuilder = null; |
128 | 127 |
|
129 | 128 |
public PolygonMustNotOverlapWithPolygonRule( |
130 |
TopologyPlan plan, |
|
131 | 129 |
TopologyRuleFactory factory, |
132 | 130 |
double tolerance, |
133 | 131 |
String dataSet1, |
134 | 132 |
String dataSet2 |
135 | 133 |
) { |
136 |
super(plan, factory, tolerance, dataSet1, dataSet2);
|
|
134 |
super(factory, tolerance, dataSet1, dataSet2); |
|
137 | 135 |
this.addAction(new MergeAction()); |
138 | 136 |
this.addAction(new SubtractAction()); |
139 | 137 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/GeometryMustNotBeNullRuleFactory.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
24 | 24 |
package org.gvsig.topology.rule; |
25 | 25 |
|
26 | 26 |
import org.gvsig.fmap.geom.Geometry; |
27 |
import org.gvsig.json.Json; |
|
27 | 28 |
import org.gvsig.tools.util.ListBuilder; |
28 | 29 |
import org.gvsig.topology.lib.api.TopologyLocator; |
29 | 30 |
import org.gvsig.topology.lib.api.TopologyManager; |
30 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
31 | 31 |
import org.gvsig.topology.lib.api.TopologyRule; |
32 | 32 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleFactory; |
33 | 33 |
|
... | ... | |
53 | 53 |
} |
54 | 54 |
|
55 | 55 |
@Override |
56 |
public TopologyRule createRule(TopologyPlan plan, String dataSet1, String dataSet2, double tolerance) {
|
|
57 |
TopologyRule rule = new GeometryMustNotBeNullRule(plan, this, tolerance, dataSet1, dataSet2);
|
|
56 |
public TopologyRule createRule(String dataSet1, String dataSet2, double tolerance) { |
|
57 |
TopologyRule rule = new GeometryMustNotBeNullRule(this, tolerance, dataSet1, dataSet2); |
|
58 | 58 |
return rule; |
59 | 59 |
} |
60 | 60 |
|
... | ... | |
63 | 63 |
try { |
64 | 64 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
65 | 65 |
manager.addRuleFactories(new GeometryMustNotBeNullRuleFactory()); |
66 |
Json.registerSerializer(GeometryMustNotBeNullRule.class); |
|
66 | 67 |
} catch(Exception ex) { |
67 | 68 |
LOGGER.warn("Can't register topology rule from GeometryMustNotBeNullRuleFactory.", ex); |
68 | 69 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PolygonMustBeCoveredByPolygonRule.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
39 | 39 |
import org.gvsig.tools.task.SimpleTaskStatus; |
40 | 40 |
import org.gvsig.topology.lib.api.ExecuteTopologyRuleActionException; |
41 | 41 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
42 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
43 | 42 |
import org.gvsig.topology.lib.api.TopologyReport; |
44 | 43 |
import org.gvsig.topology.lib.api.TopologyReportLine; |
45 | 44 |
import org.gvsig.topology.lib.api.TopologyRule; |
... | ... | |
87 | 86 |
private GeometryExpressionBuilder expressionBuilder = null; |
88 | 87 |
|
89 | 88 |
public PolygonMustBeCoveredByPolygonRule( |
90 |
TopologyPlan plan, |
|
91 | 89 |
TopologyRuleFactory factory, |
92 | 90 |
double tolerance, |
93 | 91 |
String dataSet1, |
94 | 92 |
String dataSet2 |
95 | 93 |
) { |
96 |
super(plan, factory, tolerance, dataSet1, dataSet2);
|
|
94 |
super(factory, tolerance, dataSet1, dataSet2); |
|
97 | 95 |
|
98 | 96 |
addAction(new CreateFetureAction()); |
99 | 97 |
|
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PolygonMustNotOverlapPolygonRule.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
40 | 40 |
import org.gvsig.tools.task.SimpleTaskStatus; |
41 | 41 |
import org.gvsig.topology.lib.api.ExecuteTopologyRuleActionException; |
42 | 42 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
43 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
44 | 43 |
import org.gvsig.topology.lib.api.TopologyReport; |
45 | 44 |
import org.gvsig.topology.lib.api.TopologyReportLine; |
46 | 45 |
import org.gvsig.topology.lib.api.TopologyRule; |
... | ... | |
182 | 181 |
private GeometryExpressionBuilder expressionBuilder = null; |
183 | 182 |
|
184 | 183 |
public PolygonMustNotOverlapPolygonRule( |
185 |
TopologyPlan plan, |
|
186 | 184 |
TopologyRuleFactory factory, |
187 | 185 |
double tolerance, |
188 | 186 |
String dataSet1 |
189 | 187 |
) { |
190 |
super(plan, factory, tolerance, dataSet1);
|
|
188 |
super(factory, tolerance, dataSet1); |
|
191 | 189 |
this.addAction(new CreateFetureAction()); |
192 | 190 |
this.addAction(new MergeAction()); |
193 | 191 |
this.addAction(new SubtractAction()); |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PolygonContainsPolygonRuleFactory.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
24 | 24 |
package org.gvsig.topology.rule; |
25 | 25 |
|
26 | 26 |
import org.gvsig.fmap.geom.Geometry; |
27 |
import org.gvsig.json.Json; |
|
27 | 28 |
import org.gvsig.tools.util.ListBuilder; |
28 | 29 |
import org.gvsig.topology.lib.api.TopologyLocator; |
29 | 30 |
import org.gvsig.topology.lib.api.TopologyManager; |
30 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
31 | 31 |
import org.gvsig.topology.lib.api.TopologyRule; |
32 | 32 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleFactory; |
33 | 33 |
|
... | ... | |
57 | 57 |
} |
58 | 58 |
|
59 | 59 |
@Override |
60 |
public TopologyRule createRule(TopologyPlan plan, String dataSet1, String dataSet2, double tolerance) {
|
|
61 |
TopologyRule rule = new PolygonContainsPolygonRule(plan, this, tolerance, dataSet1, dataSet2);
|
|
60 |
public TopologyRule createRule(String dataSet1, String dataSet2, double tolerance) { |
|
61 |
TopologyRule rule = new PolygonContainsPolygonRule(this, tolerance, dataSet1, dataSet2); |
|
62 | 62 |
return rule; |
63 | 63 |
} |
64 | 64 |
|
... | ... | |
66 | 66 |
try { |
67 | 67 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
68 | 68 |
manager.addRuleFactories(new PolygonContainsPolygonRuleFactory()); |
69 |
Json.registerSerializer(PolygonContainsPolygonRule.class); |
|
69 | 70 |
} catch(Exception ex) { |
70 | 71 |
LOGGER.warn("Can't register topology rule from "+PolygonContainsPolygonRuleFactory.class.getSimpleName(), ex); |
71 | 72 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/GeometryMustNotBeNullRule.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
28 | 28 |
import org.gvsig.tools.ToolsLocator; |
29 | 29 |
import org.gvsig.tools.i18n.I18nManager; |
30 | 30 |
import org.gvsig.tools.task.SimpleTaskStatus; |
31 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
32 | 31 |
import org.gvsig.topology.lib.api.TopologyReport; |
33 | 32 |
import org.gvsig.topology.lib.api.TopologyRuleFactory; |
34 | 33 |
import org.gvsig.topology.lib.spi.AbstractTopologyRule; |
... | ... | |
40 | 39 |
@SuppressWarnings("UseSpecificCatch") |
41 | 40 |
public class GeometryMustNotBeNullRule extends AbstractTopologyRule { |
42 | 41 |
|
42 |
public GeometryMustNotBeNullRule() { |
|
43 |
|
|
44 |
} |
|
45 |
|
|
43 | 46 |
public GeometryMustNotBeNullRule( |
44 |
TopologyPlan plan, |
|
45 | 47 |
TopologyRuleFactory factory, |
46 | 48 |
double tolerance, |
47 | 49 |
String dataSet1, |
48 | 50 |
String dataSet2 |
49 | 51 |
) { |
50 |
super(plan, factory, tolerance, dataSet1, dataSet2);
|
|
52 |
super(factory, tolerance, dataSet1, dataSet2); |
|
51 | 53 |
} |
52 | 54 |
|
53 | 55 |
@Override |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PolygonContainsPointRuleFactory.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
24 | 24 |
package org.gvsig.topology.rule; |
25 | 25 |
|
26 | 26 |
import org.gvsig.fmap.geom.Geometry; |
27 |
import org.gvsig.json.Json; |
|
27 | 28 |
import org.gvsig.tools.util.ListBuilder; |
28 | 29 |
import org.gvsig.topology.lib.api.TopologyLocator; |
29 | 30 |
import org.gvsig.topology.lib.api.TopologyManager; |
30 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
31 | 31 |
import org.gvsig.topology.lib.api.TopologyRule; |
32 | 32 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleFactory; |
33 | 33 |
|
... | ... | |
56 | 56 |
} |
57 | 57 |
|
58 | 58 |
@Override |
59 |
public TopologyRule createRule(TopologyPlan plan, String dataSet1, String dataSet2, double tolerance) {
|
|
60 |
TopologyRule rule = new PolygonContainsPointRule(plan, this, tolerance, dataSet1, dataSet2);
|
|
59 |
public TopologyRule createRule(String dataSet1, String dataSet2, double tolerance) { |
|
60 |
TopologyRule rule = new PolygonContainsPointRule(this, tolerance, dataSet1, dataSet2); |
|
61 | 61 |
return rule; |
62 | 62 |
} |
63 | 63 |
|
... | ... | |
65 | 65 |
try { |
66 | 66 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
67 | 67 |
manager.addRuleFactories(new PolygonContainsPointRuleFactory()); |
68 |
Json.registerSerializer(PolygonContainsPointRule.class); |
|
68 | 69 |
} catch(Exception ex) { |
69 | 70 |
LOGGER.warn("Can't register topology rule from "+PolygonContainsPointRuleFactory.class.getSimpleName(), ex); |
70 | 71 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PolygonContainsOnePointRuleFactory.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
24 | 24 |
package org.gvsig.topology.rule; |
25 | 25 |
|
26 | 26 |
import org.gvsig.fmap.geom.Geometry; |
27 |
import org.gvsig.json.Json; |
|
27 | 28 |
import org.gvsig.tools.util.ListBuilder; |
28 | 29 |
import org.gvsig.topology.lib.api.TopologyLocator; |
29 | 30 |
import org.gvsig.topology.lib.api.TopologyManager; |
30 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
31 | 31 |
import org.gvsig.topology.lib.api.TopologyRule; |
32 | 32 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleFactory; |
33 | 33 |
|
... | ... | |
56 | 56 |
} |
57 | 57 |
|
58 | 58 |
@Override |
59 |
public TopologyRule createRule(TopologyPlan plan, String dataSet1, String dataSet2, double tolerance) {
|
|
60 |
TopologyRule rule = new PolygonContainsOnePointRule(plan, this, tolerance, dataSet1, dataSet2);
|
|
59 |
public TopologyRule createRule(String dataSet1, String dataSet2, double tolerance) { |
|
60 |
TopologyRule rule = new PolygonContainsOnePointRule(this, tolerance, dataSet1, dataSet2); |
|
61 | 61 |
return rule; |
62 | 62 |
} |
63 | 63 |
|
... | ... | |
65 | 65 |
try { |
66 | 66 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
67 | 67 |
manager.addRuleFactories(new PolygonContainsOnePointRuleFactory()); |
68 |
Json.registerSerializer(PolygonContainsOnePointRule.class); |
|
68 | 69 |
} catch(Exception ex) { |
69 | 70 |
LOGGER.warn("Can't register topology rule from "+PolygonContainsOnePointRuleFactory.class.getSimpleName(), ex); |
70 | 71 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PolygonContainsPolygonRule.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
36 | 36 |
import org.gvsig.tools.i18n.I18nManager; |
37 | 37 |
import org.gvsig.tools.task.SimpleTaskStatus; |
38 | 38 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
39 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
40 | 39 |
import org.gvsig.topology.lib.api.TopologyReport; |
41 | 40 |
import org.gvsig.topology.lib.api.TopologyRuleFactory; |
42 | 41 |
import org.gvsig.topology.lib.spi.AbstractTopologyRule; |
... | ... | |
53 | 52 |
private GeometryExpressionBuilder expressionBuilder = null; |
54 | 53 |
|
55 | 54 |
public PolygonContainsPolygonRule( |
56 |
TopologyPlan plan, |
|
57 | 55 |
TopologyRuleFactory factory, |
58 | 56 |
double tolerance, |
59 | 57 |
String dataSet1, |
60 | 58 |
String dataSet2 |
61 | 59 |
) { |
62 |
super(plan, factory, tolerance, dataSet1, dataSet2);
|
|
60 |
super(factory, tolerance, dataSet1, dataSet2); |
|
63 | 61 |
|
64 | 62 |
} |
65 | 63 |
|
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PolygonContainsPointRule.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
40 | 40 |
import org.gvsig.tools.task.SimpleTaskStatus; |
41 | 41 |
import org.gvsig.topology.lib.api.ExecuteTopologyRuleActionException; |
42 | 42 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
43 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
44 | 43 |
import org.gvsig.topology.lib.api.TopologyReport; |
45 | 44 |
import org.gvsig.topology.lib.api.TopologyReportLine; |
46 | 45 |
import org.gvsig.topology.lib.api.TopologyRule; |
... | ... | |
93 | 92 |
private GeometryExpressionBuilder expressionBuilder = null; |
94 | 93 |
|
95 | 94 |
public PolygonContainsPointRule( |
96 |
TopologyPlan plan, |
|
97 | 95 |
TopologyRuleFactory factory, |
98 | 96 |
double tolerance, |
99 | 97 |
String dataSet1, |
100 | 98 |
String dataSet2 |
101 | 99 |
) { |
102 |
super(plan, factory, tolerance, dataSet1, dataSet2);
|
|
100 |
super(factory, tolerance, dataSet1, dataSet2); |
|
103 | 101 |
|
104 | 102 |
this.addAction(new CreateFetureAction()); |
105 | 103 |
} |
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 | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
24 | 24 |
package org.gvsig.topology.rule; |
25 | 25 |
|
26 | 26 |
import org.gvsig.fmap.geom.Geometry; |
27 |
import org.gvsig.json.Json; |
|
27 | 28 |
import org.gvsig.tools.util.ListBuilder; |
28 | 29 |
import org.gvsig.topology.lib.api.TopologyLocator; |
29 | 30 |
import org.gvsig.topology.lib.api.TopologyManager; |
30 | 31 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleFactory; |
31 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
32 | 32 |
import org.gvsig.topology.lib.api.TopologyRule; |
33 | 33 |
|
34 | 34 |
/** |
... | ... | |
56 | 56 |
} |
57 | 57 |
|
58 | 58 |
@Override |
59 |
public TopologyRule createRule(TopologyPlan plan, String dataSet1, String dataSet2, double tolerance) {
|
|
60 |
TopologyRule rule = new PointMustBeProperlyInsidePolygonRule(plan, this, tolerance, dataSet1, dataSet2);
|
|
59 |
public TopologyRule createRule(String dataSet1, String dataSet2, double tolerance) { |
|
60 |
TopologyRule rule = new PointMustBeProperlyInsidePolygonRule(this, tolerance, dataSet1, dataSet2); |
|
61 | 61 |
return rule; |
62 | 62 |
} |
63 | 63 |
|
... | ... | |
65 | 65 |
try { |
66 | 66 |
TopologyManager manager = TopologyLocator.getTopologyManager(); |
67 | 67 |
manager.addRuleFactories(new PointMustBeProperlyInsidePolygonRuleFactory()); |
68 |
Json.registerSerializer(PointMustBeProperlyInsidePolygonRule.class); |
|
68 | 69 |
} catch(Exception ex) { |
69 | 70 |
LOGGER.warn("Can't register topology rule from PointMustBeProperlyInsidePolygonRuleFactory.", ex); |
70 | 71 |
} |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/PolygonContainsOnePointRule.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
33 | 33 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
34 | 34 |
import org.gvsig.fmap.geom.Geometry; |
35 | 35 |
import org.gvsig.tools.ToolsLocator; |
36 |
import org.gvsig.tools.exception.BaseException; |
|
37 | 36 |
import org.gvsig.tools.i18n.I18nManager; |
38 | 37 |
import org.gvsig.tools.task.SimpleTaskStatus; |
39 | 38 |
import org.gvsig.tools.visitor.VisitCanceledException; |
40 |
import org.gvsig.tools.visitor.Visitor; |
|
41 | 39 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
42 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
43 | 40 |
import org.gvsig.topology.lib.api.TopologyReport; |
44 | 41 |
import org.gvsig.topology.lib.api.TopologyRuleFactory; |
45 | 42 |
import org.gvsig.topology.lib.spi.AbstractTopologyRule; |
... | ... | |
56 | 53 |
private GeometryExpressionBuilder expressionBuilder = null; |
57 | 54 |
|
58 | 55 |
public PolygonContainsOnePointRule( |
59 |
TopologyPlan plan, |
|
60 | 56 |
TopologyRuleFactory factory, |
61 | 57 |
double tolerance, |
62 | 58 |
String dataSet1, |
63 | 59 |
String dataSet2 |
64 | 60 |
) { |
65 |
super(plan, factory, tolerance, dataSet1, dataSet2);
|
|
61 |
super(factory, tolerance, dataSet1, dataSet2); |
|
66 | 62 |
} |
67 | 63 |
|
68 | 64 |
@Override |
... | ... | |
73 | 69 |
@Override |
74 | 70 |
public void execute(final SimpleTaskStatus taskStatus, final TopologyReport report) { |
75 | 71 |
try { |
76 |
this.getDataSet1().accept(new Visitor() { |
|
77 |
@Override |
|
78 |
public void visit(final Object o1) throws VisitCanceledException, BaseException { |
|
79 |
if (taskStatus.isCancellationRequested()) { |
|
80 |
throw new VisitCanceledException(); |
|
81 |
} |
|
82 |
taskStatus.incrementCurrentValue(); |
|
83 |
try { |
|
84 |
check(taskStatus, report, (Feature) o1); |
|
85 |
} catch (Exception ex) { |
|
86 |
throw new RuntimeException(ex); |
|
87 |
} |
|
72 |
this.getDataSet1().accept((final Object o1) -> { |
|
73 |
if (taskStatus.isCancellationRequested()) { |
|
74 |
throw new VisitCanceledException(); |
|
88 | 75 |
} |
76 |
taskStatus.incrementCurrentValue(); |
|
77 |
try { |
|
78 |
check(taskStatus, report, (Feature) o1); |
|
79 |
} catch (Exception ex) { |
|
80 |
throw new RuntimeException(ex); |
|
81 |
} |
|
89 | 82 |
}); |
90 |
this.getDataSet2().accept(new Visitor() { |
|
91 |
@Override |
|
92 |
public void visit(final Object o1) throws VisitCanceledException, BaseException { |
|
93 |
if (taskStatus.isCancellationRequested()) { |
|
94 |
throw new VisitCanceledException(); |
|
95 |
} |
|
96 |
taskStatus.incrementCurrentValue(); |
|
97 |
try { |
|
98 |
check2(taskStatus, report, (Feature) o1); |
|
99 |
} catch (Exception ex) { |
|
100 |
throw new RuntimeException(ex); |
|
101 |
} |
|
83 |
this.getDataSet2().accept((final Object o1) -> { |
|
84 |
if (taskStatus.isCancellationRequested()) { |
|
85 |
throw new VisitCanceledException(); |
|
102 | 86 |
} |
87 |
taskStatus.incrementCurrentValue(); |
|
88 |
try { |
|
89 |
check2(taskStatus, report, (Feature) o1); |
|
90 |
} catch (Exception ex) { |
|
91 |
throw new RuntimeException(ex); |
|
92 |
} |
|
103 | 93 |
}); |
104 | 94 |
} catch (VisitCanceledException ex) { |
105 | 95 |
// return; |
org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/rule/LineMustBeCoveredByBoundaryOfPolygonRuleFactory.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
24 | 24 |
package org.gvsig.topology.rule; |
25 | 25 |
|
26 | 26 |
import org.gvsig.fmap.geom.Geometry; |
27 |
import org.gvsig.json.Json; |
|
27 | 28 |
import org.gvsig.tools.util.ListBuilder; |
28 | 29 |
import org.gvsig.topology.lib.api.TopologyLocator; |
29 | 30 |
import org.gvsig.topology.lib.api.TopologyManager; |
30 |
import org.gvsig.topology.lib.api.TopologyPlan; |
|
31 | 31 |
import org.gvsig.topology.lib.api.TopologyRule; |
32 | 32 |
import org.gvsig.topology.lib.spi.AbstractTopologyRuleFactory; |
33 | 33 |
|
... | ... | |
57 | 57 |
} |
58 | 58 |
|
59 | 59 |
@Override |
Also available in: Unified diff