コード例 #1
0
ファイル: GeoJSONBuilder.java プロジェクト: rishg/geoserver
 /**
  * Overrides to handle the case of encoding {@code java.util.Date} and its date/time/timestamp
  * descendants, as well as {@code java.util.Calendar} instances as ISO 8601 strings. In addition
  * handles rounding numbers to the specified number of decimal points.
  *
  * @see net.sf.json.util.JSONBuilder#value(java.lang.Object)
  */
 @Override
 public GeoJSONBuilder value(Object value) {
   if (value instanceof java.util.Date || value instanceof Calendar) {
     value = Converters.convert(value, String.class);
   }
   super.value(value);
   return this;
 }
コード例 #2
0
  public static <T extends FeatureType, F extends Feature> void featureIdSetToJson(
      FeatureCollection<T, F> features, JSONBuilder json) {
    json.object();
    json.key("objectIdFieldName");
    json.value("objectid"); // TODO: Advertise "real" identifier property

    FeatureIterator<F> iterator = features.features();
    try {
      json.key("objectIds");
      json.array();
      while (iterator.hasNext()) {
        F feature = iterator.next();
        json.value(adaptId(feature.getIdentifier().getID()));
      }
      json.endArray();
    } finally {
      iterator.close();
    }

    json.endObject();
  }
コード例 #3
0
ファイル: GeoJSONBuilder.java プロジェクト: rishg/geoserver
 private void roundedValue(double value) {
   super.value(RoundingUtil.round(value, numDecimals));
 }