IonoModelStore.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: IonoModelStore.cpp 70 2006-08-01 18:36:21Z ehagen $"
00002 
00003 
00004 
00005 //============================================================================
00006 //
00007 //  This file is part of GPSTk, the GPS Toolkit.
00008 //
00009 //  The GPSTk is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU Lesser General Public License as published
00011 //  by the Free Software Foundation; either version 2.1 of the License, or
00012 //  any later version.
00013 //
00014 //  The GPSTk is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 //  GNU Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with GPSTk; if not, write to the Free Software Foundation,
00021 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //  
00023 //  Copyright 2004, The University of Texas at Austin
00024 //
00025 //============================================================================
00026 
00027 //============================================================================
00028 //
00029 //This software developed by Applied Research Laboratories at the University of
00030 //Texas at Austin, under contract to an agency or agencies within the U.S. 
00031 //Department of Defense. The U.S. Government retains all rights to use,
00032 //duplicate, distribute, disclose, or release this software. 
00033 //
00034 //Pursuant to DoD Directive 523024 
00035 //
00036 // DISTRIBUTION STATEMENT A: This software has been approved for public 
00037 //                           release, distribution is unlimited.
00038 //
00039 //=============================================================================
00040 
00041 
00042 
00043 
00044 
00045 
00051 #include "IonoModelStore.hpp"
00052 
00053 using namespace std;
00054 
00055 namespace gpstk
00056 {
00057    bool IonoModelStore::addIonoModel(const DayTime& mt, const IonoModel& im)
00058       throw()
00059    {
00060       if (!im.isValid())
00061          return false;
00062       
00063       IonoModelMap::const_iterator i = ims.upper_bound(mt);
00064       if (!ims.empty() && i != ims.begin())
00065       {
00066             // compare to previous stored model and if they have the
00067             // the same alpha and beta parameters don't store it
00068          i--;
00069          if (im == i->second)
00070             return false;
00071       }
00072       ims[mt] = im;
00073       return true;
00074    }
00075       
00076    double IonoModelStore::getCorrection(const DayTime& time,
00077                                         const Geodetic& rxgeo,
00078                                         double svel,
00079                                         double svaz,
00080                                         IonoModel::Frequency freq) const
00081       throw(IonoModelStore::NoIonoModelFound)
00082    {
00083       IonoModelMap::const_iterator i = ims.upper_bound(time);
00084       if (!ims.empty() && i != ims.begin())
00085       {
00086          i--;
00087          return i->second.getCorrection(time, rxgeo, svel, svaz, freq);
00088       }
00089       else
00090       {
00091          NoIonoModelFound e;
00092          GPSTK_THROW(e);
00093       }
00094    }
00095 }

Generated on Tue May 22 03:30:59 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1