Uploaded image for project: 'OpenTrafficSim'
  1. OpenTrafficSim
  2. OTS-237

Clone of CrossSectionLink adds CrossSectionElements twice

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Unresolved
    • Labels:
      None

      Description

      The clone() method of the CrossSectionLink loops over the CrossSectionElements and adds the CrossSectioonElement to the Link:

          protected CrossSectionLink(final Network newNetwork, final OTSSimulatorInterface newSimulator, final boolean animation,
                  final CrossSectionLink link) throws NetworkException
          {
              super(newNetwork, newSimulator, animation, link);
              this.laneKeepingPolicy = link.laneKeepingPolicy;
              for (CrossSectionElement cse : link.crossSectionElementList)
              {
                  addCrossSectionElement(cse.clone(this, newSimulator, animation));
              }
          }
      

      However, the CrossSectionElement adds itself also to the CrossSectionLink when being generated in its constructor:

              this.parentLink.addCrossSectionElement(this);
      

        Attachments

          Activity

            People

            • Assignee:
              averbraeck Alexander Verbraeck
              Reporter:
              averbraeck Alexander Verbraeck
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 15 minutes
                15m
                Remaining:
                0m
                Logged:
                Time Not Required
                Not Specified