-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose ordinal constants and use instead of reflection (#222)
* Expose ordinal constants and use instead of reflection * Add deprecation note Signed-off-by: Björn Harrtell <bjorn@wololo.org>
- Loading branch information
1 parent
e5e52b6
commit 511c3d9
Showing
11 changed files
with
168 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,16 +155,25 @@ public abstract class Geometry | |
implements Cloneable, Comparable, Serializable | ||
{ | ||
private static final long serialVersionUID = 8763622679187376702L; | ||
|
||
static final int SORTINDEX_POINT = 0; | ||
static final int SORTINDEX_MULTIPOINT = 1; | ||
static final int SORTINDEX_LINESTRING = 2; | ||
static final int SORTINDEX_LINEARRING = 3; | ||
static final int SORTINDEX_MULTILINESTRING = 4; | ||
static final int SORTINDEX_POLYGON = 5; | ||
static final int SORTINDEX_MULTIPOLYGON = 6; | ||
static final int SORTINDEX_GEOMETRYCOLLECTION = 7; | ||
|
||
|
||
protected static final int TYPECODE_POINT = 0; | ||
protected static final int TYPECODE_MULTIPOINT = 1; | ||
protected static final int TYPECODE_LINESTRING = 2; | ||
protected static final int TYPECODE_LINEARRING = 3; | ||
protected static final int TYPECODE_MULTILINESTRING = 4; | ||
protected static final int TYPECODE_POLYGON = 5; | ||
protected static final int TYPECODE_MULTIPOLYGON = 6; | ||
protected static final int TYPECODE_GEOMETRYCOLLECTION = 7; | ||
|
||
public static final String TYPENAME_POINT = "Point"; | ||
public static final String TYPENAME_MULTIPOINT = "MultiPoint"; | ||
public static final String TYPENAME_LINESTRING = "LineString"; | ||
public static final String TYPENAME_LINEARRING = "LinearRing"; | ||
public static final String TYPENAME_MULTILINESTRING = "MultiLineString"; | ||
public static final String TYPENAME_POLYGON = "Polygon"; | ||
public static final String TYPENAME_MULTIPOLYGON = "MultiPolygon"; | ||
public static final String TYPENAME_GEOMETRYCOLLECTION = "GeometryCollection"; | ||
|
||
private final static GeometryComponentFilter geometryChangedFilter = new GeometryComponentFilter() { | ||
public void filter(Geometry geom) { | ||
geom.geometryChangedAction(); | ||
|
@@ -1722,8 +1731,8 @@ public Geometry norm() | |
*/ | ||
public int compareTo(Object o) { | ||
Geometry other = (Geometry) o; | ||
if (getSortIndex() != other.getSortIndex()) { | ||
return getSortIndex() - other.getSortIndex(); | ||
if (getTypeCode() != other.getTypeCode()) { | ||
return getTypeCode() - other.getTypeCode(); | ||
} | ||
if (isEmpty() && other.isEmpty()) { | ||
return 0; | ||
|
@@ -1769,8 +1778,8 @@ public int compareTo(Object o) { | |
*/ | ||
public int compareTo(Object o, CoordinateSequenceComparator comp) { | ||
Geometry other = (Geometry) o; | ||
if (getSortIndex() != other.getSortIndex()) { | ||
return getSortIndex() - other.getSortIndex(); | ||
if (getTypeCode() != other.getTypeCode()) { | ||
return getTypeCode() - other.getTypeCode(); | ||
} | ||
if (isEmpty() && other.isEmpty()) { | ||
return 0; | ||
|
@@ -1822,7 +1831,7 @@ protected static void checkNotGeometryCollection(Geometry g) { | |
*/ | ||
protected boolean isGeometryCollection() | ||
{ | ||
return getSortIndex() == SORTINDEX_GEOMETRYCOLLECTION; | ||
return getTypeCode() == TYPECODE_GEOMETRYCOLLECTION; | ||
} | ||
|
||
/** | ||
|
@@ -1901,7 +1910,7 @@ protected boolean equal(Coordinate a, Coordinate b, double tolerance) { | |
return a.distance(b) <= tolerance; | ||
} | ||
|
||
abstract protected int getSortIndex(); | ||
abstract protected int getTypeCode(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dr-jts
Contributor
|
||
|
||
private Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Isn't this a breaking change? In case it is and it doesn't matter, we can simplify changes to
Geometry.reverse()
, too.