Exemple #1
0
 @Override
 public String toString() {
   return base
       + (Range.ZERO_TO_INFINITY.equals(range) ? "" : range)
       + Utils.join("", conds)
       + (subpart != null ? "::" + subpart : "");
 }
 /**
  * Copies the tags of object to the clipboard. The output by this function looks similar to:
  * key=value\nkey=value
  *
  * @param source The OSM data layer source
  * @param primitives The OSM primitives to copy
  */
 public static void copy(OsmDataLayer source, Collection<OsmPrimitive> primitives) {
   Set<String> values = new TreeSet<>();
   for (OsmPrimitive p : primitives) {
     for (Entry<String, String> kv : p.getKeys().entrySet()) {
       values.add(new Tag(kv.getKey(), kv.getValue()).toString());
     }
   }
   if (!values.isEmpty()) Utils.copyToClipboard(Utils.join("\n", values));
 }
Exemple #3
0
 protected final void onLayerSelectionChanged() {
   if (wms.getServiceUrl() != null) {
     wmsUrl.setText(
         wms.buildGetMapUrl(tree.getSelectedLayers(), (String) formats.getSelectedItem()));
     name.setText(
         wms.getServiceUrl().getHost() + ": " + Utils.join(", ", tree.getSelectedLayers()));
   }
   showBounds.setEnabled(tree.getSelectedLayers().size() == 1);
 }
 @Override
 protected String buildRequestString(final OsmPrimitiveType type, Set<Long> idPackage) {
   final Utils.Function<Long, Object> toOverpassExpression =
       new Utils.Function<Long, Object>() {
         @Override
         public Object apply(Long x) {
           return type.getAPIName() + "(" + x + ");>;";
         }
       };
   final String query =
       "(" + Utils.join("", Utils.transform(idPackage, toOverpassExpression)) + ");out meta;";
   return "interpreter?data=" + Utils.encodeUrl(query);
 }
Exemple #5
0
 /**
  * Get a string representation of all layers suitable for the {@code source} changeset tag.
  *
  * @return A String of sources separated by ';'
  */
 public String getLayerInformationForSourceTag() {
   final Collection<String> layerInfo = new ArrayList<>();
   if (!getLayersOfType(GpxLayer.class).isEmpty()) {
     // no i18n for international values
     layerInfo.add("survey");
   }
   for (final GeoImageLayer i : getLayersOfType(GeoImageLayer.class)) {
     layerInfo.add(i.getName());
   }
   for (final ImageryLayer i : getLayersOfType(ImageryLayer.class)) {
     layerInfo.add(
         ImageryInfo.ImageryType.BING.equals(i.getInfo().getImageryType()) ? "Bing" : i.getName());
   }
   return Utils.join("; ", layerInfo);
 }