Ignore:
Timestamp:
2009-11-07T07:26:15+01:00 (16 years ago)
Author:
Gubaer
Message:

Made nodes, ways, and relations in DataSet private. Plugin updates to be checked in shortly.
Also added setter/getter for DataSet version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r2388 r2396  
    5252     * The API version that created this data set, if any.
    5353     */
    54     public String version;
     54    private String version;
     55
     56    /**
     57     * Replies the API version this dataset was created from. May be null.
     58     *
     59     * @return the API version this dataset was created from. May be null.
     60     */
     61    public String getVersion() {
     62        return version;
     63    }
     64
     65    /**
     66     * Sets the API version this dataset was created from.
     67     *
     68     * @param version the API version, i.e. "0.5" or "0.6"
     69     */
     70    public void setVersion(String version) {
     71        this.version = version;
     72    }
    5573
    5674    /**
    5775     * All nodes goes here, even when included in other data (ways etc). This enables the instant
    5876     * conversion of the whole DataSet by iterating over this data structure.
    59      * @deprecated Use getNodes() for read-only operations, addPrimitive() and removePrimitive() for modifications
    60      */
    61     @Deprecated
    62     public QuadBuckets<Node> nodes = new QuadBuckets<Node>();
    63 
     77     */
     78    private QuadBuckets<Node> nodes = new QuadBuckets<Node>();
     79
     80    /**
     81     * Replies an unmodifiable collection of nodes in this dataset
     82     *
     83     * @return an unmodifiable collection of nodes in this dataset
     84     */
    6485    public Collection<Node> getNodes() {
    6586        return Collections.unmodifiableCollection(nodes);
     
    7495     *
    7596     * The way nodes are stored only in the way list.
    76      * @deprecated Use getWays() for read-only operations, addPrimitive() and removePrimitive() for modifications
    77      */
    78     @Deprecated
    79     public QuadBuckets<Way> ways = new QuadBuckets<Way>();
    80 
     97     */
     98    private QuadBuckets<Way> ways = new QuadBuckets<Way>();
     99
     100    /**
     101     * Replies an unmodifiable collection of ways in this dataset
     102     *
     103     * @return an unmodifiable collection of ways in this dataset
     104     */
    81105    public Collection<Way> getWays() {
    82106        return Collections.unmodifiableCollection(ways);
     
    89113    /**
    90114     * All relations/relationships
    91      * @deprecated Use getRelations() for read-only operations, addPrimitive() and removePrimitive() for modifications
    92      */
    93     @Deprecated
    94     public Collection<Relation> relations = new LinkedList<Relation>();
    95 
     115     */
     116    private Collection<Relation> relations = new LinkedList<Relation>();
     117
     118    /**
     119     * Replies an unmodifiable collection of relations in this dataset
     120     *
     121     * @return an unmodifiable collection of relations in this dataset
     122     */
    96123    public Collection<Relation> getRelations() {
    97124        return Collections.unmodifiableCollection(relations);
     
    703730        }
    704731    }
     732
     733    /**
     734     * Removes all primitives from the dataset and resets the currently selected primitives
     735     * to the empty collection. Also notifies selection change listeners if necessary.
     736     *
     737     */
     738    public void clear() {
     739        if (!selectedPrimitives.isEmpty()) {
     740            selectedPrimitives.clear();
     741            fireSelectionChanged();
     742        }
     743        nodes.clear();
     744        ways.clear();
     745        relations.clear();
     746    }
    705747}
Note: See TracChangeset for help on using the changeset viewer.