public void recalculate() {
    Enumeration<Editable> numer = getSegments().elements();
    WorldLocation thisOrigin = getOrigin();
    HiResDate thisDate = getStartDate();
    while (numer.hasMoreElements()) {
      Editable editable = (Editable) numer.nextElement();
      PlanningSegment seg = (PlanningSegment) editable;

      PlanningCalc theCalc = null;
      int model = seg.getCalculation();
      switch (model) {
        case PlanningLegCalcModelPropertyEditor.RANGE_SPEED:
          theCalc = new FromRangeSpeed();
          break;
        case PlanningLegCalcModelPropertyEditor.RANGE_TIME:
          theCalc = new FromRangeTime();
          break;
        case PlanningLegCalcModelPropertyEditor.SPEED_TIME:
          theCalc = new FromSpeedTime();
          break;
      }

      // see if this is the closing segment
      if (seg instanceof ClosingSegment) {
        // what's the range and bearing back to the origin
        WorldVector offset = getOrigin().subtract(thisOrigin);

        // and store it.
        seg.setSpeedSilent(new WorldSpeed(12, WorldSpeed.Kts));
        seg.setDistanceSilent(new WorldDistance(offset.getRange(), WorldDistance.DEGS));
        seg.setCourseSilent(MWC.Algorithms.Conversions.Rads2Degs(offset.getBearing()));
        seg.setDepthSilent(new WorldDistance(offset.getDepth(), WorldDistance.METRES));
      }

      theCalc.construct(seg, thisOrigin, thisDate);

      // did we generate anything?
      if (seg.size() > 0) {
        // ok, now update the date/location
        thisOrigin = seg.last().getBounds().getCentre();
        thisDate = seg.endDTG();
      }
    }

    // ok, sort out the symbol & label freq
    HiResDate symFreq = this.getSymbolFrequency();
    HiResDate labelFreq = this.getLabelFrequency();

    this.setSymbolFrequency(new HiResDate(0));
    this.setLabelFrequency(new HiResDate(0));

    // and restore them
    setSymbolFrequency(symFreq);
    setLabelFrequency(labelFreq);
  }
  @Override
  public void findNearestHotSpotIn(
      Point cursorPos,
      WorldLocation cursorLoc,
      ComponentConstruct currentNearest,
      Layer parentLayer) {
    // initialise thisDist, since we're going to be over-writing it
    WorldDistance thisDist = new WorldDistance(0, WorldDistance.DEGS);

    Enumeration<Editable> numer = getSegments().elements();
    while (numer.hasMoreElements()) {
      final PlanningSegment thisSeg = (PlanningSegment) numer.nextElement();
      if (thisSeg.getVisible()) {
        // produce a location for the end
        FixWrapper endFix = (FixWrapper) thisSeg.last();
        if (endFix != null) {

          // how far away is it?
          thisDist = endFix.getLocation().rangeFrom(cursorLoc, thisDist);

          final WorldLocation fixLocation =
              new WorldLocation(endFix.getLocation()) {
                private static final long serialVersionUID = 1L;

                @Override
                public void addToMe(WorldVector delta) {
                  super.addToMe(delta);

                  // so, what's the bearing back to the leg start?
                  double newBearing = super.bearingFrom(thisSeg.first().getBounds().getCentre());

                  newBearing = MWC.Algorithms.Conversions.Rads2Degs(newBearing);

                  // limit the bearing to the nearest 5 deg marker
                  int m = ((int) newBearing / 10);
                  newBearing = m * 10d;

                  // trim it to being positive
                  if (newBearing < 0) newBearing += 360;

                  thisSeg.setCourse(newBearing);
                }
              };

          // try range
          currentNearest.checkMe(this, thisDist, null, parentLayer, fixLocation);
        }
      }
    }
  }