Revision 727 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
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, |
Also available in: Unified diff