/*
 *    Debrief - the Open Source Maritime Analysis Application
 *    http://debrief.info
 *
 *    (C) 2000-2014, PlanetMayo Ltd
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the Eclipse Public License v1.0
 *    (http://www.eclipse.org/legal/epl-v10.html)
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 */
package org.mwc.debrief.track_shift.views;

import org.mwc.debrief.track_shift.controls.ZoneChart.ColorProvider;
import org.mwc.debrief.track_shift.controls.ZoneChart.ZoneSlicer;

public class FrequencyResidualsView extends BaseStackedDotsView
{
  public FrequencyResidualsView()
  {
    super(false, true);
  }

  protected String getUnits()
  {
    return "Hz";
  }

  protected String getType()
  {
    return "Frequency";
  }

  protected void updateData(final boolean updateDoublets)
  {
    // note: we now ignore the parent doublets value.
    // this is because we need to regenerate the target fix each time.
    // For frequency data the target fix is interpolated - this means
    // it doesn't update as we drag the solution.  We need to 
    // regenerate the interpolated fix, to ensure we're using up-to-date
    // values
    boolean updateDoubletsVal = true;
    
    // update the current datasets
    _myHelper.updateFrequencyData(_dotPlot, _linePlot, _myTrackDataProvider,
        _onlyVisible.isChecked(), _holder, this, updateDoubletsVal);
  }

  @Override
  protected ZoneSlicer getOwnshipZoneSlicer(ColorProvider blueProv)
  {
    // don't bother, it's for bearing data
    return null;
  }
  
  @Override
  protected String formatValue(double value)
  {
    return MWC.Utilities.TextFormatting.GeneralFormat
        .formatTwoDecimalPlaces(value);
  }

  @Override
  protected boolean allowDisplayOfTargetOverview()
  {
    return false;
  }

  @Override
  protected boolean allowDisplayOfZoneChart()
  {
    return false;
  }

}

@@ -577,16 +577,244 @@
 ews;%0D%0A%0D%0A
+import org.eclipse.jface.action.Action;%0D%0Aimport org.eclipse.jface.action.IAction;%0D%0Aimport org.eclipse.jface.action.IToolBarManager;%0D%0Aimport org.mwc.cmap.core.CorePlugin;%0D%0Aimport org.mwc.debrief.track_shift.TrackShiftActivator;%0D%0A
 import o
@@ -871,24 +871,24 @@
 rProvider;%0D%0A
-
 import org.m
@@ -1012,16 +1012,50 @@
 iew%0D%0A%7B%0D%0A
+  private Action calcBaseFreq;%0D%0A%0D%0A
   public
@@ -1820,16 +1820,16 @@
 vider,%0D%0A
-
         
@@ -1889,32 +1889,872 @@
 tsVal);%0D%0A  %7D%0D%0A%0D%0A
+%0D%0A  @Override%0D%0A  protected void addExtras(final IToolBarManager toolBarManager)%0D%0A  %7B%0D%0A    super.addExtras(toolBarManager);%0D%0A    toolBarManager.add(calcBaseFreq);%0D%0A  %7D%0D%0A  %0D%0A  @Override%0D%0A  protected void makeActions()%0D%0A  %7B%0D%0A    super.makeActions();%0D%0A    %0D%0A    // now frequency calculator%0D%0A    calcBaseFreq = new Action(%22Calculate base frequency%22, IAction.AS_PUSH_BUTTON)%0D%0A    %7B%0D%0A      @Override%0D%0A      public void run()%0D%0A      %7B%0D%0A        super.run();%0D%0A%0D%0A        calculateBaseFreq();%0D%0A      %7D%0D%0A    %7D;%0D%0A    calcBaseFreq.setChecked(true);%0D%0A    calcBaseFreq.setToolTipText(%22Calculate the base frequency of the visible frequency cuts%22);%0D%0A    calcBaseFreq.setImageDescriptor(CorePlugin%0D%0A        .getImageDescriptor(%22icons/24/calculator.png%22));%0D%0A  %7D%0D%0A%0D%0A  protected void calculateBaseFreq()%0D%0A  %7B%0D%0A    // TODO Auto-generated method stub%0D%0A    %0D%0A  %7D%0D%0A%0D%0A
   @Override%0D%0A  p

Introduce freq calculator button