| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
package org.locationtech.jts.geom; |
| 15 |
|
| 16 |
/** |
| 17 |
* Constants representing the different topological locations |
| 18 |
* which can occur in a {@link Geometry}. |
| 19 |
* The constants are also used as the row and column indices |
| 20 |
* of DE-9IM {@link IntersectionMatrix}es. |
| 21 |
* |
| 22 |
*@version 1.7 |
| 23 |
*/ |
| 24 |
public class Location { |
| 25 |
/** |
| 26 |
* The location value for the interior of a geometry. |
| 27 |
* Also, DE-9IM row index of the interior of the first geometry and column index of |
| 28 |
* the interior of the second geometry. |
| 29 |
*/ |
| 30 |
public final static int INTERIOR = 0; |
| 31 |
/** |
| 32 |
* The location value for the boundary of a geometry. |
| 33 |
* Also, DE-9IM row index of the boundary of the first geometry and column index of |
| 34 |
* the boundary of the second geometry. |
| 35 |
*/ |
| 36 |
public final static int BOUNDARY = 1; |
| 37 |
/** |
| 38 |
* The location value for the exterior of a geometry. |
| 39 |
* Also, DE-9IM row index of the exterior of the first geometry and column index of |
| 40 |
* the exterior of the second geometry. |
| 41 |
*/ |
| 42 |
public final static int EXTERIOR = 2; |
| 43 |
|
| 44 |
/** |
| 45 |
* Used for uninitialized location values. |
| 46 |
*/ |
| 47 |
public final static int NONE = -1; |
| 48 |
|
| 49 |
/** |
| 50 |
* Converts the location value to a location symbol, for example, <code>EXTERIOR => 'e'</code> |
| 51 |
* . |
| 52 |
* |
| 53 |
*@param locationValue either EXTERIOR, BOUNDARY, INTERIOR or NONE |
| 54 |
*@return either 'e', 'b', 'i' or '-' |
| 55 |
*/ |
| 56 |
public static char toLocationSymbol(int locationValue) { |
| 57 |
switch (locationValue) { |
| 58 |
case EXTERIOR: |
| 59 |
return 'e'; |
| 60 |
case BOUNDARY: |
| 61 |
return 'b'; |
| 62 |
case INTERIOR: |
| 63 |
return 'i'; |
| 64 |
case NONE: |
| 65 |
return '-'; |
| 66 |
} |
| 67 |
throw new IllegalArgumentException("Unknown location value: " + locationValue); |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
|