Пример #1
0
 /**
  * initializes the API data set with the primitives in <code>primitives</code>
  *
  * @param primitives the collection of primitives
  */
 public APIDataSet(Collection<OsmPrimitive> primitives) {
   this();
   toAdd.clear();
   toUpdate.clear();
   toDelete.clear();
   for (OsmPrimitive osm : primitives) {
     if (osm.isNewOrUndeleted() && !osm.isDeleted()) {
       toAdd.addLast(osm);
     } else if (osm.isModified() && !osm.isDeleted()) {
       toUpdate.addLast(osm);
     } else if (osm.isDeleted() && !osm.isNew() && osm.isModified() && osm.isVisible()) {
       toDelete.addFirst(osm);
     }
   }
   sortNew();
   sortDeleted();
 }
Пример #2
0
  /**
   * initializes the API data set with the modified primitives in <code>ds</code>
   *
   * @param ds the data set. Ignored, if null.
   */
  public void init(DataSet ds) {
    if (ds == null) return;
    toAdd.clear();
    toUpdate.clear();
    toDelete.clear();

    for (OsmPrimitive osm : ds.allPrimitives()) {
      if (osm.get("josm/ignore") != null) {
        continue;
      }
      if (osm.isNewOrUndeleted() && !osm.isDeleted()) {
        toAdd.add(osm);
      } else if (osm.isModified() && !osm.isDeleted()) {
        toUpdate.add(osm);
      } else if (osm.isDeleted() && !osm.isNew() && osm.isModified() && osm.isVisible()) {
        toDelete.add(osm);
      }
    }
    sortDeleted();
    sortNew();
    sortUpdated();
  }