/** * Checks if is a geospatial type. * * @return <tt>true</tt> if is geospatial type; <tt>false</tt> otherwise. */ public boolean isGeospatial() { return name().startsWith("Geo"); }
/** * Checks if is a geospatial type. * * @return <tt>true</tt> if is geospatial type; <tt>false</tt> otherwise. */ public boolean isGeospatial() { return name().startsWith("Geo"); }
private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) { final GeospatialCollection collection; if (itor.hasNext()) { final List<Geospatial> geospatials = new ArrayList<Geospatial>(); while (itor.hasNext()) { final JsonNode geo = itor.next(); final String collItemType = geo.get(Constants.ATTR_TYPE).asText(); final String callAsType; if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType) || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) { callAsType = collItemType; } else { callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry") + collItemType; } geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build())); } collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials); } else { collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, Collections.<Geospatial> emptyList()); } return collection; }
private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) { final GeospatialCollection collection; if (itor.hasNext()) { final List<Geospatial> geospatials = new ArrayList<Geospatial>(); while (itor.hasNext()) { final JsonNode geo = itor.next(); final String collItemType = geo.get(Constants.ATTR_TYPE).asText(); final String callAsType; if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType) || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) { callAsType = collItemType; } else { callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry") + collItemType; } geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build())); } collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials); } else { collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, Collections.<Geospatial> emptyList()); } return collection; }
|| value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) { jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name()); } else { final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y'); final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1); jgen.writeStringField(Constants.ATTR_TYPE, itemType);
|| value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) { jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name()); } else { final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y'); final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1); jgen.writeStringField(Constants.ATTR_TYPE, itemType);
@Test public void testGeometryTypes() { Column c = new Column(); c.setDatatype(SystemMetadata.getInstance().getRuntimeTypeMap().get(DefaultDataTypes.GEOMETRY)); c.setProperty(BaseColumn.SPATIAL_TYPE, "MULTIPOLYGON"); //$NON-NLS-1$ assertEquals("GeometryMultiPolygon", ODataTypeManager.odataType(c).name()); c.setProperty(BaseColumn.SPATIAL_TYPE, "LINESTRING"); //$NON-NLS-1$ assertEquals("GeometryLineString", ODataTypeManager.odataType(c).name()); assertEquals("geometry", ODataTypeManager.teiidType(EdmGeometryPoint.getInstance(), false)); }
@Test public void testGeographyTypes() { Column c = new Column(); c.setDatatype(SystemMetadata.getInstance().getRuntimeTypeMap().get(DefaultDataTypes.GEOGRAPHY)); c.setProperty(BaseColumn.SPATIAL_TYPE, "MULTILINESTRING"); //$NON-NLS-1$ assertEquals("GeographyMultiLineString", ODataTypeManager.odataType(c).name()); c.setProperty(BaseColumn.SPATIAL_TYPE, "POLYGON"); //$NON-NLS-1$ assertEquals("GeographyPolygon", ODataTypeManager.odataType(c).name()); assertEquals("geography", ODataTypeManager.teiidType(EdmGeographyPoint.getInstance(), false)); }