01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.validation;
16:
17: import java.net.URI;
18:
19: import net.refractions.udig.project.ILayer;
20:
21: import org.geotools.validation.IntegrityValidation;
22: import org.geotools.validation.relate.OverlapsIntegrity;
23:
24: /**
25: * Overrides the FeatureValidationOp abstract class and returns the appropriate validation method for the
26: * validation type.
27: * <p>
28: * </p>
29: *
30: * @author chorner
31: * @since 1.0.1
32: */
33: public class ValidateOverlaps extends IntegrityValidationOp {
34: public IntegrityValidation getValidator(ILayer[] layer) {
35: OverlapsIntegrity overlapsIntegrity = new OverlapsIntegrity();
36: overlapsIntegrity.setExpected(false); //(for now we'll assume overlaps are unexpected)
37: URI nameSpace = layer[0].getSchema().getNamespace();
38: String typeName = layer[0].getSchema().getTypeName();
39: overlapsIntegrity.setGeomTypeRefA(nameSpace + ":" + typeName); //$NON-NLS-1$
40: //check for the existence of a second layer
41: if (layer.length > 1) {
42: nameSpace = layer[1].getSchema().getNamespace();
43: typeName = layer[1].getSchema().getTypeName();
44: overlapsIntegrity.setGeomTypeRefB(nameSpace
45: + ":" + typeName); //$NON-NLS-1$
46: }
47: return overlapsIntegrity;
48: }
49: }
|