4
* The JTS Topology Suite is a collection of Java classes that
5
* implement the fundamental operations required to validate a given
6
* geo-spatial data set to a known topological specification.
8
* Copyright (C) 2001 Vivid Solutions
10
* This library is free software; you can redistribute it and/or
11
* modify it under the terms of the GNU Lesser General Public
12
* License as published by the Free Software Foundation; either
13
* version 2.1 of the License, or (at your option) any later version.
15
* This library is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
* Lesser General Public License for more details.
20
* You should have received a copy of the GNU Lesser General Public
21
* License along with this library; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
* For more information, contact:
28
* 2328 Government Street
33
* www.vividsolutions.com
35
package com.vividsolutions.jts.operation.valid;
37
import com.vividsolutions.jts.geom.Coordinate;
40
* Contains information about the nature and location of a {@link Geometry}
45
public class TopologyValidationError {
47
public static final int ERROR = 0;
48
public static final int REPEATED_POINT = 1;
49
public static final int HOLE_OUTSIDE_SHELL = 2;
50
public static final int NESTED_HOLES = 3;
51
public static final int DISCONNECTED_INTERIOR = 4;
52
public static final int SELF_INTERSECTION = 5;
53
public static final int RING_SELF_INTERSECTION = 6;
54
public static final int NESTED_SHELLS = 7;
55
public static final int DUPLICATE_RINGS = 8;
56
public static final int TOO_FEW_POINTS = 9;
57
public static final int INVALID_COORDINATE = 10;
59
// these messages must synch up with the indexes above
60
private static String[] errMsg = {
61
"Topology Validation Error",
63
"Hole lies outside shell",
65
"Interior is disconnected",
67
"Ring Self-intersection",
70
"Too few points in geometry component",
75
private int errorType;
76
private Coordinate pt;
78
public TopologyValidationError(int errorType, Coordinate pt)
80
this.errorType = errorType;
81
this.pt = (Coordinate) pt.clone();
83
public TopologyValidationError(int errorType)
85
this(errorType, null);
88
public Coordinate getCoordinate() { return pt; }
90
public int getErrorType() { return errorType; }
92
public String getMessage() { return errMsg[errorType]; }
94
public String toString()
96
return getMessage() + " at or near point " + pt;