Ignore:
Timestamp:
2005-10-27T00:38:03+02:00 (18 years ago)
Author:
imi
Message:
  • added commands to support undo later
  • added Edit-Layer concept
  • painting of deleted objects
File:
1 edited

Legend:

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

    r21 r23  
    11package org.openstreetmap.josm.data.osm;
    2 
    3 import java.util.Collection;
    4 import java.util.Collections;
    5 import java.util.LinkedList;
    62
    73import org.openstreetmap.josm.data.osm.visitor.Visitor;
     
    2622
    2723        /**
    28          * The tracks, this line segment is part of.
    29          */
    30         transient Collection<Track> parent = new LinkedList<Track>();
    31 
    32         /**
    3324         * Create an line segment from the given starting and ending node
    3425         * @param start Starting node of the line segment.
     
    3829                this.start = start;
    3930                this.end = end;
    40                 start.parentSegment.add(this);
    41                 end.parentSegment.add(this);
    42         }
    43 
    44         /**
    45          * Return all parent tracks this line segment is part of. The list is readonly.
    46          */
    47         public Collection<Track> getParents() {
    48                 return Collections.unmodifiableCollection(parent);
    49         }
    50 
    51         public void setStart(Node start) {
    52                 this.start.parentSegment.remove(this);
    53                 this.start = start;
    54                 start.parentSegment.add(this);
    55         }
    56         public Node getStart() {
    57                 return start;
    58         }
    59         public void setEnd(Node end) {
    60                 this.end.parentSegment.remove(this);
    61                 this.end = end;
    62                 end.parentSegment.add(this);
    63         }
    64         public Node getEnd() {
    65                 return end;
    66         }
    67 
    68         /**
    69          * The LineSegment is going to be destroyed. Unlink all back references.
    70          */
    71         public void destroy() {
    72                 start.parentSegment.remove(this);
    73                 end.parentSegment.remove(this);
    74         }
    75 
    76         /**
    77          * Return start and end in a list.
    78          */
    79         @Override
    80         public Collection<Node> getAllNodes() {
    81                 LinkedList<Node> nodes = new LinkedList<Node>();
    82                 nodes.add(getStart());
    83                 nodes.add(getEnd());
    84                 return nodes;
    8531        }
    8632
Note: See TracChangeset for help on using the changeset viewer.