/** \file
 *
 *  Contains the NavChart class declaration.
 *
 *  NavChart.h should only be included by NavChart.cpp
 *  Other classes should include NavChartIF.h
 *
 *  Copyright (c) 2007,2008,2009 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 */

#ifndef NAVCHART_H_
#define NAVCHART_H_

#include "component/SyncComponent.h"

class UniversalDataReader;
class UniversalDataWriter;
class DataWriter;

/**
 *  Over simplified NavChart component.  Uses NavChartDb
 *  to look up the altitude of the vehicle above sea-floor
 *  at its current location, as well as its offshore distance.
 *  Back-up to real altitude sensor.
 *
 *  NavChart.h should only be included by NavChart.cpp
 *  Other classes should include NavChartIF.h
 *
 *  \ingroup modules_derivation
 */
class NavChart : public SyncNavigationComponent
{
public:
    NavChart( const Module* module );
    virtual ~NavChart();

    /// Initialize function
    void initialize( void );

    /// Uninit function
    void uninitialize( void );

    /// The actual "payload" of the component
    void run();

protected:

    // Accessors
    UniversalDataReader* depthReader_;
    UniversalDataReader* latitudeReader_;
    UniversalDataReader* longitudeReader_;
    UniversalDataReader* latitudeFixReader_;
    UniversalDataWriter* heightAboveSeaFloorWriter_;
    UniversalDataWriter* seaFloorDepthWriter_;
    UniversalDataWriter* offshoreDistanceWriter_;

    DataWriter* nonUniversalHeightAboveSeaFloorWriter_; //For writing the component only height above sea floor when the universal isn't desired

private:
    ConfigReader* useChartAltitudeReader_;

    int useChartsForAltitude_;

    /// Holds the time of the last GPS fix update to allow the component post-process fixes
    /// that may come in while the NavChartDB is not ready.
    Timestamp lastFixTime_;

    /// Returns true when a new GPS fix is detected.
    bool gotFix( void );

};

#endif /*NAVCHART_H_*/
