Ignore:
Timestamp:
2009-08-08T08:52:03+02:00 (15 years ago)
Author:
jttt
Message:

Replaced Relation.members with Relation.getMembers()

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
9 edited

Legend:

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

    r1910 r1925  
    401401    public void unlinkPrimitiveFromRelations(OsmPrimitive primitive) {
    402402        for (Relation relation : relations) {
    403             Iterator<RelationMember> it = relation.members.iterator();
     403            Iterator<RelationMember> it = relation.getMembers().iterator();
    404404            while(it.hasNext()) {
    405405                RelationMember member = it.next();
     
    442442                continue;
    443443            }
    444             for (RelationMember member: parent.members) {
     444            for (RelationMember member: parent.getMembers()) {
    445445                if (member.refersTo(child)) {
    446446                    parents.add(parent);
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r1762 r1925  
    44import static org.openstreetmap.josm.tools.I18n.trn;
    55
     6import java.util.ArrayList;
    67import java.util.Arrays;
    7 import java.util.ArrayList;
    88import java.util.Collection;
    99import java.util.List;
    1010
     11import org.openstreetmap.josm.Main;
    1112import org.openstreetmap.josm.data.osm.visitor.Visitor;
    12 import org.openstreetmap.josm.Main;
     13import org.openstreetmap.josm.tools.CopyList;
    1314
    1415/**
     
    2425     */
    2526    public final List<RelationMember> members = new ArrayList<RelationMember>();
     27
     28    /**
     29     * @return Members of the relation. Changes made in returned list are not mapped
     30     * back to the primitive, use setMembers() to modify the members
     31     * @since 1925
     32     */
     33    public List<RelationMember> getMembers() {
     34        return new CopyList<RelationMember>(members.toArray(new RelationMember[members.size()]));
     35    }
     36
     37    /**
     38     *
     39     * @param members
     40     * @since 1925
     41     */
     42    public void setMembers(List<RelationMember> members) {
     43        this.members.clear();
     44        this.members.addAll(members);
     45    }
    2646
    2747    final static String[] defnames = {"name", "ref", "restriction", "note"};
     
    5979        // we must not add the members themselves, but instead
    6080        // add clones of the members
    61         for (RelationMember em : ((Relation)osm).members) {
     81        for (RelationMember em : ((Relation)osm).getMembers()) {
    6282            members.add(new RelationMember(em));
    6383        }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/AllNodesVisitor.java

    r1523 r1925  
    55import java.util.HashSet;
    66
     7import org.openstreetmap.josm.data.osm.Node;
     8import org.openstreetmap.josm.data.osm.OsmPrimitive;
    79import org.openstreetmap.josm.data.osm.Relation;
    810import org.openstreetmap.josm.data.osm.RelationMember;
    9 import org.openstreetmap.josm.data.osm.Node;
    10 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1111import org.openstreetmap.josm.data.osm.Way;
    1212
     
    4343     */
    4444    public void visit(Relation e) {
    45         for (RelationMember m : e.members)
     45        for (RelationMember m : e.getMembers())
    4646            if (m.member instanceof Node) visit((Node)m.member);
    4747    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r1724 r1925  
    55import org.openstreetmap.josm.data.Bounds;
    66import org.openstreetmap.josm.data.ProjectionBounds;
     7import org.openstreetmap.josm.data.coor.CachedLatLon;
    78import org.openstreetmap.josm.data.coor.EastNorth;
    8 import org.openstreetmap.josm.data.coor.CachedLatLon;
    99import org.openstreetmap.josm.data.coor.LatLon;
    1010import org.openstreetmap.josm.data.osm.Node;
     
    3333    public void visit(Relation e) {
    3434        // only use direct members
    35         for (RelationMember m : e.members) {
     35        for (RelationMember m : e.getMembers()) {
    3636            if (!(m.member instanceof Relation)) {
    3737                m.member.visit(this);
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/CollectBackReferencesVisitor.java

    r1862 r1925  
    7373        for (Relation r : ds.relations) {
    7474            if (r.incomplete || r.deleted) continue;
    75             for (RelationMember m : r.members) {
     75            for (RelationMember m : r.getMembers()) {
    7676                if (m.member == p) {
    7777                    if (!data.contains(r)) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

    r1899 r1925  
    485485        if(selectedCall)
    486486        {
    487             for (RelationMember m : r.members)
     487            for (RelationMember m : r.getMembers())
    488488            {
    489489                if (m.member != null && !m.member.incomplete && !m.member.deleted
     
    507507        if(r.isSelected()) /* draw ways*/
    508508        {
    509             for (RelationMember m : r.members)
     509            for (RelationMember m : r.getMembers())
    510510            {
    511511                if (m.member != null && !m.member.incomplete && !m.member.deleted
     
    532532
    533533        /* find the "from", "via" and "to" elements */
    534         for (RelationMember m : r.members)
     534        for (RelationMember m : r.getMembers())
    535535        {
    536536            //if(restrictionDebug)
     
    782782        r.clearErrors();
    783783
    784         for (RelationMember m : r.members)
     784        for (RelationMember m : r.getMembers())
    785785        {
    786786            if(m.member == null)
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java

    r1910 r1925  
    9191        }
    9292        clone.members.clear();
    93         for (RelationMember member: r.members) {
     93        for (RelationMember member: r.getMembers()) {
    9494            RelationMember cloneMember = new RelationMember(member);
    9595            cloneMember.member = mappedPrimitives.get(member.member);
     
    189189        //
    190190        rememberRelationPartial(r);
    191         for (RelationMember member: r.members) {
     191        for (RelationMember member: r.getMembers()) {
    192192            if (isAlreadyRemembered(member.member)) {
    193193                // referred primitive already remembered
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java

    r1862 r1925  
    192192        boolean replacedSomething = false;
    193193        LinkedList<RelationMember> newMembers = new LinkedList<RelationMember>();
    194         for (RelationMember myMember : r.members) {
     194        for (RelationMember myMember : r.getMembers()) {
    195195            OsmPrimitive mergedMember = merged.get(myMember.member);
    196196            if (mergedMember == null) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r1899 r1925  
    348348        g.setColor(col);
    349349
    350         for (RelationMember m : r.members) {
     350        for (RelationMember m : r.getMembers()) {
    351351            if (m.member.incomplete || m.member.deleted) continue;
    352352
Note: See TracChangeset for help on using the changeset viewer.