/** * Reads a Geometry instance from GeoJSON. * * @param input The input. See {@link GeoJSONUtil#toReader(Object)} for details. * @return The geometry instance. */ public Geometry read(Object input) throws IOException { return parse(new GeometryHandler(factory), input); }
@Override public boolean primitive(Object value) throws ParseException, IOException { if (delegate == UNINITIALIZED) { delegate = createDelegate(lookupDelegate(value.toString()), new Object[] {factory}); if (proxy != null) { proxy.replay(delegate); proxy = null; } return true; } else { return super.primitive(value); } } }
Geometry g = ((IContentHandler<Geometry>) delegate).getValue(); if (g != null || !(((GeometryHandler) delegate).getDelegate() instanceof GeometryCollectionHandler)) { if (properties != null) {
Geometry g = ((IContentHandler<Geometry>)delegate).getValue(); if (g == null && ((GeometryHandler)delegate).getDelegate() instanceof GeometryCollectionHandler) {
@Override public boolean primitive(Object value) throws ParseException, IOException { if (delegate == UNINITIALIZED) { delegate = createDelegate(lookupDelegate(value.toString()), new Object[]{factory}); if (proxy != null) { proxy.replay(delegate); proxy = null; } return true; } else { return super.primitive(value); } } }
@Override public boolean startObject() throws ParseException, IOException { if (properties == NULL_LIST) { properties = new ArrayList(); } else if (properties != null) { // start of a new object in properties means a geometry delegate = new GeometryHandler(new GeometryFactory()); } return super.startObject(); }
public boolean startObjectEntry(String key) throws ParseException, IOException { if ("id".equals(key) && properties == null) { id = ""; return true; } else if ("crs".equals(key) && properties == null /* it's top level, not a property */) { delegate = new CRSHandler(); return true; } else if ("geometry".equals(key) && properties == null /* it's top level, not a property */) { delegate = new GeometryHandler(new GeometryFactory()); return true; } else if ("properties".equals(key) && delegate == NULL) { properties = NULL_LIST; values = new ArrayList(); } else if (properties != null && delegate == NULL) { properties.add(key); return true; } return super.startObjectEntry(key); }
@Override public boolean startObject() throws ParseException, IOException { if (properties == NULL_LIST) { properties = new ArrayList(); } else if (properties != null) { //start of a new object in properties means a geometry delegate = new GeometryHandler(new GeometryFactory()); } return super.startObject(); }
/** * Reads a Geometry instance from GeoJSON. * * @param input The input. See {@link GeoJSONUtil#toReader(Object)} for details. * * @return The geometry instance. */ public Geometry read(Object input) throws IOException { return parse(new GeometryHandler(factory), input); }
public boolean startObjectEntry(String key) throws ParseException, IOException { if ("id".equals(key)) { id = ""; return true; } else if ("crs".equals(key)) { delegate = new CRSHandler(); return true; } else if ("geometry".equals(key)) { delegate = new GeometryHandler(new GeometryFactory()); return true; } else if ("properties".equals(key) && delegate == NULL) { properties = NULL_LIST; values = new ArrayList(); } else if (properties != null && delegate == NULL) { properties.add(key); return true; } return super.startObjectEntry(key); }