public void encode(Object o, String srsName) throws IllegalArgumentException { if (o instanceof Geometry) { encode((Geometry) o, srsName); } else { throw new IllegalArgumentException("Unable to encode " + o); } }
geometryTranslator.encode((Geometry) value, srsName); } else if (value instanceof Date) { String text = null;
/** * writes the <code>gml:boundedBy</code> element to output based on <code>fc.getBounds() * </code> * * @param bounds * @throws RuntimeException if it is thorwn while writing the element or coordinates */ public void writeBounds(BoundingBox bounds) { try { String boundedBy = geometryTranslator.getDefaultPrefix() + ":" + "boundedBy"; contentHandler.startElement("", "", boundedBy, NULL_ATTS); Envelope env = null; if (bounds != null) { env = new Envelope( new Coordinate(bounds.getMinX(), bounds.getMinY()), new Coordinate(bounds.getMaxX(), bounds.getMaxY())); } geometryTranslator.encode(env, srsName); contentHandler.endElement("", "", boundedBy); } catch (SAXException se) { throw new RuntimeException(se); } }
public void encode(Object o) throws IllegalArgumentException { encode(o, null); }
public void encode(Object o) throws IllegalArgumentException { encode(o, null); }
public void encode(Object o, String srsName) throws IllegalArgumentException { if (o instanceof Geometry) { encode((Geometry) o, srsName); } else { throw new IllegalArgumentException("Unable to encode " + o); } }
public void visit(org.geotools.filter.LiteralExpression expression) { Object value = expression.getLiteral(); if (Geometry.class.isAssignableFrom(value.getClass())) { geometryEncoder.encode( (Geometry) value ); } else { element("Literal",value.toString()); } }
public void encode(Object o, String srsName) throws IllegalArgumentException { if (o instanceof Geometry) { encode((Geometry) o, srsName); } else { throw new IllegalArgumentException("Unable to encode " + o); } }
/** * Encodes the given geometry with no srsName attribute and forcing 2D */ public void encode(Geometry geometry) { encode(geometry, null); }
private void writeMulti(GeometryCollection geometry, String member) { for (int i = 0, n = geometry.getNumGeometries(); i < n; i++) { start(member); encode(geometry.getGeometryN(i)); end(member); } } }
/** * Encodes the geometry in plain 2D using the given srsName attribute value * @see #encode(Geometry, String, int) */ public void encode(Geometry geometry, String srsName) { encode(geometry, srsName, 2); }
private void writeMulti(GeometryCollection geometry, String member) { for (int i = 0, n = geometry.getNumGeometries(); i < n; i++) { start(member); encode(geometry.getGeometryN(i)); end(member); } } }
/** * Encodes the geometry in plain 2D using the given srsName attribute value * @see #encode(Geometry, String, int) */ public void encode(Geometry geometry, String srsName) { encode(geometry, srsName, 2); }
public void encode(Envelope bounds, String srsName) { // DJB: old behavior for null bounds: // // <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#0"> // <gml:coordinates decimal="." cs="," ts=" ">0,0 -1,-1</gml:coordinates> // </gml:Box> // // new behavior: // <gml:null>unknown</gml:null> if (bounds == null || bounds.isNull()) { encodeNullBounds(); return; // we're done! } String boxName = boxName(); if ((srsName == null) || srsName.equals("")) { start(boxName); } else { AttributesImpl atts = new AttributesImpl(); atts.addAttribute("", "srsName", "srsName", "", srsName); start(boxName, atts); } try { double[] coords = new double[4]; coords[0] = bounds.getMinX(); coords[1] = bounds.getMinY(); coords[2] = bounds.getMaxX(); coords[3] = bounds.getMaxY();
/** Encodes the given geometry with no srsName attribute and forcing 2D */ public void encode(Geometry geometry) { String srsName = null; // see if we have a EPSG CRS attached to the geometry if (geometry.getUserData() instanceof CoordinateReferenceSystem) { try { CoordinateReferenceSystem crs = (CoordinateReferenceSystem) geometry.getUserData(); Integer code = CRS.lookupEpsgCode(crs, false); if (code != null) { if (AxisOrder.NORTH_EAST.equals(CRS.getAxisOrder(crs))) { srsName = "urn:ogc:def:crs:EPSG::" + code; } else { srsName = "EPSG:" + code; } } } catch (Exception e) { LOGGER.fine("Failed to encode the CoordinateReferenceSystem into a srsName"); } } encode(geometry, srsName); }
public Object visit(BBOX filter, Object extraData) { Expression left = filter.getExpression1(); Expression right = filter.getExpression2(); final String type = "BBOX"; start(type); left.accept(this, extraData); if (right instanceof Literal) { Literal literal = (Literal) right; Envelope bbox = literal.evaluate(null, Envelope.class); if (bbox != null) { geometryEncoder.encode(bbox); } else { right.accept(this, extraData); } } else { right.accept(this, extraData); } end(type); return extraData; }
public Object visit(Literal expression, Object extraData) { Object value = expression.getValue(); if (value == null) { element("Literal", ""); } else if (value instanceof Geometry) { geometryEncoder.encode((Geometry) value); } else { String txt = expression.evaluate(null, String.class); if (txt == null) { txt = value.toString(); } element("Literal", txt); } return extraData; }
public void encode(Object o) throws IllegalArgumentException { encode(o, null); }
/** * Encodes the geometry in plain 2D using the given srsName attribute value * * @see #encode(Geometry, String, int) */ public void encode(Geometry geometry, String srsName) { encode(geometry, srsName, 2); }
private void writeMulti(GeometryCollection geometry, String member) { for (int i = 0, n = geometry.getNumGeometries(); i < n; i++) { start(member); encode(geometry.getGeometryN(i)); end(member); } } }