Revision 26438
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OverlapsGeometryEvaluator.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.layers.vectorial; |
|
2 |
|
|
3 |
import org.cresques.cts.ICoordTrans; |
|
4 |
import org.cresques.cts.IProjection; |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
|
6 |
import org.gvsig.fmap.dal.feature.Feature; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
9 |
import org.gvsig.fmap.geom.Geometry; |
|
10 |
import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext; |
|
11 |
import org.gvsig.fmap.geom.operation.relationship.Equals; |
|
12 |
import org.gvsig.fmap.geom.operation.relationship.Overlaps; |
|
13 |
import org.gvsig.tools.evaluator.AbstractEvaluator; |
|
14 |
import org.gvsig.tools.evaluator.EvaluatorData; |
|
15 |
import org.gvsig.tools.evaluator.EvaluatorException; |
|
16 |
/** |
|
17 |
* |
|
18 |
* @author Vicente Caballero Navarro |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class OverlapsGeometryEvaluator extends AbstractEvaluator { |
|
22 |
|
|
23 |
private String geomName; |
|
24 |
private Geometry geometry; |
|
25 |
private Geometry geometryTrans; |
|
26 |
private String srs; |
|
27 |
private boolean isDefault; |
|
28 |
|
|
29 |
public OverlapsGeometryEvaluator(Geometry geometry, |
|
30 |
IProjection envelopeProjection, FeatureType featureType, |
|
31 |
String geomName) { |
|
32 |
FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType |
|
33 |
.get(geomName); |
|
34 |
this.isDefault = featureType.getDefaultGeometryAttributeName().equals( |
|
35 |
geomName); |
|
36 |
this.geometry = geometry; |
|
37 |
this.geometryTrans = geometry.cloneGeometry(); |
|
38 |
this.srs = envelopeProjection.getAbrev(); |
|
39 |
ICoordTrans ct = envelopeProjection.getCT(CRSFactory.getCRS(fad |
|
40 |
.getSRS())); |
|
41 |
if (ct != null) { |
|
42 |
geometryTrans.reProject(ct); |
|
43 |
} |
|
44 |
this.geomName = geomName; |
|
45 |
|
|
46 |
this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans); |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public Object evaluate(EvaluatorData data) throws EvaluatorException { |
|
51 |
try { |
|
52 |
DefaultRelationshipGeometryOperationContext context; |
|
53 |
if (isDefault) { |
|
54 |
Feature feature = (Feature) data.getContextValue("feature"); |
|
55 |
context =new DefaultRelationshipGeometryOperationContext(feature |
|
56 |
.getDefaultGeometry()); |
|
57 |
|
|
58 |
} else { |
|
59 |
Geometry geom = (Geometry) data.getDataValue(geomName); |
|
60 |
|
|
61 |
context = new DefaultRelationshipGeometryOperationContext(geom); |
|
62 |
} |
|
63 |
return geometryTrans.invokeOperation(Overlaps.CODE, context); |
|
64 |
|
|
65 |
} catch (Exception e) { |
|
66 |
throw new EvaluatorException(e); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public String getName() { |
|
71 |
return "overlaps with geometry"; |
|
72 |
} |
|
73 |
|
|
74 |
public String getCQL() { |
|
75 |
return " overlaps(GeomFromText('" + geometry.toString() + "', " + "'" |
|
76 |
+ srs + "'" + "), " + geomName + ") "; |
|
77 |
} |
|
78 |
|
|
79 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsGeometryEvaluator.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.layers.vectorial; |
|
2 |
|
|
3 |
import org.cresques.cts.ICoordTrans; |
|
4 |
import org.cresques.cts.IProjection; |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
|
6 |
import org.gvsig.fmap.dal.feature.Feature; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
9 |
import org.gvsig.fmap.geom.Geometry; |
|
10 |
import org.gvsig.fmap.geom.operation.relationship.Contains; |
|
11 |
import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext; |
|
12 |
import org.gvsig.fmap.geom.operation.relationship.Equals; |
|
13 |
import org.gvsig.tools.evaluator.AbstractEvaluator; |
|
14 |
import org.gvsig.tools.evaluator.EvaluatorData; |
|
15 |
import org.gvsig.tools.evaluator.EvaluatorException; |
|
16 |
/** |
|
17 |
* |
|
18 |
* @author Vicente Caballero Navarro |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class ContainsGeometryEvaluator extends AbstractEvaluator { |
|
22 |
|
|
23 |
private String geomName; |
|
24 |
private Geometry geometry; |
|
25 |
private Geometry geometryTrans; |
|
26 |
private String srs; |
|
27 |
private boolean isDefault; |
|
28 |
|
|
29 |
public ContainsGeometryEvaluator(Geometry geometry, |
|
30 |
IProjection envelopeProjection, FeatureType featureType, |
|
31 |
String geomName) { |
|
32 |
FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType |
|
33 |
.get(geomName); |
|
34 |
this.isDefault = featureType.getDefaultGeometryAttributeName().equals( |
|
35 |
geomName); |
|
36 |
this.geometry = geometry; |
|
37 |
this.geometryTrans = geometry.cloneGeometry(); |
|
38 |
this.srs = envelopeProjection.getAbrev(); |
|
39 |
ICoordTrans ct = envelopeProjection.getCT(CRSFactory.getCRS(fad |
|
40 |
.getSRS())); |
|
41 |
if (ct != null) { |
|
42 |
geometryTrans.reProject(ct); |
|
43 |
} |
|
44 |
this.geomName = geomName; |
|
45 |
|
|
46 |
this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans); |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public Object evaluate(EvaluatorData data) throws EvaluatorException { |
|
51 |
try { |
|
52 |
DefaultRelationshipGeometryOperationContext context; |
|
53 |
if (isDefault) { |
|
54 |
Feature feature = (Feature) data.getContextValue("feature"); |
|
55 |
context =new DefaultRelationshipGeometryOperationContext(feature |
|
56 |
.getDefaultGeometry()); |
|
57 |
|
|
58 |
} else { |
|
59 |
Geometry geom = (Geometry) data.getDataValue(geomName); |
|
60 |
|
|
61 |
context = new DefaultRelationshipGeometryOperationContext(geom); |
|
62 |
} |
|
63 |
return geometryTrans.invokeOperation(Contains.CODE, context); |
|
64 |
|
|
65 |
} catch (Exception e) { |
|
66 |
throw new EvaluatorException(e); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public String getName() { |
|
71 |
return "contains with geometry"; |
|
72 |
} |
|
73 |
|
|
74 |
public String getCQL() { |
|
75 |
return " contains(GeomFromText('" + geometry.toString() + "', " + "'" |
|
76 |
+ srs + "'" + "), " + geomName + ") "; |
|
77 |
} |
|
78 |
|
|
79 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java | ||
---|---|---|
391 | 391 |
} |
392 | 392 |
Point2D offset = viewPort.getOffset(); |
393 | 393 |
|
394 |
|
|
395 |
|
|
396 | 394 |
if (bDrawShapes) { |
397 | 395 |
if (cancel.isCanceled()) { |
398 | 396 |
return; |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossesGeometryEvaluator.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.layers.vectorial; |
|
2 |
|
|
3 |
import org.cresques.cts.ICoordTrans; |
|
4 |
import org.cresques.cts.IProjection; |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
|
6 |
import org.gvsig.fmap.dal.feature.Feature; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
9 |
import org.gvsig.fmap.geom.Geometry; |
|
10 |
import org.gvsig.fmap.geom.operation.relationship.Crosses; |
|
11 |
import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext; |
|
12 |
import org.gvsig.fmap.geom.operation.relationship.Equals; |
|
13 |
import org.gvsig.tools.evaluator.AbstractEvaluator; |
|
14 |
import org.gvsig.tools.evaluator.EvaluatorData; |
|
15 |
import org.gvsig.tools.evaluator.EvaluatorException; |
|
16 |
/** |
|
17 |
* |
|
18 |
* @author Vicente Caballero Navarro |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class CrossesGeometryEvaluator extends AbstractEvaluator { |
|
22 |
|
|
23 |
private String geomName; |
|
24 |
private Geometry geometry; |
|
25 |
private Geometry geometryTrans; |
|
26 |
private String srs; |
|
27 |
private boolean isDefault; |
|
28 |
|
|
29 |
public CrossesGeometryEvaluator(Geometry geometry, |
|
30 |
IProjection envelopeProjection, FeatureType featureType, |
|
31 |
String geomName) { |
|
32 |
FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType |
|
33 |
.get(geomName); |
|
34 |
this.isDefault = featureType.getDefaultGeometryAttributeName().equals( |
|
35 |
geomName); |
|
36 |
this.geometry = geometry; |
|
37 |
this.geometryTrans = geometry.cloneGeometry(); |
|
38 |
this.srs = envelopeProjection.getAbrev(); |
|
39 |
ICoordTrans ct = envelopeProjection.getCT(CRSFactory.getCRS(fad |
|
40 |
.getSRS())); |
|
41 |
if (ct != null) { |
|
42 |
geometryTrans.reProject(ct); |
|
43 |
} |
|
44 |
this.geomName = geomName; |
|
45 |
|
|
46 |
this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans); |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public Object evaluate(EvaluatorData data) throws EvaluatorException { |
|
51 |
try { |
|
52 |
DefaultRelationshipGeometryOperationContext context; |
|
53 |
if (isDefault) { |
|
54 |
Feature feature = (Feature) data.getContextValue("feature"); |
|
55 |
context =new DefaultRelationshipGeometryOperationContext(feature |
|
56 |
.getDefaultGeometry()); |
|
57 |
|
|
58 |
} else { |
|
59 |
Geometry geom = (Geometry) data.getDataValue(geomName); |
|
60 |
|
|
61 |
context = new DefaultRelationshipGeometryOperationContext(geom); |
|
62 |
} |
|
63 |
return geometryTrans.invokeOperation(Crosses.CODE, context); |
|
64 |
|
|
65 |
} catch (Exception e) { |
|
66 |
throw new EvaluatorException(e); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public String getName() { |
|
71 |
return "crosses with geometry"; |
|
72 |
} |
|
73 |
|
|
74 |
public String getCQL() { |
|
75 |
return " crosses(GeomFromText('" + geometry.toString() + "', " + "'" |
|
76 |
+ srs + "'" + "), " + geomName + ") "; |
|
77 |
} |
|
78 |
|
|
79 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/WithinGeometryEvaluator.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.layers.vectorial; |
|
2 |
|
|
3 |
import org.cresques.cts.ICoordTrans; |
|
4 |
import org.cresques.cts.IProjection; |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
|
6 |
import org.gvsig.fmap.dal.feature.Feature; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
9 |
import org.gvsig.fmap.geom.Geometry; |
|
10 |
import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext; |
|
11 |
import org.gvsig.fmap.geom.operation.relationship.Equals; |
|
12 |
import org.gvsig.fmap.geom.operation.relationship.Within; |
|
13 |
import org.gvsig.tools.evaluator.AbstractEvaluator; |
|
14 |
import org.gvsig.tools.evaluator.EvaluatorData; |
|
15 |
import org.gvsig.tools.evaluator.EvaluatorException; |
|
16 |
/** |
|
17 |
* |
|
18 |
* @author Vicente Caballero Navarro |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class WithinGeometryEvaluator extends AbstractEvaluator { |
|
22 |
|
|
23 |
private String geomName; |
|
24 |
private Geometry geometry; |
|
25 |
private Geometry geometryTrans; |
|
26 |
private String srs; |
|
27 |
private boolean isDefault; |
|
28 |
|
|
29 |
public WithinGeometryEvaluator(Geometry geometry, |
|
30 |
IProjection envelopeProjection, FeatureType featureType, |
|
31 |
String geomName) { |
|
32 |
FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType |
|
33 |
.get(geomName); |
|
34 |
this.isDefault = featureType.getDefaultGeometryAttributeName().equals( |
|
35 |
geomName); |
|
36 |
this.geometry = geometry; |
|
37 |
this.geometryTrans = geometry.cloneGeometry(); |
|
38 |
this.srs = envelopeProjection.getAbrev(); |
|
39 |
ICoordTrans ct = envelopeProjection.getCT(CRSFactory.getCRS(fad |
|
40 |
.getSRS())); |
|
41 |
if (ct != null) { |
|
42 |
geometryTrans.reProject(ct); |
|
43 |
} |
|
44 |
this.geomName = geomName; |
|
45 |
|
|
46 |
this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans); |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public Object evaluate(EvaluatorData data) throws EvaluatorException { |
|
51 |
try { |
|
52 |
DefaultRelationshipGeometryOperationContext context; |
|
53 |
if (isDefault) { |
|
54 |
Feature feature = (Feature) data.getContextValue("feature"); |
|
55 |
context =new DefaultRelationshipGeometryOperationContext(feature |
|
56 |
.getDefaultGeometry()); |
|
57 |
|
|
58 |
} else { |
|
59 |
Geometry geom = (Geometry) data.getDataValue(geomName); |
|
60 |
|
|
61 |
context = new DefaultRelationshipGeometryOperationContext(geom); |
|
62 |
} |
|
63 |
return geometryTrans.invokeOperation(Within.CODE, context); |
|
64 |
|
|
65 |
} catch (Exception e) { |
|
66 |
throw new EvaluatorException(e); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public String getName() { |
|
71 |
return "within with geometry"; |
|
72 |
} |
|
73 |
|
|
74 |
public String getCQL() { |
|
75 |
return " within(GeomFromText('" + geometry.toString() + "', " + "'" |
|
76 |
+ srs + "'" + "), " + geomName + ") "; |
|
77 |
} |
|
78 |
|
|
79 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/DisjointGeometryEvaluator.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.layers.vectorial; |
|
2 |
|
|
3 |
import org.cresques.cts.ICoordTrans; |
|
4 |
import org.cresques.cts.IProjection; |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
|
6 |
import org.gvsig.fmap.dal.feature.Feature; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
9 |
import org.gvsig.fmap.geom.Geometry; |
|
10 |
import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext; |
|
11 |
import org.gvsig.fmap.geom.operation.relationship.Disjoint; |
|
12 |
import org.gvsig.fmap.geom.operation.relationship.Equals; |
|
13 |
import org.gvsig.fmap.geom.operation.relationship.Intersects; |
|
14 |
import org.gvsig.tools.evaluator.AbstractEvaluator; |
|
15 |
import org.gvsig.tools.evaluator.EvaluatorData; |
|
16 |
import org.gvsig.tools.evaluator.EvaluatorException; |
|
17 |
/** |
|
18 |
* |
|
19 |
* @author Vicente Caballero Navarro |
|
20 |
* |
|
21 |
*/ |
|
22 |
public class DisjointGeometryEvaluator extends AbstractEvaluator { |
|
23 |
|
|
24 |
private String geomName; |
|
25 |
private Geometry geometry; |
|
26 |
private Geometry geometryTrans; |
|
27 |
private String srs; |
|
28 |
private boolean isDefault; |
|
29 |
|
|
30 |
public DisjointGeometryEvaluator(Geometry geometry, |
|
31 |
IProjection envelopeProjection, FeatureType featureType, |
|
32 |
String geomName) { |
|
33 |
FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType |
|
34 |
.get(geomName); |
|
35 |
this.isDefault = featureType.getDefaultGeometryAttributeName().equals( |
|
36 |
geomName); |
|
37 |
this.geometry = geometry; |
|
38 |
this.geometryTrans = geometry.cloneGeometry(); |
|
39 |
this.srs = envelopeProjection.getAbrev(); |
|
40 |
ICoordTrans ct = envelopeProjection.getCT(CRSFactory.getCRS(fad |
|
41 |
.getSRS())); |
|
42 |
if (ct != null) { |
|
43 |
geometryTrans.reProject(ct); |
|
44 |
} |
|
45 |
this.geomName = geomName; |
|
46 |
|
|
47 |
this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans); |
|
48 |
|
|
49 |
} |
|
50 |
|
|
51 |
public Object evaluate(EvaluatorData data) throws EvaluatorException { |
|
52 |
try { |
|
53 |
DefaultRelationshipGeometryOperationContext context; |
|
54 |
if (isDefault) { |
|
55 |
Feature feature = (Feature) data.getContextValue("feature"); |
|
56 |
context =new DefaultRelationshipGeometryOperationContext(feature |
|
57 |
.getDefaultGeometry()); |
|
58 |
|
|
59 |
} else { |
|
60 |
Geometry geom = (Geometry) data.getDataValue(geomName); |
|
61 |
|
|
62 |
context = new DefaultRelationshipGeometryOperationContext(geom); |
|
63 |
} |
|
64 |
return geometryTrans.invokeOperation(Disjoint.CODE, context); |
|
65 |
|
|
66 |
} catch (Exception e) { |
|
67 |
throw new EvaluatorException(e); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
public String getName() { |
|
72 |
return "disjoint with geometry"; |
|
73 |
} |
|
74 |
|
|
75 |
public String getCQL() { |
|
76 |
return " disjoint(GeomFromText('" + geometry.toString() + "', " + "'" |
|
77 |
+ srs + "'" + "), " + geomName + ") "; |
|
78 |
} |
|
79 |
|
|
80 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/EqualsGeometryEvaluator.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.layers.vectorial; |
|
2 |
|
|
3 |
import org.cresques.cts.ICoordTrans; |
|
4 |
import org.cresques.cts.IProjection; |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
|
6 |
import org.gvsig.fmap.dal.feature.Feature; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
9 |
import org.gvsig.fmap.geom.Geometry; |
|
10 |
import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext; |
|
11 |
import org.gvsig.fmap.geom.operation.relationship.Equals; |
|
12 |
import org.gvsig.tools.evaluator.AbstractEvaluator; |
|
13 |
import org.gvsig.tools.evaluator.EvaluatorData; |
|
14 |
import org.gvsig.tools.evaluator.EvaluatorException; |
|
15 |
/** |
|
16 |
* |
|
17 |
* @author Vicente Caballero Navarro |
|
18 |
* |
|
19 |
*/ |
|
20 |
public class EqualsGeometryEvaluator extends AbstractEvaluator { |
|
21 |
|
|
22 |
private String geomName; |
|
23 |
private Geometry geometry; |
|
24 |
private Geometry geometryTrans; |
|
25 |
private String srs; |
|
26 |
private boolean isDefault; |
|
27 |
|
|
28 |
public EqualsGeometryEvaluator(Geometry geometry, |
|
29 |
IProjection envelopeProjection, FeatureType featureType, |
|
30 |
String geomName) { |
|
31 |
FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType |
|
32 |
.get(geomName); |
|
33 |
this.isDefault = featureType.getDefaultGeometryAttributeName().equals( |
|
34 |
geomName); |
|
35 |
this.geometry = geometry; |
|
36 |
this.geometryTrans = geometry.cloneGeometry(); |
|
37 |
this.srs = envelopeProjection.getAbrev(); |
|
38 |
ICoordTrans ct = envelopeProjection.getCT(CRSFactory.getCRS(fad |
|
39 |
.getSRS())); |
|
40 |
if (ct != null) { |
|
41 |
geometryTrans.reProject(ct); |
|
42 |
} |
|
43 |
this.geomName = geomName; |
|
44 |
|
|
45 |
this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans); |
|
46 |
|
|
47 |
} |
|
48 |
|
|
49 |
public Object evaluate(EvaluatorData data) throws EvaluatorException { |
|
50 |
try { |
|
51 |
DefaultRelationshipGeometryOperationContext context; |
|
52 |
if (isDefault) { |
|
53 |
Feature feature = (Feature) data.getContextValue("feature"); |
|
54 |
context =new DefaultRelationshipGeometryOperationContext(feature |
|
55 |
.getDefaultGeometry()); |
|
56 |
|
|
57 |
} else { |
|
58 |
Geometry geom = (Geometry) data.getDataValue(geomName); |
|
59 |
|
|
60 |
context = new DefaultRelationshipGeometryOperationContext(geom); |
|
61 |
} |
|
62 |
return geometryTrans.invokeOperation(Equals.CODE, context); |
|
63 |
|
|
64 |
} catch (Exception e) { |
|
65 |
throw new EvaluatorException(e); |
|
66 |
} |
|
67 |
} |
|
68 |
|
|
69 |
public String getName() { |
|
70 |
return "equals with geometry"; |
|
71 |
} |
|
72 |
|
|
73 |
public String getCQL() { |
|
74 |
return " equals(GeomFromText('" + geometry.toString() + "', " + "'" |
|
75 |
+ srs + "'" + "), " + geomName + ") "; |
|
76 |
} |
|
77 |
|
|
78 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/TouchesGeometryEvaluator.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.layers.vectorial; |
|
2 |
|
|
3 |
import org.cresques.cts.ICoordTrans; |
|
4 |
import org.cresques.cts.IProjection; |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
|
6 |
import org.gvsig.fmap.dal.feature.Feature; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
9 |
import org.gvsig.fmap.geom.Geometry; |
|
10 |
import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext; |
|
11 |
import org.gvsig.fmap.geom.operation.relationship.Equals; |
|
12 |
import org.gvsig.fmap.geom.operation.relationship.Touches; |
|
13 |
import org.gvsig.tools.evaluator.AbstractEvaluator; |
|
14 |
import org.gvsig.tools.evaluator.EvaluatorData; |
|
15 |
import org.gvsig.tools.evaluator.EvaluatorException; |
|
16 |
/** |
|
17 |
* |
|
18 |
* @author Vicente Caballero Navarro |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class TouchesGeometryEvaluator extends AbstractEvaluator { |
|
22 |
|
|
23 |
private String geomName; |
|
24 |
private Geometry geometry; |
|
25 |
private Geometry geometryTrans; |
|
26 |
private String srs; |
|
27 |
private boolean isDefault; |
|
28 |
|
|
29 |
public TouchesGeometryEvaluator(Geometry geometry, |
|
30 |
IProjection envelopeProjection, FeatureType featureType, |
|
31 |
String geomName) { |
|
32 |
FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType |
|
33 |
.get(geomName); |
|
34 |
this.isDefault = featureType.getDefaultGeometryAttributeName().equals( |
|
35 |
geomName); |
|
36 |
this.geometry = geometry; |
|
37 |
this.geometryTrans = geometry.cloneGeometry(); |
|
38 |
this.srs = envelopeProjection.getAbrev(); |
|
39 |
ICoordTrans ct = envelopeProjection.getCT(CRSFactory.getCRS(fad |
|
40 |
.getSRS())); |
|
41 |
if (ct != null) { |
|
42 |
geometryTrans.reProject(ct); |
|
43 |
} |
|
44 |
this.geomName = geomName; |
|
45 |
|
|
46 |
this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans); |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public Object evaluate(EvaluatorData data) throws EvaluatorException { |
|
51 |
try { |
|
52 |
DefaultRelationshipGeometryOperationContext context; |
|
53 |
if (isDefault) { |
|
54 |
Feature feature = (Feature) data.getContextValue("feature"); |
|
55 |
context =new DefaultRelationshipGeometryOperationContext(feature |
|
56 |
.getDefaultGeometry()); |
|
57 |
|
|
58 |
} else { |
|
59 |
Geometry geom = (Geometry) data.getDataValue(geomName); |
|
60 |
|
|
61 |
context = new DefaultRelationshipGeometryOperationContext(geom); |
|
62 |
} |
|
63 |
return geometryTrans.invokeOperation(Touches.CODE, context); |
|
64 |
|
|
65 |
} catch (Exception e) { |
|
66 |
throw new EvaluatorException(e); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public String getName() { |
|
71 |
return "touches with geometry"; |
|
72 |
} |
|
73 |
|
|
74 |
public String getCQL() { |
|
75 |
return " touches(GeomFromText('" + geometry.toString() + "', " + "'" |
|
76 |
+ srs + "'" + "), " + geomName + ") "; |
|
77 |
} |
|
78 |
|
|
79 |
} |
Also available in: Unified diff