Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[GEOT-3548] GML2 encoding can intermittently encode null values in pl…

…ace of geometries

git-svn-id: http://svn.osgeo.org/geotools/trunk@37029 e5c1c795-43da-0310-a71f-fac65c449510
  • Loading branch information...
commit 64b0c72495f60ff206767b6014e39cda188f8f7b 1 parent f03b32a
aaime authored
View
30 modules/library/main/src/main/java/org/geotools/gml/producer/GMLUtils.java
@@ -80,22 +80,21 @@ private GMLUtils() {
public static String getGeometryName(Geometry geometry) {
LOGGER.entering("GMLUtils", "getGeometryName", geometry);
- Class geomClass = geometry.getClass();
String returnValue = null;
- if (geomClass.equals(Point.class)) {
+ if (geometry instanceof Point) {
returnValue = "Point";
- } else if (geomClass.equals(LineString.class)) {
+ } else if (geometry instanceof LineString) {
returnValue = "LineString";
- } else if (geomClass.equals(Polygon.class)) {
+ } else if (geometry instanceof Polygon) {
returnValue = "Polygon";
- } else if (geomClass.equals(MultiPoint.class)) {
+ } else if (geometry instanceof MultiPoint) {
returnValue = "MultiPoint";
- } else if (geomClass.equals(MultiLineString.class)) {
+ } else if (geometry instanceof MultiPoint) {
returnValue = "MultiLineString";
- } else if (geomClass.equals(MultiPolygon.class)) {
+ } else if (geometry instanceof MultiPolygon) {
returnValue = "MultiPolygon";
- } else if (geomClass.equals(GeometryCollection.class)) {
+ } else if (geometry instanceof GeometryCollection) {
returnValue = "GeometryCollection";
} else {
//HACK!!! throw exception
@@ -117,26 +116,25 @@ public static String getGeometryName(Geometry geometry) {
public static int getGeometryType(Geometry geometry) {
//LOGGER.entering("GMLUtils", "getGeometryType", geometry);
- Class geomClass = geometry.getClass();
int returnValue = -1;
- if (geomClass.equals(Point.class)) {
+ if (geometry instanceof Point) {
//LOGGER.finest("found point");
returnValue = POINT;
- } else if (geomClass.equals(LineString.class)) {
+ } else if (geometry instanceof LineString) {
//LOGGER.finest("found linestring");
returnValue = LINESTRING;
- } else if (geomClass.equals(Polygon.class)) {
+ } else if (geometry instanceof Polygon) {
//LOGGER.finest("found polygon");
returnValue = POLYGON;
- } else if (geomClass.equals(MultiPoint.class)) {
+ } else if (geometry instanceof MultiPoint) {
//LOGGER.finest("found multiPoint");
returnValue = MULTIPOINT;
- } else if (geomClass.equals(MultiLineString.class)) {
+ } else if (geometry instanceof MultiLineString) {
returnValue = MULTILINESTRING;
- } else if (geomClass.equals(MultiPolygon.class)) {
+ } else if (geometry instanceof MultiPolygon) {
returnValue = MULTIPOLYGON;
- } else if (geomClass.equals(GeometryCollection.class)) {
+ } else if (geometry instanceof GeometryCollection) {
returnValue = MULTIGEOMETRY;
} else {
returnValue = -1;
Please sign in to comment.
Something went wrong with that request. Please try again.