/** * Get the {@code Geometries} for the given object. * * @param geom a JTS Geometry object * @return the {@code Geometries} for the argument's class, or {@code null} if the argument is * {@code null} */ public static Geometries get(Geometry geom) { if (geom != null) { return getForBinding(geom.getClass()); } return null; }
writer.endNode(); writer.startNode("type"); writer.setValue(Geometries.getForBinding(vt.getGeometryType(geom)).getName()); writer.endNode(); writer.startNode("srid");
static Geometries findGeometryType(SimpleFeatureType schema) { GeometryDescriptor gd = findGeometryDescriptor(schema); return gd != null ? Geometries.getForBinding((Class<? extends Geometry>) gd.getType().getBinding()) : null; }
sql.append(", ").append(epsg); sql.append(", '") .append(Geometries.getForBinding(binding).getName()) .append("'"); sql.append(", ").append(2); // TODO: dimension
@Test public void testGetSubclass() { class DerivedLine extends LineString { DerivedLine(CoordinateSequence seq, GeometryFactory gf) { super(seq, gf); } } assertEquals(Geometries.LINESTRING, Geometries.getForBinding(DerivedLine.class)); abstract class DerivedGeometry extends Geometry { DerivedGeometry(GeometryFactory gf) { super(gf); } } assertEquals(Geometries.GEOMETRY, Geometries.getForBinding(DerivedGeometry.class)); }
geomType = Geometries.getForBinding(clazz);
Geometries.getForBinding((Class<? extends Geometry>) gd.getType().getBinding()); sql.append("'").append(g != null ? g.getName().toUpperCase() : "GEOMETRY").append("')");
/** * {@inheritDoc} The {@code layer} argument must be an instance of {@linkplain FeatureLayer}. */ @Override public void setLayer(Layer layer) { if (!(layer instanceof FeatureLayer)) { throw new IllegalArgumentException("layer must be an instance of FeatureLayer"); } super.setLayer(layer); GeometryDescriptor geomDesc = layer.getFeatureSource().getSchema().getGeometryDescriptor(); attrName = geomDesc.getLocalName(); Class<? extends Geometry> geomClass = (Class<? extends Geometry>) geomDesc.getType().getBinding(); geomType = Geometries.getForBinding(geomClass); }
@Test public void testGetSubclassByObject() { class DerivedLine extends LineString { DerivedLine(CoordinateSequence seq, GeometryFactory gf) { super(seq, gf); } } DerivedLine p = new DerivedLine(new CoordinateArraySequence(coords), geomFactory); assertEquals(Geometries.LINESTRING, Geometries.getForBinding(DerivedLine.class)); }
if (gd != null) { fe.setGeometryColumn(gd.getLocalName()); fe.setGeometryType(Geometries.getForBinding((Class) gd.getType().getBinding())); fe1.setGeometryColumn(gd1.getLocalName()); fe1.setGeometryType( Geometries.getForBinding((Class) gd1.getType().getBinding())); geopkg.addGeometryColumnsEntry(fe1);
static Geometries findGeometryType(SimpleFeatureType schema) { GeometryDescriptor gd = findGeometryDescriptor(schema); return gd != null ? Geometries.getForBinding((Class<? extends Geometry>) gd.getType().getBinding()) : null; }
sql.append(", '").append(gd.getLocalName()).append("'"); sql.append(", ").append(epsg); sql.append(", '").append(Geometries.getForBinding(binding).getName()).append("'"); sql.append(", ").append(2); //TODO: dimension sql.append(")");
String gType = Geometries.getForBinding((Class<? extends Geometry>) gd.getType().getBinding() ).getName(); if ( gType == null ) { throw new IOException( "Unknown geometry type: " + gd.getType().getBinding() );
geomType = Geometries.getForBinding(clazz);
/** * {@inheritDoc} * The {@code layer} argument must be an instance of {@linkplain FeatureLayer}. */ @Override public void setLayer(Layer layer) { if (!(layer instanceof FeatureLayer)) { throw new IllegalArgumentException("layer must be an instance of FeatureLayer"); } super.setLayer(layer); GeometryDescriptor geomDesc = layer.getFeatureSource().getSchema().getGeometryDescriptor(); attrName = geomDesc.getLocalName(); Class<? extends Geometry> geomClass = (Class<? extends Geometry>) geomDesc.getType().getBinding(); geomType = Geometries.getForBinding(geomClass); }
if (gd != null) { fe.setGeometryColumn(gd.getLocalName()); fe.setGeometryType(Geometries.getForBinding((Class) gd.getType().getBinding())); fe1.setGeometryColumn(gd1.getLocalName()); fe1.setGeometryType( Geometries.getForBinding((Class) gd1.getType().getBinding())); geopkg.addGeometryColumnsEntry(fe1);