Changeset 12019 in josm


Ignore:
Timestamp:
2017-04-29T17:35:29+02:00 (15 months ago)
Author:
Don-vip
Message:

do not output visible attribute when saving upload=no/never XML files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmWriter.java

    r11878 r12019  
    3333
    3434/**
    35  * Save the dataset into a stream as osm intern xml format. This is not using any
    36  * xml library for storing.
     35 * Save the dataset into a stream as osm intern xml format. This is not using any xml library for storing.
    3736 * @author imi
     37 * @since 59
    3838 */
    3939public class OsmWriter extends XmlWriter implements PrimitiveVisitor {
    4040
     41    /** Default OSM API version */
    4142    public static final String DEFAULT_API_VERSION = "0.6";
    4243
    4344    private final boolean osmConform;
    4445    private boolean withBody = true;
     46    private boolean withVisible = true;
    4547    private boolean isOsmChange;
    4648    private String version;
     
    6062    }
    6163
     64    /**
     65     * Sets whether body must be written.
     66     * @param wb if {@code true} body will be written.
     67     */
    6268    public void setWithBody(boolean wb) {
    6369        this.withBody = wb;
     70    }
     71
     72    /**
     73     * Sets whether 'visible' attribute must be written.
     74     * @param wv if {@code true} 'visible' attribute will be written.
     75     * @since 12019
     76     */
     77    public void setWithVisible(boolean wv) {
     78        this.withVisible = wv;
    6479    }
    6580
     
    127142     */
    128143    public void writeContent(DataSet ds) {
     144        setWithVisible(UploadPolicy.NORMAL.equals(ds.getUploadPolicy()));
    129145        writeNodes(ds.getNodes());
    130146        writeWays(ds.getWays());
     
    322338                }
    323339            }
    324             out.print(" visible='"+osm.isVisible()+'\'');
     340            if (withVisible) {
     341                out.print(" visible='"+osm.isVisible()+'\'');
     342            }
    325343        }
    326344        if (osm.getVersion() != 0) {
Note: See TracChangeset for help on using the changeset viewer.