Statistics
| Revision:

gvsig-projects-pool / 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 @ 727

History | View | Annotate | Download (2.51 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 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.fmap.dal.feature.Feature;
27
import org.gvsig.fmap.dal.feature.FeatureSet;
28
import org.gvsig.tools.task.SimpleTaskStatus;
29
import org.gvsig.topology.lib.spi.AbstractTopologyRule;
30
import org.gvsig.topology.lib.api.TopologyPlan;
31
import org.gvsig.topology.lib.api.TopologyReport;
32
import org.gvsig.topology.lib.api.TopologyRuleFactory;
33

    
34
/**
35
 *
36
 * @author jjdelcerro
37
 */
38
@SuppressWarnings("UseSpecificCatch")
39
public class ContainsNullRule extends AbstractTopologyRule {
40

    
41
    public ContainsNullRule(
42
            TopologyPlan plan,
43
            TopologyRuleFactory factory,
44
            double tolerance,
45
            String dataSet1,
46
            String dataSet2
47
    ) {
48
        super(plan, factory, tolerance, dataSet1, dataSet2);
49
    }
50

    
51
    @Override
52
    protected void check(SimpleTaskStatus taskStatus, TopologyReport report, Feature feature1) throws Exception {
53
        FeatureSet set = null;
54
        try {
55
            if ( feature1.getDefaultGeometry()==null ) {
56
                report.addLine(this,
57
                        this.getDataSet1(),
58
                        this.getDataSet2(),
59
                        feature1.getDefaultGeometry(),
60
                        null,
61
                        feature1.getReference(),
62
                        null,
63
                        false,
64
                        "The geometry is null."
65
                );
66
            }
67
        } catch(Exception ex) {
68
            LOGGER.warn("Can't check feature.", ex);
69
        } finally {
70
            if( set!=null ) {
71
                set.dispose();
72
            }
73
        }
74
    }
75

    
76
}